@linzumi/cli 0.0.66-beta → 0.0.68-beta

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
@@ -58,7 +58,7 @@ Install the CLI or run it with `npx`:
58
58
  ```bash
59
59
  npm install -g @linzumi/cli@latest
60
60
  npx -y @linzumi/cli@latest signup
61
- npx -y @linzumi/cli@0.0.66-beta --version
61
+ npx -y @linzumi/cli@0.0.68-beta --version
62
62
  linzumi --version
63
63
  ```
64
64
 
package/dist/index.js CHANGED
@@ -3292,23 +3292,25 @@ async function attachChannelSession(args) {
3292
3292
  });
3293
3293
  }
3294
3294
  break;
3295
- case "turn/completed":
3296
- if (turnId !== void 0) {
3297
- enqueueWebSearchProgressCompletion(args, state, turnId);
3298
- enqueueFileChangeCompletion(args, state, turnId);
3295
+ case "turn/completed": {
3296
+ const completedTurnId = turnId ?? inferThreadOnlyCompletedTurnId(args, state, threadId);
3297
+ if (completedTurnId !== void 0) {
3298
+ enqueueWebSearchProgressCompletion(args, state, completedTurnId);
3299
+ enqueueFileChangeCompletion(args, state, completedTurnId);
3299
3300
  void forwardCompletedCodexTurn(
3300
3301
  args,
3301
3302
  state,
3302
- turnId,
3303
+ completedTurnId,
3303
3304
  payloadContext
3304
3305
  ).catch((error) => {
3305
3306
  args.log("codex.turn_forward_failed", {
3306
- turn_id: turnId,
3307
+ turn_id: completedTurnId,
3307
3308
  message: error instanceof Error ? error.message : String(error)
3308
3309
  });
3309
3310
  });
3310
3311
  }
3311
3312
  break;
3313
+ }
3312
3314
  case "item/agentMessage/delta":
3313
3315
  enqueueAssistantDelta(args, state, params, payloadContext);
3314
3316
  break;
@@ -4695,7 +4697,16 @@ async function processKandanChatEvent(args, state, runnerIdentity, event, payloa
4695
4697
  }
4696
4698
  }
4697
4699
  async function drainKandanMessageQueue(args, state, payloadContext) {
4698
- if (state.closed || state.turn.status !== "idle" || localTuiTurnIsActive(state)) {
4700
+ if (state.closed) {
4701
+ logQueuedDrainBlocked(args, state, "session_closed");
4702
+ return;
4703
+ }
4704
+ if (state.turn.status !== "idle") {
4705
+ logQueuedDrainBlocked(args, state, "turn_not_idle");
4706
+ return;
4707
+ }
4708
+ if (localTuiTurnIsActive(state)) {
4709
+ logQueuedDrainBlocked(args, state, "local_tui_turn_active");
4699
4710
  return;
4700
4711
  }
4701
4712
  const resumed = await tryResumeCodexThreadForPendingRuntimeSettings(
@@ -4703,6 +4714,7 @@ async function drainKandanMessageQueue(args, state, payloadContext) {
4703
4714
  state
4704
4715
  );
4705
4716
  if (!resumed) {
4717
+ logQueuedDrainBlocked(args, state, "runtime_settings_resume_pending");
4706
4718
  return;
4707
4719
  }
4708
4720
  const next = dequeuePendingKandanMessage(state.queue);
@@ -4823,6 +4835,22 @@ async function drainKandanMessageQueue(args, state, payloadContext) {
4823
4835
  });
4824
4836
  }
4825
4837
  }
4838
+ function logQueuedDrainBlocked(args, state, reason) {
4839
+ const queueDepth = pendingKandanMessageQueueLength(state.queue);
4840
+ if (queueDepth === 0) {
4841
+ return;
4842
+ }
4843
+ args.log("kandan.queue_drain_blocked", {
4844
+ reason,
4845
+ queue_depth: queueDepth,
4846
+ turn_status: state.turn.status,
4847
+ active_turn_id: activeTurnId(state.turn) ?? null,
4848
+ active_queued_seq: state.turn.status === "active" || state.turn.status === "completing" ? state.turn.queuedSeq : state.turn.status === "starting" ? state.turn.queuedSeq : null,
4849
+ codex_thread_id: state.codexThreadId ?? null,
4850
+ kandan_thread_id: state.kandanThreadId ?? null,
4851
+ local_tui_turn_count: state.localTuiTurnIds.size
4852
+ });
4853
+ }
4826
4854
  async function fetchReconnectContextInjection(args, state) {
4827
4855
  if (state.kandanThreadId === void 0) {
4828
4856
  throw new Error(
@@ -5368,6 +5396,9 @@ function logCompletedCodexOutput(args, turnId, message) {
5368
5396
  });
5369
5397
  }
5370
5398
  function compareCompletedOutputProjection(left, right) {
5399
+ if (left.kind === "snapshot" && right.kind === "snapshot" && left.match.kind !== right.match.kind && (left.match.kind === "none" || right.match.kind === "none")) {
5400
+ return left.snapshotIndex - right.snapshotIndex;
5401
+ }
5371
5402
  return left.sortOrder === right.sortOrder ? left.snapshotIndex - right.snapshotIndex : left.sortOrder - right.sortOrder;
5372
5403
  }
5373
5404
  function fallbackSnapshotOutputBase(sortOrders) {
@@ -6559,6 +6590,30 @@ function codexNotificationBelongsToSession(state, threadId, turnId) {
6559
6590
  }
6560
6591
  return activeTurnId(state.turn) === turnId || isLocalTuiTurn(state, turnId);
6561
6592
  }
6593
+ function inferThreadOnlyCompletedTurnId(args, state, threadId) {
6594
+ if (threadId === void 0 || state.codexThreadId !== threadId) {
6595
+ return void 0;
6596
+ }
6597
+ switch (state.turn.status) {
6598
+ case "active":
6599
+ case "completing":
6600
+ args.log("codex.turn_completion_inferred", {
6601
+ thread_id: threadId,
6602
+ turn_id: state.turn.turnId,
6603
+ queued_seq: state.turn.queuedSeq,
6604
+ turn_status: state.turn.status
6605
+ });
6606
+ return state.turn.turnId;
6607
+ case "idle":
6608
+ case "starting":
6609
+ args.log("codex.turn_completion_without_turn_id", {
6610
+ thread_id: threadId,
6611
+ turn_status: state.turn.status,
6612
+ queued_seq: state.turn.status === "starting" ? state.turn.queuedSeq : null
6613
+ });
6614
+ return void 0;
6615
+ }
6616
+ }
6562
6617
  function codexNotificationActiveTurnFallback(method, state, params) {
6563
6618
  if (method !== "response_item" || codexCompletedFileChangeFromNotification(params) === void 0) {
6564
6619
  return void 0;
@@ -11695,7 +11750,7 @@ var linzumiCliVersion, linzumiCliVersionText;
11695
11750
  var init_version = __esm({
11696
11751
  "src/version.ts"() {
11697
11752
  "use strict";
11698
- linzumiCliVersion = "0.0.66-beta";
11753
+ linzumiCliVersion = "0.0.68-beta";
11699
11754
  linzumiCliVersionText = `linzumi ${linzumiCliVersion}`;
11700
11755
  }
11701
11756
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@linzumi/cli",
3
- "version": "0.0.66-beta",
3
+ "version": "0.0.68-beta",
4
4
  "description": "Linzumi CLI — point a Codex agent at the real code on your laptop, with your team watching and steering from shared threads.",
5
5
  "type": "module",
6
6
  "bin": {