very-happy-cli 0.2.176 → 0.2.177
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/dist/{AcpBackend-9_ZI1Bv3.cjs → AcpBackend-B-ny68XM.cjs} +188 -37
- package/dist/{AcpBackend-COp6D8gl.mjs → AcpBackend-B0K0WrtW.mjs} +187 -38
- package/dist/{BasePermissionHandler-DPvLN7aR.cjs → BasePermissionHandler-DR6nxuEn.cjs} +1 -1
- package/dist/{BasePermissionHandler-ChMkmsGD.mjs → BasePermissionHandler-hdY7kTqX.mjs} +1 -1
- package/dist/{agentHome-BKi7tsE9.cjs → agentHome-BdTXEUPe.cjs} +4 -4
- package/dist/{agentHome-D61ZMLXM.mjs → agentHome-GRN2VfHv.mjs} +4 -4
- package/dist/{api-Buc_ejoA.cjs → api-BWX10o97.cjs} +15 -8
- package/dist/{api-CbwDDXJt.mjs → api-CKBViqI3.mjs} +16 -9
- package/dist/{apiMachine--PXoXwKq.cjs → apiMachine-BYYFGgFs.cjs} +14 -13
- package/dist/{apiMachine-CS7t3Rg-.mjs → apiMachine-DttO4UFj.mjs} +15 -14
- package/dist/{attachmentContent-BQYc8KpE.mjs → attachmentContent-cPVF463_.mjs} +1 -1
- package/dist/{attachmentContent-CFzzTeV9.cjs → attachmentContent-kJKXpkMX.cjs} +1 -1
- package/dist/{auth-B3xMoveE.mjs → auth-BmESeKuM.mjs} +5 -5
- package/dist/{auth-CBkmRIGw.mjs → auth-CKdXb9zp.mjs} +8 -8
- package/dist/{auth-CpO3ZUMz.cjs → auth-CTECt2Oz.cjs} +5 -5
- package/dist/{auth-LPvsVriN.cjs → auth-DNxVmVbn.cjs} +8 -8
- package/dist/{auto-DHGch_zK.mjs → auto-Ch3203qd.mjs} +16 -15
- package/dist/{auto-Dm3EIKT7.cjs → auto-D1ypjjfx.cjs} +14 -13
- package/dist/{backgroundTaskActivity-8PdPxrvy.mjs → backgroundTaskActivity-BVwJBl02.mjs} +1 -1
- package/dist/{bootstrap-BboDz_w2.cjs → bootstrap-6OI698q9.cjs} +2 -2
- package/dist/{bootstrap-CxuBAkJU.mjs → bootstrap-C0s2bPFQ.mjs} +2 -2
- package/dist/{browser-BvARP-YR.mjs → browser-BlLWZUMx.mjs} +1 -1
- package/dist/{browser-GQZJxD2n.cjs → browser-DG6Uof5O.cjs} +1 -1
- package/dist/{claudeLocal-B9EhFmD7.mjs → claudeLocal-CcWcKnoo.mjs} +5 -5
- package/dist/{claudeLocal-D-mujSX1.cjs → claudeLocal-CemsIArT.cjs} +4 -4
- package/dist/{claudeLocalLauncher-Bdl-9aU_.mjs → claudeLocalLauncher-7p6y88nj.mjs} +15 -18
- package/dist/{claudeLocalLauncher-Tbrx6TXF.cjs → claudeLocalLauncher-A4VuevIi.cjs} +14 -17
- package/dist/{claudeSessionFork-D_DKvDKE.mjs → claudeSessionFork-BtROOjqf.mjs} +1 -1
- package/dist/{claudeSessionFork-sOz97qqW.cjs → claudeSessionFork-CbDfm8Fz.cjs} +1 -1
- package/dist/{client-Cg6ABRe-.mjs → client-BPMWutfs.mjs} +3 -3
- package/dist/{client-D9pEOhn4.cjs → client-COmgDDy0.cjs} +2 -2
- package/dist/{client-Ryu9fllj.mjs → client-DG5ndWLw.mjs} +2 -2
- package/dist/{client-D7sSU04O.cjs → client-DyvBTYee.cjs} +3 -3
- package/dist/codex/happyMcpStdioBridge.cjs +14 -14
- package/dist/codex/happyMcpStdioBridge.mjs +15 -15
- package/dist/{codexAppServerClient-C70pJ-BB.mjs → codexAppServerClient-D-Z8qSfI.mjs} +10 -58
- package/dist/{codexAppServerClient-DsIUkVnX.cjs → codexAppServerClient-R24WZZfg.cjs} +6 -54
- package/dist/{codexCommand-Aycux-B7.cjs → codexCommand-6hW19gsq.cjs} +41 -63
- package/dist/{codexCommand-DWbA3pJN.mjs → codexCommand-CVTkZJ1o.mjs} +41 -63
- package/dist/{BaseReasoningProcessor-Dnf16mtJ.cjs → codexTermination-BBU7e92y.cjs} +25 -1
- package/dist/{BaseReasoningProcessor-pjvLSTQF.mjs → codexTermination-CCIfwzcx.mjs} +25 -2
- package/dist/{config-Bztmzu8z.mjs → config-CvsNChKX.mjs} +3 -3
- package/dist/{config-BcL0bxO5.cjs → config-DhdrvOLV.cjs} +3 -3
- package/dist/{configuration-BAwOtWFY.mjs → configuration-D55F0t16.mjs} +1 -1
- package/dist/{configuration-CpBrilxV.cjs → configuration-DZPy0T9Z.cjs} +1 -1
- package/dist/{connect-BeWQ4MMA.mjs → connect-CwCXMRmD.mjs} +12 -12
- package/dist/{connect-BBNCMTi8.cjs → connect-Wz-XZYXW.cjs} +11 -11
- package/dist/{context-Hk0j2Y9-.cjs → context-BKbrZ55r.cjs} +1 -1
- package/dist/{context-j114QJre.mjs → context-CCRpVXFo.mjs} +1 -1
- package/dist/{controlClient-00KYAjsI.mjs → controlClient-C4xB5J6O.mjs} +4 -4
- package/dist/{controlClient-bs_YqwDl.cjs → controlClient-SX8gSza2.cjs} +3 -3
- package/dist/{createSessionMetadata-D4Sj6H95.cjs → createSessionMetadata-BCFmYlBo.cjs} +2 -2
- package/dist/{createSessionMetadata-xlycGog5.mjs → createSessionMetadata-Bi-m0Y_O.mjs} +2 -2
- package/dist/{defaultPermissionMode-CMsiaRzr.cjs → defaultPermissionMode-DMBEnXll.cjs} +2 -2
- package/dist/{defaultPermissionMode-B97ox9p1.mjs → defaultPermissionMode-wBcbBezm.mjs} +2 -2
- package/dist/{deterministicJson-ucyv8j6b.mjs → deterministicJson-BkQETt8_.mjs} +8 -8
- package/dist/{deterministicJson-aHxtYLha.cjs → deterministicJson-ChGfQEF6.cjs} +8 -8
- package/dist/{doctor-D554c6Bg.mjs → doctor-B9c2C9dF.mjs} +8 -8
- package/dist/{doctor-BXkNXcok.cjs → doctor-BsN3JZJn.cjs} +7 -7
- package/dist/{downloadTarget-2_zMvt2N.mjs → downloadTarget-ByXzbDK4.mjs} +6 -6
- package/dist/{downloadTarget-CmdlljZW.cjs → downloadTarget-Dj3WoVJa.cjs} +6 -6
- package/dist/{ensureDaemonRunning-DJlziY-m.mjs → ensureDaemonRunning--HYzs5Ce.mjs} +5 -5
- package/dist/{ensureDaemonRunning-CY7iC--U.cjs → ensureDaemonRunning-7Wb8M7Lv.cjs} +5 -5
- package/dist/{handleResumeCommand-CNTnXBXA.mjs → handleResumeCommand-DHddBkNJ.mjs} +5 -5
- package/dist/{handleResumeCommand-lSVnvTNC.cjs → handleResumeCommand-OmuUGYjQ.cjs} +5 -5
- package/dist/{index-jeD70GGH.cjs → index-BRJzH4sc.cjs} +137 -83
- package/dist/{index-DY3I8j0W.mjs → index-BzJNDsJq.mjs} +139 -85
- package/dist/{index-B6UGRQ7h.mjs → index-CEjJnq05.mjs} +3 -0
- package/dist/{index-59hR7nVz.mjs → index-CEm0MYiS.mjs} +3 -3
- package/dist/{index-DhARRePz.cjs → index-CrR4JISa.cjs} +4 -4
- package/dist/{index-MwTVbeGW.cjs → index-D9NoYc5I.cjs} +3 -3
- package/dist/{index-D3kI0hDR.cjs → index-DFPT4HOO.cjs} +3 -0
- package/dist/{index-CxSLrTPA.mjs → index-Dhl6_bw7.mjs} +4 -4
- package/dist/index.cjs +2 -2
- package/dist/index.mjs +2 -2
- package/dist/{install-DXUEtGfU.cjs → install-1qn-D9FS.cjs} +3 -3
- package/dist/{install-DytIJ_Ia.mjs → install-BDIUtPXi.mjs} +3 -3
- package/dist/lib.cjs +10 -10
- package/dist/lib.d.cts +7 -1
- package/dist/lib.d.mts +7 -1
- package/dist/lib.mjs +11 -11
- package/dist/{lidState-CduPmrM0.mjs → lidState-BqVsw7H1.mjs} +1 -1
- package/dist/{lidState-UasMvPzw.cjs → lidState-DxbK0qfu.cjs} +1 -1
- package/dist/{localHappyAgentAuth-DL8JjHTV.mjs → localHappyAgentAuth-Ce8kO2yc.mjs} +1 -1
- package/dist/{localHappyAgentAuth-CA02WOny.cjs → localHappyAgentAuth-D5tANdRD.cjs} +1 -1
- package/dist/{logger-CihCDWDw.mjs → logger-13cBr_ew.mjs} +2 -2
- package/dist/{logger-zoO54Zsy.cjs → logger-LvwVeATU.cjs} +2 -2
- package/dist/{machineMetadata-BAKVtr-k.cjs → machineMetadata-29h7vgf4.cjs} +3 -3
- package/dist/{machineMetadata-DEZcQ_CQ.mjs → machineMetadata-dMida2qq.mjs} +3 -3
- package/dist/{main-BIvxyX71.cjs → main-DpM5jaFH.cjs} +44 -44
- package/dist/{main-DyJfNlL_.mjs → main-x4nAhdH5.mjs} +44 -44
- package/dist/{manager-2Il8XJVq.mjs → manager-BEsI4qt3.mjs} +1 -1
- package/dist/{mcp-yoIdGe6C.mjs → mcp-DMiFGYMT.mjs} +15 -15
- package/dist/{mcp-Dd11vHij.cjs → mcp-DQv3caXs.cjs} +14 -14
- package/dist/{mirrorProtocol-D-hF_SE5.cjs → mirrorProtocol-BfrERW7Z.cjs} +2 -2
- package/dist/{mirrorProtocol-BukXB5s3.mjs → mirrorProtocol-Bz8tEabR.mjs} +2 -2
- package/dist/{package-A7zOGx8B.cjs → package-Ch9WGDV_.cjs} +7 -7
- package/dist/{package-ayqGDKSp.mjs → package-CjlsAaRe.mjs} +7 -7
- package/dist/{peerTools-DDMSViPu.mjs → peerTools-CxmrKnfV.mjs} +4 -4
- package/dist/{peerTools-dPc9hRC5.cjs → peerTools-DtGKWli5.cjs} +4 -4
- package/dist/{persistence-Dy3lmall.mjs → persistence-C_tYtOqK.mjs} +2 -2
- package/dist/{persistence-Cih2AWml.cjs → persistence-DXbKOHxl.cjs} +2 -2
- package/dist/{piRunnerArgs-BuJgnUI5.cjs → piRunnerArgs-BVRZe2AR.cjs} +1 -1
- package/dist/{piRunnerArgs-D3z3-1VJ.mjs → piRunnerArgs-BpHc-JZl.mjs} +1 -1
- package/dist/{piRuntime-B-SPcWIr.cjs → piRuntime-D7eio8Ix.cjs} +1 -1
- package/dist/{piRuntime-kVGue-_5.mjs → piRuntime-DOdGF395.mjs} +1 -1
- package/dist/{piTerminal-aEtVdCJ2.mjs → piTerminal-dpxz4Q8D.mjs} +17 -17
- package/dist/{piTerminal-DSxK5aAm.cjs → piTerminal-y_PRo2NY.cjs} +16 -16
- package/dist/processTree-CMHWlVse.cjs +66 -0
- package/dist/processTree-CP5IvQ2Z.mjs +61 -0
- package/dist/{rateLimitWindows-82izLQy8.cjs → rateLimitWindows-DFnMU2Vt.cjs} +1 -1
- package/dist/{rateLimitWindows-E5DRjfE6.mjs → rateLimitWindows-DYHDGuzQ.mjs} +1 -1
- package/dist/{registerCommonHandlers-CqO075-X.cjs → registerCommonHandlers-60VuTkdg.cjs} +2 -2
- package/dist/{registerCommonHandlers-Bm7CMqMv.mjs → registerCommonHandlers-D8OMpBbQ.mjs} +2 -2
- package/dist/{registerKillSessionHandler-D02OY4vi.mjs → registerKillSessionHandler-Drhf7-Vz.mjs} +4 -4
- package/dist/{registerKillSessionHandler-WQra3T9B.cjs → registerKillSessionHandler-pqChBKwO.cjs} +4 -4
- package/dist/{remoteSessionClient-f3DYorl8.cjs → remoteSessionClient-B7NvjHD3.cjs} +5 -5
- package/dist/{remoteSessionClient-Buh6NejV.mjs → remoteSessionClient-D01Hso2-.mjs} +5 -5
- package/dist/{reportProgressTool-C5aSoKYX.mjs → reportProgressTool-B203EZCR.mjs} +1 -1
- package/dist/{reportProgressTool-C2gn_HWD.cjs → reportProgressTool-Du_zAK4h.cjs} +1 -1
- package/dist/{run-Drxogp0j.mjs → run-DX4Zs3Ug.mjs} +31 -31
- package/dist/{run-CDEmq6Zs.cjs → run-DZ5jU53c.cjs} +31 -31
- package/dist/{runClaude-BF6U2Js7.mjs → runClaude-CgPHXP0L.mjs} +25 -21
- package/dist/{runClaude-yEcZTCt_.cjs → runClaude-ClRhHpwR.cjs} +24 -20
- package/dist/{runClaudeDeps-CnNNFjlI.cjs → runClaudeDeps-D2v_WDSL.cjs} +384 -86
- package/dist/{runClaudeDeps-Bl4ndq7N.mjs → runClaudeDeps-Dz2iydq4.mjs} +390 -92
- package/dist/{runGemini-DDVDRNg4.cjs → runGemini-BtZqGFkp.cjs} +206 -191
- package/dist/{runGemini-C3wt7iv7.mjs → runGemini-DBXxpoY8.mjs} +206 -191
- package/dist/{runOpenClaw-CY6YHAvj.mjs → runOpenClaw-BOHpzCEU.mjs} +16 -16
- package/dist/{runOpenClaw-BzlVA_9Q.cjs → runOpenClaw-D8q8G57u.cjs} +15 -15
- package/dist/{sandbox-CX_wLwpq.mjs → sandbox-C452Vrsc.mjs} +4 -4
- package/dist/{sandbox-0UNHR3hP.cjs → sandbox-Cu9mMzjx.cjs} +4 -4
- package/dist/selfCheck-BAvqBwBR.mjs +84 -0
- package/dist/{selfCheck-FNwMFY8p.cjs → selfCheck-gKa3uVr1.cjs} +35 -35
- package/dist/{send-BQkl25g0.cjs → send-2Vb5eppI.cjs} +8 -8
- package/dist/{send-CpEGYict.mjs → send-B8HARi7x.mjs} +9 -9
- package/dist/{server-DnINX_Lm.mjs → server-BBWCIZyS.mjs} +4 -4
- package/dist/{server-BodFZ5sW.cjs → server-Db9Wuam3.cjs} +6 -6
- package/dist/{sessionLock-DOj6mMXn.cjs → sessionLock-6qL_N6Rn.cjs} +3 -3
- package/dist/{sessionLock-Ddn-fhZ0.mjs → sessionLock-ZfvFVdUi.mjs} +3 -3
- package/dist/{sessionModeFile-DDbonFR_.mjs → sessionModeFile-CWVq8AT9.mjs} +1 -1
- package/dist/{sessionModeFile-DVukoSp7.cjs → sessionModeFile-CsLtn_PL.cjs} +1 -1
- package/dist/{sessionOps-B1vQ25GS.mjs → sessionOps-CdgbEJgf.mjs} +5 -5
- package/dist/{sessionOps-Nryt1DZt.cjs → sessionOps-Dmt7WUUs.cjs} +4 -4
- package/dist/{sessionScanner-DCr3ofhR.mjs → sessionScanner-CNVaSNOn.mjs} +34 -4
- package/dist/{sessionScanner-D1h-cdte.cjs → sessionScanner-CQL_WSaC.cjs} +34 -3
- package/dist/{sessions-D2HsTbLf.cjs → sessions-BJblG_Hx.cjs} +9 -9
- package/dist/{sessions-DpAN6Ft9.mjs → sessions-DTomHfFg.mjs} +10 -10
- package/dist/{setupOfflineReconnection-DQHEp330.mjs → setupOfflineReconnection-C5trsV-j.mjs} +2 -2
- package/dist/{setupOfflineReconnection-B9Tw1Ouj.cjs → setupOfflineReconnection-DVA0VpQL.cjs} +2 -2
- package/dist/{spawn-CNjm1yOi.mjs → spawn-CQJFgoOq.mjs} +14 -13
- package/dist/{spawn-CvDZ38hi.cjs → spawn-DRyNAqD8.cjs} +12 -11
- package/dist/{spawnHappyCLI-C8Vl56wB.mjs → spawnHappyCLI-B_0RWxD4.mjs} +1 -1
- package/dist/{spawnHappyCLI-ahi4j6Mh.cjs → spawnHappyCLI-ChniczJ5.cjs} +1 -1
- package/dist/{specialCommands-BpqnGrOP.cjs → specialCommands-DbntVs0d.cjs} +3 -3
- package/dist/{specialCommands-DfVMGXTl.mjs → specialCommands-DkdFJi4N.mjs} +3 -3
- package/dist/{startFileWatcher-Ddn3L0u3.cjs → startFileWatcher-C292fhra.cjs} +1 -1
- package/dist/{startFileWatcher-DXJXY4AE.mjs → startFileWatcher-UQyTSRAP.mjs} +1 -1
- package/dist/{sync-BKvgkhPs.mjs → sync-C3p7-KLn.mjs} +1 -1
- package/dist/{sync-BgZuthoS.cjs → sync-C7sxoUYG.cjs} +1 -1
- package/dist/{systemPrompt-DuPem6c9.mjs → systemPrompt-CdHOlyVW.mjs} +1 -1
- package/dist/{systemPrompt-C6O1cHUg.cjs → systemPrompt-DtibzbRU.cjs} +1 -1
- package/dist/{teams-DifEhhmk.cjs → teams-D7O7TpVU.cjs} +6 -6
- package/dist/{teams-CffMBBfU.mjs → teams-ujXr3AFn.mjs} +6 -6
- package/dist/{time-s8CaneqW.cjs → time-Dg5tVB8S.cjs} +1 -1
- package/dist/{time-DxCTiteK.mjs → time-yEL6wHUF.mjs} +1 -1
- package/dist/{titleGenerator-CXr7t6cf.cjs → titleGenerator-BMEaDTwU.cjs} +2 -2
- package/dist/{titleGenerator-B5T7QSzu.mjs → titleGenerator-Dr-BtjzO.mjs} +1 -1
- package/dist/{todo-B41GKMcI.cjs → todo-CUcFamGs.cjs} +5 -5
- package/dist/{todo-DNO7s8td.mjs → todo-CvJe4M2C.mjs} +5 -5
- package/dist/{tools-697R1uqn.mjs → tools-BrM3bZW5.mjs} +1 -1
- package/dist/{tools-lotMyxIE.cjs → tools-DDKTB5aQ.cjs} +1 -1
- package/dist/{uninstall-CRu96len.cjs → uninstall-7oLuhYIu.cjs} +3 -3
- package/dist/{uninstall-CYO7EDjO.mjs → uninstall-CEcMMQGz.mjs} +3 -3
- package/package.json +7 -7
- package/dist/selfCheck-ClVv8NK3.mjs +0 -84
|
@@ -2,26 +2,26 @@ 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
4
|
import { join } from 'node:path';
|
|
5
|
-
import { c as connectionState, A as ApiClient } from './api-
|
|
6
|
-
import { l as logger } from './logger-
|
|
7
|
-
import { r as readSettings } from './persistence-
|
|
8
|
-
import { c as createSessionMetadata } from './createSessionMetadata-
|
|
5
|
+
import { c as connectionState, A as ApiClient } from './api-CKBViqI3.mjs';
|
|
6
|
+
import { l as logger } from './logger-13cBr_ew.mjs';
|
|
7
|
+
import { r as readSettings } from './persistence-C_tYtOqK.mjs';
|
|
8
|
+
import { c as createSessionMetadata } from './createSessionMetadata-Bi-m0Y_O.mjs';
|
|
9
9
|
import { e as errorLogMetadata, c as contentLogMetadata } from './contentLogMetadata-BlWI0egu.mjs';
|
|
10
|
-
import { g as getInitialMachineMetadata } from './machineMetadata-
|
|
11
|
-
import { M as MessageQueue2, r as registerKillSessionHandler } from './registerKillSessionHandler-
|
|
12
|
-
import { h as hashObject, s as startHappyServer } from './deterministicJson-
|
|
10
|
+
import { g as getInitialMachineMetadata } from './machineMetadata-dMida2qq.mjs';
|
|
11
|
+
import { M as MessageQueue2, r as registerKillSessionHandler } from './registerKillSessionHandler-Drhf7-Vz.mjs';
|
|
12
|
+
import { h as hashObject, s as startHappyServer } from './deterministicJson-BkQETt8_.mjs';
|
|
13
13
|
import { p as projectPath } from './projectPath-BTBIMB57.mjs';
|
|
14
14
|
import { M as MessageBuffer } from './messageBuffer-BWlGgR3A.mjs';
|
|
15
|
-
import { n as notifyDaemonSessionStarted } from './controlClient-
|
|
15
|
+
import { n as notifyDaemonSessionStarted } from './controlClient-C4xB5J6O.mjs';
|
|
16
16
|
import { e as encodeBase64 } from './authRelay-DSAvg1uv.mjs';
|
|
17
|
-
import { s as setupOfflineReconnection } from './setupOfflineReconnection-
|
|
18
|
-
import { A as AcpBackend } from './AcpBackend-
|
|
17
|
+
import { s as setupOfflineReconnection } from './setupOfflineReconnection-C5trsV-j.mjs';
|
|
18
|
+
import { A as AcpBackend, i as isAgentExitError } from './AcpBackend-B0K0WrtW.mjs';
|
|
19
19
|
import { a as GEMINI_API_KEY_ENV, b as GOOGLE_API_KEY_ENV, G as GEMINI_MODEL_ENV, C as CHANGE_TITLE_INSTRUCTION } from './constants-BC4St0xd.mjs';
|
|
20
|
-
import { readGeminiLocalConfig, determineGeminiModel, getGeminiModelSource, getInitialGeminiModel, saveGeminiModelToConfig } from './config-
|
|
21
|
-
import { B as BasePermissionHandler } from './BasePermissionHandler-
|
|
22
|
-
import { B as BaseReasoningProcessor } from './
|
|
20
|
+
import { readGeminiLocalConfig, determineGeminiModel, getGeminiModelSource, getInitialGeminiModel, saveGeminiModelToConfig } from './config-CvsNChKX.mjs';
|
|
21
|
+
import { B as BasePermissionHandler } from './BasePermissionHandler-hdY7kTqX.mjs';
|
|
22
|
+
import { B as BaseReasoningProcessor, s as settleCodexSession } from './codexTermination-CCIfwzcx.mjs';
|
|
23
23
|
import 'axios';
|
|
24
|
-
import './lidState-
|
|
24
|
+
import './lidState-BqVsw7H1.mjs';
|
|
25
25
|
import 'os';
|
|
26
26
|
import 'child_process';
|
|
27
27
|
import 'node:events';
|
|
@@ -31,52 +31,53 @@ import 'zod';
|
|
|
31
31
|
import './index-DMy3OCBe.mjs';
|
|
32
32
|
import '@paralleldrive/cuid2';
|
|
33
33
|
import './limits-DIo7rEBR.mjs';
|
|
34
|
-
import './time-
|
|
35
|
-
import './configuration-
|
|
34
|
+
import './time-yEL6wHUF.mjs';
|
|
35
|
+
import './configuration-D55F0t16.mjs';
|
|
36
36
|
import 'node:fs';
|
|
37
37
|
import 'node:os';
|
|
38
|
-
import './package-
|
|
38
|
+
import './package-CjlsAaRe.mjs';
|
|
39
39
|
import 'node:fs/promises';
|
|
40
|
-
import './registerCommonHandlers-
|
|
40
|
+
import './registerCommonHandlers-D8OMpBbQ.mjs';
|
|
41
41
|
import 'util';
|
|
42
42
|
import 'fs/promises';
|
|
43
43
|
import 'crypto';
|
|
44
44
|
import 'path';
|
|
45
45
|
import 'cross-spawn';
|
|
46
|
-
import './sync-
|
|
47
|
-
import './backgroundTaskActivity-
|
|
46
|
+
import './sync-C3p7-KLn.mjs';
|
|
47
|
+
import './backgroundTaskActivity-BVwJBl02.mjs';
|
|
48
48
|
import 'chalk';
|
|
49
49
|
import 'node:util';
|
|
50
50
|
import './detectCLI-CSGMlV51.mjs';
|
|
51
51
|
import 'fs';
|
|
52
|
-
import './localHappyAgentAuth-
|
|
52
|
+
import './localHappyAgentAuth-Ce8kO2yc.mjs';
|
|
53
53
|
import 'tweetnacl';
|
|
54
54
|
import './types-CkqAACXx.mjs';
|
|
55
|
-
import './client-
|
|
56
|
-
import './context-
|
|
57
|
-
import './sessionOps-
|
|
55
|
+
import './client-BPMWutfs.mjs';
|
|
56
|
+
import './context-CCRpVXFo.mjs';
|
|
57
|
+
import './sessionOps-CdgbEJgf.mjs';
|
|
58
58
|
import './resources-BdFBQi8r.mjs';
|
|
59
|
-
import './tools-
|
|
60
|
-
import './reportProgressTool-
|
|
61
|
-
import './client-
|
|
59
|
+
import './tools-BrM3bZW5.mjs';
|
|
60
|
+
import './reportProgressTool-B203EZCR.mjs';
|
|
61
|
+
import './client-DG5ndWLw.mjs';
|
|
62
62
|
import './precheckCompat-DeEbilbr.mjs';
|
|
63
63
|
import './agentGuidance-BDYt2Qy2.mjs';
|
|
64
64
|
import './trimIdent-BAjmv_TG.mjs';
|
|
65
|
-
import './peerTools-
|
|
65
|
+
import './peerTools-CxmrKnfV.mjs';
|
|
66
66
|
import './ids-DU6sLx4C.mjs';
|
|
67
|
-
import './remoteSessionClient-
|
|
67
|
+
import './remoteSessionClient-D01Hso2-.mjs';
|
|
68
68
|
import '@modelcontextprotocol/sdk/server/mcp.js';
|
|
69
69
|
import 'node:http';
|
|
70
70
|
import '@modelcontextprotocol/sdk/server/streamableHttp.js';
|
|
71
|
-
import './downloadTarget-
|
|
71
|
+
import './downloadTarget-ByXzbDK4.mjs';
|
|
72
72
|
import './terminals-Dlg0x3nY.mjs';
|
|
73
73
|
import 'node:child_process';
|
|
74
74
|
import './terminalTitleSuggest-CeKsX_V6.mjs';
|
|
75
75
|
import './tmuxSocket-B8Yx20sT.mjs';
|
|
76
|
-
import './bootstrap-
|
|
76
|
+
import './bootstrap-C0s2bPFQ.mjs';
|
|
77
77
|
import './previewPath-CXN4Vag0.mjs';
|
|
78
78
|
import 'url';
|
|
79
79
|
import '@agentclientprotocol/sdk';
|
|
80
|
+
import './processTree-CP5IvQ2Z.mjs';
|
|
80
81
|
|
|
81
82
|
const GEMINI_TIMEOUTS = {
|
|
82
83
|
/** Gemini CLI can be slow on first start (downloading models, etc.) */
|
|
@@ -891,6 +892,74 @@ ${formattedMessages}
|
|
|
891
892
|
}
|
|
892
893
|
}
|
|
893
894
|
|
|
895
|
+
function factsOf(error) {
|
|
896
|
+
if (error instanceof Error) {
|
|
897
|
+
const record = error;
|
|
898
|
+
const details = typeof record.data?.details === "string" ? record.data.details : typeof record.details === "string" ? record.details : "";
|
|
899
|
+
return { code: record.code, details, message: error.message, whole: `${details} ${error.message}`, empty: false };
|
|
900
|
+
}
|
|
901
|
+
if (error && typeof error === "object") {
|
|
902
|
+
const record = error;
|
|
903
|
+
const details = typeof record.data?.details === "string" ? record.data.details : typeof record.details === "string" ? record.details : "";
|
|
904
|
+
const message = typeof record.message === "string" ? record.message : typeof record.error?.message === "string" ? record.error.message : "";
|
|
905
|
+
let whole = `${details} ${message}`;
|
|
906
|
+
try {
|
|
907
|
+
whole += ` ${JSON.stringify(error)}`;
|
|
908
|
+
} catch {
|
|
909
|
+
}
|
|
910
|
+
return { code: record.code ?? record.status ?? record.response?.status, details, message, whole, empty: Object.keys(error).length === 0 };
|
|
911
|
+
}
|
|
912
|
+
return { code: void 0, details: "", message: String(error), whole: String(error), empty: false };
|
|
913
|
+
}
|
|
914
|
+
function quotaResetSuffix(text) {
|
|
915
|
+
const match = text.match(/reset after (\d+h)?(\d+m)?(\d+s)?/i);
|
|
916
|
+
if (!match) return "";
|
|
917
|
+
const parts = match.slice(1).filter(Boolean).join("");
|
|
918
|
+
return parts ? ` Quota resets in ${parts}.` : "";
|
|
919
|
+
}
|
|
920
|
+
const EMPTY_RESPONSE = /empty response|Model stream ended/i;
|
|
921
|
+
const TRANSIENT = /overloaded|UNAVAILABLE|\b503\b|ECONNRESET|socket hang up|ETIMEDOUT/i;
|
|
922
|
+
function isRetryableGeminiError(error) {
|
|
923
|
+
if (isAgentExitError(error)) return false;
|
|
924
|
+
const facts = factsOf(error);
|
|
925
|
+
if (/exhausted|quota|capacity/i.test(facts.whole)) return false;
|
|
926
|
+
return EMPTY_RESPONSE.test(facts.whole) || TRANSIENT.test(facts.whole);
|
|
927
|
+
}
|
|
928
|
+
function describeGeminiFailure(error, ctx) {
|
|
929
|
+
if (isAgentExitError(error)) {
|
|
930
|
+
return { kind: "exited", message: `Process exited unexpectedly: ${error.message}` };
|
|
931
|
+
}
|
|
932
|
+
const f = factsOf(error);
|
|
933
|
+
if (f.code === 404 || /notFound|\b404\b/.test(f.details) || /not found|\b404\b/.test(f.message)) {
|
|
934
|
+
return { kind: "not-found", message: `Gemini error: model "${ctx.model}" not found. Available models: gemini-2.5-pro, gemini-2.5-flash, gemini-2.5-flash-lite` };
|
|
935
|
+
}
|
|
936
|
+
if (EMPTY_RESPONSE.test(f.whole)) {
|
|
937
|
+
return { kind: "empty", message: "Gemini error: the API returned an empty response after retries. This is usually temporary \u2014 please try again." };
|
|
938
|
+
}
|
|
939
|
+
if (f.code === 429 || /\b429\b|rateLimitExceeded|RESOURCE_EXHAUSTED|Rate limit exceeded|Resource exhausted/i.test(f.whole)) {
|
|
940
|
+
return { kind: "rate-limit", message: "Gemini error: API rate limit exceeded. Please wait a moment and try again." };
|
|
941
|
+
}
|
|
942
|
+
if (/quota|exhausted|capacity/i.test(f.whole)) {
|
|
943
|
+
return { kind: "quota", message: `Gemini error: quota exceeded.${quotaResetSuffix(f.whole)} Try another model (gemini-2.5-flash-lite) or wait for the quota to reset.` };
|
|
944
|
+
}
|
|
945
|
+
if (f.code === -32e3 || /Authentication required/i.test(f.whole)) {
|
|
946
|
+
return {
|
|
947
|
+
kind: "auth",
|
|
948
|
+
message: "Gemini error: authentication required. For Google Workspace accounts set a Google Cloud project: `very-happy gemini project set <your-project-id>`; or use another Google account: `very-happy connect gemini`. Guide: https://goo.gle/gemini-cli-auth-docs#workspace-gca"
|
|
949
|
+
};
|
|
950
|
+
}
|
|
951
|
+
if (f.empty) {
|
|
952
|
+
return { kind: "not-installed", message: 'Gemini error: failed to start Gemini. Is the "gemini" CLI installed? Run: npm install -g @google/gemini-cli' };
|
|
953
|
+
}
|
|
954
|
+
const text = (f.details || f.message || "process error occurred").replace(/\s+/g, " ").trim();
|
|
955
|
+
return { kind: "other", message: `Gemini error: ${text.length > 400 ? `${text.slice(0, 399)}\u2026` : text}` };
|
|
956
|
+
}
|
|
957
|
+
function describeGeminiRetry(attempt, maxAttempts, error) {
|
|
958
|
+
const f = factsOf(error);
|
|
959
|
+
const why = EMPTY_RESPONSE.test(f.whole) ? "an empty response" : "a transient API error";
|
|
960
|
+
return `Gemini is retrying after ${why} (attempt ${attempt}/${maxAttempts})`;
|
|
961
|
+
}
|
|
962
|
+
|
|
894
963
|
async function runGemini(opts) {
|
|
895
964
|
const sessionTag = randomUUID();
|
|
896
965
|
connectionState.setBackend("Gemini");
|
|
@@ -1095,8 +1164,12 @@ async function runGemini(opts) {
|
|
|
1095
1164
|
let geminiBackend = null;
|
|
1096
1165
|
let acpSessionId = null;
|
|
1097
1166
|
let wasSessionCreated = false;
|
|
1167
|
+
let turnEnding = "completed";
|
|
1168
|
+
const turnAborted = () => turnEnding === "aborted";
|
|
1169
|
+
let backendGone = null;
|
|
1098
1170
|
async function handleAbort() {
|
|
1099
1171
|
logger.debug("[Gemini] Abort requested - stopping current task");
|
|
1172
|
+
turnEnding = "aborted";
|
|
1100
1173
|
session.sendAgentMessage("gemini", {
|
|
1101
1174
|
type: "turn_aborted",
|
|
1102
1175
|
id: randomUUID()
|
|
@@ -1104,6 +1177,7 @@ async function runGemini(opts) {
|
|
|
1104
1177
|
reasoningProcessor.abort();
|
|
1105
1178
|
diffProcessor.reset();
|
|
1106
1179
|
try {
|
|
1180
|
+
permissionHandler.abortAll();
|
|
1107
1181
|
abortController.abort();
|
|
1108
1182
|
messageQueue.reset();
|
|
1109
1183
|
if (geminiBackend && acpSessionId) {
|
|
@@ -1116,22 +1190,13 @@ async function runGemini(opts) {
|
|
|
1116
1190
|
abortController = new AbortController();
|
|
1117
1191
|
}
|
|
1118
1192
|
}
|
|
1119
|
-
const handleKillSession = async () => {
|
|
1120
|
-
logger.debug(
|
|
1193
|
+
const handleKillSession = async (intent = "archive") => {
|
|
1194
|
+
logger.debug(`[Gemini] Kill session requested (${intent}) - terminating process`);
|
|
1121
1195
|
await handleAbort();
|
|
1122
1196
|
logger.debug("[Gemini] Abort completed, proceeding with termination");
|
|
1123
1197
|
try {
|
|
1124
1198
|
if (session) {
|
|
1125
|
-
session.
|
|
1126
|
-
...currentMetadata,
|
|
1127
|
-
lifecycleState: "archived",
|
|
1128
|
-
lifecycleStateSince: Date.now(),
|
|
1129
|
-
archivedBy: "cli",
|
|
1130
|
-
archiveReason: "User terminated"
|
|
1131
|
-
}));
|
|
1132
|
-
session.sendSessionDeath();
|
|
1133
|
-
await session.flush();
|
|
1134
|
-
await session.close();
|
|
1199
|
+
await settleCodexSession(session, intent, (id) => api.deactivateSession(id), (m, e) => logger.debug(m, e));
|
|
1135
1200
|
}
|
|
1136
1201
|
happyServer.stop();
|
|
1137
1202
|
if (geminiBackend) {
|
|
@@ -1145,7 +1210,7 @@ async function runGemini(opts) {
|
|
|
1145
1210
|
}
|
|
1146
1211
|
};
|
|
1147
1212
|
session.rpcHandlerManager.registerHandler("abort", handleAbort);
|
|
1148
|
-
registerKillSessionHandler(session.rpcHandlerManager, handleKillSession, session);
|
|
1213
|
+
registerKillSessionHandler(session.rpcHandlerManager, () => handleKillSession("archive"), session, { processSignals: true, onSignal: () => handleKillSession("offline") });
|
|
1149
1214
|
const messageBuffer = new MessageBuffer();
|
|
1150
1215
|
const hasTTY = process.stdout.isTTY && process.stdin.isTTY;
|
|
1151
1216
|
let inkInstance = null;
|
|
@@ -1248,10 +1313,9 @@ async function runGemini(opts) {
|
|
|
1248
1313
|
});
|
|
1249
1314
|
if (msg.status === "error") {
|
|
1250
1315
|
logger.debug("[gemini] Error status received:", contentLogMetadata(statusDetail));
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
});
|
|
1316
|
+
}
|
|
1317
|
+
if (msg.status === "stopped") {
|
|
1318
|
+
backendGone = new Error(statusDetail || "gemini process exited");
|
|
1255
1319
|
}
|
|
1256
1320
|
if (msg.status === "running") {
|
|
1257
1321
|
thinking = true;
|
|
@@ -1266,31 +1330,6 @@ async function runGemini(opts) {
|
|
|
1266
1330
|
messageBuffer.addMessage("Thinking...", "system");
|
|
1267
1331
|
} else if (msg.status === "idle" || msg.status === "stopped") {
|
|
1268
1332
|
reasoningProcessor.complete();
|
|
1269
|
-
} else if (msg.status === "error") {
|
|
1270
|
-
thinking = false;
|
|
1271
|
-
session.keepAlive(thinking, "remote");
|
|
1272
|
-
accumulatedResponse = "";
|
|
1273
|
-
isResponseInProgress = false;
|
|
1274
|
-
let errorMessage = "Unknown error";
|
|
1275
|
-
if (msg.detail) {
|
|
1276
|
-
if (typeof msg.detail === "object") {
|
|
1277
|
-
const detailObj = msg.detail;
|
|
1278
|
-
errorMessage = detailObj.message || detailObj.details || JSON.stringify(detailObj);
|
|
1279
|
-
} else {
|
|
1280
|
-
errorMessage = String(msg.detail);
|
|
1281
|
-
}
|
|
1282
|
-
}
|
|
1283
|
-
if (errorMessage.includes("Authentication required")) {
|
|
1284
|
-
errorMessage = `Authentication required.
|
|
1285
|
-
For Google Workspace accounts, run: very-happy gemini project set <project-id>
|
|
1286
|
-
Or use a different Google account: very-happy connect gemini
|
|
1287
|
-
Guide: https://goo.gle/gemini-cli-auth-docs#workspace-gca`;
|
|
1288
|
-
}
|
|
1289
|
-
messageBuffer.addMessage(`Error: ${errorMessage}`, "status");
|
|
1290
|
-
session.sendAgentMessage("gemini", {
|
|
1291
|
-
type: "message",
|
|
1292
|
-
message: `Error: ${errorMessage}`
|
|
1293
|
-
});
|
|
1294
1333
|
}
|
|
1295
1334
|
break;
|
|
1296
1335
|
case "tool-call":
|
|
@@ -1483,55 +1522,68 @@ Guide: https://goo.gle/gemini-cli-auth-docs#workspace-gca`;
|
|
|
1483
1522
|
if (!message) {
|
|
1484
1523
|
break;
|
|
1485
1524
|
}
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
messageBuffer.addMessage("\u2550".repeat(40), "status");
|
|
1490
|
-
if (conversationHistory.hasHistory()) {
|
|
1491
|
-
messageBuffer.addMessage(`Switching model (preserving ${conversationHistory.size()} messages of context)...`, "status");
|
|
1492
|
-
injectHistoryContext = true;
|
|
1493
|
-
logger.debug("[Gemini] Will inject conversation history");
|
|
1494
|
-
} else {
|
|
1495
|
-
messageBuffer.addMessage("Starting new Gemini session (mode changed)...", "status");
|
|
1496
|
-
}
|
|
1497
|
-
permissionHandler.reset();
|
|
1498
|
-
reasoningProcessor.abort();
|
|
1499
|
-
if (geminiBackend) {
|
|
1500
|
-
await geminiBackend.dispose();
|
|
1501
|
-
geminiBackend = null;
|
|
1502
|
-
}
|
|
1503
|
-
const modelToUse = message.mode?.model === void 0 ? void 0 : message.mode.model || null;
|
|
1504
|
-
const backendResult = createGeminiBackend({
|
|
1505
|
-
cwd: process.cwd(),
|
|
1506
|
-
mcpServers,
|
|
1507
|
-
permissionHandler,
|
|
1508
|
-
cloudToken,
|
|
1509
|
-
currentUserEmail,
|
|
1510
|
-
// Pass model from message - if undefined, will use local config/env/default
|
|
1511
|
-
// If explicitly null, will skip local config and use env/default
|
|
1512
|
-
model: modelToUse
|
|
1513
|
-
});
|
|
1514
|
-
geminiBackend = backendResult.backend;
|
|
1515
|
-
setupGeminiMessageHandler(geminiBackend);
|
|
1516
|
-
const actualModel = backendResult.model;
|
|
1517
|
-
logger.debug(`[gemini] Model change - modelToUse=${modelToUse}, actualModel=${actualModel} (from ${backendResult.modelSource})`);
|
|
1518
|
-
conversationHistory.setCurrentModel(actualModel);
|
|
1519
|
-
logger.debug("[gemini] Starting new ACP session with model:", actualModel);
|
|
1520
|
-
const { sessionId } = await geminiBackend.startSession();
|
|
1521
|
-
acpSessionId = sessionId;
|
|
1522
|
-
logger.debug(`[gemini] New ACP session started: ${acpSessionId}`);
|
|
1523
|
-
logger.debug(`[gemini] Calling updateDisplayedModel with: ${actualModel}`);
|
|
1524
|
-
updateDisplayedModel(actualModel, false);
|
|
1525
|
-
updatePermissionMode(message.mode.permissionMode);
|
|
1526
|
-
wasSessionCreated = true;
|
|
1527
|
-
currentModeHash = message.hash;
|
|
1528
|
-
first = false;
|
|
1525
|
+
if (!thinking) {
|
|
1526
|
+
thinking = true;
|
|
1527
|
+
session.keepAlive(thinking, "remote");
|
|
1529
1528
|
}
|
|
1529
|
+
turnEnding = "completed";
|
|
1530
|
+
let injectHistoryContext = false;
|
|
1531
|
+
let restartAfterExit = false;
|
|
1530
1532
|
currentModeHash = message.hash;
|
|
1531
1533
|
const userMessageToShow = message.mode?.originalUserMessage || message.message;
|
|
1532
1534
|
messageBuffer.addMessage(userMessageToShow, "user");
|
|
1533
1535
|
isProcessingMessage = true;
|
|
1534
1536
|
try {
|
|
1537
|
+
restartAfterExit = backendGone !== null;
|
|
1538
|
+
if (restartAfterExit) {
|
|
1539
|
+
logger.debug(`[Gemini] Restarting Gemini after it exited: ${backendGone?.message ?? "unknown"}`);
|
|
1540
|
+
backendGone = null;
|
|
1541
|
+
session.sendSessionEvent({ type: "message", message: `Gemini was restarted after its process exited; the conversation so far is re-sent to it as context.` });
|
|
1542
|
+
}
|
|
1543
|
+
if (restartAfterExit || wasSessionCreated && currentModeHash && message.hash !== currentModeHash) {
|
|
1544
|
+
logger.debug("[Gemini] Mode changed or process gone \u2013 restarting Gemini session");
|
|
1545
|
+
messageBuffer.addMessage("\u2550".repeat(40), "status");
|
|
1546
|
+
if (conversationHistory.hasHistory()) {
|
|
1547
|
+
messageBuffer.addMessage(`${restartAfterExit ? "Restarting Gemini" : "Switching model"} (preserving ${conversationHistory.size()} messages of context)...`, "status");
|
|
1548
|
+
injectHistoryContext = true;
|
|
1549
|
+
logger.debug("[Gemini] Will inject conversation history");
|
|
1550
|
+
} else {
|
|
1551
|
+
messageBuffer.addMessage(restartAfterExit ? "Restarting Gemini..." : "Starting new Gemini session (mode changed)...", "status");
|
|
1552
|
+
}
|
|
1553
|
+
permissionHandler.reset();
|
|
1554
|
+
reasoningProcessor.abort();
|
|
1555
|
+
if (geminiBackend) {
|
|
1556
|
+
await geminiBackend.dispose();
|
|
1557
|
+
geminiBackend = null;
|
|
1558
|
+
}
|
|
1559
|
+
acpSessionId = null;
|
|
1560
|
+
const modelToUse = message.mode?.model === void 0 ? void 0 : message.mode.model || null;
|
|
1561
|
+
const backendResult = createGeminiBackend({
|
|
1562
|
+
cwd: process.cwd(),
|
|
1563
|
+
mcpServers,
|
|
1564
|
+
permissionHandler,
|
|
1565
|
+
cloudToken,
|
|
1566
|
+
currentUserEmail,
|
|
1567
|
+
// Pass model from message - if undefined, will use local config/env/default
|
|
1568
|
+
// If explicitly null, will skip local config and use env/default
|
|
1569
|
+
model: modelToUse
|
|
1570
|
+
});
|
|
1571
|
+
geminiBackend = backendResult.backend;
|
|
1572
|
+
setupGeminiMessageHandler(geminiBackend);
|
|
1573
|
+
const actualModel = backendResult.model;
|
|
1574
|
+
logger.debug(`[gemini] Model change - modelToUse=${modelToUse}, actualModel=${actualModel} (from ${backendResult.modelSource})`);
|
|
1575
|
+
conversationHistory.setCurrentModel(actualModel);
|
|
1576
|
+
logger.debug("[gemini] Starting new ACP session with model:", actualModel);
|
|
1577
|
+
const { sessionId } = await geminiBackend.startSession();
|
|
1578
|
+
acpSessionId = sessionId;
|
|
1579
|
+
logger.debug(`[gemini] New ACP session started: ${acpSessionId}`);
|
|
1580
|
+
logger.debug(`[gemini] Calling updateDisplayedModel with: ${actualModel}`);
|
|
1581
|
+
updateDisplayedModel(actualModel, false);
|
|
1582
|
+
updatePermissionMode(message.mode.permissionMode);
|
|
1583
|
+
wasSessionCreated = true;
|
|
1584
|
+
currentModeHash = message.hash;
|
|
1585
|
+
first = false;
|
|
1586
|
+
}
|
|
1535
1587
|
if (first || !wasSessionCreated) {
|
|
1536
1588
|
if (!geminiBackend) {
|
|
1537
1589
|
const modelToUse = message.mode?.model === void 0 ? void 0 : message.mode.model || null;
|
|
@@ -1585,49 +1637,37 @@ Guide: https://goo.gle/gemini-cli-auth-docs#workspace-gca`;
|
|
|
1585
1637
|
logger.debug("[gemini] Sending prompt to Gemini:", contentLogMetadata(promptToSend));
|
|
1586
1638
|
const MAX_RETRIES = 3;
|
|
1587
1639
|
const RETRY_DELAY_MS = 2e3;
|
|
1588
|
-
let lastError = null;
|
|
1589
1640
|
for (let attempt = 1; attempt <= MAX_RETRIES; attempt++) {
|
|
1590
1641
|
try {
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1642
|
+
accumulatedResponse = "";
|
|
1643
|
+
isResponseInProgress = false;
|
|
1644
|
+
const outcome = await geminiBackend.sendPrompt(acpSessionId, promptToSend);
|
|
1645
|
+
const stopReason = outcome && typeof outcome === "object" ? outcome.stopReason : void 0;
|
|
1646
|
+
logger.debug(`[gemini] Prompt answered (stopReason=${stopReason ?? "none"})`);
|
|
1647
|
+
if (stopReason === "cancelled") {
|
|
1648
|
+
if (!turnAborted()) {
|
|
1649
|
+
turnEnding = "aborted";
|
|
1650
|
+
session.sendAgentMessage("gemini", { type: "turn_aborted", id: randomUUID() });
|
|
1651
|
+
}
|
|
1652
|
+
} else if (stopReason === "error") {
|
|
1653
|
+
throw new Error("the turn ended with an error reported by the agent");
|
|
1654
|
+
} else if (stopReason && stopReason !== "end_turn") {
|
|
1655
|
+
session.sendSessionEvent({ type: "message", message: `Gemini stopped the turn: ${stopReason}` });
|
|
1596
1656
|
}
|
|
1597
1657
|
break;
|
|
1598
1658
|
} catch (promptError) {
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
if (isQuotaError) {
|
|
1605
|
-
const resetTimeMatch = errorDetails.match(/reset after (\d+h)?(\d+m)?(\d+s)?/i);
|
|
1606
|
-
let resetTimeMsg = "";
|
|
1607
|
-
if (resetTimeMatch) {
|
|
1608
|
-
const parts = resetTimeMatch.slice(1).filter(Boolean).join("");
|
|
1609
|
-
resetTimeMsg = ` Quota resets in ${parts}.`;
|
|
1610
|
-
}
|
|
1611
|
-
const quotaMsg = `Gemini quota exceeded.${resetTimeMsg} Try using a different model (gemini-2.5-flash-lite) or wait for quota reset.`;
|
|
1612
|
-
messageBuffer.addMessage(quotaMsg, "status");
|
|
1613
|
-
session.sendAgentMessage("gemini", { type: "message", message: quotaMsg });
|
|
1614
|
-
throw promptError;
|
|
1615
|
-
}
|
|
1616
|
-
const isEmptyResponseError = errorDetails.includes("empty response") || errorDetails.includes("Model stream ended");
|
|
1617
|
-
const isInternalError = errorCode === -32603;
|
|
1618
|
-
const isRetryable = isEmptyResponseError || isInternalError;
|
|
1619
|
-
if (isRetryable && attempt < MAX_RETRIES) {
|
|
1620
|
-
logger.debug(`[gemini] Retryable error on attempt ${attempt}/${MAX_RETRIES}:`, contentLogMetadata(errorDetails));
|
|
1621
|
-
messageBuffer.addMessage(`Gemini returned empty response, retrying (${attempt}/${MAX_RETRIES})...`, "status");
|
|
1659
|
+
if (isRetryableGeminiError(promptError) && attempt < MAX_RETRIES) {
|
|
1660
|
+
const notice = describeGeminiRetry(attempt, MAX_RETRIES, promptError);
|
|
1661
|
+
logger.debug(`[gemini] Retryable error on attempt ${attempt}/${MAX_RETRIES}:`, errorLogMetadata(promptError));
|
|
1662
|
+
messageBuffer.addMessage(notice, "status");
|
|
1663
|
+
session.sendSessionEvent({ type: "message", message: notice });
|
|
1622
1664
|
await new Promise((resolve2) => setTimeout(resolve2, RETRY_DELAY_MS * attempt));
|
|
1665
|
+
if (turnAborted()) throw promptError;
|
|
1623
1666
|
continue;
|
|
1624
1667
|
}
|
|
1625
1668
|
throw promptError;
|
|
1626
1669
|
}
|
|
1627
1670
|
}
|
|
1628
|
-
if (lastError && MAX_RETRIES > 1) {
|
|
1629
|
-
logger.debug("[gemini] Prompt succeeded after retries");
|
|
1630
|
-
}
|
|
1631
1671
|
if (first) {
|
|
1632
1672
|
first = false;
|
|
1633
1673
|
}
|
|
@@ -1635,49 +1675,22 @@ Guide: https://goo.gle/gemini-cli-auth-docs#workspace-gca`;
|
|
|
1635
1675
|
logger.debug("[gemini] Error in gemini session:", errorLogMetadata(error));
|
|
1636
1676
|
const isAbortError = error instanceof Error && error.name === "AbortError";
|
|
1637
1677
|
if (isAbortError) {
|
|
1678
|
+
turnEnding = "aborted";
|
|
1638
1679
|
messageBuffer.addMessage("Aborted by user", "status");
|
|
1639
1680
|
session.sendSessionEvent({ type: "message", message: "Aborted by user" });
|
|
1640
1681
|
} else {
|
|
1641
|
-
|
|
1642
|
-
if (
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
errorMsg = "Gemini API returned empty response after retries. This is a temporary issue - please try again.";
|
|
1653
|
-
} else if (errorCode === 429 || errorDetails.includes("429") || errorMessage.includes("429") || errorString.includes("429") || errorDetails.includes("rateLimitExceeded") || errorDetails.includes("RESOURCE_EXHAUSTED") || errorMessage.includes("Rate limit exceeded") || errorMessage.includes("Resource exhausted") || errorString.includes("rateLimitExceeded") || errorString.includes("RESOURCE_EXHAUSTED")) {
|
|
1654
|
-
errorMsg = "Gemini API rate limit exceeded. Please wait a moment and try again. The API will retry automatically.";
|
|
1655
|
-
} else if (errorDetails.includes("quota") || errorMessage.includes("quota") || errorString.includes("quota") || errorDetails.includes("exhausted") || errorDetails.includes("capacity")) {
|
|
1656
|
-
const resetTimeMatch = (errorDetails + errorMessage + errorString).match(/reset after (\d+h)?(\d+m)?(\d+s)?/i);
|
|
1657
|
-
let resetTimeMsg = "";
|
|
1658
|
-
if (resetTimeMatch) {
|
|
1659
|
-
const parts = resetTimeMatch.slice(1).filter(Boolean).join("");
|
|
1660
|
-
resetTimeMsg = ` Quota resets in ${parts}.`;
|
|
1661
|
-
}
|
|
1662
|
-
errorMsg = `Gemini quota exceeded.${resetTimeMsg} Try using a different model (gemini-2.5-flash-lite) or wait for quota reset.`;
|
|
1663
|
-
} else if (errorMessage.includes("Authentication required") || errorDetails.includes("Authentication required") || errorCode === -32e3) {
|
|
1664
|
-
errorMsg = `Authentication required. For Google Workspace accounts, you need to set a Google Cloud Project:
|
|
1665
|
-
very-happy gemini project set <your-project-id>
|
|
1666
|
-
Or use a different Google account: very-happy connect gemini
|
|
1667
|
-
Guide: https://goo.gle/gemini-cli-auth-docs#workspace-gca`;
|
|
1668
|
-
} else if (Object.keys(error).length === 0) {
|
|
1669
|
-
errorMsg = 'Failed to start Gemini. Is "gemini" CLI installed? Run: npm install -g @google/gemini-cli';
|
|
1670
|
-
} else if (errObj.message || errorMessage) {
|
|
1671
|
-
errorMsg = errorDetails || errorMessage || errObj.message;
|
|
1672
|
-
}
|
|
1673
|
-
} else if (error instanceof Error) {
|
|
1674
|
-
errorMsg = error.message;
|
|
1682
|
+
const failure = describeGeminiFailure(error, { model: displayedModel || "gemini-2.5-pro" });
|
|
1683
|
+
if (failure.kind === "exited" && error instanceof Error) {
|
|
1684
|
+
backendGone = error;
|
|
1685
|
+
} else if (restartAfterExit && !acpSessionId && error instanceof Error) {
|
|
1686
|
+
backendGone = error;
|
|
1687
|
+
}
|
|
1688
|
+
messageBuffer.addMessage(failure.message, "status");
|
|
1689
|
+
session.sendSessionEvent({ type: "message", message: failure.message });
|
|
1690
|
+
if (!turnAborted()) {
|
|
1691
|
+
turnEnding = "failed";
|
|
1692
|
+
session.sendAgentMessage("gemini", { type: "turn_aborted", id: randomUUID() });
|
|
1675
1693
|
}
|
|
1676
|
-
messageBuffer.addMessage(errorMsg, "status");
|
|
1677
|
-
session.sendAgentMessage("gemini", {
|
|
1678
|
-
type: "message",
|
|
1679
|
-
message: errorMsg
|
|
1680
|
-
});
|
|
1681
1694
|
}
|
|
1682
1695
|
} finally {
|
|
1683
1696
|
permissionHandler.reset();
|
|
@@ -1705,10 +1718,12 @@ Guide: https://goo.gle/gemini-cli-auth-docs#workspace-gca`;
|
|
|
1705
1718
|
accumulatedResponse = "";
|
|
1706
1719
|
isResponseInProgress = false;
|
|
1707
1720
|
}
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1721
|
+
if (turnEnding === "completed") {
|
|
1722
|
+
session.sendAgentMessage("gemini", {
|
|
1723
|
+
type: "task_complete",
|
|
1724
|
+
id: randomUUID()
|
|
1725
|
+
});
|
|
1726
|
+
}
|
|
1712
1727
|
hadToolCallInTurn = false;
|
|
1713
1728
|
pendingChangeTitle = false;
|
|
1714
1729
|
changeTitleCompleted = false;
|
|
@@ -3,23 +3,23 @@ import { execFileSync } from 'node:child_process';
|
|
|
3
3
|
import os from 'node:os';
|
|
4
4
|
import { existsSync, readFileSync } from 'node:fs';
|
|
5
5
|
import { join } from 'node:path';
|
|
6
|
-
import { c as connectionState, A as ApiClient } from './api-
|
|
6
|
+
import { c as connectionState, A as ApiClient } from './api-CKBViqI3.mjs';
|
|
7
7
|
import { A as AcpSessionManager } from './AcpSessionManager-DykjzBM4.mjs';
|
|
8
|
-
import { l as logger } from './logger-
|
|
9
|
-
import { M as MessageQueue2, r as registerKillSessionHandler } from './registerKillSessionHandler-
|
|
10
|
-
import { r as readSettings } from './persistence-
|
|
11
|
-
import { g as getInitialMachineMetadata } from './machineMetadata-
|
|
12
|
-
import { c as createSessionMetadata } from './createSessionMetadata-
|
|
13
|
-
import { s as setupOfflineReconnection } from './setupOfflineReconnection-
|
|
14
|
-
import { n as notifyDaemonSessionStarted } from './controlClient-
|
|
8
|
+
import { l as logger } from './logger-13cBr_ew.mjs';
|
|
9
|
+
import { M as MessageQueue2, r as registerKillSessionHandler } from './registerKillSessionHandler-Drhf7-Vz.mjs';
|
|
10
|
+
import { r as readSettings } from './persistence-C_tYtOqK.mjs';
|
|
11
|
+
import { g as getInitialMachineMetadata } from './machineMetadata-dMida2qq.mjs';
|
|
12
|
+
import { c as createSessionMetadata } from './createSessionMetadata-Bi-m0Y_O.mjs';
|
|
13
|
+
import { s as setupOfflineReconnection } from './setupOfflineReconnection-C5trsV-j.mjs';
|
|
14
|
+
import { n as notifyDaemonSessionStarted } from './controlClient-C4xB5J6O.mjs';
|
|
15
15
|
import { e as encodeBase64 } from './authRelay-DSAvg1uv.mjs';
|
|
16
16
|
import WebSocket from 'ws';
|
|
17
17
|
import * as ed from '@noble/ed25519';
|
|
18
18
|
import { sha512 } from '@noble/hashes/sha2.js';
|
|
19
|
-
import { f as ensurePrivateDirectorySync, a as hardenPrivateFileSync, w as writePrivateFileSync, c as configuration } from './configuration-
|
|
19
|
+
import { f as ensurePrivateDirectorySync, a as hardenPrivateFileSync, w as writePrivateFileSync, c as configuration } from './configuration-D55F0t16.mjs';
|
|
20
20
|
import { e as errorLogMetadata, c as contentLogMetadata } from './contentLogMetadata-BlWI0egu.mjs';
|
|
21
21
|
import 'axios';
|
|
22
|
-
import './lidState-
|
|
22
|
+
import './lidState-BqVsw7H1.mjs';
|
|
23
23
|
import 'os';
|
|
24
24
|
import 'child_process';
|
|
25
25
|
import 'node:events';
|
|
@@ -29,8 +29,8 @@ import 'zod';
|
|
|
29
29
|
import './index-DMy3OCBe.mjs';
|
|
30
30
|
import '@paralleldrive/cuid2';
|
|
31
31
|
import './limits-DIo7rEBR.mjs';
|
|
32
|
-
import './time-
|
|
33
|
-
import './registerCommonHandlers-
|
|
32
|
+
import './time-yEL6wHUF.mjs';
|
|
33
|
+
import './registerCommonHandlers-D8OMpBbQ.mjs';
|
|
34
34
|
import 'util';
|
|
35
35
|
import 'fs/promises';
|
|
36
36
|
import 'crypto';
|
|
@@ -38,17 +38,17 @@ import 'path';
|
|
|
38
38
|
import 'cross-spawn';
|
|
39
39
|
import './projectPath-BTBIMB57.mjs';
|
|
40
40
|
import 'url';
|
|
41
|
-
import './sync-
|
|
42
|
-
import './backgroundTaskActivity-
|
|
41
|
+
import './sync-C3p7-KLn.mjs';
|
|
42
|
+
import './backgroundTaskActivity-BVwJBl02.mjs';
|
|
43
43
|
import 'chalk';
|
|
44
44
|
import 'node:util';
|
|
45
45
|
import 'tweetnacl';
|
|
46
46
|
import './types-CkqAACXx.mjs';
|
|
47
47
|
import 'node:fs/promises';
|
|
48
|
-
import './package-
|
|
48
|
+
import './package-CjlsAaRe.mjs';
|
|
49
49
|
import './detectCLI-CSGMlV51.mjs';
|
|
50
50
|
import 'fs';
|
|
51
|
-
import './localHappyAgentAuth-
|
|
51
|
+
import './localHappyAgentAuth-Ce8kO2yc.mjs';
|
|
52
52
|
|
|
53
53
|
ed.hashes.sha512 = (message) => sha512(message);
|
|
54
54
|
const { getPublicKeyAsync, signAsync, utils } = ed;
|