happy-imou-cloud 2.0.5 → 2.0.7

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 (24) hide show
  1. package/dist/{BaseReasoningProcessor-bFVTvf3Q.mjs → BaseReasoningProcessor-ClrT-x-H.mjs} +2 -2
  2. package/dist/{BaseReasoningProcessor-DPVZIJ4n.cjs → BaseReasoningProcessor-DphULXS-.cjs} +2 -2
  3. package/dist/{api-DaqnNHfl.cjs → api-Dwkm7s_E.cjs} +3 -3
  4. package/dist/{api-DoHt-HyL.mjs → api-dwwHBzLc.mjs} +3 -3
  5. package/dist/{command-Dl9SrMnv.mjs → command-Cfq3Uc0S.mjs} +3 -3
  6. package/dist/{command-D9-hmqVq.cjs → command-DiAVIsxX.cjs} +3 -3
  7. package/dist/{index-Dc92gnxM.cjs → index-CfqxEoyl.cjs} +235 -93
  8. package/dist/{index-C5wR2qKT.mjs → index-HyqLXzw-.mjs} +233 -91
  9. package/dist/index.cjs +5 -5
  10. package/dist/index.mjs +5 -5
  11. package/dist/lib.cjs +1 -1
  12. package/dist/lib.mjs +1 -1
  13. package/dist/{persistence-QqeBvUxX.mjs → persistence-Dg-rxY2a.mjs} +1 -1
  14. package/dist/{persistence-D6Y0604_.cjs → persistence-hbhwAYIV.cjs} +1 -1
  15. package/dist/{registerKillSessionHandler-CC9zGBPE.mjs → registerKillSessionHandler-BAvk4GYO.mjs} +26 -2
  16. package/dist/{registerKillSessionHandler-C6yXr8ky.cjs → registerKillSessionHandler-D1ouN10n.cjs} +26 -2
  17. package/dist/{runClaude-gHKFB1UG.cjs → runClaude-CZmJ7qEP.cjs} +5 -5
  18. package/dist/{runClaude-CZ8gxaJL.mjs → runClaude-OxYbt3ZQ.mjs} +4 -4
  19. package/dist/{runCodex-DT7g4MPm.mjs → runCodex-ByVTEbSY.mjs} +35 -62
  20. package/dist/{runCodex-CdjzG1N7.cjs → runCodex-CtncAgso.cjs} +34 -62
  21. package/dist/{runGemini-CmY5386l.mjs → runGemini-BRO6A2jm.mjs} +5 -5
  22. package/dist/{runGemini-DxjvRmOc.cjs → runGemini-ChwjLmhI.cjs} +5 -5
  23. package/package.json +2 -2
  24. package/scripts/release-smoke.mjs +4 -0
@@ -1,9 +1,9 @@
1
1
  import { randomUUID } from 'node:crypto';
2
- import { l as logger, b as connectionState, A as ApiClient, i as isAuthenticationRequiredError } from './api-DoHt-HyL.mjs';
3
- import { readSettings } from './persistence-QqeBvUxX.mjs';
4
- import { f as formatDisplayMessage, v as validateCodexAcpSpawn, d as createCodexBackend, t as truncateDisplayMessage, b as stopCaffeinate, i as initialMachineMetadata, n as notifyDaemonSessionStarted } from './index-C5wR2qKT.mjs';
5
- import { B as BasePermissionHandler, g as getPendingInteractionTimeoutMs, I as INTERACTION_SUPERSEDED_ERROR, b as INTERACTION_TIMED_OUT_ERROR, a as BaseReasoningProcessor, c as createSessionMetadata, s as setupOfflineReconnection } from './BaseReasoningProcessor-bFVTvf3Q.mjs';
6
- import { h as hashObject, a as MessageBuffer, r as registerKillSessionHandler, M as MessageQueue2 } from './registerKillSessionHandler-CC9zGBPE.mjs';
2
+ import { l as logger, b as connectionState, A as ApiClient, i as isAuthenticationRequiredError } from './api-dwwHBzLc.mjs';
3
+ import { readSettings } from './persistence-Dg-rxY2a.mjs';
4
+ import { f as formatDisplayMessage, v as validateCodexAcpSpawn, d as createCodexBackend, t as truncateDisplayMessage, b as stopCaffeinate, i as initialMachineMetadata, n as notifyDaemonSessionStarted } from './index-HyqLXzw-.mjs';
5
+ import { B as BasePermissionHandler, g as getPendingInteractionTimeoutMs, I as INTERACTION_SUPERSEDED_ERROR, b as INTERACTION_TIMED_OUT_ERROR, a as BaseReasoningProcessor, c as createSessionMetadata, s as setupOfflineReconnection } from './BaseReasoningProcessor-ClrT-x-H.mjs';
6
+ import { h as hashObject, a as MessageBuffer, r as registerKillSessionHandler, M as MessageQueue2 } from './registerKillSessionHandler-BAvk4GYO.mjs';
7
7
  import React, { useState, useRef, useEffect, useCallback } from 'react';
