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
@@ -1,8 +1,8 @@
1
1
  import { randomUUID } from 'node:crypto';
2
- import { l as logger, h as backoff, j as delay, k as AsyncLock, c as configuration, s as startOfflineReconnection, b as connectionState, A as ApiClient, i as isAuthenticationRequiredError } from './api-CMJhY7of.mjs';
2
+ import { l as logger, h as backoff, j as delay, k as AsyncLock, c as configuration, s as startOfflineReconnection, b as connectionState, A as ApiClient, i as isAuthenticationRequiredError } from './api-wcqkneTg.mjs';
3
3
  import 'cross-spawn';
4
4
  import '@agentclientprotocol/sdk';
5
- import { n as getProjectPath, F as Future, o as claudeLocal, E as ExitCodeError, q as trimIdent, u as createClaudeBackend, f as formatDisplayMessage, t as truncateDisplayMessage, w as claudeCheckSession, x as projectPath, y as mapToClaudeMode, P as PushableAsyncIterable, z as query, A as AbortError, e as stopCaffeinate, p as publishSessionRegistration, B as getEnvironmentInfo, a as createSessionMetadata, C as startCaffeinate, b as closeProviderSession } from './index-4t8rMnvz.mjs';
5
+ import { n as getProjectPath, F as Future, o as claudeLocal, E as ExitCodeError, q as trimIdent, u as createClaudeBackend, f as formatDisplayMessage, t as truncateDisplayMessage, w as claudeCheckSession, x as projectPath, y as mapToClaudeMode, P as PushableAsyncIterable, z as query, A as AbortError, e as stopCaffeinate, p as publishSessionRegistration, B as getEnvironmentInfo, a as createSessionMetadata, C as startCaffeinate, b as closeProviderSession } from './index-B9mt95QV.mjs';
6
6
  import 'ps-list';
7
7
  import 'fs';
8
8
  import 'path';
@@ -23,9 +23,9 @@ import 'tweetnacl';
23
23
  import 'open';
24
24
  import React, { useState, useRef, useEffect, useCallback } from 'react';
25
25
  import { useStdout, useInput, Box, Text, render } from 'ink';
26
- import { c as createKeepAliveController, P as ProviderSelectionHandler, r as runModeLoop } from './ProviderSelectionHandler-CCsorkyV.mjs';
26
+ import { c as createKeepAliveController, P as ProviderSelectionHandler, r as runModeLoop } from './ProviderSelectionHandler-DrSgStLw.mjs';
27
27
  import { R as RawJSONLinesSchema } from './types-CiliQpqS.mjs';
28
- import { B as BasePermissionHandler, d as MessageBuffer, C as ConversationHistory$1, f as buildHappyOrgTurnPrompt, w as waitForResponseCompleteWithAbort, i as finalizeHappyOrgTurnWithBusinessAck, l as launchRuntimeHandleWithFactoryResult, j as renderTerminalOutputPreview, m as forwardAgentMessageToProviderSession, s as syncControlledByUserState, r as resolveHappyOrgQueuedTurn, e as ensureManagedProviderMachine, M as MissingMachineIdError, b as MessageQueue2, h as hashObject, c as registerKillSessionHandler } from './registerKillSessionHandler-CLFQ8bQP.mjs';
28
+ import { B as BasePermissionHandler, d as MessageBuffer, C as ConversationHistory$1, f as buildHappyOrgTurnPrompt, w as waitForResponseCompleteWithAbort, i as finalizeHappyOrgTurnWithBusinessAck, j as buildTurnResultPushNotification, k as buildReadyPushNotification, l as launchRuntimeHandleWithFactoryResult, o as renderTerminalOutputPreview, q as forwardAgentMessageToProviderSession, n as buildPermissionPushNotification, s as syncControlledByUserState, r as resolveHappyOrgQueuedTurn, e as ensureManagedProviderMachine, M as MissingMachineIdError, b as MessageQueue2, h as hashObject, c as registerKillSessionHandler } from './registerKillSessionHandler-Buc97BEh.mjs';
29
29
  import 'socket.io-client';
30
30
  import 'expo-server-sdk';
31
31
  import { isDeepStrictEqual } from 'node:util';
@@ -1017,13 +1017,21 @@ async function claudeAcpRemoteLauncher(session) {
1017
1017
  abortController = new AbortController();
1018
1018
  return activeController;
1019
1019
  };
