very-happy-cli 0.2.191 → 0.2.193
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-CCy_9AfR.mjs → AcpBackend-B4PwjqHt.mjs} +3 -3
- package/dist/{AcpBackend-DgrIc1vH.cjs → AcpBackend-DtJCgftG.cjs} +3 -3
- package/dist/{AcpSessionManager-CQnxx7gD.mjs → AcpSessionManager-BzKWgkdP.mjs} +2 -2
- package/dist/{AcpSessionManager-DVOzCD3P.cjs → AcpSessionManager-D4qshX_H.cjs} +2 -2
- package/dist/{BasePermissionHandler-C9Ag7yvs.cjs → BasePermissionHandler-5iG-cvA2.cjs} +1 -1
- package/dist/{BasePermissionHandler-DYLN6Ec9.mjs → BasePermissionHandler-DV6UM6e9.mjs} +1 -1
- package/dist/account-Dco_nGT4.mjs +297 -0
- package/dist/account-DvpA60oU.cjs +302 -0
- package/dist/accountService-Cd7bnkfd.mjs +916 -0
- package/dist/accountService-CuUSJDhP.cjs +921 -0
- package/dist/{acpSessionResume-TvP_4Zq2.cjs → acpSessionResume-Bk9mjXZ9.cjs} +1 -1
- package/dist/{acpSessionResume-Bi7pA1n_.mjs → acpSessionResume-TQwN9ZZE.mjs} +1 -1
- package/dist/{agentHome-DGv105SR.mjs → agentHome-Bep8semY.mjs} +4 -4
- package/dist/{agentHome-DNUKJWOY.cjs → agentHome-c2dlgcw1.cjs} +4 -4
- package/dist/{api-BBxZ7y2z.cjs → api-CBE_a88I.cjs} +10 -10
- package/dist/{api-jfeMRg5R.mjs → api-DUfunY3x.mjs} +10 -10
- package/dist/{apiMachine-DqyjKBZG.cjs → apiMachine-BqtG0IWm.cjs} +83 -27
- package/dist/{apiMachine-DRJ7y-BB.mjs → apiMachine-CU_bw5nV.mjs} +78 -22
- package/dist/{attachmentContent-BO2njyza.cjs → attachmentContent-B3AzuYqk.cjs} +2 -2
- package/dist/{attachmentContent-Dm_RIs5L.mjs → attachmentContent-KNIZxwlu.mjs} +2 -2
- package/dist/{auth-BYDtjVNb.mjs → auth-CZ7pKS-j.mjs} +8 -8
- package/dist/{auth-DnxoVkkf.cjs → auth-DCjxpI6Z.cjs} +5 -5
- package/dist/{auth-DLR3ksCF.cjs → auth-SJ_dPw7H.cjs} +8 -8
- package/dist/{auth-DC6rg8lJ.mjs → auth-jN5dNqTO.mjs} +5 -5
- package/dist/{auto-CwO0u8hB.cjs → auto-B_59RYH1.cjs} +23 -21
- package/dist/{auto-D5Jhukq1.mjs → auto-DC0Sq-qB.mjs} +23 -21
- package/dist/{bootstrap-rLaL3kTa.mjs → bootstrap-B3gMpU9e.mjs} +2 -2
- package/dist/{bootstrap-sly4qPPY.cjs → bootstrap-CoJu9VnB.cjs} +2 -2
- package/dist/{browser-CHpVgyni.mjs → browser-LHW2hBH8.mjs} +1 -1
- package/dist/{browser-BTgZ9d4i.cjs → browser-v1pdPP1E.cjs} +1 -1
- package/dist/claudeAccountEnv-BL1pR_37.mjs +133 -0
- package/dist/claudeAccountEnv-CEX_EMZr.cjs +138 -0
- package/dist/{claudeLocal-Bgb5GGsq.mjs → claudeLocal-BZUgA5G2.mjs} +5 -5
- package/dist/{claudeLocal-1vuTFcL8.cjs → claudeLocal-BrzM2RBI.cjs} +5 -5
- package/dist/{claudeLocalLauncher-T7EfT68h.mjs → claudeLocalLauncher-A0AQyHFi.mjs} +10 -10
- package/dist/{claudeLocalLauncher-DOsL6HFY.cjs → claudeLocalLauncher-XAMpXUM7.cjs} +10 -10
- package/dist/{claudeSessionFork-Cko4SaVi.cjs → claudeSessionFork-Mhn2fYe_.cjs} +1 -1
- package/dist/{claudeSessionFork-CPvi6yDX.mjs → claudeSessionFork-_GwIlmMB.mjs} +1 -1
- package/dist/{client-BXD66ZF5.mjs → client-7RnI9J0W.mjs} +2 -2
- package/dist/{client-Bi20Ka0h.mjs → client-Bde4QVIn.mjs} +4 -2
- package/dist/{client-C5-C0t2a.cjs → client-CJr8Pjwm.cjs} +4 -2
- package/dist/{client-BscskEBk.cjs → client-D2GWkd-T.cjs} +2 -2
- package/dist/{client-C-OdTbrU.cjs → client-DLlnmAPL.cjs} +4 -4
- package/dist/{client-Bh1aUPh-.mjs → client-DwbhrX6D.mjs} +4 -4
- package/dist/codex/happyMcpStdioBridge.cjs +16 -16
- package/dist/codex/happyMcpStdioBridge.mjs +16 -16
- package/dist/codexAccount-BDQjRbtI.cjs +1028 -0
- package/dist/codexAccount-NOX5pmQf.mjs +1015 -0
- package/dist/{codexAppServerClient-DXhAf6i-.mjs → codexAppServerClient-B3QJV6Ey.mjs} +18 -7
- package/dist/{codexAppServerClient-DKXeikEe.cjs → codexAppServerClient-DWEsZUC4.cjs} +18 -7
- package/dist/{codexCommand-DvbbpYBS.cjs → codexCommand-Bg8AmxVm.cjs} +195 -63
- package/dist/{codexCommand-CIaOiiOj.mjs → codexCommand-D1xlj4sT.mjs} +196 -64
- package/dist/{codexTermination-BszWfyk5.cjs → codexTermination-ByX9GcEJ.cjs} +1 -1
- package/dist/{codexTermination-BcQdEDaw.mjs → codexTermination-CaWAVQjZ.mjs} +1 -1
- package/dist/{config-Di3Cf6js.cjs → config-B2GGbiTv.cjs} +3 -3
- package/dist/{config-OCEcVVK1.mjs → config-C2XYEwXz.mjs} +3 -3
- package/dist/{configuration-DfPBa-9d.cjs → configuration-BBK0rmmj.cjs} +1 -1
- package/dist/{configuration-ECqXu34R.mjs → configuration-ThKBP_zY.mjs} +1 -1
- package/dist/{connect-BTfAUhk8.mjs → connect-BirnCl9q.mjs} +13 -13
- package/dist/{connect-BPQRuOw5.cjs → connect-C3tZs_NC.cjs} +13 -13
- package/dist/{context-CfgTFpCB.mjs → context-C0EFLnOg.mjs} +1 -1
- package/dist/{context-Co7hUaW-.cjs → context-wDp0aZBK.cjs} +1 -1
- package/dist/{controlClient-ClI7A0qE.mjs → controlClient-Ckl8N1MS.mjs} +14 -5
- package/dist/{controlClient-C13_pSKG.cjs → controlClient-DwWTns3A.cjs} +15 -4
- package/dist/{createSessionMetadata-Cf78KHtt.cjs → createSessionMetadata-DqZ6h02H.cjs} +2 -2
- package/dist/{createSessionMetadata-B0eT_Kfj.mjs → createSessionMetadata-vug4Cv8z.mjs} +2 -2
- package/dist/daemonAccounts-CpGDY_4k.cjs +54 -0
- package/dist/daemonAccounts-DwPwKxvv.mjs +30 -0
- package/dist/{defaultPermissionMode-oqTupStc.cjs → defaultPermissionMode-BakXiqRr.cjs} +1 -1
- package/dist/{defaultPermissionMode-m6z2QVyP.mjs → defaultPermissionMode-DF5AfeBb.mjs} +1 -1
- package/dist/{deterministicJson-BtSwbsok.mjs → deterministicJson-BzX94gi3.mjs} +13 -13
- package/dist/{deterministicJson-CpFFgUL_.cjs → deterministicJson-t33SsuRC.cjs} +13 -13
- package/dist/{doctor-BEU0_1Xv.cjs → doctor-B9ug1LZb.cjs} +7 -7
- package/dist/{doctor-lsxmAK4o.mjs → doctor-C1zyOSXw.mjs} +7 -7
- package/dist/{downloadTarget-BXqXhNF7.mjs → downloadTarget-Baslc6jW.mjs} +6 -6
- package/dist/{downloadTarget-CikzJv1h.cjs → downloadTarget-T1id2Gh6.cjs} +6 -6
- package/dist/{ensureDaemonRunning-B_9WAlbU.mjs → ensureDaemonRunning-C6ERYK-O.mjs} +5 -5
- package/dist/{ensureDaemonRunning-BUuH-pbE.cjs → ensureDaemonRunning-CoAg11Zi.cjs} +5 -5
- package/dist/{handleResumeCommand-BK9XKH_l.mjs → handleResumeCommand-CrlqDuz7.mjs} +5 -5
- package/dist/{handleResumeCommand-Dj7oi2KO.cjs → handleResumeCommand-DPi-sPm7.cjs} +5 -5
- package/dist/{index-D3c7CLot.cjs → index-B1swQJUS.cjs} +4 -4
- package/dist/{index-CmZusg8Q.cjs → index-B2dJA8VG.cjs} +3 -3
- package/dist/{index-CLUHaPU8.cjs → index-BUFrKZeQ.cjs} +205 -5
- package/dist/{index-BjZnpGWX.mjs → index-BbdV2mzy.mjs} +3 -3
- package/dist/{index-BdOJOZ6J.mjs → index-BcSPg3c5.mjs} +4 -4
- package/dist/{index-CauRYQKr.cjs → index-Bkslzin5.cjs} +44 -40
- package/dist/{index-DuK9XYbZ.mjs → index-Cn73rdtQ.mjs} +4 -4
- package/dist/{index-Bq8NKSCF.mjs → index-D1YnIih6.mjs} +195 -6
- package/dist/{index-Cxso1rg4.mjs → index-fZO4nF6e.mjs} +45 -41
- package/dist/{index-Dg2NAF_-.cjs → index-rocrvOYG.cjs} +4 -4
- package/dist/index.cjs +2 -2
- package/dist/index.mjs +2 -2
- package/dist/{install-DXllkuy0.cjs → install-CArXjPfW.cjs} +3 -3
- package/dist/{install-DTIveLOS.mjs → install-CChhyV2G.mjs} +3 -3
- package/dist/lib.cjs +12 -12
- package/dist/lib.d.cts +354 -0
- package/dist/lib.d.mts +354 -0
- package/dist/lib.mjs +12 -12
- package/dist/{lidState-CD81ryTy.mjs → lidState-B6yYKjNK.mjs} +1 -1
- package/dist/{lidState-C9_DoF9i.cjs → lidState-B_v6qgfE.cjs} +1 -1
- package/dist/{localHappyAgentAuth-Cg-m1lwm.mjs → localHappyAgentAuth-KRlg_aI0.mjs} +1 -1
- package/dist/{localHappyAgentAuth-CCjUvOfi.cjs → localHappyAgentAuth-jJH0n67S.cjs} +1 -1
- package/dist/{logger-Ct2zvaq0.cjs → logger-CX3x2eI4.cjs} +2 -2
- package/dist/{logger-GcbI0eg2.mjs → logger-JV7-4Q_6.mjs} +2 -2
- package/dist/{machineMetadata-CXRmFNOV.mjs → machineMetadata-D5-SW9kv.mjs} +3 -3
- package/dist/{machineMetadata-DDCVWb_x.cjs → machineMetadata-DhZuM0iB.cjs} +3 -3
- package/dist/{main-BHC-WIcM.cjs → main-1x1HGQEy.cjs} +92 -48
- package/dist/{main-omGr_ONk.mjs → main-CFOdXbPD.mjs} +92 -48
- package/dist/{mcp-xUzii0m8.cjs → mcp-BnKBSEh7.cjs} +18 -15
- package/dist/{mcp-D5hxmRAq.mjs → mcp-R6lMcFLO.mjs} +18 -15
- package/dist/{mirrorProtocol-Lcx20Oby.mjs → mirrorProtocol-CD4ntuZJ.mjs} +3 -3
- package/dist/{mirrorProtocol-Dfl8Ahyf.cjs → mirrorProtocol-DO-KtvAL.cjs} +3 -3
- package/dist/{package-BsUHyqWe.mjs → package-Bw3H6VLn.mjs} +7 -7
- package/dist/{package-9n7wd2dT.cjs → package-uzlvxa5S.cjs} +7 -7
- package/dist/{panels-CpEKWWbI.mjs → panels-BamhZCoZ.mjs} +5 -5
- package/dist/{panels-BfknEmt7.cjs → panels-C46FxjmH.cjs} +5 -5
- package/dist/{peerTools-CElYh-5u.cjs → peerTools-D-VNNFw-.cjs} +5 -5
- package/dist/{peerTools-CwCe6tmJ.mjs → peerTools-WtRgTSqG.mjs} +5 -5
- package/dist/{persistence-Cpw4yJs8.mjs → persistence-Cg4sfjQV.mjs} +2 -2
- package/dist/{persistence-A2NeERZJ.cjs → persistence-CsmAgN-C.cjs} +2 -2
- package/dist/{piRunnerArgs-Bqmu16He.mjs → piRunnerArgs-BbaAQvb4.mjs} +2 -2
- package/dist/{piRunnerArgs-BnFU0K73.cjs → piRunnerArgs-vnFygygF.cjs} +1 -1
- package/dist/{piRuntime-Cgn1b0OX.mjs → piRuntime-Bid7TBf5.mjs} +1 -1
- package/dist/{piRuntime-DpS9TAIs.cjs → piRuntime-C2uj5Ucx.cjs} +1 -1
- package/dist/{piTerminal-rmve-VlI.cjs → piTerminal-Ckpjfoqa.cjs} +20 -17
- package/dist/{piTerminal-BGdps8f3.mjs → piTerminal-CqxgrI13.mjs} +20 -17
- package/dist/{pushNotifications-23YSd-0l.cjs → pushNotifications-BCg7YAiu.cjs} +5 -3
- package/dist/{pushNotifications-XAM8__Pg.mjs → pushNotifications-BbE-qV9I.mjs} +5 -3
- package/dist/{query-SZcYnJoW.mjs → query-Bfr9O_62.mjs} +1 -1
- package/dist/{query-u2GX-I0C.cjs → query-vQ-HG394.cjs} +1 -1
- package/dist/{rateLimitReporter-CaTzBe3x.cjs → rateLimitReporter-BZ8x0-6-.cjs} +3 -3
- package/dist/{rateLimitReporter-COUkf446.mjs → rateLimitReporter-CAz7VMw4.mjs} +3 -3
- package/dist/{rateLimitWindows-B2Kx6L0S.cjs → rateLimitWindows-BZl6GMwQ.cjs} +1 -1
- package/dist/{rateLimitWindows-j_qQk0KY.mjs → rateLimitWindows-CRARnKaI.mjs} +1 -1
- package/dist/reconnectEnv-B31lY4nR.cjs +27 -0
- package/dist/reconnectEnv-DeSvHl3q.mjs +24 -0
- package/dist/{registerCommonHandlers-D1MiSfcB.cjs → registerCommonHandlers-CZGmrPbT.cjs} +2 -2
- package/dist/{registerCommonHandlers-DRRfinzK.mjs → registerCommonHandlers-Cj3Nl9y-.mjs} +2 -2
- package/dist/{registerKillSessionHandler-Cpug_r5C.mjs → registerKillSessionHandler-Bg9t45Ub.mjs} +6 -6
- package/dist/{registerKillSessionHandler-hvCsEn7b.cjs → registerKillSessionHandler-C3EDnW4F.cjs} +6 -6
- package/dist/{remoteSessionClient-BdnJ_n8C.mjs → remoteSessionClient--0vfA7I5.mjs} +5 -5
- package/dist/{remoteSessionClient-6ymeMVa4.cjs → remoteSessionClient-CcSP24Zq.cjs} +5 -5
- package/dist/{reportProgressTool-XgQBzxoD.mjs → reportProgressTool-DVru7jc_.mjs} +3 -3
- package/dist/{reportProgressTool-tzQLCLIw.cjs → reportProgressTool-Ddg1yVq2.cjs} +3 -3
- package/dist/{run-DYL_wuj7.cjs → run-BTrIT_jU.cjs} +347 -856
- package/dist/{run-Bt0AklUU.mjs → run-HtvH6BLi.mjs} +346 -855
- package/dist/{runClaude-C3rii_S6.mjs → runClaude-DsHTk5Bu.mjs} +62 -44
- package/dist/{runClaude-CBEpYO4S.cjs → runClaude-ipjwAHPI.cjs} +62 -44
- package/dist/{runClaudeDeps-CYuozSC6.cjs → runClaudeDeps-BKpwL6ln.cjs} +51 -42
- package/dist/{runClaudeDeps-DlVfMG4F.mjs → runClaudeDeps-BV3vpeyY.mjs} +56 -47
- package/dist/{runGemini-CEI3b90u.cjs → runGemini-B-G0_7Ab.cjs} +33 -33
- package/dist/{runGemini-DkYhRk9S.mjs → runGemini-DhjK6_Fp.mjs} +33 -33
- package/dist/{runOpenClaw-DpprWCoz.mjs → runOpenClaw-B6lawk8n.mjs} +18 -18
- package/dist/{runOpenClaw-BgjD6E4d.cjs → runOpenClaw-BHIo8tkn.cjs} +18 -18
- package/dist/{sandbox-XCDUbH72.cjs → sandbox-BAsO0ILe.cjs} +4 -4
- package/dist/{sandbox-DJ7A7lsy.mjs → sandbox-CKb7pCXg.mjs} +4 -4
- package/dist/selfCheck-CZ-t1Xzq.mjs +88 -0
- package/dist/{selfCheck-BYUDB1Uq.cjs → selfCheck-D4VvVZNi.cjs} +39 -37
- package/dist/{send-CASDBCyJ.cjs → send-Cz5m39QR.cjs} +8 -8
- package/dist/{send-Ba63huxv.mjs → send-D8ipLKMY.mjs} +8 -8
- package/dist/{server-w3W0toNd.mjs → server-CjvgT3N9.mjs} +4 -4
- package/dist/{server-cZoV9XRt.cjs → server-CySyJKPH.cjs} +6 -6
- package/dist/{sessionLock-G2PMqvsh.mjs → sessionLock-B73fhgQN.mjs} +10 -4
- package/dist/{sessionLock-BmLA2S8K.cjs → sessionLock-DdDCuNUs.cjs} +10 -3
- package/dist/{sessionOps-DPw5k8vV.mjs → sessionOps-C65Iej_C.mjs} +50 -8
- package/dist/{sessionOps-DXlTmS7J.cjs → sessionOps-XSEjIqNq.cjs} +50 -8
- package/dist/sessionProvider-CLVNkfji.mjs +110 -0
- package/dist/sessionProvider-Dgsty8z_.cjs +115 -0
- package/dist/{sessionScanner-AHjnicxi.cjs → sessionScanner-D8IVXMMH.cjs} +3 -3
- package/dist/{sessionScanner-BCXpdZJN.mjs → sessionScanner-MW1P9Pm9.mjs} +3 -3
- package/dist/{sessions-BiBXOBx0.cjs → sessions-BKz7gZqg.cjs} +10 -10
- package/dist/{sessions-Clk8MR5Y.mjs → sessions-Dtk_agUL.mjs} +10 -10
- package/dist/{setupOfflineReconnection-DI-QZGYz.mjs → setupOfflineReconnection-Bvdy-2xd.mjs} +2 -2
- package/dist/{setupOfflineReconnection-BKLfOd-i.cjs → setupOfflineReconnection-DxMiW7OV.cjs} +2 -2
- package/dist/{spawn-D5omsx1Q.cjs → spawn-DiPkJcrQ.cjs} +36 -17
- package/dist/{spawn-4tsp1uhh.mjs → spawn-Dm4xsZBX.mjs} +36 -17
- package/dist/{spawnAgents-CtkkIFHd.cjs → spawnAgents-B9olJ8xn.cjs} +1 -1
- package/dist/{spawnAgents-CjoU6ZOS.mjs → spawnAgents-I29H9nO8.mjs} +1 -1
- package/dist/{spawnHappyCLI-CF_gLi92.cjs → spawnHappyCLI-BYGOUda1.cjs} +1 -1
- package/dist/{spawnHappyCLI-CIA9Sc_5.mjs → spawnHappyCLI-CnMwzjWX.mjs} +1 -1
- package/dist/{startFileWatcher-9Stpxe7p.cjs → startFileWatcher-D14W6gn-.cjs} +1 -1
- package/dist/{startFileWatcher-CDO6fb2m.mjs → startFileWatcher-DePAY1T5.mjs} +1 -1
- package/dist/{startupSessionCreate-BtR4iYEC.mjs → startupSessionCreate-DoK0IvJG.mjs} +3 -3
- package/dist/{startupSessionCreate-CcF7rGGB.cjs → startupSessionCreate-rBHd4tc1.cjs} +3 -3
- package/dist/store-CkNa6oj4.cjs +326 -0
- package/dist/store-Vej_738f.mjs +305 -0
- package/dist/{streamRelay-BhI6jqF-.cjs → streamRelay-C0G1HOOd.cjs} +1 -1
- package/dist/{streamRelay-DMwOMTKf.mjs → streamRelay-C5U-C4GS.mjs} +1 -1
- package/dist/{sync-C0PRuTMj.mjs → sync-BP6vnxVP.mjs} +1 -1
- package/dist/{sync-Ba8N6xba.cjs → sync-WYBwkJvG.cjs} +1 -1
- package/dist/{systemPrompt-DV5IReD4.cjs → systemPrompt-BkQlCk5_.cjs} +2 -2
- package/dist/{systemPrompt-D0q8eyjy.mjs → systemPrompt-aRqBmkpw.mjs} +2 -2
- package/dist/{teams-BO3_arwM.mjs → teams-CGmC4ygu.mjs} +7 -7
- package/dist/{teams-z3Gp-KlV.cjs → teams-phbpwAGD.cjs} +7 -7
- package/dist/{template-B_5l6pkc.cjs → template-B9pLEP8v.cjs} +2 -2
- package/dist/{template-DLR_0hfj.mjs → template-CL9EvQLQ.mjs} +2 -2
- package/dist/{time-Cy0a-7YX.cjs → time-BTLcO8jp.cjs} +1 -1
- package/dist/{time-D0jvDRhn.mjs → time-Cw0liIqB.mjs} +1 -1
- package/dist/{titleGenerator-RGHWP2YL.cjs → titleGenerator-Y1_7ceJC.cjs} +17 -13
- package/dist/{titleGenerator-AGQsXskb.mjs → titleGenerator-h6TmFe-c.mjs} +16 -12
- package/dist/{todo-CzIDPLFy.cjs → todo-BxiPiCvB.cjs} +6 -6
- package/dist/{todo-BZ954vsz.mjs → todo-OKcTC_VC.mjs} +6 -6
- package/dist/{tools-Bei5i03L.mjs → tools-BR-drXZ8.mjs} +3 -2
- package/dist/{tools-B1x1j6tz.cjs → tools-CcebYtLj.cjs} +3 -2
- package/dist/{uninstall-C3cnIvz1.cjs → uninstall-CnDeCC-M.cjs} +3 -3
- package/dist/{uninstall-B4T_e3Mr.mjs → uninstall-D3stWKD2.mjs} +3 -3
- package/dist/wrapperAccount-BkufO_9g.mjs +107 -0
- package/dist/wrapperAccount-D2A4DuZy.cjs +113 -0
- package/package.json +7 -7
- package/dist/providerBinding-B-Qbx9W2.cjs +0 -140
- package/dist/providerBinding-CYubGg-Z.mjs +0 -132
- package/dist/selfCheck-C-rNljKV.mjs +0 -86
- package/dist/sessionProvider-DUn91LhJ.mjs +0 -109
- package/dist/sessionProvider-Dg691XQ4.cjs +0 -114
package/dist/{setupOfflineReconnection-BKLfOd-i.cjs → setupOfflineReconnection-DxMiW7OV.cjs}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var configuration = require('./configuration-
|
|
4
|
-
var api = require('./api-
|
|
3
|
+
var configuration = require('./configuration-BBK0rmmj.cjs');
|
|
4
|
+
var api = require('./api-CBE_a88I.cjs');
|
|
5
5
|
|
|
6
6
|
function createOfflineSessionStub(sessionTag) {
|
|
7
7
|
return {
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var spawnAgents = require('./spawnAgents-
|
|
4
|
-
var client = require('./client-
|
|
3
|
+
var spawnAgents = require('./spawnAgents-B9olJ8xn.cjs');
|
|
4
|
+
var client = require('./client-CJr8Pjwm.cjs');
|
|
5
5
|
var chalk = require('chalk');
|
|
6
6
|
var node_fs = require('node:fs');
|
|
7
7
|
var path$1 = require('node:path');
|
|
8
|
-
var controlClient = require('./controlClient-
|
|
9
|
-
var persistence = require('./persistence-
|
|
10
|
-
var index = require('./index-
|
|
11
|
-
var configuration = require('./configuration-
|
|
8
|
+
var controlClient = require('./controlClient-DwWTns3A.cjs');
|
|
9
|
+
var persistence = require('./persistence-CsmAgN-C.cjs');
|
|
10
|
+
var index = require('./index-BUFrKZeQ.cjs');
|
|
11
|
+
var configuration = require('./configuration-BBK0rmmj.cjs');
|
|
12
12
|
var path = require('./path-B7zW-WwE.cjs');
|
|
13
|
-
var claudeSessionFork = require('./claudeSessionFork-
|
|
14
|
-
var codexAppServerClient = require('./codexAppServerClient-
|
|
13
|
+
var claudeSessionFork = require('./claudeSessionFork-Mhn2fYe_.cjs');
|
|
14
|
+
var codexAppServerClient = require('./codexAppServerClient-DWEsZUC4.cjs');
|
|
15
15
|
var codexThreadFork = require('./codexThreadFork-5kwoKjMu.cjs');
|
|
16
|
-
var sessionOps = require('./sessionOps-
|
|
17
|
-
var createSessionMetadata = require('./createSessionMetadata-
|
|
18
|
-
var logger = require('./logger-
|
|
16
|
+
var sessionOps = require('./sessionOps-XSEjIqNq.cjs');
|
|
17
|
+
var createSessionMetadata = require('./createSessionMetadata-DqZ6h02H.cjs');
|
|
18
|
+
var logger = require('./logger-CX3x2eI4.cjs');
|
|
19
19
|
var forkBackfill = require('./forkBackfill-8eLDeS73.cjs');
|
|
20
20
|
require('node:fs/promises');
|
|
21
21
|
require('zod');
|
|
@@ -24,17 +24,17 @@ require('node:crypto');
|
|
|
24
24
|
require('tweetnacl');
|
|
25
25
|
require('@paralleldrive/cuid2');
|
|
26
26
|
require('node:os');
|
|
27
|
-
require('./package-
|
|
27
|
+
require('./package-uzlvxa5S.cjs');
|
|
28
28
|
require('node:readline');
|
|
29
29
|
require('node:child_process');
|
|
30
30
|
require('cross-spawn');
|
|
31
31
|
require('./contentLogMetadata-ZSFk_NjQ.cjs');
|
|
32
32
|
require('./manager-HrEj442o.cjs');
|
|
33
33
|
require('@anthropic-ai/sandbox-runtime');
|
|
34
|
-
require('./rateLimitWindows-
|
|
34
|
+
require('./rateLimitWindows-BZl6GMwQ.cjs');
|
|
35
35
|
require('./processTree-CMHWlVse.cjs');
|
|
36
36
|
require('axios');
|
|
37
|
-
require('./time-
|
|
37
|
+
require('./time-BTLcO8jp.cjs');
|
|
38
38
|
require('./specialCommands-J3JFOq0J.cjs');
|
|
39
39
|
require('socket.io-client');
|
|
40
40
|
require('./backgroundTaskActivity-CBvUdj39.cjs');
|
|
@@ -157,6 +157,10 @@ function parseSpawnArgs(args) {
|
|
|
157
157
|
const value = args[++i];
|
|
158
158
|
if (value === void 0 || value.trim().length === 0) throw new Error("--model requires a value");
|
|
159
159
|
options.model = value;
|
|
160
|
+
} else if (arg === "--account") {
|
|
161
|
+
const value = args[++i];
|
|
162
|
+
if (value === void 0 || !/^[a-z0-9][a-z0-9-]{0,47}$/.test(value)) throw new Error('--account requires an account id (see `very-happy account list`) or "machine"');
|
|
163
|
+
options.account = value;
|
|
160
164
|
} else if (arg === "--fork") {
|
|
161
165
|
const value = args[++i];
|
|
162
166
|
if (value === void 0) throw new Error("--fork requires a session id");
|
|
@@ -192,8 +196,8 @@ ${chalk.bold("very-happy spawn")} - Spawn a remote session via the local daemon
|
|
|
192
196
|
${chalk.bold("Usage:")}
|
|
193
197
|
very-happy spawn --dir <path> [--prompt <text> | --prompt-file <file>]
|
|
194
198
|
[--spawned-by <name>] [--permission-mode <mode>]
|
|
195
|
-
[--agent <name>] [--model <id>] [--
|
|
196
|
-
[--project <id> | --no-project] [--json]
|
|
199
|
+
[--agent <name>] [--model <id>] [--account <id>]
|
|
200
|
+
[--env KEY=VALUE]... [--project <id> | --no-project] [--json]
|
|
197
201
|
very-happy spawn --fork <sessionId> [--prompt \u2026] [--permission-mode <mode>]
|
|
198
202
|
[--model <id>] [--spawned-by <name>] [--project <id>]
|
|
199
203
|
[--json]
|
|
@@ -220,6 +224,10 @@ ${chalk.bold("Options:")}
|
|
|
220
224
|
machine runs (claude: newest Opus; codex: newest
|
|
221
225
|
sol its Codex lists; gemini: newest pro), else the
|
|
222
226
|
machine default. 'default' = the machine default.
|
|
227
|
+
--account <id> Claude / Codex account on this machine (\`very-happy account
|
|
228
|
+
list\`); 'machine' = the machine's own login.
|
|
229
|
+
Default = the machine's default account, if set. A
|
|
230
|
+
missing or expired account fails the spawn.
|
|
223
231
|
--fork <sessionId> Fork an existing session of THIS machine (same as the
|
|
224
232
|
web's fork): copies its conversation and continues
|
|
225
233
|
it in a new session, in the same directory and with
|
|
@@ -371,6 +379,16 @@ async function handleSpawnCommand(args) {
|
|
|
371
379
|
process.exit(1);
|
|
372
380
|
}
|
|
373
381
|
}
|
|
382
|
+
let accountChoice = options.account ? options.account === "machine" ? null : options.account : void 0;
|
|
383
|
+
if (accountChoice === void 0 && options.project && !forkSource) {
|
|
384
|
+
try {
|
|
385
|
+
const defaults = await client.sharedProjectsClient().defaults(options.project);
|
|
386
|
+
const machineId = (await persistence.readSettings()).machineId;
|
|
387
|
+
if (machineId) accountChoice = index.resolveLaunchAgentProfile({ project: defaults.agentProfiles, agent: agent ?? "claude", machineId }).agentProfileId;
|
|
388
|
+
} catch (error) {
|
|
389
|
+
console.error(chalk.dim(`(project ${options.project}: defaults unavailable \u2014 using the machine default account: ${error instanceof Error ? error.message : String(error)})`));
|
|
390
|
+
}
|
|
391
|
+
}
|
|
374
392
|
logger.logger.debug(`[SPAWN CMD] Spawning session in ${directory}${forkSource ? ` (fork of ${forkSource.parentSessionId})` : ""}`);
|
|
375
393
|
const result = await controlClient.spawnDaemonSession(directory, void 0, {
|
|
376
394
|
spawnedBy: options.spawnedBy,
|
|
@@ -382,7 +400,8 @@ async function handleSpawnCommand(args) {
|
|
|
382
400
|
// through, an old wrapper ignores it).
|
|
383
401
|
environmentVariables: spawnEnvironmentVariables(options.env, prompt !== void 0),
|
|
384
402
|
...resumeIds,
|
|
385
|
-
...forkSource ? { parentSessionId: forkSource.parentSessionId } : {}
|
|
403
|
+
...forkSource ? { parentSessionId: forkSource.parentSessionId } : {},
|
|
404
|
+
...accountChoice !== void 0 ? { agentProfileId: accountChoice } : {}
|
|
386
405
|
});
|
|
387
406
|
if (result?.error || !result?.success || !result?.sessionId) {
|
|
388
407
|
const message = result?.error || "Daemon returned no session ID";
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { r as resolveSpawnPermissionMode, c as chooseProject, j as joinProject, a as resolveFirstMessageMeta, w as waitsForModelCatalog, s as sanitizeSpawnPermissionMode, A as ALLOWED_SPAWN_PERMISSION_MODES, S as SPAWN_AGENTS } from './spawnAgents-
|
|
2
|
-
import { s as sharedProjectsClient } from './client-
|
|
1
|
+
import { r as resolveSpawnPermissionMode, c as chooseProject, j as joinProject, a as resolveFirstMessageMeta, w as waitsForModelCatalog, s as sanitizeSpawnPermissionMode, A as ALLOWED_SPAWN_PERMISSION_MODES, S as SPAWN_AGENTS } from './spawnAgents-I29H9nO8.mjs';
|
|
2
|
+
import { s as sharedProjectsClient } from './client-Bde4QVIn.mjs';
|
|
3
3
|
import chalk from 'chalk';
|
|
4
4
|
import { readFileSync, statSync } from 'node:fs';
|
|
5
5
|
import { resolve } from 'node:path';
|
|
6
|
-
import { b as checkIfDaemonRunningAndCleanupStaleState,
|
|
7
|
-
import { c as readPersistedSessions } from './persistence-
|
|
8
|
-
import {
|
|
9
|
-
import { c as configuration } from './configuration-
|
|
6
|
+
import { b as checkIfDaemonRunningAndCleanupStaleState, f as spawnDaemonSession, h as stopDaemonSession } from './controlClient-Ckl8N1MS.mjs';
|
|
7
|
+
import { c as readPersistedSessions, r as readSettings } from './persistence-Cg4sfjQV.mjs';
|
|
8
|
+
import { u as parseLatestModelTable, v as resolveLaunchAgentProfile } from './index-D1YnIih6.mjs';
|
|
9
|
+
import { c as configuration } from './configuration-ThKBP_zY.mjs';
|
|
10
10
|
import { g as getProjectPath } from './path-D2wdaNSk.mjs';
|
|
11
|
-
import { f as forkSession, F as ForkSourceMissingError } from './claudeSessionFork-
|
|
12
|
-
import { C as CodexAppServerClient } from './codexAppServerClient-
|
|
11
|
+
import { f as forkSession, F as ForkSourceMissingError } from './claudeSessionFork-_GwIlmMB.mjs';
|
|
12
|
+
import { C as CodexAppServerClient } from './codexAppServerClient-B3QJV6Ey.mjs';
|
|
13
13
|
import { f as forkCodexThread } from './codexThreadFork-DobPd19R.mjs';
|
|
14
|
-
import { e as sendUserMessage, f as readSessionMetadata, g as waitForSessionKey, s as sessionWebUrl } from './sessionOps-
|
|
15
|
-
import { i as isValidSpawnOrigin } from './createSessionMetadata-
|
|
16
|
-
import { l as logger } from './logger-
|
|
14
|
+
import { e as sendUserMessage, f as readSessionMetadata, g as waitForSessionKey, s as sessionWebUrl } from './sessionOps-C65Iej_C.mjs';
|
|
15
|
+
import { i as isValidSpawnOrigin } from './createSessionMetadata-vug4Cv8z.mjs';
|
|
16
|
+
import { l as logger } from './logger-JV7-4Q_6.mjs';
|
|
17
17
|
import { w as waitForForkBackfill } from './forkBackfill-DYIjlN1Z.mjs';
|
|
18
18
|
import 'node:fs/promises';
|
|
19
19
|
import 'zod';
|
|
@@ -22,17 +22,17 @@ import 'node:crypto';
|
|
|
22
22
|
import 'tweetnacl';
|
|
23
23
|
import '@paralleldrive/cuid2';
|
|
24
24
|
import 'node:os';
|
|
25
|
-
import './package-
|
|
25
|
+
import './package-Bw3H6VLn.mjs';
|
|
26
26
|
import 'node:readline';
|
|
27
27
|
import 'node:child_process';
|
|
28
28
|
import 'cross-spawn';
|
|
29
29
|
import './contentLogMetadata-BlWI0egu.mjs';
|
|
30
30
|
import './manager-BEsI4qt3.mjs';
|
|
31
31
|
import '@anthropic-ai/sandbox-runtime';
|
|
32
|
-
import './rateLimitWindows-
|
|
32
|
+
import './rateLimitWindows-CRARnKaI.mjs';
|
|
33
33
|
import './processTree-CP5IvQ2Z.mjs';
|
|
34
34
|
import 'axios';
|
|
35
|
-
import './time-
|
|
35
|
+
import './time-Cw0liIqB.mjs';
|
|
36
36
|
import './specialCommands-MXUN0wfI.mjs';
|
|
37
37
|
import 'socket.io-client';
|
|
38
38
|
import './backgroundTaskActivity-8PdPxrvy.mjs';
|
|
@@ -155,6 +155,10 @@ function parseSpawnArgs(args) {
|
|
|
155
155
|
const value = args[++i];
|
|
156
156
|
if (value === void 0 || value.trim().length === 0) throw new Error("--model requires a value");
|
|
157
157
|
options.model = value;
|
|
158
|
+
} else if (arg === "--account") {
|
|
159
|
+
const value = args[++i];
|
|
160
|
+
if (value === void 0 || !/^[a-z0-9][a-z0-9-]{0,47}$/.test(value)) throw new Error('--account requires an account id (see `very-happy account list`) or "machine"');
|
|
161
|
+
options.account = value;
|
|
158
162
|
} else if (arg === "--fork") {
|
|
159
163
|
const value = args[++i];
|
|
160
164
|
if (value === void 0) throw new Error("--fork requires a session id");
|
|
@@ -190,8 +194,8 @@ ${chalk.bold("very-happy spawn")} - Spawn a remote session via the local daemon
|
|
|
190
194
|
${chalk.bold("Usage:")}
|
|
191
195
|
very-happy spawn --dir <path> [--prompt <text> | --prompt-file <file>]
|
|
192
196
|
[--spawned-by <name>] [--permission-mode <mode>]
|
|
193
|
-
[--agent <name>] [--model <id>] [--
|
|
194
|
-
[--project <id> | --no-project] [--json]
|
|
197
|
+
[--agent <name>] [--model <id>] [--account <id>]
|
|
198
|
+
[--env KEY=VALUE]... [--project <id> | --no-project] [--json]
|
|
195
199
|
very-happy spawn --fork <sessionId> [--prompt \u2026] [--permission-mode <mode>]
|
|
196
200
|
[--model <id>] [--spawned-by <name>] [--project <id>]
|
|
197
201
|
[--json]
|
|
@@ -218,6 +222,10 @@ ${chalk.bold("Options:")}
|
|
|
218
222
|
machine runs (claude: newest Opus; codex: newest
|
|
219
223
|
sol its Codex lists; gemini: newest pro), else the
|
|
220
224
|
machine default. 'default' = the machine default.
|
|
225
|
+
--account <id> Claude / Codex account on this machine (\`very-happy account
|
|
226
|
+
list\`); 'machine' = the machine's own login.
|
|
227
|
+
Default = the machine's default account, if set. A
|
|
228
|
+
missing or expired account fails the spawn.
|
|
221
229
|
--fork <sessionId> Fork an existing session of THIS machine (same as the
|
|
222
230
|
web's fork): copies its conversation and continues
|
|
223
231
|
it in a new session, in the same directory and with
|
|
@@ -369,6 +377,16 @@ async function handleSpawnCommand(args) {
|
|
|
369
377
|
process.exit(1);
|
|
370
378
|
}
|
|
371
379
|
}
|
|
380
|
+
let accountChoice = options.account ? options.account === "machine" ? null : options.account : void 0;
|
|
381
|
+
if (accountChoice === void 0 && options.project && !forkSource) {
|
|
382
|
+
try {
|
|
383
|
+
const defaults = await sharedProjectsClient().defaults(options.project);
|
|
384
|
+
const machineId = (await readSettings()).machineId;
|
|
385
|
+
if (machineId) accountChoice = resolveLaunchAgentProfile({ project: defaults.agentProfiles, agent: agent ?? "claude", machineId }).agentProfileId;
|
|
386
|
+
} catch (error) {
|
|
387
|
+
console.error(chalk.dim(`(project ${options.project}: defaults unavailable \u2014 using the machine default account: ${error instanceof Error ? error.message : String(error)})`));
|
|
388
|
+
}
|
|
389
|
+
}
|
|
372
390
|
logger.debug(`[SPAWN CMD] Spawning session in ${directory}${forkSource ? ` (fork of ${forkSource.parentSessionId})` : ""}`);
|
|
373
391
|
const result = await spawnDaemonSession(directory, void 0, {
|
|
374
392
|
spawnedBy: options.spawnedBy,
|
|
@@ -380,7 +398,8 @@ async function handleSpawnCommand(args) {
|
|
|
380
398
|
// through, an old wrapper ignores it).
|
|
381
399
|
environmentVariables: spawnEnvironmentVariables(options.env, prompt !== void 0),
|
|
382
400
|
...resumeIds,
|
|
383
|
-
...forkSource ? { parentSessionId: forkSource.parentSessionId } : {}
|
|
401
|
+
...forkSource ? { parentSessionId: forkSource.parentSessionId } : {},
|
|
402
|
+
...accountChoice !== void 0 ? { agentProfileId: accountChoice } : {}
|
|
384
403
|
});
|
|
385
404
|
if (result?.error || !result?.success || !result?.sessionId) {
|
|
386
405
|
const message = result?.error || "Daemon returned no session ID";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { L as getAgentCodeDefaults, M as isLatestModelMode, N as resolveLatestModel, O as LATEST_MODEL_MODE, Q as EFFORT_INTENT_AUTO, T as normalizeAgentKey } from './index-D1YnIih6.mjs';
|
|
2
2
|
|
|
3
3
|
function chooseProject(opts) {
|
|
4
4
|
if (opts.project) return { kind: "explicit", projectId: opts.project };
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var spawn = require('cross-spawn');
|
|
4
4
|
var path = require('node:path');
|
|
5
5
|
var projectPath = require('./projectPath-C3ioB4Bu.cjs');
|
|
6
|
-
var logger = require('./logger-
|
|
6
|
+
var logger = require('./logger-CX3x2eI4.cjs');
|
|
7
7
|
var node_fs = require('node:fs');
|
|
8
8
|
|
|
9
9
|
let cachedRuntime = null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { spawn } from 'cross-spawn';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import { p as projectPath } from './projectPath-BTBIMB57.mjs';
|
|
4
|
-
import { l as logger } from './logger-
|
|
4
|
+
import { l as logger } from './logger-JV7-4Q_6.mjs';
|
|
5
5
|
import { existsSync } from 'node:fs';
|
|
6
6
|
|
|
7
7
|
let cachedRuntime = null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { l as logger } from './logger-
|
|
2
|
-
import { e as evaluateWrapperIdle, j as isQuiescent, k as HIBERNATION_UNSUPPORTED_BACKOFF_MS } from './persistence-
|
|
3
|
-
import { c as connectionState } from './api-
|
|
1
|
+
import { l as logger } from './logger-JV7-4Q_6.mjs';
|
|
2
|
+
import { e as evaluateWrapperIdle, j as isQuiescent, k as HIBERNATION_UNSUPPORTED_BACKOFF_MS } from './persistence-Cg4sfjQV.mjs';
|
|
3
|
+
import { c as connectionState } from './api-DUfunY3x.mjs';
|
|
4
4
|
|
|
5
5
|
const PRESENCE_SETTLE_MS = 6e3;
|
|
6
6
|
async function commitHibernation(deps) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var logger = require('./logger-
|
|
4
|
-
var persistence = require('./persistence-
|
|
5
|
-
var api = require('./api-
|
|
3
|
+
var logger = require('./logger-CX3x2eI4.cjs');
|
|
4
|
+
var persistence = require('./persistence-CsmAgN-C.cjs');
|
|
5
|
+
var api = require('./api-CBE_a88I.cjs');
|
|
6
6
|
|
|
7
7
|
const PRESENCE_SETTLE_MS = 6e3;
|
|
8
8
|
async function commitHibernation(deps) {
|
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var node_fs = require('node:fs');
|
|
4
|
+
var os = require('node:os');
|
|
5
|
+
var path = require('node:path');
|
|
6
|
+
var index = require('./index-BUFrKZeQ.cjs');
|
|
7
|
+
|
|
8
|
+
function providersPath(happyHomeDir) {
|
|
9
|
+
return path.join(happyHomeDir, "providers.json");
|
|
10
|
+
}
|
|
11
|
+
function sessionProvidersPath(happyHomeDir) {
|
|
12
|
+
return path.join(happyHomeDir, "session-providers.json");
|
|
13
|
+
}
|
|
14
|
+
function parseProvidersFile(raw) {
|
|
15
|
+
const profiles = {};
|
|
16
|
+
const src = raw && typeof raw === "object" ? raw.profiles : void 0;
|
|
17
|
+
if (src && typeof src === "object") {
|
|
18
|
+
for (const [id, p] of Object.entries(src)) {
|
|
19
|
+
if (!p || typeof p !== "object") continue;
|
|
20
|
+
const { name, baseUrl, apiKeyFile, models } = p;
|
|
21
|
+
if (typeof baseUrl !== "string" || !/^https?:\/\//.test(baseUrl) || typeof apiKeyFile !== "string" || !apiKeyFile) continue;
|
|
22
|
+
const ids = [];
|
|
23
|
+
const contextWindows = {};
|
|
24
|
+
for (const m of Array.isArray(models) ? models : []) {
|
|
25
|
+
if (typeof m === "string") ids.push(m);
|
|
26
|
+
else if (m && typeof m === "object" && typeof m.id === "string") {
|
|
27
|
+
const { id: modelId, contextWindow } = m;
|
|
28
|
+
ids.push(modelId);
|
|
29
|
+
if (typeof contextWindow === "number" && Number.isInteger(contextWindow) && contextWindow > 0) contextWindows[modelId] = contextWindow;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
profiles[id] = {
|
|
33
|
+
...typeof name === "string" ? { name } : {},
|
|
34
|
+
baseUrl: baseUrl.replace(/\/+$/, ""),
|
|
35
|
+
apiKeyFile,
|
|
36
|
+
...Array.isArray(models) ? { models: ids } : {},
|
|
37
|
+
...Object.keys(contextWindows).length > 0 ? { contextWindows } : {}
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return { profiles };
|
|
42
|
+
}
|
|
43
|
+
function parseSessionProvidersFile(raw) {
|
|
44
|
+
const out = {};
|
|
45
|
+
if (!raw || typeof raw !== "object") return out;
|
|
46
|
+
for (const [sessionId, b] of Object.entries(raw)) {
|
|
47
|
+
if (!b || typeof b !== "object") continue;
|
|
48
|
+
const { profile, model } = b;
|
|
49
|
+
if (typeof profile === "string" && profile && typeof model === "string" && model) out[sessionId] = { profile, model };
|
|
50
|
+
}
|
|
51
|
+
return out;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const KIND_AGENT = {
|
|
55
|
+
"claude-subscription": "claude",
|
|
56
|
+
"claude-api": "claude",
|
|
57
|
+
"codex-chatgpt": "codex",
|
|
58
|
+
"codex-provider": "codex"
|
|
59
|
+
};
|
|
60
|
+
function isApiKind(kind) {
|
|
61
|
+
return kind === "claude-api" || kind === "codex-provider";
|
|
62
|
+
}
|
|
63
|
+
const SPAWN_ACCOUNT_ENV = "VH_AGENT_PROFILE_ID";
|
|
64
|
+
const SUBSCRIPTION_TOKEN_TTL_MS = 365 * 24 * 60 * 60 * 1e3;
|
|
65
|
+
const ACCOUNT_ID_PATTERN = /^[a-z0-9][a-z0-9-]{0,47}$/;
|
|
66
|
+
function accountsPath(home) {
|
|
67
|
+
return path.join(home, "accounts.json");
|
|
68
|
+
}
|
|
69
|
+
function accountSecretPath(home, id) {
|
|
70
|
+
if (!ACCOUNT_ID_PATTERN.test(id)) throw new Error(`invalid account id "${id}"`);
|
|
71
|
+
return path.join(home, "accounts", id, "secret");
|
|
72
|
+
}
|
|
73
|
+
function accountCodexHomePath(home, id) {
|
|
74
|
+
if (!ACCOUNT_ID_PATTERN.test(id)) throw new Error(`invalid account id "${id}"`);
|
|
75
|
+
return path.join(home, "accounts", id, "codex-home");
|
|
76
|
+
}
|
|
77
|
+
function sessionAccountsPath(home) {
|
|
78
|
+
return path.join(home, "session-accounts.json");
|
|
79
|
+
}
|
|
80
|
+
function expandHome(path$1, home = os.homedir()) {
|
|
81
|
+
return path$1 === "~" ? home : path$1.startsWith("~/") ? path.join(home, path$1.slice(2)) : path$1;
|
|
82
|
+
}
|
|
83
|
+
function readJson(path) {
|
|
84
|
+
if (!node_fs.existsSync(path)) return void 0;
|
|
85
|
+
try {
|
|
86
|
+
return JSON.parse(node_fs.readFileSync(path, "utf8"));
|
|
87
|
+
} catch {
|
|
88
|
+
return void 0;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
function writeJson0600(path$1, value) {
|
|
92
|
+
node_fs.mkdirSync(path.dirname(path$1), { recursive: true });
|
|
93
|
+
const tmp = `${path$1}.${process.pid}.${Date.now()}.tmp`;
|
|
94
|
+
node_fs.writeFileSync(tmp, JSON.stringify(value, null, 2) + "\n", { mode: 384 });
|
|
95
|
+
node_fs.chmodSync(tmp, 384);
|
|
96
|
+
node_fs.renameSync(tmp, path$1);
|
|
97
|
+
}
|
|
98
|
+
function parseKey(raw) {
|
|
99
|
+
if (!raw || typeof raw !== "object") return void 0;
|
|
100
|
+
const k = raw;
|
|
101
|
+
if (k.source === "file" && typeof k.path === "string" && k.path) return { source: "file", path: k.path };
|
|
102
|
+
if (k.source === "env" && typeof k.name === "string" && /^[A-Za-z_][A-Za-z0-9_]*$/.test(k.name)) return { source: "env", name: k.name };
|
|
103
|
+
if (k.source === "stored") return { source: "stored" };
|
|
104
|
+
return void 0;
|
|
105
|
+
}
|
|
106
|
+
function parseAccountsFile(raw) {
|
|
107
|
+
const out = { version: 2, accounts: {}, defaults: {} };
|
|
108
|
+
if (!raw || typeof raw !== "object") return out;
|
|
109
|
+
const src = raw.accounts;
|
|
110
|
+
if (src && typeof src === "object") {
|
|
111
|
+
for (const [id, value] of Object.entries(src)) {
|
|
112
|
+
if (!ACCOUNT_ID_PATTERN.test(id) || !value || typeof value !== "object") continue;
|
|
113
|
+
const a = value;
|
|
114
|
+
const kind = a.kind;
|
|
115
|
+
if (typeof a.kind !== "string" || !(a.kind in KIND_AGENT) || a.agent !== KIND_AGENT[kind]) continue;
|
|
116
|
+
const label = typeof a.label === "string" && a.label.trim() ? a.label.trim() : id;
|
|
117
|
+
const rec = { label, agent: KIND_AGENT[kind], kind, createdAt: typeof a.createdAt === "number" ? a.createdAt : 0 };
|
|
118
|
+
const baseUrl = typeof a.baseUrl === "string" && /^https?:\/\//.test(a.baseUrl) ? a.baseUrl.replace(/\/+$/, "") : void 0;
|
|
119
|
+
if (kind === "codex-provider") {
|
|
120
|
+
const provider = typeof a.provider === "string" && /^[A-Za-z0-9_-]{1,64}$/.test(a.provider) ? a.provider : void 0;
|
|
121
|
+
if (!provider && !baseUrl) continue;
|
|
122
|
+
if (provider) rec.provider = provider;
|
|
123
|
+
if (a.wireApi === "responses" || a.wireApi === "chat") rec.wireApi = a.wireApi;
|
|
124
|
+
}
|
|
125
|
+
if (kind === "codex-chatgpt") {
|
|
126
|
+
if (typeof a.email === "string" && a.email) rec.email = a.email;
|
|
127
|
+
if (typeof a.planType === "string" && a.planType) rec.planType = a.planType;
|
|
128
|
+
}
|
|
129
|
+
if (isApiKind(kind)) {
|
|
130
|
+
if (kind === "claude-api" && !baseUrl) continue;
|
|
131
|
+
const key = parseKey(a.key);
|
|
132
|
+
if (!key) continue;
|
|
133
|
+
if (baseUrl) rec.baseUrl = baseUrl;
|
|
134
|
+
rec.key = key;
|
|
135
|
+
if (Array.isArray(a.models)) rec.models = a.models.filter((m) => typeof m === "string" && m.length > 0);
|
|
136
|
+
if (a.contextWindows && typeof a.contextWindows === "object") {
|
|
137
|
+
const cw = {};
|
|
138
|
+
for (const [m, n] of Object.entries(a.contextWindows)) {
|
|
139
|
+
if (typeof n === "number" && Number.isInteger(n) && n > 0) cw[m] = n;
|
|
140
|
+
}
|
|
141
|
+
if (Object.keys(cw).length > 0) rec.contextWindows = cw;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
if (typeof a.expiresAt === "number") rec.expiresAt = a.expiresAt;
|
|
145
|
+
if (a.check && typeof a.check === "object") {
|
|
146
|
+
const c = a.check;
|
|
147
|
+
if (typeof c.status === "string" && typeof c.at === "number") {
|
|
148
|
+
rec.check = { status: c.status, at: c.at, ...typeof c.detail === "string" ? { detail: c.detail } : {} };
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
out.accounts[id] = rec;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
const defaults = raw.defaults;
|
|
155
|
+
if (defaults && typeof defaults === "object") {
|
|
156
|
+
for (const [agent, id] of Object.entries(defaults)) {
|
|
157
|
+
if (typeof id === "string" && id) out.defaults[agent] = id;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return out;
|
|
161
|
+
}
|
|
162
|
+
function legacyAccountsFromProviders(raw) {
|
|
163
|
+
const out = {};
|
|
164
|
+
for (const [id, p] of Object.entries(parseProvidersFile(raw).profiles)) {
|
|
165
|
+
if (!ACCOUNT_ID_PATTERN.test(id)) continue;
|
|
166
|
+
out[id] = {
|
|
167
|
+
label: p.name ?? id,
|
|
168
|
+
agent: "claude",
|
|
169
|
+
kind: "claude-api",
|
|
170
|
+
createdAt: 0,
|
|
171
|
+
baseUrl: p.baseUrl,
|
|
172
|
+
key: { source: "file", path: p.apiKeyFile },
|
|
173
|
+
...p.models ? { models: p.models } : {},
|
|
174
|
+
...p.contextWindows ? { contextWindows: p.contextWindows } : {},
|
|
175
|
+
legacy: true
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
return out;
|
|
179
|
+
}
|
|
180
|
+
function mergeAccounts(v2, legacy) {
|
|
181
|
+
return { ...v2, accounts: { ...legacy, ...v2.accounts } };
|
|
182
|
+
}
|
|
183
|
+
function readAccountsFileV2(home) {
|
|
184
|
+
return parseAccountsFile(readJson(accountsPath(home)));
|
|
185
|
+
}
|
|
186
|
+
function readAccounts(home) {
|
|
187
|
+
return mergeAccounts(readAccountsFileV2(home), legacyAccountsFromProviders(readJson(providersPath(home))));
|
|
188
|
+
}
|
|
189
|
+
function writeAccountsFile(home, file) {
|
|
190
|
+
const accounts = {};
|
|
191
|
+
for (const [id, a] of Object.entries(file.accounts)) if (!a.legacy) accounts[id] = a;
|
|
192
|
+
writeJson0600(accountsPath(home), { version: 2, accounts, defaults: file.defaults });
|
|
193
|
+
}
|
|
194
|
+
function mergeSessionBindings(v2Raw, v1Raw) {
|
|
195
|
+
const out = {};
|
|
196
|
+
for (const [sessionId, b] of Object.entries(parseSessionProvidersFile(v1Raw))) out[sessionId] = { account: b.profile, model: b.model };
|
|
197
|
+
if (v2Raw && typeof v2Raw === "object") {
|
|
198
|
+
for (const [sessionId, b] of Object.entries(v2Raw)) {
|
|
199
|
+
if (!b || typeof b !== "object") continue;
|
|
200
|
+
const { account, model } = b;
|
|
201
|
+
if (account !== null && (typeof account !== "string" || !account)) continue;
|
|
202
|
+
out[sessionId] = { account, ...typeof model === "string" && model ? { model } : {} };
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
return out;
|
|
206
|
+
}
|
|
207
|
+
function readSessionBindings(home) {
|
|
208
|
+
return mergeSessionBindings(readJson(sessionAccountsPath(home)), readJson(sessionProvidersPath(home)));
|
|
209
|
+
}
|
|
210
|
+
function readSessionBindingV2(home, sessionId) {
|
|
211
|
+
const raw = readJson(sessionAccountsPath(home));
|
|
212
|
+
const entry = raw && typeof raw === "object" ? raw[sessionId] : void 0;
|
|
213
|
+
return entry && typeof entry === "object" ? entry : void 0;
|
|
214
|
+
}
|
|
215
|
+
function writeSessionBinding(home, sessionId, binding) {
|
|
216
|
+
const raw = readJson(sessionAccountsPath(home));
|
|
217
|
+
const current = raw && typeof raw === "object" ? { ...raw } : {};
|
|
218
|
+
if (binding === void 0) delete current[sessionId];
|
|
219
|
+
else current[sessionId] = binding;
|
|
220
|
+
writeJson0600(sessionAccountsPath(home), current);
|
|
221
|
+
}
|
|
222
|
+
function sessionsBoundTo(bindings, accountId) {
|
|
223
|
+
return Object.entries(bindings).filter(([, b]) => b.account === accountId).map(([id]) => id);
|
|
224
|
+
}
|
|
225
|
+
function writeAccountSecret(home, id, secret) {
|
|
226
|
+
const path$1 = accountSecretPath(home, id);
|
|
227
|
+
node_fs.mkdirSync(path.dirname(path$1), { recursive: true, mode: 448 });
|
|
228
|
+
node_fs.chmodSync(path.dirname(path$1), 448);
|
|
229
|
+
const tmp = `${path$1}.${process.pid}.tmp`;
|
|
230
|
+
node_fs.writeFileSync(tmp, secret.trim() + "\n", { mode: 384 });
|
|
231
|
+
node_fs.chmodSync(tmp, 384);
|
|
232
|
+
node_fs.renameSync(tmp, path$1);
|
|
233
|
+
}
|
|
234
|
+
function removeAccountSecret(home, id) {
|
|
235
|
+
node_fs.rmSync(path.dirname(accountSecretPath(home, id)), { recursive: true, force: true });
|
|
236
|
+
}
|
|
237
|
+
const KIND_ID_BASE = {
|
|
238
|
+
"claude-subscription": "claude-sub",
|
|
239
|
+
"claude-api": "claude-api",
|
|
240
|
+
"codex-chatgpt": "chatgpt",
|
|
241
|
+
"codex-provider": "codex-api"
|
|
242
|
+
};
|
|
243
|
+
function newAccountId(label, kind, taken) {
|
|
244
|
+
const used = new Set(taken);
|
|
245
|
+
const ascii = /^[\x20-\x7e]*$/.test(label);
|
|
246
|
+
const slug = ascii ? label.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 40) : "";
|
|
247
|
+
const base = slug && /^[a-z0-9]/.test(slug) ? slug : KIND_ID_BASE[kind];
|
|
248
|
+
if (!used.has(base)) return base;
|
|
249
|
+
for (let n = 2; ; n++) if (!used.has(`${base}-${n}`)) return `${base}-${n}`;
|
|
250
|
+
}
|
|
251
|
+
function secretPresent(home, id, a, probe) {
|
|
252
|
+
if (a.kind === "codex-chatgpt") return probe.fileReadable(path.join(accountCodexHomePath(home, id), "auth.json"));
|
|
253
|
+
if (a.kind === "claude-subscription" || a.key?.source === "stored") return probe.fileReadable(accountSecretPath(home, id));
|
|
254
|
+
if (a.key?.source === "file") return probe.fileReadable(expandHome(a.key.path));
|
|
255
|
+
if (a.key?.source === "env") return !!probe.env[a.key.name]?.trim();
|
|
256
|
+
return false;
|
|
257
|
+
}
|
|
258
|
+
function accountStatus(home, id, a, probe, now) {
|
|
259
|
+
if (!secretPresent(home, id, a, probe)) return { status: "missing-secret" };
|
|
260
|
+
if (a.expiresAt !== void 0 && a.expiresAt <= now) return { status: "expired" };
|
|
261
|
+
if (a.check) return { status: a.check.status, ...a.check.detail ? { detail: a.check.detail } : {} };
|
|
262
|
+
return { status: "unverified" };
|
|
263
|
+
}
|
|
264
|
+
function summarizeAccount(home, id, a, probe, now) {
|
|
265
|
+
const { status, detail } = accountStatus(home, id, a, probe, now);
|
|
266
|
+
const keySource = a.kind === "claude-subscription" || a.kind === "codex-chatgpt" ? "stored" : a.key?.source;
|
|
267
|
+
const keyRef = a.key?.source === "file" ? a.key.path : a.key?.source === "env" ? a.key.name : void 0;
|
|
268
|
+
return {
|
|
269
|
+
id,
|
|
270
|
+
label: a.label,
|
|
271
|
+
agent: a.agent,
|
|
272
|
+
kind: a.kind,
|
|
273
|
+
status,
|
|
274
|
+
...detail ? { statusDetail: detail } : {},
|
|
275
|
+
...a.check ? { checkedAt: a.check.at } : {},
|
|
276
|
+
...a.createdAt ? { createdAt: a.createdAt } : {},
|
|
277
|
+
...a.expiresAt !== void 0 ? { expiresAt: a.expiresAt } : {},
|
|
278
|
+
...a.baseUrl ? { baseUrl: a.baseUrl } : {},
|
|
279
|
+
...a.models ? { models: a.models } : {},
|
|
280
|
+
...keySource ? { keySource } : {},
|
|
281
|
+
...keyRef ? { keyRef } : {},
|
|
282
|
+
...a.legacy ? { legacy: true } : {},
|
|
283
|
+
...a.provider ? { provider: a.provider } : {},
|
|
284
|
+
...a.email ? { email: a.email } : {},
|
|
285
|
+
...a.planType ? { planType: a.planType } : {}
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
function defaultSecretProbe(env = process.env) {
|
|
289
|
+
return {
|
|
290
|
+
fileReadable: (path) => {
|
|
291
|
+
try {
|
|
292
|
+
return node_fs.readFileSync(path, "utf8").trim().length > 0;
|
|
293
|
+
} catch {
|
|
294
|
+
return false;
|
|
295
|
+
}
|
|
296
|
+
},
|
|
297
|
+
env
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
function buildAgentProfilesState(home, file, probe, now, daemonPid) {
|
|
301
|
+
const accounts = Object.entries(file.accounts).map(([id, a]) => summarizeAccount(home, id, a, probe, now)).sort((x, y) => (x.createdAt ?? 0) - (y.createdAt ?? 0) || x.id.localeCompare(y.id));
|
|
302
|
+
const defaults = {};
|
|
303
|
+
for (const [agent, id] of Object.entries(file.defaults)) if (file.accounts[id]) defaults[agent] = id;
|
|
304
|
+
return { daemonPid, updatedAt: now, accounts, defaults, kinds: [...index.AGENT_PROFILE_KINDS] };
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
exports.SPAWN_ACCOUNT_ENV = SPAWN_ACCOUNT_ENV;
|
|
308
|
+
exports.SUBSCRIPTION_TOKEN_TTL_MS = SUBSCRIPTION_TOKEN_TTL_MS;
|
|
309
|
+
exports.accountCodexHomePath = accountCodexHomePath;
|
|
310
|
+
exports.accountSecretPath = accountSecretPath;
|
|
311
|
+
exports.accountsPath = accountsPath;
|
|
312
|
+
exports.buildAgentProfilesState = buildAgentProfilesState;
|
|
313
|
+
exports.defaultSecretProbe = defaultSecretProbe;
|
|
314
|
+
exports.expandHome = expandHome;
|
|
315
|
+
exports.newAccountId = newAccountId;
|
|
316
|
+
exports.providersPath = providersPath;
|
|
317
|
+
exports.readAccounts = readAccounts;
|
|
318
|
+
exports.readAccountsFileV2 = readAccountsFileV2;
|
|
319
|
+
exports.readSessionBindingV2 = readSessionBindingV2;
|
|
320
|
+
exports.readSessionBindings = readSessionBindings;
|
|
321
|
+
exports.removeAccountSecret = removeAccountSecret;
|
|
322
|
+
exports.sessionsBoundTo = sessionsBoundTo;
|
|
323
|
+
exports.summarizeAccount = summarizeAccount;
|
|
324
|
+
exports.writeAccountSecret = writeAccountSecret;
|
|
325
|
+
exports.writeAccountsFile = writeAccountsFile;
|
|
326
|
+
exports.writeSessionBinding = writeSessionBinding;
|