gerege-cli 0.26.7 → 0.26.8
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/bundled/gerege-video/SKILL.md +22 -0
- package/bundled/gerege-video/scripts/video.js +137 -0
- package/chunks/{MaxSizedBox-LSNOJEKM.js → MaxSizedBox-LUINLOQW.js} +1 -1
- package/chunks/{StandaloneSessionPicker-KSYGPMEV.js → StandaloneSessionPicker-B7N4QO5D.js} +1 -1
- package/chunks/{acp-subagent-executor-NSW2MFUI.js → acp-subagent-executor-J6H6FKUT.js} +1 -1
- package/chunks/{acpAgent-3DTOHTDM.js → acpAgent-XG6SM2VU.js} +3 -3
- package/chunks/{advisor-7JGQPS7X.js → advisor-SZVPQNPA.js} +1 -1
- package/chunks/{agent-PNKQJGDO.js → agent-N7QF7BJS.js} +1 -1
- package/chunks/{agent-headless-7D33X7QQ.js → agent-headless-GLP5GUEX.js} +1 -1
- package/chunks/{agent-host-client-3R2MAUVE.js → agent-host-client-H4VOB3M6.js} +1 -1
- package/chunks/{agent-host-connections-2D7DECAE.js → agent-host-connections-E4C3OC4M.js} +1 -1
- package/chunks/{anthropicContentGenerator-MGTJJGEQ.js → anthropicContentGenerator-5VTWQLT5.js} +1 -1
- package/chunks/{autofix-pr-OIHHZSPQ.js → autofix-pr-HDYQDJS4.js} +1 -1
- package/chunks/{batch-6UDAMPAA.js → batch-3CRVN5VJ.js} +1 -1
- package/chunks/{bridge-QXVXPNJ6.js → bridge-NZ6WVBLQ.js} +1 -1
- package/chunks/{channel-settings-store-P4W4R5SJ.js → channel-settings-store-Z7I2JI6M.js} +1 -1
- package/chunks/{chunk-HVP4UF2Q.js → chunk-236DHGNH.js} +1 -1
- package/chunks/{chunk-GA35LMSX.js → chunk-2M3ND5WN.js} +1 -1
- package/chunks/{chunk-IZXHCHJD.js → chunk-36A6EXHB.js} +1 -1
- package/chunks/{chunk-QHYSRPQR.js → chunk-3ANIQTDT.js} +1 -1
- package/chunks/{chunk-WK666FGZ.js → chunk-3QTR2HAE.js} +3 -3
- package/chunks/{chunk-3EZ5GCUT.js → chunk-3TTHYXT3.js} +1 -1
- package/chunks/{chunk-YWK3E4WJ.js → chunk-4CE4GMDL.js} +1 -1
- package/chunks/{chunk-VUNHJ74J.js → chunk-4FVT657Y.js} +1 -1
- package/chunks/{chunk-BY46PCWY.js → chunk-4HSISRRA.js} +1 -1
- package/chunks/{chunk-2LMSDH6P.js → chunk-4SZUJ5RT.js} +1 -1
- package/chunks/{chunk-53IB4U4E.js → chunk-57D2OB3I.js} +1 -1
- package/chunks/{chunk-QTKPC24L.js → chunk-5FGBLIXB.js} +1 -1
- package/chunks/{chunk-5TWAP4OG.js → chunk-5HX2QGVR.js} +1 -1
- package/chunks/{chunk-K7GN4CMV.js → chunk-5ZNXAWOG.js} +6 -6
- package/chunks/{chunk-QTVSPQZQ.js → chunk-6CKX56LJ.js} +1 -1
- package/chunks/{chunk-4W27Z3OL.js → chunk-6NIQFWXP.js} +1 -1
- package/chunks/{chunk-6YFNUVJR.js → chunk-6PC6MZHL.js} +1 -1
- package/chunks/{chunk-DQQN2HOP.js → chunk-6VQKGKMJ.js} +1 -1
- package/chunks/{chunk-MXZXQUVP.js → chunk-6ZEMLEK2.js} +1 -1
- package/chunks/{chunk-RT6J7PV4.js → chunk-72VY2PJA.js} +1 -1
- package/chunks/{chunk-EEPNACXJ.js → chunk-75I3NYBD.js} +1 -1
- package/chunks/{chunk-ATTJQLQV.js → chunk-76L7ZDEK.js} +1 -1
- package/chunks/{chunk-T3CQ72HC.js → chunk-7XQ5D34E.js} +6 -6
- package/chunks/{chunk-4AKTP4MM.js → chunk-AYX75VXG.js} +1 -1
- package/chunks/{chunk-MDCA4I63.js → chunk-BBDFEMCF.js} +1 -1
- package/chunks/{chunk-N4ZQC5HB.js → chunk-BOTX7S66.js} +1 -1
- package/chunks/{chunk-UVMLWDRU.js → chunk-CY2QKKZA.js} +1 -1
- package/chunks/{chunk-W2CV36HT.js → chunk-D5JWQUID.js} +1 -1
- package/chunks/{chunk-WEPC42YR.js → chunk-DMIPB7RZ.js} +1 -1
- package/chunks/{chunk-BVV7UXES.js → chunk-DSKA3P2C.js} +1 -1
- package/chunks/{chunk-SAVYMUU3.js → chunk-DVC65H4X.js} +1 -1
- package/chunks/{chunk-MS2XCBPP.js → chunk-DVJSDCMX.js} +1 -1
- package/chunks/{chunk-4QOVM2LL.js → chunk-E6CPFQX2.js} +1 -1
- package/chunks/{chunk-LYFRGP42.js → chunk-EIFBGEXJ.js} +1 -1
- package/chunks/{chunk-3ICJI5KW.js → chunk-EQOHDAYU.js} +1 -1
- package/chunks/{chunk-Q5RRVBTY.js → chunk-EZPM4DLR.js} +1 -1
- package/chunks/{chunk-ISQMHOCC.js → chunk-F6U6T7QD.js} +1 -1
- package/chunks/{chunk-WCI33URB.js → chunk-FCGFBUHS.js} +1 -1
- package/chunks/{chunk-CK3OKTTL.js → chunk-G2LTZU67.js} +1 -1
- package/chunks/{chunk-WSI4G7XC.js → chunk-GMJSEK4V.js} +1 -1
- package/chunks/{chunk-QONPET6Y.js → chunk-HJMUBVXZ.js} +2 -2
- package/chunks/{chunk-H5EXNXGW.js → chunk-HQZTAA2U.js} +1 -1
- package/chunks/{chunk-5R2JIZID.js → chunk-I63TIQOI.js} +1 -1
- package/chunks/{chunk-IY7M5HKF.js → chunk-I65LBJN7.js} +1 -1
- package/chunks/{chunk-H34KVVI4.js → chunk-IBDOC27R.js} +1 -1
- package/chunks/{chunk-N6EFYQ7M.js → chunk-IKF2HWEV.js} +1 -1
- package/chunks/{chunk-CDKBM72V.js → chunk-K6NS2HXT.js} +1 -1
- package/chunks/{chunk-BIPPD7W6.js → chunk-KTRNYPQP.js} +1 -1
- package/chunks/{chunk-DTX2OVQW.js → chunk-L3ANU5JZ.js} +1 -1
- package/chunks/{chunk-WXK7Z45R.js → chunk-LKPMADUO.js} +1 -1
- package/chunks/{chunk-4VR4DUUD.js → chunk-M56Y2B6N.js} +1 -1
- package/chunks/{chunk-YY4GWNTU.js → chunk-N5KRBAK5.js} +2 -2
- package/chunks/{chunk-DVUKYOCJ.js → chunk-NA2WJPOU.js} +1 -1
- package/chunks/{chunk-O3TUZQP4.js → chunk-NGOWLXYK.js} +1 -1
- package/chunks/{chunk-F7622ZRQ.js → chunk-NL7P73ZP.js} +1 -1
- package/chunks/{chunk-U5YOAOU3.js → chunk-NS3QR7D3.js} +1 -1
- package/chunks/{chunk-FTF2NFLB.js → chunk-O5JCCBMQ.js} +1 -1
- package/chunks/{chunk-DEJ47KJE.js → chunk-OOKFFZHF.js} +1 -1
- package/chunks/{chunk-4A663FE6.js → chunk-OTYPLLMT.js} +5 -5
- package/chunks/{chunk-NPAENNRO.js → chunk-P7NHWX27.js} +1 -1
- package/chunks/{chunk-HXTYFGSQ.js → chunk-PC5QZUKR.js} +1 -1
- package/chunks/{chunk-RULGA7WE.js → chunk-PS7MQL57.js} +2 -2
- package/chunks/{chunk-FKUDVIME.js → chunk-PXWHOFAA.js} +1 -1
- package/chunks/{chunk-6WV5RKYB.js → chunk-Q65LVCDR.js} +1 -1
- package/chunks/{chunk-ULLW2AYD.js → chunk-QDUDLELH.js} +1 -1
- package/chunks/{chunk-PMBI46K4.js → chunk-QF22ILPV.js} +1 -1
- package/chunks/{chunk-LY4XTBL4.js → chunk-QW7MAG2E.js} +1 -1
- package/chunks/{chunk-IIHUDJX7.js → chunk-RXK6XD6F.js} +1 -1
- package/chunks/{chunk-QSPXKBUX.js → chunk-SVDFCWS7.js} +1 -1
- package/chunks/{chunk-NHPKD7LY.js → chunk-TKP3GAUI.js} +1 -1
- package/chunks/{chunk-WF7Q3ZSQ.js → chunk-TUS74LFI.js} +1 -1
- package/chunks/{chunk-OZFZBGZG.js → chunk-U7YGHPSL.js} +1 -1
- package/chunks/{chunk-G4MWPXNY.js → chunk-UB37RBSK.js} +1 -1
- package/chunks/{chunk-4LC4INFI.js → chunk-UK5SIRH4.js} +1 -1
- package/chunks/{chunk-7HFFTOAD.js → chunk-UTTSBCFR.js} +1 -1
- package/chunks/{chunk-IQMKQKKD.js → chunk-UYV4ZVXY.js} +2 -2
- package/chunks/{chunk-E3KWSRJN.js → chunk-VC3JJL7E.js} +1 -1
- package/chunks/{chunk-FRVXSKL4.js → chunk-VKWVIWLK.js} +1 -1
- package/chunks/{chunk-L7LO3YRT.js → chunk-VUI6STKU.js} +1 -1
- package/chunks/{chunk-VK7LOUOJ.js → chunk-W3YXE55M.js} +1 -1
- package/chunks/{chunk-JHC22BZH.js → chunk-WAIPC47V.js} +1 -1
- package/chunks/{chunk-P2MZZMCS.js → chunk-WMJ6UHDP.js} +1 -1
- package/chunks/{chunk-6JAXAFX7.js → chunk-WZU2ECUD.js} +1 -1
- package/chunks/{chunk-HJLRKM3W.js → chunk-XAGIZY2Y.js} +1 -1
- package/chunks/{chunk-2J2BQ3PL.js → chunk-XGZYVULJ.js} +2 -2
- package/chunks/{chunk-QVHDM6N7.js → chunk-XJIHDVPX.js} +1 -1
- package/chunks/{chunk-ZFOEVHWG.js → chunk-XVDIHFRH.js} +1 -1
- package/chunks/{chunk-F5SLLEJY.js → chunk-YMEW4TTT.js} +1 -1
- package/chunks/{chunk-NYBYDW6R.js → chunk-Z32URWBG.js} +1 -1
- package/chunks/{chunk-WMLYHZZX.js → chunk-Z6HRXHJP.js} +1 -1
- package/chunks/{chunk-UM5KBBYP.js → chunk-ZO4F6ZWR.js} +1 -1
- package/chunks/{codex-subagent-executor-GPTKVP7H.js → codex-subagent-executor-DDKYNU42.js} +1 -1
- package/chunks/{config-utils-6B5FHBSF.js → config-utils-S7Z2ZZ2E.js} +1 -1
- package/chunks/{contextCommand-FGRDE3GA.js → contextCommand-7F4PGV2A.js} +1 -1
- package/chunks/{core-runtime-OFEHSKDB.js → core-runtime-LBH3U7ZF.js} +1 -1
- package/chunks/{create-sub-session-D2KEWVHQ.js → create-sub-session-56DS2T6L.js} +1 -1
- package/chunks/{cron-create-RFGGKTL7.js → cron-create-PBP3C46Q.js} +1 -1
- package/chunks/{daemon-git-worktree-guard-AV752IOZ.js → daemon-git-worktree-guard-WJS6FBDA.js} +1 -1
- package/chunks/{daemon-status-provider-GHQBRDMC.js → daemon-status-provider-UPPAEHJ6.js} +1 -1
- package/chunks/{daemon-trust-policy-24ENJNTQ.js → daemon-trust-policy-4Z5HSNUX.js} +1 -1
- package/chunks/{daemon-trust-policy-monitor-NMSQAGWV.js → daemon-trust-policy-monitor-WFWDOYX3.js} +1 -1
- package/chunks/{deferred-core-runtime-5BAMFFOI.js → deferred-core-runtime-MJYNEA4N.js} +1 -1
- package/chunks/{edit-XCECLEH3.js → edit-U7TGKKK3.js} +1 -1
- package/chunks/{enterPlanMode-SEN2PMRM.js → enterPlanMode-27HC5AXN.js} +1 -1
- package/chunks/{environment-CCPQJYKS.js → environment-PHWY6C4P.js} +1 -1
- package/chunks/{errors-Y6HHUTGK.js → errors-F2EYYFI3.js} +1 -1
- package/chunks/{execution-tool-HADWGMIG.js → execution-tool-O4KJ5SMM.js} +1 -1
- package/chunks/{execution-worker-GZS7WOQL.js → execution-worker-AMFXZ7JD.js} +1 -1
- package/chunks/{exitPlanMode-76B5HDLT.js → exitPlanMode-LDYL43PB.js} +1 -1
- package/chunks/{fast-path-OEV7LQYV.js → fast-path-HTODEVOR.js} +1 -1
- package/chunks/{glob-NLWCQRMS.js → glob-NKQJJZND.js} +1 -1
- package/chunks/{goal-tools-43XV33BT.js → goal-tools-47I455VV.js} +1 -1
- package/chunks/{handleAutoUpdate-JDQWGSSP.js → handleAutoUpdate-MJKTDJUO.js} +1 -1
- package/chunks/{i18n-JW6BVEGF.js → i18n-TCOB4TC5.js} +1 -1
- package/chunks/{initializer-UT6JLZ3O.js → initializer-NLYOGZZS.js} +1 -1
- package/chunks/{installationInfo-LKWDV3S2.js → installationInfo-TF2RSJOG.js} +1 -1
- package/chunks/{interactive-mod-session-2KWKYVPC.js → interactive-mod-session-5F7R3KSA.js} +1 -1
- package/chunks/{list-BKINK3S2.js → list-U2AEVLFP.js} +1 -1
- package/chunks/{llm-3RWXAVM2.js → llm-EV2QTQBU.js} +4 -4
- package/chunks/{llm-content-generator-MDRBSH73.js → llm-content-generator-ZXUSPPG2.js} +1 -1
- package/chunks/{loadedSettingsAdapter-WWJUKWUN.js → loadedSettingsAdapter-TLRI22X7.js} +1 -1
- package/chunks/{local-TT4FLCTR.js → local-ZTSBSKWV.js} +1 -1
- package/chunks/{local-execution-environment-OBA6VWYL.js → local-execution-environment-F263PSIM.js} +1 -1
- package/chunks/{loggingContentGenerator-CK7IKYQH.js → loggingContentGenerator-2XHSIJQD.js} +1 -1
- package/chunks/{loop-wakeup-4MSRX3DY.js → loop-wakeup-5ET3JHUT.js} +1 -1
- package/chunks/{manage-memory-PX5PZJKZ.js → manage-memory-MJEQ47H2.js} +1 -1
- package/chunks/{managed-execution-engine-WMAUR3ZK.js → managed-execution-engine-ODPR5OEH.js} +1 -1
- package/chunks/{managed-local-serve-X7REHGB4.js → managed-local-serve-S5R4Z5OL.js} +1 -1
- package/chunks/managed-npm-update-BUI5APGY.js +8 -0
- package/chunks/{managed-runtime-attestation-worker-F4AT53M5.js → managed-runtime-attestation-worker-BQP4E7LQ.js} +1 -1
- package/chunks/{managed-runtime-bootstrap-3BP5JRJX.js → managed-runtime-bootstrap-SRBDFSKK.js} +1 -1
- package/chunks/{managed-runtime-session-worker-2PO7J5UK.js → managed-runtime-session-worker-UI23BTYJ.js} +1 -1
- package/chunks/{managed-runtime-ssh-worker-4N7EMRSV.js → managed-runtime-ssh-worker-HU4CIJRK.js} +1 -1
- package/chunks/{managed-session-authority-MYOYTUM2.js → managed-session-authority-XSSTLAEY.js} +1 -1
- package/chunks/{mcp-5OTEMZ7P.js → mcp-WLHDOKP7.js} +1 -1
- package/chunks/{memory-TNW7RSAV.js → memory-OUUHPSDD.js} +1 -1
- package/chunks/{model-call-collection-KNTWFZQS.js → model-call-collection-4A2EB76B.js} +1 -1
- package/chunks/{model-configuration-U5C5P5UQ.js → model-configuration-4CGUFKEP.js} +1 -1
- package/chunks/{modelConfigUtils-R4KFI2WK.js → modelConfigUtils-HUEERWBA.js} +1 -1
- package/chunks/{monitor-RD2PFK42.js → monitor-FXL5UNMP.js} +1 -1
- package/chunks/{nonInteractiveCli-QQ72HZSH.js → nonInteractiveCli-W7M2O43W.js} +1 -1
- package/chunks/{nonInteractiveToolExecutor-QPQYR6IS.js → nonInteractiveToolExecutor-EMLI363Q.js} +1 -1
- package/chunks/{notebook-edit-YLRN3UZT.js → notebook-edit-R5RSLSSH.js} +1 -1
- package/chunks/{omni-CUJ52EW5.js → omni-DNZGITTE.js} +1 -1
- package/chunks/{openaiContentGenerator-6B5MAU54.js → openaiContentGenerator-PKOPYMHR.js} +1 -1
- package/chunks/{openaiResponsesContentGenerator-I245I3R7.js → openaiResponsesContentGenerator-MHH2MF3V.js} +1 -1
- package/chunks/{pidfile-P2HIGAUA.js → pidfile-5ZNJWMKG.js} +1 -1
- package/chunks/{processUtils-JSKN5UGS.js → processUtils-JIHQDASW.js} +1 -1
- package/chunks/{prompt-terminal-ledger-F5TSXVGU.js → prompt-terminal-ledger-L3LZ5SLR.js} +1 -1
- package/chunks/{qwenContentGenerator-IEDZONWG.js → qwenContentGenerator-QCZL7HJJ.js} +1 -1
- package/chunks/{reactive-degrade-FYZBJCF6.js → reactive-degrade-YUXOUQG4.js} +1 -1
- package/chunks/{read-file-VNZNSD6X.js → read-file-FBNU3AVX.js} +1 -1
- package/chunks/{resumeHistoryUtils-IDPE6N2N.js → resumeHistoryUtils-5FPRTI4A.js} +1 -1
- package/chunks/{review-TBJRZWTD.js → review-NLFYSNM3.js} +1 -1
- package/chunks/{ripGrep-4W5B5FOE.js → ripGrep-JUAPC5LD.js} +1 -1
- package/chunks/{run-qwen-serve-44X262G5.js → run-qwen-serve-JP64UQ3Y.js} +1 -1
- package/chunks/{runtime-6H6LKD73.js → runtime-D2QUYM6U.js} +1 -1
- package/chunks/{sandboxConfig-SQXDRGVN.js → sandboxConfig-7VZJQV6H.js} +1 -1
- package/chunks/{scheduled-tasks-62IZKHJG.js → scheduled-tasks-PC6EH75E.js} +1 -1
- package/chunks/{scheduler-QUCXJYRL.js → scheduler-RUV2FNDR.js} +1 -1
- package/chunks/{search-memory-TC2Z34QN.js → search-memory-YJTJ7BRU.js} +1 -1
- package/chunks/{send-message-TFZX7KI7.js → send-message-EEEFFTHX.js} +1 -1
- package/chunks/{serve-WSICDFGG.js → serve-KMIZDYON.js} +1 -1
- package/chunks/{server-GYYVTNGY.js → server-DUPK3V7B.js} +3 -3
- package/chunks/{session-KF3O23ZJ.js → session-CW5YMFMP.js} +1 -1
- package/chunks/{session-attachments-root-7HFUSONH.js → session-attachments-root-5H5GFHLI.js} +1 -1
- package/chunks/{session-execution-engine-selector-NVILT6BR.js → session-execution-engine-selector-MVXM2HZW.js} +1 -1
- package/chunks/{session-pr-refresh-3KDFTDEV.js → session-pr-refresh-4UPONX4L.js} +1 -1
- package/chunks/{sessionService-XRTFLPDW.js → sessionService-GGCYISSL.js} +1 -1
- package/chunks/{settings-QPPK6WXE.js → settings-AASJCESS.js} +1 -1
- package/chunks/{shell-WYQDZWL7.js → shell-V4WWLW3Q.js} +1 -1
- package/chunks/{skill-FYPT6AU7.js → skill-NDEBB7VX.js} +1 -1
- package/chunks/{skill-settings-OGFI5KZF.js → skill-settings-YAI3GYU5.js} +1 -1
- package/chunks/{spawnChannel-ANOOVPG7.js → spawnChannel-6JKVJAXZ.js} +1 -1
- package/chunks/{standalone-update-45WTDY4E.js → standalone-update-NJP5OCKJ.js} +1 -1
- package/chunks/{start-opentui-ui-TL5WK33V.js → start-opentui-ui-M4B4SXRM.js} +1 -1
- package/chunks/{startInteractiveUI-N2IREVBM.js → startInteractiveUI-O4JUDEAU.js} +1 -1
- package/chunks/{team-create-R77PRZ5U.js → team-create-NLJ7QBLD.js} +1 -1
- package/chunks/{team-plan-approval-6DCRKB5I.js → team-plan-approval-XKYPVWNG.js} +1 -1
- package/chunks/{terminal-image-renderer-TB7EX2WW.js → terminal-image-renderer-47TD747D.js} +1 -1
- package/chunks/{theme-manager-RQDXJGVR.js → theme-manager-AANEBPLJ.js} +1 -1
- package/chunks/{tool-call-LVB4NCDT.js → tool-call-ETH3LS7Y.js} +1 -1
- package/chunks/{tool-result-media-LRBB2KS6.js → tool-result-media-EFOEPAF2.js} +1 -1
- package/chunks/{tool-search-OG73QAQZ.js → tool-search-J3CF5PRN.js} +1 -1
- package/chunks/{total-session-admission-A4CUF6AD.js → total-session-admission-3DC52PLQ.js} +1 -1
- package/chunks/{trustedFolders-LSGOYTU2.js → trustedFolders-4KPWZZKB.js} +1 -1
- package/chunks/{update-relaunch-OGC6BZO7.js → update-relaunch-A67BS7QS.js} +1 -1
- package/chunks/{updateCheck-7J3GXTER.js → updateCheck-X623JRSY.js} +1 -1
- package/chunks/{upload-config-ML5XEJIF.js → upload-config-X2CR3F26.js} +1 -1
- package/chunks/{useAutoAcceptIndicator-6DH6GQ2X.js → useAutoAcceptIndicator-INIOQGJH.js} +1 -1
- package/chunks/{validateNonInterActiveAuth-KJDAGZCM.js → validateNonInterActiveAuth-XJ2U5CLB.js} +1 -1
- package/chunks/{version-7JN2YXL2.js → version-MFHRMM7W.js} +1 -1
- package/chunks/{web-fetch-42ZR4FEZ.js → web-fetch-3GEJ62DH.js} +1 -1
- package/chunks/{web-search-74NLPMZJ.js → web-search-WJZO3Q3A.js} +1 -1
- package/chunks/{workflow-WNPHX42I.js → workflow-ML7ITCMH.js} +1 -1
- package/chunks/{workflow-ancestor-trust-HGF6G7LQ.js → workflow-ancestor-trust-M3VFMS73.js} +1 -1
- package/chunks/{workspace-agents-3YFBFAK3.js → workspace-agents-YFZMV7EF.js} +1 -1
- package/chunks/{workspace-providers-status-EPJI6KRV.js → workspace-providers-status-3COKLBCI.js} +1 -1
- package/chunks/{workspace-recovery-worker-T3FK5YOD.js → workspace-recovery-worker-QURA3WFZ.js} +1 -1
- package/chunks/{workspace-registration-store-VEXYBDMA.js → workspace-registration-store-F3AGIOBW.js} +1 -1
- package/chunks/{workspace-registry-NRZYTP2X.js → workspace-registry-QUBL3RW6.js} +1 -1
- package/chunks/{workspace-runtime-coordinator-USNSTP2V.js → workspace-runtime-coordinator-22TSDHXX.js} +1 -1
- package/chunks/{workspace-service-USATWO56.js → workspace-service-UUENTHNO.js} +1 -1
- package/chunks/{workspace-skills-status-M5JTSFDL.js → workspace-skills-status-NNQQBBCJ.js} +1 -1
- package/chunks/{workspace-trust-reconciler-ZUZ2O5WC.js → workspace-trust-reconciler-3CMMNCGG.js} +1 -1
- package/chunks/{write-file-UMJVKE4S.js → write-file-DEAFIK4C.js} +1 -1
- package/chunks/{zoom-image-76XYHQ3Z.js → zoom-image-YYO22PQG.js} +1 -1
- package/cli-entry.js +2 -3
- package/cli.js +2 -2
- package/execution-worker.js +1 -1
- package/export-transcript-document.js +1 -1
- package/package.json +2 -12
- package/chunks/managed-npm-update-6HUVAJH7.js +0 -8
- package/opentui-assets/@opentui/core/assets/javascript/highlights.scm +0 -205
- package/opentui-assets/@opentui/core/assets/javascript/tree-sitter-javascript.wasm +0 -0
- package/opentui-assets/@opentui/core/assets/markdown/highlights.scm +0 -150
- package/opentui-assets/@opentui/core/assets/markdown/injections.scm +0 -27
- package/opentui-assets/@opentui/core/assets/markdown/tree-sitter-markdown.wasm +0 -0
- package/opentui-assets/@opentui/core/assets/markdown_inline/highlights.scm +0 -115
- package/opentui-assets/@opentui/core/assets/markdown_inline/tree-sitter-markdown_inline.wasm +0 -0
- package/opentui-assets/@opentui/core/assets/typescript/highlights.scm +0 -604
- package/opentui-assets/@opentui/core/assets/typescript/tree-sitter-typescript.wasm +0 -0
- package/opentui-assets/@opentui/core/assets/zig/highlights.scm +0 -284
- package/opentui-assets/@opentui/core/assets/zig/tree-sitter-zig.wasm +0 -0
- package/opentui-assets/@opentui/core/parser.worker.js +0 -4566
- package/opentui-assets/@opentui/core-darwin-arm64/libopentui.dylib +0 -0
- package/opentui-assets/@opentui/core-darwin-x64/libopentui.dylib +0 -0
- package/opentui-assets/@opentui/core-linux-arm64/libopentui.so +0 -0
- package/opentui-assets/@opentui/core-linux-x64/libopentui.so +0 -0
- package/opentui-assets/web-tree-sitter/tree-sitter.wasm +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{HistoryReplayer,observeAcpToolResultProjection}from"./chunk-K7GN4CMV.js";import{JSON_STRING_DELIMITER_BYTES,jsonStringJsonByteLength,jsonStringPayloadByteLength,truncateJsonStringPayload}from"./chunk-WQUA4G2X.js";import{isA2uiToolMeta}from"./chunk-HVP4UF2Q.js";import{redactLogCredentials}from"./chunk-CFTFKWPW.js";import{getResponseText,lastHistoryContentFromRecords,restorableAskUserQuestionCallIds}from"./chunk-T3CQ72HC.js";import{isShellResultDisplay,mapShellResultText}from"./chunk-T7CHK6C2.js";import{parseGoalSnapshotV2,parseGoalStateCause}from"./chunk-HW6AWS7W.js";import{init_esbuild_shims}from"./chunk-VKDAXTCZ.js";import{__name}from"./chunk-KBWJGX7I.js";init_esbuild_shims();var MAX_REMEMBER_ERROR_DETAILS_CHARS=1e3;var MAX_REMEMBER_ERROR_CAUSE_DEPTH=50;var REMEMBER_ERROR_FORMAT_RE=new RegExp("[\\p{Cf}]|\\p{Variation_Selector}","gu");var REMEMBER_ERROR_SPACE_SEPARATOR_RE=/[\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000]/gu;var REMEMBER_ERROR_CREDENTIAL_SEPARATOR_RE=new RegExp("[\\x00-\\x1f\\x7f-\\x9f\\p{Cf}\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000]|\\p{Variation_Selector}","gu");var REMEMBER_ERROR_AUTH_SCHEME_INVISIBLE_RE=new RegExp("\\b(Bearer|QQBot)(?:[\\x00-\\x1f\\x7f-\\x9f\\p{Cf}\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000]|\\p{Variation_Selector})+(?=[A-Za-z0-9._~+/=-])","giu");var REMEMBER_ERROR_AUTH_TOKEN_WITH_SEPARATORS_RE=new RegExp("\\b(Bearer|QQBot)(?:\\s|[\\x00-\\x1f\\x7f-\\x9f\\p{Cf}\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000]|\\p{Variation_Selector})+((?:[A-Za-z0-9._~+/=-]+(?:[\\x00-\\x1f\\x7f-\\x9f\\p{Cf}\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000]|\\p{Variation_Selector})+)*[A-Za-z0-9._~+/=-]+)","giu");var REMEMBER_ERROR_BARE_TOKEN_WITH_SEPARATORS_RE=new RegExp("\\b(?:sk-|ghp_|gho_|ghs_|ghu_|github_pat_|glpat-|xox[b]-|xox[p]-)(?:[A-Za-z0-9_-]+(?:[\\x00-\\x1f\\x7f-\\x9f\\p{Cf}\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000]|\\p{Variation_Selector})+)*[A-Za-z0-9_-]+","gu");var REMEMBER_ERROR_AWS_KEY_WITH_SEPARATORS_RE=new RegExp("\\b(?:AKIA|ASIA)(?:[A-Z0-9]+(?:[\\x00-\\x1f\\x7f-\\x9f\\p{Cf}\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000]|\\p{Variation_Selector})+)*[A-Z0-9]+","gu");var REMEMBER_ERROR_SECRET_ASSIGNMENT_WITH_SEPARATORS_RE=new RegExp("((?:api[_-]?key|token|secret|password|pwd)[_-]?[=:]\\s*)((?:\\S+(?:[\\x00-\\x1f\\x7f-\\x9f\\p{Cf}\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000]|\\p{Variation_Selector})+)*\\S+)","giu");var REMEMBER_ERROR_ENV_SECRET_ASSIGNMENT_WITH_SEPARATORS_RE=new RegExp("([A-Z][A-Z0-9]{0,50}(?:_[A-Z0-9]{1,50}){0,10}_(?:KEY|TOKEN|SECRET|PASSWORD)\\s*[=:]\\s*)((?:\\S+(?:[\\x00-\\x1f\\x7f-\\x9f\\p{Cf}\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000]|\\p{Variation_Selector})+)*\\S+)","gu");var REMEMBER_ERROR_URL_CREDENTIALS_WITH_SEPARATORS_RE=new RegExp("(\\b[a-z][a-z0-9+.-]{0,31}:\\/\\/)([^/@\\s]*(?:[\\x00-\\x1f\\x7f-\\x9f\\p{Cf}\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000]|\\p{Variation_Selector})+[^/@\\s]*)@","giu");var REMEMBER_ERROR_CONTROL_RE=/[\x00-\x1f\x7f-\x9f]/g;var DETAIL_SUPPRESSED_REMEMBER_ERROR_CODES=new Set(["managed_memory_unavailable"]);function createWorkspaceMemoryExtractionErrorLogger(logger){return(target,err)=>{logger.warn(`Failed to extract workspace memory error ${target}:`,{extractionError:err instanceof Error?err.message:String(err)})}}__name(createWorkspaceMemoryExtractionErrorLogger,"createWorkspaceMemoryExtractionErrorLogger");function reportRememberErrorExtractionFailure(onExtractionError,target,err){try{onExtractionError?.(target,err)}catch{}}__name(reportRememberErrorExtractionFailure,"reportRememberErrorExtractionFailure");function errorCodeFromRecord(record){if(typeof record["code"]==="string")return record["code"];const data=record["data"];if(data&&typeof data==="object"){const dataRecord=data;if(typeof dataRecord["errorKind"]==="string"){return dataRecord["errorKind"]}if(typeof dataRecord["code"]==="string")return dataRecord["code"]}return void 0}__name(errorCodeFromRecord,"errorCodeFromRecord");function rawRememberErrorCode(err,seen,depth){if(depth>MAX_REMEMBER_ERROR_CAUSE_DEPTH)return void 0;if(!err||typeof err!=="object")return void 0;if(seen.has(err))return void 0;seen.add(err);const record=err;const direct=errorCodeFromRecord(record);if(direct)return direct;const cause=record["cause"];if(cause!=null){return rawRememberErrorCode(cause,seen,depth+1)}return void 0}__name(rawRememberErrorCode,"rawRememberErrorCode");function extractRememberErrorCode(err,fallback="remember_failed"){return rawRememberErrorCode(err,new WeakSet,0)??fallback}__name(extractRememberErrorCode,"extractRememberErrorCode");function workspaceMemoryFailureCode(err,fallback="remember_failed",onExtractionError){try{return extractRememberErrorCode(err,fallback)}catch(extractionErr){reportRememberErrorExtractionFailure(onExtractionError,"code",extractionErr);return fallback}}__name(workspaceMemoryFailureCode,"workspaceMemoryFailureCode");function detailFromRecord(record,seen,depth){const data=record["data"];if(data&&typeof data==="object"){const dataRecord=data;const details=dataRecord["details"];if(typeof details==="string"&&details.length>0)return details;const message2=dataRecord["message"];if(typeof message2==="string"&&message2.length>0)return message2}const message=record["message"];if(typeof message==="string"&&message.length>0)return message;if(typeof data==="string"&&data.length>0)return data;const cause=record["cause"];if(cause!=null){return rawRememberErrorDetails(cause,seen,depth+1)}return void 0}__name(detailFromRecord,"detailFromRecord");function rawRememberErrorDetails(err,seen,depth){if(depth>MAX_REMEMBER_ERROR_CAUSE_DEPTH)return void 0;if(typeof err==="string"&&err.length>0)return err;if(!err||typeof err!=="object")return void 0;if(seen.has(err))return void 0;seen.add(err);return detailFromRecord(err,seen,depth)}__name(rawRememberErrorDetails,"rawRememberErrorDetails");function replaceControlChars(details){return details.replace(REMEMBER_ERROR_AUTH_SCHEME_INVISIBLE_RE,"$1 ").replace(REMEMBER_ERROR_FORMAT_RE,"").replace(REMEMBER_ERROR_SPACE_SEPARATOR_RE," ").replace(REMEMBER_ERROR_CONTROL_RE," ")}__name(replaceControlChars,"replaceControlChars");function replaceStackControlChars(stack){return stack.replace(REMEMBER_ERROR_AUTH_SCHEME_INVISIBLE_RE,"$1 ").replace(REMEMBER_ERROR_FORMAT_RE,"").replace(REMEMBER_ERROR_SPACE_SEPARATOR_RE," ").replace(REMEMBER_ERROR_CONTROL_RE,char=>char==="\n"||char==="\r"||char===" "?char:" ")}__name(replaceStackControlChars,"replaceStackControlChars");function collapseCredentialSeparators(text){return text.replace(REMEMBER_ERROR_URL_CREDENTIALS_WITH_SEPARATORS_RE,(_match,scheme,userinfo)=>`${scheme}${userinfo.replace(REMEMBER_ERROR_CREDENTIAL_SEPARATOR_RE,"")}@`).replace(REMEMBER_ERROR_AUTH_TOKEN_WITH_SEPARATORS_RE,(_match,scheme,token)=>`${scheme} ${token.replace(REMEMBER_ERROR_CREDENTIAL_SEPARATOR_RE,"")}`).replace(REMEMBER_ERROR_BARE_TOKEN_WITH_SEPARATORS_RE,token=>token.replace(REMEMBER_ERROR_CREDENTIAL_SEPARATOR_RE,"")).replace(REMEMBER_ERROR_AWS_KEY_WITH_SEPARATORS_RE,token=>token.replace(REMEMBER_ERROR_CREDENTIAL_SEPARATOR_RE,"")).replace(REMEMBER_ERROR_SECRET_ASSIGNMENT_WITH_SEPARATORS_RE,(_match,prefix,value)=>`${prefix}${value.replace(REMEMBER_ERROR_CREDENTIAL_SEPARATOR_RE,"")}`).replace(REMEMBER_ERROR_ENV_SECRET_ASSIGNMENT_WITH_SEPARATORS_RE,(_match,prefix,value)=>`${prefix}${value.replace(REMEMBER_ERROR_CREDENTIAL_SEPARATOR_RE,"")}`)}__name(collapseCredentialSeparators,"collapseCredentialSeparators");function collapseCredentialSeparatorsByStackLine(stack){return stack.split(/(\r\n|\n|\r)/).map(part=>part==="\r\n"||part==="\n"||part==="\r"?part:collapseCredentialSeparators(part)).join("")}__name(collapseCredentialSeparatorsByStackLine,"collapseCredentialSeparatorsByStackLine");function isHighSurrogate(codeUnit){return codeUnit>=55296&&codeUnit<=56319}__name(isHighSurrogate,"isHighSurrogate");function isLowSurrogate(codeUnit){return codeUnit>=56320&&codeUnit<=57343}__name(isLowSurrogate,"isLowSurrogate");function truncateBeforeDanglingSurrogate(details,cutPoint){const beforeCut=details.charCodeAt(cutPoint-1);const atCut=details.charCodeAt(cutPoint);if(isHighSurrogate(beforeCut)&&isLowSurrogate(atCut)){return cutPoint-1}return cutPoint}__name(truncateBeforeDanglingSurrogate,"truncateBeforeDanglingSurrogate");function capRememberErrorText(redacted){if(redacted.length<=MAX_REMEMBER_ERROR_DETAILS_CHARS)return redacted;const truncationSuffix="... [truncated]";const cutPoint=truncateBeforeDanglingSurrogate(redacted,MAX_REMEMBER_ERROR_DETAILS_CHARS-truncationSuffix.length);return`${redacted.slice(0,cutPoint)}${truncationSuffix}`}__name(capRememberErrorText,"capRememberErrorText");function redactAndCapRememberErrorText(normalized){const redacted=redactLogCredentials(normalized).trim();if(!redacted)return void 0;return capRememberErrorText(redacted)}__name(redactAndCapRememberErrorText,"redactAndCapRememberErrorText");function sanitizeRememberErrorDetails(details){return redactAndCapRememberErrorText(replaceControlChars(collapseCredentialSeparators(details)))}__name(sanitizeRememberErrorDetails,"sanitizeRememberErrorDetails");function sanitizeRememberErrorStack(stack){return redactAndCapRememberErrorText(replaceStackControlChars(collapseCredentialSeparatorsByStackLine(stack)))}__name(sanitizeRememberErrorStack,"sanitizeRememberErrorStack");function extractRememberErrorDetails(err){const raw=rawRememberErrorDetails(err,new WeakSet,0);if(!raw)return void 0;return sanitizeRememberErrorDetails(raw)}__name(extractRememberErrorDetails,"extractRememberErrorDetails");function extractRememberErrorStack(err){if(!(err instanceof Error)||!err.stack)return void 0;return sanitizeRememberErrorStack(err.stack)}__name(extractRememberErrorStack,"extractRememberErrorStack");function shouldSuppressRememberErrorDetails(code){return DETAIL_SUPPRESSED_REMEMBER_ERROR_CODES.has(code)}__name(shouldSuppressRememberErrorDetails,"shouldSuppressRememberErrorDetails");function workspaceMemoryFailureDiagnostics(err,onExtractionError){let details;let stack;try{details=extractRememberErrorDetails(err)}catch(extractionErr){reportRememberErrorExtractionFailure(onExtractionError,"details",extractionErr);details=void 0}try{stack=extractRememberErrorStack(err)}catch(extractionErr){reportRememberErrorExtractionFailure(onExtractionError,"stack",extractionErr);stack=void 0}return{...details?{details}:{},debugDetails:details??"<details unavailable>",...stack?{stack}:{}}}__name(workspaceMemoryFailureDiagnostics,"workspaceMemoryFailureDiagnostics");init_esbuild_shims();var MAX_REMEMBER_CONTENT_BYTES=64*1024;init_esbuild_shims();function formatWorkspaceMemoryForgetSummary(removedEntryCount){return removedEntryCount>0?`Forgot ${removedEntryCount} memory entr${removedEntryCount===1?"y":"ies"}.`:"No managed auto-memory entries matched."}__name(formatWorkspaceMemoryForgetSummary,"formatWorkspaceMemoryForgetSummary");function formatWorkspaceMemoryDreamSummary(touchedTopicCount){return touchedTopicCount>0?"Managed auto-memory dream completed.":"No managed auto-memory topics changed."}__name(formatWorkspaceMemoryDreamSummary,"formatWorkspaceMemoryDreamSummary");init_esbuild_shims();var VALID_SERVER_NAME=/^[A-Za-z0-9_-]+$/;var RESERVED_SERVER_NAMES=new Set(["__proto__","constructor","prototype"]);function isValidServerName(name){return typeof name==="string"&&name.length>0&&name.length<=256&&VALID_SERVER_NAME.test(name)&&!RESERVED_SERVER_NAMES.has(name)}__name(isValidServerName,"isValidServerName");init_esbuild_shims();var GENERATION_MAX_PROMPT_BYTES=32*1024;var GENERATION_TIMEOUT_MS=6e4;async function executeGeneration(config,requestId,prompt,signal,emit){const fastModel=config.getFastModel();const mainModel=config.getModel();const client=config.getBaseLlmClient();let modelSource=fastModel?"fast":"main";let resolved;if(fastModel){try{resolved=await client.resolveForModel(fastModel,{failClosed:true})}catch{modelSource="main"}}resolved??=await client.resolveForModel(mainModel,{failClosed:true});const{contentGenerator,model}=resolved;await emit({type:"started",model,modelSource});const stream=await contentGenerator.generateContentStream({model,contents:[{role:"user",parts:[{text:prompt}]}],config:{abortSignal:signal,tools:[],thinkingConfig:{thinkingBudget:0,includeThoughts:false},temperature:.2}},`generation:${requestId}`);let seq=0;let thinkingEmitted=false;let usage;for await(const chunk of stream){if(!thinkingEmitted&&chunk.candidates?.some(candidate=>candidate.content?.parts?.some(part=>part.thought===true))){thinkingEmitted=true;await emit({type:"thinking"})}const text=getResponseText(chunk)??"";if(text){await emit({type:"delta",seq:seq++,text})}if(chunk.usageMetadata)usage=chunk.usageMetadata}return{model,modelSource,...usage?.promptTokenCount!==void 0?{inputTokens:usage.promptTokenCount}:{},...usage?.candidatesTokenCount!==void 0?{outputTokens:usage.candidatesTokenCount}:{}}}__name(executeGeneration,"executeGeneration");init_esbuild_shims();import{Buffer as Buffer2}from"node:buffer";init_esbuild_shims();import{Buffer}from"node:buffer";import{isDeepStrictEqual}from"node:util";var ACP_TOOL_RESULT_TEXT_JSON_BYTE_BUDGET=65536;var ACP_TOOL_RESULT_TEXT_TRUNCATION_MARKER="\n[... truncated for ACP transport ...]\n";var EMPTY_CONTENT_ARRAY_JSON_BYTES=Buffer.byteLength("[]","utf8");var EMPTY_TEXT_BLOCK_JSON_BYTES=Buffer.byteLength(JSON.stringify(createTextBlock("")),"utf8");var JSON_ARRAY_SEPARATOR_BYTES=1;var TRUNCATION_MARKER_PAYLOAD_BYTES=jsonStringJsonByteLength(ACP_TOOL_RESULT_TEXT_TRUNCATION_MARKER)-JSON_STRING_DELIMITER_BYTES;var MAX_CANONICAL_TEXT_BLOCKS=Math.floor((ACP_TOOL_RESULT_TEXT_JSON_BYTE_BUDGET-EMPTY_CONTENT_ARRAY_JSON_BYTES+JSON_ARRAY_SEPARATOR_BYTES)/(EMPTY_TEXT_BLOCK_JSON_BYTES+JSON_ARRAY_SEPARATOR_BYTES));function createTextBlock(text){return{type:"content",content:{type:"text",text}}}__name(createTextBlock,"createTextBlock");function isObjectRecord(value){return typeof value==="object"&&value!==null&&!Array.isArray(value)}__name(isObjectRecord,"isObjectRecord");function hasExactKeys(value,first,second){const keys=Object.keys(value);return keys.length===2&&Object.hasOwn(value,first)&&Object.hasOwn(value,second)}__name(hasExactKeys,"hasExactKeys");function canonicalTextBlocks(value){if(!Array.isArray(value))return void 0;for(const block of value){if(!isObjectRecord(block)||!hasExactKeys(block,"type","content")||block["type"]!=="content"||!isObjectRecord(block["content"])||!hasExactKeys(block["content"],"type","text")||block["content"]["type"]!=="text"||typeof block["content"]["text"]!=="string"){return void 0}}return value}__name(canonicalTextBlocks,"canonicalTextBlocks");function contentSkeletonBytes(blockCount){if(blockCount===0)return EMPTY_CONTENT_ARRAY_JSON_BYTES;return EMPTY_CONTENT_ARRAY_JSON_BYTES+blockCount*EMPTY_TEXT_BLOCK_JSON_BYTES+(blockCount-1)*JSON_ARRAY_SEPARATOR_BYTES}__name(contentSkeletonBytes,"contentSkeletonBytes");function fallbackContent(){return[createTextBlock(ACP_TOOL_RESULT_TEXT_TRUNCATION_MARKER)]}__name(fallbackContent,"fallbackContent");function jsonByteLength(value){return Buffer.byteLength(JSON.stringify(value),"utf8")}__name(jsonByteLength,"jsonByteLength");function allocatePayloadBudgets(payloadBytes,availableBytes){const base=payloadBytes.map(bytes=>Math.min(bytes,TRUNCATION_MARKER_PAYLOAD_BYTES));let remaining=availableBytes-base.reduce((sum,bytes)=>sum+bytes,0);if(remaining<0)return void 0;const capacities=payloadBytes.map((bytes,index)=>({index,capacity:bytes-base[index]}));const sorted=capacities.filter(({capacity})=>capacity>0).sort((left,right)=>left.capacity===right.capacity?left.index-right.index:left.capacity-right.capacity);let active=sorted.length;let position=0;let level=0;let remainder=0;while(position<sorted.length&&active>0&&remaining>0){const nextLevel=sorted[position].capacity;const cost=(nextLevel-level)*active;if(cost>remaining){level+=Math.floor(remaining/active);remainder=remaining%active;remaining=0;break}level=nextLevel;remaining-=cost;while(position<sorted.length&&sorted[position].capacity===nextLevel){position++;active--}}const allocations=base.map((bytes,index)=>bytes+Math.min(capacities[index].capacity,level));if(remainder>0){for(const{index,capacity}of capacities){if(remainder===0)break;if(capacity>level){allocations[index]++;remainder--}}}return allocations}__name(allocatePayloadBudgets,"allocatePayloadBudgets");function projectContent(original){if(original.length>MAX_CANONICAL_TEXT_BLOCKS)return fallbackContent();const skeletonBytes=contentSkeletonBytes(original.length);const availablePayloadBytes=ACP_TOOL_RESULT_TEXT_JSON_BYTE_BUDGET-skeletonBytes;let remainingPayloadBytes=availablePayloadBytes;let needsProjection=false;for(const block of original){const payloadBytes2=jsonStringPayloadByteLength(block.content.text,remainingPayloadBytes);if(payloadBytes2>remainingPayloadBytes){needsProjection=true;break}remainingPayloadBytes-=payloadBytes2}if(!needsProjection)return original;const baseScans=original.map(block=>jsonStringPayloadByteLength(block.content.text,TRUNCATION_MARKER_PAYLOAD_BYTES));const basePayloadBytes=baseScans.map(bytes=>Math.min(bytes,TRUNCATION_MARKER_PAYLOAD_BYTES));const baseTotal=basePayloadBytes.reduce((sum,bytes)=>sum+bytes,0);if(baseTotal>availablePayloadBytes)return fallbackContent();const payloadBytes=original.map((block,index)=>{if(baseScans[index]<=TRUNCATION_MARKER_PAYLOAD_BYTES){return baseScans[index]}const maximumAllocation=availablePayloadBytes-baseTotal+basePayloadBytes[index];const bytes=jsonStringPayloadByteLength(block.content.text,maximumAllocation);return bytes<=maximumAllocation?bytes:maximumAllocation+1});const allocations=allocatePayloadBudgets(payloadBytes,availablePayloadBytes);if(!allocations)return fallbackContent();const projected=original.map((block,index)=>{if(payloadBytes[index]<=allocations[index])return block;return createTextBlock(truncateJsonStringPayload(block.content.text,payloadBytes[index],allocations[index],ACP_TOOL_RESULT_TEXT_TRUNCATION_MARKER))});return jsonByteLength(projected)<=ACP_TOOL_RESULT_TEXT_JSON_BYTE_BUDGET?projected:fallbackContent()}__name(projectContent,"projectContent");function projectRawOutput(value){const payloadBudget=ACP_TOOL_RESULT_TEXT_JSON_BYTE_BUDGET-JSON_STRING_DELIMITER_BYTES;const payloadBytes=jsonStringPayloadByteLength(value,payloadBudget);if(payloadBytes<=payloadBudget)return value;const projected=truncateJsonStringPayload(value,payloadBytes,payloadBudget,ACP_TOOL_RESULT_TEXT_TRUNCATION_MARKER);return jsonByteLength(projected)<=ACP_TOOL_RESULT_TEXT_JSON_BYTE_BUDGET?projected:ACP_TOOL_RESULT_TEXT_TRUNCATION_MARKER}__name(projectRawOutput,"projectRawOutput");function a2uiMeta(meta){if(!meta)return void 0;const toolName=typeof meta["toolName"]==="string"?meta["toolName"]:void 0;const serverId=typeof meta["serverId"]==="string"?meta["serverId"]:void 0;return toolName===void 0&&serverId===void 0?void 0:{...toolName===void 0?{}:{toolName},...serverId===void 0?{}:{serverId}}}__name(a2uiMeta,"a2uiMeta");function projectAcpToolResultUpdate(update){const record=update;if(record["sessionUpdate"]!=="tool_call_update")return update;const meta=isObjectRecord(record["_meta"])?record["_meta"]:void 0;if(isA2uiToolMeta(a2uiMeta(meta)))return update;const content=canonicalTextBlocks(record["content"]);const rawOutput=record["rawOutput"];if(content?.length===1&&typeof rawOutput==="string"&&rawOutput===content[0].content.text){const projectedContent2=projectContent(content);if(projectedContent2===content)return update;const projectedText=projectedContent2[0].content.text;return{...record,content:projectedContent2,rawOutput:projectedText}}const projectedContent=content?projectContent(content):void 0;let projectedRawOutput=typeof rawOutput==="string"?projectRawOutput(rawOutput):void 0;if(isShellResultDisplay(rawOutput)){const structured=mapShellResultText(rawOutput,text=>text);projectedRawOutput=isDeepStrictEqual(structured,rawOutput)?rawOutput:structured;if(Buffer.byteLength(JSON.stringify(structured),"utf8")>ACP_TOOL_RESULT_TEXT_JSON_BYTE_BUDGET){const payloadBytes=[];const skeleton=mapShellResultText(structured,text=>{payloadBytes.push(jsonStringPayloadByteLength(text));return""});const budgets=allocatePayloadBudgets(payloadBytes,ACP_TOOL_RESULT_TEXT_JSON_BYTE_BUDGET-Buffer.byteLength(JSON.stringify(skeleton),"utf8"));let index=0;projectedRawOutput=mapShellResultText(structured,text=>truncateJsonStringPayload(text,jsonStringPayloadByteLength(text),budgets[index++],ACP_TOOL_RESULT_TEXT_TRUNCATION_MARKER))}}const contentChanged=projectedContent!==void 0&&projectedContent!==content;const rawOutputChanged=projectedRawOutput!==void 0&&projectedRawOutput!==rawOutput;if(!contentChanged&&!rawOutputChanged)return update;return{...record,...contentChanged?{content:projectedContent}:{},...rawOutputChanged?{rawOutput:projectedRawOutput}:{}}}__name(projectAcpToolResultUpdate,"projectAcpToolResultUpdate");var HistoryReplayLimitError=class extends Error{constructor(sessionId,reason,observed,limit){super(`Transcript replay for session ${sessionId} exceeds the ${reason} limit (${observed}, max ${limit})`);this.sessionId=sessionId;this.reason=reason;this.observed=observed;this.limit=limit;this.name="HistoryReplayLimitError"}static{__name(this,"HistoryReplayLimitError")}};function createReplayCumulativeUsage(){return{promptTokens:0,cachedTokens:0,candidateTokens:0,apiTimeMs:0}}__name(createReplayCumulativeUsage,"createReplayCumulativeUsage");function copyCumulativeUsage(target,source){target.promptTokens=source.promptTokens;target.cachedTokens=source.cachedTokens;target.candidateTokens=source.candidateTokens;target.apiTimeMs=source.apiTimeMs}__name(copyCumulativeUsage,"copyCumulativeUsage");function isObjectRecord2(value){return typeof value==="object"&&value!==null&&!Array.isArray(value)}__name(isObjectRecord2,"isObjectRecord");function isCumulativeUsage(value){if(!isObjectRecord2(value))return false;return typeof value["promptTokens"]==="number"&&Number.isFinite(value["promptTokens"])&&typeof value["cachedTokens"]==="number"&&Number.isFinite(value["cachedTokens"])&&typeof value["candidateTokens"]==="number"&&Number.isFinite(value["candidateTokens"])&&typeof value["apiTimeMs"]==="number"&&Number.isFinite(value["apiTimeMs"])}__name(isCumulativeUsage,"isCumulativeUsage");function isPendingReplayToolCall(value){if(!isObjectRecord2(value))return false;return typeof value["callId"]==="string"&&typeof value["toolName"]==="string"&&(value["timestamp"]===void 0||typeof value["timestamp"]==="string")&&typeof value["recordId"]==="string"}__name(isPendingReplayToolCall,"isPendingReplayToolCall");function isCurrentPendingReplayToolCall(value){if(!isObjectRecord2(value))return false;return typeof value["callId"]==="string"&&typeof value["toolName"]==="string"&&typeof value["sourceRecordId"]==="string"&&(value["sourceTimestamp"]===void 0||typeof value["sourceTimestamp"]==="string")}__name(isCurrentPendingReplayToolCall,"isCurrentPendingReplayToolCall");function parseTranscriptReplayState(replay,logger){if(!isObjectRecord2(replay)){return{pendingToolCalls:[],cumulativeUsage:createReplayCumulativeUsage()}}if("v"in replay&&replay["v"]!==1){throw new TypeError("Unsupported transcript replay state version.")}const rawPending=replay["pendingToolCalls"];const pendingToolCalls=Array.isArray(rawPending)?rawPending.flatMap(pending=>{if(isPendingReplayToolCall(pending))return[pending];if(isCurrentPendingReplayToolCall(pending)){return[{callId:pending.callId,toolName:pending.toolName,...pending.resolvedToolName?{resolvedToolName:pending.resolvedToolName}:{},recordId:pending.sourceRecordId,...pending.sourceTimestamp?{timestamp:pending.sourceTimestamp}:{},...pending.rawCallId?{rawCallId:pending.rawCallId}:{},...pending.timingMatched?{timingMatched:true}:{}}]}return[]}):[];if(logger&&Array.isArray(rawPending)&&pendingToolCalls.length!==rawPending.length){const dropped=rawPending.length-pendingToolCalls.length;logger.warn(`[transcript] replay state dropped ${dropped} of ${rawPending.length} malformed pending tool calls`)}const cumulativeUsage=isCumulativeUsage(replay["cumulativeUsage"])?{...replay["cumulativeUsage"]}:createReplayCumulativeUsage();const rawGoalState=replay["goalState"];const goalState=rawGoalState===void 0?void 0:parseGoalSnapshotV2(rawGoalState);if(logger&&rawGoalState!==void 0&&!goalState){logger.warn("[transcript] replay state dropped a malformed Goal state")}const rawGoalCause=replay["goalCause"];const goalCause=rawGoalCause===void 0?void 0:parseGoalStateCause(rawGoalCause);if(logger&&rawGoalCause!==void 0&&!goalCause){logger.warn("[transcript] replay state dropped a malformed Goal cause")}return{pendingToolCalls,cumulativeUsage,...goalState?{goalState}:{},...goalCause?{goalCause}:{}}}__name(parseTranscriptReplayState,"parseTranscriptReplayState");function blankReplayedMcpAppHtml(update){const record=update;if(record["sessionUpdate"]!=="tool_call_update")return void 0;const rawOutput=record["rawOutput"];if(!isObjectRecord2(rawOutput)||rawOutput["type"]!=="mcp_app"||typeof rawOutput["html"]!=="string"||rawOutput["html"]===""){return void 0}const blanked={...record,rawOutput:{...rawOutput,html:"",fallbackText:rawOutput["fallbackText"]||"MCP App HTML omitted because the restored page exceeds its size limit."}};if(Buffer2.byteLength(JSON.stringify(blanked),"utf8")>=Buffer2.byteLength(JSON.stringify(record),"utf8")){return void 0}return blanked}__name(blankReplayedMcpAppHtml,"blankReplayedMcpAppHtml");function degradeReplayEnvelopeAppHtml(envelope,maxBytes){let pageBytes=Buffer2.byteLength(JSON.stringify(envelope),"utf8");for(let i=0;i<envelope.updates.length&&pageBytes>maxBytes;i++){const update=envelope.updates[i];const blanked=blankReplayedMcpAppHtml(update);if(blanked===void 0)continue;pageBytes+=Buffer2.byteLength(JSON.stringify(blanked),"utf8")-Buffer2.byteLength(JSON.stringify(update),"utf8");envelope.updates[i]=blanked}}__name(degradeReplayEnvelopeAppHtml,"degradeReplayEnvelopeAppHtml");function replayContext(sessionId,updates,cumulativeUsage,config,limits){let activeRecordId=null;let serializedUpdateBytes=2;return{sessionId,sendUpdate:__name(async update=>{const projectedUpdate=projectAcpToolResultUpdate(update);const updateWithRecordId=(()=>{if(activeRecordId===null)return projectedUpdate;const record=projectedUpdate;const meta=isObjectRecord2(record["_meta"])?record["_meta"]:{};return{...record,_meta:{...meta,"qwen.session.recordId":activeRecordId}}})();let deliveredUpdate=liftSessionUpdateTimestamp(updateWithRecordId);observeAcpToolResultProjection(update,projectedUpdate,sessionId,deliveredUpdate);if(limits){const updateCount=updates.length+1;if(updateCount>limits.maxUpdates){throw new HistoryReplayLimitError(sessionId,"updates",updateCount,limits.maxUpdates)}let updateBytes=(updates.length===0?0:1)+Buffer2.byteLength(JSON.stringify(deliveredUpdate),"utf8");if(serializedUpdateBytes+updateBytes>limits.maxBytes){for(let i=0;i<updates.length&&serializedUpdateBytes+updateBytes>limits.maxBytes;i++){const blanked=blankReplayedMcpAppHtml(updates[i]);if(blanked===void 0)continue;serializedUpdateBytes-=Buffer2.byteLength(JSON.stringify(updates[i]),"utf8")-Buffer2.byteLength(JSON.stringify(blanked),"utf8");updates[i]=blanked}if(serializedUpdateBytes+updateBytes>limits.maxBytes){const blanked=blankReplayedMcpAppHtml(deliveredUpdate);if(blanked!==void 0){deliveredUpdate=blanked;updateBytes=(updates.length===0?0:1)+Buffer2.byteLength(JSON.stringify(blanked),"utf8")}}}serializedUpdateBytes+=updateBytes;if(serializedUpdateBytes>limits.maxBytes){throw new HistoryReplayLimitError(sessionId,"bytes",serializedUpdateBytes,limits.maxBytes)}}updates.push(deliveredUpdate)},"sendUpdate"),setActiveRecordId:__name(recordId=>{activeRecordId=recordId},"setActiveRecordId"),cumulativeUsage,...config?{config}:{}}}__name(replayContext,"replayContext");async function collectHistoryReplayUpdates({sessionId,config,records,gaps,cumulativeUsage,logger,replayState,goalBootstrap,limits,suppressRestoreAskUserQuestion,finalizeDangling,branchPointsByAssistantUuid}){const updates=[];let replayError;try{const initial=parseTranscriptReplayState(replayState,logger);let skipFinalizeCallIds;if(suppressRestoreAskUserQuestion!==true&&config?.getRestoreAskUserQuestion?.()===true){const replayClient=config.getLlmClient?.();const lastHistoryContent=replayClient?.isInitialized?.()===true?replayClient.getChat?.()?.peekLastHistoryEntry?.()??lastHistoryContentFromRecords(records):lastHistoryContentFromRecords(records);skipFinalizeCallIds=restorableAskUserQuestionCallIds(lastHistoryContent)}await new HistoryReplayer(replayContext(sessionId,updates,cumulativeUsage,config,limits)).replay(records,gaps,{...initial.goalState?{initialGoalState:initial.goalState}:{},...initial.goalCause?{initialGoalCause:initial.goalCause}:{},...goalBootstrap?{goalBootstrap}:{},...skipFinalizeCallIds?{skipFinalizeCallIds}:{},...finalizeDangling===void 0?{}:{finalizeDangling}})}catch(error){if(error instanceof HistoryReplayLimitError)throw error;replayError=error instanceof Error?error.message:String(error);logger?.warn("[historyReplay] History replay failed for session %s (partial updates: %d):",sessionId,updates.length,error)}if(branchPointsByAssistantUuid){stampBranchPoints(updates,branchPointsByAssistantUuid)}return replayError===void 0?{updates}:{updates,replayError}}__name(collectHistoryReplayUpdates,"collectHistoryReplayUpdates");function liftSessionUpdateTimestamp(update){const record=update;const meta=record["_meta"];const timestamp=isObjectRecord2(meta)?meta["timestamp"]:void 0;return typeof timestamp==="number"||typeof timestamp==="string"?{...record,timestamp}:update}__name(liftSessionUpdateTimestamp,"liftSessionUpdateTimestamp");function readTranscriptSourceRecordIds(update){const value=update;const meta=value["_meta"]&&typeof value["_meta"]==="object"?value["_meta"]:void 0;const transcript=meta?.["qwenTranscript"]&&typeof meta["qwenTranscript"]==="object"?meta["qwenTranscript"]:void 0;const sourceRecordIds=transcript?.["sourceRecordIds"];if(!Array.isArray(sourceRecordIds))return void 0;return sourceRecordIds.filter(id=>typeof id==="string")}__name(readTranscriptSourceRecordIds,"readTranscriptSourceRecordIds");function stampBranchPoints(updates,branchPoints){const lastChunkIndexByRecordId=new Map;updates.forEach((update,index)=>{if(update.sessionUpdate!=="agent_message_chunk")return;const text=update.content?.text;if(typeof text!=="string"||text.length===0)return;for(const recordId of readTranscriptSourceRecordIds(update)??[]){if(Object.hasOwn(branchPoints,recordId)){lastChunkIndexByRecordId.set(recordId,index)}}});const decoratedIndexes=new Set;for(const[recordId,index]of lastChunkIndexByRecordId){if(decoratedIndexes.has(index))continue;decoratedIndexes.add(index);const value=updates[index];const meta=value["_meta"]&&typeof value["_meta"]==="object"?value["_meta"]:void 0;const transcript=meta?.["qwenTranscript"]&&typeof meta["qwenTranscript"]==="object"?meta["qwenTranscript"]:void 0;value["_meta"]={...meta,qwenTranscript:{...transcript,branchRecordId:branchPoints[recordId]}}}}__name(stampBranchPoints,"stampBranchPoints");async function replayTranscriptRecordPage({sessionId,page,config,encodeCursor,logger,finalizeDangling=true}){const state=parseTranscriptReplayState(page.replay,logger);const updates=[];const replayer=new HistoryReplayer(replayContext(sessionId,updates,state.cumulativeUsage,config));let replayState;let replayError;try{const replayPageState=await replayer.replayPage(page.records,{pendingToolCalls:page.direction==="backward"?[]:state.pendingToolCalls,finalizeDangling:finalizeDangling&&(page.direction==="backward"||!page.hasMore),gaps:page.gaps,includeTiming:true,...state.goalState?{goalState:state.goalState}:{},...state.goalCause?{goalCause:state.goalCause}:{}});replayState=replayPageState.replay}catch(error){logger?.warn("[historyReplay] Paged history replay failed for session %s (partial updates: %d):",sessionId,updates.length,error);replayState=replayer.getReplayState();replayError="Replay conversion failed for this page"}if(page.branchPointsByAssistantUuid){stampBranchPoints(updates,page.branchPointsByAssistantUuid)}const nextCursor=page.nextCursorState&&replayError===void 0?encodeCursor({...page.nextCursorState,...page.direction==="backward"?{}:{replay:replayState}}):void 0;return{updates,...nextCursor?{nextCursor}:{},hasMore:replayError===void 0&&page.hasMore,startTime:page.startTime,lastUpdated:page.lastUpdated,...replayError?{partial:true,replayError}:{}}}__name(replayTranscriptRecordPage,"replayTranscriptRecordPage");export{createWorkspaceMemoryExtractionErrorLogger,extractRememberErrorCode,workspaceMemoryFailureCode,shouldSuppressRememberErrorDetails,workspaceMemoryFailureDiagnostics,MAX_REMEMBER_CONTENT_BYTES,formatWorkspaceMemoryForgetSummary,formatWorkspaceMemoryDreamSummary,isValidServerName,GENERATION_MAX_PROMPT_BYTES,GENERATION_TIMEOUT_MS,executeGeneration,projectAcpToolResultUpdate,HistoryReplayLimitError,createReplayCumulativeUsage,copyCumulativeUsage,degradeReplayEnvelopeAppHtml,collectHistoryReplayUpdates,replayTranscriptRecordPage};
|
|
3
|
+
import{HistoryReplayer,observeAcpToolResultProjection}from"./chunk-5ZNXAWOG.js";import{JSON_STRING_DELIMITER_BYTES,jsonStringJsonByteLength,jsonStringPayloadByteLength,truncateJsonStringPayload}from"./chunk-WQUA4G2X.js";import{isA2uiToolMeta}from"./chunk-236DHGNH.js";import{redactLogCredentials}from"./chunk-CFTFKWPW.js";import{getResponseText,lastHistoryContentFromRecords,restorableAskUserQuestionCallIds}from"./chunk-7XQ5D34E.js";import{isShellResultDisplay,mapShellResultText}from"./chunk-T7CHK6C2.js";import{parseGoalSnapshotV2,parseGoalStateCause}from"./chunk-HW6AWS7W.js";import{init_esbuild_shims}from"./chunk-VKDAXTCZ.js";import{__name}from"./chunk-KBWJGX7I.js";init_esbuild_shims();var MAX_REMEMBER_ERROR_DETAILS_CHARS=1e3;var MAX_REMEMBER_ERROR_CAUSE_DEPTH=50;var REMEMBER_ERROR_FORMAT_RE=new RegExp("[\\p{Cf}]|\\p{Variation_Selector}","gu");var REMEMBER_ERROR_SPACE_SEPARATOR_RE=/[\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000]/gu;var REMEMBER_ERROR_CREDENTIAL_SEPARATOR_RE=new RegExp("[\\x00-\\x1f\\x7f-\\x9f\\p{Cf}\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000]|\\p{Variation_Selector}","gu");var REMEMBER_ERROR_AUTH_SCHEME_INVISIBLE_RE=new RegExp("\\b(Bearer|QQBot)(?:[\\x00-\\x1f\\x7f-\\x9f\\p{Cf}\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000]|\\p{Variation_Selector})+(?=[A-Za-z0-9._~+/=-])","giu");var REMEMBER_ERROR_AUTH_TOKEN_WITH_SEPARATORS_RE=new RegExp("\\b(Bearer|QQBot)(?:\\s|[\\x00-\\x1f\\x7f-\\x9f\\p{Cf}\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000]|\\p{Variation_Selector})+((?:[A-Za-z0-9._~+/=-]+(?:[\\x00-\\x1f\\x7f-\\x9f\\p{Cf}\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000]|\\p{Variation_Selector})+)*[A-Za-z0-9._~+/=-]+)","giu");var REMEMBER_ERROR_BARE_TOKEN_WITH_SEPARATORS_RE=new RegExp("\\b(?:sk-|ghp_|gho_|ghs_|ghu_|github_pat_|glpat-|xox[b]-|xox[p]-)(?:[A-Za-z0-9_-]+(?:[\\x00-\\x1f\\x7f-\\x9f\\p{Cf}\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000]|\\p{Variation_Selector})+)*[A-Za-z0-9_-]+","gu");var REMEMBER_ERROR_AWS_KEY_WITH_SEPARATORS_RE=new RegExp("\\b(?:AKIA|ASIA)(?:[A-Z0-9]+(?:[\\x00-\\x1f\\x7f-\\x9f\\p{Cf}\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000]|\\p{Variation_Selector})+)*[A-Z0-9]+","gu");var REMEMBER_ERROR_SECRET_ASSIGNMENT_WITH_SEPARATORS_RE=new RegExp("((?:api[_-]?key|token|secret|password|pwd)[_-]?[=:]\\s*)((?:\\S+(?:[\\x00-\\x1f\\x7f-\\x9f\\p{Cf}\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000]|\\p{Variation_Selector})+)*\\S+)","giu");var REMEMBER_ERROR_ENV_SECRET_ASSIGNMENT_WITH_SEPARATORS_RE=new RegExp("([A-Z][A-Z0-9]{0,50}(?:_[A-Z0-9]{1,50}){0,10}_(?:KEY|TOKEN|SECRET|PASSWORD)\\s*[=:]\\s*)((?:\\S+(?:[\\x00-\\x1f\\x7f-\\x9f\\p{Cf}\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000]|\\p{Variation_Selector})+)*\\S+)","gu");var REMEMBER_ERROR_URL_CREDENTIALS_WITH_SEPARATORS_RE=new RegExp("(\\b[a-z][a-z0-9+.-]{0,31}:\\/\\/)([^/@\\s]*(?:[\\x00-\\x1f\\x7f-\\x9f\\p{Cf}\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000]|\\p{Variation_Selector})+[^/@\\s]*)@","giu");var REMEMBER_ERROR_CONTROL_RE=/[\x00-\x1f\x7f-\x9f]/g;var DETAIL_SUPPRESSED_REMEMBER_ERROR_CODES=new Set(["managed_memory_unavailable"]);function createWorkspaceMemoryExtractionErrorLogger(logger){return(target,err)=>{logger.warn(`Failed to extract workspace memory error ${target}:`,{extractionError:err instanceof Error?err.message:String(err)})}}__name(createWorkspaceMemoryExtractionErrorLogger,"createWorkspaceMemoryExtractionErrorLogger");function reportRememberErrorExtractionFailure(onExtractionError,target,err){try{onExtractionError?.(target,err)}catch{}}__name(reportRememberErrorExtractionFailure,"reportRememberErrorExtractionFailure");function errorCodeFromRecord(record){if(typeof record["code"]==="string")return record["code"];const data=record["data"];if(data&&typeof data==="object"){const dataRecord=data;if(typeof dataRecord["errorKind"]==="string"){return dataRecord["errorKind"]}if(typeof dataRecord["code"]==="string")return dataRecord["code"]}return void 0}__name(errorCodeFromRecord,"errorCodeFromRecord");function rawRememberErrorCode(err,seen,depth){if(depth>MAX_REMEMBER_ERROR_CAUSE_DEPTH)return void 0;if(!err||typeof err!=="object")return void 0;if(seen.has(err))return void 0;seen.add(err);const record=err;const direct=errorCodeFromRecord(record);if(direct)return direct;const cause=record["cause"];if(cause!=null){return rawRememberErrorCode(cause,seen,depth+1)}return void 0}__name(rawRememberErrorCode,"rawRememberErrorCode");function extractRememberErrorCode(err,fallback="remember_failed"){return rawRememberErrorCode(err,new WeakSet,0)??fallback}__name(extractRememberErrorCode,"extractRememberErrorCode");function workspaceMemoryFailureCode(err,fallback="remember_failed",onExtractionError){try{return extractRememberErrorCode(err,fallback)}catch(extractionErr){reportRememberErrorExtractionFailure(onExtractionError,"code",extractionErr);return fallback}}__name(workspaceMemoryFailureCode,"workspaceMemoryFailureCode");function detailFromRecord(record,seen,depth){const data=record["data"];if(data&&typeof data==="object"){const dataRecord=data;const details=dataRecord["details"];if(typeof details==="string"&&details.length>0)return details;const message2=dataRecord["message"];if(typeof message2==="string"&&message2.length>0)return message2}const message=record["message"];if(typeof message==="string"&&message.length>0)return message;if(typeof data==="string"&&data.length>0)return data;const cause=record["cause"];if(cause!=null){return rawRememberErrorDetails(cause,seen,depth+1)}return void 0}__name(detailFromRecord,"detailFromRecord");function rawRememberErrorDetails(err,seen,depth){if(depth>MAX_REMEMBER_ERROR_CAUSE_DEPTH)return void 0;if(typeof err==="string"&&err.length>0)return err;if(!err||typeof err!=="object")return void 0;if(seen.has(err))return void 0;seen.add(err);return detailFromRecord(err,seen,depth)}__name(rawRememberErrorDetails,"rawRememberErrorDetails");function replaceControlChars(details){return details.replace(REMEMBER_ERROR_AUTH_SCHEME_INVISIBLE_RE,"$1 ").replace(REMEMBER_ERROR_FORMAT_RE,"").replace(REMEMBER_ERROR_SPACE_SEPARATOR_RE," ").replace(REMEMBER_ERROR_CONTROL_RE," ")}__name(replaceControlChars,"replaceControlChars");function replaceStackControlChars(stack){return stack.replace(REMEMBER_ERROR_AUTH_SCHEME_INVISIBLE_RE,"$1 ").replace(REMEMBER_ERROR_FORMAT_RE,"").replace(REMEMBER_ERROR_SPACE_SEPARATOR_RE," ").replace(REMEMBER_ERROR_CONTROL_RE,char=>char==="\n"||char==="\r"||char===" "?char:" ")}__name(replaceStackControlChars,"replaceStackControlChars");function collapseCredentialSeparators(text){return text.replace(REMEMBER_ERROR_URL_CREDENTIALS_WITH_SEPARATORS_RE,(_match,scheme,userinfo)=>`${scheme}${userinfo.replace(REMEMBER_ERROR_CREDENTIAL_SEPARATOR_RE,"")}@`).replace(REMEMBER_ERROR_AUTH_TOKEN_WITH_SEPARATORS_RE,(_match,scheme,token)=>`${scheme} ${token.replace(REMEMBER_ERROR_CREDENTIAL_SEPARATOR_RE,"")}`).replace(REMEMBER_ERROR_BARE_TOKEN_WITH_SEPARATORS_RE,token=>token.replace(REMEMBER_ERROR_CREDENTIAL_SEPARATOR_RE,"")).replace(REMEMBER_ERROR_AWS_KEY_WITH_SEPARATORS_RE,token=>token.replace(REMEMBER_ERROR_CREDENTIAL_SEPARATOR_RE,"")).replace(REMEMBER_ERROR_SECRET_ASSIGNMENT_WITH_SEPARATORS_RE,(_match,prefix,value)=>`${prefix}${value.replace(REMEMBER_ERROR_CREDENTIAL_SEPARATOR_RE,"")}`).replace(REMEMBER_ERROR_ENV_SECRET_ASSIGNMENT_WITH_SEPARATORS_RE,(_match,prefix,value)=>`${prefix}${value.replace(REMEMBER_ERROR_CREDENTIAL_SEPARATOR_RE,"")}`)}__name(collapseCredentialSeparators,"collapseCredentialSeparators");function collapseCredentialSeparatorsByStackLine(stack){return stack.split(/(\r\n|\n|\r)/).map(part=>part==="\r\n"||part==="\n"||part==="\r"?part:collapseCredentialSeparators(part)).join("")}__name(collapseCredentialSeparatorsByStackLine,"collapseCredentialSeparatorsByStackLine");function isHighSurrogate(codeUnit){return codeUnit>=55296&&codeUnit<=56319}__name(isHighSurrogate,"isHighSurrogate");function isLowSurrogate(codeUnit){return codeUnit>=56320&&codeUnit<=57343}__name(isLowSurrogate,"isLowSurrogate");function truncateBeforeDanglingSurrogate(details,cutPoint){const beforeCut=details.charCodeAt(cutPoint-1);const atCut=details.charCodeAt(cutPoint);if(isHighSurrogate(beforeCut)&&isLowSurrogate(atCut)){return cutPoint-1}return cutPoint}__name(truncateBeforeDanglingSurrogate,"truncateBeforeDanglingSurrogate");function capRememberErrorText(redacted){if(redacted.length<=MAX_REMEMBER_ERROR_DETAILS_CHARS)return redacted;const truncationSuffix="... [truncated]";const cutPoint=truncateBeforeDanglingSurrogate(redacted,MAX_REMEMBER_ERROR_DETAILS_CHARS-truncationSuffix.length);return`${redacted.slice(0,cutPoint)}${truncationSuffix}`}__name(capRememberErrorText,"capRememberErrorText");function redactAndCapRememberErrorText(normalized){const redacted=redactLogCredentials(normalized).trim();if(!redacted)return void 0;return capRememberErrorText(redacted)}__name(redactAndCapRememberErrorText,"redactAndCapRememberErrorText");function sanitizeRememberErrorDetails(details){return redactAndCapRememberErrorText(replaceControlChars(collapseCredentialSeparators(details)))}__name(sanitizeRememberErrorDetails,"sanitizeRememberErrorDetails");function sanitizeRememberErrorStack(stack){return redactAndCapRememberErrorText(replaceStackControlChars(collapseCredentialSeparatorsByStackLine(stack)))}__name(sanitizeRememberErrorStack,"sanitizeRememberErrorStack");function extractRememberErrorDetails(err){const raw=rawRememberErrorDetails(err,new WeakSet,0);if(!raw)return void 0;return sanitizeRememberErrorDetails(raw)}__name(extractRememberErrorDetails,"extractRememberErrorDetails");function extractRememberErrorStack(err){if(!(err instanceof Error)||!err.stack)return void 0;return sanitizeRememberErrorStack(err.stack)}__name(extractRememberErrorStack,"extractRememberErrorStack");function shouldSuppressRememberErrorDetails(code){return DETAIL_SUPPRESSED_REMEMBER_ERROR_CODES.has(code)}__name(shouldSuppressRememberErrorDetails,"shouldSuppressRememberErrorDetails");function workspaceMemoryFailureDiagnostics(err,onExtractionError){let details;let stack;try{details=extractRememberErrorDetails(err)}catch(extractionErr){reportRememberErrorExtractionFailure(onExtractionError,"details",extractionErr);details=void 0}try{stack=extractRememberErrorStack(err)}catch(extractionErr){reportRememberErrorExtractionFailure(onExtractionError,"stack",extractionErr);stack=void 0}return{...details?{details}:{},debugDetails:details??"<details unavailable>",...stack?{stack}:{}}}__name(workspaceMemoryFailureDiagnostics,"workspaceMemoryFailureDiagnostics");init_esbuild_shims();var MAX_REMEMBER_CONTENT_BYTES=64*1024;init_esbuild_shims();function formatWorkspaceMemoryForgetSummary(removedEntryCount){return removedEntryCount>0?`Forgot ${removedEntryCount} memory entr${removedEntryCount===1?"y":"ies"}.`:"No managed auto-memory entries matched."}__name(formatWorkspaceMemoryForgetSummary,"formatWorkspaceMemoryForgetSummary");function formatWorkspaceMemoryDreamSummary(touchedTopicCount){return touchedTopicCount>0?"Managed auto-memory dream completed.":"No managed auto-memory topics changed."}__name(formatWorkspaceMemoryDreamSummary,"formatWorkspaceMemoryDreamSummary");init_esbuild_shims();var VALID_SERVER_NAME=/^[A-Za-z0-9_-]+$/;var RESERVED_SERVER_NAMES=new Set(["__proto__","constructor","prototype"]);function isValidServerName(name){return typeof name==="string"&&name.length>0&&name.length<=256&&VALID_SERVER_NAME.test(name)&&!RESERVED_SERVER_NAMES.has(name)}__name(isValidServerName,"isValidServerName");init_esbuild_shims();var GENERATION_MAX_PROMPT_BYTES=32*1024;var GENERATION_TIMEOUT_MS=6e4;async function executeGeneration(config,requestId,prompt,signal,emit){const fastModel=config.getFastModel();const mainModel=config.getModel();const client=config.getBaseLlmClient();let modelSource=fastModel?"fast":"main";let resolved;if(fastModel){try{resolved=await client.resolveForModel(fastModel,{failClosed:true})}catch{modelSource="main"}}resolved??=await client.resolveForModel(mainModel,{failClosed:true});const{contentGenerator,model}=resolved;await emit({type:"started",model,modelSource});const stream=await contentGenerator.generateContentStream({model,contents:[{role:"user",parts:[{text:prompt}]}],config:{abortSignal:signal,tools:[],thinkingConfig:{thinkingBudget:0,includeThoughts:false},temperature:.2}},`generation:${requestId}`);let seq=0;let thinkingEmitted=false;let usage;for await(const chunk of stream){if(!thinkingEmitted&&chunk.candidates?.some(candidate=>candidate.content?.parts?.some(part=>part.thought===true))){thinkingEmitted=true;await emit({type:"thinking"})}const text=getResponseText(chunk)??"";if(text){await emit({type:"delta",seq:seq++,text})}if(chunk.usageMetadata)usage=chunk.usageMetadata}return{model,modelSource,...usage?.promptTokenCount!==void 0?{inputTokens:usage.promptTokenCount}:{},...usage?.candidatesTokenCount!==void 0?{outputTokens:usage.candidatesTokenCount}:{}}}__name(executeGeneration,"executeGeneration");init_esbuild_shims();import{Buffer as Buffer2}from"node:buffer";init_esbuild_shims();import{Buffer}from"node:buffer";import{isDeepStrictEqual}from"node:util";var ACP_TOOL_RESULT_TEXT_JSON_BYTE_BUDGET=65536;var ACP_TOOL_RESULT_TEXT_TRUNCATION_MARKER="\n[... truncated for ACP transport ...]\n";var EMPTY_CONTENT_ARRAY_JSON_BYTES=Buffer.byteLength("[]","utf8");var EMPTY_TEXT_BLOCK_JSON_BYTES=Buffer.byteLength(JSON.stringify(createTextBlock("")),"utf8");var JSON_ARRAY_SEPARATOR_BYTES=1;var TRUNCATION_MARKER_PAYLOAD_BYTES=jsonStringJsonByteLength(ACP_TOOL_RESULT_TEXT_TRUNCATION_MARKER)-JSON_STRING_DELIMITER_BYTES;var MAX_CANONICAL_TEXT_BLOCKS=Math.floor((ACP_TOOL_RESULT_TEXT_JSON_BYTE_BUDGET-EMPTY_CONTENT_ARRAY_JSON_BYTES+JSON_ARRAY_SEPARATOR_BYTES)/(EMPTY_TEXT_BLOCK_JSON_BYTES+JSON_ARRAY_SEPARATOR_BYTES));function createTextBlock(text){return{type:"content",content:{type:"text",text}}}__name(createTextBlock,"createTextBlock");function isObjectRecord(value){return typeof value==="object"&&value!==null&&!Array.isArray(value)}__name(isObjectRecord,"isObjectRecord");function hasExactKeys(value,first,second){const keys=Object.keys(value);return keys.length===2&&Object.hasOwn(value,first)&&Object.hasOwn(value,second)}__name(hasExactKeys,"hasExactKeys");function canonicalTextBlocks(value){if(!Array.isArray(value))return void 0;for(const block of value){if(!isObjectRecord(block)||!hasExactKeys(block,"type","content")||block["type"]!=="content"||!isObjectRecord(block["content"])||!hasExactKeys(block["content"],"type","text")||block["content"]["type"]!=="text"||typeof block["content"]["text"]!=="string"){return void 0}}return value}__name(canonicalTextBlocks,"canonicalTextBlocks");function contentSkeletonBytes(blockCount){if(blockCount===0)return EMPTY_CONTENT_ARRAY_JSON_BYTES;return EMPTY_CONTENT_ARRAY_JSON_BYTES+blockCount*EMPTY_TEXT_BLOCK_JSON_BYTES+(blockCount-1)*JSON_ARRAY_SEPARATOR_BYTES}__name(contentSkeletonBytes,"contentSkeletonBytes");function fallbackContent(){return[createTextBlock(ACP_TOOL_RESULT_TEXT_TRUNCATION_MARKER)]}__name(fallbackContent,"fallbackContent");function jsonByteLength(value){return Buffer.byteLength(JSON.stringify(value),"utf8")}__name(jsonByteLength,"jsonByteLength");function allocatePayloadBudgets(payloadBytes,availableBytes){const base=payloadBytes.map(bytes=>Math.min(bytes,TRUNCATION_MARKER_PAYLOAD_BYTES));let remaining=availableBytes-base.reduce((sum,bytes)=>sum+bytes,0);if(remaining<0)return void 0;const capacities=payloadBytes.map((bytes,index)=>({index,capacity:bytes-base[index]}));const sorted=capacities.filter(({capacity})=>capacity>0).sort((left,right)=>left.capacity===right.capacity?left.index-right.index:left.capacity-right.capacity);let active=sorted.length;let position=0;let level=0;let remainder=0;while(position<sorted.length&&active>0&&remaining>0){const nextLevel=sorted[position].capacity;const cost=(nextLevel-level)*active;if(cost>remaining){level+=Math.floor(remaining/active);remainder=remaining%active;remaining=0;break}level=nextLevel;remaining-=cost;while(position<sorted.length&&sorted[position].capacity===nextLevel){position++;active--}}const allocations=base.map((bytes,index)=>bytes+Math.min(capacities[index].capacity,level));if(remainder>0){for(const{index,capacity}of capacities){if(remainder===0)break;if(capacity>level){allocations[index]++;remainder--}}}return allocations}__name(allocatePayloadBudgets,"allocatePayloadBudgets");function projectContent(original){if(original.length>MAX_CANONICAL_TEXT_BLOCKS)return fallbackContent();const skeletonBytes=contentSkeletonBytes(original.length);const availablePayloadBytes=ACP_TOOL_RESULT_TEXT_JSON_BYTE_BUDGET-skeletonBytes;let remainingPayloadBytes=availablePayloadBytes;let needsProjection=false;for(const block of original){const payloadBytes2=jsonStringPayloadByteLength(block.content.text,remainingPayloadBytes);if(payloadBytes2>remainingPayloadBytes){needsProjection=true;break}remainingPayloadBytes-=payloadBytes2}if(!needsProjection)return original;const baseScans=original.map(block=>jsonStringPayloadByteLength(block.content.text,TRUNCATION_MARKER_PAYLOAD_BYTES));const basePayloadBytes=baseScans.map(bytes=>Math.min(bytes,TRUNCATION_MARKER_PAYLOAD_BYTES));const baseTotal=basePayloadBytes.reduce((sum,bytes)=>sum+bytes,0);if(baseTotal>availablePayloadBytes)return fallbackContent();const payloadBytes=original.map((block,index)=>{if(baseScans[index]<=TRUNCATION_MARKER_PAYLOAD_BYTES){return baseScans[index]}const maximumAllocation=availablePayloadBytes-baseTotal+basePayloadBytes[index];const bytes=jsonStringPayloadByteLength(block.content.text,maximumAllocation);return bytes<=maximumAllocation?bytes:maximumAllocation+1});const allocations=allocatePayloadBudgets(payloadBytes,availablePayloadBytes);if(!allocations)return fallbackContent();const projected=original.map((block,index)=>{if(payloadBytes[index]<=allocations[index])return block;return createTextBlock(truncateJsonStringPayload(block.content.text,payloadBytes[index],allocations[index],ACP_TOOL_RESULT_TEXT_TRUNCATION_MARKER))});return jsonByteLength(projected)<=ACP_TOOL_RESULT_TEXT_JSON_BYTE_BUDGET?projected:fallbackContent()}__name(projectContent,"projectContent");function projectRawOutput(value){const payloadBudget=ACP_TOOL_RESULT_TEXT_JSON_BYTE_BUDGET-JSON_STRING_DELIMITER_BYTES;const payloadBytes=jsonStringPayloadByteLength(value,payloadBudget);if(payloadBytes<=payloadBudget)return value;const projected=truncateJsonStringPayload(value,payloadBytes,payloadBudget,ACP_TOOL_RESULT_TEXT_TRUNCATION_MARKER);return jsonByteLength(projected)<=ACP_TOOL_RESULT_TEXT_JSON_BYTE_BUDGET?projected:ACP_TOOL_RESULT_TEXT_TRUNCATION_MARKER}__name(projectRawOutput,"projectRawOutput");function a2uiMeta(meta){if(!meta)return void 0;const toolName=typeof meta["toolName"]==="string"?meta["toolName"]:void 0;const serverId=typeof meta["serverId"]==="string"?meta["serverId"]:void 0;return toolName===void 0&&serverId===void 0?void 0:{...toolName===void 0?{}:{toolName},...serverId===void 0?{}:{serverId}}}__name(a2uiMeta,"a2uiMeta");function projectAcpToolResultUpdate(update){const record=update;if(record["sessionUpdate"]!=="tool_call_update")return update;const meta=isObjectRecord(record["_meta"])?record["_meta"]:void 0;if(isA2uiToolMeta(a2uiMeta(meta)))return update;const content=canonicalTextBlocks(record["content"]);const rawOutput=record["rawOutput"];if(content?.length===1&&typeof rawOutput==="string"&&rawOutput===content[0].content.text){const projectedContent2=projectContent(content);if(projectedContent2===content)return update;const projectedText=projectedContent2[0].content.text;return{...record,content:projectedContent2,rawOutput:projectedText}}const projectedContent=content?projectContent(content):void 0;let projectedRawOutput=typeof rawOutput==="string"?projectRawOutput(rawOutput):void 0;if(isShellResultDisplay(rawOutput)){const structured=mapShellResultText(rawOutput,text=>text);projectedRawOutput=isDeepStrictEqual(structured,rawOutput)?rawOutput:structured;if(Buffer.byteLength(JSON.stringify(structured),"utf8")>ACP_TOOL_RESULT_TEXT_JSON_BYTE_BUDGET){const payloadBytes=[];const skeleton=mapShellResultText(structured,text=>{payloadBytes.push(jsonStringPayloadByteLength(text));return""});const budgets=allocatePayloadBudgets(payloadBytes,ACP_TOOL_RESULT_TEXT_JSON_BYTE_BUDGET-Buffer.byteLength(JSON.stringify(skeleton),"utf8"));let index=0;projectedRawOutput=mapShellResultText(structured,text=>truncateJsonStringPayload(text,jsonStringPayloadByteLength(text),budgets[index++],ACP_TOOL_RESULT_TEXT_TRUNCATION_MARKER))}}const contentChanged=projectedContent!==void 0&&projectedContent!==content;const rawOutputChanged=projectedRawOutput!==void 0&&projectedRawOutput!==rawOutput;if(!contentChanged&&!rawOutputChanged)return update;return{...record,...contentChanged?{content:projectedContent}:{},...rawOutputChanged?{rawOutput:projectedRawOutput}:{}}}__name(projectAcpToolResultUpdate,"projectAcpToolResultUpdate");var HistoryReplayLimitError=class extends Error{constructor(sessionId,reason,observed,limit){super(`Transcript replay for session ${sessionId} exceeds the ${reason} limit (${observed}, max ${limit})`);this.sessionId=sessionId;this.reason=reason;this.observed=observed;this.limit=limit;this.name="HistoryReplayLimitError"}static{__name(this,"HistoryReplayLimitError")}};function createReplayCumulativeUsage(){return{promptTokens:0,cachedTokens:0,candidateTokens:0,apiTimeMs:0}}__name(createReplayCumulativeUsage,"createReplayCumulativeUsage");function copyCumulativeUsage(target,source){target.promptTokens=source.promptTokens;target.cachedTokens=source.cachedTokens;target.candidateTokens=source.candidateTokens;target.apiTimeMs=source.apiTimeMs}__name(copyCumulativeUsage,"copyCumulativeUsage");function isObjectRecord2(value){return typeof value==="object"&&value!==null&&!Array.isArray(value)}__name(isObjectRecord2,"isObjectRecord");function isCumulativeUsage(value){if(!isObjectRecord2(value))return false;return typeof value["promptTokens"]==="number"&&Number.isFinite(value["promptTokens"])&&typeof value["cachedTokens"]==="number"&&Number.isFinite(value["cachedTokens"])&&typeof value["candidateTokens"]==="number"&&Number.isFinite(value["candidateTokens"])&&typeof value["apiTimeMs"]==="number"&&Number.isFinite(value["apiTimeMs"])}__name(isCumulativeUsage,"isCumulativeUsage");function isPendingReplayToolCall(value){if(!isObjectRecord2(value))return false;return typeof value["callId"]==="string"&&typeof value["toolName"]==="string"&&(value["timestamp"]===void 0||typeof value["timestamp"]==="string")&&typeof value["recordId"]==="string"}__name(isPendingReplayToolCall,"isPendingReplayToolCall");function isCurrentPendingReplayToolCall(value){if(!isObjectRecord2(value))return false;return typeof value["callId"]==="string"&&typeof value["toolName"]==="string"&&typeof value["sourceRecordId"]==="string"&&(value["sourceTimestamp"]===void 0||typeof value["sourceTimestamp"]==="string")}__name(isCurrentPendingReplayToolCall,"isCurrentPendingReplayToolCall");function parseTranscriptReplayState(replay,logger){if(!isObjectRecord2(replay)){return{pendingToolCalls:[],cumulativeUsage:createReplayCumulativeUsage()}}if("v"in replay&&replay["v"]!==1){throw new TypeError("Unsupported transcript replay state version.")}const rawPending=replay["pendingToolCalls"];const pendingToolCalls=Array.isArray(rawPending)?rawPending.flatMap(pending=>{if(isPendingReplayToolCall(pending))return[pending];if(isCurrentPendingReplayToolCall(pending)){return[{callId:pending.callId,toolName:pending.toolName,...pending.resolvedToolName?{resolvedToolName:pending.resolvedToolName}:{},recordId:pending.sourceRecordId,...pending.sourceTimestamp?{timestamp:pending.sourceTimestamp}:{},...pending.rawCallId?{rawCallId:pending.rawCallId}:{},...pending.timingMatched?{timingMatched:true}:{}}]}return[]}):[];if(logger&&Array.isArray(rawPending)&&pendingToolCalls.length!==rawPending.length){const dropped=rawPending.length-pendingToolCalls.length;logger.warn(`[transcript] replay state dropped ${dropped} of ${rawPending.length} malformed pending tool calls`)}const cumulativeUsage=isCumulativeUsage(replay["cumulativeUsage"])?{...replay["cumulativeUsage"]}:createReplayCumulativeUsage();const rawGoalState=replay["goalState"];const goalState=rawGoalState===void 0?void 0:parseGoalSnapshotV2(rawGoalState);if(logger&&rawGoalState!==void 0&&!goalState){logger.warn("[transcript] replay state dropped a malformed Goal state")}const rawGoalCause=replay["goalCause"];const goalCause=rawGoalCause===void 0?void 0:parseGoalStateCause(rawGoalCause);if(logger&&rawGoalCause!==void 0&&!goalCause){logger.warn("[transcript] replay state dropped a malformed Goal cause")}return{pendingToolCalls,cumulativeUsage,...goalState?{goalState}:{},...goalCause?{goalCause}:{}}}__name(parseTranscriptReplayState,"parseTranscriptReplayState");function blankReplayedMcpAppHtml(update){const record=update;if(record["sessionUpdate"]!=="tool_call_update")return void 0;const rawOutput=record["rawOutput"];if(!isObjectRecord2(rawOutput)||rawOutput["type"]!=="mcp_app"||typeof rawOutput["html"]!=="string"||rawOutput["html"]===""){return void 0}const blanked={...record,rawOutput:{...rawOutput,html:"",fallbackText:rawOutput["fallbackText"]||"MCP App HTML omitted because the restored page exceeds its size limit."}};if(Buffer2.byteLength(JSON.stringify(blanked),"utf8")>=Buffer2.byteLength(JSON.stringify(record),"utf8")){return void 0}return blanked}__name(blankReplayedMcpAppHtml,"blankReplayedMcpAppHtml");function degradeReplayEnvelopeAppHtml(envelope,maxBytes){let pageBytes=Buffer2.byteLength(JSON.stringify(envelope),"utf8");for(let i=0;i<envelope.updates.length&&pageBytes>maxBytes;i++){const update=envelope.updates[i];const blanked=blankReplayedMcpAppHtml(update);if(blanked===void 0)continue;pageBytes+=Buffer2.byteLength(JSON.stringify(blanked),"utf8")-Buffer2.byteLength(JSON.stringify(update),"utf8");envelope.updates[i]=blanked}}__name(degradeReplayEnvelopeAppHtml,"degradeReplayEnvelopeAppHtml");function replayContext(sessionId,updates,cumulativeUsage,config,limits){let activeRecordId=null;let serializedUpdateBytes=2;return{sessionId,sendUpdate:__name(async update=>{const projectedUpdate=projectAcpToolResultUpdate(update);const updateWithRecordId=(()=>{if(activeRecordId===null)return projectedUpdate;const record=projectedUpdate;const meta=isObjectRecord2(record["_meta"])?record["_meta"]:{};return{...record,_meta:{...meta,"qwen.session.recordId":activeRecordId}}})();let deliveredUpdate=liftSessionUpdateTimestamp(updateWithRecordId);observeAcpToolResultProjection(update,projectedUpdate,sessionId,deliveredUpdate);if(limits){const updateCount=updates.length+1;if(updateCount>limits.maxUpdates){throw new HistoryReplayLimitError(sessionId,"updates",updateCount,limits.maxUpdates)}let updateBytes=(updates.length===0?0:1)+Buffer2.byteLength(JSON.stringify(deliveredUpdate),"utf8");if(serializedUpdateBytes+updateBytes>limits.maxBytes){for(let i=0;i<updates.length&&serializedUpdateBytes+updateBytes>limits.maxBytes;i++){const blanked=blankReplayedMcpAppHtml(updates[i]);if(blanked===void 0)continue;serializedUpdateBytes-=Buffer2.byteLength(JSON.stringify(updates[i]),"utf8")-Buffer2.byteLength(JSON.stringify(blanked),"utf8");updates[i]=blanked}if(serializedUpdateBytes+updateBytes>limits.maxBytes){const blanked=blankReplayedMcpAppHtml(deliveredUpdate);if(blanked!==void 0){deliveredUpdate=blanked;updateBytes=(updates.length===0?0:1)+Buffer2.byteLength(JSON.stringify(blanked),"utf8")}}}serializedUpdateBytes+=updateBytes;if(serializedUpdateBytes>limits.maxBytes){throw new HistoryReplayLimitError(sessionId,"bytes",serializedUpdateBytes,limits.maxBytes)}}updates.push(deliveredUpdate)},"sendUpdate"),setActiveRecordId:__name(recordId=>{activeRecordId=recordId},"setActiveRecordId"),cumulativeUsage,...config?{config}:{}}}__name(replayContext,"replayContext");async function collectHistoryReplayUpdates({sessionId,config,records,gaps,cumulativeUsage,logger,replayState,goalBootstrap,limits,suppressRestoreAskUserQuestion,finalizeDangling,branchPointsByAssistantUuid}){const updates=[];let replayError;try{const initial=parseTranscriptReplayState(replayState,logger);let skipFinalizeCallIds;if(suppressRestoreAskUserQuestion!==true&&config?.getRestoreAskUserQuestion?.()===true){const replayClient=config.getLlmClient?.();const lastHistoryContent=replayClient?.isInitialized?.()===true?replayClient.getChat?.()?.peekLastHistoryEntry?.()??lastHistoryContentFromRecords(records):lastHistoryContentFromRecords(records);skipFinalizeCallIds=restorableAskUserQuestionCallIds(lastHistoryContent)}await new HistoryReplayer(replayContext(sessionId,updates,cumulativeUsage,config,limits)).replay(records,gaps,{...initial.goalState?{initialGoalState:initial.goalState}:{},...initial.goalCause?{initialGoalCause:initial.goalCause}:{},...goalBootstrap?{goalBootstrap}:{},...skipFinalizeCallIds?{skipFinalizeCallIds}:{},...finalizeDangling===void 0?{}:{finalizeDangling}})}catch(error){if(error instanceof HistoryReplayLimitError)throw error;replayError=error instanceof Error?error.message:String(error);logger?.warn("[historyReplay] History replay failed for session %s (partial updates: %d):",sessionId,updates.length,error)}if(branchPointsByAssistantUuid){stampBranchPoints(updates,branchPointsByAssistantUuid)}return replayError===void 0?{updates}:{updates,replayError}}__name(collectHistoryReplayUpdates,"collectHistoryReplayUpdates");function liftSessionUpdateTimestamp(update){const record=update;const meta=record["_meta"];const timestamp=isObjectRecord2(meta)?meta["timestamp"]:void 0;return typeof timestamp==="number"||typeof timestamp==="string"?{...record,timestamp}:update}__name(liftSessionUpdateTimestamp,"liftSessionUpdateTimestamp");function readTranscriptSourceRecordIds(update){const value=update;const meta=value["_meta"]&&typeof value["_meta"]==="object"?value["_meta"]:void 0;const transcript=meta?.["qwenTranscript"]&&typeof meta["qwenTranscript"]==="object"?meta["qwenTranscript"]:void 0;const sourceRecordIds=transcript?.["sourceRecordIds"];if(!Array.isArray(sourceRecordIds))return void 0;return sourceRecordIds.filter(id=>typeof id==="string")}__name(readTranscriptSourceRecordIds,"readTranscriptSourceRecordIds");function stampBranchPoints(updates,branchPoints){const lastChunkIndexByRecordId=new Map;updates.forEach((update,index)=>{if(update.sessionUpdate!=="agent_message_chunk")return;const text=update.content?.text;if(typeof text!=="string"||text.length===0)return;for(const recordId of readTranscriptSourceRecordIds(update)??[]){if(Object.hasOwn(branchPoints,recordId)){lastChunkIndexByRecordId.set(recordId,index)}}});const decoratedIndexes=new Set;for(const[recordId,index]of lastChunkIndexByRecordId){if(decoratedIndexes.has(index))continue;decoratedIndexes.add(index);const value=updates[index];const meta=value["_meta"]&&typeof value["_meta"]==="object"?value["_meta"]:void 0;const transcript=meta?.["qwenTranscript"]&&typeof meta["qwenTranscript"]==="object"?meta["qwenTranscript"]:void 0;value["_meta"]={...meta,qwenTranscript:{...transcript,branchRecordId:branchPoints[recordId]}}}}__name(stampBranchPoints,"stampBranchPoints");async function replayTranscriptRecordPage({sessionId,page,config,encodeCursor,logger,finalizeDangling=true}){const state=parseTranscriptReplayState(page.replay,logger);const updates=[];const replayer=new HistoryReplayer(replayContext(sessionId,updates,state.cumulativeUsage,config));let replayState;let replayError;try{const replayPageState=await replayer.replayPage(page.records,{pendingToolCalls:page.direction==="backward"?[]:state.pendingToolCalls,finalizeDangling:finalizeDangling&&(page.direction==="backward"||!page.hasMore),gaps:page.gaps,includeTiming:true,...state.goalState?{goalState:state.goalState}:{},...state.goalCause?{goalCause:state.goalCause}:{}});replayState=replayPageState.replay}catch(error){logger?.warn("[historyReplay] Paged history replay failed for session %s (partial updates: %d):",sessionId,updates.length,error);replayState=replayer.getReplayState();replayError="Replay conversion failed for this page"}if(page.branchPointsByAssistantUuid){stampBranchPoints(updates,page.branchPointsByAssistantUuid)}const nextCursor=page.nextCursorState&&replayError===void 0?encodeCursor({...page.nextCursorState,...page.direction==="backward"?{}:{replay:replayState}}):void 0;return{updates,...nextCursor?{nextCursor}:{},hasMore:replayError===void 0&&page.hasMore,startTime:page.startTime,lastUpdated:page.lastUpdated,...replayError?{partial:true,replayError}:{}}}__name(replayTranscriptRecordPage,"replayTranscriptRecordPage");export{createWorkspaceMemoryExtractionErrorLogger,extractRememberErrorCode,workspaceMemoryFailureCode,shouldSuppressRememberErrorDetails,workspaceMemoryFailureDiagnostics,MAX_REMEMBER_CONTENT_BYTES,formatWorkspaceMemoryForgetSummary,formatWorkspaceMemoryDreamSummary,isValidServerName,GENERATION_MAX_PROMPT_BYTES,GENERATION_TIMEOUT_MS,executeGeneration,projectAcpToolResultUpdate,HistoryReplayLimitError,createReplayCumulativeUsage,copyCumulativeUsage,degradeReplayEnvelopeAppHtml,collectHistoryReplayUpdates,replayTranscriptRecordPage};
|
|
4
4
|
/**
|
|
5
5
|
* @license
|
|
6
6
|
* Copyright 2026 Qwen Team
|