codex-to-im 1.0.16 → 1.0.18

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.
package/README.md CHANGED
@@ -86,7 +86,7 @@ codex-to-im stop
86
86
  /t all
87
87
  ```
88
88
 
89
- 查看全部桌面线程。
89
+ 查看最多 200 条桌面线程。
90
90
  再通过:
91
91
 
92
92
  ```text
@@ -120,8 +120,8 @@ codex-to-im stop
120
120
 
121
121
  - `/` 或 `/status`:查看当前会话、线程、模型、模式、思考级别、共享镜像状态。
122
122
  - `/t`:查看最近 10 条桌面线程。
123
- - `/t all`:查看全部桌面线程。
124
- - `/t n 100`:查看最近 100 条桌面线程。
123
+ - `/t all`:查看最多 200 条桌面线程。
124
+ - `/t n 100`:查看最近 100 条桌面线程,最多 200 条。
125
125
  - `/t 1`:切换到第 1 条桌面线程。
126
126
  - `/t 0`:切换到当前聊天的临时线程。
127
127
  - `/new`:在当前正式会话目录下新建线程。
@@ -150,7 +150,7 @@ codex-to-im stop
150
150
  - `/new` 创建的是 IM 线程,当前只保证在 IM 中可继续;不保证会自动出现在 Codex Desktop 会话列表中。
151
151
  - 一个会话只能绑定一个聊天,跨飞书/微信也互斥。
152
152
  - 飞书附件当前支持图片和文件;视频目前按文件发送,不承诺原生预览。
153
- - `/t` 默认只显示最近 10 条桌面线程;需要更多时用 `/t all` `/t n 100`。
153
+ - `/t` 默认只显示最近 10 条桌面线程;`/t all` 最多返回 200 条,`/t n 100` 也最多返回 200 条。
154
154
 
155
155
  ## 更多文档
156
156
 
package/README_EN.md CHANGED
@@ -136,7 +136,7 @@ Useful commands:
136
136
 
137
137
  - `/` / `/status` shows the current session
138
138
  - `/h` / `/help` shows help
139
- - `/t` / `/threads` lists the most recent 10 desktop threads, `/t all` / `/threads all` lists all of them, `/t n 100` / `/threads n 100` lists the most recent 100 desktop threads, and `/t 1` / `/thread 1` binds the first one
139
+ - `/t` / `/threads` lists the most recent 10 desktop threads, `/t all` / `/threads all` lists up to 200 of them, `/t n 100` / `/threads n 100` lists the most recent 100 desktop threads (also capped at 200), and `/t 1` / `/thread 1` binds the first one
140
140
  - `/n` / `/new` creates a new thread in the current formal session directory; these IM-created threads are only guaranteed to continue inside IM and will not automatically appear in the Codex Desktop thread list
141
141
  - `/n proj1` / `/new proj1` creates a new project session under the default workspace root
142
142
  - `/m` / `/mode` shows or changes the current mode; options: `code` / `plan` / `ask`
package/dist/daemon.mjs CHANGED
@@ -5118,9 +5118,27 @@ function htmlToFeishuMarkdown(html) {
5118
5118
  }
