happy-imou-cloud 2.1.37 → 2.1.39

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 (25) hide show
  1. package/dist/{BaseReasoningProcessor-Do2r_eVW.cjs → BaseReasoningProcessor-BUTolvO5.cjs} +2 -2
  2. package/dist/{BaseReasoningProcessor-CotgApeZ.mjs → BaseReasoningProcessor-Cbp6sIDm.mjs} +2 -2
  3. package/dist/{ProviderSelectionHandler-CywTx_Df.cjs → ProviderSelectionHandler-B22eXuym.cjs} +2 -2
  4. package/dist/{ProviderSelectionHandler-CCsorkyV.mjs → ProviderSelectionHandler-DrSgStLw.mjs} +2 -2
  5. package/dist/{api-CexMNqai.cjs → api-BoeZDGwx.cjs} +121 -1
  6. package/dist/{api-CMJhY7of.mjs → api-wcqkneTg.mjs} +121 -2
  7. package/dist/{command-Ct7Eeo2F.cjs → command-CkYq_KwA.cjs} +2 -2
  8. package/dist/{command-C2YB2hE-.mjs → command-DcgK0y3F.mjs} +2 -2
  9. package/dist/{index-4t8rMnvz.mjs → index-B9mt95QV.mjs} +201 -39
  10. package/dist/{index-CQ2Yq72y.cjs → index-Cgor8CE7.cjs} +204 -42
  11. package/dist/index.cjs +2 -2
  12. package/dist/index.mjs +2 -2
  13. package/dist/lib.cjs +1 -1
  14. package/dist/lib.d.cts +94 -36
  15. package/dist/lib.d.mts +94 -36
  16. package/dist/lib.mjs +1 -1
  17. package/dist/{registerKillSessionHandler-CLFQ8bQP.mjs → registerKillSessionHandler-Buc97BEh.mjs} +246 -10
  18. package/dist/{registerKillSessionHandler-C1PIogKI.cjs → registerKillSessionHandler-DtXhn2Cd.cjs} +249 -9
  19. package/dist/{runClaude-BiFuU4AP.mjs → runClaude-BYKNCDEU.mjs} +58 -20
  20. package/dist/{runClaude-L4G4BbIJ.cjs → runClaude-CwXQwmgw.cjs} +58 -20
  21. package/dist/{runCodex-CaUoS6E4.cjs → runCodex-BkB_YKhV.cjs} +58 -10
  22. package/dist/{runCodex-C0wjgp2b.mjs → runCodex-DqAddhDE.mjs} +58 -10
  23. package/dist/{runGemini-DxQX5VhV.mjs → runGemini-3jkfOtlr.mjs} +79 -11
  24. package/dist/{runGemini-DhYi_crP.cjs → runGemini-B4uXPrue.cjs} +79 -11
  25. package/package.json +1 -1
@@ -3,10 +3,10 @@
3
3
  var ink = require('ink');
4
4
  var React = require('react');
5
5
  var node_crypto = require('node:crypto');
6
- var persistence = require('./api-CexMNqai.cjs');
7
- var registerKillSessionHandler = require('./registerKillSessionHandler-C1PIogKI.cjs');
8
- var index = require('./index-CQ2Yq72y.cjs');
9
- var BaseReasoningProcessor = require('./BaseReasoningProcessor-Do2r_eVW.cjs');
6
+ var persistence = require('./api-BoeZDGwx.cjs');
7
+ var registerKillSessionHandler = require('./registerKillSessionHandler-DtXhn2Cd.cjs');
8
+ var index = require('./index-Cgor8CE7.cjs');
9
+ var BaseReasoningProcessor = require('./BaseReasoningProcessor-BUTolvO5.cjs');
10
10
  require('cross-spawn');
11
11
  require('@agentclientprotocol/sdk');
12
12
  require('ps-list');
