claude-codex-wechat 0.1.11 → 0.1.12

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.
Files changed (2) hide show
  1. package/dist/server/cli.js +26 -6
  2. package/package.json +1 -1
@@ -2686,6 +2686,18 @@ var CodexAppServerClient = class {
2686
2686
  };
2687
2687
 
2688
2688
  // src/providers/codex/codexInteractiveRunner.ts
2689
+ function readAgentMessageItemId(value) {
2690
+ if (!value || typeof value !== "object") return void 0;
2691
+ const record = value;
2692
+ if (typeof record.itemId === "string" && record.itemId) return record.itemId;
2693
+ if (typeof record.id === "string" && record.id) return record.id;
2694
+ if (record.item && typeof record.item === "object") {
2695
+ const item = record.item;
2696
+ if (typeof item.id === "string" && item.id) return item.id;
2697
+ if (typeof item.itemId === "string" && item.itemId) return item.itemId;
2698
+ }
2699
+ return void 0;
2700
+ }
2689
2701
  function readThreadId(value) {
2690
2702
  if (!value || typeof value !== "object") return void 0;
2691
2703
  const record = value;
@@ -2726,7 +2738,7 @@ var CodexInteractiveRunner = class {
2726
2738
  sessionName: input.options?.sessionName,
2727
2739
  cwd: input.cwd,
2728
2740
  status: "idle",
2729
- pendingText: []
2741
+ pendingMessages: []
2730
2742
  };
2731
2743
  this.sessions.set(input.bridgeSessionId, session);
2732
2744
  return session;
@@ -2735,7 +2747,7 @@ var CodexInteractiveRunner = class {
2735
2747
  const session = this.sessions.get(input.bridgeSessionId);
2736
2748
  if (!session) throw new Error(`codex_session_not_found:${input.bridgeSessionId}`);
2737
2749
  const client = await this.ensureClient(session);
2738
- session.pendingText = [];
2750
+ session.pendingMessages = [];
2739
2751
  session.activeTurnId = void 0;
2740
2752
  session.turnCompletedPromise = new Promise((resolve2) => {
2741
2753
  session.turnCompletedResolver = resolve2;
@@ -2784,8 +2796,10 @@ var CodexInteractiveRunner = class {
2784
2796
  cwd: session.cwd
2785
2797
  });
2786
2798
  }
2787
- for (const text of session.pendingText) {
2788
- yield { type: "text_delta", text };
2799
+ for (const message of session.pendingMessages) {
2800
+ if (!message.text) continue;
2801
+ yield { type: "text_delta", text: message.text };
2802
+ yield { type: "message_done" };
2789
2803
  }
2790
2804
  yield {
2791
2805
  type: "session_state",
@@ -2797,7 +2811,6 @@ var CodexInteractiveRunner = class {
2797
2811
  status: "idle"
2798
2812
  }
2799
2813
  };
2800
- yield { type: "message_done" };
2801
2814
  }
2802
2815
  async stopSession(bridgeSessionId) {
2803
2816
  const session = this.sessions.get(bridgeSessionId);
@@ -2834,7 +2847,14 @@ var CodexInteractiveRunner = class {
2834
2847
  await client.initialize();
2835
2848
  client.onNotification("item/agentMessage/delta", (params) => {
2836
2849
  const record = params;
2837
- if (typeof record.delta === "string" && record.delta) session.pendingText.push(record.delta);
2850
+ if (typeof record.delta !== "string" || !record.delta) return;
2851
+ const itemId = readAgentMessageItemId(record) ?? `fallback-${session.pendingMessages.length}`;
2852
+ const last = session.pendingMessages.at(-1);
2853
+ if (last?.itemId === itemId) {
2854
+ last.text += record.delta;
2855
+ return;
2856
+ }
2857
+ session.pendingMessages.push({ itemId, text: record.delta });
2838
2858
  });
2839
2859
  client.onNotification("turn/started", (params) => {
2840
2860
  const turnId = readTurnId(params);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-codex-wechat",
3
- "version": "0.1.11",
3
+ "version": "0.1.12",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "bin": {