5119
5119
  function buildToolProgressMarkdown(tools) {
5120
5120
  if (tools.length === 0) return "";
5121
- const lines = tools.map((tc) => {
5122
- const icon = tc.status === "running" ? "\u{1F504}" : tc.status === "complete" ? "\u2705" : "\u274C";
5123
- return `${icon} \`${tc.name}\``;
5121
+ const grouped = /* @__PURE__ */ new Map();
5122
+ for (const tool of tools) {
5123
+ const key = tool.name || "tool";
5124
+ const bucket = grouped.get(key) || { running: 0, complete: 0, error: 0 };
5125
+ if (tool.status === "running") bucket.running += 1;
5126
+ else if (tool.status === "error") bucket.error += 1;
5127
+ else bucket.complete += 1;
5128
+ grouped.set(key, bucket);
5129
+ }
5130
+ const lines = Array.from(grouped.entries()).map(([name, counts]) => {
5131
+ const total = counts.running + counts.complete + counts.error;
5132
+ const icon = counts.running > 0 ? "\u{1F504}" : counts.error > 0 ? "\u274C" : "\u2705";
5133
+ const countSuffix = total > 1 ? ` \xD7${total}` : "";
5134
+ const detailParts = [];
5135
+ if (counts.running > 0) detailParts.push(`\u8FD0\u884C\u4E2D ${counts.running}`);
5136
+ if (counts.error > 0) detailParts.push(`\u5F02\u5E38 ${counts.error}`);
5137
+ if ((counts.running > 0 || counts.error > 0) && counts.complete > 0) {
5138
+ detailParts.push(`\u5B8C\u6210 ${counts.complete}`);
5139
+ }
5140
+ const detailSuffix = detailParts.length > 0 ? `\uFF08${detailParts.join(" / ")}\uFF09` : "";
5141
+ return `${icon} \`${name}\`${countSuffix}${detailSuffix}`;
5124
5142
  });
5125
5143
  return lines.join("\n");
5126
5144
  }
@@ -16759,6 +16777,8 @@ var HISTORY_SUMMARY_TTL_MS = 24 * 60 * 60 * 1e3;
16759
16777
  var REASONING_LEVELS = ["minimal", "low", "medium", "high", "xhigh"];
16760
16778
  var MODE_OPTIONS_TEXT = "\u53EF\u9009\uFF1A`code`\uFF08\u76F4\u63A5\u6267\u884C\uFF0C\u9ED8\u8BA4\uFF09 `plan`\uFF08\u5148\u5206\u6790\u518D\u884C\u52A8\uFF09 `ask`\uFF08\u8F7B\u5BF9\u8BDD / \u8349\u7A3F\uFF09";
16761
16779
  var REASONING_OPTIONS_TEXT = "\u53EF\u9009\uFF1A`1=minimal` `2=low` `3=medium` `4=high` `5=xhigh`";
16780
+ var DEFAULT_DESKTOP_THREAD_LIST_LIMIT = 10;
16781
+ var MAX_DESKTOP_THREAD_LIST_LIMIT = 200;
16762
16782
  var MIRROR_POLL_INTERVAL_MS = 2500;
16763
16783
  var MIRROR_WATCH_DEBOUNCE_MS = 350;
16764
16784
  var MIRROR_EVENT_BATCH_LIMIT = 8;
@@ -16830,20 +16850,21 @@ function resolveByIndexOrPrefix(raw, items, getId) {
16830
16850
  }
16831
16851
  return { match: null, ambiguous: false };
16832
16852
  }
16833
- function getDisplayedDesktopThreads(limit = 10) {
16853
+ function getDisplayedDesktopThreads(limit = DEFAULT_DESKTOP_THREAD_LIST_LIMIT) {
16834
16854
  return listDesktopSessions(limit);
16835
16855
  }
16836
16856
  function parseDesktopThreadListArgs(args) {
16837
16857
  const trimmed = args.trim().toLowerCase();
16838
16858
  if (!trimmed) {
16839
- return { showAll: false, limit: 10 };
16859
+ return { showAll: false, limit: DEFAULT_DESKTOP_THREAD_LIST_LIMIT };
16840
16860
  }
16841
16861
  if (trimmed === "all") {
16842
- return { showAll: true, limit: 0 };
16862
+ return { showAll: true, limit: MAX_DESKTOP_THREAD_LIST_LIMIT };
16843
16863
  }
16844
16864
  const match2 = trimmed.match(/^n\s+(\d+)$/);
16845
16865
  if (!match2) return null;
16846
- const limit = Number(match2[1]);
16866
+ const requestedLimit = Number(match2[1]);
16867
+ const limit = Math.min(requestedLimit, MAX_DESKTOP_THREAD_LIST_LIMIT);
16847
16868
  if (!Number.isInteger(limit) || limit < 1) return null;
16848
16869
  return { showAll: false, limit };
16849
16870
  }
@@ -16957,7 +16978,7 @@ function buildIndexedCommandList(title, items, footer = [], markdown = false) {
16957
16978
  }
16958
16979
  function buildDesktopThreadsCommandResponse(desktopSessions, markdown, showAll, limit = 10) {
16959
16980
  return buildIndexedCommandList(
16960
- showAll ? "\u5168\u90E8\u684C\u9762\u4F1A\u8BDD" : `\u6700\u8FD1 ${limit} \u6761\u684C\u9762\u4F1A\u8BDD`,
16981
+ showAll ? `\u684C\u9762\u4F1A\u8BDD\uFF08\u6700\u591A ${MAX_DESKTOP_THREAD_LIST_LIMIT} \u6761\uFF09` : `\u6700\u8FD1 ${limit} \u6761\u684C\u9762\u4F1A\u8BDD`,
16961
16982
  desktopSessions.map((session) => ({
16962
16983
  heading: session.title || "\u672A\u547D\u540D\u7EBF\u7A0B",
16963
16984
  details: [
@@ -16967,11 +16988,11 @@ function buildDesktopThreadsCommandResponse(desktopSessions, markdown, showAll,
16967
16988
  })),
16968
16989
  showAll ? [
16969
16990
  "\u53D1\u9001 `/t 1` \u53EF\u63A5\u7BA1\u7B2C 1 \u6761\u684C\u9762\u4F1A\u8BDD\u3002",
16970
- "\u53D1\u9001 `/t` \u53EF\u53EA\u770B\u6700\u8FD1 10 \u6761\u3002"
16991
+ `\u53D1\u9001 \`/t\` \u53EF\u53EA\u770B\u6700\u8FD1 ${DEFAULT_DESKTOP_THREAD_LIST_LIMIT} \u6761\u3002`
16971
16992
  ] : [
16972
16993
  "\u53D1\u9001 `/t 1` \u53EF\u63A5\u7BA1\u7B2C 1 \u6761\u684C\u9762\u4F1A\u8BDD\u3002",
16973
- "\u53D1\u9001 `/t all` \u53EF\u67E5\u770B\u5168\u90E8\u684C\u9762\u4F1A\u8BDD\u3002",
16974
- "\u53D1\u9001 `/t n 100` \u53EF\u67E5\u770B\u6700\u8FD1 100 \u6761\u684C\u9762\u4F1A\u8BDD\u3002"
16994
+ `\u53D1\u9001 \`/t all\` \u53EF\u67E5\u770B\u6700\u591A ${MAX_DESKTOP_THREAD_LIST_LIMIT} \u6761\u684C\u9762\u4F1A\u8BDD\u3002`,
16995
+ `\u53D1\u9001 \`/t n 100\` \u53EF\u67E5\u770B\u6700\u8FD1 100 \u6761\u684C\u9762\u4F1A\u8BDD\uFF08\u6700\u591A ${MAX_DESKTOP_THREAD_LIST_LIMIT} \u6761\uFF09\u3002`
16975
16996
  ],
16976
16997
  markdown
16977
16998
  );
@@ -18959,11 +18980,11 @@ async function handleCommand(adapter, msg, text2) {
18959
18980
  break;
18960
18981
  }
18961
18982
  if (!args) {
18962
- response = "\u7528\u6CD5\uFF1A/thread <\u5E8F\u53F7>\uFF0C\u6216 /thread 0 \u8FDB\u5165\u4E34\u65F6\u8349\u7A3F\u7EBF\u7A0B\uFF1B\u53D1\u9001 /t all \u67E5\u770B\u5168\u90E8\uFF0C\u6216 /t n 100 \u67E5\u770B\u6700\u8FD1 100 \u6761\u684C\u9762\u4F1A\u8BDD";
18983
+ response = `\u7528\u6CD5\uFF1A/thread <\u5E8F\u53F7>\uFF0C\u6216 /thread 0 \u8FDB\u5165\u4E34\u65F6\u8349\u7A3F\u7EBF\u7A0B\uFF1B\u53D1\u9001 /t all \u67E5\u770B\u6700\u591A ${MAX_DESKTOP_THREAD_LIST_LIMIT} \u6761\uFF0C\u6216 /t n 100 \u67E5\u770B\u6700\u8FD1 100 \u6761\u684C\u9762\u4F1A\u8BDD`;
18963
18984
  break;
18964
18985
  }
18965
18986
  if (args === "all") {
18966
- const desktopSessions = getDisplayedDesktopThreads(void 0);
18987
+ const desktopSessions = getDisplayedDesktopThreads(MAX_DESKTOP_THREAD_LIST_LIMIT);
18967
18988
  if (desktopSessions.length === 0) {
18968
18989
  response = "\u6CA1\u6709\u627E\u5230\u684C\u9762\u4F1A\u8BDD\u3002\u5148\u5728 Codex Desktop App \u4E2D\u6253\u5F00\u4E00\u4E2A\u4F1A\u8BDD\uFF0C\u518D\u56DE\u6765\u8BD5\u4E00\u6B21\u3002";
18969
18990
  break;
@@ -18975,7 +18996,7 @@ async function handleCommand(adapter, msg, text2) {
18975
18996
  );
18976
18997
  break;
18977
18998
  }
18978
- const displayedThreads = getDisplayedDesktopThreads(10);
18999
+ const displayedThreads = getDisplayedDesktopThreads(DEFAULT_DESKTOP_THREAD_LIST_LIMIT);
18979
19000
  const threadPick = resolveByIndexOrPrefix(args, displayedThreads, (session) => session.threadId);
18980
19001
  if (threadPick.ambiguous) {
18981
19002
  response = "\u5339\u914D\u5230\u591A\u4E2A\u684C\u9762\u4F1A\u8BDD\uFF0C\u8BF7\u5148\u53D1\u9001 `/t` \u67E5\u770B\u5217\u8868\uFF0C\u518D\u7528 `/t 1` \u8FD9\u79CD\u5E8F\u53F7\u5207\u6362\u3002";
@@ -19033,11 +19054,11 @@ async function handleCommand(adapter, msg, text2) {
19033
19054
  case "/threads": {
19034
19055
  const listArgs = parseDesktopThreadListArgs(args);
19035
19056
  if (!listArgs) {
19036
- response = "\u7528\u6CD5\uFF1A/threads\u3001/threads all\u3001/threads n 100";
19057
+ response = `\u7528\u6CD5\uFF1A/threads\u3001/threads all\u3001/threads n 100\uFF08\u6700\u591A ${MAX_DESKTOP_THREAD_LIST_LIMIT} \u6761\uFF09`;
19037
19058
  break;
19038
19059
  }
19039
19060
  const { showAll, limit } = listArgs;
19040
- const desktopSessions = getDisplayedDesktopThreads(showAll ? void 0 : limit);
19061
+ const desktopSessions = getDisplayedDesktopThreads(limit);
19041
19062
  if (desktopSessions.length === 0) {
19042
19063
  response = showAll ? "\u6CA1\u6709\u627E\u5230\u684C\u9762\u4F1A\u8BDD\u3002\u5148\u5728 Codex Desktop App \u4E2D\u6253\u5F00\u4E00\u4E2A\u4F1A\u8BDD\uFF0C\u518D\u56DE\u6765\u8BD5\u4E00\u6B21\u3002" : "\u6CA1\u6709\u627E\u5230\u6700\u8FD1\u684C\u9762\u4F1A\u8BDD\u3002\u5148\u5728 Codex Desktop App \u4E2D\u6253\u5F00\u4E00\u4E2A\u4F1A\u8BDD\uFF0C\u518D\u56DE\u6765\u8BD5\u4E00\u6B21\u3002";
19043
19064
  break;
@@ -19417,9 +19438,9 @@ ${truncateHistoryContent(formatStoredMessageContent(message.content))}`;
19417
19438
  "**\u5E38\u7528**",
19418
19439
  "- `/` \u5F53\u524D\u4F1A\u8BDD",
19419
19440
  "- `/h` \u5E2E\u52A9",
19420
- "- `/t` \u6700\u8FD1 10 \u6761\u684C\u9762\u4F1A\u8BDD",
19421
- "- `/t all` \u5168\u90E8\u684C\u9762\u4F1A\u8BDD",
19422
- "- `/t n 100` \u6700\u8FD1 100 \u6761\u684C\u9762\u4F1A\u8BDD",
19441
+ `- \`/t\` \u6700\u8FD1 ${DEFAULT_DESKTOP_THREAD_LIST_LIMIT} \u6761\u684C\u9762\u4F1A\u8BDD`,
19442
+ `- \`/t all\` \u6700\u591A ${MAX_DESKTOP_THREAD_LIST_LIMIT} \u6761\u684C\u9762\u4F1A\u8BDD`,
19443
+ `- \`/t n 100\` \u6700\u8FD1 100 \u6761\u684C\u9762\u4F1A\u8BDD\uFF08\u6700\u591A ${MAX_DESKTOP_THREAD_LIST_LIMIT} \u6761\uFF09`,
19423
19444
  "- `/t 1` \u63A5\u7BA1\u7B2C 1 \u6761\u4F1A\u8BDD",
19424
19445
  "- `/n` \u5728\u5F53\u524D\u5DE5\u4F5C\u76EE\u5F55\u4E0B\u65B0\u5EFA\u7EBF\u7A0B\uFF08\u4EC5\u4FDD\u8BC1 IM \u53EF\u7EE7\u7EED\uFF0C\u4E0D\u4F1A\u81EA\u52A8\u51FA\u73B0\u5728\u684C\u9762\u4F1A\u8BDD\u5217\u8868\uFF09",
19425
19446
  "- `/n proj1` \u5728\u9ED8\u8BA4\u5DE5\u4F5C\u7A7A\u95F4\u4E0B\u65B0\u5EFA\u9879\u76EE\u4F1A\u8BDD",
@@ -8767,8 +8767,8 @@ function renderHtml() {
8767
8767
  <div class="command-item"><div class="command-col-command"><code>/</code></div><div class="command-col-original"><code>/status</code></div><div class="command-col-desc">\u67E5\u770B\u5F53\u524D\u4F1A\u8BDD\u3002</div></div>
8768
8768
  <div class="command-item"><div class="command-col-command"><code>/h</code></div><div class="command-col-original"><code>/help</code></div><div class="command-col-desc">\u67E5\u770B\u5E2E\u52A9\u3002</div></div>
8769
8769
  <div class="command-item"><div class="command-col-command"><code>/t</code></div><div class="command-col-original"><code>/threads</code></div><div class="command-col-desc">\u5217\u51FA\u6700\u8FD1 10 \u6761\u684C\u9762\u4F1A\u8BDD\u3002</div></div>
8770
- <div class="command-item"><div class="command-col-command"><code>/t all</code></div><div class="command-col-original"><code>/threads all</code></div><div class="command-col-desc">\u5217\u51FA\u5168\u90E8\u684C\u9762\u4F1A\u8BDD\u3002</div></div>
8771
- <div class="command-item"><div class="command-col-command"><code>/t n 100</code></div><div class="command-col-original"><code>/threads n 100</code></div><div class="command-col-desc">\u5217\u51FA\u6700\u8FD1 100 \u6761\u684C\u9762\u4F1A\u8BDD\u3002</div></div>
8770
+ <div class="command-item"><div class="command-col-command"><code>/t all</code></div><div class="command-col-original"><code>/threads all</code></div><div class="command-col-desc">\u6700\u591A\u5217\u51FA 200 \u6761\u684C\u9762\u4F1A\u8BDD\u3002</div></div>
8771
+ <div class="command-item"><div class="command-col-command"><code>/t n 100</code></div><div class="command-col-original"><code>/threads n 100</code></div><div class="command-col-desc">\u5217\u51FA\u6700\u8FD1 100 \u6761\u684C\u9762\u4F1A\u8BDD\uFF0C\u6700\u591A 200 \u6761\u3002</div></div>
8772
8772
  <div class="command-item"><div class="command-col-command"><code>/t &lt;\u5E8F\u53F7&gt;</code></div><div class="command-col-original"><code>/thread &lt;\u5E8F\u53F7&gt;</code></div><div class="command-col-desc">\u6309\u5E8F\u53F7\u63A5\u7BA1\u684C\u9762\u4F1A\u8BDD\u3002</div></div>
8773
8773
  <div class="command-item"><div class="command-col-command"><code>/n [\u7EDD\u5BF9\u8DEF\u5F84 | \u9879\u76EE\u540D]</code></div><div class="command-col-original"><code>/new [\u7EDD\u5BF9\u8DEF\u5F84 | \u9879\u76EE\u540D]</code></div><div class="command-col-desc">\u4E0D\u5E26\u53C2\u6570\u65F6\u5728\u5F53\u524D\u6B63\u5F0F\u4F1A\u8BDD\u76EE\u5F55\u4E0B\u65B0\u5EFA\u7EBF\u7A0B\uFF1B\u76F8\u5BF9\u9879\u76EE\u540D\u4F1A\u5728\u201C\u9ED8\u8BA4\u5DE5\u4F5C\u7A7A\u95F4\u201D\u4E0B\u521B\u5EFA\u76EE\u5F55\uFF1B\u5F53\u524D\u82E5\u662F\u4E34\u65F6\u8349\u7A3F\u7EBF\u7A0B\u5219\u4F1A\u62A5\u9519\u3002\u901A\u8FC7 IM \u521B\u5EFA\u7684\u65B0\u7EBF\u7A0B\u5F53\u524D\u53EA\u4FDD\u8BC1\u5728 IM \u4E2D\u53EF\u7EE7\u7EED\uFF0C\u4E0D\u4F1A\u81EA\u52A8\u51FA\u73B0\u5728 Codex Desktop \u4F1A\u8BDD\u5217\u8868\u4E2D\u3002</div></div>
8774
8774
  <div class="command-item"><div class="command-col-command"><code>\u76F4\u63A5\u53D1\u9001\u6587\u672C</code></div><div class="command-col-original">\u2014</div><div class="command-col-desc">\u7EE7\u7EED\u5F53\u524D\u5DF2\u7ED1\u5B9A\u4F1A\u8BDD\uFF1B\u672A\u7ED1\u5B9A\u65F6\u4F1A\u81EA\u52A8\u8FDB\u5165\u4E34\u65F6\u8349\u7A3F\u7EBF\u7A0B\u3002</div></div>
@@ -227,7 +227,7 @@ codex-to-im stop
227
227
  - IM 里也支持一组短命令别名:
228
228
  - `/` / `/status` 当前会话
229
229
  - `/h` / `/help` 帮助
230
- - `/t` / `/threads` 最近 10 条桌面会话,`/t all` / `/threads all` 查看全部,`/t n 100` / `/threads n 100` 查看最近 100 条,`/t 1` / `/thread 1` 接管
230
+ - `/t` / `/threads` 最近 10 条桌面会话,`/t all` / `/threads all` 最多查看 200 条,`/t n 100` / `/threads n 100` 查看最近 100 条(同样最多 200 条),`/t 1` / `/thread 1` 接管
231
231
  - `/n` / `/new` 在当前正式会话目录下新建线程;这类线程当前只保证在 IM 中可继续,不会自动出现在 Codex Desktop 会话列表中
232
232
  - `/n proj1` / `/new proj1` 新建项目会话
233
233
  - `/m` / `/mode` 查看或切换模式,可选 `code` / `plan` / `ask`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codex-to-im",
3
- "version": "1.0.16",
3
+ "version": "1.0.18",
4
4
  "description": "Installable Codex-to-IM bridge with local setup UI and background service",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/zhangle1987/codex-to-im#readme",