@noxsoft/anima 5.0.1 → 5.0.3
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/{accounts-BOkEyUcS.js → accounts-DjjQHOIW.js} +5 -5
- package/dist/{accounts-CVmv61PJ.js → accounts-Dzi6Ld7X.js} +2 -2
- package/dist/{acp-cli-C8aBckv5.js → acp-cli-I-yv1f5O.js} +15 -15
- package/dist/{acp-cli-BcshtFqY.js → acp-cli-QBd9GLqD.js} +3 -3
- package/dist/{agent-Cil6Zvns.js → agent-B3KeHK1A.js} +9 -9
- package/dist/{agent-c49U1LxE.js → agent-fG1PVmNy.js} +16 -16
- package/dist/{agent-scope-DICrDp7Y.js → agent-scope-BHR6uOLT.js} +2 -2
- package/dist/{agent-scope-BLiq3nK_.js → agent-scope-ryeVDUKe.js} +2 -2
- package/dist/{agents-2BloqCjm.js → agents-DY5ZtGB2.js} +9 -9
- package/dist/{agents.config-Bqr5rrkV.js → agents.config-DmF0fsB6.js} +1 -1
- package/dist/{anthropic-direct-runner-mh6c_WBB.js → anthropic-direct-runner-BJosFvVm.js} +41 -18
- package/dist/{anthropic-direct-runner-BVlO2Vi5.js → anthropic-direct-runner-BXb24VJt.js} +50 -27
- package/dist/{audit-BbmRSFjf.js → audit-BTMmL_HS.js} +5 -5
- package/dist/{audit-DegswVkZ.js → audit-qHMf9jWY.js} +16 -16
- package/dist/{auth-Cs_c5TKt.js → auth-DQfFqQBz.js} +3 -3
- package/dist/{auth-choice-BVAMr2Dk.js → auth-choice-BoyT3ahK.js} +60 -8
- package/dist/{auth-health-D0VUH0FQ.js → auth-health-BcABdgUT.js} +1 -1
- package/dist/{auth-profiles-k5IOWaG2.js → auth-profiles-BF5x9Ej0.js} +1 -1
- package/dist/{auth-profiles-BhZX2spm.js → auth-profiles-C_LmTbMb.js} +5 -5
- package/dist/{auth-profiles-Chf1JBpl.js → auth-profiles-Da39zGOD.js} +4 -4
- package/dist/{auth-store-D0vDEvCx.js → auth-store-CXZzirrJ.js} +3 -3
- package/dist/{auth-store-BMwyg-WK.js → auth-store-DTpDRu--.js} +3 -3
- package/dist/{banner-CgxCSS-T.js → banner-CJVa8aiZ.js} +1 -1
- package/dist/{bonjour-discovery-DaCmsB4i.js → bonjour-discovery-B3IeIN1u.js} +2 -2
- package/dist/build-info.json +3 -3
- package/dist/bundled/boot-md/handler.js +22 -22
- package/dist/bundled/bootstrap-extra-files/handler.js +7 -7
- package/dist/bundled/session-memory/handler.js +19 -19
- package/dist/{call-Z_GCO8CL.js → call-BKsdSTVf.js} +1 -1
- package/dist/{call-BOwaQIXo.js → call-C3CH9PNK.js} +6 -6
- package/dist/canvas-host/a2ui/.bundle.hash +1 -1
- package/dist/{catalog-B-pfqu76.js → catalog-3hzXhHxJ.js} +2 -2
- package/dist/{channel-web-Y8i3EzJq.js → channel-web-Df3Ay9v7.js} +18 -18
- package/dist/{channels-status-issues-DenKLCLq.js → channels-status-issues-D5XAOSaj.js} +4 -4
- package/dist/{chrome-C3-muxXb.js → chrome-CLhrEjgx.js} +4 -4
- package/dist/{chrome-Cxl7I5SB.js → chrome-CkSIMI7j.js} +2 -2
- package/dist/{chunk-DGg8zCWl.js → chunk-Dq7ILx_r.js} +2 -2
- package/dist/{chunk-DFCmYqgJ.js → chunk-fcLG1hME.js} +1 -1
- package/dist/{clack-prompter-CCRr4nAr.js → clack-prompter-DmD_A7en.js} +5 -5
- package/dist/{clack-prompter-B-ZJG628.js → clack-prompter-bl-Zsxpq.js} +1 -1
- package/dist/cli/daemon-cli.js +1 -1
- package/dist/{cli-C3uw3mId.js → cli-0-FvuyBX.js} +22 -22
- package/dist/cli-CLVEx1Po.js +104 -0
- package/dist/{cli-session-BzZYmGP1.js → cli-session-CmX1oA1T.js} +7 -7
- package/dist/{cli-session-DgUHOBYo.js → cli-session-gR2abU0g.js} +16 -16
- package/dist/{client-BObcTF_9.js → client-BT3pbXCv.js} +3 -3
- package/dist/{command-registry-DLofaVIN.js → command-registry-C3SmyTQU.js} +12 -12
- package/dist/{common-k1Cu8adj.js → common-Bi43BlMQ.js} +2 -2
- package/dist/{common-Cd7BmlCQ.js → common-CSTOiddD.js} +2 -2
- package/dist/{completion-cli-C9KvX2ZF.js → completion-cli-308M08su.js} +2 -2
- package/dist/{completion-cli-3eYvtAih.js → completion-cli-D7gWcWEj.js} +3 -3
- package/dist/{config-B-9UciOO.js → config-BfhpauV9.js} +6 -6
- package/dist/{config-CG7uuHNE.js → config-Dk-5Mb_G.js} +6 -6
- package/dist/{config-D6D_ieel.js → config-Ofh9gKvs.js} +1 -1
- package/dist/config-cli-CajDGi9m.js +15 -0
- package/dist/{config-cli-CBXWDtvj.js → config-cli-De0z7mvk.js} +3 -3
- package/dist/{config-guard-BT3OoaEu.js → config-guard-BnkobgvR.js} +21 -21
- package/dist/{config-guard-qiKju2Fg.js → config-guard-DlOs5hMU.js} +2 -2
- package/dist/{configure-jlAKeuki.js → configure-BXK8YRUD.js} +32 -32
- package/dist/{configure-CH_-SNya.js → configure-Caf6yI_m.js} +24 -24
- package/dist/{configure-Dpk4lSoz.js → configure-DS9oQW51.js} +78 -78
- package/dist/{configure-CGTBBLR_.js → configure-DgXRL7Uz.js} +9 -9
- package/dist/{context-Cau0zD3W.js → context-BZV-msqG.js} +1 -1
- package/dist/{control-service-DMoq3DpT.js → control-service-BFYEuU-S.js} +5 -5
- package/dist/{control-service-CUhnhmpc.js → control-service-DUF4hGd3.js} +2 -2
- package/dist/{cron-cli-CKs1evSF.js → cron-cli-BglUapfu.js} +4 -4
- package/dist/{cron-cli-ybIqf_95.js → cron-cli-OHSsCpVe.js} +16 -16
- package/dist/{daemon-cli-C5Tosclk.js → daemon-cli-B2UGyc5z.js} +19 -19
- package/dist/{daemon-cli-CSCFNzUo.js → daemon-cli-CO-1GTE_.js} +5 -5
- package/dist/daemon-cli.js +58 -1
- package/dist/{daemon-runtime-B9AywEma.js → daemon-runtime-BsUCg0Nr.js} +3 -3
- package/dist/{daemon-runtime-DpY6Y5qE.js → daemon-runtime-cGQoReHT.js} +1 -1
- package/dist/{deliver-DkF6LCoS.js → deliver-CoAOvyW0.js} +1 -1
- package/dist/{deliver-BYxbDIF0.js → deliver-DhQSpWQA.js} +4 -4
- package/dist/{deliver-B2p9Fke_.js → deliver-DvbZ8dp4.js} +6 -6
- package/dist/{deps-D9266xfk.js → deps-CCbWMWT4.js} +1 -1
- package/dist/{diagnostics-TXSvtpaq.js → diagnostics-CtqVmSaZ.js} +1 -1
- package/dist/{dispatcher-DG44QJKz.js → dispatcher-C4k9ABOv.js} +2 -2
- package/dist/{dispatcher-BeO47t7A.js → dispatcher-N_4IYF9I.js} +1 -1
- package/dist/{dns-cli-BklOUsrX.js → dns-cli-DJ8mwzgA.js} +2 -2
- package/dist/{dns-cli-Dq98107U.js → dns-cli-Dk48S2y7.js} +13 -13
- package/dist/{docs-cli-CehJ2v5M.js → docs-cli-BvBEqoCl.js} +7 -7
- package/dist/{doctor-DJfgnQ67.js → doctor-9cbiXykn.js} +19 -19
- package/dist/{doctor-CWmHUAjs.js → doctor-C_1WNQix.js} +40 -40
- package/dist/{doctor-completion-CmJmktDv.js → doctor-completion-B1cKYcZj.js} +1 -1
- package/dist/{doctor-completion-CtCwd1fi.js → doctor-completion-D7uvGhAv.js} +3 -3
- package/dist/{doctor-config-flow-D0GgdMmi.js → doctor-config-flow-Bno6wZvG.js} +7 -7
- package/dist/{doctor-config-flow-D_8YNTSK.js → doctor-config-flow-rshwu4JS.js} +3 -3
- package/dist/entry.js +59 -2
- package/dist/{env-T3-raV4i.js → env-CLiKFfXU.js} +1 -1
- package/dist/{exec-DbnX_71w.js → exec-Bo7Vwe77.js} +1 -1
- package/dist/{exec-DnanRQle.js → exec-CEFTijVj.js} +1 -1
- package/dist/{exec-approvals-cli-B7hQEhGe.js → exec-approvals-cli-CRqO-FRn.js} +19 -19
- package/dist/{exec-approvals-cli-CcY7IQWQ.js → exec-approvals-cli-i_Bmu0zE.js} +4 -4
- package/dist/extensionAPI.js +1535 -315
- package/dist/{frontmatter-BmBmtOUh.js → frontmatter-Dsa7N963.js} +1 -1
- package/dist/{gateway-cli-DYrzIvOE.js → gateway-cli-CBmfvcpr.js} +99 -99
- package/dist/{gateway-cli-BazTmg20.js → gateway-cli-CufIzw2K.js} +43 -43
- package/dist/{gateway-rpc-LkRV5joR.js → gateway-rpc-BX-Pz0j8.js} +3 -3
- package/dist/{gateway-rpc-De-TWFvD.js → gateway-rpc-BvqpdNqp.js} +1 -1
- package/dist/{gmail-setup-utils-B4oMbrOI.js → gmail-setup-utils-B-LgbK-5.js} +3 -3
- package/dist/{health-BRSKF_iF.js → health-BVBoq6jM.js} +10 -10
- package/dist/{health-JqtB_B8C.js → health-DKC8u4W8.js} +18 -18
- package/dist/{health-format-Ojy0hLp3.js → health-format-DHYaqzgj.js} +2 -2
- package/dist/{heartbeat-visibility-BGj2czmk.js → heartbeat-visibility-CF3WzMM0.js} +2 -2
- package/dist/{heartbeat-visibility-pyFf6XBW.js → heartbeat-visibility-CUKC8xqZ.js} +2 -2
- package/dist/{help-format-BZ7j9sHT.js → help-format-mLYxJ3oD.js} +1 -1
- package/dist/{hooks-cli-B7g3jEC3.js → hooks-cli-BHO_BQFY.js} +23 -23
- package/dist/{hooks-cli-ZK4Z044T.js → hooks-cli-kLrFK7pV.js} +57 -57
- package/dist/{hooks-status-DR_WkhpR.js → hooks-status-CfvVr6eJ.js} +3 -3
- package/dist/{image-ops-B7tKwzpV.js → image-ops-C_aRXc-7.js} +1 -1
- package/dist/index.js +69 -69
- package/dist/{installs-BxZFjTKY.js → installs-DW-ErO4y.js} +5 -5
- package/dist/{lanes-DyM6NSSL.js → lanes-CrNcoc6P.js} +480 -163
- package/dist/{lifecycle-core-CHv9wUhV.js → lifecycle-core-DWESti3N.js} +6 -6
- package/dist/{links-CziCxopc.js → links-C4Hwnnc9.js} +1 -1
- package/dist/llm-slug-generator.js +17 -17
- package/dist/{logging-Dwz0XtXm.js → logging-CnEuyIPZ.js} +1 -1
- package/dist/{login-BvRe8YZ9.js → login-CY9_XaLc.js} +7 -7
- package/dist/{login-BbfWLOBl.js → login-Dj6hCAFK.js} +5 -5
- package/dist/{login-DevThvtW.js → login-Ga69_Kio.js} +2 -2
- package/dist/{login-qr-FDWY-tu5.js → login-qr-BYeWGzxI.js} +12 -12
- package/dist/{login-qr-BqhujMcQ.js → login-qr-DD1apkdT.js} +10 -10
- package/dist/{login-qr-BkpIGqae.js → login-qr-swgX7elR.js} +3 -3
- package/dist/{logs-cli-CiMRc2qL.js → logs-cli-D02oahhw.js} +4 -4
- package/dist/{logs-cli-CsfmPUwa.js → logs-cli-DAVu9h8p.js} +16 -16
- package/dist/{manager-CcawxgaC.js → manager-CLAy-qOR.js} +10 -10
- package/dist/{manager-v4S80Br3.js → manager-DQPfk6Ea.js} +12 -12
- package/dist/{manager-DS1DfkbC.js → manager-yWxV2UI_.js} +1 -1
- package/dist/{manifest-registry-BiGCvMJ8.js → manifest-registry-BJat2nhC.js} +1 -1
- package/dist/{memory-cli-wDO418hx.js → memory-cli-B8AsIRG3.js} +3 -3
- package/dist/{memory-cli-Cl2n9UtH.js → memory-cli-bA70cVlm.js} +12 -12
- package/dist/{message-channel-DuxJGOJz.js → message-channel-C5I8UgGH.js} +1 -1
- package/dist/{model-auth-Ja4oelNH.js → model-auth-Be3_KahV.js} +2 -2
- package/dist/{model-auth-DVG37yXU.js → model-auth-DBHvPqaY.js} +4 -4
- package/dist/{model-auth-Uxm-wRjR.js → model-auth-DYHjH-Oh.js} +3 -3
- package/dist/{model-selection-xZLlICyg.js → model-selection-BuMFehML.js} +5 -2
- package/dist/{model-selection-BKFF7fDb.js → model-selection-DFbDH9o2.js} +4 -1
- package/dist/{model-selection-C2dAUmK_.js → model-selection-DRIxw3do.js} +5 -2
- package/dist/{models-tQnX4hL4.js → models-B9jYbX5H.js} +26 -26
- package/dist/{node-cli-DAcW-rfA.js → node-cli-C_efNJ2B.js} +7 -7
- package/dist/{node-cli-CZuWFgpO.js → node-cli-ScPCT6uD.js} +28 -28
- package/dist/{node-service-Ds1r16VN.js → node-service-BCfZtWK_.js} +1 -1
- package/dist/{note-Daao-cv8.js → note-DjzS4Am4.js} +2 -2
- package/dist/{npm-registry-spec-fJIJ8GG5.js → npm-registry-spec-Opq9qQXl.js} +1 -1
- package/dist/{onboard-Dd6xFMYB.js → onboard-C7ZSJNCe.js} +10 -10
- package/dist/{onboard-dasbF9G1.js → onboard-CJOJPctL.js} +17 -17
- package/dist/{onboard-channels-DisvVyIs.js → onboard-channels-DSlUCvl1.js} +2 -2
- package/dist/{onboard-channels-BUv3VbAL.js → onboard-channels-DwPNXSwW.js} +9 -9
- package/dist/{onboard-helpers-BgsHO6fO.js → onboard-helpers-CU_S0_Kf.js} +10 -10
- package/dist/{onboard-helpers-49TVSf7J.js → onboard-helpers-tkuUrdCB.js} +2 -2
- package/dist/{onboarding-Dq3bCBjc.js → onboarding-Caiq91Yz.js} +10 -10
- package/dist/{onboarding-6Xs4orLw.js → onboarding-DP2NlqhA.js} +20 -20
- package/dist/{outbound-RxegsVGB.js → outbound-B84phlQU.js} +4 -4
- package/dist/{outbound-CliT3nme.js → outbound-CKmmCVxJ.js} +1 -1
- package/dist/{outbound-CLII4C2A.js → outbound-DKM-JeSH.js} +5 -5
- package/dist/{parse-timeout-BnOIKwx8.js → parse-timeout-C59j-ev4.js} +1 -1
- package/dist/{parse-timeout-C8t_lmnL.js → parse-timeout-aZGyXXFz.js} +3 -3
- package/dist/{path-env-CsgLP0dy.js → path-env-cFxXrXB1.js} +1 -1
- package/dist/{paths-DybdJi5a.js → paths-CLxC7m0Z.js} +1 -1
- package/dist/{pi-auth-json-MH7vz0HI.js → pi-auth-json-DPoqstQN.js} +7 -7
- package/dist/{pi-auth-json-BY6wRDm0.js → pi-auth-json-DjxzPUt3.js} +2 -2
- package/dist/{pi-auth-json-DLroEcea.js → pi-auth-json-hMxhauJ8.js} +6 -6
- package/dist/{pi-embedded-CS4D_0t7.js → pi-embedded-JUmNmkTK.js} +700 -362
- package/dist/{pi-embedded-helpers-iju5zIIA.js → pi-embedded-helpers-B6wVA0hU.js} +1 -1
- package/dist/{pi-embedded-helpers-DnRfi8bN.js → pi-embedded-helpers-B_Sx4G6d.js} +30 -20
- package/dist/{pi-tools.policy-RhdERrk3.js → pi-tools.policy-Bn9S3ywB.js} +2 -2
- package/dist/{pi-tools.policy-CN78I2yN.js → pi-tools.policy-ChzY9kW7.js} +7 -7
- package/dist/{plugin-auto-enable-DLrgOd4y.js → plugin-auto-enable-UE1XVFcw.js} +1 -1
- package/dist/{plugin-auto-enable-DIWd94Po.js → plugin-auto-enable-f05JE-GF.js} +5 -5
- package/dist/{plugin-registry-l3z9phEV.js → plugin-registry-BeB2L6Qe.js} +2 -2
- package/dist/{plugin-registry-esOxvV3X.js → plugin-registry-DIXcynua.js} +4 -4
- package/dist/plugin-sdk/agents/anthropic-direct-runner.d.ts +1 -1
- package/dist/plugin-sdk/agents/gemini-direct-runner.d.ts +38 -0
- package/dist/plugin-sdk/agents/tools/browser-tool.schema.d.ts +2 -2
- package/dist/plugin-sdk/commands/onboard-types.d.ts +2 -2
- package/dist/plugin-sdk/gateway/protocol/index.d.ts +22 -22
- package/dist/plugin-sdk/index.js +75 -8
- package/dist/{plugins-C_GedoUi.js → plugins-DCXdhkeB.js} +2 -2
- package/dist/{plugins-BmYfBGLM.js → plugins-NbldDVJs.js} +1 -1
- package/dist/{plugins-cli-CbXtuN4b.js → plugins-cli-CzUD-ewi.js} +58 -58
- package/dist/{plugins-cli-D2v0n4BL.js → plugins-cli-Dk2W0fBT.js} +23 -23
- package/dist/{polls-Cuv4dsX_.js → polls-OzE9fR2s.js} +6 -6
- package/dist/{ports-DOiSDgNp.js → ports-CWvYU8j6.js} +4 -4
- package/dist/{ports-BQ0cAsGj.js → ports-Cgow804e.js} +2 -2
- package/dist/{program-y0NPJuYm.js → program-DxItv_Ts.js} +28 -28
- package/dist/{program-context-CqPwmgYa.js → program-context-cgh8PMPD.js} +33 -33
- package/dist/{progress-BZZa-fXr.js → progress-DzZ_4Z4f.js} +1 -1
- package/dist/{prompt-style-1bwj7IzZ.js → prompt-style-C7WfXowC.js} +1 -1
- package/dist/{prompts-DY0qdoD1.js → prompts-BfHxhlF9.js} +13 -2
- package/dist/{prompts-DTKoIKPV.js → prompts-DH_nIROF.js} +71 -8
- package/dist/{pw-ai-BhoKfvvM.js → pw-ai-Bigm0Qwh.js} +7 -7
- package/dist/{pw-ai-CJgeaF06.js → pw-ai-CsODxGt8.js} +3 -3
- package/dist/{qmd-manager-BGob_1OP.js → qmd-manager-C3z8LWKx.js} +6 -6
- package/dist/{qmd-manager-BmGj4bZk.js → qmd-manager-lfhigvUf.js} +6 -6
- package/dist/{register.agent-CRazop1A.js → register.agent-BVwbjkKx.js} +30 -30
- package/dist/{register.agent-Bi2FqIlN.js → register.agent-D0FKVD_s.js} +70 -70
- package/dist/{register.anima-BmdRCJLy.js → register.anima-Dc7OI2Nh.js} +4 -4
- package/dist/{register.anima-FFaI_C8x.js → register.anima-bys_cyEd.js} +4 -4
- package/dist/{register.configure-FIXOWrO9.js → register.configure-BrRG_RtB.js} +31 -31
- package/dist/register.configure-CXKr61Ka.js +108 -0
- package/dist/register.maintenance-BToHjam6.js +103 -0
- package/dist/{register.maintenance-DJYji5mV.js → register.maintenance-DXL3L0ip.js} +35 -35
- package/dist/{register.onboard-thGXwzOX.js → register.onboard-B3hbdfaQ.js} +71 -71
- package/dist/{register.onboard-oUsWjmam.js → register.onboard-Bg5zEb3f.js} +35 -35
- package/dist/{register.setup-B4MYuE3g.js → register.setup-CZqwphif.js} +35 -35
- package/dist/{register.setup-DWDrQ7RT.js → register.setup-Cq8nqbrU.js} +71 -71
- package/dist/{register.status-health-sessions-Ce9QUAyj.js → register.status-health-sessions-D1kjQUAc.js} +67 -67
- package/dist/{register.status-health-sessions-CTKdzo7a.js → register.status-health-sessions-mdLJbfPN.js} +28 -28
- package/dist/{register.subclis-CWmYc4AB.js → register.subclis-mbYw7H-_.js} +20 -20
- package/dist/{reply-BKpIrCr-.js → reply-CwV-5jE0.js} +56 -52
- package/dist/{reply-CpHIJ9Kk.js → reply-DAGmjvs-.js} +33 -29
- package/dist/{reply-prefix-BO_Dt82N.js → reply-prefix-BRsV1Eof.js} +2 -2
- package/dist/{reply-prefix-BwVBvQXp.js → reply-prefix-CAsFNEP7.js} +2 -2
- package/dist/{routes-C2EyUA9x.js → routes-CYHrkIjB.js} +6 -6
- package/dist/{routes-XhTPYecR.js → routes-cdfVFYMI.js} +2 -2
- package/dist/{run-CGokiDR8.js → run-DE6EaeE3.js} +70 -70
- package/dist/{run--9hftM2H.js → run-S0Cw3Fyy.js} +32 -32
- package/dist/{run-main-DxcOzCLw.js → run-main-CCxXEvb7.js} +41 -41
- package/dist/{runtime-guard-B40AREJ_.js → runtime-guard-CNnLK4pn.js} +1 -1
- package/dist/{sandbox-BwUo1b0I.js → sandbox-B4-dXpqZ.js} +6 -6
- package/dist/{sandbox-CiwAPzO7.js → sandbox-DhcoWMaN.js} +2 -2
- package/dist/{sandbox-cli-D9-wZJ9M.js → sandbox-cli-DQMWPCOh.js} +24 -24
- package/dist/{sandbox-cli-DsrzwG_s.js → sandbox-cli-TAuv3mTO.js} +6 -6
- package/dist/{security-cli-CX5uciKz.js → security-cli-Da-3YxZ4.js} +29 -29
- package/dist/{security-cli-CouqfUGc.js → security-cli-Dc-NwTC2.js} +9 -9
- package/dist/{semantic-Buqqx7gZ.js → semantic-BlQgdb3-.js} +1 -1
- package/dist/{semantic-B4TOg4CK.js → semantic-VlSmVCfb.js} +1 -1
- package/dist/{server-context-B78_sSOW.js → server-context-C-usQ5Np.js} +1 -1
- package/dist/{server-context-efO1YgXk.js → server-context-r7wPe4ZD.js} +9 -9
- package/dist/{server-node-events-TN_Y9MgU.js → server-node-events-3KeQAwUo.js} +14 -14
- package/dist/{server-node-events-DJlLCF2M.js → server-node-events-GTSQEd_U.js} +36 -36
- package/dist/{service-D1idQeBv.js → service-DCVAkKlN.js} +1 -1
- package/dist/{service-audit-BzwV-IOi.js → service-audit-Crw1cAbj.js} +1 -1
- package/dist/{service-audit-BbwXAhsr.js → service-audit-DRIpsryX.js} +3 -3
- package/dist/{session-Dvwwi-Eb.js → session-CrGApVik.js} +1 -1
- package/dist/{session-skOcrvF2.js → session-D3BNUwtH.js} +1 -1
- package/dist/{session-DCGAvNG9.js → session-DKCUYHCS.js} +1 -1
- package/dist/{session-cost-usage-6bDLU9Pb.js → session-cost-usage-LvsvRW5g.js} +1 -1
- package/dist/{session-BjPdEBPh.js → session-mpOb9zFL.js} +5 -5
- package/dist/{sessions-kJgmpWtv.js → sessions-BduC6sZj.js} +78 -68
- package/dist/{sessions-B7ikzhI_.js → sessions-CAiEkTKb.js} +18 -8
- package/dist/{sessions-B7clh58j.js → sessions-DLPN62LD.js} +4 -4
- package/dist/{settings-cli-JU5bg5jb.js → settings-cli-BgGYdH4N.js} +77 -77
- package/dist/{settings-cli-DjVugHID.js → settings-cli-f0O0FUVO.js} +32 -32
- package/dist/{setup-token-CvRwJUVY.js → setup-token-lcjrc9sO.js} +28 -28
- package/dist/{setup-token-wFsQlaW2.js → setup-token-ykp60QVx.js} +9 -9
- package/dist/{shared-DC8lQHCt.js → shared-Ca0NTTF0.js} +3 -3
- package/dist/{shell-env-JzaPTLKV.js → shell-env-BZ_fIIlm.js} +1 -1
- package/dist/{shell-env-C1yK_Rod.js → shell-env-DaSbgZYX.js} +2 -2
- package/dist/{skill-scanner-HQwt_KRF.js → skill-scanner--TxpCSNF.js} +1 -1
- package/dist/{skills-cli-OYZS-U1f.js → skills-cli-BpyTvFkg.js} +16 -16
- package/dist/{skills-cli-CSMzc9am.js → skills-cli-Tm326cFx.js} +2 -2
- package/dist/{skills-install-BKz5WLq4.js → skills-install-B2m10oTm.js} +5 -5
- package/dist/{skills-status-B_umZ78Q.js → skills-status-D14GZ5WN.js} +3 -3
- package/dist/{skills-ppB3qrZU.js → skills-wS8aRGeO.js} +3 -3
- package/dist/{soul-DpWsWxOa.js → soul-CAEpnUkv.js} +1 -1
- package/dist/{soul-aZoR6Ctt.js → soul-D9EtC35X.js} +1 -1
- package/dist/{sqlite-CnVGUfhz.js → sqlite-B0rfPL8q.js} +2 -2
- package/dist/{sqlite-Duz1QJIT.js → sqlite-CR0WDTae.js} +2 -2
- package/dist/start-DYq7cNRG.js +157 -0
- package/dist/{start-CAbxlnFZ.js → start-Y69GZPdX.js} +41 -41
- package/dist/{status-YH65ctig.js → status-BplZv8_T.js} +2 -2
- package/dist/{status-CrJV2Y4x.js → status-K3LGPZeT.js} +4 -4
- package/dist/{status-CxxXFU4R.js → status-Uzlo7BvY.js} +27 -27
- package/dist/{status-1TjjCE1l.js → status-rt3tIYmL.js} +13 -13
- package/dist/{status.update-P6xyBet8.js → status.update-B61Emp_r.js} +3 -3
- package/dist/{status.update-BzAuf_G-.js → status.update-yjbKzlMn.js} +1 -1
- package/dist/{subagent-registry-xJY9wqZy.js → subagent-registry-DfCDq9hk.js} +14 -14
- package/dist/{subagent-registry-3Dw3YppH.js → subagent-registry-ZIpC5W-9.js} +7 -7
- package/dist/{subagent-registry-B_65nJFp.js → subagent-registry-xp5sYYzS.js} +13 -13
- package/dist/{subsystem-Cn6bJV8Z.js → subsystem-BMsbqSb4.js} +58 -1
- package/dist/{subsystem-WFp78xn1.js → subsystem-BP2l3SHn.js} +58 -1
- package/dist/{system-cli-Dbn4_ed8.js → system-cli-D-eyDWD6.js} +4 -4
- package/dist/{system-cli-lmslA_Ox.js → system-cli-Dy2Pwnbg.js} +15 -15
- package/dist/{systemd-DYPdTwok.js → systemd-DXo2A9_S.js} +2 -2
- package/dist/{systemd-hints-E8yYE8Q1.js → systemd-hints-DIjCA1An.js} +1 -1
- package/dist/{systemd-linger-CpWguZ4b.js → systemd-linger-DgB-ow-D.js} +2 -2
- package/dist/{table-B991ZwKi.js → table-C-GNQABy.js} +2 -2
- package/dist/{timeout-Dbspj9Jf.js → timeout-Cl8rWNWO.js} +350 -33
- package/dist/{tokens-k_R7Y792.js → tokens-FGW_JgKz.js} +1 -1
- package/dist/{tool-images-DJZPwGqm.js → tool-images-Df50dvpv.js} +2 -2
- package/dist/{tool-images-BehEzEZF.js → tool-images-RiPaL7wQ.js} +2 -2
- package/dist/{tui-PCTDV7Ct.js → tui-NlR4LFBm.js} +9 -9
- package/dist/{tui--eIVX_W0.js → tui-YsmTyq58.js} +3 -3
- package/dist/{tui-cli-DBV3lnXA.js → tui-cli-CSudxVpO.js} +9 -9
- package/dist/{tui-cli-D39zC_Ew.js → tui-cli-QnKj1We8.js} +28 -28
- package/dist/{update-tjMvDUCw.js → update-B2O46V_t.js} +3 -3
- package/dist/{update-cli-QP5L8xlv.js → update-cli-BXKL-v-n.js} +86 -86
- package/dist/{update-cli-BzaQvirL.js → update-cli-BgQUtlLg.js} +37 -37
- package/dist/{update-runner-ZuJN8uBE.js → update-runner-U2WcWGfd.js} +5 -5
- package/dist/{update-runner-B_oj7S_n.js → update-runner-fvdM_Hip.js} +1 -1
- package/dist/{usage-DzKbMa8N.js → usage-CM-NiwBA.js} +9 -9
- package/dist/{utils-dWKYjULE.js → utils-B60lF9Wq.js} +1 -1
- package/dist/{web-CgQc2Raf.js → web-B8r6MvXh.js} +43 -43
- package/dist/web-BzFhL5WI.js +67 -0
- package/dist/{web-nI3eIGAT.js → web-eoSM6P0a.js} +26 -26
- package/dist/{webhooks-cli-CYbIJJF6.js → webhooks-cli-24A2CbXR.js} +2 -2
- package/dist/{webhooks-cli-oRmSfYdd.js → webhooks-cli-CgkxWcH5.js} +13 -13
- package/dist/{whatsapp-actions-BzPQUcRR.js → whatsapp-actions-BVlqbVgY.js} +3 -3
- package/dist/{whatsapp-actions-CZuxHplg.js → whatsapp-actions-BYxKWK0A.js} +13 -13
- package/dist/{whatsapp-actions-BB-Leqn2.js → whatsapp-actions-DagVwYC6.js} +17 -17
- package/dist/{widearea-dns-CkuHFBQy.js → widearea-dns-B1TTb1v5.js} +1 -1
- package/dist/{workspace-DOJssemp.js → workspace-Cvio8QlZ.js} +1 -1
- package/dist/{ws-log-B-xsUQys.js → ws-log-De7GACYn.js} +1 -1
- package/dist/{ws-CQYP0dWu.js → ws-sdRTa2sP.js} +1 -1
- package/package.json +1 -1
- package/dist/cli-CfvBmuhw.js +0 -104
- package/dist/config-cli-cmNuTlw0.js +0 -15
- package/dist/register.configure-r5AViY3N.js +0 -108
- package/dist/register.maintenance-Cpf0ZZTL.js +0 -103
- package/dist/start-M9abr1O1.js +0 -157
- package/dist/web-DtWSf5wm.js +0 -67
- /package/dist/{boolean-M-esQJt6.js → boolean-Ce2-qkSB.js} +0 -0
- /package/dist/{command-format-B1WxXbeU.js → command-format-UwAvxtMC.js} +0 -0
- /package/dist/{config-Qw5FwfRK.js → config-COtiNNtV.js} +0 -0
- /package/dist/{errors-DjZBTJJ3.js → errors-D6Vj_xs4.js} +0 -0
- /package/dist/{file-lock-BRW4LeL0.js → file-lock-BFQVGKm5.js} +0 -0
- /package/dist/{input-provenance-B0pwc6mp.js → input-provenance-sPbZYo89.js} +0 -0
- /package/dist/{internal-hooks-Exeq-wmx.js → internal-hooks-CWw3Hgeu.js} +0 -0
- /package/dist/{paths-BvY3CbW0.js → paths-CnuAkdfx.js} +0 -0
- /package/dist/{tailnet-CjJJHjPU.js → tailnet-CabhakZ7.js} +0 -0
- /package/dist/{transcript-events-DUQC5hbS.js → transcript-events-C1hdue6u.js} +0 -0
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import { I as shouldLogVerbose, t as createSubsystemLogger } from "./subsystem-
|
|
2
|
-
import { n as classifyFailoverReason, o as isFailoverErrorMessage } from "./pi-embedded-helpers-
|
|
3
|
-
import { t as runCommandWithTimeout } from "./exec-
|
|
4
|
-
import { u as resolveSessionAgentIds } from "./agent-scope-
|
|
5
|
-
import { c as normalizeProviderId } from "./model-selection-
|
|
6
|
-
import { t as isTruthyEnvValue } from "./env-
|
|
7
|
-
import { u as loadAuthProfileStore } from "./auth-profiles-
|
|
8
|
-
import {
|
|
1
|
+
import { I as shouldLogVerbose, t as createSubsystemLogger } from "./subsystem-BMsbqSb4.js";
|
|
2
|
+
import { n as classifyFailoverReason, o as isFailoverErrorMessage } from "./pi-embedded-helpers-B6wVA0hU.js";
|
|
3
|
+
import { t as runCommandWithTimeout } from "./exec-Bo7Vwe77.js";
|
|
4
|
+
import { u as resolveSessionAgentIds } from "./agent-scope-ryeVDUKe.js";
|
|
5
|
+
import { c as normalizeProviderId } from "./model-selection-DRIxw3do.js";
|
|
6
|
+
import { t as isTruthyEnvValue } from "./env-CLiKFfXU.js";
|
|
7
|
+
import { u as loadAuthProfileStore } from "./auth-profiles-C_LmTbMb.js";
|
|
8
|
+
import { i as resolveApiKeyForProvider } from "./model-auth-DBHvPqaY.js";
|
|
9
|
+
import { $ as resolveBootstrapContextForRun, Q as makeBootstrapWarn, _ as resolveSessionIdToSend, c as buildCliArgs, d as cleanupSuspendedCliProcesses, f as enqueueCliRun, g as resolvePromptInput, h as parseCliJsonl, i as resolveRunWorkspaceDir, l as buildSystemPrompt, m as parseCliJson, o as resolveAnimaDocsPath, p as normalizeCliModel, r as redactRunIdentifier, s as appendImagePathsToPrompt, st as resolveHeartbeatPrompt, t as runAnthropicDirectAgent, u as cleanupResumeProcesses, v as resolveSystemPromptUsage, y as writeCliImages } from "./anthropic-direct-runner-BXb24VJt.js";
|
|
9
10
|
import { existsSync } from "node:fs";
|
|
10
|
-
import { homedir } from "node:os";
|
|
11
|
-
import { join } from "node:path";
|
|
11
|
+
import os, { homedir } from "node:os";
|
|
12
|
+
import path, { join } from "node:path";
|
|
13
|
+
import fs$1 from "node:fs/promises";
|
|
12
14
|
import crypto from "node:crypto";
|
|
13
15
|
|
|
14
16
|
//#region src/agents/timeout.ts
|
|
@@ -39,8 +41,164 @@ function resolveAgentTimeoutMs(opts) {
|
|
|
39
41
|
return defaultMs;
|
|
40
42
|
}
|
|
41
43
|
|
|
44
|
+
//#endregion
|
|
45
|
+
//#region src/agents/failover-error.ts
|
|
46
|
+
const TIMEOUT_HINT_RE = /timeout|timed out|deadline exceeded|context deadline exceeded/i;
|
|
47
|
+
const ABORT_TIMEOUT_RE = /request was aborted|request aborted/i;
|
|
48
|
+
var FailoverError = class extends Error {
|
|
49
|
+
constructor(message, params) {
|
|
50
|
+
super(message, { cause: params.cause });
|
|
51
|
+
this.name = "FailoverError";
|
|
52
|
+
this.reason = params.reason;
|
|
53
|
+
this.provider = params.provider;
|
|
54
|
+
this.model = params.model;
|
|
55
|
+
this.profileId = params.profileId;
|
|
56
|
+
this.status = params.status;
|
|
57
|
+
this.code = params.code;
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
function isFailoverError(err) {
|
|
61
|
+
return err instanceof FailoverError;
|
|
62
|
+
}
|
|
63
|
+
function resolveFailoverStatus(reason) {
|
|
64
|
+
switch (reason) {
|
|
65
|
+
case "billing": return 402;
|
|
66
|
+
case "rate_limit": return 429;
|
|
67
|
+
case "auth": return 401;
|
|
68
|
+
case "timeout": return 408;
|
|
69
|
+
case "format": return 400;
|
|
70
|
+
default: return;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
function getStatusCode(err) {
|
|
74
|
+
if (!err || typeof err !== "object") return;
|
|
75
|
+
const candidate = err.status ?? err.statusCode;
|
|
76
|
+
if (typeof candidate === "number") return candidate;
|
|
77
|
+
if (typeof candidate === "string" && /^\d+$/.test(candidate)) return Number(candidate);
|
|
78
|
+
}
|
|
79
|
+
function getErrorName(err) {
|
|
80
|
+
if (!err || typeof err !== "object") return "";
|
|
81
|
+
return "name" in err ? String(err.name) : "";
|
|
82
|
+
}
|
|
83
|
+
function getErrorCode(err) {
|
|
84
|
+
if (!err || typeof err !== "object") return;
|
|
85
|
+
const candidate = err.code;
|
|
86
|
+
if (typeof candidate !== "string") return;
|
|
87
|
+
const trimmed = candidate.trim();
|
|
88
|
+
return trimmed ? trimmed : void 0;
|
|
89
|
+
}
|
|
90
|
+
function getErrorMessage(err) {
|
|
91
|
+
if (err instanceof Error) return err.message;
|
|
92
|
+
if (typeof err === "string") return err;
|
|
93
|
+
if (typeof err === "number" || typeof err === "boolean" || typeof err === "bigint") return String(err);
|
|
94
|
+
if (typeof err === "symbol") return err.description ?? "";
|
|
95
|
+
if (err && typeof err === "object") {
|
|
96
|
+
const message = err.message;
|
|
97
|
+
if (typeof message === "string") return message;
|
|
98
|
+
}
|
|
99
|
+
return "";
|
|
100
|
+
}
|
|
101
|
+
function hasTimeoutHint(err) {
|
|
102
|
+
if (!err) return false;
|
|
103
|
+
if (getErrorName(err) === "TimeoutError") return true;
|
|
104
|
+
const message = getErrorMessage(err);
|
|
105
|
+
return Boolean(message && TIMEOUT_HINT_RE.test(message));
|
|
106
|
+
}
|
|
107
|
+
function isTimeoutError(err) {
|
|
108
|
+
if (hasTimeoutHint(err)) return true;
|
|
109
|
+
if (!err || typeof err !== "object") return false;
|
|
110
|
+
if (getErrorName(err) !== "AbortError") return false;
|
|
111
|
+
const message = getErrorMessage(err);
|
|
112
|
+
if (message && ABORT_TIMEOUT_RE.test(message)) return true;
|
|
113
|
+
const cause = "cause" in err ? err.cause : void 0;
|
|
114
|
+
const reason = "reason" in err ? err.reason : void 0;
|
|
115
|
+
return hasTimeoutHint(cause) || hasTimeoutHint(reason);
|
|
116
|
+
}
|
|
117
|
+
function resolveFailoverReasonFromError(err) {
|
|
118
|
+
if (isFailoverError(err)) return err.reason;
|
|
119
|
+
const status = getStatusCode(err);
|
|
120
|
+
if (status === 402) return "billing";
|
|
121
|
+
if (status === 429) return "rate_limit";
|
|
122
|
+
if (status === 401 || status === 403) return "auth";
|
|
123
|
+
if (status === 408) return "timeout";
|
|
124
|
+
if (status === 400) return "format";
|
|
125
|
+
const code = (getErrorCode(err) ?? "").toUpperCase();
|
|
126
|
+
if ([
|
|
127
|
+
"ETIMEDOUT",
|
|
128
|
+
"ESOCKETTIMEDOUT",
|
|
129
|
+
"ECONNRESET",
|
|
130
|
+
"ECONNABORTED"
|
|
131
|
+
].includes(code)) return "timeout";
|
|
132
|
+
if (isTimeoutError(err)) return "timeout";
|
|
133
|
+
const message = getErrorMessage(err);
|
|
134
|
+
if (!message) return null;
|
|
135
|
+
return classifyFailoverReason(message);
|
|
136
|
+
}
|
|
137
|
+
function describeFailoverError(err) {
|
|
138
|
+
if (isFailoverError(err)) return {
|
|
139
|
+
message: err.message,
|
|
140
|
+
reason: err.reason,
|
|
141
|
+
status: err.status,
|
|
142
|
+
code: err.code
|
|
143
|
+
};
|
|
144
|
+
return {
|
|
145
|
+
message: getErrorMessage(err) || String(err),
|
|
146
|
+
reason: resolveFailoverReasonFromError(err) ?? void 0,
|
|
147
|
+
status: getStatusCode(err),
|
|
148
|
+
code: getErrorCode(err)
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
function coerceToFailoverError(err, context) {
|
|
152
|
+
if (isFailoverError(err)) return err;
|
|
153
|
+
const reason = resolveFailoverReasonFromError(err);
|
|
154
|
+
if (!reason) return null;
|
|
155
|
+
const message = getErrorMessage(err) || String(err);
|
|
156
|
+
const status = getStatusCode(err) ?? resolveFailoverStatus(reason);
|
|
157
|
+
const code = getErrorCode(err);
|
|
158
|
+
return new FailoverError(message, {
|
|
159
|
+
reason,
|
|
160
|
+
provider: context?.provider,
|
|
161
|
+
model: context?.model,
|
|
162
|
+
profileId: context?.profileId,
|
|
163
|
+
status,
|
|
164
|
+
code,
|
|
165
|
+
cause: err instanceof Error ? err : void 0
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
|
|
42
169
|
//#endregion
|
|
43
170
|
//#region src/agents/cli-backends.ts
|
|
171
|
+
const CLAUDE_MODEL_ALIASES = {
|
|
172
|
+
opus: "opus",
|
|
173
|
+
"opus-4.6": "opus",
|
|
174
|
+
"opus-4.5": "opus",
|
|
175
|
+
"opus-4": "opus",
|
|
176
|
+
"claude-opus-4-6": "opus",
|
|
177
|
+
"claude-opus-4-5": "opus",
|
|
178
|
+
"claude-opus-4": "opus",
|
|
179
|
+
sonnet: "sonnet",
|
|
180
|
+
"sonnet-4.5": "sonnet",
|
|
181
|
+
"sonnet-4.1": "sonnet",
|
|
182
|
+
"sonnet-4.0": "sonnet",
|
|
183
|
+
"claude-sonnet-4-5": "sonnet",
|
|
184
|
+
"claude-sonnet-4-1": "sonnet",
|
|
185
|
+
"claude-sonnet-4-0": "sonnet",
|
|
186
|
+
haiku: "haiku",
|
|
187
|
+
"haiku-3.5": "haiku",
|
|
188
|
+
"claude-haiku-3-5": "haiku"
|
|
189
|
+
};
|
|
190
|
+
const GEMINI_MODEL_ALIASES = {
|
|
191
|
+
gemini: "gemini-2.0-flash",
|
|
192
|
+
"gemini-pro": "gemini-1.5-pro",
|
|
193
|
+
"gemini-flash": "gemini-2.0-flash",
|
|
194
|
+
"gemini-2.0": "gemini-2.0-flash",
|
|
195
|
+
"gemini-2.0-flash": "gemini-2.0-flash",
|
|
196
|
+
"gemini-2.0-pro": "gemini-2.0-pro-exp-02-05",
|
|
197
|
+
"gemini-1.5": "gemini-1.5-pro",
|
|
198
|
+
"gemini-1.5-pro": "gemini-1.5-pro",
|
|
199
|
+
"gemini-1.5-flash": "gemini-1.5-flash",
|
|
200
|
+
"gemini-3": "gemini-3"
|
|
201
|
+
};
|
|
44
202
|
const DEFAULT_CLAUDE_BACKEND = {
|
|
45
203
|
command: "claude",
|
|
46
204
|
args: [
|
|
@@ -60,25 +218,7 @@ const DEFAULT_CLAUDE_BACKEND = {
|
|
|
60
218
|
output: "jsonl",
|
|
61
219
|
input: "arg",
|
|
62
220
|
modelArg: "--model",
|
|
63
|
-
modelAliases:
|
|
64
|
-
opus: "opus",
|
|
65
|
-
"opus-4.6": "opus",
|
|
66
|
-
"opus-4.5": "opus",
|
|
67
|
-
"opus-4": "opus",
|
|
68
|
-
"claude-opus-4-6": "opus",
|
|
69
|
-
"claude-opus-4-5": "opus",
|
|
70
|
-
"claude-opus-4": "opus",
|
|
71
|
-
sonnet: "sonnet",
|
|
72
|
-
"sonnet-4.5": "sonnet",
|
|
73
|
-
"sonnet-4.1": "sonnet",
|
|
74
|
-
"sonnet-4.0": "sonnet",
|
|
75
|
-
"claude-sonnet-4-5": "sonnet",
|
|
76
|
-
"claude-sonnet-4-1": "sonnet",
|
|
77
|
-
"claude-sonnet-4-0": "sonnet",
|
|
78
|
-
haiku: "haiku",
|
|
79
|
-
"haiku-3.5": "haiku",
|
|
80
|
-
"claude-haiku-3-5": "haiku"
|
|
81
|
-
},
|
|
221
|
+
modelAliases: CLAUDE_MODEL_ALIASES,
|
|
82
222
|
sessionArg: "--session-id",
|
|
83
223
|
sessionMode: "always",
|
|
84
224
|
sessionIdFields: [
|
|
@@ -117,6 +257,30 @@ const DEFAULT_CODEX_BACKEND = {
|
|
|
117
257
|
sessionMode: "existing",
|
|
118
258
|
serialize: true
|
|
119
259
|
};
|
|
260
|
+
const DEFAULT_GEMINI_BACKEND = {
|
|
261
|
+
command: "gemini",
|
|
262
|
+
args: [
|
|
263
|
+
"--output-format",
|
|
264
|
+
"json",
|
|
265
|
+
"--approval-mode",
|
|
266
|
+
"yolo"
|
|
267
|
+
],
|
|
268
|
+
resumeArgs: [
|
|
269
|
+
"--output-format",
|
|
270
|
+
"json",
|
|
271
|
+
"--approval-mode",
|
|
272
|
+
"yolo",
|
|
273
|
+
"--resume",
|
|
274
|
+
"{sessionId}"
|
|
275
|
+
],
|
|
276
|
+
output: "json",
|
|
277
|
+
input: "arg",
|
|
278
|
+
modelArg: "--model",
|
|
279
|
+
modelAliases: GEMINI_MODEL_ALIASES,
|
|
280
|
+
sessionMode: "existing",
|
|
281
|
+
clearEnv: ["GEMINI_API_KEY"],
|
|
282
|
+
serialize: true
|
|
283
|
+
};
|
|
120
284
|
const CLAUDE_BACKEND_ALIASES = [
|
|
121
285
|
"claude-cli",
|
|
122
286
|
"anthropic",
|
|
@@ -128,8 +292,14 @@ const CODEX_BACKEND_ALIASES = [
|
|
|
128
292
|
"openai",
|
|
129
293
|
"codex"
|
|
130
294
|
];
|
|
295
|
+
const GEMINI_BACKEND_ALIASES = [
|
|
296
|
+
"gemini-cli",
|
|
297
|
+
"google-gemini-cli",
|
|
298
|
+
"gemini"
|
|
299
|
+
];
|
|
131
300
|
const CLAUDE_BACKEND_ALIAS_SET = new Set(CLAUDE_BACKEND_ALIASES.map((alias) => normalizeBackendKey(alias)));
|
|
132
301
|
const CODEX_BACKEND_ALIAS_SET = new Set(CODEX_BACKEND_ALIASES.map((alias) => normalizeBackendKey(alias)));
|
|
302
|
+
const GEMINI_BACKEND_ALIAS_SET = new Set(GEMINI_BACKEND_ALIASES.map((alias) => normalizeBackendKey(alias)));
|
|
133
303
|
function normalizeBackendKey(key) {
|
|
134
304
|
return normalizeProviderId(key);
|
|
135
305
|
}
|
|
@@ -189,6 +359,18 @@ function resolveCliBackendConfig(provider, cfg) {
|
|
|
189
359
|
}
|
|
190
360
|
};
|
|
191
361
|
}
|
|
362
|
+
if (GEMINI_BACKEND_ALIAS_SET.has(normalized)) {
|
|
363
|
+
const merged = mergeBackendConfig(DEFAULT_GEMINI_BACKEND, pickBackendConfigByAliases(configured, [provider, ...GEMINI_BACKEND_ALIASES]));
|
|
364
|
+
const command = merged.command?.trim();
|
|
365
|
+
if (!command) return null;
|
|
366
|
+
return {
|
|
367
|
+
id: normalizeBackendKey("gemini-cli"),
|
|
368
|
+
config: {
|
|
369
|
+
...merged,
|
|
370
|
+
command
|
|
371
|
+
}
|
|
372
|
+
};
|
|
373
|
+
}
|
|
192
374
|
const override = pickBackendConfig(configured, normalized);
|
|
193
375
|
if (!override) return null;
|
|
194
376
|
const command = override.command?.trim();
|
|
@@ -202,134 +384,9 @@ function resolveCliBackendConfig(provider, cfg) {
|
|
|
202
384
|
};
|
|
203
385
|
}
|
|
204
386
|
|
|
205
|
-
//#endregion
|
|
206
|
-
//#region src/agents/failover-error.ts
|
|
207
|
-
const TIMEOUT_HINT_RE = /timeout|timed out|deadline exceeded|context deadline exceeded/i;
|
|
208
|
-
const ABORT_TIMEOUT_RE = /request was aborted|request aborted/i;
|
|
209
|
-
var FailoverError = class extends Error {
|
|
210
|
-
constructor(message, params) {
|
|
211
|
-
super(message, { cause: params.cause });
|
|
212
|
-
this.name = "FailoverError";
|
|
213
|
-
this.reason = params.reason;
|
|
214
|
-
this.provider = params.provider;
|
|
215
|
-
this.model = params.model;
|
|
216
|
-
this.profileId = params.profileId;
|
|
217
|
-
this.status = params.status;
|
|
218
|
-
this.code = params.code;
|
|
219
|
-
}
|
|
220
|
-
};
|
|
221
|
-
function isFailoverError(err) {
|
|
222
|
-
return err instanceof FailoverError;
|
|
223
|
-
}
|
|
224
|
-
function resolveFailoverStatus(reason) {
|
|
225
|
-
switch (reason) {
|
|
226
|
-
case "billing": return 402;
|
|
227
|
-
case "rate_limit": return 429;
|
|
228
|
-
case "auth": return 401;
|
|
229
|
-
case "timeout": return 408;
|
|
230
|
-
case "format": return 400;
|
|
231
|
-
default: return;
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
function getStatusCode(err) {
|
|
235
|
-
if (!err || typeof err !== "object") return;
|
|
236
|
-
const candidate = err.status ?? err.statusCode;
|
|
237
|
-
if (typeof candidate === "number") return candidate;
|
|
238
|
-
if (typeof candidate === "string" && /^\d+$/.test(candidate)) return Number(candidate);
|
|
239
|
-
}
|
|
240
|
-
function getErrorName(err) {
|
|
241
|
-
if (!err || typeof err !== "object") return "";
|
|
242
|
-
return "name" in err ? String(err.name) : "";
|
|
243
|
-
}
|
|
244
|
-
function getErrorCode(err) {
|
|
245
|
-
if (!err || typeof err !== "object") return;
|
|
246
|
-
const candidate = err.code;
|
|
247
|
-
if (typeof candidate !== "string") return;
|
|
248
|
-
const trimmed = candidate.trim();
|
|
249
|
-
return trimmed ? trimmed : void 0;
|
|
250
|
-
}
|
|
251
|
-
function getErrorMessage(err) {
|
|
252
|
-
if (err instanceof Error) return err.message;
|
|
253
|
-
if (typeof err === "string") return err;
|
|
254
|
-
if (typeof err === "number" || typeof err === "boolean" || typeof err === "bigint") return String(err);
|
|
255
|
-
if (typeof err === "symbol") return err.description ?? "";
|
|
256
|
-
if (err && typeof err === "object") {
|
|
257
|
-
const message = err.message;
|
|
258
|
-
if (typeof message === "string") return message;
|
|
259
|
-
}
|
|
260
|
-
return "";
|
|
261
|
-
}
|
|
262
|
-
function hasTimeoutHint(err) {
|
|
263
|
-
if (!err) return false;
|
|
264
|
-
if (getErrorName(err) === "TimeoutError") return true;
|
|
265
|
-
const message = getErrorMessage(err);
|
|
266
|
-
return Boolean(message && TIMEOUT_HINT_RE.test(message));
|
|
267
|
-
}
|
|
268
|
-
function isTimeoutError(err) {
|
|
269
|
-
if (hasTimeoutHint(err)) return true;
|
|
270
|
-
if (!err || typeof err !== "object") return false;
|
|
271
|
-
if (getErrorName(err) !== "AbortError") return false;
|
|
272
|
-
const message = getErrorMessage(err);
|
|
273
|
-
if (message && ABORT_TIMEOUT_RE.test(message)) return true;
|
|
274
|
-
const cause = "cause" in err ? err.cause : void 0;
|
|
275
|
-
const reason = "reason" in err ? err.reason : void 0;
|
|
276
|
-
return hasTimeoutHint(cause) || hasTimeoutHint(reason);
|
|
277
|
-
}
|
|
278
|
-
function resolveFailoverReasonFromError(err) {
|
|
279
|
-
if (isFailoverError(err)) return err.reason;
|
|
280
|
-
const status = getStatusCode(err);
|
|
281
|
-
if (status === 402) return "billing";
|
|
282
|
-
if (status === 429) return "rate_limit";
|
|
283
|
-
if (status === 401 || status === 403) return "auth";
|
|
284
|
-
if (status === 408) return "timeout";
|
|
285
|
-
if (status === 400) return "format";
|
|
286
|
-
const code = (getErrorCode(err) ?? "").toUpperCase();
|
|
287
|
-
if ([
|
|
288
|
-
"ETIMEDOUT",
|
|
289
|
-
"ESOCKETTIMEDOUT",
|
|
290
|
-
"ECONNRESET",
|
|
291
|
-
"ECONNABORTED"
|
|
292
|
-
].includes(code)) return "timeout";
|
|
293
|
-
if (isTimeoutError(err)) return "timeout";
|
|
294
|
-
const message = getErrorMessage(err);
|
|
295
|
-
if (!message) return null;
|
|
296
|
-
return classifyFailoverReason(message);
|
|
297
|
-
}
|
|
298
|
-
function describeFailoverError(err) {
|
|
299
|
-
if (isFailoverError(err)) return {
|
|
300
|
-
message: err.message,
|
|
301
|
-
reason: err.reason,
|
|
302
|
-
status: err.status,
|
|
303
|
-
code: err.code
|
|
304
|
-
};
|
|
305
|
-
return {
|
|
306
|
-
message: getErrorMessage(err) || String(err),
|
|
307
|
-
reason: resolveFailoverReasonFromError(err) ?? void 0,
|
|
308
|
-
status: getStatusCode(err),
|
|
309
|
-
code: getErrorCode(err)
|
|
310
|
-
};
|
|
311
|
-
}
|
|
312
|
-
function coerceToFailoverError(err, context) {
|
|
313
|
-
if (isFailoverError(err)) return err;
|
|
314
|
-
const reason = resolveFailoverReasonFromError(err);
|
|
315
|
-
if (!reason) return null;
|
|
316
|
-
const message = getErrorMessage(err) || String(err);
|
|
317
|
-
const status = getStatusCode(err) ?? resolveFailoverStatus(reason);
|
|
318
|
-
const code = getErrorCode(err);
|
|
319
|
-
return new FailoverError(message, {
|
|
320
|
-
reason,
|
|
321
|
-
provider: context?.provider,
|
|
322
|
-
model: context?.model,
|
|
323
|
-
profileId: context?.profileId,
|
|
324
|
-
status,
|
|
325
|
-
code,
|
|
326
|
-
cause: err instanceof Error ? err : void 0
|
|
327
|
-
});
|
|
328
|
-
}
|
|
329
|
-
|
|
330
387
|
//#endregion
|
|
331
388
|
//#region src/agents/cli-runner.ts
|
|
332
|
-
const log = createSubsystemLogger("agent/claude-cli");
|
|
389
|
+
const log$1 = createSubsystemLogger("agent/claude-cli");
|
|
333
390
|
async function runCliAgent(params) {
|
|
334
391
|
const started = Date.now();
|
|
335
392
|
const workspaceResolution = resolveRunWorkspaceDir({
|
|
@@ -342,7 +399,7 @@ async function runCliAgent(params) {
|
|
|
342
399
|
const redactedSessionId = redactRunIdentifier(params.sessionId);
|
|
343
400
|
const redactedSessionKey = redactRunIdentifier(params.sessionKey);
|
|
344
401
|
const redactedWorkspace = redactRunIdentifier(resolvedWorkspace);
|
|
345
|
-
if (workspaceResolution.usedFallback) log.warn(`[workspace-fallback] caller=runCliAgent reason=${workspaceResolution.fallbackReason} run=${params.runId} session=${redactedSessionId} sessionKey=${redactedSessionKey} agent=${workspaceResolution.agentId} workspace=${redactedWorkspace}`);
|
|
402
|
+
if (workspaceResolution.usedFallback) log$1.warn(`[workspace-fallback] caller=runCliAgent reason=${workspaceResolution.fallbackReason} run=${params.runId} session=${redactedSessionId} sessionKey=${redactedSessionKey} agent=${workspaceResolution.agentId} workspace=${redactedWorkspace}`);
|
|
346
403
|
const workspaceDir = resolvedWorkspace;
|
|
347
404
|
const backendResolved = resolveCliBackendConfig(params.provider, params.config);
|
|
348
405
|
if (!backendResolved) throw new Error(`Unknown CLI backend: ${params.provider}`);
|
|
@@ -359,7 +416,7 @@ async function runCliAgent(params) {
|
|
|
359
416
|
sessionId: params.sessionId,
|
|
360
417
|
warn: makeBootstrapWarn({
|
|
361
418
|
sessionLabel,
|
|
362
|
-
warn: (message) => log.warn(message)
|
|
419
|
+
warn: (message) => log$1.warn(message)
|
|
363
420
|
})
|
|
364
421
|
});
|
|
365
422
|
const { defaultAgentId, sessionAgentId } = resolveSessionAgentIds({
|
|
@@ -432,7 +489,7 @@ async function runCliAgent(params) {
|
|
|
432
489
|
const queueKey = backend.serialize ?? true ? backendResolved.id : `${backendResolved.id}:${params.runId}`;
|
|
433
490
|
try {
|
|
434
491
|
const output = await enqueueCliRun(queueKey, async () => {
|
|
435
|
-
log.info(`cli exec: provider=${params.provider} model=${normalizedModel} promptChars=${params.prompt.length}`);
|
|
492
|
+
log$1.info(`cli exec: provider=${params.provider} model=${normalizedModel} promptChars=${params.prompt.length}`);
|
|
436
493
|
const logOutputText = isTruthyEnvValue(process.env.ANIMA_CLAUDE_CLI_LOG_OUTPUT);
|
|
437
494
|
if (logOutputText) {
|
|
438
495
|
const logArgs = [];
|
|
@@ -465,7 +522,7 @@ async function runCliAgent(params) {
|
|
|
465
522
|
const promptIndex = logArgs.indexOf(argsPrompt);
|
|
466
523
|
if (promptIndex >= 0) logArgs[promptIndex] = `<prompt:${argsPrompt.length} chars>`;
|
|
467
524
|
}
|
|
468
|
-
log.info(`cli argv: ${backend.command} ${logArgs.join(" ")}`);
|
|
525
|
+
log$1.info(`cli argv: ${backend.command} ${logArgs.join(" ")}`);
|
|
469
526
|
}
|
|
470
527
|
const env = (() => {
|
|
471
528
|
const next = {
|
|
@@ -498,12 +555,12 @@ async function runCliAgent(params) {
|
|
|
498
555
|
const stdout = result.stdout.trim();
|
|
499
556
|
const stderr = result.stderr.trim();
|
|
500
557
|
if (logOutputText) {
|
|
501
|
-
if (stdout) log.info(`cli stdout:\n${stdout}`);
|
|
502
|
-
if (stderr) log.info(`cli stderr:\n${stderr}`);
|
|
558
|
+
if (stdout) log$1.info(`cli stdout:\n${stdout}`);
|
|
559
|
+
if (stderr) log$1.info(`cli stderr:\n${stderr}`);
|
|
503
560
|
}
|
|
504
561
|
if (shouldLogVerbose()) {
|
|
505
|
-
if (stdout) log.debug(`cli stdout:\n${stdout}`);
|
|
506
|
-
if (stderr) log.debug(`cli stderr:\n${stderr}`);
|
|
562
|
+
if (stdout) log$1.debug(`cli stdout:\n${stdout}`);
|
|
563
|
+
if (stderr) log$1.debug(`cli stderr:\n${stderr}`);
|
|
507
564
|
}
|
|
508
565
|
if (result.code !== 0) {
|
|
509
566
|
const err = stderr || stdout || "CLI failed.";
|
|
@@ -556,6 +613,215 @@ async function runCliAgent(params) {
|
|
|
556
613
|
}
|
|
557
614
|
}
|
|
558
615
|
|
|
616
|
+
//#endregion
|
|
617
|
+
//#region src/agents/gemini-direct-runner.ts
|
|
618
|
+
/**
|
|
619
|
+
* Gemini Direct API Runner
|
|
620
|
+
*
|
|
621
|
+
* Makes calls directly to generativelanguage.googleapis.com without needing
|
|
622
|
+
* a CLI wrapper. Works with Google API keys (GEMINI_API_KEY).
|
|
623
|
+
*
|
|
624
|
+
* This runner is automatically used when a google API key is available
|
|
625
|
+
* and the provider is set to "google" or "gemini".
|
|
626
|
+
*/
|
|
627
|
+
const log = createSubsystemLogger("agent/gemini-direct");
|
|
628
|
+
const DEFAULT_GEMINI_BASE_URL = "https://generativelanguage.googleapis.com/v1beta";
|
|
629
|
+
const MODEL_MAP = {
|
|
630
|
+
gemini: "gemini-2.0-flash",
|
|
631
|
+
"gemini-pro": "gemini-1.5-pro",
|
|
632
|
+
"gemini-flash": "gemini-2.0-flash",
|
|
633
|
+
"gemini-2.0": "gemini-2.0-flash",
|
|
634
|
+
"gemini-2.0-flash": "gemini-2.0-flash",
|
|
635
|
+
"gemini-2.0-pro": "gemini-2.0-pro-exp-02-05",
|
|
636
|
+
"gemini-1.5": "gemini-1.5-pro",
|
|
637
|
+
"gemini-1.5-pro": "gemini-1.5-pro",
|
|
638
|
+
"gemini-1.5-flash": "gemini-1.5-flash",
|
|
639
|
+
default: "gemini-2.0-flash"
|
|
640
|
+
};
|
|
641
|
+
const HISTORY_FILE_SUFFIX = ".gemini-history.json";
|
|
642
|
+
async function loadSessionHistory(sessionFile) {
|
|
643
|
+
const histPath = sessionFile + HISTORY_FILE_SUFFIX;
|
|
644
|
+
try {
|
|
645
|
+
const raw = await fs$1.readFile(histPath, "utf8");
|
|
646
|
+
return JSON.parse(raw);
|
|
647
|
+
} catch {
|
|
648
|
+
return null;
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
async function saveSessionHistory(sessionFile, history) {
|
|
652
|
+
const histPath = sessionFile + HISTORY_FILE_SUFFIX;
|
|
653
|
+
try {
|
|
654
|
+
await fs$1.mkdir(path.dirname(histPath), { recursive: true });
|
|
655
|
+
await fs$1.writeFile(histPath, JSON.stringify(history, null, 2), "utf8");
|
|
656
|
+
} catch (err) {
|
|
657
|
+
log.warn("failed to save session history", { error: String(err) });
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
function resolveModel(model) {
|
|
661
|
+
const key = (model ?? "default").trim().toLowerCase() || "default";
|
|
662
|
+
return MODEL_MAP[key] ?? key;
|
|
663
|
+
}
|
|
664
|
+
function buildModelPath(model) {
|
|
665
|
+
return model.startsWith("models/") ? model : `models/${model}`;
|
|
666
|
+
}
|
|
667
|
+
/**
|
|
668
|
+
* Run an agent turn directly against generativelanguage.googleapis.com.
|
|
669
|
+
*
|
|
670
|
+
* Maintains multi-turn conversation history per session file.
|
|
671
|
+
* Falls back to single-turn if history is unavailable.
|
|
672
|
+
*/
|
|
673
|
+
async function runGeminiDirectAgent(params) {
|
|
674
|
+
const started = Date.now();
|
|
675
|
+
const resolvedModel = resolveModel(params.model);
|
|
676
|
+
const modelPath = buildModelPath(resolvedModel);
|
|
677
|
+
log.info(`direct api exec: model=${resolvedModel} promptChars=${params.prompt.length}`);
|
|
678
|
+
const workspaceDir = resolveRunWorkspaceDir({
|
|
679
|
+
workspaceDir: params.workspaceDir,
|
|
680
|
+
sessionKey: params.sessionKey,
|
|
681
|
+
agentId: params.agentId,
|
|
682
|
+
config: params.config
|
|
683
|
+
}).workspaceDir;
|
|
684
|
+
const { contextFiles } = await resolveBootstrapContextForRun({
|
|
685
|
+
workspaceDir,
|
|
686
|
+
config: params.config,
|
|
687
|
+
sessionKey: params.sessionKey,
|
|
688
|
+
sessionId: params.sessionId,
|
|
689
|
+
warn: makeBootstrapWarn({
|
|
690
|
+
sessionLabel: params.sessionKey ?? params.sessionId,
|
|
691
|
+
warn: (msg) => log.warn(msg)
|
|
692
|
+
})
|
|
693
|
+
});
|
|
694
|
+
const { defaultAgentId, sessionAgentId } = resolveSessionAgentIds({
|
|
695
|
+
sessionKey: params.sessionKey,
|
|
696
|
+
config: params.config
|
|
697
|
+
});
|
|
698
|
+
const heartbeatPrompt = sessionAgentId === defaultAgentId ? resolveHeartbeatPrompt(params.config?.agents?.defaults?.heartbeat?.prompt) : void 0;
|
|
699
|
+
const docsPath = await resolveAnimaDocsPath({
|
|
700
|
+
workspaceDir,
|
|
701
|
+
argv1: process.argv[1],
|
|
702
|
+
cwd: process.cwd(),
|
|
703
|
+
moduleUrl: import.meta.url
|
|
704
|
+
});
|
|
705
|
+
const extraSystemPrompt = [params.extraSystemPrompt?.trim(), "Tools are disabled in this session. Do not call tools."].filter(Boolean).join("\n");
|
|
706
|
+
const systemPrompt = buildSystemPrompt({
|
|
707
|
+
workspaceDir,
|
|
708
|
+
config: params.config,
|
|
709
|
+
defaultThinkLevel: params.thinkLevel,
|
|
710
|
+
extraSystemPrompt,
|
|
711
|
+
ownerNumbers: params.ownerNumbers,
|
|
712
|
+
heartbeatPrompt,
|
|
713
|
+
docsPath: docsPath ?? void 0,
|
|
714
|
+
tools: [],
|
|
715
|
+
contextFiles,
|
|
716
|
+
modelDisplay: `google/${resolvedModel}`,
|
|
717
|
+
agentId: sessionAgentId
|
|
718
|
+
});
|
|
719
|
+
let history = await loadSessionHistory(params.sessionFile);
|
|
720
|
+
if (!history) history = {
|
|
721
|
+
sessionId: params.sessionId,
|
|
722
|
+
contents: [],
|
|
723
|
+
createdAt: started,
|
|
724
|
+
updatedAt: started
|
|
725
|
+
};
|
|
726
|
+
history.contents.push({
|
|
727
|
+
role: "user",
|
|
728
|
+
parts: [{ text: params.prompt }]
|
|
729
|
+
});
|
|
730
|
+
const requestBody = {
|
|
731
|
+
systemInstruction: { parts: [{ text: systemPrompt }] },
|
|
732
|
+
contents: history.contents,
|
|
733
|
+
generationConfig: {
|
|
734
|
+
maxOutputTokens: 8192,
|
|
735
|
+
temperature: 1
|
|
736
|
+
}
|
|
737
|
+
};
|
|
738
|
+
try {
|
|
739
|
+
const controller = new AbortController();
|
|
740
|
+
const timeoutHandle = setTimeout(() => controller.abort(), params.timeoutMs);
|
|
741
|
+
const url = `${DEFAULT_GEMINI_BASE_URL}/${modelPath}:generateContent?key=${params.apiKey}`;
|
|
742
|
+
const response = await fetch(url, {
|
|
743
|
+
method: "POST",
|
|
744
|
+
headers: {
|
|
745
|
+
"Content-Type": "application/json",
|
|
746
|
+
"User-Agent": `anima/5.0.1 (gemini-direct-runner; ${os.platform()})`
|
|
747
|
+
},
|
|
748
|
+
body: JSON.stringify(requestBody),
|
|
749
|
+
signal: controller.signal
|
|
750
|
+
});
|
|
751
|
+
clearTimeout(timeoutHandle);
|
|
752
|
+
if (!response.ok) {
|
|
753
|
+
const body = await response.text().catch(() => "");
|
|
754
|
+
const isAuth = response.status === 401 || response.status === 403;
|
|
755
|
+
const isRateLimit = response.status === 429;
|
|
756
|
+
const rateHint = isRateLimit ? " — rate limit hit, will retry next heartbeat." : "";
|
|
757
|
+
const authHint = isAuth ? " — API key may be invalid. Check GEMINI_API_KEY environment variable." : "";
|
|
758
|
+
log.error(`gemini api error: HTTP ${response.status}${authHint}${rateHint}`, {
|
|
759
|
+
status: response.status,
|
|
760
|
+
body: body.slice(0, 500)
|
|
761
|
+
});
|
|
762
|
+
return {
|
|
763
|
+
status: "failed",
|
|
764
|
+
meta: {
|
|
765
|
+
durationMs: Date.now() - started,
|
|
766
|
+
error: {
|
|
767
|
+
message: `HTTP ${response.status}: ${body.slice(0, 200)}${authHint}${rateHint}`,
|
|
768
|
+
kind: isAuth ? "auth" : isRateLimit ? "rate_limit" : "unknown"
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
};
|
|
772
|
+
}
|
|
773
|
+
const data = await response.json();
|
|
774
|
+
const candidate = data.candidates?.[0];
|
|
775
|
+
const assistantText = (candidate?.content?.parts ?? []).filter((p) => typeof p.text === "string").map((p) => p.text).join("\n");
|
|
776
|
+
if (assistantText && params.onPartialReply) await params.onPartialReply({ text: assistantText });
|
|
777
|
+
if (assistantText) {
|
|
778
|
+
history.contents.push({
|
|
779
|
+
role: "model",
|
|
780
|
+
parts: [{ text: assistantText }]
|
|
781
|
+
});
|
|
782
|
+
history.updatedAt = Date.now();
|
|
783
|
+
await saveSessionHistory(params.sessionFile, history);
|
|
784
|
+
}
|
|
785
|
+
const usage = data.usageMetadata;
|
|
786
|
+
const durationMs = Date.now() - started;
|
|
787
|
+
log.info(`gemini api complete: ${durationMs}ms`, {
|
|
788
|
+
inputTokens: usage?.promptTokenCount,
|
|
789
|
+
outputTokens: usage?.candidatesTokenCount,
|
|
790
|
+
finishReason: candidate?.finishReason
|
|
791
|
+
});
|
|
792
|
+
return {
|
|
793
|
+
status: "completed",
|
|
794
|
+
output: assistantText,
|
|
795
|
+
meta: {
|
|
796
|
+
durationMs,
|
|
797
|
+
agentMeta: {
|
|
798
|
+
model: resolvedModel,
|
|
799
|
+
provider: "google",
|
|
800
|
+
usage: usage ? {
|
|
801
|
+
input: usage.promptTokenCount ?? 0,
|
|
802
|
+
output: usage.candidatesTokenCount ?? 0
|
|
803
|
+
} : void 0
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
};
|
|
807
|
+
} catch (err) {
|
|
808
|
+
const isAbort = err instanceof Error && err.name === "AbortError";
|
|
809
|
+
const errorKind = isAbort ? "timeout" : "unknown";
|
|
810
|
+
const errorMsg = isAbort ? `Request timed out after ${params.timeoutMs}ms` : String(err);
|
|
811
|
+
log.error(`gemini api error: ${errorMsg}`, { error: String(err) });
|
|
812
|
+
return {
|
|
813
|
+
status: "failed",
|
|
814
|
+
meta: {
|
|
815
|
+
durationMs: Date.now() - started,
|
|
816
|
+
error: {
|
|
817
|
+
message: errorMsg,
|
|
818
|
+
kind: errorKind
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
};
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
|
|
559
825
|
//#endregion
|
|
560
826
|
//#region src/agents/pi-embedded.ts
|
|
561
827
|
function normalizeEmbeddedProvider(provider) {
|
|
@@ -637,6 +903,57 @@ async function runEmbeddedPiAgent(...args) {
|
|
|
637
903
|
}
|
|
638
904
|
}
|
|
639
905
|
}
|
|
906
|
+
if (provider === "google" || provider === "gemini") {
|
|
907
|
+
const geminiApiKey = (await resolveApiKeyForProvider({
|
|
908
|
+
provider: "google",
|
|
909
|
+
cfg: params.config
|
|
910
|
+
}))?.apiKey;
|
|
911
|
+
if (geminiApiKey) {
|
|
912
|
+
await emitAgentEvent$1(params, "lifecycle", {
|
|
913
|
+
phase: "start",
|
|
914
|
+
startedAt
|
|
915
|
+
});
|
|
916
|
+
try {
|
|
917
|
+
const result = await runGeminiDirectAgent({
|
|
918
|
+
apiKey: geminiApiKey,
|
|
919
|
+
sessionId: params.sessionId,
|
|
920
|
+
sessionKey: params.sessionKey,
|
|
921
|
+
agentId: params.agentId,
|
|
922
|
+
sessionFile: params.sessionFile,
|
|
923
|
+
workspaceDir: params.workspaceDir,
|
|
924
|
+
config: params.config,
|
|
925
|
+
prompt: params.prompt,
|
|
926
|
+
model: params.model,
|
|
927
|
+
thinkLevel: params.thinkLevel,
|
|
928
|
+
timeoutMs,
|
|
929
|
+
runId,
|
|
930
|
+
extraSystemPrompt: params.extraSystemPrompt,
|
|
931
|
+
ownerNumbers: params.ownerNumbers,
|
|
932
|
+
onPartialReply: async (payload) => {
|
|
933
|
+
if (!assistantStarted) {
|
|
934
|
+
assistantStarted = true;
|
|
935
|
+
await params.onAssistantMessageStart?.();
|
|
936
|
+
}
|
|
937
|
+
await params.onPartialReply?.(payload);
|
|
938
|
+
await emitAgentEvent$1(params, "assistant", { text: payload.text });
|
|
939
|
+
},
|
|
940
|
+
onAssistantMessageStart: params.onAssistantMessageStart
|
|
941
|
+
});
|
|
942
|
+
await emitAgentEvent$1(params, "lifecycle", {
|
|
943
|
+
phase: "end",
|
|
944
|
+
durationMs: Date.now() - startedAt,
|
|
945
|
+
status: result.status
|
|
946
|
+
});
|
|
947
|
+
return result;
|
|
948
|
+
} catch (err) {
|
|
949
|
+
await emitAgentEvent$1(params, "lifecycle", {
|
|
950
|
+
phase: "error",
|
|
951
|
+
error: String(err instanceof Error ? err.message : err)
|
|
952
|
+
});
|
|
953
|
+
throw err;
|
|
954
|
+
}
|
|
955
|
+
}
|
|
956
|
+
}
|
|
640
957
|
const cliProvider = resolveCompatCliProvider(provider, params.config);
|
|
641
958
|
if (!resolveCliBackendConfig(cliProvider, params.config)) throw new Error(`No CLI backend available for provider "${provider}" (resolved "${cliProvider}").\nEither:\n • Run: anima setup-token (set an Anthropic API key — no CLI needed)\n • Install the matching CLI and log in`);
|
|
642
959
|
await emitAgentEvent$1(params, "lifecycle", {
|