1020
- const sendReady = () => {
1020
+ const sendReady = (opts) => {
1021
1021
  session.client.sendSessionEvent({ type: "ready" });
1022
+ if (opts?.push === false) {
1023
+ return;
1024
+ }
1022
1025
  try {
1026
+ const notification = buildReadyPushNotification({
1027
+ providerLabel: "Claude",
1028
+ metadata: session.client.getMetadataSnapshot?.() ?? null,
1029
+ sessionId: session.client.sessionId
1030
+ });
1023
1031
  session.api.push().sendToAllDevices(
1024
- "It's ready!",
1025
- "Claude is waiting for your command",
1026
- { sessionId: session.client.sessionId }
1032
+ notification.title,
1033
+ notification.body,
1034
+ notification.data
1027
1035
  );
1028
1036
  } catch (pushError) {
1029
1037
  logger.debug("[ClaudeACP] Failed to send ready push", pushError);
@@ -1429,6 +1437,7 @@ ${systemPrompt}` : systemPrompt,
1429
1437
  messageBuffer.addMessage(message.message, "user");
1430
1438
  let shouldClearHistoryAfterTurn = false;
1431
1439
  let shouldCommitAccumulatedResponse = false;
1440
+ let sentTurnResultPush = false;
1432
1441
  let turnStatus = "task_complete";
1433
1442
  try {
1434
1443
  turnInFlight = true;
@@ -1501,6 +1510,27 @@ ${systemPrompt}` : systemPrompt,
1501
1510
  accumulatedResponse = finalizedTurn.cleanedText;
1502
1511
  if (shouldCommitAccumulatedResponse) {
1503
1512
  emitFinalAssistantMessage(finalizedTurn.cleanedText);
1513
+ if (!shouldExit) {
1514
+ try {
1515
+ const notification = buildTurnResultPushNotification({
1516
+ providerLabel: "Claude",
1517
+ metadata: finalizedTurn.nextMetadata ?? session.client.getMetadataSnapshot?.() ?? null,
1518
+ sessionId: session.client.sessionId,
1519
+ report: finalizedTurn.report,
1520
+ responseText: finalizedTurn.cleanedText
1521
+ });
1522
+ if (notification) {
1523
+ session.api.push().sendToAllDevices(
1524
+ notification.title,
1525
+ notification.body,
1526
+ notification.data
1527
+ );
1528
+ sentTurnResultPush = true;
1529
+ }
1530
+ } catch (pushError) {
1531
+ logger.debug("[ClaudeACP] Failed to send turn-result push", pushError);
1532
+ }
1533
+ }
1504
1534
  }
1505
1535
  if (shouldClearHistoryAfterTurn) {
1506
1536
  conversationHistory.clear();
@@ -1516,7 +1546,7 @@ ${systemPrompt}` : systemPrompt,
1516
1546
  selectionHandler.reset();
1517
1547
  resetTurnState();
1518
1548
  if (!shouldExit && !pending && session.queue.size() === 0 && !readyAlreadySent) {
1519
- sendReady();
1549
+ sendReady({ push: !sentTurnResultPush });
1520
1550
  readyAlreadySent = true;
1521
1551
  }
1522
1552
  }
@@ -1882,15 +1912,18 @@ class PermissionHandler {
1882
1912
  if (this.onPermissionRequestCallback) {
1883
1913
  this.onPermissionRequestCallback(id);
1884
1914
  }
1915
+ const notification = buildPermissionPushNotification({
1916
+ providerLabel: "Claude",
1917
+ metadata: this.session.client.getMetadataSnapshot?.() ?? null,
1918
+ sessionId: this.session.client.sessionId,
1919
+ requestId: id,
1920
+ toolName,
1921
+ description: getToolName(toolName)
1922
+ });
1885
1923
  this.session.api.push().sendToAllDevices(
1886
- "Permission Request",
1887
- `Claude wants to ${getToolName(toolName)}`,
1888
- {
1889
- sessionId: this.session.client.sessionId,
1890
- requestId: id,
1891
- tool: toolName,
1892
- type: "permission_request"
1893
- }
1924
+ notification.title,
1925
+ notification.body,
1926
+ notification.data
1894
1927
  );
1895
1928
  this.session.client.updateAgentState((currentState) => ({
1896
1929
  ...currentState,
@@ -2901,10 +2934,15 @@ async function claudeRemoteLauncher(session, options = {}) {
2901
2934
  onReady: () => {
2902
2935
  if (!pending && session.queue.size() === 0) {
2903
2936
  session.client.sendSessionEvent({ type: "ready" });
2937
+ const notification = buildReadyPushNotification({
2938
+ providerLabel: "Claude",
2939
+ metadata: session.client.getMetadataSnapshot?.() ?? null,
2940
+ sessionId: session.client.sessionId
2941
+ });
2904
2942
  session.api.push().sendToAllDevices(
2905
- "It's ready!",
2906
- `Claude is waiting for your command`,
2907
- { sessionId: session.client.sessionId }
2943
+ notification.title,
2944
+ notification.body,
2945
+ notification.data
2908
2946
  );
2909
2947
  }
2910
2948
  },
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
3
  var node_crypto = require('node:crypto');
4
- var persistence = require('./api-CexMNqai.cjs');
4
+ var persistence = require('./api-BoeZDGwx.cjs');
5
5
  require('cross-spawn');
6
6
  require('@agentclientprotocol/sdk');
7
- var index = require('./index-CQ2Yq72y.cjs');
7
+ var index = require('./index-Cgor8CE7.cjs');
8
8
  require('ps-list');
9
9
  require('fs');
10
10
  require('path');
@@ -25,9 +25,9 @@ require('tweetnacl');
25
25
  require('open');
26
26
  var React = require('react');
27
27
  var ink = require('ink');
28
- var ProviderSelectionHandler = require('./ProviderSelectionHandler-CywTx_Df.cjs');
28
+ var ProviderSelectionHandler = require('./ProviderSelectionHandler-B22eXuym.cjs');
29
29
  var types = require('./types-DVk3crez.cjs');
30
- var registerKillSessionHandler = require('./registerKillSessionHandler-C1PIogKI.cjs');
30
+ var registerKillSessionHandler = require('./registerKillSessionHandler-DtXhn2Cd.cjs');
31
31
  require('socket.io-client');
32
32
  require('expo-server-sdk');
33
33
  var node_util = require('node:util');
@@ -1019,13 +1019,21 @@ async function claudeAcpRemoteLauncher(session) {
1019
1019
  abortController = new AbortController();
1020
1020
  return activeController;
1021
1021
  };
1022
- const sendReady = () => {
1022
+ const sendReady = (opts) => {
1023
1023
  session.client.sendSessionEvent({ type: "ready" });
1024
+ if (opts?.push === false) {
1025
+ return;
1026
+ }
1024
1027
  try {
1028
+ const notification = registerKillSessionHandler.buildReadyPushNotification({
1029
+ providerLabel: "Claude",
1030
+ metadata: session.client.getMetadataSnapshot?.() ?? null,
1031
+ sessionId: session.client.sessionId
1032
+ });
1025
1033
  session.api.push().sendToAllDevices(
1026
- "It's ready!",
1027
- "Claude is waiting for your command",
1028
- { sessionId: session.client.sessionId }
1034
+ notification.title,
1035
+ notification.body,
1036
+ notification.data
1029
1037
  );
1030
1038
  } catch (pushError) {
1031
1039
  persistence.logger.debug("[ClaudeACP] Failed to send ready push", pushError);
@@ -1431,6 +1439,7 @@ ${systemPrompt}` : systemPrompt,
1431
1439
  messageBuffer.addMessage(message.message, "user");
1432
1440
  let shouldClearHistoryAfterTurn = false;
1433
1441
  let shouldCommitAccumulatedResponse = false;
1442
+ let sentTurnResultPush = false;
1434
1443
  let turnStatus = "task_complete";
1435
1444
  try {
1436
1445
  turnInFlight = true;
@@ -1503,6 +1512,27 @@ ${systemPrompt}` : systemPrompt,
1503
1512
  accumulatedResponse = finalizedTurn.cleanedText;
1504
1513
  if (shouldCommitAccumulatedResponse) {
1505
1514
  emitFinalAssistantMessage(finalizedTurn.cleanedText);
1515
+ if (!shouldExit) {
1516
+ try {
1517
+ const notification = registerKillSessionHandler.buildTurnResultPushNotification({
1518
+ providerLabel: "Claude",
1519
+ metadata: finalizedTurn.nextMetadata ?? session.client.getMetadataSnapshot?.() ?? null,
1520
+ sessionId: session.client.sessionId,
1521
+ report: finalizedTurn.report,
1522
+ responseText: finalizedTurn.cleanedText
1523
+ });
1524
+ if (notification) {
1525
+ session.api.push().sendToAllDevices(
1526
+ notification.title,
1527
+ notification.body,
1528
+ notification.data
1529
+ );
1530
+ sentTurnResultPush = true;
1531
+ }
1532
+ } catch (pushError) {
1533
+ persistence.logger.debug("[ClaudeACP] Failed to send turn-result push", pushError);
1534
+ }
1535
+ }
1506
1536
  }
1507
1537
  if (shouldClearHistoryAfterTurn) {
1508
1538
  conversationHistory.clear();
@@ -1518,7 +1548,7 @@ ${systemPrompt}` : systemPrompt,
1518
1548
  selectionHandler.reset();
1519
1549
  resetTurnState();
1520
1550
  if (!shouldExit && !pending && session.queue.size() === 0 && !readyAlreadySent) {
1521
- sendReady();
1551
+ sendReady({ push: !sentTurnResultPush });
1522
1552
  readyAlreadySent = true;
1523
1553
  }
1524
1554
  }
@@ -1884,15 +1914,18 @@ class PermissionHandler {
1884
1914
  if (this.onPermissionRequestCallback) {
1885
1915
  this.onPermissionRequestCallback(id);
1886
1916
  }
1917
+ const notification = registerKillSessionHandler.buildPermissionPushNotification({
1918
+ providerLabel: "Claude",
1919
+ metadata: this.session.client.getMetadataSnapshot?.() ?? null,
1920
+ sessionId: this.session.client.sessionId,
1921
+ requestId: id,
1922
+ toolName,
1923
+ description: getToolName(toolName)
1924
+ });
1887
1925
  this.session.api.push().sendToAllDevices(
1888
- "Permission Request",
1889
- `Claude wants to ${getToolName(toolName)}`,
1890
- {
1891
- sessionId: this.session.client.sessionId,
1892
- requestId: id,
1893
- tool: toolName,
1894
- type: "permission_request"
1895
- }
1926
+ notification.title,
1927
+ notification.body,
1928
+ notification.data
1896
1929
  );
1897
1930
  this.session.client.updateAgentState((currentState) => ({
1898
1931
  ...currentState,
@@ -2903,10 +2936,15 @@ async function claudeRemoteLauncher(session, options = {}) {
2903
2936
  onReady: () => {
2904
2937
  if (!pending && session.queue.size() === 0) {
2905
2938
  session.client.sendSessionEvent({ type: "ready" });
2939
+ const notification = registerKillSessionHandler.buildReadyPushNotification({
2940
+ providerLabel: "Claude",
2941
+ metadata: session.client.getMetadataSnapshot?.() ?? null,
2942
+ sessionId: session.client.sessionId
2943
+ });
2906
2944
  session.api.push().sendToAllDevices(
2907
- "It's ready!",
2908
- `Claude is waiting for your command`,
2909
- { sessionId: session.client.sessionId }
2945
+ notification.title,
2946
+ notification.body,
2947
+ notification.data
2910
2948
  );
2911
2949
  }
2912
2950
  },
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var persistence = require('./api-CexMNqai.cjs');
4
- var registerKillSessionHandler = require('./registerKillSessionHandler-C1PIogKI.cjs');
5
- var index = require('./index-CQ2Yq72y.cjs');
3
+ var persistence = require('./api-BoeZDGwx.cjs');
4
+ var registerKillSessionHandler = require('./registerKillSessionHandler-DtXhn2Cd.cjs');
5
+ var index = require('./index-Cgor8CE7.cjs');
6
6
  require('cross-spawn');
7
7
  require('@agentclientprotocol/sdk');
8
8
  var node_crypto = require('node:crypto');
@@ -26,8 +26,8 @@ require('tweetnacl');
26
26
  require('open');
27
27
  var React = require('react');
28
28
  var ink = require('ink');
29
- var ProviderSelectionHandler = require('./ProviderSelectionHandler-CywTx_Df.cjs');
30
- var BaseReasoningProcessor = require('./BaseReasoningProcessor-Do2r_eVW.cjs');
29
+ var ProviderSelectionHandler = require('./ProviderSelectionHandler-B22eXuym.cjs');
30
+ var BaseReasoningProcessor = require('./BaseReasoningProcessor-BUTolvO5.cjs');
31
31
  require('zod');
32
32
  require('socket.io-client');
33
33
  require('expo-server-sdk');
@@ -728,13 +728,21 @@ async function codexRemoteLauncher(session) {
728
728
  abortController = new AbortController();
729
729
  return activeController;
730
730
  };
731
- const sendReady = () => {
731
+ const sendReady = (opts) => {
732
732
  session.runtimeSession.sendSessionEvent({ type: "ready" });
733
+ if (opts?.push === false) {
734
+ return;
735
+ }
733
736
  try {
737
+ const notification = registerKillSessionHandler.buildReadyPushNotification({
738
+ providerLabel: "Codex",
739
+ metadata: session.runtimeSession.getMetadataSnapshot?.() ?? null,
740
+ sessionId: session.runtimeSession.sessionId
741
+ });
734
742
  session.api.push().sendToAllDevices(
735
- "It's ready!",
736
- "Codex is waiting for your command",
737
- { sessionId: session.runtimeSession.sessionId }
743
+ notification.title,
744
+ notification.body,
745
+ notification.data
738
746
  );
739
747
  } catch (pushError) {
740
748
  persistence.logger.debug("[Codex] Failed to send ready push", pushError);
@@ -973,6 +981,24 @@ async function codexRemoteLauncher(session) {
973
981
  return;
974
982
  }
975
983
  case "permission-request": {
984
+ try {
985
+ const permissionRequest = registerKillSessionHandler.extractPermissionRequestPushContext(msg);
986
+ const notification = registerKillSessionHandler.buildPermissionPushNotification({
987
+ providerLabel: "Codex",
988
+ metadata: session.runtimeSession.getMetadataSnapshot?.() ?? null,
989
+ sessionId: session.runtimeSession.sessionId,
990
+ requestId: permissionRequest.requestId,
991
+ toolName: permissionRequest.toolName,
992
+ description: permissionRequest.description
993
+ });
994
+ session.api.push().sendToAllDevices(
995
+ notification.title,
996
+ notification.body,
997
+ notification.data
998
+ );
999
+ } catch (pushError) {
1000
+ persistence.logger.debug("[Codex] Failed to send permission push", pushError);
1001
+ }
976
1002
  forwardAgentMessage(msg);
977
1003
  return;
978
1004
  }
@@ -1166,6 +1192,7 @@ async function codexRemoteLauncher(session) {
1166
1192
  readyAlreadySent = false;
1167
1193
  messageBuffer.addMessage(message.message, "user");
1168
1194
  const turnSignal = abortController.signal;
1195
+ let sentTurnResultPush = false;
1169
1196
  let turnStatus = "task_complete";
1170
1197
  currentHappyOrgTurn = message.mode.happyOrg ?? null;
1171
1198
  try {
@@ -1252,6 +1279,27 @@ ${message.message}` : message.message;
1252
1279
  accumulatedResponse = finalizedTurn.cleanedText;
1253
1280
  if (shouldCommitAccumulatedResponse) {
1254
1281
  emitFinalAssistantMessage(finalizedTurn.cleanedText);
1282
+ if (!shouldExit) {
1283
+ try {
1284
+ const notification = registerKillSessionHandler.buildTurnResultPushNotification({
1285
+ providerLabel: "Codex",
1286
+ metadata: finalizedTurn.nextMetadata ?? session.runtimeSession.getMetadataSnapshot?.() ?? null,
1287
+ sessionId: session.runtimeSession.sessionId,
1288
+ report: finalizedTurn.report,
1289
+ responseText: finalizedTurn.cleanedText
1290
+ });
1291
+ if (notification) {
1292
+ session.api.push().sendToAllDevices(
1293
+ notification.title,
1294
+ notification.body,
1295
+ notification.data
1296
+ );
1297
+ sentTurnResultPush = true;
1298
+ }
1299
+ } catch (pushError) {
1300
+ persistence.logger.debug("[Codex] Failed to send turn-result push", pushError);
1301
+ }
1302
+ }
1255
1303
  }
1256
1304
  if (!shouldExit) {
1257
1305
  session.runtimeSession.sendCodexMessage({
@@ -1268,7 +1316,7 @@ ${message.message}` : message.message;
1268
1316
  shouldExit,
1269
1317
  readyAlreadySent
1270
1318
  })) {
1271
- sendReady();
1319
+ sendReady({ push: !sentTurnResultPush });
1272
1320
  readyAlreadySent = true;
1273
1321
  }
1274
1322
  }
@@ -1,6 +1,6 @@
1
- import { p as preserveSessionRuntimeMetadata, l as logger, b as connectionState, A as ApiClient } from './api-CMJhY7of.mjs';
2
- import { B as BasePermissionHandler, h as hashObject, d as MessageBuffer, C as ConversationHistory$1, f as buildHappyOrgTurnPrompt, w as waitForResponseCompleteWithAbort, i as finalizeHappyOrgTurnWithBusinessAck, c as registerKillSessionHandler, l as launchRuntimeHandleWithFactoryResult, j as renderTerminalOutputPreview, k as inferToolResultError, m as forwardAgentMessageToProviderSession, e as ensureManagedProviderMachine, M as MissingMachineIdError, b as MessageQueue2, r as resolveHappyOrgQueuedTurn, s as syncControlledByUserState } from './registerKillSessionHandler-CLFQ8bQP.mjs';
3
- import { f as formatDisplayMessage, v as validateCodexAcpSpawn, h as createCodexBackend, t as truncateDisplayMessage, b as closeProviderSession, e as stopCaffeinate, i as readManagedSessionTag, j as resolveManagedSessionTag } from './index-4t8rMnvz.mjs';
1
+ import { p as preserveSessionRuntimeMetadata, l as logger, b as connectionState, A as ApiClient } from './api-wcqkneTg.mjs';
2
+ import { B as BasePermissionHandler, h as hashObject, d as MessageBuffer, C as ConversationHistory$1, f as buildHappyOrgTurnPrompt, w as waitForResponseCompleteWithAbort, i as finalizeHappyOrgTurnWithBusinessAck, j as buildTurnResultPushNotification, c as registerKillSessionHandler, k as buildReadyPushNotification, l as launchRuntimeHandleWithFactoryResult, m as extractPermissionRequestPushContext, n as buildPermissionPushNotification, o as renderTerminalOutputPreview, p as inferToolResultError, q as forwardAgentMessageToProviderSession, e as ensureManagedProviderMachine, M as MissingMachineIdError, b as MessageQueue2, r as resolveHappyOrgQueuedTurn, s as syncControlledByUserState } from './registerKillSessionHandler-Buc97BEh.mjs';
3
+ import { f as formatDisplayMessage, v as validateCodexAcpSpawn, h as createCodexBackend, t as truncateDisplayMessage, b as closeProviderSession, e as stopCaffeinate, i as readManagedSessionTag, j as resolveManagedSessionTag } from './index-B9mt95QV.mjs';
4
4
  import 'cross-spawn';
5
5
  import '@agentclientprotocol/sdk';
6
6
  import { randomUUID } from 'node:crypto';
@@ -24,8 +24,8 @@ import 'tweetnacl';
24
24
  import 'open';
25
25
  import React, { useState, useRef, useEffect, useCallback } from 'react';
26
26
  import { useStdout, useInput, Box, Text, render } from 'ink';
27
- import { c as createKeepAliveController, P as ProviderSelectionHandler, r as runModeLoop } from './ProviderSelectionHandler-CCsorkyV.mjs';
28
- import { B as BaseReasoningProcessor, b as bootstrapManagedProviderSession } from './BaseReasoningProcessor-CotgApeZ.mjs';
27
+ import { c as createKeepAliveController, P as ProviderSelectionHandler, r as runModeLoop } from './ProviderSelectionHandler-DrSgStLw.mjs';
28
+ import { B as BaseReasoningProcessor, b as bootstrapManagedProviderSession } from './BaseReasoningProcessor-Cbp6sIDm.mjs';
29
29
  import 'zod';
30
30
  import 'socket.io-client';
31
31
  import 'expo-server-sdk';
@@ -726,13 +726,21 @@ async function codexRemoteLauncher(session) {
726
726
  abortController = new AbortController();
727
727
  return activeController;
728
728
  };
729
- const sendReady = () => {
729
+ const sendReady = (opts) => {
730
730
  session.runtimeSession.sendSessionEvent({ type: "ready" });
731
+ if (opts?.push === false) {
732
+ return;
733
+ }
731
734
  try {
735
+ const notification = buildReadyPushNotification({
736
+ providerLabel: "Codex",
737
+ metadata: session.runtimeSession.getMetadataSnapshot?.() ?? null,
738
+ sessionId: session.runtimeSession.sessionId
739
+ });
732
740
  session.api.push().sendToAllDevices(
733
- "It's ready!",
734
- "Codex is waiting for your command",
735
- { sessionId: session.runtimeSession.sessionId }
741
+ notification.title,
742
+ notification.body,
743
+ notification.data
736
744
  );
737
745
  } catch (pushError) {
738
746
  logger.debug("[Codex] Failed to send ready push", pushError);
@@ -971,6 +979,24 @@ async function codexRemoteLauncher(session) {
971
979
  return;
972
980
  }
973
981
  case "permission-request": {
982
+ try {
983
+ const permissionRequest = extractPermissionRequestPushContext(msg);
984
+ const notification = buildPermissionPushNotification({
985
+ providerLabel: "Codex",
986
+ metadata: session.runtimeSession.getMetadataSnapshot?.() ?? null,
987
+ sessionId: session.runtimeSession.sessionId,
988
+ requestId: permissionRequest.requestId,
989
+ toolName: permissionRequest.toolName,
990
+ description: permissionRequest.description
991
+ });
992
+ session.api.push().sendToAllDevices(
993
+ notification.title,
994
+ notification.body,
995
+ notification.data
996
+ );
997
+ } catch (pushError) {
998
+ logger.debug("[Codex] Failed to send permission push", pushError);
999
+ }
974
1000
  forwardAgentMessage(msg);
975
1001
  return;
976
1002
  }
@@ -1164,6 +1190,7 @@ async function codexRemoteLauncher(session) {
1164
1190
  readyAlreadySent = false;
1165
1191
  messageBuffer.addMessage(message.message, "user");
1166
1192
  const turnSignal = abortController.signal;
1193
+ let sentTurnResultPush = false;
1167
1194
  let turnStatus = "task_complete";
1168
1195
  currentHappyOrgTurn = message.mode.happyOrg ?? null;
1169
1196
  try {
@@ -1250,6 +1277,27 @@ ${message.message}` : message.message;
1250
1277
  accumulatedResponse = finalizedTurn.cleanedText;
1251
1278
  if (shouldCommitAccumulatedResponse) {
1252
1279
  emitFinalAssistantMessage(finalizedTurn.cleanedText);
1280
+ if (!shouldExit) {
1281
+ try {
1282
+ const notification = buildTurnResultPushNotification({
1283
+ providerLabel: "Codex",
1284
+ metadata: finalizedTurn.nextMetadata ?? session.runtimeSession.getMetadataSnapshot?.() ?? null,
1285
+ sessionId: session.runtimeSession.sessionId,
1286
+ report: finalizedTurn.report,
1287
+ responseText: finalizedTurn.cleanedText
1288
+ });
1289
+ if (notification) {
1290
+ session.api.push().sendToAllDevices(
1291
+ notification.title,
1292
+ notification.body,
1293
+ notification.data
1294
+ );
1295
+ sentTurnResultPush = true;
1296
+ }
1297
+ } catch (pushError) {
1298
+ logger.debug("[Codex] Failed to send turn-result push", pushError);
1299
+ }
1300
+ }
1253
1301
  }
1254
1302
  if (!shouldExit) {
1255
1303
  session.runtimeSession.sendCodexMessage({
@@ -1266,7 +1314,7 @@ ${message.message}` : message.message;
1266
1314
  shouldExit,
1267
1315
  readyAlreadySent
1268
1316
  })) {
1269
- sendReady();
1317
+ sendReady({ push: !sentTurnResultPush });
1270
1318
  readyAlreadySent = true;
1271
1319
  }
1272
1320
  }
@@ -1,10 +1,10 @@
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 } from './api-CMJhY7of.mjs';
5
- import { B as BasePermissionHandler, C as ConversationHistory$1, r as resolveHappyOrgQueuedTurn, e as ensureManagedProviderMachine, M as MissingMachineIdError, s as syncControlledByUserState, b as MessageQueue2, h as hashObject, c as registerKillSessionHandler, d as MessageBuffer, f as buildHappyOrgTurnPrompt, w as waitForResponseCompleteWithAbort, i as finalizeHappyOrgTurnWithBusinessAck, l as launchRuntimeHandleWithFactoryResult, j as renderTerminalOutputPreview, k as inferToolResultError, m as forwardAgentMessageToProviderSession } from './registerKillSessionHandler-CLFQ8bQP.mjs';
6
- import { g as getInitialGeminiModel, r as readGeminiLocalConfig, G as GEMINI_MODEL_ENV, b as closeProviderSession, s as saveGeminiModelToConfig, d as createGeminiBackend, e as stopCaffeinate } from './index-4t8rMnvz.mjs';
7
- import { B as BaseReasoningProcessor, b as bootstrapManagedProviderSession } from './BaseReasoningProcessor-CotgApeZ.mjs';
4
+ import { l as logger, b as connectionState, A as ApiClient } from './api-wcqkneTg.mjs';
5
+ import { B as BasePermissionHandler, C as ConversationHistory$1, r as resolveHappyOrgQueuedTurn, e as ensureManagedProviderMachine, M as MissingMachineIdError, s as syncControlledByUserState, b as MessageQueue2, h as hashObject, c as registerKillSessionHandler, d as MessageBuffer, f as buildHappyOrgTurnPrompt, w as waitForResponseCompleteWithAbort, i as finalizeHappyOrgTurnWithBusinessAck, j as buildTurnResultPushNotification, k as buildReadyPushNotification, l as launchRuntimeHandleWithFactoryResult, m as extractPermissionRequestPushContext, n as buildPermissionPushNotification, o as renderTerminalOutputPreview, p as inferToolResultError, q as forwardAgentMessageToProviderSession } from './registerKillSessionHandler-Buc97BEh.mjs';
6
+ import { g as getInitialGeminiModel, r as readGeminiLocalConfig, G as GEMINI_MODEL_ENV, b as closeProviderSession, s as saveGeminiModelToConfig, d as createGeminiBackend, e as stopCaffeinate } from './index-B9mt95QV.mjs';
7
+ import { B as BaseReasoningProcessor, b as bootstrapManagedProviderSession } from './BaseReasoningProcessor-Cbp6sIDm.mjs';
8
8
  import 'cross-spawn';
9
9
  import '@agentclientprotocol/sdk';
10
10
  import 'ps-list';
@@ -642,19 +642,27 @@ async function runGemini(opts) {
642
642
  const keepAliveInterval = setInterval(() => {
643
643
  session.keepAlive(thinking, "remote");
644
644
  }, 2e3);
645
- const sendReady = () => {
645
+ const sendReady = (opts2) => {
646
646
  session.sendSessionEvent({ type: "ready" });
647
+ if (opts2?.push === false) {
648
+ return;
649
+ }
647
650
  try {
651
+ const notification = buildReadyPushNotification({
652
+ providerLabel: "Gemini",
653
+ metadata: session.getMetadataSnapshot?.() ?? null,
654
+ sessionId: session.sessionId
655
+ });
648
656
  api.push().sendToAllDevices(
649
- "It's ready!",
650
- "Gemini is waiting for your command",
651
- { sessionId: session.sessionId }
657
+ notification.title,
658
+ notification.body,
659
+ notification.data
652
660
  );
653
661
  } catch (pushError) {
654
662
  logger.debug("[Gemini] Failed to send ready push", pushError);
655
663
  }
656
664
  };
657
- const emitReadyIfIdle = () => {
665
+ const emitReadyIfIdle = (opts2) => {
658
666
  if (shouldExit) {
659
667
  return false;
660
668
  }
@@ -667,7 +675,7 @@ async function runGemini(opts) {
667
675
  if (messageQueue.size() > 0) {
668
676
  return false;
669
677
  }
670
- sendReady();
678
+ sendReady(opts2);
671
679
  return true;
672
680
  };
673
681
  let abortController = new AbortController();
@@ -1021,6 +1029,24 @@ Guide: https://goo.gle/gemini-cli-auth-docs#workspace-gca`;
1021
1029
  break;
1022
1030
  }
1023
1031
  case "permission-request":
1032
+ try {
1033
+ const permissionRequest = extractPermissionRequestPushContext(msg);
1034
+ const notification = buildPermissionPushNotification({
1035
+ providerLabel: "Gemini",
1036
+ metadata: session.getMetadataSnapshot?.() ?? null,
1037
+ sessionId: session.sessionId,
1038
+ requestId: permissionRequest.requestId,
1039
+ toolName: permissionRequest.toolName,
1040
+ description: permissionRequest.description
1041
+ });
1042
+ api.push().sendToAllDevices(
1043
+ notification.title,
1044
+ notification.body,
1045
+ notification.data
1046
+ );
1047
+ } catch (pushError) {
1048
+ logger.debug("[Gemini] Failed to send permission push", pushError);
1049
+ }
1024
1050
  forwardAgentMessage(msg);
1025
1051
  break;
1026
1052
  case "exec-approval-request":
@@ -1158,6 +1184,7 @@ Guide: https://goo.gle/gemini-cli-auth-docs#workspace-gca`;
1158
1184
  const userMessageToShow = message.mode?.originalUserMessage || message.message;
1159
1185
  messageBuffer.addMessage(userMessageToShow, "user");
1160
1186
  isProcessingMessage = true;
1187
+ let sentTurnResultPush = false;
1161
1188
  let turnStatus = "task_complete";
1162
1189
  try {
1163
1190
  turnInFlight = true;
@@ -1339,8 +1366,49 @@ Guide: https://goo.gle/gemini-cli-auth-docs#workspace-gca`;
1339
1366
  };
1340
1367
  logger.debug(`[gemini] Sending complete message to mobile (length: ${finalMessageText.length}): ${finalMessageText.substring(0, 100)}...`);
1341
1368
  session.sendAgentMessage("gemini", messagePayload);
1369
+ if (!shouldExit) {
1370
+ try {
1371
+ const notification = buildTurnResultPushNotification({
1372
+ providerLabel: "Gemini",
1373
+ metadata: finalizedTurn.nextMetadata ?? session.getMetadataSnapshot?.() ?? null,
1374
+ sessionId: session.sessionId,
1375
+ report: finalizedTurn.report,
1376
+ responseText: messageText
1377
+ });
1378
+ if (notification) {
1379
+ api.push().sendToAllDevices(
1380
+ notification.title,
1381
+ notification.body,
1382
+ notification.data
1383
+ );
1384
+ sentTurnResultPush = true;
1385
+ }
1386
+ } catch (pushError) {
1387
+ logger.debug("[Gemini] Failed to send turn-result push", pushError);
1388
+ }
1389
+ }
1342
1390
  accumulatedResponse = "";
1343
1391
  isResponseInProgress = false;
1392
+ } else if (!shouldExit && finalizedTurn.report) {
1393
+ try {
1394
+ const notification = buildTurnResultPushNotification({
1395
+ providerLabel: "Gemini",
1396
+ metadata: finalizedTurn.nextMetadata ?? session.getMetadataSnapshot?.() ?? null,
1397
+ sessionId: session.sessionId,
1398
+ report: finalizedTurn.report,
1399
+ responseText: finalizedTurn.cleanedText
1400
+ });
1401
+ if (notification) {
1402
+ api.push().sendToAllDevices(
1403
+ notification.title,
1404
+ notification.body,
1405
+ notification.data
1406
+ );
1407
+ sentTurnResultPush = true;
1408
+ }
1409
+ } catch (pushError) {
1410
+ logger.debug("[Gemini] Failed to send turn-result push", pushError);
1411
+ }
1344
1412
  }
1345
1413
  session.sendAgentMessage("gemini", {
1346
1414
  type: "task_complete",
@@ -1350,7 +1418,7 @@ Guide: https://goo.gle/gemini-cli-auth-docs#workspace-gca`;
1350
1418
  taskStartedSent = false;
1351
1419
  thinking = false;
1352
1420
  session.keepAlive(thinking, "remote");
1353
- emitReadyIfIdle();
1421
+ readyAlreadySent = emitReadyIfIdle({ push: !sentTurnResultPush }) || readyAlreadySent;
1354
1422
  isProcessingMessage = false;
1355
1423
  applyPendingSessionSwap();
1356
1424
  logger.debug(`[gemini] Main loop: turn completed, continuing to next iteration (queue size: ${messageQueue.size()})`);