8
8
  import { useStdout, useInput, Box, Text, render } from 'ink';
9
9
  import { attachToolHappierMetaV2, resolveCanonicalToolNameV2, inferToolResultError } from 'happy-protocol';
@@ -131,7 +131,6 @@ class CodexSession {
131
131
  keepAliveInterval;
132
132
  onModeChangeCallback;
133
133
  clientSwapCallbacks = [];
134
- supersedePendingInteractionsCallback = null;
135
134
  constructor(opts) {
136
135
  this.path = opts.path;
137
136
  this.api = opts.api;
@@ -172,12 +171,6 @@ class CodexSession {
172
171
  this.clientSwapCallbacks.splice(index, 1);
173
172
  }
174
173
  };
175
- setPendingInteractionSuperseder = (callback) => {
176
- this.supersedePendingInteractionsCallback = callback;
177
- };
178
- supersedePendingInteractions = (reason) => {
179
- return this.supersedePendingInteractionsCallback?.(reason) ?? false;
180
- };
181
174
  onThinkingChange = (thinking) => {
182
175
  this.thinking = thinking;
183
176
  this.client.keepAlive(thinking, this.mode);
@@ -782,21 +775,6 @@ function registerCodexRemoteRpcHandlers(clientSession, handlers) {
782
775
  clientSession.rpcHandlerManager.registerHandler("switch", handlers.handleSwitchToLocal);
783
776
  registerKillSessionHandler(clientSession.rpcHandlerManager, handlers.handleKillSession);
784
777
  }
785
- function handleIncomingCodexMessageDuringRemoteTurn(opts) {
786
- const reason = opts.reason ?? INTERACTION_SUPERSEDED_ERROR;
787
- const supersededPermissions = opts.supersedePermissions(reason);
788
- const supersededSelections = opts.supersedeSelections(reason);
789
- const interruptedTurn = opts.turnInFlight;
790
- const total = supersededPermissions + supersededSelections;
791
- if (interruptedTurn) {
792
- opts.abortActiveTurn();
793
- }
794
- if (total > 0 || interruptedTurn) {
795
- const message = interruptedTurn ? "Current Codex task was canceled because a new user message arrived. Processing the latest message instead." : "Previous pending interaction was canceled because a new user message arrived. Processing the latest message instead.";
796
- opts.onInterrupted(message);
797
- }
798
- return total > 0 || interruptedTurn;
799
- }
800
778
  async function codexRemoteLauncher(session) {
801
779
  const messageBuffer = new MessageBuffer();
802
780
  const hasTTY = process.stdout.isTTY && process.stdin.isTTY;
@@ -814,6 +792,9 @@ async function codexRemoteLauncher(session) {
814
792
  let isResponseInProgress = false;
815
793
  let taskStartedSent = false;
816
794
  let shouldInjectHistoryOnNextSession = false;
795
+ let shouldCommitAccumulatedResponse = false;
796
+ let currentAssistantMessageId = null;
797
+ let currentThinkingMessageId = null;
817
798
  const permissionHandler = new CodexPermissionHandler(session.client);
818
799
  const selectionHandler = new CodexSelectionHandler(session.client);
819
800
  const conversationHistory = new ConversationHistory({ maxMessages: 20, maxCharacters: 5e4 });
@@ -842,6 +823,9 @@ async function codexRemoteLauncher(session) {
842
823
  accumulatedResponse = "";
843
824
  isResponseInProgress = false;
844
825
  taskStartedSent = false;
826
+ shouldCommitAccumulatedResponse = false;
827
+ currentAssistantMessageId = null;
828
+ currentThinkingMessageId = null;
845
829
  session.onThinkingChange(false);
846
830
  };
847
831
  const abortActiveTurn = () => {
@@ -914,11 +898,17 @@ async function codexRemoteLauncher(session) {
914
898
  return;
915
899
  }
916
900
  if (!isResponseInProgress) {
917
- messageBuffer.removeLastMessage("system");
918
- messageBuffer.addMessage(text, "assistant");
901
+ if (currentThinkingMessageId) {
902
+ messageBuffer.removeMessage(currentThinkingMessageId);
903
+ currentThinkingMessageId = null;
904
+ }
905
+ currentAssistantMessageId = messageBuffer.addMessage(text, "assistant");
919
906
  isResponseInProgress = true;
920
907
  } else {
921
- messageBuffer.updateLastMessage(text, "assistant");
908
+ const updated = currentAssistantMessageId ? messageBuffer.updateMessage(currentAssistantMessageId, text) : false;
909
+ if (!updated) {
910
+ currentAssistantMessageId = messageBuffer.addMessage(text, "assistant");
911
+ }
922
912
  }
923
913
  accumulatedResponse += text;
924
914
  return;
@@ -933,8 +923,8 @@ async function codexRemoteLauncher(session) {
933
923
  });
934
924
  taskStartedSent = true;
935
925
  }
936
- if (!isResponseInProgress) {
937
- messageBuffer.addMessage("Thinking...", "system");
926
+ if (!isResponseInProgress && !currentThinkingMessageId) {
927
+ currentThinkingMessageId = messageBuffer.addMessage("Thinking...", "system");
938
928
  }
939
929
  return;
940
930
  }
@@ -1107,8 +1097,13 @@ async function codexRemoteLauncher(session) {
1107
1097
  const thinkingText = typeof thinkingPayload?.text === "string" ? thinkingPayload.text : "";
1108
1098
  if (thinkingText) {
1109
1099
  reasoningProcessor.processDelta(thinkingText);
1110
- if (!thinkingText.startsWith("**")) {
1111
- messageBuffer.updateLastMessage(`[Thinking] ${thinkingText.substring(0, 100)}...`, "system");
1100
+ if (!thinkingText.startsWith("**") && !isResponseInProgress) {
1101
+ const preview = `[Thinking] ${thinkingText.substring(0, 100)}...`;
1102
+ if (currentThinkingMessageId) {
1103
+ messageBuffer.updateMessage(currentThinkingMessageId, preview, { mode: "replace" });
1104
+ } else {
1105
+ currentThinkingMessageId = messageBuffer.addMessage(preview, "system");
1106
+ }
1112
1107
  }
1113
1108
  }
1114
1109
  }
@@ -1137,7 +1132,6 @@ async function codexRemoteLauncher(session) {
1137
1132
  model: executionMode.model,
1138
1133
  sandbox: executionMode.sandbox,
1139
1134
  approvalPolicy: executionMode.approvalPolicy,
1140
- mcpServers: {},
1141
1135
  permissionHandler,
1142
1136
  selectionHandler: {
1143
1137
  handleSelection: (request) => selectionHandler.requestSelection(request)
@@ -1152,20 +1146,6 @@ async function codexRemoteLauncher(session) {
1152
1146
  logger.debug("[Codex] Ignoring legacy switch request because Codex is ACP-only");
1153
1147
  emitStatusMessage(message);
1154
1148
  };
1155
- session.setPendingInteractionSuperseder((reason = INTERACTION_SUPERSEDED_ERROR) => {
1156
- return handleIncomingCodexMessageDuringRemoteTurn({
1157
- reason,
1158
- supersedePermissions: (value) => permissionHandler.supersedePendingRequests(value),
1159
- supersedeSelections: (value) => selectionHandler.supersedePendingRequests(value),
1160
- turnInFlight,
1161
- abortActiveTurn,
1162
- onInterrupted: (message) => {
1163
- logger.debug("[Codex] Incoming user message interrupted ACP remote turn");
1164
- messageBuffer.addMessage(message, "status");
1165
- session.runtimeSession.sendSessionEvent({ type: "message", message });
1166
- }
1167
- });
1168
- });
1169
1149
  async function handleAbort() {
1170
1150
  logger.debug("[Codex] Abort requested - stopping current task");
1171
1151
  try {
@@ -1269,6 +1249,7 @@ async function codexRemoteLauncher(session) {
1269
1249
  const turnSignal = abortController.signal;
1270
1250
  try {
1271
1251
  turnInFlight = true;
1252
+ shouldCommitAccumulatedResponse = false;
1272
1253
  const activeBackend = backend ?? createBackend(message.mode);
1273
1254
  if (!activeBackend) {
1274
1255
  throw new Error("Failed to create Codex ACP backend");
@@ -1290,6 +1271,7 @@ async function codexRemoteLauncher(session) {
1290
1271
  await activeBackend.sendPrompt(acpSessionId, promptToSend);
1291
1272
  await waitForResponseCompleteWithAbort(activeBackend, turnSignal);
1292
1273
  reasoningProcessor.completeCurrent();
1274
+ shouldCommitAccumulatedResponse = true;
1293
1275
  shouldInjectHistoryOnNextSession = false;
1294
1276
  } catch (error) {
1295
1277
  logger.warn("Error in codex ACP session:", error);
@@ -1312,7 +1294,9 @@ async function codexRemoteLauncher(session) {
1312
1294
  }
1313
1295
  } finally {
1314
1296
  turnInFlight = false;
1315
- emitFinalAssistantMessage();
1297
+ if (shouldCommitAccumulatedResponse) {
1298
+ emitFinalAssistantMessage();
1299
+ }
1316
1300
  if (!shouldExit) {
1317
1301
  session.runtimeSession.sendCodexMessage({
1318
1302
  type: "task_complete",
@@ -1337,7 +1321,6 @@ async function codexRemoteLauncher(session) {
1337
1321
  await disposeBackend();
1338
1322
  permissionHandler.reset();
1339
1323
  selectionHandler.reset();
1340
- session.setPendingInteractionSuperseder(null);
1341
1324
  session.removeClientSwapCallback(handleClientSwap);
1342
1325
  if (process.stdin.isTTY) {
1343
1326
  try {
@@ -1409,9 +1392,6 @@ async function syncControlledByUserState(sessionClient, controlledByUser) {
1409
1392
  }));
1410
1393
  });
1411
1394
  }
1412
- function shouldSupersedeCodexPendingInteractions(opts) {
1413
- return true;
1414
- }
1415
1395
  function resolveInitialCodexPermissionMode(opts) {
1416
1396
  if (opts.permissionMode) {
1417
1397
  return opts.permissionMode;
@@ -1518,13 +1498,6 @@ async function runCodex(opts) {
1518
1498
  messageModel = message.meta.model || void 0;
1519
1499
  currentModel = messageModel;
1520
1500
  }
1521
- if (shouldSupersedeCodexPendingInteractions({
1522
- startingMode: opts.startingMode,
1523
- currentMode: codexSession?.mode
1524
- })) {
1525
- logger.debug("[codex] Incoming user message superseding active remote interaction");
1526
- codexSession?.supersedePendingInteractions(INTERACTION_SUPERSEDED_ERROR);
1527
- }
1528
1501
  messageQueue.push(message.content.text, {
1529
1502
  permissionMode: permissionResolution.resolvedPermissionMode,
1530
1503
  model: messageModel
@@ -1560,4 +1533,4 @@ async function runCodex(opts) {
1560
1533
  }
1561
1534
  }
1562
1535
 
1563
- export { resolveIncomingCodexPermissionMode, resolveInitialCodexPermissionMode, resolveQueuedCodexPermissionMode, runCodex, shouldSupersedeCodexPendingInteractions, supportsAgentStateUpdateEvents, syncControlledByUserState };
1536
+ export { resolveIncomingCodexPermissionMode, resolveInitialCodexPermissionMode, resolveQueuedCodexPermissionMode, runCodex, supportsAgentStateUpdateEvents, syncControlledByUserState };
@@ -1,11 +1,11 @@
1
1
  'use strict';
2
2
 
3
3
  var node_crypto = require('node:crypto');
4
- var api = require('./api-DaqnNHfl.cjs');
5
- var persistence = require('./persistence-D6Y0604_.cjs');
6
- var index = require('./index-Dc92gnxM.cjs');
7
- var BaseReasoningProcessor = require('./BaseReasoningProcessor-DPVZIJ4n.cjs');
8
- var registerKillSessionHandler = require('./registerKillSessionHandler-C6yXr8ky.cjs');
4
+ var api = require('./api-Dwkm7s_E.cjs');
5
+ var persistence = require('./persistence-hbhwAYIV.cjs');
6
+ var index = require('./index-CfqxEoyl.cjs');
7
+ var BaseReasoningProcessor = require('./BaseReasoningProcessor-DphULXS-.cjs');
8
+ var registerKillSessionHandler = require('./registerKillSessionHandler-D1ouN10n.cjs');
9
9
  var React = require('react');
10
10
  var ink = require('ink');
11
11
  var happyProtocol = require('happy-protocol');
@@ -133,7 +133,6 @@ class CodexSession {
133
133
  keepAliveInterval;
134
134
  onModeChangeCallback;
135
135
  clientSwapCallbacks = [];
136
- supersedePendingInteractionsCallback = null;
137
136
  constructor(opts) {
138
137
  this.path = opts.path;
139
138
  this.api = opts.api;
@@ -174,12 +173,6 @@ class CodexSession {
174
173
  this.clientSwapCallbacks.splice(index, 1);
175
174
  }
176
175
  };
177
- setPendingInteractionSuperseder = (callback) => {
178
- this.supersedePendingInteractionsCallback = callback;
179
- };
180
- supersedePendingInteractions = (reason) => {
181
- return this.supersedePendingInteractionsCallback?.(reason) ?? false;
182
- };
183
176
  onThinkingChange = (thinking) => {
184
177
  this.thinking = thinking;
185
178
  this.client.keepAlive(thinking, this.mode);
@@ -784,21 +777,6 @@ function registerCodexRemoteRpcHandlers(clientSession, handlers) {
784
777
  clientSession.rpcHandlerManager.registerHandler("switch", handlers.handleSwitchToLocal);
785
778
  registerKillSessionHandler.registerKillSessionHandler(clientSession.rpcHandlerManager, handlers.handleKillSession);
786
779
  }
787
- function handleIncomingCodexMessageDuringRemoteTurn(opts) {
788
- const reason = opts.reason ?? BaseReasoningProcessor.INTERACTION_SUPERSEDED_ERROR;
789
- const supersededPermissions = opts.supersedePermissions(reason);
790
- const supersededSelections = opts.supersedeSelections(reason);
791
- const interruptedTurn = opts.turnInFlight;
792
- const total = supersededPermissions + supersededSelections;
793
- if (interruptedTurn) {
794
- opts.abortActiveTurn();
795
- }
796
- if (total > 0 || interruptedTurn) {
797
- const message = interruptedTurn ? "Current Codex task was canceled because a new user message arrived. Processing the latest message instead." : "Previous pending interaction was canceled because a new user message arrived. Processing the latest message instead.";
798
- opts.onInterrupted(message);
799
- }
800
- return total > 0 || interruptedTurn;
801
- }
802
780
  async function codexRemoteLauncher(session) {
803
781
  const messageBuffer = new registerKillSessionHandler.MessageBuffer();
804
782
  const hasTTY = process.stdout.isTTY && process.stdin.isTTY;
@@ -816,6 +794,9 @@ async function codexRemoteLauncher(session) {
816
794
  let isResponseInProgress = false;
817
795
  let taskStartedSent = false;
818
796
  let shouldInjectHistoryOnNextSession = false;
797
+ let shouldCommitAccumulatedResponse = false;
798
+ let currentAssistantMessageId = null;
799
+ let currentThinkingMessageId = null;
819
800
  const permissionHandler = new CodexPermissionHandler(session.client);
820
801
  const selectionHandler = new CodexSelectionHandler(session.client);
821
802
  const conversationHistory = new ConversationHistory({ maxMessages: 20, maxCharacters: 5e4 });
@@ -844,6 +825,9 @@ async function codexRemoteLauncher(session) {
844
825
  accumulatedResponse = "";
845
826
  isResponseInProgress = false;
846
827
  taskStartedSent = false;
828
+ shouldCommitAccumulatedResponse = false;
829
+ currentAssistantMessageId = null;
830
+ currentThinkingMessageId = null;
847
831
  session.onThinkingChange(false);
848
832
  };
849
833
  const abortActiveTurn = () => {
@@ -916,11 +900,17 @@ async function codexRemoteLauncher(session) {
916
900
  return;
917
901
  }
918
902
  if (!isResponseInProgress) {
919
- messageBuffer.removeLastMessage("system");
920
- messageBuffer.addMessage(text, "assistant");
903
+ if (currentThinkingMessageId) {
904
+ messageBuffer.removeMessage(currentThinkingMessageId);
905
+ currentThinkingMessageId = null;
906
+ }
907
+ currentAssistantMessageId = messageBuffer.addMessage(text, "assistant");
921
908
  isResponseInProgress = true;
922
909
  } else {
923
- messageBuffer.updateLastMessage(text, "assistant");
910
+ const updated = currentAssistantMessageId ? messageBuffer.updateMessage(currentAssistantMessageId, text) : false;
911
+ if (!updated) {
912
+ currentAssistantMessageId = messageBuffer.addMessage(text, "assistant");
913
+ }
924
914
  }
925
915
  accumulatedResponse += text;
926
916
  return;
@@ -935,8 +925,8 @@ async function codexRemoteLauncher(session) {
935
925
  });
936
926
  taskStartedSent = true;
937
927
  }
938
- if (!isResponseInProgress) {
939
- messageBuffer.addMessage("Thinking...", "system");
928
+ if (!isResponseInProgress && !currentThinkingMessageId) {
929
+ currentThinkingMessageId = messageBuffer.addMessage("Thinking...", "system");
940
930
  }
941
931
  return;
942
932
  }
@@ -1109,8 +1099,13 @@ async function codexRemoteLauncher(session) {
1109
1099
  const thinkingText = typeof thinkingPayload?.text === "string" ? thinkingPayload.text : "";
1110
1100
  if (thinkingText) {
1111
1101
  reasoningProcessor.processDelta(thinkingText);
1112
- if (!thinkingText.startsWith("**")) {
1113
- messageBuffer.updateLastMessage(`[Thinking] ${thinkingText.substring(0, 100)}...`, "system");
1102
+ if (!thinkingText.startsWith("**") && !isResponseInProgress) {
1103
+ const preview = `[Thinking] ${thinkingText.substring(0, 100)}...`;
1104
+ if (currentThinkingMessageId) {
1105
+ messageBuffer.updateMessage(currentThinkingMessageId, preview, { mode: "replace" });
1106
+ } else {
1107
+ currentThinkingMessageId = messageBuffer.addMessage(preview, "system");
1108
+ }
1114
1109
  }
1115
1110
  }
1116
1111
  }
@@ -1139,7 +1134,6 @@ async function codexRemoteLauncher(session) {
1139
1134
  model: executionMode.model,
1140
1135
  sandbox: executionMode.sandbox,
1141
1136
  approvalPolicy: executionMode.approvalPolicy,
1142
- mcpServers: {},
1143
1137
  permissionHandler,
1144
1138
  selectionHandler: {
1145
1139
  handleSelection: (request) => selectionHandler.requestSelection(request)
@@ -1154,20 +1148,6 @@ async function codexRemoteLauncher(session) {
1154
1148
  api.logger.debug("[Codex] Ignoring legacy switch request because Codex is ACP-only");
1155
1149
  emitStatusMessage(message);
1156
1150
  };
1157
- session.setPendingInteractionSuperseder((reason = BaseReasoningProcessor.INTERACTION_SUPERSEDED_ERROR) => {
1158
- return handleIncomingCodexMessageDuringRemoteTurn({
1159
- reason,
1160
- supersedePermissions: (value) => permissionHandler.supersedePendingRequests(value),
1161
- supersedeSelections: (value) => selectionHandler.supersedePendingRequests(value),
1162
- turnInFlight,
1163
- abortActiveTurn,
1164
- onInterrupted: (message) => {
1165
- api.logger.debug("[Codex] Incoming user message interrupted ACP remote turn");
1166
- messageBuffer.addMessage(message, "status");
1167
- session.runtimeSession.sendSessionEvent({ type: "message", message });
1168
- }
1169
- });
1170
- });
1171
1151
  async function handleAbort() {
1172
1152
  api.logger.debug("[Codex] Abort requested - stopping current task");
1173
1153
  try {
@@ -1271,6 +1251,7 @@ async function codexRemoteLauncher(session) {
1271
1251
  const turnSignal = abortController.signal;
1272
1252
  try {
1273
1253
  turnInFlight = true;
1254
+ shouldCommitAccumulatedResponse = false;
1274
1255
  const activeBackend = backend ?? createBackend(message.mode);
1275
1256
  if (!activeBackend) {
1276
1257
  throw new Error("Failed to create Codex ACP backend");
@@ -1292,6 +1273,7 @@ async function codexRemoteLauncher(session) {
1292
1273
  await activeBackend.sendPrompt(acpSessionId, promptToSend);
1293
1274
  await waitForResponseCompleteWithAbort(activeBackend, turnSignal);
1294
1275
  reasoningProcessor.completeCurrent();
1276
+ shouldCommitAccumulatedResponse = true;
1295
1277
  shouldInjectHistoryOnNextSession = false;
1296
1278
  } catch (error) {
1297
1279
  api.logger.warn("Error in codex ACP session:", error);
@@ -1314,7 +1296,9 @@ async function codexRemoteLauncher(session) {
1314
1296
  }
1315
1297
  } finally {
1316
1298
  turnInFlight = false;
1317
- emitFinalAssistantMessage();
1299
+ if (shouldCommitAccumulatedResponse) {
1300
+ emitFinalAssistantMessage();
1301
+ }
1318
1302
  if (!shouldExit) {
1319
1303
  session.runtimeSession.sendCodexMessage({
1320
1304
  type: "task_complete",
@@ -1339,7 +1323,6 @@ async function codexRemoteLauncher(session) {
1339
1323
  await disposeBackend();
1340
1324
  permissionHandler.reset();
1341
1325
  selectionHandler.reset();
1342
- session.setPendingInteractionSuperseder(null);
1343
1326
  session.removeClientSwapCallback(handleClientSwap);
1344
1327
  if (process.stdin.isTTY) {
1345
1328
  try {
@@ -1411,9 +1394,6 @@ async function syncControlledByUserState(sessionClient, controlledByUser) {
1411
1394
  }));
1412
1395
  });
1413
1396
  }
1414
- function shouldSupersedeCodexPendingInteractions(opts) {
1415
- return true;
1416
- }
1417
1397
  function resolveInitialCodexPermissionMode(opts) {
1418
1398
  if (opts.permissionMode) {
1419
1399
  return opts.permissionMode;
@@ -1520,13 +1500,6 @@ async function runCodex(opts) {
1520
1500
  messageModel = message.meta.model || void 0;
1521
1501
  currentModel = messageModel;
1522
1502
  }
1523
- if (shouldSupersedeCodexPendingInteractions({
1524
- startingMode: opts.startingMode,
1525
- currentMode: codexSession?.mode
1526
- })) {
1527
- api.logger.debug("[codex] Incoming user message superseding active remote interaction");
1528
- codexSession?.supersedePendingInteractions(BaseReasoningProcessor.INTERACTION_SUPERSEDED_ERROR);
1529
- }
1530
1503
  messageQueue.push(message.content.text, {
1531
1504
  permissionMode: permissionResolution.resolvedPermissionMode,
1532
1505
  model: messageModel
@@ -1566,6 +1539,5 @@ exports.resolveIncomingCodexPermissionMode = resolveIncomingCodexPermissionMode;
1566
1539
  exports.resolveInitialCodexPermissionMode = resolveInitialCodexPermissionMode;
1567
1540
  exports.resolveQueuedCodexPermissionMode = resolveQueuedCodexPermissionMode;
1568
1541
  exports.runCodex = runCodex;
1569
- exports.shouldSupersedeCodexPendingInteractions = shouldSupersedeCodexPendingInteractions;
1570
1542
  exports.supportsAgentStateUpdateEvents = supportsAgentStateUpdateEvents;
1571
1543
  exports.syncControlledByUserState = syncControlledByUserState;
@@ -1,11 +1,11 @@
1
1
  import { useStdout, useInput, Box, Text, render } from 'ink';
2
2
  import React, { useState, useRef, useEffect, useCallback } from 'react';
3
3
  import { randomUUID } from 'node:crypto';
4
- import { l as logger, b as connectionState, A as ApiClient, i as isAuthenticationRequiredError } from './api-DoHt-HyL.mjs';
5
- import { readSettings } from './persistence-QqeBvUxX.mjs';
6
- import { B as BasePermissionHandler, a as BaseReasoningProcessor, c as createSessionMetadata, s as setupOfflineReconnection } from './BaseReasoningProcessor-bFVTvf3Q.mjs';
7
- import { i as initialMachineMetadata, n as notifyDaemonSessionStarted, g as getInitialGeminiModel, r as readGeminiLocalConfig, G as GEMINI_MODEL_ENV, s as saveGeminiModelToConfig, a as createGeminiBackend, b as stopCaffeinate } from './index-C5wR2qKT.mjs';
8
- import { M as MessageQueue2, h as hashObject, a as MessageBuffer, r as registerKillSessionHandler } from './registerKillSessionHandler-CC9zGBPE.mjs';
4
+ import { l as logger, b as connectionState, A as ApiClient, i as isAuthenticationRequiredError } from './api-dwwHBzLc.mjs';
5
+ import { readSettings } from './persistence-Dg-rxY2a.mjs';
6
+ import { B as BasePermissionHandler, a as BaseReasoningProcessor, c as createSessionMetadata, s as setupOfflineReconnection } from './BaseReasoningProcessor-ClrT-x-H.mjs';
7
+ import { i as initialMachineMetadata, n as notifyDaemonSessionStarted, g as getInitialGeminiModel, r as readGeminiLocalConfig, G as GEMINI_MODEL_ENV, s as saveGeminiModelToConfig, a as createGeminiBackend, b as stopCaffeinate } from './index-HyqLXzw-.mjs';
8
+ import { M as MessageQueue2, h as hashObject, a as MessageBuffer, r as registerKillSessionHandler } from './registerKillSessionHandler-BAvk4GYO.mjs';
9
9
  import { attachToolHappierMetaV2, resolveCanonicalToolNameV2, inferToolResultError } from 'happy-protocol';
10
10
  import 'axios';
11
11
  import 'chalk';
@@ -3,11 +3,11 @@
3
3
  var ink = require('ink');
4
4
  var React = require('react');
5
5
  var node_crypto = require('node:crypto');
6
- var api = require('./api-DaqnNHfl.cjs');
7
- var persistence = require('./persistence-D6Y0604_.cjs');
8
- var BaseReasoningProcessor = require('./BaseReasoningProcessor-DPVZIJ4n.cjs');
9
- var index = require('./index-Dc92gnxM.cjs');
10
- var registerKillSessionHandler = require('./registerKillSessionHandler-C6yXr8ky.cjs');
6
+ var api = require('./api-Dwkm7s_E.cjs');
7
+ var persistence = require('./persistence-hbhwAYIV.cjs');
8
+ var BaseReasoningProcessor = require('./BaseReasoningProcessor-DphULXS-.cjs');
9
+ var index = require('./index-CfqxEoyl.cjs');
10
+ var registerKillSessionHandler = require('./registerKillSessionHandler-D1ouN10n.cjs');
11
11
  var happyProtocol = require('happy-protocol');
12
12
  require('axios');
13
13
  require('chalk');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "happy-imou-cloud",
3
- "version": "2.0.5",
3
+ "version": "2.0.7",
4
4
  "description": "hicloud - Imou 企业定制版。关键是 happy!移动端远程 AI 编程工具,支持 Claude Code、Codex 和 Gemini CLI",
5
5
  "author": "long.zhu",
6
6
  "license": "MIT",
@@ -59,7 +59,7 @@
59
59
  "dev:local-server": "yarn build && tsx --env-file .env.dev-local-server src/index.ts",
60
60
  "dev:integration-test-env": "yarn build && tsx --env-file .env.integration-test src/index.ts",
61
61
  "// ==== Release ====": "",
62
- "prepublishOnly": "npm run build",
62
+ "prepublishOnly": "yarn release:smoke",
63
63
  "release": "yarn install && release-it",
64
64
  "release:smoke": "node ./scripts/release-smoke.mjs",
65
65
  "// ==== Dev/Stable Variant Management ====": "",
@@ -33,6 +33,10 @@ function main() {
33
33
  runStep('unit runtime suite', 'yarn', [
34
34
  'vitest',
35
35
  'run',
36
+ 'src/agent/acp/AcpBackend.startup.test.ts',
37
+ 'src/agent/acp/acpSpawn.test.ts',
38
+ 'src/agent/acp/createAcpFilteredStdoutReadable.multiline.test.ts',
39
+ 'src/agent/acp/killProcessTree.test.ts',
36
40
  'src/runtime/executeProvider.test.ts',
37
41
  'src/runtime/command.test.ts',
38
42
  'src/runtime/launch.test.ts',