@namzu/cli 50.0.0 → 50.1.0
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/CHANGELOG.md +19 -0
- package/dist/bin.js +1 -1
- package/dist/chunks/{acp-GX5C46FS.js → acp-PFKCDYRZ.js} +279 -51
- package/dist/chunks/acp-PFKCDYRZ.js.map +6 -0
- package/dist/chunks/{activity-command-ALROOYA2.js → activity-command-VZNRTS4Y.js} +12 -12
- package/dist/chunks/{add-Y24XHCJZ.js → add-ILOY57M3.js} +19 -19
- package/dist/chunks/{agent-2UGJH5L2.js → agent-7XMB6YDL.js} +35 -35
- package/dist/chunks/agent-session-EJPBND2I.js +69 -0
- package/dist/chunks/{archive-BQVBBILN.js → archive-YUJITQ3K.js} +10 -10
- package/dist/chunks/{bin-main-LFD4MFRZ.js → bin-main-QQCDUNOU.js} +7 -7
- package/dist/chunks/{binding-7QVD3QFS.js → binding-QXY72MYE.js} +3 -3
- package/dist/chunks/{browser-L7XFOCFR.js → browser-T5M3N46O.js} +6 -6
- package/dist/chunks/{chat-J4HA4DHS.js → chat-H6P7555R.js} +15 -15
- package/dist/chunks/{chunk-RKYDGWUF.js → chunk-2BMVENUB.js} +2 -2
- package/dist/chunks/{chunk-F4HPFCP7.js → chunk-2FQ6QJIZ.js} +12 -12
- package/dist/chunks/{chunk-LMSDBH3N.js → chunk-424T6RL4.js} +2 -2
- package/dist/chunks/{chunk-7DITWYWT.js → chunk-45PI33XV.js} +3 -3
- package/dist/chunks/{chunk-YCJW5A7U.js → chunk-4IP74K5V.js} +2 -2
- package/dist/chunks/{chunk-N5H6BXSH.js → chunk-56WREK7X.js} +2 -2
- package/dist/chunks/{chunk-5XCRTM5D.js → chunk-57EJUGDT.js} +3 -3
- package/dist/chunks/{chunk-64LJS5ED.js → chunk-5WSDPQ3D.js} +4 -4
- package/dist/chunks/{chunk-3JUVHVOX.js → chunk-6X3NKVRL.js} +4 -4
- package/dist/chunks/{chunk-NIT2OAFM.js → chunk-7VXBUWVA.js} +2 -2
- package/dist/chunks/{chunk-TBQ7SPXV.js → chunk-AKXUNA4X.js} +6 -6
- package/dist/chunks/{chunk-24ZRB5EE.js → chunk-BIDU2JUB.js} +2 -2
- package/dist/chunks/{chunk-7F67RLOJ.js → chunk-C2PBNQYT.js} +10 -10
- package/dist/chunks/{chunk-IVBQSIVS.js → chunk-CFCULKSN.js} +2 -2
- package/dist/chunks/{chunk-K2JXGE24.js → chunk-CPWGSBBN.js} +3 -3
- package/dist/chunks/{chunk-VKYRVAQ4.js → chunk-CR23VYUE.js} +13 -13
- package/dist/chunks/{chunk-4DPAL2SS.js → chunk-D7W5LUXV.js} +3 -3
- package/dist/chunks/{chunk-YXWJD4GH.js → chunk-E6BNHEYX.js} +2 -2
- package/dist/chunks/{chunk-FLCSG33P.js → chunk-EPDDCCV5.js} +2 -2
- package/dist/chunks/{chunk-EMXHURNA.js → chunk-FGEJOOL4.js} +3 -3
- package/dist/chunks/{chunk-AVNUJT7M.js → chunk-FIIZZRMV.js} +3 -3
- package/dist/chunks/{chunk-QQZXB3E7.js → chunk-FM2QPMPK.js} +2 -2
- package/dist/chunks/{chunk-2QCCSP7N.js → chunk-FXAHVRUE.js} +3 -3
- package/dist/chunks/{chunk-I3CWCFIT.js → chunk-G5OCRPZF.js} +2 -2
- package/dist/chunks/{chunk-KWLUYAKG.js → chunk-GKPO6EGA.js} +2 -2
- package/dist/chunks/{chunk-VGUQOYPZ.js → chunk-GL6KSVMS.js} +9 -9
- package/dist/chunks/{chunk-ZXW2TTMW.js → chunk-GN424XZ3.js} +7 -7
- package/dist/chunks/{chunk-FWHZB37G.js → chunk-GWXAAFPJ.js} +2 -2
- package/dist/chunks/{chunk-VTBS7NVT.js → chunk-HDOYZYBW.js} +3 -3
- package/dist/chunks/{chunk-DRNABAHW.js → chunk-HNVUVSOI.js} +2 -2
- package/dist/chunks/{chunk-VL6NOKJF.js → chunk-HUKEVKWH.js} +3 -3
- package/dist/chunks/{chunk-NCI44BJE.js → chunk-HYUVSO4X.js} +4 -4
- package/dist/chunks/{chunk-WPEFWFO6.js → chunk-HYWVPQQD.js} +4 -4
- package/dist/chunks/{chunk-TCC7QRSV.js → chunk-IQPD7KYD.js} +3 -3
- package/dist/chunks/{chunk-P32KIQBD.js → chunk-ITNMS75R.js} +2 -2
- package/dist/chunks/{chunk-52KOLFPS.js → chunk-IXDECEIX.js} +4 -4
- package/dist/chunks/{chunk-FKNLXK7P.js → chunk-IXNUPR24.js} +33 -33
- package/dist/chunks/{chunk-HAV2WF6U.js → chunk-IZHREIZK.js} +6 -6
- package/dist/chunks/{chunk-MBFYU4BQ.js → chunk-JGYCZO6C.js} +2 -2
- package/dist/chunks/{chunk-P2NS5JPG.js → chunk-JQUAYX3B.js} +5 -5
- package/dist/chunks/{chunk-36G4OU2T.js → chunk-K4PPNYXR.js} +2 -2
- package/dist/chunks/{chunk-62ZRTAHT.js → chunk-KKEWKJVL.js} +3 -3
- package/dist/chunks/{chunk-4YFO2Q4F.js → chunk-MAMV7MUG.js} +9 -9
- package/dist/chunks/{chunk-INFXJ66V.js → chunk-MIJGXF3Z.js} +2 -2
- package/dist/chunks/chunk-NVZRRJJS.js +113 -0
- package/dist/chunks/chunk-NVZRRJJS.js.map +6 -0
- package/dist/chunks/{chunk-PH7RYICR.js → chunk-NXRUXNJ5.js} +2 -2
- package/dist/chunks/{chunk-AZLMME5T.js → chunk-P2E6HFIP.js} +2 -2
- package/dist/chunks/{chunk-FMXRUVQ3.js → chunk-P7NXR4OV.js} +4 -4
- package/dist/chunks/{chunk-BHYTFZYY.js → chunk-PCW42R33.js} +5 -5
- package/dist/chunks/{chunk-ZK6GFS2K.js → chunk-QNIHTTLG.js} +3 -3
- package/dist/chunks/{chunk-PT7CAL4N.js → chunk-QPREGR6U.js} +4 -4
- package/dist/chunks/{chunk-H2WOQGLW.js → chunk-RGUF5E22.js} +4 -4
- package/dist/chunks/{chunk-T5GYOXPH.js → chunk-RSAB3MPL.js} +11 -11
- package/dist/chunks/{chunk-4OGB5U5E.js → chunk-RZ6PDAMQ.js} +2 -2
- package/dist/chunks/{chunk-M3FCCQWN.js → chunk-S4Q4PC2L.js} +49 -3
- package/dist/chunks/chunk-S4Q4PC2L.js.map +6 -0
- package/dist/chunks/{chunk-EK4LUV4L.js → chunk-SAJGEVVD.js} +3 -3
- package/dist/chunks/{chunk-GXYFKGXC.js → chunk-SB3GBZ65.js} +3 -3
- package/dist/chunks/{chunk-O4RW4C5Q.js → chunk-SECKALTU.js} +2 -2
- package/dist/chunks/{chunk-3L3NHBFB.js → chunk-SFGTJCGU.js} +2 -2
- package/dist/chunks/{chunk-YXOWGENA.js → chunk-SSPDO3JT.js} +9 -9
- package/dist/chunks/{chunk-GL3SCBU5.js → chunk-SVB7IHBE.js} +3 -3
- package/dist/chunks/{chunk-BPKOUPPI.js → chunk-T2DRSTJV.js} +2 -2
- package/dist/chunks/{chunk-WSRGGVIM.js → chunk-T4BQXXZS.js} +5 -5
- package/dist/chunks/{chunk-DPS5H6YZ.js → chunk-UARXWUZO.js} +4 -4
- package/dist/chunks/{chunk-EKLFUD76.js → chunk-UBB7EIHC.js} +3 -3
- package/dist/chunks/{chunk-FELRB5DJ.js → chunk-URBIMXZN.js} +6 -6
- package/dist/chunks/{chunk-7L4LWYJL.js → chunk-UXXV6VCO.js} +3 -3
- package/dist/chunks/{chunk-P5BRE34M.js → chunk-VQ7FOO7M.js} +2 -2
- package/dist/chunks/{chunk-UI7WXHQL.js → chunk-WKW65PAC.js} +2 -2
- package/dist/chunks/{chunk-NBGCCPO2.js → chunk-WTMP5H7T.js} +4 -4
- package/dist/chunks/{chunk-M4CILTGF.js → chunk-XC6UYANY.js} +2 -2
- package/dist/chunks/{chunk-EQ6W5RYI.js → chunk-XXHZE4KV.js} +2 -2
- package/dist/chunks/{chunk-DPFRJK3R.js → chunk-Y22AUU3X.js} +4 -4
- package/dist/chunks/{chunk-4ZJEPJXK.js → chunk-Z3DTGVZS.js} +52 -34
- package/dist/chunks/chunk-Z3DTGVZS.js.map +6 -0
- package/dist/chunks/{chunk-S4YTXJTD.js → chunk-ZE6HLPD4.js} +766 -334
- package/dist/chunks/chunk-ZE6HLPD4.js.map +6 -0
- package/dist/chunks/{chunk-4E2XEBCA.js → chunk-ZJKISI2K.js} +4 -4
- package/dist/chunks/{cli-runtime-JHNUAZGX.js → cli-runtime-JXRGA4O7.js} +11 -11
- package/dist/chunks/{commands-QIB5PR4U.js → commands-3K6WWRUN.js} +5 -5
- package/dist/chunks/{crash-report-YKBMAI2C.js → crash-report-NTEADY4P.js} +6 -6
- package/dist/chunks/{dist-JU77OEQV.js → dist-43NXQHZ2.js} +2 -2
- package/dist/chunks/{dist-HX4CMQP7.js → dist-5ZAKSBZS.js} +2 -2
- package/dist/chunks/{dist-YKDCCBQG.js → dist-CRT6EQAR.js} +2 -2
- package/dist/chunks/{dist-BO4BUR4Z.js → dist-EHAGNOTG.js} +2 -2
- package/dist/chunks/{dist-OS52BKDN.js → dist-G2QITXMW.js} +2 -2
- package/dist/chunks/{dist-ONV5YXBC.js → dist-VEUKVTZP.js} +2 -2
- package/dist/chunks/{dist-TFGK7OXW.js → dist-WDRMCFAU.js} +2 -2
- package/dist/chunks/{dist-EGQG2CWK.js → dist-Z2QVC4OK.js} +2 -2
- package/dist/chunks/{doctor-GILJT2C6.js → doctor-UVX6YR2I.js} +16 -16
- package/dist/chunks/{drain-A65DSXV5.js → drain-URR6CUUH.js} +9 -9
- package/dist/chunks/{entry-S4CXG3N4.js → entry-WCWSORA2.js} +6 -6
- package/dist/chunks/{eval-7JFPRH2Z.js → eval-Y6FUUDCX.js} +2 -2
- package/dist/chunks/{exec-JKYNWA4S.js → exec-5BUTAYMJ.js} +34 -34
- package/dist/chunks/{home-TD3AGJSX.js → home-HDE3CFLB.js} +3 -3
- package/dist/chunks/{host-MRXWMOJP.js → host-TZ6GSDWP.js} +10 -10
- package/dist/chunks/{host-queries-77N4N7XL.js → host-queries-Y7A4XJ64.js} +15 -15
- package/dist/chunks/{learn-EEKKNN7B.js → learn-GYBZNIT3.js} +11 -11
- package/dist/chunks/{learn-builtin-DGQW6ZJ3.js → learn-builtin-EJXTHMX6.js} +14 -14
- package/dist/chunks/{lifecycle-5QSLVTIZ.js → lifecycle-5EM2QRFV.js} +28 -28
- package/dist/chunks/{list-G525YHRP.js → list-M34JU5AG.js} +11 -11
- package/dist/chunks/{live-Z4LVRXQJ.js → live-XMBIOII4.js} +15 -15
- package/dist/chunks/{login-V6COXMPE.js → login-NI3DFWOW.js} +13 -13
- package/dist/chunks/{logs-NM5XSBZ2.js → logs-OI6GZRRC.js} +4 -4
- package/dist/chunks/{mcp-NTFOOPLS.js → mcp-FK3OBBSJ.js} +29 -117
- package/dist/chunks/mcp-FK3OBBSJ.js.map +6 -0
- package/dist/chunks/{message-command-BBICY3ZH.js → message-command-CIYB47HZ.js} +41 -41
- package/dist/chunks/{open-EO6BERGC.js → open-XYGGZHXM.js} +8 -8
- package/dist/chunks/{operator-tools-EKYFPXNP.js → operator-tools-QSZS57PI.js} +13 -13
- package/dist/chunks/{output-schema-4QBMG2V3.js → output-schema-BTNJ6DL5.js} +3 -3
- package/dist/chunks/{pal-GGEP7A3C.js → pal-EQAAJBWP.js} +16 -16
- package/dist/chunks/{peers-XABPXXYU.js → peers-35H6CZOZ.js} +7 -7
- package/dist/chunks/{peers-NEFTEGGH.js → peers-KN4BGJHU.js} +6 -6
- package/dist/chunks/{providers-UR7PTSAU.js → providers-I2GONE3C.js} +11 -11
- package/dist/chunks/{pty-E6LOL7FL.js → pty-GZ4R2DCS.js} +3 -3
- package/dist/chunks/resume-4KW4GUYR.js +23 -0
- package/dist/chunks/{resume-command-SK376EH7.js → resume-command-TOAGIGZO.js} +4 -4
- package/dist/chunks/{schedule-LMZSBVLA.js → schedule-FU5WY3WV.js} +8 -8
- package/dist/chunks/{service-LXGEJ7SQ.js → service-3UYEV4JX.js} +28 -28
- package/dist/chunks/{skills-LKMGHUON.js → skills-4V2SBEY3.js} +8 -8
- package/dist/chunks/{start-check-VOPUK6AT.js → start-check-RBYWVZT4.js} +2 -2
- package/dist/chunks/{startup-failure-EICFG4GV.js → startup-failure-SST73T7Q.js} +2 -2
- package/dist/chunks/{state-JOIMBJVN.js → state-N46ZI3LZ.js} +2 -2
- package/dist/chunks/{store-ZZNUM66U.js → store-KA6NETSP.js} +3 -3
- package/dist/chunks/{store-JPIWK3PM.js → store-M56FSIZT.js} +6 -6
- package/dist/chunks/{store-CJQTON4J.js → store-R662Y2YQ.js} +10 -10
- package/dist/chunks/{store-22R5VPTI.js → store-RHAHG45U.js} +4 -4
- package/dist/chunks/{tui-7GUHLL4B.js → tui-TJNH67YO.js} +210 -177
- package/dist/chunks/tui-TJNH67YO.js.map +6 -0
- package/dist/chunks/{upgrade-WX6LVKEZ.js → upgrade-YNYPRYFI.js} +7 -7
- package/dist/chunks/{workspaces-LSNFONMM.js → workspaces-OITS2AZJ.js} +16 -16
- package/dist/chunks/{worktree-FPCQFFLT.js → worktree-DJW4XCBG.js} +12 -12
- package/dist/commands/acp.d.ts +14 -1
- package/dist/commands/acp.d.ts.map +1 -1
- package/dist/commands/desktop-host.d.ts +32 -0
- package/dist/commands/desktop-host.d.ts.map +1 -1
- package/dist/commands/desktop-outcome-feed.d.ts +36 -0
- package/dist/commands/desktop-outcome-feed.d.ts.map +1 -0
- package/dist/index.js +19 -19
- package/dist/integrations/mcp/server-listing.d.ts +53 -0
- package/dist/integrations/mcp/server-listing.d.ts.map +1 -0
- package/dist/integrations/sessions/checkpoint-view.d.ts.map +1 -1
- package/dist/tui/index.d.ts.map +1 -1
- package/dist/tui/paste-marker-guard.d.ts +77 -0
- package/dist/tui/paste-marker-guard.d.ts.map +1 -0
- package/package.json +4 -4
- package/dist/chunks/acp-GX5C46FS.js.map +0 -6
- package/dist/chunks/agent-session-UQXPM43X.js +0 -69
- package/dist/chunks/chunk-4ZJEPJXK.js.map +0 -6
- package/dist/chunks/chunk-M3FCCQWN.js.map +0 -6
- package/dist/chunks/chunk-S4YTXJTD.js.map +0 -6
- package/dist/chunks/mcp-NTFOOPLS.js.map +0 -6
- package/dist/chunks/resume-YVCJLRJM.js +0 -23
- package/dist/chunks/tui-7GUHLL4B.js.map +0 -6
- /package/dist/chunks/{activity-command-ALROOYA2.js.map → activity-command-VZNRTS4Y.js.map} +0 -0
- /package/dist/chunks/{add-Y24XHCJZ.js.map → add-ILOY57M3.js.map} +0 -0
- /package/dist/chunks/{agent-2UGJH5L2.js.map → agent-7XMB6YDL.js.map} +0 -0
- /package/dist/chunks/{agent-session-UQXPM43X.js.map → agent-session-EJPBND2I.js.map} +0 -0
- /package/dist/chunks/{archive-BQVBBILN.js.map → archive-YUJITQ3K.js.map} +0 -0
- /package/dist/chunks/{bin-main-LFD4MFRZ.js.map → bin-main-QQCDUNOU.js.map} +0 -0
- /package/dist/chunks/{binding-7QVD3QFS.js.map → binding-QXY72MYE.js.map} +0 -0
- /package/dist/chunks/{browser-L7XFOCFR.js.map → browser-T5M3N46O.js.map} +0 -0
- /package/dist/chunks/{chat-J4HA4DHS.js.map → chat-H6P7555R.js.map} +0 -0
- /package/dist/chunks/{chunk-RKYDGWUF.js.map → chunk-2BMVENUB.js.map} +0 -0
- /package/dist/chunks/{chunk-F4HPFCP7.js.map → chunk-2FQ6QJIZ.js.map} +0 -0
- /package/dist/chunks/{chunk-LMSDBH3N.js.map → chunk-424T6RL4.js.map} +0 -0
- /package/dist/chunks/{chunk-7DITWYWT.js.map → chunk-45PI33XV.js.map} +0 -0
- /package/dist/chunks/{chunk-YCJW5A7U.js.map → chunk-4IP74K5V.js.map} +0 -0
- /package/dist/chunks/{chunk-N5H6BXSH.js.map → chunk-56WREK7X.js.map} +0 -0
- /package/dist/chunks/{chunk-5XCRTM5D.js.map → chunk-57EJUGDT.js.map} +0 -0
- /package/dist/chunks/{chunk-64LJS5ED.js.map → chunk-5WSDPQ3D.js.map} +0 -0
- /package/dist/chunks/{chunk-3JUVHVOX.js.map → chunk-6X3NKVRL.js.map} +0 -0
- /package/dist/chunks/{chunk-NIT2OAFM.js.map → chunk-7VXBUWVA.js.map} +0 -0
- /package/dist/chunks/{chunk-TBQ7SPXV.js.map → chunk-AKXUNA4X.js.map} +0 -0
- /package/dist/chunks/{chunk-24ZRB5EE.js.map → chunk-BIDU2JUB.js.map} +0 -0
- /package/dist/chunks/{chunk-7F67RLOJ.js.map → chunk-C2PBNQYT.js.map} +0 -0
- /package/dist/chunks/{chunk-IVBQSIVS.js.map → chunk-CFCULKSN.js.map} +0 -0
- /package/dist/chunks/{chunk-K2JXGE24.js.map → chunk-CPWGSBBN.js.map} +0 -0
- /package/dist/chunks/{chunk-VKYRVAQ4.js.map → chunk-CR23VYUE.js.map} +0 -0
- /package/dist/chunks/{chunk-4DPAL2SS.js.map → chunk-D7W5LUXV.js.map} +0 -0
- /package/dist/chunks/{chunk-YXWJD4GH.js.map → chunk-E6BNHEYX.js.map} +0 -0
- /package/dist/chunks/{chunk-FLCSG33P.js.map → chunk-EPDDCCV5.js.map} +0 -0
- /package/dist/chunks/{chunk-EMXHURNA.js.map → chunk-FGEJOOL4.js.map} +0 -0
- /package/dist/chunks/{chunk-AVNUJT7M.js.map → chunk-FIIZZRMV.js.map} +0 -0
- /package/dist/chunks/{chunk-QQZXB3E7.js.map → chunk-FM2QPMPK.js.map} +0 -0
- /package/dist/chunks/{chunk-2QCCSP7N.js.map → chunk-FXAHVRUE.js.map} +0 -0
- /package/dist/chunks/{chunk-I3CWCFIT.js.map → chunk-G5OCRPZF.js.map} +0 -0
- /package/dist/chunks/{chunk-KWLUYAKG.js.map → chunk-GKPO6EGA.js.map} +0 -0
- /package/dist/chunks/{chunk-VGUQOYPZ.js.map → chunk-GL6KSVMS.js.map} +0 -0
- /package/dist/chunks/{chunk-ZXW2TTMW.js.map → chunk-GN424XZ3.js.map} +0 -0
- /package/dist/chunks/{chunk-FWHZB37G.js.map → chunk-GWXAAFPJ.js.map} +0 -0
- /package/dist/chunks/{chunk-VTBS7NVT.js.map → chunk-HDOYZYBW.js.map} +0 -0
- /package/dist/chunks/{chunk-DRNABAHW.js.map → chunk-HNVUVSOI.js.map} +0 -0
- /package/dist/chunks/{chunk-VL6NOKJF.js.map → chunk-HUKEVKWH.js.map} +0 -0
- /package/dist/chunks/{chunk-NCI44BJE.js.map → chunk-HYUVSO4X.js.map} +0 -0
- /package/dist/chunks/{chunk-WPEFWFO6.js.map → chunk-HYWVPQQD.js.map} +0 -0
- /package/dist/chunks/{chunk-TCC7QRSV.js.map → chunk-IQPD7KYD.js.map} +0 -0
- /package/dist/chunks/{chunk-P32KIQBD.js.map → chunk-ITNMS75R.js.map} +0 -0
- /package/dist/chunks/{chunk-52KOLFPS.js.map → chunk-IXDECEIX.js.map} +0 -0
- /package/dist/chunks/{chunk-FKNLXK7P.js.map → chunk-IXNUPR24.js.map} +0 -0
- /package/dist/chunks/{chunk-HAV2WF6U.js.map → chunk-IZHREIZK.js.map} +0 -0
- /package/dist/chunks/{chunk-MBFYU4BQ.js.map → chunk-JGYCZO6C.js.map} +0 -0
- /package/dist/chunks/{chunk-P2NS5JPG.js.map → chunk-JQUAYX3B.js.map} +0 -0
- /package/dist/chunks/{chunk-36G4OU2T.js.map → chunk-K4PPNYXR.js.map} +0 -0
- /package/dist/chunks/{chunk-62ZRTAHT.js.map → chunk-KKEWKJVL.js.map} +0 -0
- /package/dist/chunks/{chunk-4YFO2Q4F.js.map → chunk-MAMV7MUG.js.map} +0 -0
- /package/dist/chunks/{chunk-INFXJ66V.js.map → chunk-MIJGXF3Z.js.map} +0 -0
- /package/dist/chunks/{chunk-PH7RYICR.js.map → chunk-NXRUXNJ5.js.map} +0 -0
- /package/dist/chunks/{chunk-AZLMME5T.js.map → chunk-P2E6HFIP.js.map} +0 -0
- /package/dist/chunks/{chunk-FMXRUVQ3.js.map → chunk-P7NXR4OV.js.map} +0 -0
- /package/dist/chunks/{chunk-BHYTFZYY.js.map → chunk-PCW42R33.js.map} +0 -0
- /package/dist/chunks/{chunk-ZK6GFS2K.js.map → chunk-QNIHTTLG.js.map} +0 -0
- /package/dist/chunks/{chunk-PT7CAL4N.js.map → chunk-QPREGR6U.js.map} +0 -0
- /package/dist/chunks/{chunk-H2WOQGLW.js.map → chunk-RGUF5E22.js.map} +0 -0
- /package/dist/chunks/{chunk-T5GYOXPH.js.map → chunk-RSAB3MPL.js.map} +0 -0
- /package/dist/chunks/{chunk-4OGB5U5E.js.map → chunk-RZ6PDAMQ.js.map} +0 -0
- /package/dist/chunks/{chunk-EK4LUV4L.js.map → chunk-SAJGEVVD.js.map} +0 -0
- /package/dist/chunks/{chunk-GXYFKGXC.js.map → chunk-SB3GBZ65.js.map} +0 -0
- /package/dist/chunks/{chunk-O4RW4C5Q.js.map → chunk-SECKALTU.js.map} +0 -0
- /package/dist/chunks/{chunk-3L3NHBFB.js.map → chunk-SFGTJCGU.js.map} +0 -0
- /package/dist/chunks/{chunk-YXOWGENA.js.map → chunk-SSPDO3JT.js.map} +0 -0
- /package/dist/chunks/{chunk-GL3SCBU5.js.map → chunk-SVB7IHBE.js.map} +0 -0
- /package/dist/chunks/{chunk-BPKOUPPI.js.map → chunk-T2DRSTJV.js.map} +0 -0
- /package/dist/chunks/{chunk-WSRGGVIM.js.map → chunk-T4BQXXZS.js.map} +0 -0
- /package/dist/chunks/{chunk-DPS5H6YZ.js.map → chunk-UARXWUZO.js.map} +0 -0
- /package/dist/chunks/{chunk-EKLFUD76.js.map → chunk-UBB7EIHC.js.map} +0 -0
- /package/dist/chunks/{chunk-FELRB5DJ.js.map → chunk-URBIMXZN.js.map} +0 -0
- /package/dist/chunks/{chunk-7L4LWYJL.js.map → chunk-UXXV6VCO.js.map} +0 -0
- /package/dist/chunks/{chunk-P5BRE34M.js.map → chunk-VQ7FOO7M.js.map} +0 -0
- /package/dist/chunks/{chunk-UI7WXHQL.js.map → chunk-WKW65PAC.js.map} +0 -0
- /package/dist/chunks/{chunk-NBGCCPO2.js.map → chunk-WTMP5H7T.js.map} +0 -0
- /package/dist/chunks/{chunk-M4CILTGF.js.map → chunk-XC6UYANY.js.map} +0 -0
- /package/dist/chunks/{chunk-EQ6W5RYI.js.map → chunk-XXHZE4KV.js.map} +0 -0
- /package/dist/chunks/{chunk-DPFRJK3R.js.map → chunk-Y22AUU3X.js.map} +0 -0
- /package/dist/chunks/{chunk-4E2XEBCA.js.map → chunk-ZJKISI2K.js.map} +0 -0
- /package/dist/chunks/{cli-runtime-JHNUAZGX.js.map → cli-runtime-JXRGA4O7.js.map} +0 -0
- /package/dist/chunks/{commands-QIB5PR4U.js.map → commands-3K6WWRUN.js.map} +0 -0
- /package/dist/chunks/{crash-report-YKBMAI2C.js.map → crash-report-NTEADY4P.js.map} +0 -0
- /package/dist/chunks/{dist-JU77OEQV.js.map → dist-43NXQHZ2.js.map} +0 -0
- /package/dist/chunks/{dist-HX4CMQP7.js.map → dist-5ZAKSBZS.js.map} +0 -0
- /package/dist/chunks/{dist-YKDCCBQG.js.map → dist-CRT6EQAR.js.map} +0 -0
- /package/dist/chunks/{dist-BO4BUR4Z.js.map → dist-EHAGNOTG.js.map} +0 -0
- /package/dist/chunks/{dist-OS52BKDN.js.map → dist-G2QITXMW.js.map} +0 -0
- /package/dist/chunks/{dist-ONV5YXBC.js.map → dist-VEUKVTZP.js.map} +0 -0
- /package/dist/chunks/{dist-TFGK7OXW.js.map → dist-WDRMCFAU.js.map} +0 -0
- /package/dist/chunks/{dist-EGQG2CWK.js.map → dist-Z2QVC4OK.js.map} +0 -0
- /package/dist/chunks/{doctor-GILJT2C6.js.map → doctor-UVX6YR2I.js.map} +0 -0
- /package/dist/chunks/{drain-A65DSXV5.js.map → drain-URR6CUUH.js.map} +0 -0
- /package/dist/chunks/{entry-S4CXG3N4.js.map → entry-WCWSORA2.js.map} +0 -0
- /package/dist/chunks/{eval-7JFPRH2Z.js.map → eval-Y6FUUDCX.js.map} +0 -0
- /package/dist/chunks/{exec-JKYNWA4S.js.map → exec-5BUTAYMJ.js.map} +0 -0
- /package/dist/chunks/{home-TD3AGJSX.js.map → home-HDE3CFLB.js.map} +0 -0
- /package/dist/chunks/{host-MRXWMOJP.js.map → host-TZ6GSDWP.js.map} +0 -0
- /package/dist/chunks/{host-queries-77N4N7XL.js.map → host-queries-Y7A4XJ64.js.map} +0 -0
- /package/dist/chunks/{learn-EEKKNN7B.js.map → learn-GYBZNIT3.js.map} +0 -0
- /package/dist/chunks/{learn-builtin-DGQW6ZJ3.js.map → learn-builtin-EJXTHMX6.js.map} +0 -0
- /package/dist/chunks/{lifecycle-5QSLVTIZ.js.map → lifecycle-5EM2QRFV.js.map} +0 -0
- /package/dist/chunks/{list-G525YHRP.js.map → list-M34JU5AG.js.map} +0 -0
- /package/dist/chunks/{live-Z4LVRXQJ.js.map → live-XMBIOII4.js.map} +0 -0
- /package/dist/chunks/{login-V6COXMPE.js.map → login-NI3DFWOW.js.map} +0 -0
- /package/dist/chunks/{logs-NM5XSBZ2.js.map → logs-OI6GZRRC.js.map} +0 -0
- /package/dist/chunks/{message-command-BBICY3ZH.js.map → message-command-CIYB47HZ.js.map} +0 -0
- /package/dist/chunks/{open-EO6BERGC.js.map → open-XYGGZHXM.js.map} +0 -0
- /package/dist/chunks/{operator-tools-EKYFPXNP.js.map → operator-tools-QSZS57PI.js.map} +0 -0
- /package/dist/chunks/{output-schema-4QBMG2V3.js.map → output-schema-BTNJ6DL5.js.map} +0 -0
- /package/dist/chunks/{pal-GGEP7A3C.js.map → pal-EQAAJBWP.js.map} +0 -0
- /package/dist/chunks/{peers-XABPXXYU.js.map → peers-35H6CZOZ.js.map} +0 -0
- /package/dist/chunks/{peers-NEFTEGGH.js.map → peers-KN4BGJHU.js.map} +0 -0
- /package/dist/chunks/{providers-UR7PTSAU.js.map → providers-I2GONE3C.js.map} +0 -0
- /package/dist/chunks/{pty-E6LOL7FL.js.map → pty-GZ4R2DCS.js.map} +0 -0
- /package/dist/chunks/{resume-YVCJLRJM.js.map → resume-4KW4GUYR.js.map} +0 -0
- /package/dist/chunks/{resume-command-SK376EH7.js.map → resume-command-TOAGIGZO.js.map} +0 -0
- /package/dist/chunks/{schedule-LMZSBVLA.js.map → schedule-FU5WY3WV.js.map} +0 -0
- /package/dist/chunks/{service-LXGEJ7SQ.js.map → service-3UYEV4JX.js.map} +0 -0
- /package/dist/chunks/{skills-LKMGHUON.js.map → skills-4V2SBEY3.js.map} +0 -0
- /package/dist/chunks/{start-check-VOPUK6AT.js.map → start-check-RBYWVZT4.js.map} +0 -0
- /package/dist/chunks/{startup-failure-EICFG4GV.js.map → startup-failure-SST73T7Q.js.map} +0 -0
- /package/dist/chunks/{state-JOIMBJVN.js.map → state-N46ZI3LZ.js.map} +0 -0
- /package/dist/chunks/{store-22R5VPTI.js.map → store-KA6NETSP.js.map} +0 -0
- /package/dist/chunks/{store-CJQTON4J.js.map → store-M56FSIZT.js.map} +0 -0
- /package/dist/chunks/{store-JPIWK3PM.js.map → store-R662Y2YQ.js.map} +0 -0
- /package/dist/chunks/{store-ZZNUM66U.js.map → store-RHAHG45U.js.map} +0 -0
- /package/dist/chunks/{upgrade-WX6LVKEZ.js.map → upgrade-YNYPRYFI.js.map} +0 -0
- /package/dist/chunks/{workspaces-LSNFONMM.js.map → workspaces-OITS2AZJ.js.map} +0 -0
- /package/dist/chunks/{worktree-FPCQFFLT.js.map → worktree-DJW4XCBG.js.map} +0 -0
|
@@ -325,7 +325,7 @@ var require_brace_expansion = __commonJS({
|
|
|
325
325
|
});
|
|
326
326
|
|
|
327
327
|
// ../sdk/dist/version.js
|
|
328
|
-
var VERSION = "62.
|
|
328
|
+
var VERSION = "62.8.0";
|
|
329
329
|
|
|
330
330
|
// ../sdk/dist/runtime/harness-session/index.js
|
|
331
331
|
import { posix, win32 } from "node:path";
|
|
@@ -5566,7 +5566,7 @@ var recursive = /* @__PURE__ */ new WeakMap();
|
|
|
5566
5566
|
var NONE = 0;
|
|
5567
5567
|
var ASSUMED = 1;
|
|
5568
5568
|
var PROVEN = 2;
|
|
5569
|
-
function isRecursive(inst, stack,
|
|
5569
|
+
function isRecursive(inst, stack, resolve37) {
|
|
5570
5570
|
const cached4 = recursive.get(inst);
|
|
5571
5571
|
if (cached4 !== void 0)
|
|
5572
5572
|
return cached4 ? PROVEN : NONE;
|
|
@@ -5576,7 +5576,7 @@ function isRecursive(inst, stack, resolve36) {
|
|
|
5576
5576
|
let result = NONE;
|
|
5577
5577
|
const check3 = /* @__PURE__ */ __name((child) => {
|
|
5578
5578
|
if (result !== PROVEN && child?._zod) {
|
|
5579
|
-
const answer = isRecursive(child, stack,
|
|
5579
|
+
const answer = isRecursive(child, stack, resolve37);
|
|
5580
5580
|
if (answer > result)
|
|
5581
5581
|
result = answer;
|
|
5582
5582
|
}
|
|
@@ -5587,7 +5587,7 @@ function isRecursive(inst, stack, resolve36) {
|
|
|
5587
5587
|
const desc = Object.getOwnPropertyDescriptor(sh, key6);
|
|
5588
5588
|
if (spread && !desc.enumerable)
|
|
5589
5589
|
continue;
|
|
5590
|
-
const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack,
|
|
5590
|
+
const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve37) : NONE;
|
|
5591
5591
|
if (child > answer)
|
|
5592
5592
|
answer = child;
|
|
5593
5593
|
}
|
|
@@ -5651,7 +5651,7 @@ function isRecursive(inst, stack, resolve36) {
|
|
|
5651
5651
|
break;
|
|
5652
5652
|
// `$ZodLazy` caches its inner on the def, so a resolved edge is followed exactly
|
|
5653
5653
|
case "lazy": {
|
|
5654
|
-
const inner = def._cachedInner ?? (
|
|
5654
|
+
const inner = def._cachedInner ?? (resolve37 ? inst._zod.innerType : void 0);
|
|
5655
5655
|
merge2(inner ? isRecursive(inner, stack, false) : ASSUMED);
|
|
5656
5656
|
break;
|
|
5657
5657
|
}
|
|
@@ -22262,10 +22262,10 @@ var ExternalHarnessSession = class {
|
|
|
22262
22262
|
}
|
|
22263
22263
|
}
|
|
22264
22264
|
makeActive(turnId6, operationId, startedAt) {
|
|
22265
|
-
let
|
|
22265
|
+
let resolve37;
|
|
22266
22266
|
let reject2;
|
|
22267
22267
|
const done = new Promise((yes, no) => {
|
|
22268
|
-
|
|
22268
|
+
resolve37 = yes;
|
|
22269
22269
|
reject2 = no;
|
|
22270
22270
|
});
|
|
22271
22271
|
void done.catch(() => void 0);
|
|
@@ -22275,7 +22275,7 @@ var ExternalHarnessSession = class {
|
|
|
22275
22275
|
startedAt,
|
|
22276
22276
|
items: /* @__PURE__ */ new Map(),
|
|
22277
22277
|
reviews: /* @__PURE__ */ new Map(),
|
|
22278
|
-
resolve:
|
|
22278
|
+
resolve: resolve37,
|
|
22279
22279
|
reject: reject2,
|
|
22280
22280
|
done
|
|
22281
22281
|
};
|
|
@@ -24457,13 +24457,13 @@ var GuardedFetchProvider = class {
|
|
|
24457
24457
|
operation.throwIfStopped();
|
|
24458
24458
|
return url2;
|
|
24459
24459
|
}
|
|
24460
|
-
const
|
|
24460
|
+
const resolve37 = this.config.resolve ?? (async (name2) => (await lookup(name2, { all: true })).map((r) => r.address));
|
|
24461
24461
|
let addresses;
|
|
24462
24462
|
if (isIP(hostname3)) {
|
|
24463
24463
|
addresses = [hostname3];
|
|
24464
24464
|
} else {
|
|
24465
24465
|
try {
|
|
24466
|
-
addresses = await operation.run(() =>
|
|
24466
|
+
addresses = await operation.run(() => resolve37(hostname3, operation.signal));
|
|
24467
24467
|
} catch (err) {
|
|
24468
24468
|
operation.throwIfStopped();
|
|
24469
24469
|
throw new WebFetchRefusedError(`Refused "${hostname3}" \u2014 it could not be resolved (${err instanceof Error ? err.message : String(err)}), so nothing here can say where it points.`, { url: rawUrl, reason: "private-address" });
|
|
@@ -24809,9 +24809,9 @@ async function vetWebSocketTarget(raw, options = {}) {
|
|
|
24809
24809
|
if (literal3 !== 0) {
|
|
24810
24810
|
addresses = [hostname3];
|
|
24811
24811
|
} else {
|
|
24812
|
-
const
|
|
24812
|
+
const resolve37 = options.resolve ?? (async (name2) => (await dnsLookup(name2, { all: true })).map((r) => r.address));
|
|
24813
24813
|
try {
|
|
24814
|
-
addresses = await
|
|
24814
|
+
addresses = await resolve37(hostname3);
|
|
24815
24815
|
} catch (err) {
|
|
24816
24816
|
throw new WebSocketRefusedError(`Refused "${hostname3}": it could not be resolved (${err instanceof Error ? err.message : String(err)}), so nothing here can say where it points.`);
|
|
24817
24817
|
}
|
|
@@ -25345,8 +25345,8 @@ var BackgroundJobRegistry = class {
|
|
|
25345
25345
|
};
|
|
25346
25346
|
let startError;
|
|
25347
25347
|
let settleStarted;
|
|
25348
|
-
const startedPromise = new Promise((
|
|
25349
|
-
settleStarted = /* @__PURE__ */ __name(() =>
|
|
25348
|
+
const startedPromise = new Promise((resolve37) => {
|
|
25349
|
+
settleStarted = /* @__PURE__ */ __name(() => resolve37(startError === void 0 ? {} : { error: startError }), "settleStarted");
|
|
25350
25350
|
});
|
|
25351
25351
|
if (params.spawn || child.pid !== void 0)
|
|
25352
25352
|
settleStarted();
|
|
@@ -25392,7 +25392,7 @@ var BackgroundJobRegistry = class {
|
|
|
25392
25392
|
outputChunks: [],
|
|
25393
25393
|
outputObservers: /* @__PURE__ */ new Set(),
|
|
25394
25394
|
started: startedPromise,
|
|
25395
|
-
exit: new Promise((
|
|
25395
|
+
exit: new Promise((resolve37) => {
|
|
25396
25396
|
let spawned = child.pid !== void 0;
|
|
25397
25397
|
let failedToSpawn = false;
|
|
25398
25398
|
let finalized = false;
|
|
@@ -25411,7 +25411,7 @@ var BackgroundJobRegistry = class {
|
|
|
25411
25411
|
...code === null ? {} : { exitCode: code },
|
|
25412
25412
|
...signal ? { signal } : {}
|
|
25413
25413
|
};
|
|
25414
|
-
|
|
25414
|
+
resolve37();
|
|
25415
25415
|
for (const observer of entry.outputObservers)
|
|
25416
25416
|
observer();
|
|
25417
25417
|
if (entry.monitor) {
|
|
@@ -25610,7 +25610,7 @@ var BackgroundJobRegistry = class {
|
|
|
25610
25610
|
const signal = opts.signal;
|
|
25611
25611
|
if (signal.aborted)
|
|
25612
25612
|
return Promise.reject(signal.reason);
|
|
25613
|
-
return new Promise((
|
|
25613
|
+
return new Promise((resolve37, reject2) => {
|
|
25614
25614
|
let disposeAbort = /* @__PURE__ */ __name(() => {
|
|
25615
25615
|
}, "disposeAbort");
|
|
25616
25616
|
const unsubscribe = this.onExit((job) => {
|
|
@@ -25618,7 +25618,7 @@ var BackgroundJobRegistry = class {
|
|
|
25618
25618
|
return;
|
|
25619
25619
|
unsubscribe();
|
|
25620
25620
|
disposeAbort();
|
|
25621
|
-
|
|
25621
|
+
resolve37(job);
|
|
25622
25622
|
});
|
|
25623
25623
|
disposeAbort = subscribeToAbort(signal, () => {
|
|
25624
25624
|
unsubscribe();
|
|
@@ -25715,7 +25715,7 @@ var BackgroundJobRegistry = class {
|
|
|
25715
25715
|
throw new BackgroundJobOutputWaitLimitError({ owner, limit: globalLimit, scope: "registry" });
|
|
25716
25716
|
this.outputWaiters++;
|
|
25717
25717
|
this.outputWaitersByOwner.set(owner, ownerCount + 1);
|
|
25718
|
-
return new Promise((
|
|
25718
|
+
return new Promise((resolve37) => {
|
|
25719
25719
|
const startedAt = Date.now();
|
|
25720
25720
|
let settled = false;
|
|
25721
25721
|
let disposeAbort = /* @__PURE__ */ __name(() => {
|
|
@@ -25735,7 +25735,7 @@ var BackgroundJobRegistry = class {
|
|
|
25735
25735
|
this.outputWaitersByOwner.delete(owner);
|
|
25736
25736
|
else
|
|
25737
25737
|
this.outputWaitersByOwner.set(owner, remaining);
|
|
25738
|
-
|
|
25738
|
+
resolve37(result);
|
|
25739
25739
|
}, "finish");
|
|
25740
25740
|
const timeout = /* @__PURE__ */ __name((cause) => {
|
|
25741
25741
|
read();
|
|
@@ -26514,7 +26514,7 @@ ${line}`;
|
|
|
26514
26514
|
stdout: true,
|
|
26515
26515
|
stderr: true
|
|
26516
26516
|
});
|
|
26517
|
-
return await new Promise((
|
|
26517
|
+
return await new Promise((resolve37) => {
|
|
26518
26518
|
let settled = false;
|
|
26519
26519
|
let terminal;
|
|
26520
26520
|
const inFlight = /* @__PURE__ */ new Set();
|
|
@@ -26529,7 +26529,7 @@ ${line}`;
|
|
|
26529
26529
|
clearTimeout(deadline);
|
|
26530
26530
|
options.signal?.removeEventListener("abort", onAbort);
|
|
26531
26531
|
void worker.terminate();
|
|
26532
|
-
|
|
26532
|
+
resolve37({ ...result, calls: [...calls] });
|
|
26533
26533
|
}, "finish");
|
|
26534
26534
|
const finishTerminalWhenHostCallsSettle = /* @__PURE__ */ __name(() => {
|
|
26535
26535
|
if (terminal && inFlight.size === 0)
|
|
@@ -28419,8 +28419,8 @@ ${body}`,
|
|
|
28419
28419
|
let timer;
|
|
28420
28420
|
await Promise.race([
|
|
28421
28421
|
Promise.allSettled([...inFlight]),
|
|
28422
|
-
new Promise((
|
|
28423
|
-
timer = setTimeout(
|
|
28422
|
+
new Promise((resolve37) => {
|
|
28423
|
+
timer = setTimeout(resolve37, grace);
|
|
28424
28424
|
})
|
|
28425
28425
|
]);
|
|
28426
28426
|
clearTimeout(timer);
|
|
@@ -30848,14 +30848,14 @@ var MCPReconnectSupervisor = class {
|
|
|
30848
30848
|
});
|
|
30849
30849
|
}
|
|
30850
30850
|
wait(ms) {
|
|
30851
|
-
return new Promise((
|
|
30851
|
+
return new Promise((resolve37) => {
|
|
30852
30852
|
const finish2 = /* @__PURE__ */ __name(() => {
|
|
30853
30853
|
if (this.timer)
|
|
30854
30854
|
clearTimeout(this.timer);
|
|
30855
30855
|
this.timer = void 0;
|
|
30856
30856
|
if (this.finishWait === finish2)
|
|
30857
30857
|
this.finishWait = void 0;
|
|
30858
|
-
|
|
30858
|
+
resolve37();
|
|
30859
30859
|
}, "finish");
|
|
30860
30860
|
this.finishWait = finish2;
|
|
30861
30861
|
this.timer = setTimeout(finish2, ms);
|
|
@@ -31976,7 +31976,7 @@ async function renameWithRetry(from, to) {
|
|
|
31976
31976
|
const code = err.code ?? "";
|
|
31977
31977
|
if (!CONTENDED.has(code) || attempt >= RENAME_ATTEMPTS)
|
|
31978
31978
|
throw err;
|
|
31979
|
-
await new Promise((
|
|
31979
|
+
await new Promise((resolve37) => setTimeout(resolve37, attempt));
|
|
31980
31980
|
}
|
|
31981
31981
|
}
|
|
31982
31982
|
}
|
|
@@ -32988,8 +32988,8 @@ var SessionGoalStoreBase = class {
|
|
|
32988
32988
|
sessions;
|
|
32989
32989
|
now;
|
|
32990
32990
|
makeGoalId;
|
|
32991
|
-
constructor(
|
|
32992
|
-
this.sessions =
|
|
32991
|
+
constructor(sessions2, now, makeGoalId) {
|
|
32992
|
+
this.sessions = sessions2;
|
|
32993
32993
|
this.now = now;
|
|
32994
32994
|
this.makeGoalId = makeGoalId;
|
|
32995
32995
|
}
|
|
@@ -34263,11 +34263,11 @@ async function teardownSandbox(sandbox, timeoutMs) {
|
|
|
34263
34263
|
return await operation;
|
|
34264
34264
|
let timer;
|
|
34265
34265
|
let timedOut;
|
|
34266
|
-
const deadline = new Promise((
|
|
34266
|
+
const deadline = new Promise((resolve37) => {
|
|
34267
34267
|
timer = setTimeout(() => {
|
|
34268
34268
|
timedOut = teardownTimeoutError(timeoutMs);
|
|
34269
34269
|
controller.abort(timedOut);
|
|
34270
|
-
|
|
34270
|
+
resolve37({ kind: "timed_out", error: timedOut });
|
|
34271
34271
|
}, timeoutMs);
|
|
34272
34272
|
});
|
|
34273
34273
|
try {
|
|
@@ -34295,20 +34295,20 @@ async function acquireSandbox(options) {
|
|
|
34295
34295
|
let timeoutError3;
|
|
34296
34296
|
let timer;
|
|
34297
34297
|
let onAbort;
|
|
34298
|
-
const aborted2 = new Promise((
|
|
34298
|
+
const aborted2 = new Promise((resolve37) => {
|
|
34299
34299
|
onAbort = /* @__PURE__ */ __name(() => {
|
|
34300
34300
|
operationController.abort(runSignal.reason);
|
|
34301
|
-
|
|
34301
|
+
resolve37({ kind: "cancelled" });
|
|
34302
34302
|
}, "onAbort");
|
|
34303
34303
|
runSignal.addEventListener("abort", onAbort, { once: true });
|
|
34304
34304
|
});
|
|
34305
|
-
const timedOut = new Promise((
|
|
34305
|
+
const timedOut = new Promise((resolve37) => {
|
|
34306
34306
|
if (options.timeoutMs === Number.POSITIVE_INFINITY)
|
|
34307
34307
|
return;
|
|
34308
34308
|
timer = setTimeout(() => {
|
|
34309
34309
|
timeoutError3 = acquisitionTimeoutError(options.timeoutMs);
|
|
34310
34310
|
operationController.abort(timeoutError3);
|
|
34311
|
-
|
|
34311
|
+
resolve37({ kind: "timed_out", error: timeoutError3 });
|
|
34312
34312
|
}, options.timeoutMs);
|
|
34313
34313
|
});
|
|
34314
34314
|
if (runSignal.aborted) {
|
|
@@ -40436,16 +40436,16 @@ function splitSentences(text9) {
|
|
|
40436
40436
|
return text9.split(/(?<=[.!?])\s+/).map((s) => s.trim()).filter((s) => s.length > 0);
|
|
40437
40437
|
}
|
|
40438
40438
|
__name(splitSentences, "splitSentences");
|
|
40439
|
-
function isSubstantive(
|
|
40440
|
-
return !/^(ok|okay|sure|alright|got it|understood|i see|great|perfect|excellent|good|nice|cool|right|yes|no|thanks)[.!?]*$/i.test(
|
|
40439
|
+
function isSubstantive(sentence2) {
|
|
40440
|
+
return !/^(ok|okay|sure|alright|got it|understood|i see|great|perfect|excellent|good|nice|cool|right|yes|no|thanks)[.!?]*$/i.test(sentence2);
|
|
40441
40441
|
}
|
|
40442
40442
|
__name(isSubstantive, "isSubstantive");
|
|
40443
|
-
function isLowSignalNote(
|
|
40444
|
-
return /^(?:we|i)(?: have|'ve)? (?:looked|taken a look|had a look) at (?:the |this )?(?:code|files?|repo(?:sitory)?|project)\.?$/i.test(
|
|
40443
|
+
function isLowSignalNote(sentence2) {
|
|
40444
|
+
return /^(?:we|i)(?: have|'ve)? (?:looked|taken a look|had a look) at (?:the |this )?(?:code|files?|repo(?:sitory)?|project)\.?$/i.test(sentence2);
|
|
40445
40445
|
}
|
|
40446
40446
|
__name(isLowSignalNote, "isLowSignalNote");
|
|
40447
|
-
function isExplicitAssistantDecision(
|
|
40448
|
-
return /^(?:(?:the|my|our) decision is\b|decision\s*:|(?:i|we)(?: have|'ve)? (?:decided|chose|chosen)\b)/i.test(
|
|
40447
|
+
function isExplicitAssistantDecision(sentence2) {
|
|
40448
|
+
return /^(?:(?:the|my|our) decision is\b|decision\s*:|(?:i|we)(?: have|'ve)? (?:decided|chose|chosen)\b)/i.test(sentence2);
|
|
40449
40449
|
}
|
|
40450
40450
|
__name(isExplicitAssistantDecision, "isExplicitAssistantDecision");
|
|
40451
40451
|
function truncateResult(result, maxLen) {
|
|
@@ -40574,11 +40574,11 @@ function extractFromAssistantMessage(manager, content, config2) {
|
|
|
40574
40574
|
const sentences = splitSentences(content);
|
|
40575
40575
|
const substantive = sentences.filter((s) => isSubstantive(s) && !isLowSignalNote(s));
|
|
40576
40576
|
const selected = substantive.slice(0, config2.maxSentencesPerTurn);
|
|
40577
|
-
for (const
|
|
40578
|
-
if (isExplicitAssistantDecision(
|
|
40579
|
-
manager.addDecision(truncateStateText(`Assistant stated: ${
|
|
40577
|
+
for (const sentence2 of selected) {
|
|
40578
|
+
if (isExplicitAssistantDecision(sentence2)) {
|
|
40579
|
+
manager.addDecision(truncateStateText(`Assistant stated: ${sentence2}`, config2.maxCharsPerNote));
|
|
40580
40580
|
} else {
|
|
40581
|
-
manager.addAssistantNote(
|
|
40581
|
+
manager.addAssistantNote(sentence2);
|
|
40582
40582
|
}
|
|
40583
40583
|
}
|
|
40584
40584
|
}
|
|
@@ -42127,6 +42127,82 @@ async function verifyPointer(bytes, pointer2) {
|
|
|
42127
42127
|
}
|
|
42128
42128
|
__name(verifyPointer, "verifyPointer");
|
|
42129
42129
|
|
|
42130
|
+
// ../sdk/dist/store/session-log/incremental.js
|
|
42131
|
+
var SESSIONS_KEPT = 4;
|
|
42132
|
+
var sessions = /* @__PURE__ */ new Map();
|
|
42133
|
+
function keptFor(sessionId5, key6) {
|
|
42134
|
+
let reductions = sessions.get(sessionId5);
|
|
42135
|
+
if (reductions === void 0) {
|
|
42136
|
+
reductions = /* @__PURE__ */ new Map();
|
|
42137
|
+
if (sessions.size >= SESSIONS_KEPT) {
|
|
42138
|
+
const oldest = sessions.keys().next().value;
|
|
42139
|
+
if (oldest !== void 0)
|
|
42140
|
+
sessions.delete(oldest);
|
|
42141
|
+
}
|
|
42142
|
+
} else {
|
|
42143
|
+
sessions.delete(sessionId5);
|
|
42144
|
+
}
|
|
42145
|
+
sessions.set(sessionId5, reductions);
|
|
42146
|
+
let kept = reductions.get(key6);
|
|
42147
|
+
if (kept === void 0) {
|
|
42148
|
+
kept = { state: void 0, anchor: void 0, turn: Promise.resolve() };
|
|
42149
|
+
reductions.set(key6, kept);
|
|
42150
|
+
}
|
|
42151
|
+
return kept;
|
|
42152
|
+
}
|
|
42153
|
+
__name(keptFor, "keptFor");
|
|
42154
|
+
async function foldSessionLog(log, fold4) {
|
|
42155
|
+
const kept = keptFor(log.sessionId, `${fold4.name}:${fold4.mode}`);
|
|
42156
|
+
const run2 = /* @__PURE__ */ __name(async () => {
|
|
42157
|
+
let state = kept.state;
|
|
42158
|
+
let anchor2 = kept.anchor;
|
|
42159
|
+
for (let attempt = 0; attempt < 2; attempt++) {
|
|
42160
|
+
const resuming = state !== void 0 && anchor2 !== void 0;
|
|
42161
|
+
if (!resuming) {
|
|
42162
|
+
state = fold4.create();
|
|
42163
|
+
anchor2 = void 0;
|
|
42164
|
+
}
|
|
42165
|
+
let moved = false;
|
|
42166
|
+
try {
|
|
42167
|
+
const walk2 = log.read({ mode: fold4.mode, ...anchor2 ? { after: anchor2 } : {} });
|
|
42168
|
+
let summary2;
|
|
42169
|
+
for (; ; ) {
|
|
42170
|
+
summary2 = await walk2.next();
|
|
42171
|
+
if (summary2.done)
|
|
42172
|
+
break;
|
|
42173
|
+
moved = true;
|
|
42174
|
+
fold4.apply(state, summary2.value);
|
|
42175
|
+
}
|
|
42176
|
+
const ended = summary2.value;
|
|
42177
|
+
if (resuming && !moved && ended.break?.reason === "anchor-mismatch") {
|
|
42178
|
+
kept.state = void 0;
|
|
42179
|
+
kept.anchor = void 0;
|
|
42180
|
+
state = void 0;
|
|
42181
|
+
anchor2 = void 0;
|
|
42182
|
+
continue;
|
|
42183
|
+
}
|
|
42184
|
+
kept.state = state;
|
|
42185
|
+
kept.anchor = ended.head?.pointer ?? anchor2;
|
|
42186
|
+
return await fold4.result(state);
|
|
42187
|
+
} catch (error62) {
|
|
42188
|
+
kept.state = void 0;
|
|
42189
|
+
kept.anchor = void 0;
|
|
42190
|
+
if (resuming && !moved && error62 instanceof SessionLogIntegrityError && error62.reason === "anchor-mismatch") {
|
|
42191
|
+
state = void 0;
|
|
42192
|
+
anchor2 = void 0;
|
|
42193
|
+
continue;
|
|
42194
|
+
}
|
|
42195
|
+
throw error62;
|
|
42196
|
+
}
|
|
42197
|
+
}
|
|
42198
|
+
throw new Error("unreachable");
|
|
42199
|
+
}, "run");
|
|
42200
|
+
const result = kept.turn.then(run2, run2);
|
|
42201
|
+
kept.turn = result.catch(() => void 0);
|
|
42202
|
+
return result;
|
|
42203
|
+
}
|
|
42204
|
+
__name(foldSessionLog, "foldSessionLog");
|
|
42205
|
+
|
|
42130
42206
|
// ../sdk/dist/types/session/turn.js
|
|
42131
42207
|
var TurnInProgressError = class extends Error {
|
|
42132
42208
|
static {
|
|
@@ -42467,8 +42543,8 @@ async function releaseHeldSessionLeases(options = {}) {
|
|
|
42467
42543
|
}, () => {
|
|
42468
42544
|
})));
|
|
42469
42545
|
let timer;
|
|
42470
|
-
const deadline = new Promise((
|
|
42471
|
-
timer = setTimeout(
|
|
42546
|
+
const deadline = new Promise((resolve37) => {
|
|
42547
|
+
timer = setTimeout(resolve37, options.timeoutMs ?? 2e3);
|
|
42472
42548
|
});
|
|
42473
42549
|
await Promise.race([all, deadline]);
|
|
42474
42550
|
clearTimeout(timer);
|
|
@@ -42496,8 +42572,8 @@ var EvidencePageLimit = class extends Error {
|
|
|
42496
42572
|
__name(this, "EvidencePageLimit");
|
|
42497
42573
|
}
|
|
42498
42574
|
};
|
|
42499
|
-
function stamp2(
|
|
42500
|
-
return [
|
|
42575
|
+
function stamp2(stat20) {
|
|
42576
|
+
return [stat20.dev, stat20.ino, stat20.size, stat20.mtimeMs, stat20.ctimeMs].join(":");
|
|
42501
42577
|
}
|
|
42502
42578
|
__name(stamp2, "stamp");
|
|
42503
42579
|
async function noLinks(path2) {
|
|
@@ -42615,7 +42691,7 @@ async function renameWithRetry2(from, to) {
|
|
|
42615
42691
|
const code = err.code ?? "";
|
|
42616
42692
|
if (!CONTENDED2.has(code) || attempt >= RENAME_ATTEMPTS2)
|
|
42617
42693
|
throw err;
|
|
42618
|
-
await new Promise((
|
|
42694
|
+
await new Promise((resolve37) => setTimeout(resolve37, attempt));
|
|
42619
42695
|
}
|
|
42620
42696
|
}
|
|
42621
42697
|
}
|
|
@@ -45543,10 +45619,23 @@ async function recordedTurnStart(log, turnId6) {
|
|
|
45543
45619
|
}
|
|
45544
45620
|
__name(recordedTurnStart, "recordedTurnStart");
|
|
45545
45621
|
async function readFoldedHistory(log, options = {}) {
|
|
45622
|
+
if (options.throughSeq === void 0) {
|
|
45623
|
+
return foldSessionLog(log, {
|
|
45624
|
+
name: "folded-history",
|
|
45625
|
+
mode: "strict",
|
|
45626
|
+
create: /* @__PURE__ */ __name(() => new SessionMessageFold(), "create"),
|
|
45627
|
+
apply: /* @__PURE__ */ __name((fold5, entry) => fold5.apply(entry.record), "apply"),
|
|
45628
|
+
result: /* @__PURE__ */ __name((fold5) => recordedMessages(log, fold5), "result")
|
|
45629
|
+
});
|
|
45630
|
+
}
|
|
45546
45631
|
const fold4 = new SessionMessageFold();
|
|
45547
|
-
for await (const entry of log.read(
|
|
45632
|
+
for await (const entry of log.read({ throughSeq: options.throughSeq })) {
|
|
45548
45633
|
fold4.apply(entry.record);
|
|
45549
45634
|
}
|
|
45635
|
+
return recordedMessages(log, fold4);
|
|
45636
|
+
}
|
|
45637
|
+
__name(readFoldedHistory, "readFoldedHistory");
|
|
45638
|
+
async function recordedMessages(log, fold4) {
|
|
45550
45639
|
const out = [];
|
|
45551
45640
|
const spilled = fold4.spilledSummary;
|
|
45552
45641
|
if (spilled) {
|
|
@@ -45555,7 +45644,7 @@ async function readFoldedHistory(log, options = {}) {
|
|
|
45555
45644
|
}
|
|
45556
45645
|
}
|
|
45557
45646
|
for (const entry of fold4.entries()) {
|
|
45558
|
-
const message = entry.spill ? JSON.parse(await log.readSpill(entry.spill)) : entry.message;
|
|
45647
|
+
const message = entry.spill ? JSON.parse(await log.readSpill(entry.spill)) : structuredClone(entry.message);
|
|
45559
45648
|
out.push({
|
|
45560
45649
|
message: withMessageId(message, entry.messageId),
|
|
45561
45650
|
...entry.messageId ? { messageId: entry.messageId } : {}
|
|
@@ -45563,29 +45652,35 @@ async function readFoldedHistory(log, options = {}) {
|
|
|
45563
45652
|
}
|
|
45564
45653
|
return out;
|
|
45565
45654
|
}
|
|
45566
|
-
__name(
|
|
45655
|
+
__name(recordedMessages, "recordedMessages");
|
|
45567
45656
|
async function readEverRecordedMessages(log) {
|
|
45568
|
-
|
|
45569
|
-
|
|
45570
|
-
|
|
45571
|
-
|
|
45572
|
-
|
|
45573
|
-
|
|
45574
|
-
|
|
45575
|
-
|
|
45576
|
-
|
|
45577
|
-
|
|
45578
|
-
|
|
45579
|
-
|
|
45580
|
-
|
|
45581
|
-
|
|
45582
|
-
|
|
45583
|
-
|
|
45584
|
-
|
|
45585
|
-
|
|
45586
|
-
|
|
45587
|
-
|
|
45588
|
-
|
|
45657
|
+
return foldSessionLog(log, {
|
|
45658
|
+
name: "ever-recorded-messages",
|
|
45659
|
+
mode: "strict",
|
|
45660
|
+
create: /* @__PURE__ */ __name(() => /* @__PURE__ */ new Map(), "create"),
|
|
45661
|
+
apply: /* @__PURE__ */ __name((latest, entry) => {
|
|
45662
|
+
const record4 = entry.record;
|
|
45663
|
+
if (record4.type === "message") {
|
|
45664
|
+
latest.set(record4.messageId, {
|
|
45665
|
+
content: record4.content,
|
|
45666
|
+
...record4.spill ? { spill: record4.spill } : {}
|
|
45667
|
+
});
|
|
45668
|
+
} else if (record4.type === "message_replaced") {
|
|
45669
|
+
latest.set(record4.targetMessageId, {
|
|
45670
|
+
content: record4.content,
|
|
45671
|
+
...record4.spill ? { spill: record4.spill } : {}
|
|
45672
|
+
});
|
|
45673
|
+
}
|
|
45674
|
+
}, "apply"),
|
|
45675
|
+
result: /* @__PURE__ */ __name(async (latest) => {
|
|
45676
|
+
const resolved2 = /* @__PURE__ */ new Map();
|
|
45677
|
+
for (const [id3, entry] of latest) {
|
|
45678
|
+
const content = entry.spill ? JSON.parse(await log.readSpill(entry.spill)) : structuredClone(entry.content);
|
|
45679
|
+
resolved2.set(id3, withMessageId(content, id3));
|
|
45680
|
+
}
|
|
45681
|
+
return resolved2;
|
|
45682
|
+
}, "result")
|
|
45683
|
+
});
|
|
45589
45684
|
}
|
|
45590
45685
|
__name(readEverRecordedMessages, "readEverRecordedMessages");
|
|
45591
45686
|
|
|
@@ -46135,10 +46230,10 @@ function toolDiscoveryHint(description, maxLength = 100) {
|
|
|
46135
46230
|
if (normalized.length === 0)
|
|
46136
46231
|
return "";
|
|
46137
46232
|
const sentenceMatch = normalized.match(/^.*?[.!?](?=\s|$)/);
|
|
46138
|
-
const
|
|
46139
|
-
if (
|
|
46140
|
-
return
|
|
46141
|
-
return `${
|
|
46233
|
+
const sentence2 = sentenceMatch ? sentenceMatch[0] : normalized;
|
|
46234
|
+
if (sentence2.length <= maxLength)
|
|
46235
|
+
return sentence2;
|
|
46236
|
+
return `${sentence2.slice(0, maxLength - 1).trimEnd()}\u2026`;
|
|
46142
46237
|
}
|
|
46143
46238
|
__name(toolDiscoveryHint, "toolDiscoveryHint");
|
|
46144
46239
|
|
|
@@ -48312,12 +48407,12 @@ var AwaitedJobs = class {
|
|
|
48312
48407
|
return Promise.resolve();
|
|
48313
48408
|
if (this.outstanding.size === 0 && this.monitors.size === 0)
|
|
48314
48409
|
return Promise.resolve();
|
|
48315
|
-
return new Promise((
|
|
48410
|
+
return new Promise((resolve37) => {
|
|
48316
48411
|
const finish2 = /* @__PURE__ */ __name(() => {
|
|
48317
48412
|
clearTimeout(timer);
|
|
48318
48413
|
this.arrivals.delete(finish2);
|
|
48319
48414
|
signal?.removeEventListener("abort", finish2);
|
|
48320
|
-
|
|
48415
|
+
resolve37();
|
|
48321
48416
|
}, "finish");
|
|
48322
48417
|
const timer = setTimeout(finish2, timeoutMs);
|
|
48323
48418
|
timer.unref?.();
|
|
@@ -49849,7 +49944,7 @@ var DetachedCalls = class {
|
|
|
49849
49944
|
return Promise.resolve();
|
|
49850
49945
|
if (signal.aborted)
|
|
49851
49946
|
return Promise.reject(signal.reason);
|
|
49852
|
-
return new Promise((
|
|
49947
|
+
return new Promise((resolve37, reject2) => {
|
|
49853
49948
|
const done = /* @__PURE__ */ __name(() => {
|
|
49854
49949
|
clearTimeout(timer);
|
|
49855
49950
|
this.waiters.delete(wake);
|
|
@@ -49857,7 +49952,7 @@ var DetachedCalls = class {
|
|
|
49857
49952
|
}, "done");
|
|
49858
49953
|
const wake = /* @__PURE__ */ __name(() => {
|
|
49859
49954
|
done();
|
|
49860
|
-
|
|
49955
|
+
resolve37();
|
|
49861
49956
|
}, "wake");
|
|
49862
49957
|
const abort = /* @__PURE__ */ __name(() => {
|
|
49863
49958
|
done();
|
|
@@ -50685,12 +50780,12 @@ var CompletionInbox = class {
|
|
|
50685
50780
|
return Promise.resolve();
|
|
50686
50781
|
if (!this.hasPendingWork)
|
|
50687
50782
|
return Promise.resolve();
|
|
50688
|
-
return new Promise((
|
|
50783
|
+
return new Promise((resolve37) => {
|
|
50689
50784
|
const finish2 = /* @__PURE__ */ __name(() => {
|
|
50690
50785
|
clearTimeout(timer);
|
|
50691
50786
|
this.arrivals.delete(finish2);
|
|
50692
50787
|
signal?.removeEventListener("abort", finish2);
|
|
50693
|
-
|
|
50788
|
+
resolve37();
|
|
50694
50789
|
}, "finish");
|
|
50695
50790
|
const timer = setTimeout(finish2, timeoutMs);
|
|
50696
50791
|
timer.unref?.();
|
|
@@ -50858,11 +50953,11 @@ ${JSON.stringify({ tasks: tasks2 })}`;
|
|
|
50858
50953
|
});
|
|
50859
50954
|
if (settlements.length === 0)
|
|
50860
50955
|
return this.drain();
|
|
50861
|
-
await new Promise((
|
|
50956
|
+
await new Promise((resolve37) => {
|
|
50862
50957
|
const finish2 = /* @__PURE__ */ __name(() => {
|
|
50863
50958
|
signal?.removeEventListener("abort", finish2);
|
|
50864
50959
|
this.drains.delete(finish2);
|
|
50865
|
-
|
|
50960
|
+
resolve37();
|
|
50866
50961
|
}, "finish");
|
|
50867
50962
|
this.drains.add(finish2);
|
|
50868
50963
|
signal?.addEventListener("abort", finish2, { once: true });
|
|
@@ -51626,12 +51721,12 @@ function createMemoryRecallStep(options) {
|
|
|
51626
51721
|
candidates: described,
|
|
51627
51722
|
signal: controller.signal
|
|
51628
51723
|
}),
|
|
51629
|
-
new Promise((
|
|
51724
|
+
new Promise((resolve37) => {
|
|
51630
51725
|
timer2 = setTimeout(() => {
|
|
51631
51726
|
controller.abort(new Error(`Memory selection exceeded ${selectTimeoutMs}ms.`));
|
|
51632
|
-
|
|
51727
|
+
resolve37(void 0);
|
|
51633
51728
|
}, selectTimeoutMs);
|
|
51634
|
-
controller.signal.addEventListener("abort", () =>
|
|
51729
|
+
controller.signal.addEventListener("abort", () => resolve37(void 0), { once: true });
|
|
51635
51730
|
})
|
|
51636
51731
|
]);
|
|
51637
51732
|
return controller.signal.aborted || !Array.isArray(picks) ? void 0 : picks;
|
|
@@ -53935,8 +54030,8 @@ var OutcomeLedger = class {
|
|
|
53935
54030
|
const asked = Promise.resolve().then(detect);
|
|
53936
54031
|
asked.catch(() => {
|
|
53937
54032
|
});
|
|
53938
|
-
const late = new Promise((
|
|
53939
|
-
timer = setTimeout(() =>
|
|
54033
|
+
const late = new Promise((resolve37) => {
|
|
54034
|
+
timer = setTimeout(() => resolve37(null), deadline);
|
|
53940
54035
|
});
|
|
53941
54036
|
const answer = await Promise.race([asked, late]);
|
|
53942
54037
|
return typeof answer === "string" ? answer : null;
|
|
@@ -54850,21 +54945,21 @@ async function waitForTaskWithBounds(gateway, taskId, bounds, now = Date.now) {
|
|
|
54850
54945
|
throw err;
|
|
54851
54946
|
}
|
|
54852
54947
|
);
|
|
54853
|
-
const expiry = new Promise((
|
|
54948
|
+
const expiry = new Promise((resolve37) => {
|
|
54854
54949
|
const tick = setInterval(() => {
|
|
54855
54950
|
if (settled)
|
|
54856
54951
|
return;
|
|
54857
54952
|
const elapsed = now() - startedAt;
|
|
54858
54953
|
if (elapsed >= bounds.wallMs) {
|
|
54859
54954
|
clearInterval(tick);
|
|
54860
|
-
|
|
54955
|
+
resolve37({ kind: "timeout", cause: "wall", elapsedMs: elapsed, idleBoundArmed });
|
|
54861
54956
|
return;
|
|
54862
54957
|
}
|
|
54863
54958
|
if (idleBoundArmed && bounds.idleMs !== void 0) {
|
|
54864
54959
|
const quietFor = now() - lastProgressAt;
|
|
54865
54960
|
if (quietFor >= bounds.idleMs) {
|
|
54866
54961
|
clearInterval(tick);
|
|
54867
|
-
|
|
54962
|
+
resolve37({ kind: "timeout", cause: "idle", elapsedMs: elapsed, idleBoundArmed });
|
|
54868
54963
|
}
|
|
54869
54964
|
}
|
|
54870
54965
|
}, POLL_INTERVAL_MS);
|
|
@@ -59047,14 +59142,14 @@ async function awaitDecisionDurably(ctx, checkpoint, request, scope) {
|
|
|
59047
59142
|
}, "record");
|
|
59048
59143
|
let parkTimer;
|
|
59049
59144
|
let recording = false;
|
|
59050
|
-
const recordIfSlow = new Promise((
|
|
59145
|
+
const recordIfSlow = new Promise((resolve37) => {
|
|
59051
59146
|
parkTimer = setTimeout(() => {
|
|
59052
59147
|
if (settled) {
|
|
59053
|
-
|
|
59148
|
+
resolve37();
|
|
59054
59149
|
return;
|
|
59055
59150
|
}
|
|
59056
59151
|
recording = true;
|
|
59057
|
-
record4().then(
|
|
59152
|
+
record4().then(resolve37, resolve37);
|
|
59058
59153
|
}, delay2);
|
|
59059
59154
|
});
|
|
59060
59155
|
try {
|
|
@@ -59106,13 +59201,13 @@ async function awaitDecisionOrAbort(ctx, request, scope) {
|
|
|
59106
59201
|
const abortedDecision = /* @__PURE__ */ __name(() => scope && !turnSignal?.aborted ? scope.closedAs() : { action: "abort", reason: "run aborted while parked for HITL" }, "abortedDecision");
|
|
59107
59202
|
if (signal.aborted)
|
|
59108
59203
|
return abortedDecision();
|
|
59109
|
-
return new Promise((
|
|
59204
|
+
return new Promise((resolve37) => {
|
|
59110
59205
|
let settled = false;
|
|
59111
59206
|
const onAbort = /* @__PURE__ */ __name(() => {
|
|
59112
59207
|
if (settled)
|
|
59113
59208
|
return;
|
|
59114
59209
|
settled = true;
|
|
59115
|
-
|
|
59210
|
+
resolve37(abortedDecision());
|
|
59116
59211
|
}, "onAbort");
|
|
59117
59212
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
59118
59213
|
Promise.resolve(ctx.resumeHandler(request, resumeContext)).then((decision2) => {
|
|
@@ -59120,13 +59215,13 @@ async function awaitDecisionOrAbort(ctx, request, scope) {
|
|
|
59120
59215
|
return;
|
|
59121
59216
|
settled = true;
|
|
59122
59217
|
signal.removeEventListener("abort", onAbort);
|
|
59123
|
-
|
|
59218
|
+
resolve37(decision2);
|
|
59124
59219
|
}, (err) => {
|
|
59125
59220
|
if (settled)
|
|
59126
59221
|
return;
|
|
59127
59222
|
settled = true;
|
|
59128
59223
|
signal.removeEventListener("abort", onAbort);
|
|
59129
|
-
|
|
59224
|
+
resolve37({
|
|
59130
59225
|
action: "abort",
|
|
59131
59226
|
reason: err instanceof Error ? err.message : "resume handler failed"
|
|
59132
59227
|
});
|
|
@@ -59332,7 +59427,7 @@ var DECLINED_TOOL_CALL_FEEDBACK = "The user declined this. Do not get the same c
|
|
|
59332
59427
|
import { isDeepStrictEqual as isDeepStrictEqual2 } from "node:util";
|
|
59333
59428
|
async function awaitProjectInstructionCallback(signal, start) {
|
|
59334
59429
|
signal.throwIfAborted();
|
|
59335
|
-
return new Promise((
|
|
59430
|
+
return new Promise((resolve37, reject2) => {
|
|
59336
59431
|
let settled = false;
|
|
59337
59432
|
const cleanup = /* @__PURE__ */ __name(() => signal.removeEventListener("abort", onAbort), "cleanup");
|
|
59338
59433
|
const rejectOnce = /* @__PURE__ */ __name((reason) => {
|
|
@@ -59347,7 +59442,7 @@ async function awaitProjectInstructionCallback(signal, start) {
|
|
|
59347
59442
|
return;
|
|
59348
59443
|
settled = true;
|
|
59349
59444
|
cleanup();
|
|
59350
|
-
|
|
59445
|
+
resolve37(value);
|
|
59351
59446
|
}, "resolveOnce");
|
|
59352
59447
|
const onAbort = /* @__PURE__ */ __name(() => rejectOnce(signal.reason), "onAbort");
|
|
59353
59448
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
@@ -61109,7 +61204,7 @@ async function canonicalize(absolute) {
|
|
|
61109
61204
|
__name(canonicalize, "canonicalize");
|
|
61110
61205
|
|
|
61111
61206
|
// ../sdk/dist/tools/builtins/bounded-file-read.js
|
|
61112
|
-
import { constants as constants3 } from "node:fs";
|
|
61207
|
+
import { constants as constants3, closeSync, fstatSync, openSync, readSync } from "node:fs";
|
|
61113
61208
|
import { open as open8 } from "node:fs/promises";
|
|
61114
61209
|
var CHUNK_BYTES = 64 * 1024;
|
|
61115
61210
|
var TEXT_MAX_INPUT_BYTES = 32 * 1024 * 1024;
|
|
@@ -61135,9 +61230,9 @@ async function readBoundedChunks(read, maximum, signal, selectLimit) {
|
|
|
61135
61230
|
}
|
|
61136
61231
|
}
|
|
61137
61232
|
__name(readBoundedChunks, "readBoundedChunks");
|
|
61138
|
-
async function readBoundedFile(path2, maximum, signal, selectLimit) {
|
|
61233
|
+
async function readBoundedFile(path2, maximum, signal, selectLimit, extraFlags = 0) {
|
|
61139
61234
|
signal?.throwIfAborted();
|
|
61140
|
-
const file2 = await open8(path2, constants3.O_RDONLY | constants3.O_NONBLOCK);
|
|
61235
|
+
const file2 = await open8(path2, constants3.O_RDONLY | constants3.O_NONBLOCK | extraFlags);
|
|
61141
61236
|
try {
|
|
61142
61237
|
const info = await file2.stat();
|
|
61143
61238
|
if (!info.isFile())
|
|
@@ -61170,6 +61265,42 @@ function inputTooLarge(limit) {
|
|
|
61170
61265
|
return new Error(`File exceeds the bounded read limit (${limit} bytes). Extract a smaller file with a shell command.`);
|
|
61171
61266
|
}
|
|
61172
61267
|
__name(inputTooLarge, "inputTooLarge");
|
|
61268
|
+
var CAN_REFUSE_LINKS = typeof constants3.O_NOFOLLOW === "number" && constants3.O_NOFOLLOW > 0;
|
|
61269
|
+
var REFUSE_LINK_FLAG = CAN_REFUSE_LINKS ? constants3.O_NOFOLLOW : 0;
|
|
61270
|
+
function readBoundedFileSync(path2, maximum, scratch, syncMaximum = maximum) {
|
|
61271
|
+
const fd = openSync(path2, constants3.O_RDONLY | constants3.O_NONBLOCK | constants3.O_NOFOLLOW);
|
|
61272
|
+
try {
|
|
61273
|
+
const info = fstatSync(fd);
|
|
61274
|
+
if (!info.isFile())
|
|
61275
|
+
throw new Error("Read requires a regular file.");
|
|
61276
|
+
if (info.size > maximum)
|
|
61277
|
+
return "too-large";
|
|
61278
|
+
if (info.size > syncMaximum)
|
|
61279
|
+
return "large";
|
|
61280
|
+
const chunks = [];
|
|
61281
|
+
let offset = 0;
|
|
61282
|
+
for (; ; ) {
|
|
61283
|
+
const length = Math.min(CHUNK_BYTES, maximum + 1 - offset);
|
|
61284
|
+
const buffer = offset === 0 && scratch && scratch.length >= length ? scratch : Buffer.allocUnsafe(length);
|
|
61285
|
+
let used = 0;
|
|
61286
|
+
while (used < length) {
|
|
61287
|
+
const bytesRead = readSync(fd, buffer, used, length - used, offset + used);
|
|
61288
|
+
if (bytesRead === 0)
|
|
61289
|
+
break;
|
|
61290
|
+
used += bytesRead;
|
|
61291
|
+
}
|
|
61292
|
+
offset += used;
|
|
61293
|
+
if (offset > maximum)
|
|
61294
|
+
throw inputTooLarge(maximum);
|
|
61295
|
+
chunks.push(buffer.subarray(0, used));
|
|
61296
|
+
if (used < length)
|
|
61297
|
+
return chunks.length === 1 ? chunks[0] : Buffer.concat(chunks, offset);
|
|
61298
|
+
}
|
|
61299
|
+
} finally {
|
|
61300
|
+
closeSync(fd);
|
|
61301
|
+
}
|
|
61302
|
+
}
|
|
61303
|
+
__name(readBoundedFileSync, "readBoundedFileSync");
|
|
61173
61304
|
|
|
61174
61305
|
// ../sdk/dist/tools/builtins/bash-cwd.js
|
|
61175
61306
|
var MAX_SESSIONS = 256;
|
|
@@ -61736,7 +61867,7 @@ function shellProgress(report) {
|
|
|
61736
61867
|
__name(shellProgress, "shellProgress");
|
|
61737
61868
|
function execHostShell(command, options) {
|
|
61738
61869
|
options.signal?.throwIfAborted();
|
|
61739
|
-
return new Promise((
|
|
61870
|
+
return new Promise((resolve37, reject2) => {
|
|
61740
61871
|
const child = spawnHostShell(command, {
|
|
61741
61872
|
cwd: options.cwd,
|
|
61742
61873
|
env: options.env,
|
|
@@ -61837,7 +61968,7 @@ function execHostShell(command, options) {
|
|
|
61837
61968
|
const stdout = decodeCapture("stdout");
|
|
61838
61969
|
const stderr = decodeCapture("stderr");
|
|
61839
61970
|
if (!failure3 && cause === void 0 && code === 0 && signal === null) {
|
|
61840
|
-
|
|
61971
|
+
resolve37({
|
|
61841
61972
|
stdout,
|
|
61842
61973
|
stderr,
|
|
61843
61974
|
stdoutBytes: captures.stdout.bytes,
|
|
@@ -61888,7 +62019,7 @@ ${stderr}`));
|
|
|
61888
62019
|
child.off("close", onClose);
|
|
61889
62020
|
child.off("error", onError);
|
|
61890
62021
|
child.off("spawn", onSpawn);
|
|
61891
|
-
|
|
62022
|
+
resolve37({
|
|
61892
62023
|
backgroundedJobId: jobId,
|
|
61893
62024
|
backgroundedBy: reason,
|
|
61894
62025
|
stdout: decodeCapture("stdout"),
|
|
@@ -61917,6 +62048,10 @@ ${stderr}`));
|
|
|
61917
62048
|
});
|
|
61918
62049
|
}
|
|
61919
62050
|
__name(execHostShell, "execHostShell");
|
|
62051
|
+
function sentence(reason) {
|
|
62052
|
+
return reason ? `${reason.charAt(0).toUpperCase()}${reason.slice(1)}` : reason;
|
|
62053
|
+
}
|
|
62054
|
+
__name(sentence, "sentence");
|
|
61920
62055
|
function isDangerousCommand(command) {
|
|
61921
62056
|
return DANGEROUS_PATTERNS.some((pattern) => pattern.test(command));
|
|
61922
62057
|
}
|
|
@@ -61978,7 +62113,12 @@ var BashToolBase = defineTool({
|
|
|
61978
62113
|
success: false,
|
|
61979
62114
|
output: "",
|
|
61980
62115
|
error: `Dangerous command blocked: "${input2.command}". Why: ${dangerousCommandReason(input2.command)}. Nothing ran. Use a narrower command that avoids it, or ask the user to run this one.`,
|
|
61981
|
-
facts: {
|
|
62116
|
+
facts: {
|
|
62117
|
+
kind: "failure",
|
|
62118
|
+
reason: "blocked",
|
|
62119
|
+
subject: "bash",
|
|
62120
|
+
note: sentence(dangerousCommandReason(input2.command))
|
|
62121
|
+
}
|
|
61982
62122
|
};
|
|
61983
62123
|
}
|
|
61984
62124
|
if (!input2.run_in_background && context2.backgroundJobs && !backgroundTasksDisabled()) {
|
|
@@ -62295,14 +62435,14 @@ __name(backoffProportional, "backoffProportional");
|
|
|
62295
62435
|
function sleep(ms, signal) {
|
|
62296
62436
|
if (ms <= 0)
|
|
62297
62437
|
return Promise.resolve();
|
|
62298
|
-
return new Promise((
|
|
62438
|
+
return new Promise((resolve37, reject2) => {
|
|
62299
62439
|
if (signal?.aborted) {
|
|
62300
62440
|
reject2(signal.reason);
|
|
62301
62441
|
return;
|
|
62302
62442
|
}
|
|
62303
62443
|
const timer = setTimeout(() => {
|
|
62304
62444
|
signal?.removeEventListener("abort", onAbort);
|
|
62305
|
-
|
|
62445
|
+
resolve37();
|
|
62306
62446
|
}, ms);
|
|
62307
62447
|
const onAbort = /* @__PURE__ */ __name(() => {
|
|
62308
62448
|
clearTimeout(timer);
|
|
@@ -65190,8 +65330,8 @@ async function resolveRetainedOutput(directory, candidate) {
|
|
|
65190
65330
|
return void 0;
|
|
65191
65331
|
if (!inside(resolve10(directory), lexical) && !inside(base3, lexical))
|
|
65192
65332
|
return void 0;
|
|
65193
|
-
const
|
|
65194
|
-
if (
|
|
65333
|
+
const stat20 = await lstat2(lexical);
|
|
65334
|
+
if (stat20.isSymbolicLink() || !stat20.isFile() || stat20.nlink !== 1)
|
|
65195
65335
|
return void 0;
|
|
65196
65336
|
const real = await realpath4(lexical);
|
|
65197
65337
|
if (!inside(base3, real) || dirname11(real) === real)
|
|
@@ -66266,10 +66406,10 @@ async function readArtifact(path2, context2) {
|
|
|
66266
66406
|
const resolved2 = await resolveWithinAnyReal(toolRoots(context2), path2);
|
|
66267
66407
|
const file2 = await open10(resolved2, "r");
|
|
66268
66408
|
try {
|
|
66269
|
-
const
|
|
66270
|
-
if (!
|
|
66409
|
+
const stat20 = await file2.stat();
|
|
66410
|
+
if (!stat20.isFile())
|
|
66271
66411
|
throw new Error("Image inspection requires a regular file.");
|
|
66272
|
-
if (
|
|
66412
|
+
if (stat20.size > MAX_BYTES)
|
|
66273
66413
|
throw new Error("Image exceeds the 16 MiB inspection limit. Export a smaller image.");
|
|
66274
66414
|
const bytes = await readBounded(async (offset, length) => {
|
|
66275
66415
|
const buffer = Buffer.allocUnsafe(length);
|
|
@@ -66610,7 +66750,7 @@ function checkPageRange(value) {
|
|
|
66610
66750
|
}
|
|
66611
66751
|
__name(checkPageRange, "checkPageRange");
|
|
66612
66752
|
function run(command, args, input2, signal, timeoutMs) {
|
|
66613
|
-
return new Promise((
|
|
66753
|
+
return new Promise((resolve37) => {
|
|
66614
66754
|
const child = spawn(command, [...args], { stdio: ["pipe", "pipe", "pipe"], signal });
|
|
66615
66755
|
let stdout = "";
|
|
66616
66756
|
let stderr = "";
|
|
@@ -66631,11 +66771,11 @@ function run(command, args, input2, signal, timeoutMs) {
|
|
|
66631
66771
|
child.on("error", (error62) => {
|
|
66632
66772
|
missing2 = error62.code === "ENOENT";
|
|
66633
66773
|
clearTimeout(timer);
|
|
66634
|
-
|
|
66774
|
+
resolve37({ code: null, stdout, stderr: stderr || error62.message, missing: missing2, timedOut });
|
|
66635
66775
|
});
|
|
66636
66776
|
child.on("close", (code) => {
|
|
66637
66777
|
clearTimeout(timer);
|
|
66638
|
-
|
|
66778
|
+
resolve37({ code, stdout, stderr, missing: missing2, timedOut });
|
|
66639
66779
|
});
|
|
66640
66780
|
child.stdin.on("error", () => {
|
|
66641
66781
|
});
|
|
@@ -67937,8 +68077,8 @@ async function withFileMutationLock(key6, operation) {
|
|
|
67937
68077
|
const previous = mutationTails.get(key6) ?? Promise.resolve();
|
|
67938
68078
|
let release2 = /* @__PURE__ */ __name(() => {
|
|
67939
68079
|
}, "release");
|
|
67940
|
-
const current = new Promise((
|
|
67941
|
-
release2 =
|
|
68080
|
+
const current = new Promise((resolve37) => {
|
|
68081
|
+
release2 = resolve37;
|
|
67942
68082
|
});
|
|
67943
68083
|
const tail = previous.then(() => current);
|
|
67944
68084
|
mutationTails.set(key6, tail);
|
|
@@ -70215,8 +70355,8 @@ var ToolCallBudget = class {
|
|
|
70215
70355
|
signal.throwIfAborted();
|
|
70216
70356
|
const previous = this.chain;
|
|
70217
70357
|
let release2;
|
|
70218
|
-
this.chain = new Promise((
|
|
70219
|
-
release2 =
|
|
70358
|
+
this.chain = new Promise((resolve37) => {
|
|
70359
|
+
release2 = resolve37;
|
|
70220
70360
|
});
|
|
70221
70361
|
try {
|
|
70222
70362
|
await previous;
|
|
@@ -70353,16 +70493,29 @@ var DEFAULT_TOOL_RETRY_BACKOFF = {
|
|
|
70353
70493
|
maxDelayMs: 16e3
|
|
70354
70494
|
};
|
|
70355
70495
|
var DECLINED_NOTE_MAX_CHARS = 4e3;
|
|
70356
|
-
function refusalFacts(toolName, input2) {
|
|
70496
|
+
function refusalFacts(toolName, input2, reason) {
|
|
70357
70497
|
const command = input2 && typeof input2 === "object" ? input2.command : void 0;
|
|
70358
70498
|
const elevated = typeof command === "string" && /(^|[\s;&|(])(sudo|doas)\b/.test(command);
|
|
70359
70499
|
return {
|
|
70360
70500
|
kind: "failure",
|
|
70361
70501
|
reason: elevated ? "needs_administrator" : "blocked",
|
|
70362
|
-
subject: toolName
|
|
70502
|
+
subject: toolName,
|
|
70503
|
+
...refusalNote(reason) ? { note: refusalNote(reason) } : {}
|
|
70363
70504
|
};
|
|
70364
70505
|
}
|
|
70365
70506
|
__name(refusalFacts, "refusalFacts");
|
|
70507
|
+
var REFUSAL_NOTE_MAX = 200;
|
|
70508
|
+
function refusalNote(reason) {
|
|
70509
|
+
const line = reason?.split(/\r?\n/).map((part2) => part2.trim()).find(Boolean);
|
|
70510
|
+
if (!line)
|
|
70511
|
+
return void 0;
|
|
70512
|
+
const plain = line.replace(/^Blocked(?: by [^:]{1,60})?:\s*/i, "").trim();
|
|
70513
|
+
if (!plain)
|
|
70514
|
+
return void 0;
|
|
70515
|
+
const sentence2 = `${plain.charAt(0).toUpperCase()}${plain.slice(1)}`;
|
|
70516
|
+
return sentence2.length > REFUSAL_NOTE_MAX ? `${sentence2.slice(0, REFUSAL_NOTE_MAX - 1)}\u2026` : sentence2;
|
|
70517
|
+
}
|
|
70518
|
+
__name(refusalNote, "refusalNote");
|
|
70366
70519
|
function deniedToolOutput(toolName, reason) {
|
|
70367
70520
|
return `Error: Tool "${toolName}" was not executed. ${reason}`;
|
|
70368
70521
|
}
|
|
@@ -71379,7 +71532,7 @@ var ToolExecutor = class {
|
|
|
71379
71532
|
let failure3;
|
|
71380
71533
|
const settledUnits = /* @__PURE__ */ new Map();
|
|
71381
71534
|
const refusedAfterEnd = "An earlier call in this batch was refused and the turn was stopped, so this call was not run.";
|
|
71382
|
-
await new Promise((
|
|
71535
|
+
await new Promise((resolve37) => {
|
|
71383
71536
|
const start = /* @__PURE__ */ __name((unit) => {
|
|
71384
71537
|
inFlight.add(unit);
|
|
71385
71538
|
let settledUnit;
|
|
@@ -71428,7 +71581,7 @@ var ToolExecutor = class {
|
|
|
71428
71581
|
start(unit);
|
|
71429
71582
|
}
|
|
71430
71583
|
if (cursor >= units.length && inFlight.size === 0)
|
|
71431
|
-
|
|
71584
|
+
resolve37();
|
|
71432
71585
|
}, "pump");
|
|
71433
71586
|
review.ended.addEventListener("abort", pump, { once: true });
|
|
71434
71587
|
pump();
|
|
@@ -72196,21 +72349,21 @@ ${note}`;
|
|
|
72196
72349
|
let invocationOpen = true;
|
|
72197
72350
|
const nestedDispatches = /* @__PURE__ */ new Set();
|
|
72198
72351
|
try {
|
|
72199
|
-
const expired = Number.isFinite(timeoutMs) && timeoutMs > 0 ? new Promise((
|
|
72352
|
+
const expired = Number.isFinite(timeoutMs) && timeoutMs > 0 ? new Promise((resolve37) => {
|
|
72200
72353
|
timer = setTimeout(() => {
|
|
72201
72354
|
timedOut = true;
|
|
72202
72355
|
controller.abort(new Error(`Tool "${toolName}" exceeded ${timeoutMs}ms`));
|
|
72203
|
-
|
|
72356
|
+
resolve37("timeout");
|
|
72204
72357
|
}, timeoutMs);
|
|
72205
72358
|
}) : void 0;
|
|
72206
|
-
const aborted2 = new Promise((
|
|
72359
|
+
const aborted2 = new Promise((resolve37) => {
|
|
72207
72360
|
if (controller.signal.aborted && !timedOut) {
|
|
72208
|
-
|
|
72361
|
+
resolve37("aborted");
|
|
72209
72362
|
return;
|
|
72210
72363
|
}
|
|
72211
72364
|
controller.signal.addEventListener("abort", () => {
|
|
72212
72365
|
if (!timedOut)
|
|
72213
|
-
|
|
72366
|
+
resolve37("aborted");
|
|
72214
72367
|
}, { once: true });
|
|
72215
72368
|
});
|
|
72216
72369
|
const inheritedDispatch = toolContext.dispatchTool;
|
|
@@ -72593,7 +72746,7 @@ ${note}`;
|
|
|
72593
72746
|
...declined2 ? { presentation: this.declinedPresentation(toolName, input2, declined2) } : {},
|
|
72594
72747
|
// A refusal by policy says what kind it was; the person's own No is
|
|
72595
72748
|
// already carried by the presentation above.
|
|
72596
|
-
...declined2 ? {} : { facts: refusalFacts(toolName, input2) },
|
|
72749
|
+
...declined2 ? {} : { facts: refusalFacts(toolName, input2, reason) },
|
|
72597
72750
|
isError: true
|
|
72598
72751
|
});
|
|
72599
72752
|
return { toolCallId: toolCall.id, toolName, output: output2, isError: true };
|
|
@@ -72774,8 +72927,8 @@ var Semaphore = class {
|
|
|
72774
72927
|
this.available--;
|
|
72775
72928
|
return Promise.resolve();
|
|
72776
72929
|
}
|
|
72777
|
-
return new Promise((
|
|
72778
|
-
this.waiters.push(
|
|
72930
|
+
return new Promise((resolve37) => {
|
|
72931
|
+
this.waiters.push(resolve37);
|
|
72779
72932
|
});
|
|
72780
72933
|
}
|
|
72781
72934
|
release() {
|
|
@@ -73647,8 +73800,8 @@ var PerCallReview = class {
|
|
|
73647
73800
|
async admit(call2) {
|
|
73648
73801
|
const before = this.#line;
|
|
73649
73802
|
let leave;
|
|
73650
|
-
this.#line = new Promise((
|
|
73651
|
-
leave =
|
|
73803
|
+
this.#line = new Promise((resolve37) => {
|
|
73804
|
+
leave = resolve37;
|
|
73652
73805
|
});
|
|
73653
73806
|
try {
|
|
73654
73807
|
const verdict2 = await this.#decide(call2, before, leave);
|
|
@@ -73995,7 +74148,7 @@ function watchForOperator(ctx, startedAt) {
|
|
|
73995
74148
|
return void 0;
|
|
73996
74149
|
const watching = new AbortController();
|
|
73997
74150
|
let timer;
|
|
73998
|
-
const requested = new Promise((
|
|
74151
|
+
const requested = new Promise((resolve37) => {
|
|
73999
74152
|
const settled = Promise.race(wakes.map((wake) => {
|
|
74000
74153
|
try {
|
|
74001
74154
|
return wake(watching.signal);
|
|
@@ -74009,7 +74162,7 @@ function watchForOperator(ctx, startedAt) {
|
|
|
74009
74162
|
if (watching.signal.aborted)
|
|
74010
74163
|
return;
|
|
74011
74164
|
const wait = Math.max(0, startedAt + DETACH_AFTER_MS - Date.now());
|
|
74012
|
-
timer = setTimeout(
|
|
74165
|
+
timer = setTimeout(resolve37, wait);
|
|
74013
74166
|
},
|
|
74014
74167
|
// An aborted wait is the batch ending, which is not a message.
|
|
74015
74168
|
() => {
|
|
@@ -74267,8 +74420,8 @@ async function* runToolReview(ctx, response, iterationNum) {
|
|
|
74267
74420
|
}
|
|
74268
74421
|
const wakeup = /* @__PURE__ */ __name(() => {
|
|
74269
74422
|
let notify;
|
|
74270
|
-
const promise2 = new Promise((
|
|
74271
|
-
notify =
|
|
74423
|
+
const promise2 = new Promise((resolve37) => {
|
|
74424
|
+
notify = resolve37;
|
|
74272
74425
|
});
|
|
74273
74426
|
return { promise: promise2, notify };
|
|
74274
74427
|
}, "wakeup");
|
|
@@ -78903,7 +79056,7 @@ async function awaitStoreRead(signal, start) {
|
|
|
78903
79056
|
if (!signal)
|
|
78904
79057
|
return await start();
|
|
78905
79058
|
signal.throwIfAborted();
|
|
78906
|
-
return new Promise((
|
|
79059
|
+
return new Promise((resolve37, reject2) => {
|
|
78907
79060
|
let settled = false;
|
|
78908
79061
|
const cleanup = /* @__PURE__ */ __name(() => signal.removeEventListener("abort", onAbort), "cleanup");
|
|
78909
79062
|
const rejectOnce = /* @__PURE__ */ __name((reason) => {
|
|
@@ -78918,7 +79071,7 @@ async function awaitStoreRead(signal, start) {
|
|
|
78918
79071
|
return;
|
|
78919
79072
|
settled = true;
|
|
78920
79073
|
cleanup();
|
|
78921
|
-
|
|
79074
|
+
resolve37(value);
|
|
78922
79075
|
}, "resolveOnce");
|
|
78923
79076
|
const onAbort = /* @__PURE__ */ __name(() => rejectOnce(signal.reason), "onAbort");
|
|
78924
79077
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
@@ -79434,6 +79587,19 @@ var ActivityStore = class {
|
|
|
79434
79587
|
};
|
|
79435
79588
|
|
|
79436
79589
|
// ../sdk/dist/runtime/query/context.js
|
|
79590
|
+
function relayAbort(signal, controller) {
|
|
79591
|
+
const controllerRef = new WeakRef(controller);
|
|
79592
|
+
const signalRef = new WeakRef(signal);
|
|
79593
|
+
const relay = /* @__PURE__ */ __name(() => {
|
|
79594
|
+
controllerRef.deref()?.abort(signalRef.deref()?.reason);
|
|
79595
|
+
}, "relay");
|
|
79596
|
+
signal.addEventListener("abort", relay, { once: true });
|
|
79597
|
+
relayCleanup.register(controller, { signalRef, relay });
|
|
79598
|
+
}
|
|
79599
|
+
__name(relayAbort, "relayAbort");
|
|
79600
|
+
var relayCleanup = new FinalizationRegistry(({ signalRef, relay }) => {
|
|
79601
|
+
signalRef.deref()?.removeEventListener("abort", relay);
|
|
79602
|
+
});
|
|
79437
79603
|
var TurnContextFactory = class _TurnContextFactory {
|
|
79438
79604
|
static {
|
|
79439
79605
|
__name(this, "TurnContextFactory");
|
|
@@ -79465,7 +79631,7 @@ var TurnContextFactory = class _TurnContextFactory {
|
|
|
79465
79631
|
if (config2.signal.aborted) {
|
|
79466
79632
|
abortController.abort(config2.signal.reason);
|
|
79467
79633
|
} else {
|
|
79468
|
-
config2.signal
|
|
79634
|
+
relayAbort(config2.signal, abortController);
|
|
79469
79635
|
}
|
|
79470
79636
|
}
|
|
79471
79637
|
const cwd = config2.workingDirectory ?? process.cwd();
|
|
@@ -79494,7 +79660,10 @@ var TurnContextFactory = class _TurnContextFactory {
|
|
|
79494
79660
|
});
|
|
79495
79661
|
const trackingConfig = resolveActivityTracking(permissionMode.current, config2.enableActivityTracking);
|
|
79496
79662
|
const activityStore = new ActivityStore(config2.turnId, trackingConfig);
|
|
79497
|
-
const planManager = new PlanManager({
|
|
79663
|
+
const planManager = new PlanManager({
|
|
79664
|
+
sessionId: config2.sessionId,
|
|
79665
|
+
turnId: config2.turnId
|
|
79666
|
+
});
|
|
79498
79667
|
const toolResultsDir = config2.storage.sessionDir === void 0 ? void 0 : join21(config2.storage.sessionDir, SPILL_DIR);
|
|
79499
79668
|
return {
|
|
79500
79669
|
turnId: config2.turnId,
|
|
@@ -80165,13 +80334,35 @@ function createSessionEvidenceSource(options) {
|
|
|
80165
80334
|
});
|
|
80166
80335
|
}
|
|
80167
80336
|
__name(createSessionEvidenceSource, "createSessionEvidenceSource");
|
|
80168
|
-
|
|
80337
|
+
var SCAN_CACHE_LIMIT = 64;
|
|
80338
|
+
var scanCache = /* @__PURE__ */ new Map();
|
|
80339
|
+
function remember(key6, scan) {
|
|
80340
|
+
scanCache.delete(key6);
|
|
80341
|
+
scanCache.set(key6, scan);
|
|
80342
|
+
if (scanCache.size > SCAN_CACHE_LIMIT) {
|
|
80343
|
+
const oldest = scanCache.keys().next().value;
|
|
80344
|
+
if (oldest !== void 0)
|
|
80345
|
+
scanCache.delete(oldest);
|
|
80346
|
+
}
|
|
80347
|
+
}
|
|
80348
|
+
__name(remember, "remember");
|
|
80349
|
+
async function sessionState(handle, size, scope, cacheKey, identity) {
|
|
80169
80350
|
const unmetered = { bytes: 0, limit: Number.MAX_SAFE_INTEGER };
|
|
80170
80351
|
let first;
|
|
80171
80352
|
let active;
|
|
80172
80353
|
let turnClosed = false;
|
|
80173
|
-
let buffered = Buffer.alloc(0);
|
|
80174
80354
|
let offset = 0;
|
|
80355
|
+
const cached4 = scanCache.get(cacheKey);
|
|
80356
|
+
if (cached4 && cached4.identity === identity && cached4.consumed <= size) {
|
|
80357
|
+
const head2 = await readBytes(handle, 0, cached4.first.length, unmetered);
|
|
80358
|
+
if (head2.equals(cached4.first)) {
|
|
80359
|
+
;
|
|
80360
|
+
({ first, active, turnClosed } = cached4);
|
|
80361
|
+
offset = cached4.consumed;
|
|
80362
|
+
}
|
|
80363
|
+
}
|
|
80364
|
+
let consumed = offset;
|
|
80365
|
+
let buffered = Buffer.alloc(0);
|
|
80175
80366
|
while (offset < size || buffered.length > 0) {
|
|
80176
80367
|
let newline = buffered.indexOf(10);
|
|
80177
80368
|
if (newline < 0) {
|
|
@@ -80187,6 +80378,7 @@ async function sessionState(handle, size, scope) {
|
|
|
80187
80378
|
const raw = buffered.subarray(0, newline + 1);
|
|
80188
80379
|
buffered = buffered.subarray(newline + 1);
|
|
80189
80380
|
newline = -1;
|
|
80381
|
+
consumed += raw.length;
|
|
80190
80382
|
const record4 = JSON.parse(decode3(raw));
|
|
80191
80383
|
if (!first) {
|
|
80192
80384
|
if (record4.type !== "session_started" || record4.sessionId !== scope.sessionId || record4.projectId !== scope.projectId || record4.tenantId !== void 0 && record4.tenantId !== scope.tenantId) {
|
|
@@ -80206,6 +80398,10 @@ async function sessionState(handle, size, scope) {
|
|
|
80206
80398
|
}
|
|
80207
80399
|
if (!first)
|
|
80208
80400
|
throw new Error("The session log is empty; evidence is incomplete.");
|
|
80401
|
+
const kept = scanCache.get(cacheKey);
|
|
80402
|
+
if (!kept || kept.identity !== identity || kept.consumed <= consumed) {
|
|
80403
|
+
remember(cacheKey, { identity, consumed, first, active, turnClosed });
|
|
80404
|
+
}
|
|
80209
80405
|
return { first, closed: scope.turnId !== void 0 ? turnClosed : active === void 0 };
|
|
80210
80406
|
}
|
|
80211
80407
|
__name(sessionState, "sessionState");
|
|
@@ -80238,7 +80434,7 @@ function createSource(options, mode, anchor2) {
|
|
|
80238
80434
|
} else {
|
|
80239
80435
|
size = consistency === "snapshot" ? await completePrefix(handle, before.size, budget) : before.size;
|
|
80240
80436
|
}
|
|
80241
|
-
const state = await sessionState(handle, size, scope);
|
|
80437
|
+
const state = await sessionState(handle, size, scope, `${logPath}\0${scopeKey2}`, fileIdentity(before));
|
|
80242
80438
|
if (!state.closed && consistency === "closed") {
|
|
80243
80439
|
throw new Error("Evidence scope has an active turn; it is not closed.");
|
|
80244
80440
|
}
|
|
@@ -80515,8 +80711,8 @@ var EventTranslator = class {
|
|
|
80515
80711
|
async withLogLock(operation) {
|
|
80516
80712
|
const previous = this.appendChain;
|
|
80517
80713
|
let release2;
|
|
80518
|
-
this.appendChain = new Promise((
|
|
80519
|
-
release2 =
|
|
80714
|
+
this.appendChain = new Promise((resolve37) => {
|
|
80715
|
+
release2 = resolve37;
|
|
80520
80716
|
});
|
|
80521
80717
|
try {
|
|
80522
80718
|
await previous;
|
|
@@ -81884,7 +82080,7 @@ async function verifyCheckpoint(log, scope, checkpoint, text9) {
|
|
|
81884
82080
|
__name(verifyCheckpoint, "verifyCheckpoint");
|
|
81885
82081
|
|
|
81886
82082
|
// ../sdk/dist/store/checkpoint/disk.js
|
|
81887
|
-
import { link as link5, mkdir as mkdir11, open as open12, readFile as readFile12, readdir as readdir4, unlink as unlink8 } from "node:fs/promises";
|
|
82083
|
+
import { link as link5, mkdir as mkdir11, open as open12, readFile as readFile12, readdir as readdir4, stat as stat8, unlink as unlink8 } from "node:fs/promises";
|
|
81888
82084
|
import { dirname as dirname15 } from "node:path";
|
|
81889
82085
|
|
|
81890
82086
|
// ../sdk/dist/store/checkpoint/prune.js
|
|
@@ -81908,6 +82104,10 @@ async function selectStoredCheckpointsToPrune(log, scope, stored, keepLast) {
|
|
|
81908
82104
|
if (!Number.isSafeInteger(keepLast) || keepLast < 0) {
|
|
81909
82105
|
throw new RangeError(`keepLast must be a nonnegative integer, got ${String(keepLast)}`);
|
|
81910
82106
|
}
|
|
82107
|
+
if (log.pruneFacts) {
|
|
82108
|
+
const facts = await log.pruneFacts(scope, stored.map((checkpoint) => checkpoint.checkpointId));
|
|
82109
|
+
return selectSessionCheckpointsToPrune(stored.filter((checkpoint) => facts.written.has(checkpoint.checkpointId)), keepLast, new Set(facts.open));
|
|
82110
|
+
}
|
|
81911
82111
|
const committed = [];
|
|
81912
82112
|
for (const checkpoint of stored) {
|
|
81913
82113
|
if (await log.writtenDocSha256(scope, checkpoint.checkpointId) !== null) {
|
|
@@ -81920,6 +82120,8 @@ __name(selectStoredCheckpointsToPrune, "selectStoredCheckpointsToPrune");
|
|
|
81920
82120
|
|
|
81921
82121
|
// ../sdk/dist/store/checkpoint/disk.js
|
|
81922
82122
|
var DOCUMENT = /^(.+)\.json$/;
|
|
82123
|
+
var documentTurns = /* @__PURE__ */ new Map();
|
|
82124
|
+
var DOCUMENT_TURNS_KEPT = 2e4;
|
|
81923
82125
|
var DiskSessionCheckpointStore = class {
|
|
81924
82126
|
static {
|
|
81925
82127
|
__name(this, "DiskSessionCheckpointStore");
|
|
@@ -82003,10 +82205,29 @@ var DiskSessionCheckpointStore = class {
|
|
|
82003
82205
|
const id3 = DOCUMENT.exec(name2)?.[1];
|
|
82004
82206
|
if (id3 === void 0 || !isEntityId(id3, "checkpoint"))
|
|
82005
82207
|
continue;
|
|
82006
|
-
const
|
|
82208
|
+
const path2 = this.#paths.checkpointFile(locator, id3);
|
|
82209
|
+
const seen = await stat8(path2).catch((error62) => {
|
|
82210
|
+
if (error62.code === "ENOENT")
|
|
82211
|
+
return null;
|
|
82212
|
+
throw error62;
|
|
82213
|
+
});
|
|
82214
|
+
if (seen === null)
|
|
82215
|
+
continue;
|
|
82216
|
+
const known = documentTurns.get(path2);
|
|
82217
|
+
if (known !== void 0 && known.turnId !== checked2.turnId && known.size === seen.size && known.mtimeMs === seen.mtimeMs) {
|
|
82218
|
+
continue;
|
|
82219
|
+
}
|
|
82220
|
+
const text9 = await readIfPresent(path2);
|
|
82007
82221
|
if (text9 === null)
|
|
82008
82222
|
continue;
|
|
82009
82223
|
const checkpoint = parseStoredCheckpoint(text9, checked2, id3);
|
|
82224
|
+
if (documentTurns.size >= DOCUMENT_TURNS_KEPT)
|
|
82225
|
+
documentTurns.clear();
|
|
82226
|
+
documentTurns.set(path2, {
|
|
82227
|
+
turnId: checkpoint.turnId,
|
|
82228
|
+
size: seen.size,
|
|
82229
|
+
mtimeMs: seen.mtimeMs
|
|
82230
|
+
});
|
|
82010
82231
|
if (checkpoint.turnId === checked2.turnId)
|
|
82011
82232
|
checkpoints.push(checkpoint);
|
|
82012
82233
|
}
|
|
@@ -82177,7 +82398,10 @@ async function locateSession(paths2, sessionId5, parentSessionId) {
|
|
|
82177
82398
|
const parent = await findSessionLocator(paths2, parentSessionId) ?? {
|
|
82178
82399
|
sessionId: parentSessionId
|
|
82179
82400
|
};
|
|
82180
|
-
return {
|
|
82401
|
+
return {
|
|
82402
|
+
sessionId: sessionId5,
|
|
82403
|
+
ancestors: [...parent.ancestors ?? [], parent.sessionId]
|
|
82404
|
+
};
|
|
82181
82405
|
}
|
|
82182
82406
|
__name(locateSession, "locateSession");
|
|
82183
82407
|
var MAX_SEARCH_DEPTH = 64;
|
|
@@ -82225,7 +82449,10 @@ async function listDirectory(directory) {
|
|
|
82225
82449
|
__name(listDirectory, "listDirectory");
|
|
82226
82450
|
async function defaultSessionPaths(workingDirectory) {
|
|
82227
82451
|
const home = resolveNamzuHome();
|
|
82228
|
-
const project = await ensureProject({
|
|
82452
|
+
const project = await ensureProject({
|
|
82453
|
+
home,
|
|
82454
|
+
cwd: workingDirectory ?? process.cwd()
|
|
82455
|
+
});
|
|
82229
82456
|
return new SessionPaths({ home, slug: project.slug });
|
|
82230
82457
|
}
|
|
82231
82458
|
__name(defaultSessionPaths, "defaultSessionPaths");
|
|
@@ -82234,7 +82461,9 @@ function heldState(log) {
|
|
|
82234
82461
|
if (current)
|
|
82235
82462
|
return current;
|
|
82236
82463
|
const next2 = {
|
|
82237
|
-
checkpoints: new InMemorySessionCheckpointStore({
|
|
82464
|
+
checkpoints: new InMemorySessionCheckpointStore({
|
|
82465
|
+
log: checkpointLogView(log)
|
|
82466
|
+
}),
|
|
82238
82467
|
tokenBudgets: new InMemorySessionTokenBudgetStore()
|
|
82239
82468
|
};
|
|
82240
82469
|
held2.set(log.medium, next2);
|
|
@@ -82277,6 +82506,35 @@ function checkpointLogView(log) {
|
|
|
82277
82506
|
}
|
|
82278
82507
|
}
|
|
82279
82508
|
return open16.values();
|
|
82509
|
+
},
|
|
82510
|
+
async pruneFacts(scope, checkpointIds) {
|
|
82511
|
+
own2(scope);
|
|
82512
|
+
return foldSessionLog(log, {
|
|
82513
|
+
name: "prune-facts",
|
|
82514
|
+
mode: "tolerant",
|
|
82515
|
+
create: /* @__PURE__ */ __name(() => ({
|
|
82516
|
+
written: /* @__PURE__ */ new Map(),
|
|
82517
|
+
open: /* @__PURE__ */ new Map()
|
|
82518
|
+
}), "create"),
|
|
82519
|
+
apply: /* @__PURE__ */ __name(({ written, open: open16 }, { record: record4 }) => {
|
|
82520
|
+
if (record4.type === "checkpoint_written")
|
|
82521
|
+
written.set(record4.checkpointId, record4.docSha256);
|
|
82522
|
+
if (record4.type === "decision_requested")
|
|
82523
|
+
open16.set(record4.decisionId, record4.checkpointId);
|
|
82524
|
+
if (record4.type === "decision_resolved" || record4.type === "decision_expired") {
|
|
82525
|
+
open16.delete(record4.decisionId);
|
|
82526
|
+
}
|
|
82527
|
+
}, "apply"),
|
|
82528
|
+
result: /* @__PURE__ */ __name(({ written, open: open16 }) => {
|
|
82529
|
+
const wanted = /* @__PURE__ */ new Map();
|
|
82530
|
+
for (const id3 of checkpointIds) {
|
|
82531
|
+
const sha2564 = written.get(id3);
|
|
82532
|
+
if (sha2564 !== void 0)
|
|
82533
|
+
wanted.set(id3, sha2564);
|
|
82534
|
+
}
|
|
82535
|
+
return { written: wanted, open: [...open16.values()] };
|
|
82536
|
+
}, "result")
|
|
82537
|
+
});
|
|
82280
82538
|
}
|
|
82281
82539
|
};
|
|
82282
82540
|
}
|
|
@@ -82376,8 +82634,8 @@ async function resolveProviderContextWindow(provider, model, signal, timeoutMs,
|
|
|
82376
82634
|
const resolverSignal = signal ? AbortSignal.any([signal, deadline.signal]) : deadline.signal;
|
|
82377
82635
|
const interrupted = /* @__PURE__ */ Symbol("provider-context-window-interrupted");
|
|
82378
82636
|
let onAbort;
|
|
82379
|
-
const interruption = new Promise((
|
|
82380
|
-
onAbort = /* @__PURE__ */ __name(() =>
|
|
82637
|
+
const interruption = new Promise((resolve37) => {
|
|
82638
|
+
onAbort = /* @__PURE__ */ __name(() => resolve37(interrupted), "onAbort");
|
|
82381
82639
|
resolverSignal.addEventListener("abort", onAbort, { once: true });
|
|
82382
82640
|
});
|
|
82383
82641
|
const deadlineMs = timeoutMs === 0 ? 5e3 : Math.min(Math.max(0, timeoutMs), 2147483647);
|
|
@@ -82891,14 +83149,22 @@ __name(reconcileCallerMessages, "reconcileCallerMessages");
|
|
|
82891
83149
|
async function assertTurnIdIsNew(params, turnId6, storage) {
|
|
82892
83150
|
if (params.turnId === void 0)
|
|
82893
83151
|
return;
|
|
82894
|
-
|
|
82895
|
-
|
|
82896
|
-
|
|
82897
|
-
|
|
82898
|
-
|
|
82899
|
-
|
|
82900
|
-
|
|
82901
|
-
}
|
|
83152
|
+
const exists = await foldSessionLog(storage.log, {
|
|
83153
|
+
name: "turn-ids",
|
|
83154
|
+
mode: "tolerant",
|
|
83155
|
+
create: /* @__PURE__ */ __name(() => /* @__PURE__ */ new Set(), "create"),
|
|
83156
|
+
apply: /* @__PURE__ */ __name((ids, { record: record4 }) => {
|
|
83157
|
+
if (record4.type === "turn_started")
|
|
83158
|
+
ids.add(record4.turnId);
|
|
83159
|
+
}, "apply"),
|
|
83160
|
+
result: /* @__PURE__ */ __name((ids) => ids.has(turnId6), "result")
|
|
83161
|
+
});
|
|
83162
|
+
if (exists) {
|
|
83163
|
+
throw new NamzuError({
|
|
83164
|
+
code: "invalid_config",
|
|
83165
|
+
message: `Turn ${turnId6} already exists in session ${params.sessionId}. A new turn needs a new id; to continue that turn, pass resumeFromCheckpoint.`,
|
|
83166
|
+
details: { sessionId: params.sessionId, turnId: turnId6 }
|
|
83167
|
+
});
|
|
82902
83168
|
}
|
|
82903
83169
|
}
|
|
82904
83170
|
__name(assertTurnIdIsNew, "assertTurnIdIsNew");
|
|
@@ -84580,8 +84846,8 @@ function createMockBidiProvider(script = {}) {
|
|
|
84580
84846
|
}
|
|
84581
84847
|
if (done)
|
|
84582
84848
|
return;
|
|
84583
|
-
await new Promise((
|
|
84584
|
-
wake =
|
|
84849
|
+
await new Promise((resolve37) => {
|
|
84850
|
+
wake = resolve37;
|
|
84585
84851
|
});
|
|
84586
84852
|
wake = void 0;
|
|
84587
84853
|
}
|
|
@@ -84849,8 +85115,8 @@ async function startBidiTurn(params) {
|
|
|
84849
85115
|
}
|
|
84850
85116
|
if (closed)
|
|
84851
85117
|
return;
|
|
84852
|
-
await new Promise((
|
|
84853
|
-
wake =
|
|
85118
|
+
await new Promise((resolve37) => {
|
|
85119
|
+
wake = resolve37;
|
|
84854
85120
|
});
|
|
84855
85121
|
wake = void 0;
|
|
84856
85122
|
}
|
|
@@ -85284,7 +85550,7 @@ __name(ftsMatchExpression, "ftsMatchExpression");
|
|
|
85284
85550
|
|
|
85285
85551
|
// ../sdk/dist/store/session-index/rebuild.js
|
|
85286
85552
|
import { constants as fsConstants } from "node:fs";
|
|
85287
|
-
import { open as open13, readdir as readdir6, stat as
|
|
85553
|
+
import { open as open13, readdir as readdir6, stat as stat9 } from "node:fs/promises";
|
|
85288
85554
|
import { join as join24 } from "node:path";
|
|
85289
85555
|
|
|
85290
85556
|
// ../sdk/dist/store/session-index/refs.js
|
|
@@ -85961,7 +86227,7 @@ var SessionIndexBase = class {
|
|
|
85961
86227
|
};
|
|
85962
86228
|
async function pathExists(path2) {
|
|
85963
86229
|
try {
|
|
85964
|
-
await
|
|
86230
|
+
await stat9(path2);
|
|
85965
86231
|
return true;
|
|
85966
86232
|
} catch (error62) {
|
|
85967
86233
|
if (error62.code === "ENOENT")
|
|
@@ -85990,7 +86256,7 @@ var ScanSessionIndex = class _ScanSessionIndex extends SessionIndexBase {
|
|
|
85990
86256
|
/** An empty index; fill it with `indexSession`, `refresh` or `sync`. */
|
|
85991
86257
|
constructor() {
|
|
85992
86258
|
super();
|
|
85993
|
-
const
|
|
86259
|
+
const sessions2 = this.#sessions;
|
|
85994
86260
|
const turns = this.#turns;
|
|
85995
86261
|
const decisions = this.#decisions;
|
|
85996
86262
|
const refs = this.#refs;
|
|
@@ -86004,9 +86270,9 @@ var ScanSessionIndex = class _ScanSessionIndex extends SessionIndexBase {
|
|
|
86004
86270
|
map2.delete(k);
|
|
86005
86271
|
}, "dropWhere");
|
|
86006
86272
|
this.#sink = {
|
|
86007
|
-
getSession: /* @__PURE__ */ __name((id3) =>
|
|
86273
|
+
getSession: /* @__PURE__ */ __name((id3) => sessions2.get(id3), "getSession"),
|
|
86008
86274
|
putSession: /* @__PURE__ */ __name((row) => {
|
|
86009
|
-
|
|
86275
|
+
sessions2.set(row.id, { ...row });
|
|
86010
86276
|
}, "putSession"),
|
|
86011
86277
|
putProject: /* @__PURE__ */ __name((slug, projectId2, cwd) => {
|
|
86012
86278
|
if (!projects.has(slug))
|
|
@@ -86049,7 +86315,7 @@ var ScanSessionIndex = class _ScanSessionIndex extends SessionIndexBase {
|
|
|
86049
86315
|
rows.push({ ...row });
|
|
86050
86316
|
}, "putEvidence"),
|
|
86051
86317
|
clearSession: /* @__PURE__ */ __name((sessionId5) => {
|
|
86052
|
-
|
|
86318
|
+
sessions2.delete(sessionId5);
|
|
86053
86319
|
dropWhere(turns, (row) => row.sessionId === sessionId5);
|
|
86054
86320
|
dropWhere(decisions, (row) => row.sessionId === sessionId5);
|
|
86055
86321
|
dropWhere(refs, (row) => row.sessionId === sessionId5);
|
|
@@ -86110,9 +86376,9 @@ var ScanSessionIndex = class _ScanSessionIndex extends SessionIndexBase {
|
|
|
86110
86376
|
async searchEvidence(options) {
|
|
86111
86377
|
const match = evidenceMatcher(options);
|
|
86112
86378
|
const limit = options.limit ?? 100;
|
|
86113
|
-
const
|
|
86379
|
+
const sessions2 = options.sessionId === void 0 ? [...this.#evidence.keys()].sort() : this.#evidence.has(options.sessionId) ? [options.sessionId] : [];
|
|
86114
86380
|
const hits = [];
|
|
86115
|
-
for (const sessionId5 of
|
|
86381
|
+
for (const sessionId5 of sessions2) {
|
|
86116
86382
|
const rows = [...this.#evidence.get(sessionId5) ?? []].sort(compareBy((row) => row.seq, (row) => row.part));
|
|
86117
86383
|
for (const row of rows) {
|
|
86118
86384
|
const found = match(row.text);
|
|
@@ -86131,7 +86397,7 @@ var ScanSessionIndex = class _ScanSessionIndex extends SessionIndexBase {
|
|
|
86131
86397
|
|
|
86132
86398
|
// ../sdk/dist/store/session-index/sqlite.js
|
|
86133
86399
|
import { existsSync as existsSync3, statSync as statSync2 } from "node:fs";
|
|
86134
|
-
import { mkdir as mkdir12, readdir as readdir7, rename as rename5, rm as rm4, stat as
|
|
86400
|
+
import { mkdir as mkdir12, readdir as readdir7, rename as rename5, rm as rm4, stat as stat10 } from "node:fs/promises";
|
|
86135
86401
|
import { createRequire as createRequire2 } from "node:module";
|
|
86136
86402
|
import { basename as basename9, dirname as dirname17, join as join25 } from "node:path";
|
|
86137
86403
|
var SESSION_INDEX_VERSION = 1;
|
|
@@ -86315,7 +86581,7 @@ __name(processAlive, "processAlive");
|
|
|
86315
86581
|
var ABANDONED_REBUILD_AFTER_MS = 60 * 60 * 1e3;
|
|
86316
86582
|
async function modifiedAt(path2) {
|
|
86317
86583
|
try {
|
|
86318
|
-
return (await
|
|
86584
|
+
return (await stat10(path2)).mtimeMs;
|
|
86319
86585
|
} catch (error62) {
|
|
86320
86586
|
if (error62.code === "ENOENT")
|
|
86321
86587
|
return null;
|
|
@@ -87955,17 +88221,17 @@ async function drainParkedTurns(params) {
|
|
|
87955
88221
|
const failed = [];
|
|
87956
88222
|
const unreleased = [];
|
|
87957
88223
|
let stopped = false;
|
|
87958
|
-
const
|
|
88224
|
+
const sessions2 = /* @__PURE__ */ new Map();
|
|
87959
88225
|
const pending2 = await index.listPendingDecisions(params.sessionId ? { sessionId: params.sessionId } : {});
|
|
87960
88226
|
const consider = /* @__PURE__ */ __name(async (sessionId5) => {
|
|
87961
|
-
if (
|
|
88227
|
+
if (sessions2.has(sessionId5))
|
|
87962
88228
|
return;
|
|
87963
88229
|
const session = await index.getSession(sessionId5);
|
|
87964
88230
|
if (!session)
|
|
87965
88231
|
return;
|
|
87966
88232
|
if (params.projectId && session.projectId !== params.projectId)
|
|
87967
88233
|
return;
|
|
87968
|
-
|
|
88234
|
+
sessions2.set(sessionId5, { sessionId: sessionId5, projectId: session.projectId, logPath: session.logPath });
|
|
87969
88235
|
}, "consider");
|
|
87970
88236
|
for (const decision2 of pending2)
|
|
87971
88237
|
await consider(decision2.sessionId);
|
|
@@ -87977,7 +88243,7 @@ async function drainParkedTurns(params) {
|
|
|
87977
88243
|
await consider(session.id);
|
|
87978
88244
|
}
|
|
87979
88245
|
}
|
|
87980
|
-
const candidates = [...
|
|
88246
|
+
const candidates = [...sessions2.values()].slice(0, pageSize);
|
|
87981
88247
|
const handle = /* @__PURE__ */ __name(async (candidate) => {
|
|
87982
88248
|
const log = openLog(candidate.sessionId, candidate.logPath);
|
|
87983
88249
|
const now = params.now ?? Date.now();
|
|
@@ -89831,7 +90097,7 @@ ${JSON.stringify({
|
|
|
89831
90097
|
__name(createScopedEvidenceRecallStep, "createScopedEvidenceRecallStep");
|
|
89832
90098
|
|
|
89833
90099
|
// ../sdk/dist/skills/loader.js
|
|
89834
|
-
import { readFile as readFile14, readdir as readdir8, stat as
|
|
90100
|
+
import { readFile as readFile14, readdir as readdir8, stat as stat11 } from "node:fs/promises";
|
|
89835
90101
|
import { basename as basename10, join as join28 } from "node:path";
|
|
89836
90102
|
|
|
89837
90103
|
// ../sdk/dist/utils/frontmatter.js
|
|
@@ -90154,12 +90420,12 @@ async function discoverSkills(parentDir, log) {
|
|
|
90154
90420
|
if (entry.startsWith(".") || entry.startsWith("_"))
|
|
90155
90421
|
continue;
|
|
90156
90422
|
const fullPath = join28(parentDir, entry);
|
|
90157
|
-
const s = await
|
|
90423
|
+
const s = await stat11(fullPath);
|
|
90158
90424
|
if (!s.isDirectory())
|
|
90159
90425
|
continue;
|
|
90160
90426
|
const skillMdPath = join28(fullPath, SKILL_FILENAME);
|
|
90161
90427
|
try {
|
|
90162
|
-
await
|
|
90428
|
+
await stat11(skillMdPath);
|
|
90163
90429
|
dirs.push(fullPath);
|
|
90164
90430
|
} catch {
|
|
90165
90431
|
}
|
|
@@ -90172,7 +90438,7 @@ async function discoverSkills(parentDir, log) {
|
|
|
90172
90438
|
__name(discoverSkills, "discoverSkills");
|
|
90173
90439
|
|
|
90174
90440
|
// ../sdk/dist/skills/registry.js
|
|
90175
|
-
import { stat as
|
|
90441
|
+
import { stat as stat12 } from "node:fs/promises";
|
|
90176
90442
|
import { join as join29 } from "node:path";
|
|
90177
90443
|
var SkillCollisionError = class extends RegistryCollisionError {
|
|
90178
90444
|
static {
|
|
@@ -90213,7 +90479,7 @@ var SkillRegistry = class {
|
|
|
90213
90479
|
async stamp(name2, dirPath) {
|
|
90214
90480
|
const path2 = join29(dirPath, SKILL_FILENAME);
|
|
90215
90481
|
try {
|
|
90216
|
-
const info = await
|
|
90482
|
+
const info = await stat12(path2);
|
|
90217
90483
|
this.stamps.set(name2, { path: path2, mtimeMs: info.mtimeMs, size: info.size });
|
|
90218
90484
|
} catch {
|
|
90219
90485
|
this.stamps.delete(name2);
|
|
@@ -90314,7 +90580,7 @@ var SkillRegistry = class {
|
|
|
90314
90580
|
const path2 = previous?.path ?? join29(dirPath, SKILL_FILENAME);
|
|
90315
90581
|
let info;
|
|
90316
90582
|
try {
|
|
90317
|
-
info = await
|
|
90583
|
+
info = await stat12(path2);
|
|
90318
90584
|
} catch {
|
|
90319
90585
|
return "gone";
|
|
90320
90586
|
}
|
|
@@ -90505,8 +90771,8 @@ var ALL_SLOTS = [
|
|
|
90505
90771
|
var DEFAULT_MODULE_TIMEOUT_MS = 1e4;
|
|
90506
90772
|
async function importWithDeadline(fileUrl, importModule, timeoutMs) {
|
|
90507
90773
|
let timer;
|
|
90508
|
-
const deadline = new Promise((
|
|
90509
|
-
timer = setTimeout(() =>
|
|
90774
|
+
const deadline = new Promise((resolve37) => {
|
|
90775
|
+
timer = setTimeout(() => resolve37({ status: "abandoned" }), timeoutMs);
|
|
90510
90776
|
});
|
|
90511
90777
|
try {
|
|
90512
90778
|
const result = await Promise.race([
|
|
@@ -90960,7 +91226,7 @@ async function resolveForRun(entry, context2) {
|
|
|
90960
91226
|
if (!context2.signal)
|
|
90961
91227
|
return await entry.forRun(context2);
|
|
90962
91228
|
const signal = context2.signal;
|
|
90963
|
-
return await new Promise((
|
|
91229
|
+
return await new Promise((resolve37, reject2) => {
|
|
90964
91230
|
const onAbort = /* @__PURE__ */ __name(() => {
|
|
90965
91231
|
signal.removeEventListener("abort", onAbort);
|
|
90966
91232
|
reject2(signal.reason);
|
|
@@ -90970,7 +91236,7 @@ async function resolveForRun(entry, context2) {
|
|
|
90970
91236
|
onAbort();
|
|
90971
91237
|
return;
|
|
90972
91238
|
}
|
|
90973
|
-
Promise.resolve().then(() => entry.forRun(context2)).then(
|
|
91239
|
+
Promise.resolve().then(() => entry.forRun(context2)).then(resolve37, reject2).finally(() => signal.removeEventListener("abort", onAbort));
|
|
90974
91240
|
});
|
|
90975
91241
|
}
|
|
90976
91242
|
__name(resolveForRun, "resolveForRun");
|
|
@@ -93051,7 +93317,7 @@ function defineAgent(options) {
|
|
|
93051
93317
|
__name(defineAgent, "defineAgent");
|
|
93052
93318
|
|
|
93053
93319
|
// ../sdk/dist/agents/file-definitions.js
|
|
93054
|
-
import { readFile as readFile16, readdir as readdir10, stat as
|
|
93320
|
+
import { readFile as readFile16, readdir as readdir10, stat as stat13 } from "node:fs/promises";
|
|
93055
93321
|
import { join as join31 } from "node:path";
|
|
93056
93322
|
var MAX_AGENT_FILE_CHARS = 32e3;
|
|
93057
93323
|
var MAX_AGENT_FILE_BYTES = 4 * 1024 * 1024;
|
|
@@ -93096,7 +93362,7 @@ __name(discoverAgentDefinitions, "discoverAgentDefinitions");
|
|
|
93096
93362
|
async function parseAgentFile(path2, source, reserved = DEFAULT_RESERVED_AGENT_NAMES, permissionModes) {
|
|
93097
93363
|
let raw;
|
|
93098
93364
|
try {
|
|
93099
|
-
if ((await
|
|
93365
|
+
if ((await stat13(path2)).size > MAX_AGENT_FILE_BYTES) {
|
|
93100
93366
|
return { path: path2, reason: "is larger than 4 MiB, which no agent file is" };
|
|
93101
93367
|
}
|
|
93102
93368
|
raw = await readFile16(path2, "utf8");
|
|
@@ -93597,15 +93863,15 @@ var DiskTaskStore = class {
|
|
|
93597
93863
|
break;
|
|
93598
93864
|
await existing.catch(() => void 0);
|
|
93599
93865
|
}
|
|
93600
|
-
let
|
|
93866
|
+
let resolve37;
|
|
93601
93867
|
const lock = new Promise((r) => {
|
|
93602
|
-
|
|
93868
|
+
resolve37 = r;
|
|
93603
93869
|
});
|
|
93604
93870
|
this.locks.set(taskId, lock);
|
|
93605
93871
|
try {
|
|
93606
93872
|
return await fn();
|
|
93607
93873
|
} finally {
|
|
93608
|
-
|
|
93874
|
+
resolve37?.();
|
|
93609
93875
|
if (this.locks.get(taskId) === lock) {
|
|
93610
93876
|
this.locks.delete(taskId);
|
|
93611
93877
|
}
|
|
@@ -95188,18 +95454,18 @@ var MarkdownMemoryStore = class {
|
|
|
95188
95454
|
if (!fileName2.endsWith(".md") || fileName2 === MEMORY_INDEX_FILE)
|
|
95189
95455
|
continue;
|
|
95190
95456
|
const path2 = join34(dir, fileName2);
|
|
95191
|
-
const
|
|
95457
|
+
const stat20 = await lstat8(path2).catch((error62) => {
|
|
95192
95458
|
if (error62.code === "ENOENT")
|
|
95193
95459
|
return void 0;
|
|
95194
95460
|
throw error62;
|
|
95195
95461
|
});
|
|
95196
|
-
if (!
|
|
95462
|
+
if (!stat20)
|
|
95197
95463
|
continue;
|
|
95198
|
-
if (
|
|
95464
|
+
if (stat20.isSymbolicLink())
|
|
95199
95465
|
invalidFile(path2, "a memory file must not be a symlink");
|
|
95200
|
-
if (!
|
|
95466
|
+
if (!stat20.isFile())
|
|
95201
95467
|
invalidFile(path2, "a memory file must be a regular file");
|
|
95202
|
-
if (
|
|
95468
|
+
if (stat20.size > MEMORY_FILE_MAX_BYTES) {
|
|
95203
95469
|
invalidFile(path2, `larger than the ${MEMORY_FILE_MAX_BYTES}-byte memory file limit`);
|
|
95204
95470
|
}
|
|
95205
95471
|
const bytes = await readFile18(path2);
|
|
@@ -95211,7 +95477,7 @@ var MarkdownMemoryStore = class {
|
|
|
95211
95477
|
}
|
|
95212
95478
|
if (raw.includes("\0"))
|
|
95213
95479
|
invalidFile(path2, "contains NUL bytes");
|
|
95214
|
-
const record4 = decodeMemoryFile(raw, path2, fileName2,
|
|
95480
|
+
const record4 = decodeMemoryFile(raw, path2, fileName2, stat20.mtimeMs);
|
|
95215
95481
|
const other = loaded.get(record4.entry.id);
|
|
95216
95482
|
if (other) {
|
|
95217
95483
|
const renamedHandWritten = /* @__PURE__ */ __name((a, b) => !a.dated && a.derived && b.dated && !b.derived && a.entry.updatedAt < b.entry.updatedAt, "renamedHandWritten");
|
|
@@ -97798,7 +98064,7 @@ var StdioTransport = class {
|
|
|
97798
98064
|
this.exitPending = false;
|
|
97799
98065
|
return;
|
|
97800
98066
|
}
|
|
97801
|
-
await new Promise((
|
|
98067
|
+
await new Promise((resolve37) => {
|
|
97802
98068
|
let settled = false;
|
|
97803
98069
|
const finish2 = /* @__PURE__ */ __name(() => {
|
|
97804
98070
|
if (settled)
|
|
@@ -97806,7 +98072,7 @@ var StdioTransport = class {
|
|
|
97806
98072
|
settled = true;
|
|
97807
98073
|
clearTimeout(escalate);
|
|
97808
98074
|
clearTimeout(giveUp);
|
|
97809
|
-
|
|
98075
|
+
resolve37();
|
|
97810
98076
|
}, "finish");
|
|
97811
98077
|
child.once("close", finish2);
|
|
97812
98078
|
child.once("error", finish2);
|
|
@@ -98762,7 +99028,7 @@ var MCPClient = class {
|
|
|
98762
99028
|
capabilities: this.config.capabilities ?? {}
|
|
98763
99029
|
});
|
|
98764
99030
|
const controller = new AbortController();
|
|
98765
|
-
return new Promise((
|
|
99031
|
+
return new Promise((resolve37) => {
|
|
98766
99032
|
let settled = false;
|
|
98767
99033
|
const finish2 = /* @__PURE__ */ __name((answer) => {
|
|
98768
99034
|
if (settled)
|
|
@@ -98771,7 +99037,7 @@ var MCPClient = class {
|
|
|
98771
99037
|
clearTimeout(timer);
|
|
98772
99038
|
if (this.pendingRequests.get(id3) === entry)
|
|
98773
99039
|
this.pendingRequests.delete(id3);
|
|
98774
|
-
|
|
99040
|
+
resolve37(answer);
|
|
98775
99041
|
}, "finish");
|
|
98776
99042
|
const entry = {
|
|
98777
99043
|
resolve: /* @__PURE__ */ __name((value) => finish2({ kind: "result", result: value }), "resolve"),
|
|
@@ -99345,8 +99611,8 @@ var MCPClient = class {
|
|
|
99345
99611
|
let settled = false;
|
|
99346
99612
|
let resolvePublic;
|
|
99347
99613
|
let rejectPublic;
|
|
99348
|
-
const result = new Promise((
|
|
99349
|
-
resolvePublic =
|
|
99614
|
+
const result = new Promise((resolve37, reject2) => {
|
|
99615
|
+
resolvePublic = resolve37;
|
|
99350
99616
|
rejectPublic = reject2;
|
|
99351
99617
|
});
|
|
99352
99618
|
const entry = {
|
|
@@ -102140,21 +102406,21 @@ function guardedLookup(hostname3, options, callback) {
|
|
|
102140
102406
|
}
|
|
102141
102407
|
__name(guardedLookup, "guardedLookup");
|
|
102142
102408
|
function postHookJson(input2) {
|
|
102143
|
-
return new Promise((
|
|
102409
|
+
return new Promise((resolve37) => {
|
|
102144
102410
|
let url2;
|
|
102145
102411
|
try {
|
|
102146
102412
|
url2 = new URL(input2.url);
|
|
102147
102413
|
} catch {
|
|
102148
|
-
|
|
102414
|
+
resolve37({ status: null, body: "", timedOut: false, error: "the url is not valid" });
|
|
102149
102415
|
return;
|
|
102150
102416
|
}
|
|
102151
102417
|
if (url2.protocol !== "http:" && url2.protocol !== "https:") {
|
|
102152
|
-
|
|
102418
|
+
resolve37({ status: null, body: "", timedOut: false, error: "the url must be http or https" });
|
|
102153
102419
|
return;
|
|
102154
102420
|
}
|
|
102155
102421
|
const literal3 = url2.hostname.replace(/^\[|\]$/g, "");
|
|
102156
102422
|
if (isIP3(literal3) !== 0 && !isReachableHookAddress(literal3)) {
|
|
102157
|
-
|
|
102423
|
+
resolve37({
|
|
102158
102424
|
status: null,
|
|
102159
102425
|
body: "",
|
|
102160
102426
|
timedOut: false,
|
|
@@ -102179,7 +102445,7 @@ function postHookJson(input2) {
|
|
|
102179
102445
|
settled = true;
|
|
102180
102446
|
clearTimeout(timer);
|
|
102181
102447
|
input2.signal?.removeEventListener("abort", onAbort);
|
|
102182
|
-
|
|
102448
|
+
resolve37(response);
|
|
102183
102449
|
}, "finish");
|
|
102184
102450
|
const onAbort = /* @__PURE__ */ __name(() => {
|
|
102185
102451
|
req.destroy();
|
|
@@ -102326,7 +102592,7 @@ function runShellHook(entry, input2, signal) {
|
|
|
102326
102592
|
const payload = shellHookPayload(input2);
|
|
102327
102593
|
const toolPath = pathOf2(input2.toolInput);
|
|
102328
102594
|
const { NAMZU_TURN_ID: _inheritedTurnId, ...inherited } = process.env;
|
|
102329
|
-
return new Promise((
|
|
102595
|
+
return new Promise((resolve37) => {
|
|
102330
102596
|
let child;
|
|
102331
102597
|
try {
|
|
102332
102598
|
const env = {
|
|
@@ -102357,7 +102623,7 @@ function runShellHook(entry, input2, signal) {
|
|
|
102357
102623
|
...process.platform === "win32" ? {} : { shell: { path: "sh", dialect: "sh", source: "sh" } }
|
|
102358
102624
|
});
|
|
102359
102625
|
} catch (error62) {
|
|
102360
|
-
|
|
102626
|
+
resolve37({
|
|
102361
102627
|
exitCode: null,
|
|
102362
102628
|
timedOut: false,
|
|
102363
102629
|
stdout: "",
|
|
@@ -102383,7 +102649,7 @@ function runShellHook(entry, input2, signal) {
|
|
|
102383
102649
|
settled = true;
|
|
102384
102650
|
clearTimeout(timer);
|
|
102385
102651
|
signal?.removeEventListener("abort", onAbort);
|
|
102386
|
-
|
|
102652
|
+
resolve37(outcome);
|
|
102387
102653
|
}, "finish");
|
|
102388
102654
|
const killTree2 = /* @__PURE__ */ __name(() => {
|
|
102389
102655
|
if (child.pid !== void 0 && process.platform !== "win32") {
|
|
@@ -102779,8 +103045,8 @@ ${json3}`;
|
|
|
102779
103045
|
const combined = signal ? AbortSignal.any([signal, deadline]) : deadline;
|
|
102780
103046
|
let reply;
|
|
102781
103047
|
try {
|
|
102782
|
-
reply = await new Promise((
|
|
102783
|
-
const stop = /* @__PURE__ */ __name(() =>
|
|
103048
|
+
reply = await new Promise((resolve37, reject2) => {
|
|
103049
|
+
const stop = /* @__PURE__ */ __name(() => resolve37(void 0), "stop");
|
|
102784
103050
|
combined.addEventListener("abort", stop, { once: true });
|
|
102785
103051
|
judge({
|
|
102786
103052
|
instruction: PROMPT_HOOK_INSTRUCTION,
|
|
@@ -102788,7 +103054,7 @@ ${json3}`;
|
|
|
102788
103054
|
sessionId: input2.sessionId,
|
|
102789
103055
|
...input2.turnId !== void 0 ? { turnId: input2.turnId } : {},
|
|
102790
103056
|
signal: combined
|
|
102791
|
-
}).then(
|
|
103057
|
+
}).then(resolve37, reject2);
|
|
102792
103058
|
});
|
|
102793
103059
|
} catch (error62) {
|
|
102794
103060
|
log.warn("prompt hook failed", {
|
|
@@ -103010,8 +103276,8 @@ async function settleWithSignal(operation, signal, acceptAfterAbort) {
|
|
|
103010
103276
|
return operation;
|
|
103011
103277
|
const settled = operation.then((value) => ({ kind: "fulfilled", value }), (reason) => ({ kind: "rejected", reason }));
|
|
103012
103278
|
let onAbort;
|
|
103013
|
-
const aborted2 = new Promise((
|
|
103014
|
-
onAbort = /* @__PURE__ */ __name(() =>
|
|
103279
|
+
const aborted2 = new Promise((resolve37) => {
|
|
103280
|
+
onAbort = /* @__PURE__ */ __name(() => resolve37({ kind: "aborted" }), "onAbort");
|
|
103015
103281
|
if (signal.aborted) {
|
|
103016
103282
|
onAbort();
|
|
103017
103283
|
return;
|
|
@@ -103030,8 +103296,8 @@ async function settleWithSignal(operation, signal, acceptAfterAbort) {
|
|
|
103030
103296
|
let timer;
|
|
103031
103297
|
const grace = await Promise.race([
|
|
103032
103298
|
settled,
|
|
103033
|
-
new Promise((
|
|
103034
|
-
timer = setTimeout(() =>
|
|
103299
|
+
new Promise((resolve37) => {
|
|
103300
|
+
timer = setTimeout(() => resolve37({ kind: "grace_elapsed" }), 0);
|
|
103035
103301
|
})
|
|
103036
103302
|
]).finally(() => {
|
|
103037
103303
|
if (timer !== void 0)
|
|
@@ -104322,8 +104588,8 @@ var TopicManager = class {
|
|
|
104322
104588
|
if (!topic) {
|
|
104323
104589
|
throw new Error(`Topic ${topicId2} not found`);
|
|
104324
104590
|
}
|
|
104325
|
-
const
|
|
104326
|
-
const blocking =
|
|
104591
|
+
const sessions2 = await this.deps.sessionStore.listSessionsByTopic(topicId2, tenantId2);
|
|
104592
|
+
const blocking = sessions2.filter((s) => ARCHIVAL_BLOCKING_STATUSES.has(s.status));
|
|
104327
104593
|
if (blocking.length > 0) {
|
|
104328
104594
|
throw new TopicNotEmptyError({
|
|
104329
104595
|
topicId: topicId2,
|
|
@@ -104358,26 +104624,26 @@ var TopicManager = class {
|
|
|
104358
104624
|
* #5: deny-by-default; no implicit cascade into SessionStore.
|
|
104359
104625
|
*/
|
|
104360
104626
|
async delete(topicId2, tenantId2) {
|
|
104361
|
-
const
|
|
104362
|
-
if (
|
|
104627
|
+
const sessions2 = await this.deps.sessionStore.listSessionsByTopic(topicId2, tenantId2);
|
|
104628
|
+
if (sessions2.length > 0) {
|
|
104363
104629
|
throw new TopicNotEmptyError({
|
|
104364
104630
|
topicId: topicId2,
|
|
104365
104631
|
tenantId: tenantId2,
|
|
104366
104632
|
op: "delete",
|
|
104367
|
-
blockingSessions: summarizeBlocking(
|
|
104368
|
-
totalBlockingSessions:
|
|
104633
|
+
blockingSessions: summarizeBlocking(sessions2),
|
|
104634
|
+
totalBlockingSessions: sessions2.length
|
|
104369
104635
|
});
|
|
104370
104636
|
}
|
|
104371
104637
|
await this.deps.topicStore.deleteTopic(topicId2, tenantId2);
|
|
104372
104638
|
}
|
|
104373
104639
|
};
|
|
104374
|
-
function summarizeBlocking(
|
|
104375
|
-
return
|
|
104640
|
+
function summarizeBlocking(sessions2) {
|
|
104641
|
+
return sessions2.slice(0, TOPIC_NOT_EMPTY_SAMPLE_LIMIT).map((s) => ({ sessionId: s.id, status: s.status }));
|
|
104376
104642
|
}
|
|
104377
104643
|
__name(summarizeBlocking, "summarizeBlocking");
|
|
104378
104644
|
|
|
104379
104645
|
// ../sdk/dist/manager/agent/lifecycle.js
|
|
104380
|
-
import { realpath as realpath11, rm as rm5, stat as
|
|
104646
|
+
import { realpath as realpath11, rm as rm5, stat as stat14 } from "node:fs/promises";
|
|
104381
104647
|
import { isAbsolute as isAbsolute12, relative as relative7, resolve as resolve20, sep as sep9 } from "node:path";
|
|
104382
104648
|
|
|
104383
104649
|
// ../sdk/dist/session/handoff/capacity.js
|
|
@@ -104480,8 +104746,8 @@ var ProjectManager = class {
|
|
|
104480
104746
|
if (!listByProject) {
|
|
104481
104747
|
throw new Error(`Project ${projectId2} cannot be archived: this SessionStore does not implement listSessionsByProject, so whether a session is still running in the workspace cannot be established. Implement it, or settle and verify the sessions through your own path before closing the workspace.`);
|
|
104482
104748
|
}
|
|
104483
|
-
const
|
|
104484
|
-
const blocking =
|
|
104749
|
+
const sessions2 = await listByProject.call(this.deps.store, projectId2, tenantId2);
|
|
104750
|
+
const blocking = sessions2.filter((s) => ARCHIVAL_BLOCKING_STATUSES2.has(s.status));
|
|
104485
104751
|
if (blocking.length > 0) {
|
|
104486
104752
|
throw new ProjectNotEmptyError({
|
|
104487
104753
|
projectId: projectId2,
|
|
@@ -104560,7 +104826,7 @@ async function requireIsolatedWorktreePath(ref, callerCwd, subdirectory) {
|
|
|
104560
104826
|
realpath11(meta3.worktreePath),
|
|
104561
104827
|
realpath11(resolve20(callerCwd ?? process.cwd()))
|
|
104562
104828
|
]);
|
|
104563
|
-
if (!(await
|
|
104829
|
+
if (!(await stat14(physicalPaths[0])).isDirectory()) {
|
|
104564
104830
|
throw new Error("The worktree path is not a directory");
|
|
104565
104831
|
}
|
|
104566
104832
|
} catch (cause) {
|
|
@@ -104584,7 +104850,7 @@ async function requireIsolatedWorktreePath(ref, callerCwd, subdirectory) {
|
|
|
104584
104850
|
let physicalChild;
|
|
104585
104851
|
try {
|
|
104586
104852
|
physicalChild = await realpath11(lexicalChild);
|
|
104587
|
-
if (!(await
|
|
104853
|
+
if (!(await stat14(physicalChild)).isDirectory()) {
|
|
104588
104854
|
throw new Error("The selected worktree path is not a directory");
|
|
104589
104855
|
}
|
|
104590
104856
|
} catch (cause) {
|
|
@@ -105390,9 +105656,9 @@ var AgentManager = class {
|
|
|
105390
105656
|
if (isTerminalAgentTaskState(agentTask.state)) {
|
|
105391
105657
|
return Promise.resolve();
|
|
105392
105658
|
}
|
|
105393
|
-
return new Promise((
|
|
105659
|
+
return new Promise((resolve37) => {
|
|
105394
105660
|
const existing = this.completionCallbacks.get(taskId) ?? [];
|
|
105395
|
-
existing.push(
|
|
105661
|
+
existing.push(resolve37);
|
|
105396
105662
|
this.completionCallbacks.set(taskId, existing);
|
|
105397
105663
|
});
|
|
105398
105664
|
}
|
|
@@ -106125,8 +106391,8 @@ var AgentManager = class {
|
|
|
106125
106391
|
resolveCompletionCallbacks(taskId) {
|
|
106126
106392
|
const callbacks = this.completionCallbacks.get(taskId);
|
|
106127
106393
|
if (callbacks) {
|
|
106128
|
-
for (const
|
|
106129
|
-
|
|
106394
|
+
for (const resolve37 of callbacks)
|
|
106395
|
+
resolve37();
|
|
106130
106396
|
this.completionCallbacks.delete(taskId);
|
|
106131
106397
|
}
|
|
106132
106398
|
}
|
|
@@ -107674,7 +107940,7 @@ var MockLLMProvider = class {
|
|
|
107674
107940
|
async delay() {
|
|
107675
107941
|
if (this.responseDelayMs <= 0)
|
|
107676
107942
|
return;
|
|
107677
|
-
await new Promise((
|
|
107943
|
+
await new Promise((resolve37) => setTimeout(resolve37, this.responseDelayMs));
|
|
107678
107944
|
}
|
|
107679
107945
|
/**
|
|
107680
107946
|
* The turn to play. A script shorter than the turn repeats its last
|
|
@@ -107787,7 +108053,7 @@ registerMock();
|
|
|
107787
108053
|
// ../sdk/dist/sandbox/provider/local.js
|
|
107788
108054
|
import { spawn as spawn5, spawnSync } from "node:child_process";
|
|
107789
108055
|
import { constants as constants4, accessSync as accessSync2, existsSync as existsSync5, realpathSync as realpathSync3 } from "node:fs";
|
|
107790
|
-
import { readFile as fsReadFile, writeFile as fsWriteFile, mkdir as mkdir16, open as open15, readdir as readdir13, rename as rename7, rm as rm6, stat as
|
|
108056
|
+
import { readFile as fsReadFile, writeFile as fsWriteFile, mkdir as mkdir16, open as open15, readdir as readdir13, rename as rename7, rm as rm6, stat as stat15 } from "node:fs/promises";
|
|
107791
108057
|
import { tmpdir as tmpdir3 } from "node:os";
|
|
107792
108058
|
import { dirname as dirname20, isAbsolute as isAbsolute14, join as join38, parse as parse8, resolve as resolve21 } from "node:path";
|
|
107793
108059
|
|
|
@@ -108427,6 +108693,7 @@ var VCS_NAMES = new Set(module_.vcs);
|
|
|
108427
108693
|
|
|
108428
108694
|
// ../sdk/dist/sandbox/file-walk.js
|
|
108429
108695
|
var DEFAULT_MAX_VISITED_ENTRIES = 5e5;
|
|
108696
|
+
var WALK_SLICE_MS = 8;
|
|
108430
108697
|
var GLOBSTAR = /* @__PURE__ */ Symbol("globstar");
|
|
108431
108698
|
var expandBraces2 = import_brace_expansion.default;
|
|
108432
108699
|
function positiveInteger(value, name2) {
|
|
@@ -108531,11 +108798,12 @@ function directoryMatcher(plan) {
|
|
|
108531
108798
|
});
|
|
108532
108799
|
}
|
|
108533
108800
|
__name(directoryMatcher, "directoryMatcher");
|
|
108534
|
-
async function* executeWalk(plan, signal, onSummary) {
|
|
108801
|
+
async function* executeWalk(plan, signal, onSummary, withoutSizes = false) {
|
|
108535
108802
|
const fs = await import("node:fs/promises");
|
|
108536
108803
|
const path2 = await import("node:path");
|
|
108537
108804
|
const { EventEmitter: EventEmitter3 } = await import("node:events");
|
|
108538
108805
|
const open16 = [];
|
|
108806
|
+
let sliceStart = performance.now();
|
|
108539
108807
|
let visited = 0;
|
|
108540
108808
|
let emitted = 0;
|
|
108541
108809
|
let ignoredDirectories = 0;
|
|
@@ -108664,8 +108932,18 @@ async function* executeWalk(plan, signal, onSummary) {
|
|
|
108664
108932
|
while (open16.length > 0) {
|
|
108665
108933
|
check3();
|
|
108666
108934
|
const frame = open16[open16.length - 1];
|
|
108667
|
-
|
|
108668
|
-
|
|
108935
|
+
let entry;
|
|
108936
|
+
if (withoutSizes) {
|
|
108937
|
+
if (performance.now() - sliceStart > WALK_SLICE_MS) {
|
|
108938
|
+
await new Promise((done) => setImmediate(done));
|
|
108939
|
+
sliceStart = performance.now();
|
|
108940
|
+
}
|
|
108941
|
+
check3();
|
|
108942
|
+
entry = frame.dir.readSync();
|
|
108943
|
+
} else {
|
|
108944
|
+
entry = await wait(frame.dir.read());
|
|
108945
|
+
check3();
|
|
108946
|
+
}
|
|
108669
108947
|
if (!entry) {
|
|
108670
108948
|
open16.pop();
|
|
108671
108949
|
if (frame.layered)
|
|
@@ -108694,6 +108972,13 @@ async function* executeWalk(plan, signal, onSummary) {
|
|
|
108694
108972
|
continue;
|
|
108695
108973
|
if (ignore?.isIgnored(absolute, false))
|
|
108696
108974
|
continue;
|
|
108975
|
+
if (withoutSizes) {
|
|
108976
|
+
emitted += 1;
|
|
108977
|
+
yield { path: absolute, size: 0 };
|
|
108978
|
+
if (emitted >= plan.maxEntries)
|
|
108979
|
+
return;
|
|
108980
|
+
continue;
|
|
108981
|
+
}
|
|
108697
108982
|
let info;
|
|
108698
108983
|
try {
|
|
108699
108984
|
info = await wait(fs.lstat(absolute));
|
|
@@ -108730,7 +109015,7 @@ function globalIgnoreFiles() {
|
|
|
108730
109015
|
__name(globalIgnoreFiles, "globalIgnoreFiles");
|
|
108731
109016
|
async function* walkFilesLocally(rootPath, options) {
|
|
108732
109017
|
options.signal?.throwIfAborted();
|
|
108733
|
-
yield* executeWalk(planWalk(rootPath, options), options.signal, options.onSummary);
|
|
109018
|
+
yield* executeWalk(planWalk(rootPath, options), options.signal, options.onSummary, options.withoutSizes === true);
|
|
108734
109019
|
}
|
|
108735
109020
|
__name(walkFilesLocally, "walkFilesLocally");
|
|
108736
109021
|
async function* walkFilesViaExec(exec, rootPath, options) {
|
|
@@ -108848,8 +109133,8 @@ async function* walkFilesViaExec(exec, rootPath, options) {
|
|
|
108848
109133
|
throw failure3;
|
|
108849
109134
|
if (settled)
|
|
108850
109135
|
break;
|
|
108851
|
-
await new Promise((
|
|
108852
|
-
wake =
|
|
109136
|
+
await new Promise((resolve37) => {
|
|
109137
|
+
wake = resolve37;
|
|
108853
109138
|
});
|
|
108854
109139
|
wake = void 0;
|
|
108855
109140
|
}
|
|
@@ -109336,7 +109621,7 @@ var LocalSandbox = class {
|
|
|
109336
109621
|
throw new Error(`Sandbox ${this.id} is destroyed`);
|
|
109337
109622
|
}
|
|
109338
109623
|
const resolved2 = await resolveWithinAnyReal(this.roots, rootPath);
|
|
109339
|
-
const root = await
|
|
109624
|
+
const root = await stat15(resolved2).catch(() => null);
|
|
109340
109625
|
if (!root || !root.isDirectory())
|
|
109341
109626
|
return [];
|
|
109342
109627
|
const entries2 = [];
|
|
@@ -109354,7 +109639,7 @@ var LocalSandbox = class {
|
|
|
109354
109639
|
}
|
|
109355
109640
|
if (!ent.isFile())
|
|
109356
109641
|
continue;
|
|
109357
|
-
const info = await
|
|
109642
|
+
const info = await stat15(full).catch(() => null);
|
|
109358
109643
|
if (!info)
|
|
109359
109644
|
continue;
|
|
109360
109645
|
entries2.push({ path: full, size: info.size });
|
|
@@ -109637,7 +109922,7 @@ var LocalSandboxProvider = class {
|
|
|
109637
109922
|
const requested = resolve21(config2.workingDirectory);
|
|
109638
109923
|
let entry;
|
|
109639
109924
|
try {
|
|
109640
|
-
entry = await
|
|
109925
|
+
entry = await stat15(requested);
|
|
109641
109926
|
} catch (error62) {
|
|
109642
109927
|
if (error62.code === "ENOENT") {
|
|
109643
109928
|
throw new Error(`Sandbox workingDirectory does not exist: ${requested}`, {
|
|
@@ -109657,7 +109942,7 @@ var LocalSandboxProvider = class {
|
|
|
109657
109942
|
}
|
|
109658
109943
|
removeRootOnDestroy = false;
|
|
109659
109944
|
for (const dir of config2.additionalDirectories ?? []) {
|
|
109660
|
-
const entry2 = await
|
|
109945
|
+
const entry2 = await stat15(resolve21(dir)).catch(() => null);
|
|
109661
109946
|
if (!entry2?.isDirectory()) {
|
|
109662
109947
|
throw new Error(`Sandbox additional directory is not a directory: ${resolve21(dir)}`);
|
|
109663
109948
|
}
|
|
@@ -112228,8 +112513,8 @@ function operationBoundary(options) {
|
|
|
112228
112513
|
let cause;
|
|
112229
112514
|
let transportAbortArmed = options.abortTransportInitially;
|
|
112230
112515
|
let resolveStopped;
|
|
112231
|
-
const stopped = new Promise((
|
|
112232
|
-
resolveStopped =
|
|
112516
|
+
const stopped = new Promise((resolve37) => {
|
|
112517
|
+
resolveStopped = resolve37;
|
|
112233
112518
|
});
|
|
112234
112519
|
const stop = /* @__PURE__ */ __name((next2) => {
|
|
112235
112520
|
if (cause !== void 0)
|
|
@@ -112467,8 +112752,8 @@ var A2ADelegate = class {
|
|
|
112467
112752
|
*/
|
|
112468
112753
|
async recoverInitialTask(request) {
|
|
112469
112754
|
let timer;
|
|
112470
|
-
const expired = new Promise((
|
|
112471
|
-
timer = setTimeout(() =>
|
|
112755
|
+
const expired = new Promise((resolve37) => {
|
|
112756
|
+
timer = setTimeout(() => resolve37(void 0), PEER_CANCEL_GRACE_MS);
|
|
112472
112757
|
});
|
|
112473
112758
|
try {
|
|
112474
112759
|
const recovered = await Promise.race([
|
|
@@ -112562,7 +112847,7 @@ var A2ADelegate = class {
|
|
|
112562
112847
|
};
|
|
112563
112848
|
function sleep2(ms, signal) {
|
|
112564
112849
|
signal.throwIfAborted();
|
|
112565
|
-
return new Promise((
|
|
112850
|
+
return new Promise((resolve37, reject2) => {
|
|
112566
112851
|
let settled = false;
|
|
112567
112852
|
const cleanup = /* @__PURE__ */ __name(() => signal.removeEventListener("abort", onAbort), "cleanup");
|
|
112568
112853
|
const onAbort = /* @__PURE__ */ __name(() => {
|
|
@@ -112578,7 +112863,7 @@ function sleep2(ms, signal) {
|
|
|
112578
112863
|
return;
|
|
112579
112864
|
settled = true;
|
|
112580
112865
|
cleanup();
|
|
112581
|
-
|
|
112866
|
+
resolve37();
|
|
112582
112867
|
}, ms);
|
|
112583
112868
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
112584
112869
|
if (signal.aborted)
|
|
@@ -113475,7 +113760,7 @@ var ACPServer = class {
|
|
|
113475
113760
|
request(method, params, signal) {
|
|
113476
113761
|
this.requestSeq += 1;
|
|
113477
113762
|
const id3 = `agent_${this.requestSeq}`;
|
|
113478
|
-
return new Promise((
|
|
113763
|
+
return new Promise((resolve37, reject2) => {
|
|
113479
113764
|
const finish2 = /* @__PURE__ */ __name(() => {
|
|
113480
113765
|
if (this.pending.get(id3) !== entry)
|
|
113481
113766
|
return false;
|
|
@@ -113490,7 +113775,7 @@ var ACPServer = class {
|
|
|
113490
113775
|
const entry = {
|
|
113491
113776
|
resolve: /* @__PURE__ */ __name((value) => {
|
|
113492
113777
|
if (finish2())
|
|
113493
|
-
|
|
113778
|
+
resolve37(value);
|
|
113494
113779
|
}, "resolve"),
|
|
113495
113780
|
reject: /* @__PURE__ */ __name((error62) => {
|
|
113496
113781
|
if (finish2())
|
|
@@ -114183,7 +114468,7 @@ var FileLockManager = class {
|
|
|
114183
114468
|
return immediate;
|
|
114184
114469
|
const deadline = Date.now() + this.config.acquireTimeoutMs;
|
|
114185
114470
|
while (Date.now() < deadline) {
|
|
114186
|
-
await new Promise((
|
|
114471
|
+
await new Promise((resolve37) => setTimeout(resolve37, LOCK_ACQUIRE_POLL_INTERVAL_MS));
|
|
114187
114472
|
this.expireStale();
|
|
114188
114473
|
const retry = this.tryAcquire(filePath, owner);
|
|
114189
114474
|
if (retry.acquired)
|
|
@@ -119105,12 +119390,12 @@ function openTerminalWith(pty, options, defaults) {
|
|
|
119105
119390
|
for (const listener of listeners)
|
|
119106
119391
|
listener(chunk);
|
|
119107
119392
|
});
|
|
119108
|
-
const exited = new Promise((
|
|
119393
|
+
const exited = new Promise((resolve37) => {
|
|
119109
119394
|
const exitSub = child.onExit((event) => {
|
|
119110
119395
|
dataSub.dispose();
|
|
119111
119396
|
exitSub.dispose();
|
|
119112
119397
|
listeners.clear();
|
|
119113
|
-
|
|
119398
|
+
resolve37(event);
|
|
119114
119399
|
});
|
|
119115
119400
|
});
|
|
119116
119401
|
return {
|
|
@@ -120763,7 +121048,7 @@ var SqliteLearningExperienceStore = class {
|
|
|
120763
121048
|
|
|
120764
121049
|
// ../sdk/dist/learning/store.js
|
|
120765
121050
|
import { createHash as createHash33, randomUUID as randomUUID11 } from "node:crypto";
|
|
120766
|
-
import { closeSync, existsSync as existsSync6, fsyncSync, linkSync, lstatSync as lstatSync4, mkdirSync as mkdirSync5, openSync, readFileSync as readFileSync4, unlinkSync, writeFileSync as writeFileSync3 } from "node:fs";
|
|
121051
|
+
import { closeSync as closeSync2, existsSync as existsSync6, fsyncSync, linkSync, lstatSync as lstatSync4, mkdirSync as mkdirSync5, openSync as openSync2, readFileSync as readFileSync4, unlinkSync, writeFileSync as writeFileSync3 } from "node:fs";
|
|
120767
121052
|
import { createRequire as createRequire4 } from "node:module";
|
|
120768
121053
|
import { dirname as dirname24, join as join44, resolve as resolve27 } from "node:path";
|
|
120769
121054
|
|
|
@@ -121214,13 +121499,13 @@ var SqliteLearningStore = class {
|
|
|
121214
121499
|
mkdirSync5(this.artifactsPath, { recursive: true, mode: 448 });
|
|
121215
121500
|
const target = join44(this.artifactsPath, `${artifact.hash}.json`);
|
|
121216
121501
|
const temporary = join44(this.artifactsPath, `.candidate-${randomUUID11()}`);
|
|
121217
|
-
const fd =
|
|
121502
|
+
const fd = openSync2(temporary, "wx", 384);
|
|
121218
121503
|
try {
|
|
121219
121504
|
try {
|
|
121220
121505
|
writeFileSync3(fd, body);
|
|
121221
121506
|
fsyncSync(fd);
|
|
121222
121507
|
} finally {
|
|
121223
|
-
|
|
121508
|
+
closeSync2(fd);
|
|
121224
121509
|
}
|
|
121225
121510
|
try {
|
|
121226
121511
|
linkSync(temporary, target);
|
|
@@ -121235,11 +121520,11 @@ var SqliteLearningStore = class {
|
|
|
121235
121520
|
unlinkSync(temporary);
|
|
121236
121521
|
}
|
|
121237
121522
|
if (process.platform !== "win32") {
|
|
121238
|
-
const directory =
|
|
121523
|
+
const directory = openSync2(this.artifactsPath, "r");
|
|
121239
121524
|
try {
|
|
121240
121525
|
fsyncSync(directory);
|
|
121241
121526
|
} finally {
|
|
121242
|
-
|
|
121527
|
+
closeSync2(directory);
|
|
121243
121528
|
}
|
|
121244
121529
|
}
|
|
121245
121530
|
this.use(true, (db) => {
|
|
@@ -121654,7 +121939,7 @@ __name(derivePeerRef, "derivePeerRef");
|
|
|
121654
121939
|
|
|
121655
121940
|
// ../sdk/dist/peers/registry.js
|
|
121656
121941
|
import { randomBytes as randomBytes9 } from "node:crypto";
|
|
121657
|
-
import { closeSync as
|
|
121942
|
+
import { closeSync as closeSync3, fsyncSync as fsyncSync2, lstatSync as lstatSync6, openSync as openSync3, readFileSync as readFileSync5, readdirSync as readdirSync2, renameSync, unlinkSync as unlinkSync2, writeSync } from "node:fs";
|
|
121658
121943
|
import { basename as basename13, dirname as dirname25, join as join47 } from "node:path";
|
|
121659
121944
|
|
|
121660
121945
|
// ../sdk/dist/peers/client.js
|
|
@@ -121675,7 +121960,7 @@ function connectPath(address2) {
|
|
|
121675
121960
|
}
|
|
121676
121961
|
__name(connectPath, "connectPath");
|
|
121677
121962
|
function sendPeerRequest(address2, request, parseResponse, timeoutMs) {
|
|
121678
|
-
return new Promise((
|
|
121963
|
+
return new Promise((resolve37) => {
|
|
121679
121964
|
let settled = false;
|
|
121680
121965
|
const finish2 = /* @__PURE__ */ __name((result) => {
|
|
121681
121966
|
if (settled)
|
|
@@ -121683,7 +121968,7 @@ function sendPeerRequest(address2, request, parseResponse, timeoutMs) {
|
|
|
121683
121968
|
settled = true;
|
|
121684
121969
|
clearTimeout(timer);
|
|
121685
121970
|
socket.destroy();
|
|
121686
|
-
|
|
121971
|
+
resolve37(result);
|
|
121687
121972
|
}, "finish");
|
|
121688
121973
|
const unreachable = /* @__PURE__ */ __name((error62) => finish2({
|
|
121689
121974
|
kind: "unreachable",
|
|
@@ -121695,7 +121980,7 @@ function sendPeerRequest(address2, request, parseResponse, timeoutMs) {
|
|
|
121695
121980
|
path2 = connectPath(address2);
|
|
121696
121981
|
} catch (error62) {
|
|
121697
121982
|
clearTimeout(timer);
|
|
121698
|
-
|
|
121983
|
+
resolve37({
|
|
121699
121984
|
kind: "unreachable",
|
|
121700
121985
|
reason: error62 instanceof Error ? error62.message : String(error62)
|
|
121701
121986
|
});
|
|
@@ -121798,13 +122083,13 @@ function writePeerRecord(sessionsDir, record4) {
|
|
|
121798
122083
|
const parsed = validated.data;
|
|
121799
122084
|
const path2 = recordPath(sessionsDir, parsed.sessionId);
|
|
121800
122085
|
const temporary = temporaryPathBeside(path2);
|
|
121801
|
-
const fd =
|
|
122086
|
+
const fd = openSync3(temporary, "wx", RECORD_FILE_MODE);
|
|
121802
122087
|
try {
|
|
121803
122088
|
writeSync(fd, `${JSON.stringify(parsed)}
|
|
121804
122089
|
`);
|
|
121805
122090
|
fsyncSync2(fd);
|
|
121806
122091
|
} finally {
|
|
121807
|
-
|
|
122092
|
+
closeSync3(fd);
|
|
121808
122093
|
}
|
|
121809
122094
|
try {
|
|
121810
122095
|
renameSync(temporary, path2);
|
|
@@ -122244,23 +122529,23 @@ async function createPeerEndpoint(options) {
|
|
|
122244
122529
|
void handleLine(buffered.subarray(0, newline)).catch(() => socket.destroy());
|
|
122245
122530
|
});
|
|
122246
122531
|
});
|
|
122247
|
-
await new Promise((
|
|
122532
|
+
await new Promise((resolve37, reject2) => {
|
|
122248
122533
|
const failed = /* @__PURE__ */ __name((error62) => reject2(error62), "failed");
|
|
122249
122534
|
server.once("error", failed);
|
|
122250
122535
|
server.listen({ path: listenPath }, () => {
|
|
122251
122536
|
server.removeListener("error", failed);
|
|
122252
|
-
|
|
122537
|
+
resolve37();
|
|
122253
122538
|
});
|
|
122254
122539
|
});
|
|
122255
122540
|
server.on("error", () => {
|
|
122256
122541
|
});
|
|
122257
122542
|
if (parsed.scheme === "uds")
|
|
122258
122543
|
chmodSync2(listenPath, 384);
|
|
122259
|
-
const close = /* @__PURE__ */ __name(() => new Promise((
|
|
122544
|
+
const close = /* @__PURE__ */ __name(() => new Promise((resolve37) => {
|
|
122260
122545
|
closing = true;
|
|
122261
122546
|
for (const socket of sockets)
|
|
122262
122547
|
socket.destroy();
|
|
122263
|
-
server.close(() =>
|
|
122548
|
+
server.close(() => resolve37());
|
|
122264
122549
|
}), "close");
|
|
122265
122550
|
return {
|
|
122266
122551
|
address: options.address,
|
|
@@ -122352,12 +122637,12 @@ __name(formatPeerNotice, "formatPeerNotice");
|
|
|
122352
122637
|
|
|
122353
122638
|
// ../sdk/dist/account/registry.js
|
|
122354
122639
|
import { randomBytes as randomBytes11 } from "node:crypto";
|
|
122355
|
-
import { chmodSync as chmodSync3, closeSync as
|
|
122640
|
+
import { chmodSync as chmodSync3, closeSync as closeSync5, fsyncSync as fsyncSync3, mkdirSync as mkdirSync8, openSync as openSync5, readFileSync as readFileSync7, realpathSync as realpathSync6, renameSync as renameSync2, rmSync as rmSync2, unlinkSync as unlinkSync4, writeSync as writeSync3 } from "node:fs";
|
|
122356
122641
|
import { basename as basename15, dirname as dirname27, isAbsolute as isAbsolute17, join as join49, relative as relative10, resolve as resolve28 } from "node:path";
|
|
122357
122642
|
|
|
122358
122643
|
// ../sdk/dist/account/lock.js
|
|
122359
122644
|
import { randomBytes as randomBytes10 } from "node:crypto";
|
|
122360
|
-
import { closeSync as
|
|
122645
|
+
import { closeSync as closeSync4, mkdirSync as mkdirSync7, openSync as openSync4, readFileSync as readFileSync6, rmSync, writeSync as writeSync2 } from "node:fs";
|
|
122361
122646
|
import { dirname as dirname26, join as join48 } from "node:path";
|
|
122362
122647
|
|
|
122363
122648
|
// ../sdk/dist/account/types.js
|
|
@@ -122402,7 +122687,7 @@ function acquire(lockPath) {
|
|
|
122402
122687
|
for (let pass = 0; pass < 2; pass++) {
|
|
122403
122688
|
let fd;
|
|
122404
122689
|
try {
|
|
122405
|
-
fd =
|
|
122690
|
+
fd = openSync4(lockPath, "wx", 384);
|
|
122406
122691
|
} catch (error62) {
|
|
122407
122692
|
if (error62.code !== "EEXIST")
|
|
122408
122693
|
throw error62;
|
|
@@ -122413,7 +122698,7 @@ function acquire(lockPath) {
|
|
|
122413
122698
|
try {
|
|
122414
122699
|
writeSync2(fd, token);
|
|
122415
122700
|
} finally {
|
|
122416
|
-
|
|
122701
|
+
closeSync4(fd);
|
|
122417
122702
|
}
|
|
122418
122703
|
return token;
|
|
122419
122704
|
}
|
|
@@ -122447,7 +122732,7 @@ function reclaimIfStale(lockPath) {
|
|
|
122447
122732
|
const guard = `${lockPath}.reclaim`;
|
|
122448
122733
|
let fd;
|
|
122449
122734
|
try {
|
|
122450
|
-
fd =
|
|
122735
|
+
fd = openSync4(guard, "wx", 384);
|
|
122451
122736
|
} catch (error62) {
|
|
122452
122737
|
if (error62.code !== "EEXIST")
|
|
122453
122738
|
throw error62;
|
|
@@ -122461,7 +122746,7 @@ function reclaimIfStale(lockPath) {
|
|
|
122461
122746
|
}
|
|
122462
122747
|
try {
|
|
122463
122748
|
writeSync2(fd, `${process.pid}`);
|
|
122464
|
-
|
|
122749
|
+
closeSync4(fd);
|
|
122465
122750
|
let again;
|
|
122466
122751
|
try {
|
|
122467
122752
|
again = readFileSync6(lockPath, "utf8");
|
|
@@ -122574,12 +122859,12 @@ function parseAccountId(id3) {
|
|
|
122574
122859
|
__name(parseAccountId, "parseAccountId");
|
|
122575
122860
|
function writeAtomic(path2, text9) {
|
|
122576
122861
|
const temporary = join49(dirname27(path2), `.${randomBytes11(8).toString("hex")}.accounts.tmp`);
|
|
122577
|
-
const fd =
|
|
122862
|
+
const fd = openSync5(temporary, "wx", 384);
|
|
122578
122863
|
try {
|
|
122579
122864
|
writeSync3(fd, text9);
|
|
122580
122865
|
fsyncSync3(fd);
|
|
122581
122866
|
} finally {
|
|
122582
|
-
|
|
122867
|
+
closeSync5(fd);
|
|
122583
122868
|
}
|
|
122584
122869
|
try {
|
|
122585
122870
|
renameSync2(temporary, path2);
|
|
@@ -122875,7 +123160,7 @@ __name(resolveBoundAccount, "resolveBoundAccount");
|
|
|
122875
123160
|
|
|
122876
123161
|
// ../sdk/dist/pals/store.js
|
|
122877
123162
|
import { randomUUID as randomUUID12 } from "node:crypto";
|
|
122878
|
-
import { chmodSync as chmodSync4, closeSync as
|
|
123163
|
+
import { chmodSync as chmodSync4, closeSync as closeSync6, fsyncSync as fsyncSync4, linkSync as linkSync2, lstatSync as lstatSync8, mkdirSync as mkdirSync9, openSync as openSync6, readFileSync as readFileSync8, readdirSync as readdirSync3, realpathSync as realpathSync7, unlinkSync as unlinkSync5, writeSync as writeSync4 } from "node:fs";
|
|
122879
123164
|
import { dirname as dirname28, isAbsolute as isAbsolute18, join as join50, relative as relative11, resolve as resolve29, sep as sep12 } from "node:path";
|
|
122880
123165
|
var ID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/u;
|
|
122881
123166
|
var REVISION_FILE2 = /^[1-9][0-9]*\.json$/u;
|
|
@@ -123169,13 +123454,13 @@ function assertDirectory(path2) {
|
|
|
123169
123454
|
__name(assertDirectory, "assertDirectory");
|
|
123170
123455
|
function publishExclusive(path2, value) {
|
|
123171
123456
|
const temporary = join50(dirname28(path2), `.pal-${randomUUID12()}.tmp`);
|
|
123172
|
-
const fd =
|
|
123457
|
+
const fd = openSync6(temporary, "wx", 384);
|
|
123173
123458
|
try {
|
|
123174
123459
|
writeSync4(fd, `${JSON.stringify(value)}
|
|
123175
123460
|
`);
|
|
123176
123461
|
fsyncSync4(fd);
|
|
123177
123462
|
} finally {
|
|
123178
|
-
|
|
123463
|
+
closeSync6(fd);
|
|
123179
123464
|
}
|
|
123180
123465
|
try {
|
|
123181
123466
|
linkSync2(temporary, path2);
|
|
@@ -124850,8 +125135,8 @@ var DiskPalCommunicationStore = class {
|
|
|
124850
125135
|
}
|
|
124851
125136
|
directory(path2) {
|
|
124852
125137
|
mkdirSync10(path2, { recursive: true, mode: 448 });
|
|
124853
|
-
const
|
|
124854
|
-
if (!
|
|
125138
|
+
const stat20 = lstatSync9(path2);
|
|
125139
|
+
if (!stat20.isDirectory() || stat20.isSymbolicLink() || realpathSync8(path2) !== path2)
|
|
124855
125140
|
throw new Error("Pal communication requires a real directory without aliases.");
|
|
124856
125141
|
this.secure(path2);
|
|
124857
125142
|
}
|
|
@@ -124868,8 +125153,8 @@ var DiskPalCommunicationStore = class {
|
|
|
124868
125153
|
for (const name2 of readdirSync4(revisionsDir)) {
|
|
124869
125154
|
if (!/^[1-9][0-9]*\.json$/u.test(name2))
|
|
124870
125155
|
continue;
|
|
124871
|
-
const
|
|
124872
|
-
if (!
|
|
125156
|
+
const stat20 = lstatSync9(join51(revisionsDir, name2));
|
|
125157
|
+
if (!stat20.isFile() || stat20.isSymbolicLink())
|
|
124873
125158
|
throw new Error("Pal communication commit must be a real file.");
|
|
124874
125159
|
}
|
|
124875
125160
|
return {
|
|
@@ -126861,8 +127146,8 @@ var DiskPalActivitySubscriptionStore = class {
|
|
|
126861
127146
|
}
|
|
126862
127147
|
directory(path2) {
|
|
126863
127148
|
mkdirSync13(path2, { recursive: true, mode: 448 });
|
|
126864
|
-
const
|
|
126865
|
-
if (!
|
|
127149
|
+
const stat20 = lstatSync12(path2);
|
|
127150
|
+
if (!stat20.isDirectory() || stat20.isSymbolicLink() || realpathSync11(path2) !== path2)
|
|
126866
127151
|
throw new Error("Pal subscriptions require real directories without aliases.");
|
|
126867
127152
|
this.secure(path2);
|
|
126868
127153
|
}
|
|
@@ -126876,8 +127161,8 @@ var DiskPalActivitySubscriptionStore = class {
|
|
|
126876
127161
|
for (const name2 of readdirSync7(revisionsDir)) {
|
|
126877
127162
|
if (!/^[1-9][0-9]*\.json$/u.test(name2))
|
|
126878
127163
|
continue;
|
|
126879
|
-
const
|
|
126880
|
-
if (!
|
|
127164
|
+
const stat20 = lstatSync12(join54(revisionsDir, name2));
|
|
127165
|
+
if (!stat20.isFile() || stat20.isSymbolicLink())
|
|
126881
127166
|
throw new Error("Pal subscription commits must be real files.");
|
|
126882
127167
|
}
|
|
126883
127168
|
return {
|
|
@@ -127019,8 +127304,8 @@ var DiskPalActivitySubscriptionPolicy = class {
|
|
|
127019
127304
|
}
|
|
127020
127305
|
directory(path2) {
|
|
127021
127306
|
mkdirSync14(path2, { recursive: true, mode: 448 });
|
|
127022
|
-
const
|
|
127023
|
-
if (!
|
|
127307
|
+
const stat20 = lstatSync13(path2);
|
|
127308
|
+
if (!stat20.isDirectory() || stat20.isSymbolicLink() || realpathSync12(path2) !== path2)
|
|
127024
127309
|
throw new Error("Pal activity permissions require real directories without aliases.");
|
|
127025
127310
|
this.secure(path2);
|
|
127026
127311
|
}
|
|
@@ -127034,8 +127319,8 @@ var DiskPalActivitySubscriptionPolicy = class {
|
|
|
127034
127319
|
for (const name2 of readdirSync8(revisionsDir)) {
|
|
127035
127320
|
if (!/^[1-9][0-9]*\.json$/u.test(name2))
|
|
127036
127321
|
continue;
|
|
127037
|
-
const
|
|
127038
|
-
if (!
|
|
127322
|
+
const stat20 = lstatSync13(join55(revisionsDir, name2));
|
|
127323
|
+
if (!stat20.isFile() || stat20.isSymbolicLink())
|
|
127039
127324
|
throw new Error("Pal permission commits must be real files.");
|
|
127040
127325
|
}
|
|
127041
127326
|
return {
|
|
@@ -127579,7 +127864,8 @@ function admitToolFacts(value) {
|
|
|
127579
127864
|
return pick3({
|
|
127580
127865
|
kind: "failure",
|
|
127581
127866
|
reason,
|
|
127582
|
-
subject: text8(value.subject)
|
|
127867
|
+
subject: text8(value.subject),
|
|
127868
|
+
note: text8(value.note)
|
|
127583
127869
|
});
|
|
127584
127870
|
}
|
|
127585
127871
|
default:
|
|
@@ -127776,6 +128062,64 @@ function isReadDenied(context2, path2, sandboxRoot) {
|
|
|
127776
128062
|
return context2.readDenied(joinPath(context2.workingDirectory, relative17));
|
|
127777
128063
|
}
|
|
127778
128064
|
__name(isReadDenied, "isReadDenied");
|
|
128065
|
+
async function* readAhead(source, ahead = 256) {
|
|
128066
|
+
const iterator = source[Symbol.asyncIterator]();
|
|
128067
|
+
const buffer = [];
|
|
128068
|
+
let finished = false;
|
|
128069
|
+
let failure3;
|
|
128070
|
+
let stop = false;
|
|
128071
|
+
let wakeConsumer;
|
|
128072
|
+
let wakeProducer;
|
|
128073
|
+
const notifyConsumer = /* @__PURE__ */ __name(() => {
|
|
128074
|
+
const wake = wakeConsumer;
|
|
128075
|
+
wakeConsumer = void 0;
|
|
128076
|
+
wake?.();
|
|
128077
|
+
}, "notifyConsumer");
|
|
128078
|
+
const producer = (async () => {
|
|
128079
|
+
try {
|
|
128080
|
+
while (!stop) {
|
|
128081
|
+
if (buffer.length >= ahead) {
|
|
128082
|
+
await new Promise((resolve37) => {
|
|
128083
|
+
wakeProducer = resolve37;
|
|
128084
|
+
});
|
|
128085
|
+
continue;
|
|
128086
|
+
}
|
|
128087
|
+
const next2 = await iterator.next();
|
|
128088
|
+
if (next2.done)
|
|
128089
|
+
break;
|
|
128090
|
+
buffer.push(next2.value);
|
|
128091
|
+
notifyConsumer();
|
|
128092
|
+
}
|
|
128093
|
+
} catch (error62) {
|
|
128094
|
+
failure3 = { error: error62 };
|
|
128095
|
+
}
|
|
128096
|
+
finished = true;
|
|
128097
|
+
notifyConsumer();
|
|
128098
|
+
})();
|
|
128099
|
+
try {
|
|
128100
|
+
for (; ; ) {
|
|
128101
|
+
if (buffer.length > 0) {
|
|
128102
|
+
const item = buffer.shift();
|
|
128103
|
+
wakeProducer?.();
|
|
128104
|
+
yield item;
|
|
128105
|
+
continue;
|
|
128106
|
+
}
|
|
128107
|
+
if (failure3)
|
|
128108
|
+
throw failure3.error;
|
|
128109
|
+
if (finished)
|
|
128110
|
+
return;
|
|
128111
|
+
await new Promise((resolve37) => {
|
|
128112
|
+
wakeConsumer = resolve37;
|
|
128113
|
+
});
|
|
128114
|
+
}
|
|
128115
|
+
} finally {
|
|
128116
|
+
stop = true;
|
|
128117
|
+
wakeProducer?.();
|
|
128118
|
+
await producer;
|
|
128119
|
+
await iterator.return?.();
|
|
128120
|
+
}
|
|
128121
|
+
}
|
|
128122
|
+
__name(readAhead, "readAhead");
|
|
127779
128123
|
|
|
127780
128124
|
// ../sdk/dist/tools/builtins/glob.js
|
|
127781
128125
|
var MAX_GLOB_RESULTS = 500;
|
|
@@ -127928,7 +128272,7 @@ ${ignoredHint(ignored)}` : "";
|
|
|
127928
128272
|
});
|
|
127929
128273
|
|
|
127930
128274
|
// ../sdk/dist/tools/builtins/code-analysis.js
|
|
127931
|
-
import { realpath as realpath14, stat as
|
|
128275
|
+
import { realpath as realpath14, stat as stat16 } from "node:fs/promises";
|
|
127932
128276
|
import { isAbsolute as isAbsolute21, relative as relative14, sep as sep15 } from "node:path";
|
|
127933
128277
|
var DEFAULT_LIMIT = 50;
|
|
127934
128278
|
var MAX_LIMIT = 200;
|
|
@@ -128194,7 +128538,7 @@ async function owningRoot(roots, target) {
|
|
|
128194
128538
|
let real;
|
|
128195
128539
|
try {
|
|
128196
128540
|
real = await realpath14(candidate);
|
|
128197
|
-
if (!(await
|
|
128541
|
+
if (!(await stat16(real)).isDirectory()) {
|
|
128198
128542
|
if (isWithin(real, target) || real === target)
|
|
128199
128543
|
sawFile = true;
|
|
128200
128544
|
continue;
|
|
@@ -128430,8 +128774,8 @@ function getCodeNavigationTools(provider) {
|
|
|
128430
128774
|
__name(getCodeNavigationTools, "getCodeNavigationTools");
|
|
128431
128775
|
|
|
128432
128776
|
// ../sdk/dist/tools/builtins/grep.js
|
|
128433
|
-
import { stat as
|
|
128434
|
-
import { isAbsolute as isAbsolute22, join as join57, relative as relative15, sep as sep16 } from "node:path";
|
|
128777
|
+
import { stat as stat17 } from "node:fs/promises";
|
|
128778
|
+
import { dirname as dirname29, isAbsolute as isAbsolute22, join as join57, relative as relative15, resolve as resolve35, sep as sep16 } from "node:path";
|
|
128435
128779
|
async function readWithSignal(read, signal) {
|
|
128436
128780
|
signal?.throwIfAborted();
|
|
128437
128781
|
if (!signal)
|
|
@@ -128453,6 +128797,84 @@ async function readWithSignal(read, signal) {
|
|
|
128453
128797
|
}
|
|
128454
128798
|
}
|
|
128455
128799
|
__name(readWithSignal, "readWithSignal");
|
|
128800
|
+
var READ_SLICE_MS = 8;
|
|
128801
|
+
var LOCAL_SYNC_READ_MAX_BYTES = 64 * 1024;
|
|
128802
|
+
function createLocalReader(root, signal) {
|
|
128803
|
+
const scratch = Buffer.allocUnsafe(64 * 1024);
|
|
128804
|
+
const rootRealPromise = canonicalize(resolve35(root));
|
|
128805
|
+
const directories = /* @__PURE__ */ new Map();
|
|
128806
|
+
let sliceStart = performance.now();
|
|
128807
|
+
const realDirectory = /* @__PURE__ */ __name((directory) => {
|
|
128808
|
+
let known = directories.get(directory);
|
|
128809
|
+
if (!known) {
|
|
128810
|
+
known = canonicalize(directory);
|
|
128811
|
+
directories.set(directory, known);
|
|
128812
|
+
}
|
|
128813
|
+
return known;
|
|
128814
|
+
}, "realDirectory");
|
|
128815
|
+
let rootReal;
|
|
128816
|
+
return {
|
|
128817
|
+
async read(filePath) {
|
|
128818
|
+
if (performance.now() - sliceStart > READ_SLICE_MS) {
|
|
128819
|
+
await new Promise((done) => setImmediate(done));
|
|
128820
|
+
sliceStart = performance.now();
|
|
128821
|
+
}
|
|
128822
|
+
signal?.throwIfAborted();
|
|
128823
|
+
const directory = dirname29(filePath);
|
|
128824
|
+
const real = await realDirectory(directory);
|
|
128825
|
+
rootReal ??= await rootRealPromise;
|
|
128826
|
+
const contained2 = real === directory ? filePath : join57(real, filePath.slice(directory.length + 1));
|
|
128827
|
+
if (!(contained2.startsWith(rootReal + sep16) || contained2 === rootReal)) {
|
|
128828
|
+
const rel = relative15(rootReal, contained2);
|
|
128829
|
+
if (rel.startsWith("..") || isAbsolute22(rel)) {
|
|
128830
|
+
throw new Error("Path escapes the working directory through a link.");
|
|
128831
|
+
}
|
|
128832
|
+
}
|
|
128833
|
+
signal?.throwIfAborted();
|
|
128834
|
+
try {
|
|
128835
|
+
const read = readBoundedFileSync(contained2, MAX_FILE_SIZE, scratch, LOCAL_SYNC_READ_MAX_BYTES);
|
|
128836
|
+
if (read !== "large")
|
|
128837
|
+
return { buffer: read, contained: contained2 };
|
|
128838
|
+
const large = await readBoundedFile(contained2, MAX_FILE_SIZE, signal, void 0, REFUSE_LINK_FLAG);
|
|
128839
|
+
sliceStart = performance.now();
|
|
128840
|
+
return { buffer: large, contained: contained2 };
|
|
128841
|
+
} catch (error62) {
|
|
128842
|
+
const code = error62.code;
|
|
128843
|
+
if (code === "ENOENT" || code === "ENOTDIR")
|
|
128844
|
+
return { buffer: "gone", contained: contained2 };
|
|
128845
|
+
throw error62;
|
|
128846
|
+
}
|
|
128847
|
+
}
|
|
128848
|
+
};
|
|
128849
|
+
}
|
|
128850
|
+
__name(createLocalReader, "createLocalReader");
|
|
128851
|
+
var PLAIN_TAIL = /(^|\/)\.{1,2}(\/|$)|\/\/|\/$/;
|
|
128852
|
+
function createWalkedPaths(root, lexicalRoot, workingDirectory) {
|
|
128853
|
+
if (sep16 !== "/")
|
|
128854
|
+
return void 0;
|
|
128855
|
+
const prefix = root === "/" ? "/" : `${root}/`;
|
|
128856
|
+
const rootRel = relative15(workingDirectory, lexicalRoot);
|
|
128857
|
+
const display = rootRel.startsWith("..") || isAbsolute22(rootRel) ? void 0 : rootRel;
|
|
128858
|
+
return {
|
|
128859
|
+
within(path2) {
|
|
128860
|
+
if (path2.startsWith(prefix) && path2.length > prefix.length) {
|
|
128861
|
+
if (!PLAIN_TAIL.test(path2.slice(prefix.length)))
|
|
128862
|
+
return path2;
|
|
128863
|
+
}
|
|
128864
|
+
return resolveWithin(root, path2);
|
|
128865
|
+
},
|
|
128866
|
+
displayName(path2) {
|
|
128867
|
+
if (display === void 0 || !path2.startsWith(prefix) || path2.length === prefix.length) {
|
|
128868
|
+
return void 0;
|
|
128869
|
+
}
|
|
128870
|
+
const tail = path2.slice(prefix.length);
|
|
128871
|
+
if (PLAIN_TAIL.test(tail))
|
|
128872
|
+
return void 0;
|
|
128873
|
+
return display === "" ? tail : `${display}/${tail}`;
|
|
128874
|
+
}
|
|
128875
|
+
};
|
|
128876
|
+
}
|
|
128877
|
+
__name(createWalkedPaths, "createWalkedPaths");
|
|
128456
128878
|
function relativeInclude(include, root, sandboxed) {
|
|
128457
128879
|
let pattern = sandboxed ? include : include.split(sep16).join("/");
|
|
128458
128880
|
if (pattern.split("/").includes(".."))
|
|
@@ -128528,12 +128950,7 @@ var inputSchema12 = external_exports.object({
|
|
|
128528
128950
|
var MAX_FILE_SIZE = 5 * 1024 * 1024;
|
|
128529
128951
|
var BINARY_CHECK_BYTES = 512;
|
|
128530
128952
|
function isBinaryContent(buffer) {
|
|
128531
|
-
|
|
128532
|
-
for (const byte of check3) {
|
|
128533
|
-
if (byte === 0)
|
|
128534
|
-
return true;
|
|
128535
|
-
}
|
|
128536
|
-
return false;
|
|
128953
|
+
return buffer.subarray(0, BINARY_CHECK_BYTES).includes(0);
|
|
128537
128954
|
}
|
|
128538
128955
|
__name(isBinaryContent, "isBinaryContent");
|
|
128539
128956
|
var GrepTool = defineTool({
|
|
@@ -128611,7 +129028,7 @@ var GrepTool = defineTool({
|
|
|
128611
129028
|
walkEnd = value;
|
|
128612
129029
|
}, "onSummary")
|
|
128613
129030
|
};
|
|
128614
|
-
const entries2 = walkSandbox ? walkSandbox(root, options) : walkFilesLocally(root, options);
|
|
129031
|
+
const entries2 = walkSandbox ? walkSandbox(root, options) : readAhead(walkFilesLocally(root, { ...options, withoutSizes: CAN_REFUSE_LINKS }));
|
|
128615
129032
|
const mode = input2.output_mode ?? "files_with_matches";
|
|
128616
129033
|
const headLimit = input2.head_limit ?? input2.max_results ?? DEFAULT_HEAD_LIMIT;
|
|
128617
129034
|
const offset = input2.offset ?? 0;
|
|
@@ -128630,10 +129047,12 @@ var GrepTool = defineTool({
|
|
|
128630
129047
|
let fileLimit = false;
|
|
128631
129048
|
const filesToCollect = headLimit > 0 ? offset + Math.max(headLimit * 4, 1e3) : Number.POSITIVE_INFINITY;
|
|
128632
129049
|
let enough = false;
|
|
129050
|
+
const walked = sandbox ? void 0 : createWalkedPaths(root, lexicalRoot, context2.workingDirectory);
|
|
129051
|
+
const localReader = !sandbox && CAN_REFUSE_LINKS ? createLocalReader(root, signal) : void 0;
|
|
128633
129052
|
try {
|
|
128634
129053
|
for await (const entry of entries2) {
|
|
128635
129054
|
signal?.throwIfAborted();
|
|
128636
|
-
const filePath = sandbox ? resolveWithinPosix(root, entry.path) : resolveWithin(root, entry.path);
|
|
129055
|
+
const filePath = sandbox ? resolveWithinPosix(root, entry.path) : walked?.within(entry.path) ?? resolveWithin(root, entry.path);
|
|
128637
129056
|
if (filesSearched >= MAX_FILES_SEARCHED) {
|
|
128638
129057
|
fileLimit = true;
|
|
128639
129058
|
break;
|
|
@@ -128648,10 +129067,22 @@ var GrepTool = defineTool({
|
|
|
128648
129067
|
let content;
|
|
128649
129068
|
let contained2;
|
|
128650
129069
|
try {
|
|
128651
|
-
|
|
128652
|
-
|
|
128653
|
-
|
|
128654
|
-
|
|
129070
|
+
let buffer;
|
|
129071
|
+
if (localReader) {
|
|
129072
|
+
const read = await localReader.read(filePath);
|
|
129073
|
+
contained2 = read.contained;
|
|
129074
|
+
if (read.buffer === "too-large")
|
|
129075
|
+
continue;
|
|
129076
|
+
if (read.buffer === "gone") {
|
|
129077
|
+
filesSearched--;
|
|
129078
|
+
continue;
|
|
129079
|
+
}
|
|
129080
|
+
buffer = read.buffer;
|
|
129081
|
+
} else
|
|
129082
|
+
buffer = await readWithSignal(() => sandbox ? readBoundedChunks((offset2, length) => sandbox.readFile(filePath, { offset: offset2, length, signal }), MAX_FILE_SIZE, signal) : resolveWithinReal(root, filePath).then((path2) => {
|
|
129083
|
+
contained2 = path2;
|
|
129084
|
+
return readBoundedFile(path2, MAX_FILE_SIZE, signal);
|
|
129085
|
+
}), signal);
|
|
128655
129086
|
signal?.throwIfAborted();
|
|
128656
129087
|
if (buffer.length > MAX_FILE_SIZE || isBinaryContent(buffer))
|
|
128657
129088
|
continue;
|
|
@@ -128664,7 +129095,7 @@ var GrepTool = defineTool({
|
|
|
128664
129095
|
}
|
|
128665
129096
|
const lines = content.split("\n");
|
|
128666
129097
|
let fileMatches = 0;
|
|
128667
|
-
const relPath = sandbox ? relativePosix(sandbox.rootDir, filePath) : hostDisplayPath(context2.workingDirectory, join57(lexicalRoot, relative15(root, filePath)));
|
|
129098
|
+
const relPath = sandbox ? relativePosix(sandbox.rootDir, filePath) : walked?.displayName(filePath) ?? hostDisplayPath(context2.workingDirectory, join57(lexicalRoot, relative15(root, filePath)));
|
|
128668
129099
|
if (mode === "content" && input2.only_matching) {
|
|
128669
129100
|
for (const fragment of matchingFragments(content, regex, multiline)) {
|
|
128670
129101
|
signal?.throwIfAborted();
|
|
@@ -128830,7 +129261,7 @@ async function sortByNewest(files) {
|
|
|
128830
129261
|
if (file2.host === void 0)
|
|
128831
129262
|
return { file: file2, mtime: 0 };
|
|
128832
129263
|
try {
|
|
128833
|
-
return { file: file2, mtime: (await
|
|
129264
|
+
return { file: file2, mtime: (await stat17(file2.host)).mtimeMs };
|
|
128834
129265
|
} catch {
|
|
128835
129266
|
return { file: file2, mtime: 0 };
|
|
128836
129267
|
}
|
|
@@ -128841,7 +129272,8 @@ __name(sortByNewest, "sortByNewest");
|
|
|
128841
129272
|
function lineHits(lines, regex, context2) {
|
|
128842
129273
|
const hits = [];
|
|
128843
129274
|
for (let i = 0; i < lines.length; i++) {
|
|
128844
|
-
|
|
129275
|
+
if ((i & 255) === 0)
|
|
129276
|
+
context2.abortSignal?.throwIfAborted();
|
|
128845
129277
|
regex.lastIndex = 0;
|
|
128846
129278
|
if (regex.test(lines[i] ?? ""))
|
|
128847
129279
|
hits.push([i, i]);
|
|
@@ -129348,7 +129780,7 @@ async function waitForJobWithBounds(jobs, id3, options, now = Date.now) {
|
|
|
129348
129780
|
omittedOutputBytes
|
|
129349
129781
|
};
|
|
129350
129782
|
});
|
|
129351
|
-
const expiry = new Promise((
|
|
129783
|
+
const expiry = new Promise((resolve37) => {
|
|
129352
129784
|
const tick = setInterval(() => {
|
|
129353
129785
|
if (settled)
|
|
129354
129786
|
return;
|
|
@@ -129356,7 +129788,7 @@ async function waitForJobWithBounds(jobs, id3, options, now = Date.now) {
|
|
|
129356
129788
|
const elapsed = now() - startedAt;
|
|
129357
129789
|
if (elapsed >= options.wallMs) {
|
|
129358
129790
|
clearInterval(tick);
|
|
129359
|
-
|
|
129791
|
+
resolve37({
|
|
129360
129792
|
kind: "timeout",
|
|
129361
129793
|
cause: "wall",
|
|
129362
129794
|
elapsedMs: elapsed,
|
|
@@ -129372,7 +129804,7 @@ async function waitForJobWithBounds(jobs, id3, options, now = Date.now) {
|
|
|
129372
129804
|
const quietFor = now() - lastProgressAt;
|
|
129373
129805
|
if (quietFor >= options.idleMs) {
|
|
129374
129806
|
clearInterval(tick);
|
|
129375
|
-
|
|
129807
|
+
resolve37({
|
|
129376
129808
|
kind: "timeout",
|
|
129377
129809
|
cause: "idle",
|
|
129378
129810
|
elapsedMs: elapsed,
|
|
@@ -130414,7 +130846,7 @@ function buildRunCodeTool(options = {}) {
|
|
|
130414
130846
|
__name(buildRunCodeTool, "buildRunCodeTool");
|
|
130415
130847
|
|
|
130416
130848
|
// ../sdk/dist/tools/builtins/ls.js
|
|
130417
|
-
import { readdir as readdir16, stat as
|
|
130849
|
+
import { readdir as readdir16, stat as stat18 } from "node:fs/promises";
|
|
130418
130850
|
import { join as join58, relative as relative16 } from "node:path";
|
|
130419
130851
|
var inputSchema18 = external_exports.object({
|
|
130420
130852
|
path: external_exports.string().default(".").describe("Directory path to list. Defaults to working directory."),
|
|
@@ -130448,7 +130880,7 @@ async function listDirectory2(dirPath, showHidden) {
|
|
|
130448
130880
|
} else if (entry.isFile()) {
|
|
130449
130881
|
type = "file";
|
|
130450
130882
|
try {
|
|
130451
|
-
const s = await
|
|
130883
|
+
const s = await stat18(join58(dirPath, entry.name));
|
|
130452
130884
|
size = s.size;
|
|
130453
130885
|
} catch {
|
|
130454
130886
|
}
|
|
@@ -130592,8 +131024,8 @@ var LsTool = defineTool({
|
|
|
130592
131024
|
});
|
|
130593
131025
|
|
|
130594
131026
|
// ../sdk/dist/tools/builtins/verify-outputs.js
|
|
130595
|
-
import { stat as
|
|
130596
|
-
import { resolve as
|
|
131027
|
+
import { stat as stat19 } from "node:fs/promises";
|
|
131028
|
+
import { resolve as resolve36 } from "node:path";
|
|
130597
131029
|
var inputSchema19 = external_exports.object({
|
|
130598
131030
|
paths: external_exports.array(external_exports.string().min(1)).min(1).describe("Expected output file paths to verify. Each path is checked for existence and size."),
|
|
130599
131031
|
min_bytes: external_exports.number().int().min(0).optional().describe("Minimum acceptable file size in bytes. A file under this size counts as missing. Default: 1 (any non-empty file passes).")
|
|
@@ -130649,9 +131081,9 @@ async function verifyOne(input2) {
|
|
|
130649
131081
|
};
|
|
130650
131082
|
}
|
|
130651
131083
|
}
|
|
130652
|
-
const filePath =
|
|
131084
|
+
const filePath = resolve36(context2.workingDirectory, path2);
|
|
130653
131085
|
try {
|
|
130654
|
-
const info = await
|
|
131086
|
+
const info = await stat19(filePath);
|
|
130655
131087
|
if (!info.isFile()) {
|
|
130656
131088
|
return {
|
|
130657
131089
|
path: path2,
|
|
@@ -136667,4 +137099,4 @@ export {
|
|
|
136667
137099
|
WakeBudget,
|
|
136668
137100
|
wakeBudgetFromEnv
|
|
136669
137101
|
};
|
|
136670
|
-
//# sourceMappingURL=chunk-
|
|
137102
|
+
//# sourceMappingURL=chunk-ZE6HLPD4.js.map
|