@@ -644,19 +644,27 @@ async function runGemini(opts) {
644
644
  const keepAliveInterval = setInterval(() => {
645
645
  session.keepAlive(thinking, "remote");
646
646
  }, 2e3);
647
- const sendReady = () => {
647
+ const sendReady = (opts2) => {
648
648
  session.sendSessionEvent({ type: "ready" });
649
+ if (opts2?.push === false) {
650
+ return;
651
+ }
649
652
  try {
653
+ const notification = registerKillSessionHandler.buildReadyPushNotification({
654
+ providerLabel: "Gemini",
655
+ metadata: session.getMetadataSnapshot?.() ?? null,
656
+ sessionId: session.sessionId
657
+ });
650
658
  api.push().sendToAllDevices(
651
- "It's ready!",
652
- "Gemini is waiting for your command",
653
- { sessionId: session.sessionId }
659
+ notification.title,
660
+ notification.body,
661
+ notification.data
654
662
  );
655
663
  } catch (pushError) {
656
664
  persistence.logger.debug("[Gemini] Failed to send ready push", pushError);
657
665
  }
658
666
  };
659
- const emitReadyIfIdle = () => {
667
+ const emitReadyIfIdle = (opts2) => {
660
668
  if (shouldExit) {
661
669
  return false;
662
670
  }
@@ -669,7 +677,7 @@ async function runGemini(opts) {
669
677
  if (messageQueue.size() > 0) {
670
678
  return false;
671
679
  }
672
- sendReady();
680
+ sendReady(opts2);
673
681
  return true;
674
682
  };
675
683
  let abortController = new AbortController();
@@ -1023,6 +1031,24 @@ Guide: https://goo.gle/gemini-cli-auth-docs#workspace-gca`;
1023
1031
  break;
1024
1032
  }
1025
1033
  case "permission-request":
1034
+ try {
1035
+ const permissionRequest = registerKillSessionHandler.extractPermissionRequestPushContext(msg);
1036
+ const notification = registerKillSessionHandler.buildPermissionPushNotification({
1037
+ providerLabel: "Gemini",
1038
+ metadata: session.getMetadataSnapshot?.() ?? null,
1039
+ sessionId: session.sessionId,
1040
+ requestId: permissionRequest.requestId,
1041
+ toolName: permissionRequest.toolName,
1042
+ description: permissionRequest.description
1043
+ });
1044
+ api.push().sendToAllDevices(
1045
+ notification.title,
1046
+ notification.body,
1047
+ notification.data
1048
+ );
1049
+ } catch (pushError) {
1050
+ persistence.logger.debug("[Gemini] Failed to send permission push", pushError);
1051
+ }
1026
1052
  forwardAgentMessage(msg);
1027
1053
  break;
1028
1054
  case "exec-approval-request":
@@ -1160,6 +1186,7 @@ Guide: https://goo.gle/gemini-cli-auth-docs#workspace-gca`;
1160
1186
  const userMessageToShow = message.mode?.originalUserMessage || message.message;
1161
1187
  messageBuffer.addMessage(userMessageToShow, "user");
1162
1188
  isProcessingMessage = true;
1189
+ let sentTurnResultPush = false;
1163
1190
  let turnStatus = "task_complete";
1164
1191
  try {
1165
1192
  turnInFlight = true;
@@ -1341,8 +1368,49 @@ Guide: https://goo.gle/gemini-cli-auth-docs#workspace-gca`;
1341
1368
  };
1342
1369
  persistence.logger.debug(`[gemini] Sending complete message to mobile (length: ${finalMessageText.length}): ${finalMessageText.substring(0, 100)}...`);
1343
1370
  session.sendAgentMessage("gemini", messagePayload);
1371
+ if (!shouldExit) {
1372
+ try {
1373
+ const notification = registerKillSessionHandler.buildTurnResultPushNotification({
1374
+ providerLabel: "Gemini",
1375
+ metadata: finalizedTurn.nextMetadata ?? session.getMetadataSnapshot?.() ?? null,
1376
+ sessionId: session.sessionId,
1377
+ report: finalizedTurn.report,
1378
+ responseText: messageText
1379
+ });
1380
+ if (notification) {
1381
+ api.push().sendToAllDevices(
1382
+ notification.title,
1383
+ notification.body,
1384
+ notification.data
1385
+ );
1386
+ sentTurnResultPush = true;
1387
+ }
1388
+ } catch (pushError) {
1389
+ persistence.logger.debug("[Gemini] Failed to send turn-result push", pushError);
1390
+ }
1391
+ }
1344
1392
  accumulatedResponse = "";
1345
1393
  isResponseInProgress = false;
1394
+ } else if (!shouldExit && finalizedTurn.report) {
1395
+ try {
1396
+ const notification = registerKillSessionHandler.buildTurnResultPushNotification({
1397
+ providerLabel: "Gemini",
1398
+ metadata: finalizedTurn.nextMetadata ?? session.getMetadataSnapshot?.() ?? null,
1399
+ sessionId: session.sessionId,
1400
+ report: finalizedTurn.report,
1401
+ responseText: finalizedTurn.cleanedText
1402
+ });
1403
+ if (notification) {
1404
+ api.push().sendToAllDevices(
1405
+ notification.title,
1406
+ notification.body,
1407
+ notification.data
1408
+ );
1409
+ sentTurnResultPush = true;
1410
+ }
1411
+ } catch (pushError) {
1412
+ persistence.logger.debug("[Gemini] Failed to send turn-result push", pushError);
1413
+ }
1346
1414
  }
1347
1415
  session.sendAgentMessage("gemini", {
1348
1416
  type: "task_complete",
@@ -1352,7 +1420,7 @@ Guide: https://goo.gle/gemini-cli-auth-docs#workspace-gca`;
1352
1420
  taskStartedSent = false;
1353
1421
  thinking = false;
1354
1422
  session.keepAlive(thinking, "remote");
1355
- emitReadyIfIdle();
1423
+ readyAlreadySent = emitReadyIfIdle({ push: !sentTurnResultPush }) || readyAlreadySent;
1356
1424
  isProcessingMessage = false;
1357
1425
  applyPendingSessionSwap();
1358
1426
  persistence.logger.debug(`[gemini] Main loop: turn completed, continuing to next iteration (queue size: ${messageQueue.size()})`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "happy-imou-cloud",
3
- "version": "2.1.37",
3
+ "version": "2.1.39",
4
4
  "description": "hicloud - Imou 企业定制版。关键是 happy!移动端远程 AI 编程工具,支持 Claude Code、Codex 和 Gemini CLI",
5
5
  "author": "long.zhu",
6
6
  "license": "MIT",