@namzu/cli 45.1.0 → 45.3.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 +58 -0
- package/README.md +1 -1
- package/dist/bin-main.d.ts.map +1 -1
- package/dist/bin.js +1 -1
- package/dist/chunks/{acp-CGGPX6FV.js → acp-ZTROFKCB.js} +50 -48
- package/dist/chunks/acp-ZTROFKCB.js.map +6 -0
- package/dist/chunks/{activity-command-D744W6SC.js → activity-command-UOPJG7HV.js} +13 -13
- package/dist/chunks/{add-7F26IYNU.js → add-72ZD5COQ.js} +21 -20
- package/dist/chunks/add-72ZD5COQ.js.map +6 -0
- package/dist/chunks/{agent-42PYZGA5.js → agent-LCIH3SLO.js} +40 -38
- package/dist/chunks/agent-session-LUGICAIR.js +71 -0
- package/dist/chunks/{archive-FLZUJDJZ.js → archive-7WVQ537T.js} +11 -11
- package/dist/chunks/{bin-main-NID46PS7.js → bin-main-UKMSMD75.js} +31 -8
- package/dist/chunks/bin-main-UKMSMD75.js.map +6 -0
- package/dist/chunks/{binding-JQUI2CTZ.js → binding-XVFMQCFN.js} +3 -3
- package/dist/chunks/{browser-YZCY2CI6.js → browser-4PRGERNN.js} +6 -6
- package/dist/chunks/{chat-WBJPS4K6.js → chat-X5MYAPDS.js} +16 -16
- package/dist/chunks/{chunk-HIJXUSOS.js → chunk-25KCA24W.js} +3 -3
- package/dist/chunks/{chunk-LQN7NG2F.js → chunk-2GW4CKCP.js} +13 -13
- package/dist/chunks/chunk-2IPDTDB3.js +80 -0
- package/dist/chunks/chunk-2IPDTDB3.js.map +6 -0
- package/dist/chunks/{chunk-RPCJJZTI.js → chunk-3DV5GOM2.js} +3 -3
- package/dist/chunks/{chunk-NZ6DX5CL.js → chunk-3KFDEYQO.js} +4 -4
- package/dist/chunks/{chunk-OYX743QK.js → chunk-4HZFDYJ5.js} +587 -441
- package/dist/chunks/chunk-4HZFDYJ5.js.map +6 -0
- package/dist/chunks/{chunk-NI3LZ6UX.js → chunk-56KFHOMT.js} +5 -5
- package/dist/chunks/{chunk-NI3LZ6UX.js.map → chunk-56KFHOMT.js.map} +1 -1
- package/dist/chunks/{chunk-QXNROEIH.js → chunk-5EAN453D.js} +4 -4
- package/dist/chunks/{chunk-IZDYKTPN.js → chunk-5OLWLGSL.js} +6 -6
- package/dist/chunks/{chunk-PAY5TGHV.js → chunk-5QA7PV3Q.js} +3 -3
- package/dist/chunks/{chunk-LMVXENEF.js → chunk-5UPGCZZI.js} +3 -3
- package/dist/chunks/{chunk-24NEAMG5.js → chunk-6C7LQMXN.js} +3 -3
- package/dist/chunks/{chunk-SSE5CXYL.js → chunk-6DIVEA5W.js} +4 -4
- package/dist/chunks/{chunk-SSE5CXYL.js.map → chunk-6DIVEA5W.js.map} +1 -1
- package/dist/chunks/{chunk-P2Y3IUE6.js → chunk-6GYORUQC.js} +12 -12
- package/dist/chunks/{chunk-PQTS7XQB.js → chunk-6IKRSJZD.js} +12 -12
- package/dist/chunks/{chunk-BWI7L43E.js → chunk-6RZHAFXK.js} +6 -6
- package/dist/chunks/chunk-6ULKBT6P.js +83 -0
- package/dist/chunks/chunk-6ULKBT6P.js.map +6 -0
- package/dist/chunks/{chunk-Q7ELMF4C.js → chunk-72B3BK3S.js} +6 -6
- package/dist/chunks/{chunk-EVRWBRUB.js → chunk-7OGCV6CD.js} +2 -2
- package/dist/chunks/{chunk-POKKY7MR.js → chunk-7W4SPINO.js} +5 -5
- package/dist/chunks/{chunk-NFATUZMX.js → chunk-7YVCP6TP.js} +2 -2
- package/dist/chunks/{chunk-G742EI3J.js → chunk-ACDJPD4J.js} +83 -54
- package/dist/chunks/chunk-ACDJPD4J.js.map +6 -0
- package/dist/chunks/{chunk-2YKQMUTC.js → chunk-B7BYKKRH.js} +14 -337
- package/dist/chunks/chunk-B7BYKKRH.js.map +6 -0
- package/dist/chunks/{chunk-NS4PN3SI.js → chunk-BA34BT4O.js} +2 -2
- package/dist/chunks/{chunk-Q6DM2TVI.js → chunk-BCRSDURU.js} +2 -2
- package/dist/chunks/{chunk-2UATEMPS.js → chunk-BJKLRSSR.js} +7 -7
- package/dist/chunks/{chunk-JCLZ5HXI.js → chunk-BN5TEW6O.js} +2 -2
- package/dist/chunks/{chunk-OM3EDVLG.js → chunk-CRWKYSTS.js} +3 -3
- package/dist/chunks/{chunk-6F4PW7TF.js → chunk-D5K2HSG7.js} +5 -5
- package/dist/chunks/{chunk-L2WEBN6A.js → chunk-DH4X2E6M.js} +2 -2
- package/dist/chunks/{chunk-L2WEBN6A.js.map → chunk-DH4X2E6M.js.map} +1 -1
- package/dist/chunks/{chunk-RBH2FDM5.js → chunk-EDAXADCF.js} +3 -3
- package/dist/chunks/{chunk-7BRK6EHB.js → chunk-EEG22XMV.js} +2 -2
- package/dist/chunks/{chunk-HYPNAC4H.js → chunk-EHFPJANT.js} +3 -3
- package/dist/chunks/{chunk-GXP5BKCZ.js → chunk-FAAMBADN.js} +129 -106
- package/dist/chunks/{chunk-GXP5BKCZ.js.map → chunk-FAAMBADN.js.map} +1 -1
- package/dist/chunks/{chunk-K3UL7Z4X.js → chunk-FADVC2JQ.js} +80 -37
- package/dist/chunks/{chunk-K3UL7Z4X.js.map → chunk-FADVC2JQ.js.map} +2 -2
- package/dist/chunks/{chunk-TGPKTH2S.js → chunk-FLQZA5WL.js} +2 -2
- package/dist/chunks/{chunk-X2F5ZFBV.js → chunk-FU7GB347.js} +4 -4
- package/dist/chunks/{chunk-JU7JQ62S.js → chunk-GGAZD6ML.js} +3 -3
- package/dist/chunks/{chunk-KY2WSKNM.js → chunk-GMT73VBK.js} +2 -2
- package/dist/chunks/{chunk-QWVWGW6I.js → chunk-GXYKREW7.js} +2 -2
- package/dist/chunks/{chunk-V26FS5VG.js → chunk-HIV7GBNO.js} +11 -2
- package/dist/chunks/{chunk-V26FS5VG.js.map → chunk-HIV7GBNO.js.map} +1 -1
- package/dist/chunks/{chunk-FU776PDS.js → chunk-HWRC2KL5.js} +5 -5
- package/dist/chunks/{chunk-6OWRRNLC.js → chunk-HWZWMDMN.js} +2 -2
- package/dist/chunks/{chunk-XK26JNIF.js → chunk-I3E5SDBB.js} +6 -6
- package/dist/chunks/{chunk-XN7C5GWO.js → chunk-IKK3UQOE.js} +2 -2
- package/dist/chunks/{chunk-I6W3KJR3.js → chunk-K3W6LEIP.js} +2 -2
- package/dist/chunks/{chunk-U4YXQWPW.js → chunk-K7KQHO3W.js} +6 -6
- package/dist/chunks/{chunk-AR2GPJUO.js → chunk-KFN6CSN2.js} +3 -68
- package/dist/chunks/chunk-KFN6CSN2.js.map +6 -0
- package/dist/chunks/{chunk-PCWQ3ET3.js → chunk-LV6FQJHS.js} +4 -4
- package/dist/chunks/{chunk-T3NLKQO2.js → chunk-LVIYX25W.js} +4 -4
- package/dist/chunks/{chunk-F4B77QJQ.js → chunk-M33ZJVMX.js} +3 -3
- package/dist/chunks/{chunk-B7QEQ7Y3.js → chunk-MKLTHECQ.js} +2 -2
- package/dist/chunks/{chunk-F2QERXWD.js → chunk-MVYLBP2M.js} +10 -10
- package/dist/chunks/{chunk-Q3AB63M5.js → chunk-MXXIXVYX.js} +24 -12
- package/dist/chunks/{chunk-Q3AB63M5.js.map → chunk-MXXIXVYX.js.map} +2 -2
- package/dist/chunks/{chunk-XSAEGHPS.js → chunk-NQDPAMNA.js} +9 -9
- package/dist/chunks/{chunk-O7H4QZ7I.js → chunk-NRKOU2PC.js} +2 -2
- package/dist/chunks/{chunk-GXQ4G3KA.js → chunk-NS5UHMLA.js} +3 -3
- package/dist/chunks/{chunk-5OGY4CE7.js → chunk-NYTO4KXS.js} +2 -2
- package/dist/chunks/{chunk-ZB45QDNU.js → chunk-O6EAXTVH.js} +3 -3
- package/dist/chunks/{chunk-WNOB6C62.js → chunk-PAWGQZAW.js} +2 -2
- package/dist/chunks/{chunk-6LMIJ2YT.js → chunk-PBU6HAWN.js} +8 -8
- package/dist/chunks/{chunk-IFXYNA2K.js → chunk-PSRJQ7V6.js} +3 -3
- package/dist/chunks/chunk-QLDUL46Z.js +338 -0
- package/dist/chunks/chunk-QLDUL46Z.js.map +6 -0
- package/dist/chunks/{chunk-5VBA5XSC.js → chunk-QU7FKI2J.js} +2 -2
- package/dist/chunks/{chunk-S7WRWA25.js → chunk-RI2KAZJO.js} +2 -2
- package/dist/chunks/{chunk-S7WRWA25.js.map → chunk-RI2KAZJO.js.map} +1 -1
- package/dist/chunks/{chunk-H2RDYYTB.js → chunk-S34KVZZT.js} +2 -2
- package/dist/chunks/{chunk-H5H6HDRA.js → chunk-S3DSUD7H.js} +3 -3
- package/dist/chunks/{chunk-5DFBOMTX.js → chunk-T33MN3DE.js} +3 -3
- package/dist/chunks/{chunk-PFFQOCEI.js → chunk-THZVC2RU.js} +2 -2
- package/dist/chunks/{chunk-IFEBBQ2M.js → chunk-UOJPF6B4.js} +3 -3
- package/dist/chunks/{chunk-IPVDXTWF.js → chunk-UQJSWYXI.js} +2 -2
- package/dist/chunks/{chunk-V3R3MR7F.js → chunk-USYZCOWI.js} +4 -4
- package/dist/chunks/{chunk-5W7CSQXQ.js → chunk-UVPKVX7S.js} +4 -4
- package/dist/chunks/{chunk-OXM3GHWE.js → chunk-UXKEO43V.js} +19 -15
- package/dist/chunks/chunk-UXKEO43V.js.map +6 -0
- package/dist/chunks/chunk-V45XJDX3.js +176 -0
- package/dist/chunks/chunk-V45XJDX3.js.map +6 -0
- package/dist/chunks/{chunk-4HL5LUP5.js → chunk-VGLTZY7A.js} +1096 -642
- package/dist/chunks/chunk-VGLTZY7A.js.map +6 -0
- package/dist/chunks/{chunk-VPJG7NQL.js → chunk-W7YNWEPA.js} +2 -2
- package/dist/chunks/{chunk-NGMXEU2B.js → chunk-WQJ4VBBH.js} +2 -2
- package/dist/chunks/{chunk-U4ZP2JN2.js → chunk-WUMLVV7Q.js} +4 -4
- package/dist/chunks/{chunk-W7XKWKEZ.js → chunk-XE4RMHJI.js} +2 -2
- package/dist/chunks/{chunk-NCW3WBBI.js → chunk-XKZTXW3A.js} +4 -4
- package/dist/chunks/{chunk-OMRGJSUJ.js → chunk-XLBVOLB5.js} +91 -100
- package/dist/chunks/chunk-XLBVOLB5.js.map +6 -0
- package/dist/chunks/{chunk-TOJSNO4M.js → chunk-XS6IOLUS.js} +5 -5
- package/dist/chunks/{chunk-7HNWFGWD.js → chunk-Y4ZZZQ7V.js} +2 -2
- package/dist/chunks/{chunk-D7BXM6WW.js → chunk-YGCXTFUS.js} +2 -2
- package/dist/chunks/{chunk-BDHXJ7BM.js → chunk-Z5L5BGQH.js} +4 -2
- package/dist/chunks/chunk-Z5L5BGQH.js.map +6 -0
- package/dist/chunks/{cli-runtime-OBTTHZZI.js → cli-runtime-SX3OXB7S.js} +12 -11
- package/dist/chunks/cli-runtime-SX3OXB7S.js.map +6 -0
- package/dist/chunks/{commands-56WUDKVN.js → commands-NL3MWKEZ.js} +5 -5
- package/dist/chunks/{crash-report-3IE2RFYG.js → crash-report-JVCF24WM.js} +6 -6
- package/dist/chunks/{dist-BLCQRSQS.js → dist-663JGNNO.js} +2 -2
- package/dist/chunks/{dist-L757TGUH.js → dist-7FHKFZWJ.js} +2 -2
- package/dist/chunks/{dist-7UW2VLWO.js → dist-7Z3LCNPK.js} +2 -2
- package/dist/chunks/{dist-Y6IO47UU.js → dist-AC7IAQ22.js} +2 -2
- package/dist/chunks/{dist-SEXSU4PO.js → dist-IB62FDT7.js} +2 -2
- package/dist/chunks/{dist-BLC5XSXL.js → dist-JEF2TWFB.js} +2 -2
- package/dist/chunks/{dist-QZPA2XDK.js → dist-RICAGJLB.js} +24 -2
- package/dist/chunks/{dist-GUHZ3EE6.js → dist-TQZS3NMV.js} +2 -2
- package/dist/chunks/{doctor-QGFOTR5H.js → doctor-QNEVNEWM.js} +16 -16
- package/dist/chunks/{drain-5WSM4MTM.js → drain-RMVRJ3ZH.js} +10 -10
- package/dist/chunks/{entry-HLIJKK65.js → entry-Z2QTPFTK.js} +27 -21
- package/dist/chunks/{entry-HLIJKK65.js.map → entry-Z2QTPFTK.js.map} +1 -1
- package/dist/chunks/{eval-5ZIBALCB.js → eval-R6XNQB7S.js} +2 -2
- package/dist/chunks/{exec-7YEZ64T4.js → exec-KGXLOANS.js} +38 -35
- package/dist/chunks/exec-KGXLOANS.js.map +6 -0
- package/dist/chunks/{home-DXPCVXZK.js → home-MG5XGCBL.js} +3 -3
- package/dist/chunks/host-Q4VEV5LF.js +30 -0
- package/dist/chunks/{host-queries-7CSOWEPE.js → host-queries-6PVXVD67.js} +16 -16
- package/dist/chunks/{learn-NNBHDBLF.js → learn-QEJFA6JU.js} +13 -13
- package/dist/chunks/{learn-builtin-YEDJT6ZP.js → learn-builtin-5I4QOYGH.js} +16 -16
- package/dist/chunks/{lifecycle-NDR7R22S.js → lifecycle-MOIUIQAH.js} +31 -30
- package/dist/chunks/{list-GIP6KAYZ.js → list-EWRMBRFM.js} +12 -11
- package/dist/chunks/list-EWRMBRFM.js.map +6 -0
- package/dist/chunks/{live-FJISKPXJ.js → live-IOPYPFSM.js} +15 -15
- package/dist/chunks/{login-42ZPPMYK.js → login-CO4ONVID.js} +13 -13
- package/dist/chunks/{logs-7MAFXNFR.js → logs-7TJCQWWC.js} +4 -4
- package/dist/chunks/{mcp-EBVO25Q2.js → mcp-AGC6CKVF.js} +22 -21
- package/dist/chunks/mcp-AGC6CKVF.js.map +6 -0
- package/dist/chunks/{message-command-YIHQF33L.js → message-command-YABOALYQ.js} +46 -44
- package/dist/chunks/message-command-YABOALYQ.js.map +6 -0
- package/dist/chunks/{mouse-WFSJSLQD.js → mouse-EJQML44I.js} +2 -2
- package/dist/chunks/{open-3I5NZTSX.js → open-EOD6CNU3.js} +8 -8
- package/dist/chunks/{operator-tools-PK2WYSF3.js → operator-tools-PKBH2QBO.js} +14 -14
- package/dist/chunks/{output-schema-2UJ7LOOX.js → output-schema-AWMLT4WM.js} +3 -3
- package/dist/chunks/{pal-IOPI5RKZ.js → pal-5YHCJ2JR.js} +16 -16
- package/dist/chunks/{palette-WDPS7W6Q.js → palette-CL5OOYGK.js} +10 -4
- package/dist/chunks/{peers-MZD3KTZK.js → peers-Z3T7RTVH.js} +6 -6
- package/dist/chunks/{plain-report-IOYN4O6N.js → plain-report-XVPBQDLE.js} +2 -2
- package/dist/chunks/{prefix-MLAG4KTK.js → prefix-3ZNPUSUK.js} +2 -2
- package/dist/chunks/{providers-SI467SWN.js → providers-N664Y22F.js} +11 -11
- package/dist/chunks/{pty-T5LBAATA.js → pty-ETJLWVJ3.js} +3 -3
- package/dist/chunks/{resident-DDGJ2IWB.js → resident-LZELYADV.js} +26 -25
- package/dist/chunks/resident-LZELYADV.js.map +6 -0
- package/dist/chunks/resume-HXLVD3CA.js +24 -0
- package/dist/chunks/{resume-command-V6ZKY7J6.js → resume-command-DTBT3HAZ.js} +4 -4
- package/dist/chunks/{schedule-GSNY74KJ.js → schedule-CJHDXOBP.js} +8 -8
- package/dist/chunks/{service-MH57P24N.js → service-G3C3P3OH.js} +30 -29
- package/dist/chunks/service-G3C3P3OH.js.map +6 -0
- package/dist/chunks/{session-step-D4AT5RZR.js → session-step-Y5MB3PC3.js} +15 -15
- package/dist/chunks/{skills-QARQHL6M.js → skills-A43CBSME.js} +8 -8
- package/dist/chunks/{start-check-2EP7HZTU.js → start-check-YM6MB74I.js} +2 -2
- package/dist/chunks/startup-failure-BRK5RHPG.js +27 -0
- package/dist/chunks/startup-failure-BRK5RHPG.js.map +6 -0
- package/dist/chunks/{state-ADQWQEYB.js → state-CEVBX4RS.js} +2 -2
- package/dist/chunks/{store-TFJ73ZAM.js → store-22ERCOCX.js} +4 -4
- package/dist/chunks/store-76EY6ETT.js +21 -0
- package/dist/chunks/{store-RF6D7U2T.js → store-IHGR6SBK.js} +6 -6
- package/dist/chunks/{store-KOGQWG66.js → store-M4T7Y6I3.js} +11 -11
- package/dist/chunks/{tui-5HAU6RLS.js → tui-VBX3GXNF.js} +435 -168
- package/dist/chunks/tui-VBX3GXNF.js.map +6 -0
- package/dist/chunks/{upgrade-ARBZZZRK.js → upgrade-V6M7ZTO4.js} +8 -9
- package/dist/chunks/upgrade-V6M7ZTO4.js.map +6 -0
- package/dist/chunks/{spaces-JVPRV4YM.js → workspaces-6RCDMD75.js} +79 -53
- package/dist/chunks/workspaces-6RCDMD75.js.map +6 -0
- package/dist/chunks/{worktree-5M2XFFJT.js → worktree-BJWETVLX.js} +13 -13
- package/dist/cli.d.ts.map +1 -1
- package/dist/commands/manifest.d.ts +1 -1
- package/dist/commands/manifest.d.ts.map +1 -1
- package/dist/commands/upgrade.d.ts.map +1 -1
- package/dist/commands/workspaces.d.ts +49 -0
- package/dist/commands/workspaces.d.ts.map +1 -0
- package/dist/config/load.d.ts.map +1 -1
- package/dist/config/schema.d.ts +8 -3
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/context/environment.d.ts +9 -1
- package/dist/context/environment.d.ts.map +1 -1
- package/dist/doctor/checks/runtime.d.ts +1 -1
- package/dist/doctor/checks/runtime.d.ts.map +1 -1
- package/dist/doctor/checks/terminal.d.ts +1 -1
- package/dist/doctor/checks/terminal.d.ts.map +1 -1
- package/dist/index.js +21 -20
- package/dist/integrations/accounts/host-facts.d.ts +1 -1
- package/dist/integrations/peers/runtime.d.ts +1 -1
- package/dist/integrations/peers/runtime.d.ts.map +1 -1
- package/dist/integrations/resident/runner-worker.js +21 -21
- package/dist/reminders/environment.d.ts +1 -1
- package/dist/reminders/environment.d.ts.map +1 -1
- package/dist/reminders/index.d.ts +1 -1
- package/dist/reminders/index.d.ts.map +1 -1
- package/dist/rounds/types.d.ts +6 -0
- package/dist/rounds/types.d.ts.map +1 -1
- package/dist/startup-failure.d.ts +12 -0
- package/dist/startup-failure.d.ts.map +1 -0
- package/dist/tui/App.d.ts +19 -7
- package/dist/tui/App.d.ts.map +1 -1
- package/dist/tui/Composer.d.ts +10 -4
- package/dist/tui/Composer.d.ts.map +1 -1
- package/dist/tui/agent.d.ts +17 -0
- package/dist/tui/agent.d.ts.map +1 -1
- package/dist/tui/capability-notice.d.ts +7 -0
- package/dist/tui/capability-notice.d.ts.map +1 -1
- package/dist/tui/external-editor.d.ts.map +1 -1
- package/dist/tui/index.d.ts.map +1 -1
- package/dist/tui/live-model-step.d.ts +16 -0
- package/dist/tui/live-model-step.d.ts.map +1 -0
- package/dist/tui/model-refusal.d.ts +2 -0
- package/dist/tui/model-refusal.d.ts.map +1 -1
- package/dist/tui/slashCommands.d.ts +22 -0
- package/dist/tui/slashCommands.d.ts.map +1 -1
- package/dist/tui/zoom/entry.d.ts +6 -6
- package/dist/tui/zoom/entry.d.ts.map +1 -1
- package/dist/tui/zoom/gesture.d.ts +2 -2
- package/dist/tui/zoom/gesture.d.ts.map +1 -1
- package/dist/tui/zoom/leave.d.ts +2 -2
- package/dist/tui/zoom/leave.d.ts.map +1 -1
- package/dist/tui/zoom/local.d.ts +3 -3
- package/dist/tui/zoom/local.d.ts.map +1 -1
- package/dist/{spaces → workspaces}/git.d.ts +1 -1
- package/dist/workspaces/git.d.ts.map +1 -0
- package/dist/{spaces → workspaces}/goto.d.ts +7 -7
- package/dist/workspaces/goto.d.ts.map +1 -0
- package/dist/{spaces → workspaces}/host.d.ts +61 -52
- package/dist/workspaces/host.d.ts.map +1 -0
- package/dist/{spaces → workspaces}/input.d.ts +1 -1
- package/dist/workspaces/input.d.ts.map +1 -0
- package/dist/{spaces → workspaces}/keymap.d.ts +2 -2
- package/dist/workspaces/keymap.d.ts.map +1 -0
- package/dist/{spaces → workspaces}/layout.d.ts +6 -4
- package/dist/workspaces/layout.d.ts.map +1 -0
- package/dist/{spaces → workspaces}/mouse.d.ts +2 -2
- package/dist/workspaces/mouse.d.ts.map +1 -0
- package/dist/{spaces → workspaces}/overlay.d.ts +0 -1
- package/dist/workspaces/overlay.d.ts.map +1 -0
- package/dist/workspaces/palette.d.ts +75 -0
- package/dist/workspaces/palette.d.ts.map +1 -0
- package/dist/workspaces/peers.d.ts.map +1 -0
- package/dist/{spaces → workspaces}/prefix.d.ts +1 -1
- package/dist/workspaces/prefix.d.ts.map +1 -0
- package/dist/{spaces → workspaces}/roster.d.ts +22 -22
- package/dist/workspaces/roster.d.ts.map +1 -0
- package/dist/workspaces/selection.d.ts.map +1 -0
- package/dist/{spaces → workspaces}/session.d.ts +1 -1
- package/dist/workspaces/session.d.ts.map +1 -0
- package/dist/{spaces → workspaces}/sidebar.d.ts +17 -17
- package/dist/workspaces/sidebar.d.ts.map +1 -0
- package/dist/{spaces → workspaces}/signal.d.ts +5 -3
- package/dist/workspaces/signal.d.ts.map +1 -0
- package/dist/{spaces → workspaces}/status.d.ts +2 -2
- package/dist/workspaces/status.d.ts.map +1 -0
- package/dist/{spaces → workspaces}/store.d.ts +25 -14
- package/dist/workspaces/store.d.ts.map +1 -0
- package/dist/workspaces/tabbar.d.ts +54 -0
- package/dist/workspaces/tabbar.d.ts.map +1 -0
- package/dist/{spaces → workspaces}/tiling.d.ts +7 -4
- package/dist/workspaces/tiling.d.ts.map +1 -0
- package/package.json +3 -3
- package/dist/chunks/acp-CGGPX6FV.js.map +0 -6
- package/dist/chunks/add-7F26IYNU.js.map +0 -6
- package/dist/chunks/agent-session-SYLDVKFJ.js +0 -69
- package/dist/chunks/bin-main-NID46PS7.js.map +0 -6
- package/dist/chunks/chunk-2YKQMUTC.js.map +0 -6
- package/dist/chunks/chunk-4HL5LUP5.js.map +0 -6
- package/dist/chunks/chunk-AR2GPJUO.js.map +0 -6
- package/dist/chunks/chunk-BDHXJ7BM.js.map +0 -6
- package/dist/chunks/chunk-EXFSMYH4.js +0 -83
- package/dist/chunks/chunk-EXFSMYH4.js.map +0 -6
- package/dist/chunks/chunk-G742EI3J.js.map +0 -6
- package/dist/chunks/chunk-OMRGJSUJ.js.map +0 -6
- package/dist/chunks/chunk-OXM3GHWE.js.map +0 -6
- package/dist/chunks/chunk-OYX743QK.js.map +0 -6
- package/dist/chunks/cli-runtime-OBTTHZZI.js.map +0 -6
- package/dist/chunks/exec-7YEZ64T4.js.map +0 -6
- package/dist/chunks/host-663JLCCW.js +0 -28
- package/dist/chunks/list-GIP6KAYZ.js.map +0 -6
- package/dist/chunks/mcp-EBVO25Q2.js.map +0 -6
- package/dist/chunks/message-command-YIHQF33L.js.map +0 -6
- package/dist/chunks/resident-DDGJ2IWB.js.map +0 -6
- package/dist/chunks/resume-GPXJJXCK.js +0 -24
- package/dist/chunks/service-MH57P24N.js.map +0 -6
- package/dist/chunks/spaces-JVPRV4YM.js.map +0 -6
- package/dist/chunks/store-IRKBQZNF.js +0 -17
- package/dist/chunks/tui-5HAU6RLS.js.map +0 -6
- package/dist/chunks/upgrade-ARBZZZRK.js.map +0 -6
- package/dist/commands/spaces.d.ts +0 -46
- package/dist/commands/spaces.d.ts.map +0 -1
- package/dist/spaces/git.d.ts.map +0 -1
- package/dist/spaces/goto.d.ts.map +0 -1
- package/dist/spaces/host.d.ts.map +0 -1
- package/dist/spaces/input.d.ts.map +0 -1
- package/dist/spaces/keymap.d.ts.map +0 -1
- package/dist/spaces/layout.d.ts.map +0 -1
- package/dist/spaces/mouse.d.ts.map +0 -1
- package/dist/spaces/overlay.d.ts.map +0 -1
- package/dist/spaces/palette.d.ts +0 -35
- package/dist/spaces/palette.d.ts.map +0 -1
- package/dist/spaces/peers.d.ts.map +0 -1
- package/dist/spaces/prefix.d.ts.map +0 -1
- package/dist/spaces/roster.d.ts.map +0 -1
- package/dist/spaces/selection.d.ts.map +0 -1
- package/dist/spaces/session.d.ts.map +0 -1
- package/dist/spaces/sidebar.d.ts.map +0 -1
- package/dist/spaces/signal.d.ts.map +0 -1
- package/dist/spaces/status.d.ts.map +0 -1
- package/dist/spaces/store.d.ts.map +0 -1
- package/dist/spaces/tabbar.d.ts +0 -36
- package/dist/spaces/tabbar.d.ts.map +0 -1
- package/dist/spaces/tiling.d.ts.map +0 -1
- /package/dist/chunks/{activity-command-D744W6SC.js.map → activity-command-UOPJG7HV.js.map} +0 -0
- /package/dist/chunks/{agent-42PYZGA5.js.map → agent-LCIH3SLO.js.map} +0 -0
- /package/dist/chunks/{agent-session-SYLDVKFJ.js.map → agent-session-LUGICAIR.js.map} +0 -0
- /package/dist/chunks/{archive-FLZUJDJZ.js.map → archive-7WVQ537T.js.map} +0 -0
- /package/dist/chunks/{binding-JQUI2CTZ.js.map → binding-XVFMQCFN.js.map} +0 -0
- /package/dist/chunks/{browser-YZCY2CI6.js.map → browser-4PRGERNN.js.map} +0 -0
- /package/dist/chunks/{chat-WBJPS4K6.js.map → chat-X5MYAPDS.js.map} +0 -0
- /package/dist/chunks/{chunk-HIJXUSOS.js.map → chunk-25KCA24W.js.map} +0 -0
- /package/dist/chunks/{chunk-LQN7NG2F.js.map → chunk-2GW4CKCP.js.map} +0 -0
- /package/dist/chunks/{chunk-RPCJJZTI.js.map → chunk-3DV5GOM2.js.map} +0 -0
- /package/dist/chunks/{chunk-NZ6DX5CL.js.map → chunk-3KFDEYQO.js.map} +0 -0
- /package/dist/chunks/{chunk-QXNROEIH.js.map → chunk-5EAN453D.js.map} +0 -0
- /package/dist/chunks/{chunk-IZDYKTPN.js.map → chunk-5OLWLGSL.js.map} +0 -0
- /package/dist/chunks/{chunk-PAY5TGHV.js.map → chunk-5QA7PV3Q.js.map} +0 -0
- /package/dist/chunks/{chunk-LMVXENEF.js.map → chunk-5UPGCZZI.js.map} +0 -0
- /package/dist/chunks/{chunk-24NEAMG5.js.map → chunk-6C7LQMXN.js.map} +0 -0
- /package/dist/chunks/{chunk-P2Y3IUE6.js.map → chunk-6GYORUQC.js.map} +0 -0
- /package/dist/chunks/{chunk-PQTS7XQB.js.map → chunk-6IKRSJZD.js.map} +0 -0
- /package/dist/chunks/{chunk-BWI7L43E.js.map → chunk-6RZHAFXK.js.map} +0 -0
- /package/dist/chunks/{chunk-Q7ELMF4C.js.map → chunk-72B3BK3S.js.map} +0 -0
- /package/dist/chunks/{chunk-EVRWBRUB.js.map → chunk-7OGCV6CD.js.map} +0 -0
- /package/dist/chunks/{chunk-POKKY7MR.js.map → chunk-7W4SPINO.js.map} +0 -0
- /package/dist/chunks/{chunk-NFATUZMX.js.map → chunk-7YVCP6TP.js.map} +0 -0
- /package/dist/chunks/{chunk-NS4PN3SI.js.map → chunk-BA34BT4O.js.map} +0 -0
- /package/dist/chunks/{chunk-Q6DM2TVI.js.map → chunk-BCRSDURU.js.map} +0 -0
- /package/dist/chunks/{chunk-2UATEMPS.js.map → chunk-BJKLRSSR.js.map} +0 -0
- /package/dist/chunks/{chunk-JCLZ5HXI.js.map → chunk-BN5TEW6O.js.map} +0 -0
- /package/dist/chunks/{chunk-OM3EDVLG.js.map → chunk-CRWKYSTS.js.map} +0 -0
- /package/dist/chunks/{chunk-6F4PW7TF.js.map → chunk-D5K2HSG7.js.map} +0 -0
- /package/dist/chunks/{chunk-RBH2FDM5.js.map → chunk-EDAXADCF.js.map} +0 -0
- /package/dist/chunks/{chunk-7BRK6EHB.js.map → chunk-EEG22XMV.js.map} +0 -0
- /package/dist/chunks/{chunk-HYPNAC4H.js.map → chunk-EHFPJANT.js.map} +0 -0
- /package/dist/chunks/{chunk-TGPKTH2S.js.map → chunk-FLQZA5WL.js.map} +0 -0
- /package/dist/chunks/{chunk-X2F5ZFBV.js.map → chunk-FU7GB347.js.map} +0 -0
- /package/dist/chunks/{chunk-JU7JQ62S.js.map → chunk-GGAZD6ML.js.map} +0 -0
- /package/dist/chunks/{chunk-KY2WSKNM.js.map → chunk-GMT73VBK.js.map} +0 -0
- /package/dist/chunks/{chunk-QWVWGW6I.js.map → chunk-GXYKREW7.js.map} +0 -0
- /package/dist/chunks/{chunk-FU776PDS.js.map → chunk-HWRC2KL5.js.map} +0 -0
- /package/dist/chunks/{chunk-6OWRRNLC.js.map → chunk-HWZWMDMN.js.map} +0 -0
- /package/dist/chunks/{chunk-XK26JNIF.js.map → chunk-I3E5SDBB.js.map} +0 -0
- /package/dist/chunks/{chunk-XN7C5GWO.js.map → chunk-IKK3UQOE.js.map} +0 -0
- /package/dist/chunks/{chunk-I6W3KJR3.js.map → chunk-K3W6LEIP.js.map} +0 -0
- /package/dist/chunks/{chunk-U4YXQWPW.js.map → chunk-K7KQHO3W.js.map} +0 -0
- /package/dist/chunks/{chunk-PCWQ3ET3.js.map → chunk-LV6FQJHS.js.map} +0 -0
- /package/dist/chunks/{chunk-T3NLKQO2.js.map → chunk-LVIYX25W.js.map} +0 -0
- /package/dist/chunks/{chunk-F4B77QJQ.js.map → chunk-M33ZJVMX.js.map} +0 -0
- /package/dist/chunks/{chunk-B7QEQ7Y3.js.map → chunk-MKLTHECQ.js.map} +0 -0
- /package/dist/chunks/{chunk-F2QERXWD.js.map → chunk-MVYLBP2M.js.map} +0 -0
- /package/dist/chunks/{chunk-XSAEGHPS.js.map → chunk-NQDPAMNA.js.map} +0 -0
- /package/dist/chunks/{chunk-O7H4QZ7I.js.map → chunk-NRKOU2PC.js.map} +0 -0
- /package/dist/chunks/{chunk-GXQ4G3KA.js.map → chunk-NS5UHMLA.js.map} +0 -0
- /package/dist/chunks/{chunk-5OGY4CE7.js.map → chunk-NYTO4KXS.js.map} +0 -0
- /package/dist/chunks/{chunk-ZB45QDNU.js.map → chunk-O6EAXTVH.js.map} +0 -0
- /package/dist/chunks/{chunk-WNOB6C62.js.map → chunk-PAWGQZAW.js.map} +0 -0
- /package/dist/chunks/{chunk-6LMIJ2YT.js.map → chunk-PBU6HAWN.js.map} +0 -0
- /package/dist/chunks/{chunk-IFXYNA2K.js.map → chunk-PSRJQ7V6.js.map} +0 -0
- /package/dist/chunks/{chunk-5VBA5XSC.js.map → chunk-QU7FKI2J.js.map} +0 -0
- /package/dist/chunks/{chunk-H2RDYYTB.js.map → chunk-S34KVZZT.js.map} +0 -0
- /package/dist/chunks/{chunk-H5H6HDRA.js.map → chunk-S3DSUD7H.js.map} +0 -0
- /package/dist/chunks/{chunk-5DFBOMTX.js.map → chunk-T33MN3DE.js.map} +0 -0
- /package/dist/chunks/{chunk-PFFQOCEI.js.map → chunk-THZVC2RU.js.map} +0 -0
- /package/dist/chunks/{chunk-IFEBBQ2M.js.map → chunk-UOJPF6B4.js.map} +0 -0
- /package/dist/chunks/{chunk-IPVDXTWF.js.map → chunk-UQJSWYXI.js.map} +0 -0
- /package/dist/chunks/{chunk-V3R3MR7F.js.map → chunk-USYZCOWI.js.map} +0 -0
- /package/dist/chunks/{chunk-5W7CSQXQ.js.map → chunk-UVPKVX7S.js.map} +0 -0
- /package/dist/chunks/{chunk-VPJG7NQL.js.map → chunk-W7YNWEPA.js.map} +0 -0
- /package/dist/chunks/{chunk-NGMXEU2B.js.map → chunk-WQJ4VBBH.js.map} +0 -0
- /package/dist/chunks/{chunk-U4ZP2JN2.js.map → chunk-WUMLVV7Q.js.map} +0 -0
- /package/dist/chunks/{chunk-W7XKWKEZ.js.map → chunk-XE4RMHJI.js.map} +0 -0
- /package/dist/chunks/{chunk-NCW3WBBI.js.map → chunk-XKZTXW3A.js.map} +0 -0
- /package/dist/chunks/{chunk-TOJSNO4M.js.map → chunk-XS6IOLUS.js.map} +0 -0
- /package/dist/chunks/{chunk-7HNWFGWD.js.map → chunk-Y4ZZZQ7V.js.map} +0 -0
- /package/dist/chunks/{chunk-D7BXM6WW.js.map → chunk-YGCXTFUS.js.map} +0 -0
- /package/dist/chunks/{commands-56WUDKVN.js.map → commands-NL3MWKEZ.js.map} +0 -0
- /package/dist/chunks/{crash-report-3IE2RFYG.js.map → crash-report-JVCF24WM.js.map} +0 -0
- /package/dist/chunks/{dist-BLCQRSQS.js.map → dist-663JGNNO.js.map} +0 -0
- /package/dist/chunks/{dist-L757TGUH.js.map → dist-7FHKFZWJ.js.map} +0 -0
- /package/dist/chunks/{dist-7UW2VLWO.js.map → dist-7Z3LCNPK.js.map} +0 -0
- /package/dist/chunks/{dist-Y6IO47UU.js.map → dist-AC7IAQ22.js.map} +0 -0
- /package/dist/chunks/{dist-SEXSU4PO.js.map → dist-IB62FDT7.js.map} +0 -0
- /package/dist/chunks/{dist-BLC5XSXL.js.map → dist-JEF2TWFB.js.map} +0 -0
- /package/dist/chunks/{dist-QZPA2XDK.js.map → dist-RICAGJLB.js.map} +0 -0
- /package/dist/chunks/{dist-GUHZ3EE6.js.map → dist-TQZS3NMV.js.map} +0 -0
- /package/dist/chunks/{doctor-QGFOTR5H.js.map → doctor-QNEVNEWM.js.map} +0 -0
- /package/dist/chunks/{drain-5WSM4MTM.js.map → drain-RMVRJ3ZH.js.map} +0 -0
- /package/dist/chunks/{eval-5ZIBALCB.js.map → eval-R6XNQB7S.js.map} +0 -0
- /package/dist/chunks/{home-DXPCVXZK.js.map → home-MG5XGCBL.js.map} +0 -0
- /package/dist/chunks/{host-663JLCCW.js.map → host-Q4VEV5LF.js.map} +0 -0
- /package/dist/chunks/{host-queries-7CSOWEPE.js.map → host-queries-6PVXVD67.js.map} +0 -0
- /package/dist/chunks/{learn-NNBHDBLF.js.map → learn-QEJFA6JU.js.map} +0 -0
- /package/dist/chunks/{learn-builtin-YEDJT6ZP.js.map → learn-builtin-5I4QOYGH.js.map} +0 -0
- /package/dist/chunks/{lifecycle-NDR7R22S.js.map → lifecycle-MOIUIQAH.js.map} +0 -0
- /package/dist/chunks/{live-FJISKPXJ.js.map → live-IOPYPFSM.js.map} +0 -0
- /package/dist/chunks/{login-42ZPPMYK.js.map → login-CO4ONVID.js.map} +0 -0
- /package/dist/chunks/{logs-7MAFXNFR.js.map → logs-7TJCQWWC.js.map} +0 -0
- /package/dist/chunks/{mouse-WFSJSLQD.js.map → mouse-EJQML44I.js.map} +0 -0
- /package/dist/chunks/{open-3I5NZTSX.js.map → open-EOD6CNU3.js.map} +0 -0
- /package/dist/chunks/{operator-tools-PK2WYSF3.js.map → operator-tools-PKBH2QBO.js.map} +0 -0
- /package/dist/chunks/{output-schema-2UJ7LOOX.js.map → output-schema-AWMLT4WM.js.map} +0 -0
- /package/dist/chunks/{pal-IOPI5RKZ.js.map → pal-5YHCJ2JR.js.map} +0 -0
- /package/dist/chunks/{palette-WDPS7W6Q.js.map → palette-CL5OOYGK.js.map} +0 -0
- /package/dist/chunks/{peers-MZD3KTZK.js.map → peers-Z3T7RTVH.js.map} +0 -0
- /package/dist/chunks/{plain-report-IOYN4O6N.js.map → plain-report-XVPBQDLE.js.map} +0 -0
- /package/dist/chunks/{prefix-MLAG4KTK.js.map → prefix-3ZNPUSUK.js.map} +0 -0
- /package/dist/chunks/{providers-SI467SWN.js.map → providers-N664Y22F.js.map} +0 -0
- /package/dist/chunks/{pty-T5LBAATA.js.map → pty-ETJLWVJ3.js.map} +0 -0
- /package/dist/chunks/{resume-GPXJJXCK.js.map → resume-HXLVD3CA.js.map} +0 -0
- /package/dist/chunks/{resume-command-V6ZKY7J6.js.map → resume-command-DTBT3HAZ.js.map} +0 -0
- /package/dist/chunks/{schedule-GSNY74KJ.js.map → schedule-CJHDXOBP.js.map} +0 -0
- /package/dist/chunks/{session-step-D4AT5RZR.js.map → session-step-Y5MB3PC3.js.map} +0 -0
- /package/dist/chunks/{skills-QARQHL6M.js.map → skills-A43CBSME.js.map} +0 -0
- /package/dist/chunks/{start-check-2EP7HZTU.js.map → start-check-YM6MB74I.js.map} +0 -0
- /package/dist/chunks/{state-ADQWQEYB.js.map → state-CEVBX4RS.js.map} +0 -0
- /package/dist/chunks/{store-IRKBQZNF.js.map → store-22ERCOCX.js.map} +0 -0
- /package/dist/chunks/{store-KOGQWG66.js.map → store-76EY6ETT.js.map} +0 -0
- /package/dist/chunks/{store-RF6D7U2T.js.map → store-IHGR6SBK.js.map} +0 -0
- /package/dist/chunks/{store-TFJ73ZAM.js.map → store-M4T7Y6I3.js.map} +0 -0
- /package/dist/chunks/{worktree-5M2XFFJT.js.map → worktree-BJWETVLX.js.map} +0 -0
- /package/dist/{spaces → workspaces}/peers.d.ts +0 -0
- /package/dist/{spaces → workspaces}/selection.d.ts +0 -0
|
@@ -304,7 +304,7 @@ var require_brace_expansion = __commonJS({
|
|
|
304
304
|
});
|
|
305
305
|
|
|
306
306
|
// ../sdk/dist/version.js
|
|
307
|
-
var VERSION = "60.
|
|
307
|
+
var VERSION = "60.2.0";
|
|
308
308
|
|
|
309
309
|
// ../sdk/dist/runtime/harness-session/index.js
|
|
310
310
|
import { posix, win32 } from "node:path";
|
|
@@ -5597,7 +5597,9 @@ var EPHEMERAL_EVENT_TYPES = /* @__PURE__ */ new Set([
|
|
|
5597
5597
|
"reasoning_delta",
|
|
5598
5598
|
"tool_progress",
|
|
5599
5599
|
"monitor_event",
|
|
5600
|
-
"compaction_started"
|
|
5600
|
+
"compaction_started",
|
|
5601
|
+
"session_log_degraded",
|
|
5602
|
+
"session_log_recovered"
|
|
5601
5603
|
]);
|
|
5602
5604
|
function isEphemeralEvent(event) {
|
|
5603
5605
|
return EPHEMERAL_EVENT_TYPES.has(event.type);
|
|
@@ -6045,10 +6047,10 @@ var ExternalHarnessSession = class {
|
|
|
6045
6047
|
}
|
|
6046
6048
|
}
|
|
6047
6049
|
makeActive(turnId6, operationId, startedAt) {
|
|
6048
|
-
let
|
|
6050
|
+
let resolve35;
|
|
6049
6051
|
let reject2;
|
|
6050
6052
|
const done = new Promise((yes, no) => {
|
|
6051
|
-
|
|
6053
|
+
resolve35 = yes;
|
|
6052
6054
|
reject2 = no;
|
|
6053
6055
|
});
|
|
6054
6056
|
void done.catch(() => void 0);
|
|
@@ -6058,7 +6060,7 @@ var ExternalHarnessSession = class {
|
|
|
6058
6060
|
startedAt,
|
|
6059
6061
|
items: /* @__PURE__ */ new Map(),
|
|
6060
6062
|
reviews: /* @__PURE__ */ new Map(),
|
|
6061
|
-
resolve:
|
|
6063
|
+
resolve: resolve35,
|
|
6062
6064
|
reject: reject2,
|
|
6063
6065
|
done
|
|
6064
6066
|
};
|
|
@@ -6896,8 +6898,8 @@ function windowsEnv(env, name2) {
|
|
|
6896
6898
|
}
|
|
6897
6899
|
__name(windowsEnv, "windowsEnv");
|
|
6898
6900
|
function insideDirectory(path3, directory) {
|
|
6899
|
-
const
|
|
6900
|
-
return
|
|
6901
|
+
const relative17 = win322.relative(directory, path3);
|
|
6902
|
+
return relative17 === "" || !relative17.startsWith("..") && !win322.isAbsolute(relative17);
|
|
6901
6903
|
}
|
|
6902
6904
|
__name(insideDirectory, "insideDirectory");
|
|
6903
6905
|
function findGitBash(probe2) {
|
|
@@ -8230,13 +8232,13 @@ var GuardedFetchProvider = class {
|
|
|
8230
8232
|
operation.throwIfStopped();
|
|
8231
8233
|
return url;
|
|
8232
8234
|
}
|
|
8233
|
-
const
|
|
8235
|
+
const resolve35 = this.config.resolve ?? (async (name2) => (await lookup(name2, { all: true })).map((r) => r.address));
|
|
8234
8236
|
let addresses;
|
|
8235
8237
|
if (isIP(hostname)) {
|
|
8236
8238
|
addresses = [hostname];
|
|
8237
8239
|
} else {
|
|
8238
8240
|
try {
|
|
8239
|
-
addresses = await operation.run(() =>
|
|
8241
|
+
addresses = await operation.run(() => resolve35(hostname, operation.signal));
|
|
8240
8242
|
} catch (err) {
|
|
8241
8243
|
operation.throwIfStopped();
|
|
8242
8244
|
throw new WebFetchRefusedError(`Refused "${hostname}" \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" });
|
|
@@ -8582,9 +8584,9 @@ async function vetWebSocketTarget(raw, options = {}) {
|
|
|
8582
8584
|
if (literal !== 0) {
|
|
8583
8585
|
addresses = [hostname];
|
|
8584
8586
|
} else {
|
|
8585
|
-
const
|
|
8587
|
+
const resolve35 = options.resolve ?? (async (name2) => (await dnsLookup(name2, { all: true })).map((r) => r.address));
|
|
8586
8588
|
try {
|
|
8587
|
-
addresses = await
|
|
8589
|
+
addresses = await resolve35(hostname);
|
|
8588
8590
|
} catch (err) {
|
|
8589
8591
|
throw new WebSocketRefusedError(`Refused "${hostname}": it could not be resolved (${err instanceof Error ? err.message : String(err)}), so nothing here can say where it points.`);
|
|
8590
8592
|
}
|
|
@@ -9118,8 +9120,8 @@ var BackgroundJobRegistry = class {
|
|
|
9118
9120
|
};
|
|
9119
9121
|
let startError;
|
|
9120
9122
|
let settleStarted;
|
|
9121
|
-
const startedPromise = new Promise((
|
|
9122
|
-
settleStarted = /* @__PURE__ */ __name(() =>
|
|
9123
|
+
const startedPromise = new Promise((resolve35) => {
|
|
9124
|
+
settleStarted = /* @__PURE__ */ __name(() => resolve35(startError === void 0 ? {} : { error: startError }), "settleStarted");
|
|
9123
9125
|
});
|
|
9124
9126
|
if (params.spawn || child.pid !== void 0)
|
|
9125
9127
|
settleStarted();
|
|
@@ -9165,7 +9167,7 @@ var BackgroundJobRegistry = class {
|
|
|
9165
9167
|
outputChunks: [],
|
|
9166
9168
|
outputObservers: /* @__PURE__ */ new Set(),
|
|
9167
9169
|
started: startedPromise,
|
|
9168
|
-
exit: new Promise((
|
|
9170
|
+
exit: new Promise((resolve35) => {
|
|
9169
9171
|
let spawned = child.pid !== void 0;
|
|
9170
9172
|
let failedToSpawn = false;
|
|
9171
9173
|
let finalized = false;
|
|
@@ -9184,7 +9186,7 @@ var BackgroundJobRegistry = class {
|
|
|
9184
9186
|
...code === null ? {} : { exitCode: code },
|
|
9185
9187
|
...signal ? { signal } : {}
|
|
9186
9188
|
};
|
|
9187
|
-
|
|
9189
|
+
resolve35();
|
|
9188
9190
|
for (const observer of entry.outputObservers)
|
|
9189
9191
|
observer();
|
|
9190
9192
|
if (entry.monitor) {
|
|
@@ -9383,7 +9385,7 @@ var BackgroundJobRegistry = class {
|
|
|
9383
9385
|
const signal = opts.signal;
|
|
9384
9386
|
if (signal.aborted)
|
|
9385
9387
|
return Promise.reject(signal.reason);
|
|
9386
|
-
return new Promise((
|
|
9388
|
+
return new Promise((resolve35, reject2) => {
|
|
9387
9389
|
let disposeAbort = /* @__PURE__ */ __name(() => {
|
|
9388
9390
|
}, "disposeAbort");
|
|
9389
9391
|
const unsubscribe = this.onExit((job) => {
|
|
@@ -9391,7 +9393,7 @@ var BackgroundJobRegistry = class {
|
|
|
9391
9393
|
return;
|
|
9392
9394
|
unsubscribe();
|
|
9393
9395
|
disposeAbort();
|
|
9394
|
-
|
|
9396
|
+
resolve35(job);
|
|
9395
9397
|
});
|
|
9396
9398
|
disposeAbort = subscribeToAbort(signal, () => {
|
|
9397
9399
|
unsubscribe();
|
|
@@ -9488,7 +9490,7 @@ var BackgroundJobRegistry = class {
|
|
|
9488
9490
|
throw new BackgroundJobOutputWaitLimitError({ owner, limit: globalLimit, scope: "registry" });
|
|
9489
9491
|
this.outputWaiters++;
|
|
9490
9492
|
this.outputWaitersByOwner.set(owner, ownerCount + 1);
|
|
9491
|
-
return new Promise((
|
|
9493
|
+
return new Promise((resolve35) => {
|
|
9492
9494
|
const startedAt = Date.now();
|
|
9493
9495
|
let settled = false;
|
|
9494
9496
|
let disposeAbort = /* @__PURE__ */ __name(() => {
|
|
@@ -9508,7 +9510,7 @@ var BackgroundJobRegistry = class {
|
|
|
9508
9510
|
this.outputWaitersByOwner.delete(owner);
|
|
9509
9511
|
else
|
|
9510
9512
|
this.outputWaitersByOwner.set(owner, remaining);
|
|
9511
|
-
|
|
9513
|
+
resolve35(result);
|
|
9512
9514
|
}, "finish");
|
|
9513
9515
|
const timeout = /* @__PURE__ */ __name((cause) => {
|
|
9514
9516
|
read();
|
|
@@ -10287,7 +10289,7 @@ ${line}`;
|
|
|
10287
10289
|
stdout: true,
|
|
10288
10290
|
stderr: true
|
|
10289
10291
|
});
|
|
10290
|
-
return await new Promise((
|
|
10292
|
+
return await new Promise((resolve35) => {
|
|
10291
10293
|
let settled = false;
|
|
10292
10294
|
let terminal;
|
|
10293
10295
|
const inFlight = /* @__PURE__ */ new Set();
|
|
@@ -10302,7 +10304,7 @@ ${line}`;
|
|
|
10302
10304
|
clearTimeout(deadline);
|
|
10303
10305
|
options.signal?.removeEventListener("abort", onAbort);
|
|
10304
10306
|
void worker.terminate();
|
|
10305
|
-
|
|
10307
|
+
resolve35({ ...result, calls: [...calls] });
|
|
10306
10308
|
}, "finish");
|
|
10307
10309
|
const finishTerminalWhenHostCallsSettle = /* @__PURE__ */ __name(() => {
|
|
10308
10310
|
if (terminal && inFlight.size === 0)
|
|
@@ -12189,8 +12191,8 @@ ${body}`,
|
|
|
12189
12191
|
let timer;
|
|
12190
12192
|
await Promise.race([
|
|
12191
12193
|
Promise.allSettled([...inFlight]),
|
|
12192
|
-
new Promise((
|
|
12193
|
-
timer = setTimeout(
|
|
12194
|
+
new Promise((resolve35) => {
|
|
12195
|
+
timer = setTimeout(resolve35, grace);
|
|
12194
12196
|
})
|
|
12195
12197
|
]);
|
|
12196
12198
|
clearTimeout(timer);
|
|
@@ -14587,14 +14589,14 @@ var MCPReconnectSupervisor = class {
|
|
|
14587
14589
|
});
|
|
14588
14590
|
}
|
|
14589
14591
|
wait(ms) {
|
|
14590
|
-
return new Promise((
|
|
14592
|
+
return new Promise((resolve35) => {
|
|
14591
14593
|
const finish2 = /* @__PURE__ */ __name(() => {
|
|
14592
14594
|
if (this.timer)
|
|
14593
14595
|
clearTimeout(this.timer);
|
|
14594
14596
|
this.timer = void 0;
|
|
14595
14597
|
if (this.finishWait === finish2)
|
|
14596
14598
|
this.finishWait = void 0;
|
|
14597
|
-
|
|
14599
|
+
resolve35();
|
|
14598
14600
|
}, "finish");
|
|
14599
14601
|
this.finishWait = finish2;
|
|
14600
14602
|
this.timer = setTimeout(finish2, ms);
|
|
@@ -15619,7 +15621,7 @@ async function renameWithRetry(from, to) {
|
|
|
15619
15621
|
const code = err.code ?? "";
|
|
15620
15622
|
if (!CONTENDED.has(code) || attempt >= RENAME_ATTEMPTS)
|
|
15621
15623
|
throw err;
|
|
15622
|
-
await new Promise((
|
|
15624
|
+
await new Promise((resolve35) => setTimeout(resolve35, attempt));
|
|
15623
15625
|
}
|
|
15624
15626
|
}
|
|
15625
15627
|
}
|
|
@@ -17903,11 +17905,11 @@ async function teardownSandbox(sandbox, timeoutMs) {
|
|
|
17903
17905
|
return await operation;
|
|
17904
17906
|
let timer;
|
|
17905
17907
|
let timedOut;
|
|
17906
|
-
const deadline = new Promise((
|
|
17908
|
+
const deadline = new Promise((resolve35) => {
|
|
17907
17909
|
timer = setTimeout(() => {
|
|
17908
17910
|
timedOut = teardownTimeoutError(timeoutMs);
|
|
17909
17911
|
controller.abort(timedOut);
|
|
17910
|
-
|
|
17912
|
+
resolve35({ kind: "timed_out", error: timedOut });
|
|
17911
17913
|
}, timeoutMs);
|
|
17912
17914
|
});
|
|
17913
17915
|
try {
|
|
@@ -17935,20 +17937,20 @@ async function acquireSandbox(options) {
|
|
|
17935
17937
|
let timeoutError3;
|
|
17936
17938
|
let timer;
|
|
17937
17939
|
let onAbort;
|
|
17938
|
-
const aborted = new Promise((
|
|
17940
|
+
const aborted = new Promise((resolve35) => {
|
|
17939
17941
|
onAbort = /* @__PURE__ */ __name(() => {
|
|
17940
17942
|
operationController.abort(runSignal.reason);
|
|
17941
|
-
|
|
17943
|
+
resolve35({ kind: "cancelled" });
|
|
17942
17944
|
}, "onAbort");
|
|
17943
17945
|
runSignal.addEventListener("abort", onAbort, { once: true });
|
|
17944
17946
|
});
|
|
17945
|
-
const timedOut = new Promise((
|
|
17947
|
+
const timedOut = new Promise((resolve35) => {
|
|
17946
17948
|
if (options.timeoutMs === Number.POSITIVE_INFINITY)
|
|
17947
17949
|
return;
|
|
17948
17950
|
timer = setTimeout(() => {
|
|
17949
17951
|
timeoutError3 = acquisitionTimeoutError(options.timeoutMs);
|
|
17950
17952
|
operationController.abort(timeoutError3);
|
|
17951
|
-
|
|
17953
|
+
resolve35({ kind: "timed_out", error: timeoutError3 });
|
|
17952
17954
|
}, options.timeoutMs);
|
|
17953
17955
|
});
|
|
17954
17956
|
if (runSignal.aborted) {
|
|
@@ -18358,6 +18360,157 @@ function memoizeAsync(fn) {
|
|
|
18358
18360
|
}
|
|
18359
18361
|
__name(memoizeAsync, "memoizeAsync");
|
|
18360
18362
|
|
|
18363
|
+
// ../sdk/dist/utils/temp.js
|
|
18364
|
+
import { createHash as createHash5 } from "node:crypto";
|
|
18365
|
+
import { lstatSync, mkdirSync as mkdirSync2, mkdtempSync } from "node:fs";
|
|
18366
|
+
import { mkdtemp } from "node:fs/promises";
|
|
18367
|
+
import { tmpdir, userInfo } from "node:os";
|
|
18368
|
+
import { isAbsolute as isAbsolute2, join as join8, relative, resolve as resolve2, sep } from "node:path";
|
|
18369
|
+
var NAMZU_TMPDIR_ENV = "NAMZU_TMPDIR";
|
|
18370
|
+
var TempDirectoryError = class extends Error {
|
|
18371
|
+
static {
|
|
18372
|
+
__name(this, "TempDirectoryError");
|
|
18373
|
+
}
|
|
18374
|
+
reason;
|
|
18375
|
+
directory;
|
|
18376
|
+
name = "TempDirectoryError";
|
|
18377
|
+
constructor(message, reason2, directory) {
|
|
18378
|
+
super(message);
|
|
18379
|
+
this.reason = reason2;
|
|
18380
|
+
this.directory = directory;
|
|
18381
|
+
}
|
|
18382
|
+
};
|
|
18383
|
+
function resolveTempBase(env = process.env) {
|
|
18384
|
+
const configured = env[NAMZU_TMPDIR_ENV]?.trim();
|
|
18385
|
+
if (!configured)
|
|
18386
|
+
return tmpdir();
|
|
18387
|
+
if (!isAbsolute2(configured)) {
|
|
18388
|
+
throw new TempDirectoryError(`${NAMZU_TMPDIR_ENV} must be a full path, but it is "${configured}". Set it to a folder on a disk with free space.`, "not_absolute", configured);
|
|
18389
|
+
}
|
|
18390
|
+
return configured;
|
|
18391
|
+
}
|
|
18392
|
+
__name(resolveTempBase, "resolveTempBase");
|
|
18393
|
+
function explain(error, directory) {
|
|
18394
|
+
const code = error?.code;
|
|
18395
|
+
const elsewhere = `Free some space and start again, or set ${NAMZU_TMPDIR_ENV} to a folder on another disk.`;
|
|
18396
|
+
switch (code) {
|
|
18397
|
+
case "ENOSPC":
|
|
18398
|
+
return new TempDirectoryError(`The disk is full, so Namzu could not create ${directory}. ${elsewhere}`, "volume_full", directory);
|
|
18399
|
+
case "EDQUOT":
|
|
18400
|
+
return new TempDirectoryError(`Your disk quota is used up, so Namzu could not create ${directory}. ${elsewhere}`, "quota_exceeded", directory);
|
|
18401
|
+
case "EACCES":
|
|
18402
|
+
case "EPERM":
|
|
18403
|
+
case "EROFS":
|
|
18404
|
+
return new TempDirectoryError(`Namzu could not create ${directory} because the folder cannot be written to. Set ${NAMZU_TMPDIR_ENV} to a folder you can write to.`, "not_writable", directory);
|
|
18405
|
+
case "ENOENT":
|
|
18406
|
+
return new TempDirectoryError(`Namzu could not create ${directory} because its parent folder does not exist. Create that folder, or set ${NAMZU_TMPDIR_ENV} to one that does.`, "missing", directory);
|
|
18407
|
+
default:
|
|
18408
|
+
return void 0;
|
|
18409
|
+
}
|
|
18410
|
+
}
|
|
18411
|
+
__name(explain, "explain");
|
|
18412
|
+
function refuse(root, why) {
|
|
18413
|
+
return new TempDirectoryError(`Refusing temporary root ${root}: ${why} Set ${NAMZU_TMPDIR_ENV} to a folder only you can write to.`, "refused", root);
|
|
18414
|
+
}
|
|
18415
|
+
__name(refuse, "refuse");
|
|
18416
|
+
function sha256Hex2(value) {
|
|
18417
|
+
return createHash5("sha256").update(value).digest("hex");
|
|
18418
|
+
}
|
|
18419
|
+
__name(sha256Hex2, "sha256Hex");
|
|
18420
|
+
function privateTempRootPath(options = {}) {
|
|
18421
|
+
const getuid = "getuid" in options ? options.getuid : process.getuid?.bind(process);
|
|
18422
|
+
let user = "user";
|
|
18423
|
+
if (typeof getuid === "function") {
|
|
18424
|
+
user = String(getuid());
|
|
18425
|
+
} else {
|
|
18426
|
+
try {
|
|
18427
|
+
const name2 = (options.username ?? (() => userInfo().username))();
|
|
18428
|
+
if (name2.length > 0)
|
|
18429
|
+
user = sha256Hex2(name2).slice(0, 12);
|
|
18430
|
+
} catch {
|
|
18431
|
+
}
|
|
18432
|
+
}
|
|
18433
|
+
return join8(options.tmpdir ?? resolveTempBase(options.env), `namzu-${user}`);
|
|
18434
|
+
}
|
|
18435
|
+
__name(privateTempRootPath, "privateTempRootPath");
|
|
18436
|
+
function privateTempRoot(options = {}) {
|
|
18437
|
+
const platform2 = options.platform ?? process.platform;
|
|
18438
|
+
const getuid = "getuid" in options ? options.getuid : process.getuid?.bind(process);
|
|
18439
|
+
const root = privateTempRootPath(options);
|
|
18440
|
+
try {
|
|
18441
|
+
mkdirSync2(root, { mode: 448 });
|
|
18442
|
+
} catch (error) {
|
|
18443
|
+
if (error.code !== "EEXIST")
|
|
18444
|
+
throw explain(error, root) ?? error;
|
|
18445
|
+
}
|
|
18446
|
+
const entry = lstatSync(root);
|
|
18447
|
+
if (entry.isSymbolicLink())
|
|
18448
|
+
throw refuse(root, "it is a symbolic link.");
|
|
18449
|
+
if (!entry.isDirectory())
|
|
18450
|
+
throw refuse(root, "it is not a directory.");
|
|
18451
|
+
if (platform2 !== "win32" && typeof getuid === "function") {
|
|
18452
|
+
if (entry.uid !== getuid())
|
|
18453
|
+
throw refuse(root, `it belongs to uid ${entry.uid}.`);
|
|
18454
|
+
if ((entry.mode & 63) !== 0) {
|
|
18455
|
+
throw refuse(root, `mode ${(entry.mode & 511).toString(8)} lets other users in; it must be 700.`);
|
|
18456
|
+
}
|
|
18457
|
+
}
|
|
18458
|
+
return root;
|
|
18459
|
+
}
|
|
18460
|
+
__name(privateTempRoot, "privateTempRoot");
|
|
18461
|
+
function createTempDirSync(prefix, options = {}) {
|
|
18462
|
+
const root = privateTempRoot(options);
|
|
18463
|
+
try {
|
|
18464
|
+
return mkdtempSync(join8(root, prefix));
|
|
18465
|
+
} catch (error) {
|
|
18466
|
+
throw explain(error, join8(root, prefix)) ?? error;
|
|
18467
|
+
}
|
|
18468
|
+
}
|
|
18469
|
+
__name(createTempDirSync, "createTempDirSync");
|
|
18470
|
+
async function createTempDir(prefix, options = {}) {
|
|
18471
|
+
const root = privateTempRoot(options);
|
|
18472
|
+
try {
|
|
18473
|
+
return await mkdtemp(join8(root, prefix));
|
|
18474
|
+
} catch (error) {
|
|
18475
|
+
throw explain(error, join8(root, prefix)) ?? error;
|
|
18476
|
+
}
|
|
18477
|
+
}
|
|
18478
|
+
__name(createTempDir, "createTempDir");
|
|
18479
|
+
function tempFilePath(name2, options = {}) {
|
|
18480
|
+
return join8(privateTempRoot(options), name2);
|
|
18481
|
+
}
|
|
18482
|
+
__name(tempFilePath, "tempFilePath");
|
|
18483
|
+
function ensureScratchpadDirectory(directory, options = {}) {
|
|
18484
|
+
const root = privateTempRoot(options);
|
|
18485
|
+
const target = resolve2(directory);
|
|
18486
|
+
const inside2 = relative(root, target);
|
|
18487
|
+
if (inside2 === "" || inside2.startsWith("..") || isAbsolute2(inside2)) {
|
|
18488
|
+
throw refuse(target, "it is not inside the private temporary folder.");
|
|
18489
|
+
}
|
|
18490
|
+
const getuid = "getuid" in options ? options.getuid : process.getuid?.bind(process);
|
|
18491
|
+
const platform2 = options.platform ?? process.platform;
|
|
18492
|
+
let current = root;
|
|
18493
|
+
for (const part2 of inside2.split(sep)) {
|
|
18494
|
+
current = join8(current, part2);
|
|
18495
|
+
try {
|
|
18496
|
+
mkdirSync2(current, { mode: 448 });
|
|
18497
|
+
} catch (error) {
|
|
18498
|
+
if (error.code !== "EEXIST")
|
|
18499
|
+
throw explain(error, current) ?? error;
|
|
18500
|
+
}
|
|
18501
|
+
const entry = lstatSync(current);
|
|
18502
|
+
if (entry.isSymbolicLink())
|
|
18503
|
+
throw refuse(current, "it is a symbolic link.");
|
|
18504
|
+
if (!entry.isDirectory())
|
|
18505
|
+
throw refuse(current, "it is not a directory.");
|
|
18506
|
+
if (platform2 !== "win32" && typeof getuid === "function" && entry.uid !== getuid()) {
|
|
18507
|
+
throw refuse(current, `it belongs to uid ${entry.uid}.`);
|
|
18508
|
+
}
|
|
18509
|
+
}
|
|
18510
|
+
return target;
|
|
18511
|
+
}
|
|
18512
|
+
__name(ensureScratchpadDirectory, "ensureScratchpadDirectory");
|
|
18513
|
+
|
|
18361
18514
|
// ../sdk/dist/utils/conversation.js
|
|
18362
18515
|
function extractFinalResponse(messages) {
|
|
18363
18516
|
for (let i = messages.length - 1; i >= 0; i--) {
|
|
@@ -26132,6 +26285,8 @@ var SESSION_EVENT_TYPE_TABLE = {
|
|
|
26132
26285
|
request_envelope: true,
|
|
26133
26286
|
iteration_completed: true,
|
|
26134
26287
|
compaction_started: true,
|
|
26288
|
+
session_log_degraded: true,
|
|
26289
|
+
session_log_recovered: true,
|
|
26135
26290
|
compaction_shed: true,
|
|
26136
26291
|
compaction_completed: true,
|
|
26137
26292
|
compaction_tool_results_cleared: true,
|
|
@@ -26488,7 +26643,7 @@ function childSessionLog(childSessionId) {
|
|
|
26488
26643
|
__name(childSessionLog, "childSessionLog");
|
|
26489
26644
|
|
|
26490
26645
|
// ../sdk/dist/session/log-hash.js
|
|
26491
|
-
import { createHash as
|
|
26646
|
+
import { createHash as createHash6 } from "node:crypto";
|
|
26492
26647
|
var NEWLINE = 10;
|
|
26493
26648
|
var encoder = new TextEncoder();
|
|
26494
26649
|
var decoder = new TextDecoder("utf-8", { fatal: true });
|
|
@@ -26497,7 +26652,7 @@ function bytesOf(line) {
|
|
|
26497
26652
|
}
|
|
26498
26653
|
__name(bytesOf, "bytesOf");
|
|
26499
26654
|
function recordSha256(line) {
|
|
26500
|
-
return
|
|
26655
|
+
return createHash6("sha256").update(bytesOf(line)).digest("hex");
|
|
26501
26656
|
}
|
|
26502
26657
|
__name(recordSha256, "recordSha256");
|
|
26503
26658
|
function formatSessionLogLine(record3) {
|
|
@@ -26953,39 +27108,39 @@ var SessionTurnState = class {
|
|
|
26953
27108
|
/** Throws {@link TurnRuleError} if `record` may not follow the records applied so far. */
|
|
26954
27109
|
check(record3) {
|
|
26955
27110
|
const active = this.#active;
|
|
26956
|
-
const
|
|
27111
|
+
const refuse5 = /* @__PURE__ */ __name((message) => {
|
|
26957
27112
|
throw new TurnRuleError(message);
|
|
26958
27113
|
}, "refuse");
|
|
26959
27114
|
if (record3.type === "session_started") {
|
|
26960
27115
|
if (this.#started)
|
|
26961
|
-
|
|
27116
|
+
refuse5("session_started is the first record of a log, and only the first");
|
|
26962
27117
|
return;
|
|
26963
27118
|
}
|
|
26964
27119
|
if (!this.#started)
|
|
26965
|
-
|
|
27120
|
+
refuse5("the first record of a log is session_started");
|
|
26966
27121
|
if (record3.type === "turn_started") {
|
|
26967
27122
|
if (active !== void 0) {
|
|
26968
|
-
|
|
27123
|
+
refuse5(`turn ${active.turnId} is still active; a session has one active turn at a time`);
|
|
26969
27124
|
}
|
|
26970
27125
|
return;
|
|
26971
27126
|
}
|
|
26972
27127
|
if (record3.turnId === void 0)
|
|
26973
27128
|
return;
|
|
26974
27129
|
if (active === void 0) {
|
|
26975
|
-
|
|
27130
|
+
refuse5(`the record names turn ${record3.turnId}, and no turn is active`);
|
|
26976
27131
|
}
|
|
26977
27132
|
const current = active;
|
|
26978
27133
|
if (record3.turnId !== current.turnId) {
|
|
26979
|
-
|
|
27134
|
+
refuse5(`the record names turn ${record3.turnId}; the active turn is ${current.turnId}`);
|
|
26980
27135
|
}
|
|
26981
27136
|
if (record3.type === "turn_resuming" && !current.paused) {
|
|
26982
27137
|
return;
|
|
26983
27138
|
}
|
|
26984
27139
|
if (current.paused && record3.type !== "turn_resuming" && !CLOSES_OR_DECIDES.has(record3.type)) {
|
|
26985
|
-
|
|
27140
|
+
refuse5(`turn ${current.turnId} is paused; only turn_resuming, a decision record or a terminal record may follow`);
|
|
26986
27141
|
}
|
|
26987
27142
|
if (record3.type === "turn_paused" && current.paused) {
|
|
26988
|
-
|
|
27143
|
+
refuse5(`turn ${current.turnId} is already paused`);
|
|
26989
27144
|
}
|
|
26990
27145
|
}
|
|
26991
27146
|
apply(record3, options = {}) {
|
|
@@ -27091,8 +27246,8 @@ async function releaseHeldSessionLeases(options = {}) {
|
|
|
27091
27246
|
}, () => {
|
|
27092
27247
|
})));
|
|
27093
27248
|
let timer;
|
|
27094
|
-
const deadline = new Promise((
|
|
27095
|
-
timer = setTimeout(
|
|
27249
|
+
const deadline = new Promise((resolve35) => {
|
|
27250
|
+
timer = setTimeout(resolve35, options.timeoutMs ?? 2e3);
|
|
27096
27251
|
});
|
|
27097
27252
|
await Promise.race([all, deadline]);
|
|
27098
27253
|
clearTimeout(timer);
|
|
@@ -27102,17 +27257,17 @@ __name(releaseHeldSessionLeases, "releaseHeldSessionLeases");
|
|
|
27102
27257
|
|
|
27103
27258
|
// ../sdk/dist/store/session-log/lease.js
|
|
27104
27259
|
import { link as link3, mkdir as mkdir5, readFile as readFile5, readdir as readdir2, stat as stat2, unlink as unlink4, writeFile as writeFile4 } from "node:fs/promises";
|
|
27105
|
-
import { join as
|
|
27260
|
+
import { join as join11 } from "node:path";
|
|
27106
27261
|
|
|
27107
27262
|
// ../sdk/dist/store/session-log/spill.js
|
|
27108
|
-
import { createHash as
|
|
27263
|
+
import { createHash as createHash7, randomBytes as randomBytes5 } from "node:crypto";
|
|
27109
27264
|
import { link as link2, mkdir as mkdir4, open as open4, readFile as readFile4, rename as rename2, unlink as unlink3 } from "node:fs/promises";
|
|
27110
|
-
import { dirname as dirname5, isAbsolute as
|
|
27265
|
+
import { dirname as dirname5, isAbsolute as isAbsolute3, join as join10, normalize, sep as sep3 } from "node:path";
|
|
27111
27266
|
|
|
27112
27267
|
// ../sdk/dist/store/evidence/io.js
|
|
27113
27268
|
import { constants as constants2 } from "node:fs";
|
|
27114
27269
|
import { lstat, open as open3 } from "node:fs/promises";
|
|
27115
|
-
import { join as
|
|
27270
|
+
import { join as join9, parse, resolve as resolve3, sep as sep2 } from "node:path";
|
|
27116
27271
|
var PAGE_BYTES = 8 * 1024 * 1024;
|
|
27117
27272
|
var RECORD_BYTES = 4 * 1024 * 1024;
|
|
27118
27273
|
var EvidencePageLimit = class extends Error {
|
|
@@ -27125,10 +27280,10 @@ function stamp2(stat17) {
|
|
|
27125
27280
|
}
|
|
27126
27281
|
__name(stamp2, "stamp");
|
|
27127
27282
|
async function noLinks(path3) {
|
|
27128
|
-
const absolute =
|
|
27283
|
+
const absolute = resolve3(path3);
|
|
27129
27284
|
let current = parse(absolute).root;
|
|
27130
|
-
for (const part2 of absolute.slice(current.length).split(
|
|
27131
|
-
current =
|
|
27285
|
+
for (const part2 of absolute.slice(current.length).split(sep2).filter(Boolean)) {
|
|
27286
|
+
current = join9(current, part2);
|
|
27132
27287
|
if ((await lstat(current)).isSymbolicLink())
|
|
27133
27288
|
throw new Error("Evidence symlinks are refused.");
|
|
27134
27289
|
}
|
|
@@ -27201,14 +27356,14 @@ var SpillIntegrityError = class extends Error {
|
|
|
27201
27356
|
this.path = path3;
|
|
27202
27357
|
}
|
|
27203
27358
|
};
|
|
27204
|
-
function
|
|
27205
|
-
return
|
|
27359
|
+
function sha256Hex3(value) {
|
|
27360
|
+
return createHash7("sha256").update(value).digest("hex");
|
|
27206
27361
|
}
|
|
27207
|
-
__name(
|
|
27362
|
+
__name(sha256Hex3, "sha256Hex");
|
|
27208
27363
|
function spillFileName(key6) {
|
|
27209
27364
|
if (key6.length === 0)
|
|
27210
27365
|
throw new Error("A spill key is required.");
|
|
27211
|
-
return `${
|
|
27366
|
+
return `${sha256Hex3(key6)}.txt`;
|
|
27212
27367
|
}
|
|
27213
27368
|
__name(spillFileName, "spillFileName");
|
|
27214
27369
|
var counter2 = 0;
|
|
@@ -27239,7 +27394,7 @@ async function renameWithRetry2(from, to) {
|
|
|
27239
27394
|
const code = err.code ?? "";
|
|
27240
27395
|
if (!CONTENDED2.has(code) || attempt >= RENAME_ATTEMPTS2)
|
|
27241
27396
|
throw err;
|
|
27242
|
-
await new Promise((
|
|
27397
|
+
await new Promise((resolve35) => setTimeout(resolve35, attempt));
|
|
27243
27398
|
}
|
|
27244
27399
|
}
|
|
27245
27400
|
}
|
|
@@ -27314,7 +27469,7 @@ function checkActualReadSize(ref, bytes, maxBytes) {
|
|
|
27314
27469
|
__name(checkActualReadSize, "checkActualReadSize");
|
|
27315
27470
|
function checkRelative(path3) {
|
|
27316
27471
|
const normal = normalize(path3);
|
|
27317
|
-
if (
|
|
27472
|
+
if (isAbsolute3(normal) || normal.startsWith("..") || !normal.startsWith(`${SPILL_DIR}${sep3}`)) {
|
|
27318
27473
|
throw new SpillIntegrityError(path3, `A spill path must stay inside ${SPILL_DIR}/: ${path3}`);
|
|
27319
27474
|
}
|
|
27320
27475
|
return normal;
|
|
@@ -27325,7 +27480,7 @@ function verify(ref, text10) {
|
|
|
27325
27480
|
if (bytes !== ref.bytes) {
|
|
27326
27481
|
throw new SpillIntegrityError(ref.path, `Spill ${ref.path} is ${bytes} bytes; its record says ${ref.bytes}. Refusing rather than reading content the log cannot vouch for.`);
|
|
27327
27482
|
}
|
|
27328
|
-
if (
|
|
27483
|
+
if (sha256Hex3(text10) !== ref.sha256) {
|
|
27329
27484
|
throw new SpillIntegrityError(ref.path, `Spill ${ref.path} does not match the SHA-256 its record carries. Refusing rather than reading content the log cannot vouch for.`);
|
|
27330
27485
|
}
|
|
27331
27486
|
return text10;
|
|
@@ -27342,19 +27497,19 @@ var DiskSpillStore = class {
|
|
|
27342
27497
|
this.now = now;
|
|
27343
27498
|
}
|
|
27344
27499
|
async write(key6, content, text10) {
|
|
27345
|
-
const dir =
|
|
27500
|
+
const dir = join10(this.sessionDir, SPILL_DIR);
|
|
27346
27501
|
await mkdir4(dir, { recursive: true });
|
|
27347
27502
|
const name2 = spillFileName(key6);
|
|
27348
27503
|
const ref = {
|
|
27349
27504
|
path: `${SPILL_DIR}/${name2}`,
|
|
27350
27505
|
manifest: `${SPILL_DIR}/${name2}.manifest.json`,
|
|
27351
27506
|
bytes: Buffer.byteLength(text10, "utf8"),
|
|
27352
|
-
sha256:
|
|
27507
|
+
sha256: sha256Hex3(text10)
|
|
27353
27508
|
};
|
|
27354
|
-
const body =
|
|
27509
|
+
const body = join10(dir, name2);
|
|
27355
27510
|
if (!await durableCreateFile(body, text10)) {
|
|
27356
27511
|
const existing = await readFile4(body, "utf8");
|
|
27357
|
-
if (
|
|
27512
|
+
if (sha256Hex3(existing) !== ref.sha256) {
|
|
27358
27513
|
throw new SpillIntegrityError(ref.path, `Spill ${ref.path} already exists with different content. Refusing to replace it: an earlier record's hash vouches for the bytes that are there.`);
|
|
27359
27514
|
}
|
|
27360
27515
|
}
|
|
@@ -27367,14 +27522,14 @@ var DiskSpillStore = class {
|
|
|
27367
27522
|
sha256: ref.sha256,
|
|
27368
27523
|
createdAt: new Date(this.now()).toISOString()
|
|
27369
27524
|
};
|
|
27370
|
-
await durableCreateFile(
|
|
27525
|
+
await durableCreateFile(join10(dir, `${name2}.manifest.json`), `${JSON.stringify(manifest)}
|
|
27371
27526
|
`);
|
|
27372
27527
|
await syncDirectory2(dir);
|
|
27373
27528
|
return ref;
|
|
27374
27529
|
}
|
|
27375
27530
|
async read(ref, options) {
|
|
27376
27531
|
const maxBytes = checkedReadLimit(ref, options);
|
|
27377
|
-
const path3 =
|
|
27532
|
+
const path3 = join10(this.sessionDir, checkRelative(ref.path));
|
|
27378
27533
|
let text10;
|
|
27379
27534
|
try {
|
|
27380
27535
|
options?.signal?.throwIfAborted();
|
|
@@ -27424,10 +27579,10 @@ var InMemorySpillStore = class {
|
|
|
27424
27579
|
path: `${SPILL_DIR}/${name2}`,
|
|
27425
27580
|
manifest: `${SPILL_DIR}/${name2}.manifest.json`,
|
|
27426
27581
|
bytes: Buffer.byteLength(text10, "utf8"),
|
|
27427
|
-
sha256:
|
|
27582
|
+
sha256: sha256Hex3(text10)
|
|
27428
27583
|
};
|
|
27429
27584
|
const existing = this.#files.get(ref.path);
|
|
27430
|
-
if (existing !== void 0 &&
|
|
27585
|
+
if (existing !== void 0 && sha256Hex3(existing) !== ref.sha256) {
|
|
27431
27586
|
throw new SpillIntegrityError(ref.path, `Spill ${ref.path} already exists with different content. Refusing to replace it: an earlier record's hash vouches for the bytes that are there.`);
|
|
27432
27587
|
}
|
|
27433
27588
|
this.#files.set(ref.path, text10);
|
|
@@ -27435,7 +27590,7 @@ var InMemorySpillStore = class {
|
|
|
27435
27590
|
}
|
|
27436
27591
|
async read(ref, options) {
|
|
27437
27592
|
const maxBytes = checkedReadLimit(ref, options);
|
|
27438
|
-
const text10 = this.#files.get(checkRelative(ref.path).split(
|
|
27593
|
+
const text10 = this.#files.get(checkRelative(ref.path).split(sep3).join("/"));
|
|
27439
27594
|
if (text10 === void 0) {
|
|
27440
27595
|
throw new SpillIntegrityError(ref.path, `Spill ${ref.path} does not exist.`);
|
|
27441
27596
|
}
|
|
@@ -27524,7 +27679,7 @@ var DiskSessionLeaseStore = class {
|
|
|
27524
27679
|
if (top === void 0)
|
|
27525
27680
|
return null;
|
|
27526
27681
|
try {
|
|
27527
|
-
const body = JSON.parse(await readFile5(
|
|
27682
|
+
const body = JSON.parse(await readFile5(join11(this.sessionDir, top.name), "utf8"));
|
|
27528
27683
|
if (typeof body.holder === "string" && Number.isFinite(body.expiresAt)) {
|
|
27529
27684
|
return { holder: body.holder, fence: top.fence, expiresAt: body.expiresAt };
|
|
27530
27685
|
}
|
|
@@ -27534,10 +27689,10 @@ var DiskSessionLeaseStore = class {
|
|
|
27534
27689
|
}
|
|
27535
27690
|
/** Write `body` and make it visible at `fence`, whole or not at all. Throws `EEXIST` on a lost race. */
|
|
27536
27691
|
async #publish(fence, body) {
|
|
27537
|
-
const temporary =
|
|
27692
|
+
const temporary = join11(this.sessionDir, tempName(fence));
|
|
27538
27693
|
await writeFile4(temporary, JSON.stringify(body), { flag: "wx" });
|
|
27539
27694
|
try {
|
|
27540
|
-
await link3(temporary,
|
|
27695
|
+
await link3(temporary, join11(this.sessionDir, `lease.${fence}.json`));
|
|
27541
27696
|
} finally {
|
|
27542
27697
|
await unlink4(temporary).catch(() => void 0);
|
|
27543
27698
|
}
|
|
@@ -27550,7 +27705,7 @@ var DiskSessionLeaseStore = class {
|
|
|
27550
27705
|
fence: lease.fence,
|
|
27551
27706
|
expiresAt: new Date(lease.expiresAt).toISOString()
|
|
27552
27707
|
};
|
|
27553
|
-
await durableReplaceFile(
|
|
27708
|
+
await durableReplaceFile(join11(this.sessionDir, "lease.json"), `${JSON.stringify(view)}
|
|
27554
27709
|
`);
|
|
27555
27710
|
}
|
|
27556
27711
|
async claim(options, context2 = {}) {
|
|
@@ -27563,7 +27718,7 @@ var DiskSessionLeaseStore = class {
|
|
|
27563
27718
|
return null;
|
|
27564
27719
|
const body = { holder: options.holder, expiresAt: now + options.ttlMs };
|
|
27565
27720
|
if (decision2.kind === "renew") {
|
|
27566
|
-
await durableReplaceFile(
|
|
27721
|
+
await durableReplaceFile(join11(this.sessionDir, `lease.${decision2.fence}.json`), JSON.stringify(body));
|
|
27567
27722
|
if (await this.fence() !== decision2.fence)
|
|
27568
27723
|
return null;
|
|
27569
27724
|
const renewed = { holder: options.holder, fence: decision2.fence, expiresAt: body.expiresAt };
|
|
@@ -27611,13 +27766,13 @@ var DiskSessionLeaseStore = class {
|
|
|
27611
27766
|
const match2 = FENCE_NAME.exec(name2);
|
|
27612
27767
|
if (match2) {
|
|
27613
27768
|
if (Number(match2[1]) < max - KEEP_BELOW_MAX) {
|
|
27614
|
-
await unlink4(
|
|
27769
|
+
await unlink4(join11(this.sessionDir, name2)).catch(() => void 0);
|
|
27615
27770
|
}
|
|
27616
27771
|
continue;
|
|
27617
27772
|
}
|
|
27618
27773
|
if (!TEMP_NAME.test(name2))
|
|
27619
27774
|
continue;
|
|
27620
|
-
const path3 =
|
|
27775
|
+
const path3 = join11(this.sessionDir, name2);
|
|
27621
27776
|
try {
|
|
27622
27777
|
if (wallClock - (await stat2(path3)).mtimeMs < TEMP_TTL_MS)
|
|
27623
27778
|
continue;
|
|
@@ -27718,6 +27873,20 @@ async function restoreSpilledRequestInputs(request, read) {
|
|
|
27718
27873
|
__name(restoreSpilledRequestInputs, "restoreSpilledRequestInputs");
|
|
27719
27874
|
|
|
27720
27875
|
// ../sdk/dist/store/session-log/core.js
|
|
27876
|
+
function sessionLogDegradedCause(error) {
|
|
27877
|
+
switch (error?.code) {
|
|
27878
|
+
case "ENOSPC":
|
|
27879
|
+
return "disk_full";
|
|
27880
|
+
case "EDQUOT":
|
|
27881
|
+
return "quota_exceeded";
|
|
27882
|
+
case "EROFS":
|
|
27883
|
+
return "read_only";
|
|
27884
|
+
default:
|
|
27885
|
+
return void 0;
|
|
27886
|
+
}
|
|
27887
|
+
}
|
|
27888
|
+
__name(sessionLogDegradedCause, "sessionLogDegradedCause");
|
|
27889
|
+
var DEFAULT_DEGRADED_BUFFER_BYTES = 8 * 1024 * 1024;
|
|
27721
27890
|
var InvalidSessionRecordError = class extends Error {
|
|
27722
27891
|
static {
|
|
27723
27892
|
__name(this, "InvalidSessionRecordError");
|
|
@@ -27744,6 +27913,7 @@ var BOUNDARY_TYPES = /* @__PURE__ */ new Set([
|
|
|
27744
27913
|
"log_repaired"
|
|
27745
27914
|
]);
|
|
27746
27915
|
var PREVIEW_CHARS = 2e3;
|
|
27916
|
+
var NOT_SAVED_NOTE = "[\u2026 the rest of this output could not be saved: the disk is full]";
|
|
27747
27917
|
var COMPACTION_SPILL_ABOVE_BYTES = 256 * 1024;
|
|
27748
27918
|
var ZERO_USAGE = {
|
|
27749
27919
|
promptTokens: 0,
|
|
@@ -27787,6 +27957,17 @@ var SessionLogCore = class {
|
|
|
27787
27957
|
/** Bytes of the log this instance has verified and applied. */
|
|
27788
27958
|
#synced = 0;
|
|
27789
27959
|
#torn = 0;
|
|
27960
|
+
#degradedBufferBytes;
|
|
27961
|
+
/** Records accepted into the chain that the medium has not taken yet, oldest first. */
|
|
27962
|
+
#pending = [];
|
|
27963
|
+
#pendingBytes = 0;
|
|
27964
|
+
/** Bytes the medium holds while records are pending. */
|
|
27965
|
+
#diskBytes = 0;
|
|
27966
|
+
#degradedCause;
|
|
27967
|
+
#droppedRecords = 0;
|
|
27968
|
+
#droppedNoticeSent = false;
|
|
27969
|
+
#flushedWhileDegraded = 0;
|
|
27970
|
+
#healthListeners = /* @__PURE__ */ new Set();
|
|
27790
27971
|
constructor(options) {
|
|
27791
27972
|
this.sessionId = options.sessionId;
|
|
27792
27973
|
this.#medium = options.medium;
|
|
@@ -27800,10 +27981,31 @@ var SessionLogCore = class {
|
|
|
27800
27981
|
this.#spillAbove = Math.min(options.spillAboveBytes ?? SESSION_RECORD_MAX_BYTES, SESSION_RECORD_MAX_BYTES);
|
|
27801
27982
|
this.#compactionSpillAbove = Math.min(options.compactionSpillAboveBytes ?? COMPACTION_SPILL_ABOVE_BYTES, this.#spillAbove);
|
|
27802
27983
|
this.#sync = options.sync ?? "boundaries";
|
|
27984
|
+
this.#degradedBufferBytes = Math.max(0, options.degradedBufferBytes ?? DEFAULT_DEGRADED_BUFFER_BYTES);
|
|
27985
|
+
}
|
|
27986
|
+
onWriteHealth(listener) {
|
|
27987
|
+
this.#healthListeners.add(listener);
|
|
27988
|
+
return () => {
|
|
27989
|
+
this.#healthListeners.delete(listener);
|
|
27990
|
+
};
|
|
27991
|
+
}
|
|
27992
|
+
#notify(change) {
|
|
27993
|
+
for (const listener of this.#healthListeners) {
|
|
27994
|
+
try {
|
|
27995
|
+
listener(change);
|
|
27996
|
+
} catch {
|
|
27997
|
+
}
|
|
27998
|
+
}
|
|
27999
|
+
}
|
|
28000
|
+
/** True while records wait in memory because the volume refuses writes. */
|
|
28001
|
+
get degraded() {
|
|
28002
|
+
return this.#degradedCause !== void 0;
|
|
27803
28003
|
}
|
|
27804
28004
|
// ── state ──
|
|
27805
28005
|
/** Catch up with the medium: verify and apply whatever was appended since the last sync. */
|
|
27806
28006
|
async #catchUp() {
|
|
28007
|
+
if (this.#pending.length > 0)
|
|
28008
|
+
return;
|
|
27807
28009
|
const size = await this.#medium.size();
|
|
27808
28010
|
if (size === this.#synced + this.#torn && size >= this.#synced)
|
|
27809
28011
|
return;
|
|
@@ -27827,6 +28029,8 @@ var SessionLogCore = class {
|
|
|
27827
28029
|
this.#turns = new SessionTurnState();
|
|
27828
28030
|
this.#synced = 0;
|
|
27829
28031
|
this.#torn = 0;
|
|
28032
|
+
this.#pending = [];
|
|
28033
|
+
this.#pendingBytes = 0;
|
|
27830
28034
|
}
|
|
27831
28035
|
async #requireCurrent(lease) {
|
|
27832
28036
|
const fence = await this.#leases.fence();
|
|
@@ -27885,6 +28089,8 @@ var SessionLogCore = class {
|
|
|
27885
28089
|
*/
|
|
27886
28090
|
release(lease) {
|
|
27887
28091
|
return this.#mutex.run(async () => {
|
|
28092
|
+
if (this.#pending.length > 0)
|
|
28093
|
+
await this.#flushPending().catch(() => void 0);
|
|
27888
28094
|
if (this.#held?.fence === lease.fence) {
|
|
27889
28095
|
this.#held = void 0;
|
|
27890
28096
|
untrackHeldSessionLease(this.#holding);
|
|
@@ -28027,12 +28233,117 @@ var SessionLogCore = class {
|
|
|
28027
28233
|
}
|
|
28028
28234
|
const bytes = Buffer.from(line, "utf8");
|
|
28029
28235
|
const sync = this.#sync === "all" || this.#sync === "boundaries" && BOUNDARY_TYPES.has(type);
|
|
28030
|
-
await this.#
|
|
28236
|
+
await this.#persist(bytes, sync);
|
|
28031
28237
|
const entry = this.#chain.accept(bytes, this.#synced);
|
|
28032
28238
|
this.#turns.apply(entry.record);
|
|
28033
28239
|
this.#synced += bytes.byteLength;
|
|
28034
28240
|
return entry;
|
|
28035
28241
|
}
|
|
28242
|
+
/**
|
|
28243
|
+
* Hand a record's bytes to the medium. A volume that refuses writes (full,
|
|
28244
|
+
* over quota, read-only) does not fail the record: it waits in a bounded
|
|
28245
|
+
* buffer and goes out, in order, with the next record that can be written.
|
|
28246
|
+
* Any other error is thrown as before. Caller holds the mutex.
|
|
28247
|
+
*/
|
|
28248
|
+
async #persist(bytes, sync) {
|
|
28249
|
+
if (this.#pending.length === 0) {
|
|
28250
|
+
try {
|
|
28251
|
+
await this.#medium.append(bytes, this.#synced, sync);
|
|
28252
|
+
return;
|
|
28253
|
+
} catch (error) {
|
|
28254
|
+
const cause = sessionLogDegradedCause(error);
|
|
28255
|
+
if (cause === void 0)
|
|
28256
|
+
throw error;
|
|
28257
|
+
this.#diskBytes = this.#synced;
|
|
28258
|
+
this.#degradedCause = cause;
|
|
28259
|
+
this.#bufferRecord(bytes, sync);
|
|
28260
|
+
this.#notify({
|
|
28261
|
+
state: "degraded",
|
|
28262
|
+
cause,
|
|
28263
|
+
bufferedRecords: this.#pending.length,
|
|
28264
|
+
bufferedBytes: this.#pendingBytes
|
|
28265
|
+
});
|
|
28266
|
+
return;
|
|
28267
|
+
}
|
|
28268
|
+
}
|
|
28269
|
+
const queued = this.#bufferRecord(bytes, sync);
|
|
28270
|
+
try {
|
|
28271
|
+
await this.#flushPending();
|
|
28272
|
+
} catch (error) {
|
|
28273
|
+
if (sessionLogDegradedCause(error) === void 0) {
|
|
28274
|
+
const at = this.#pending.indexOf(queued);
|
|
28275
|
+
if (at !== -1) {
|
|
28276
|
+
this.#pending.splice(at, 1);
|
|
28277
|
+
this.#pendingBytes -= queued.bytes.byteLength;
|
|
28278
|
+
}
|
|
28279
|
+
throw error;
|
|
28280
|
+
}
|
|
28281
|
+
}
|
|
28282
|
+
}
|
|
28283
|
+
#bufferRecord(bytes, sync) {
|
|
28284
|
+
const queued = { bytes, sync };
|
|
28285
|
+
this.#pending.push(queued);
|
|
28286
|
+
this.#pendingBytes += bytes.byteLength;
|
|
28287
|
+
let dropped = false;
|
|
28288
|
+
while (this.#pendingBytes > this.#degradedBufferBytes && this.#pending.length > 1) {
|
|
28289
|
+
const oldest = this.#pending.shift();
|
|
28290
|
+
if (oldest === void 0)
|
|
28291
|
+
break;
|
|
28292
|
+
this.#pendingBytes -= oldest.bytes.byteLength;
|
|
28293
|
+
this.#droppedRecords += 1;
|
|
28294
|
+
dropped = true;
|
|
28295
|
+
}
|
|
28296
|
+
if (dropped && !this.#droppedNoticeSent && this.#degradedCause !== void 0) {
|
|
28297
|
+
this.#droppedNoticeSent = true;
|
|
28298
|
+
this.#notify({
|
|
28299
|
+
state: "degraded",
|
|
28300
|
+
cause: this.#degradedCause,
|
|
28301
|
+
bufferedRecords: this.#pending.length,
|
|
28302
|
+
bufferedBytes: this.#pendingBytes,
|
|
28303
|
+
dropping: true
|
|
28304
|
+
});
|
|
28305
|
+
}
|
|
28306
|
+
return queued;
|
|
28307
|
+
}
|
|
28308
|
+
/** Write the buffer in order. Throws the error that stopped it; clears the degraded mark when it empties. */
|
|
28309
|
+
async #flushPending() {
|
|
28310
|
+
const size = await this.#medium.size();
|
|
28311
|
+
if (size > this.#diskBytes)
|
|
28312
|
+
await this.#medium.truncate(this.#diskBytes, size);
|
|
28313
|
+
while (this.#pending.length > 0) {
|
|
28314
|
+
const next2 = this.#pending[0];
|
|
28315
|
+
if (next2 === void 0)
|
|
28316
|
+
break;
|
|
28317
|
+
await this.#medium.append(next2.bytes, this.#diskBytes, next2.sync);
|
|
28318
|
+
this.#diskBytes += next2.bytes.byteLength;
|
|
28319
|
+
this.#pendingBytes -= next2.bytes.byteLength;
|
|
28320
|
+
this.#pending.shift();
|
|
28321
|
+
this.#flushedWhileDegraded += 1;
|
|
28322
|
+
}
|
|
28323
|
+
const flushed = this.#flushedWhileDegraded;
|
|
28324
|
+
this.#flushedWhileDegraded = 0;
|
|
28325
|
+
const dropped = this.#droppedRecords;
|
|
28326
|
+
this.#degradedCause = void 0;
|
|
28327
|
+
this.#droppedRecords = 0;
|
|
28328
|
+
this.#droppedNoticeSent = false;
|
|
28329
|
+
this.#pendingBytes = 0;
|
|
28330
|
+
this.#notify({ state: "recovered", flushedRecords: flushed, droppedRecords: dropped });
|
|
28331
|
+
}
|
|
28332
|
+
/**
|
|
28333
|
+
* Write a message body beside the log. When the volume refuses it the body
|
|
28334
|
+
* is given up (`undefined`) rather than the record,; the record's own write
|
|
28335
|
+
* then meets the same refusal and degrades the log.
|
|
28336
|
+
*/
|
|
28337
|
+
async #spillOrLose(key6, content, text10) {
|
|
28338
|
+
try {
|
|
28339
|
+
return await this.#spills.write(key6, content, text10);
|
|
28340
|
+
} catch (error) {
|
|
28341
|
+
const cause = sessionLogDegradedCause(error);
|
|
28342
|
+
if (cause === void 0)
|
|
28343
|
+
throw error;
|
|
28344
|
+
return void 0;
|
|
28345
|
+
}
|
|
28346
|
+
}
|
|
28036
28347
|
async #spillIfLarge(original) {
|
|
28037
28348
|
const candidate = this.#structuredResultSpilling ? await this.#spillStructuredResults(original) : original;
|
|
28038
28349
|
const type = candidate.type;
|
|
@@ -28049,7 +28360,14 @@ var SessionLogCore = class {
|
|
|
28049
28360
|
if (type === "turn_completed") {
|
|
28050
28361
|
if (typeof candidate.result !== "string")
|
|
28051
28362
|
return candidate;
|
|
28052
|
-
const ref2 = await this.#
|
|
28363
|
+
const ref2 = await this.#spillOrLose(`record:${String(candidate.id)}`, "message", candidate.result);
|
|
28364
|
+
if (ref2 === void 0) {
|
|
28365
|
+
return {
|
|
28366
|
+
...candidate,
|
|
28367
|
+
result: `${candidate.result.slice(0, PREVIEW_CHARS)}
|
|
28368
|
+
${NOT_SAVED_NOTE}`
|
|
28369
|
+
};
|
|
28370
|
+
}
|
|
28053
28371
|
const preview3 = `${candidate.result.slice(0, PREVIEW_CHARS)}
|
|
28054
28372
|
[\u2026 ${ref2.bytes} bytes spilled to ${ref2.path}]`;
|
|
28055
28373
|
return { ...candidate, result: preview3, resultSpill: ref2 };
|
|
@@ -28062,8 +28380,19 @@ var SessionLogCore = class {
|
|
|
28062
28380
|
}
|
|
28063
28381
|
const content = candidate.content;
|
|
28064
28382
|
const key6 = content.role === "tool" && typeof content.toolCallId === "string" ? content.toolCallId : type === "message_replaced" ? `record:${String(candidate.id)}` : `message:${String(candidate.messageId)}`;
|
|
28065
|
-
const ref = await this.#
|
|
28383
|
+
const ref = await this.#spillOrLose(key6, "message", JSON.stringify(content));
|
|
28066
28384
|
const text10 = typeof content.content === "string" ? content.content : JSON.stringify(content.content);
|
|
28385
|
+
if (ref === void 0) {
|
|
28386
|
+
return {
|
|
28387
|
+
...candidate,
|
|
28388
|
+
content: {
|
|
28389
|
+
role: content.role,
|
|
28390
|
+
content: `${text10.slice(0, PREVIEW_CHARS)}
|
|
28391
|
+
${NOT_SAVED_NOTE}`,
|
|
28392
|
+
...typeof content.toolCallId === "string" ? { toolCallId: content.toolCallId } : {}
|
|
28393
|
+
}
|
|
28394
|
+
};
|
|
28395
|
+
}
|
|
28067
28396
|
const preview2 = {
|
|
28068
28397
|
role: content.role,
|
|
28069
28398
|
content: `${text10.slice(0, PREVIEW_CHARS)}
|
|
@@ -28276,11 +28605,9 @@ import { mkdir as mkdir7, open as open6, stat as stat3 } from "node:fs/promises"
|
|
|
28276
28605
|
import { dirname as dirname7 } from "node:path";
|
|
28277
28606
|
|
|
28278
28607
|
// ../sdk/dist/session/paths.js
|
|
28279
|
-
import { createHash as
|
|
28280
|
-
import { lstatSync, mkdirSync as mkdirSync2 } from "node:fs";
|
|
28608
|
+
import { createHash as createHash8 } from "node:crypto";
|
|
28281
28609
|
import { link as link4, mkdir as mkdir6, open as open5, readFile as readFile6, realpath, unlink as unlink5 } from "node:fs/promises";
|
|
28282
|
-
import {
|
|
28283
|
-
import { basename as basename4, dirname as dirname6, join as join11 } from "node:path";
|
|
28610
|
+
import { basename as basename4, dirname as dirname6, join as join12 } from "node:path";
|
|
28284
28611
|
function sessionLocatorFromLogFile(file, sessionId5) {
|
|
28285
28612
|
if (basename4(file) !== `${sessionId5}.jsonl`)
|
|
28286
28613
|
return void 0;
|
|
@@ -28305,10 +28632,10 @@ var SessionPathError = class extends Error {
|
|
|
28305
28632
|
var SLUG = /^[A-Za-z0-9-]+$/;
|
|
28306
28633
|
var NAME = /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/;
|
|
28307
28634
|
var MAX_SLUG = 200;
|
|
28308
|
-
function
|
|
28309
|
-
return
|
|
28635
|
+
function sha256Hex4(value) {
|
|
28636
|
+
return createHash8("sha256").update(value).digest("hex");
|
|
28310
28637
|
}
|
|
28311
|
-
__name(
|
|
28638
|
+
__name(sha256Hex4, "sha256Hex");
|
|
28312
28639
|
function checkId(value, kind) {
|
|
28313
28640
|
if (!isEntityId(value, kind)) {
|
|
28314
28641
|
throw new SessionPathError(`Invalid ${kind} id for a path: ${JSON.stringify(value)}`);
|
|
@@ -28327,11 +28654,11 @@ function slugForCwd(cwd) {
|
|
|
28327
28654
|
const slug = cwd.replace(/[^A-Za-z0-9]/g, "-");
|
|
28328
28655
|
if (slug.length <= MAX_SLUG)
|
|
28329
28656
|
return slug;
|
|
28330
|
-
return `${slug.slice(0, MAX_SLUG - 9)}-${
|
|
28657
|
+
return `${slug.slice(0, MAX_SLUG - 9)}-${sha256Hex4(cwd).slice(0, 8)}`;
|
|
28331
28658
|
}
|
|
28332
28659
|
__name(slugForCwd, "slugForCwd");
|
|
28333
28660
|
function hashedSlugForCwd(cwd) {
|
|
28334
|
-
return `${slugForCwd(cwd)}-${
|
|
28661
|
+
return `${slugForCwd(cwd)}-${sha256Hex4(cwd).slice(0, 8)}`;
|
|
28335
28662
|
}
|
|
28336
28663
|
__name(hashedSlugForCwd, "hashedSlugForCwd");
|
|
28337
28664
|
var ProjectDocumentError = class extends Error {
|
|
@@ -28367,9 +28694,9 @@ async function ensureProject(options) {
|
|
|
28367
28694
|
const now = options.now ?? (() => /* @__PURE__ */ new Date());
|
|
28368
28695
|
const candidates = [slugForCwd(cwd), hashedSlugForCwd(cwd)];
|
|
28369
28696
|
for (const slug of candidates) {
|
|
28370
|
-
const projectDir =
|
|
28697
|
+
const projectDir = join12(options.home, "projects", slug);
|
|
28371
28698
|
await mkdir6(projectDir, { recursive: true });
|
|
28372
|
-
const file =
|
|
28699
|
+
const file = join12(projectDir, "project.json");
|
|
28373
28700
|
let existing = await readProjectDocument(file);
|
|
28374
28701
|
if (existing === null) {
|
|
28375
28702
|
const document = {
|
|
@@ -28380,7 +28707,7 @@ async function ensureProject(options) {
|
|
|
28380
28707
|
slug,
|
|
28381
28708
|
createdAt: now().toISOString()
|
|
28382
28709
|
};
|
|
28383
|
-
const temporary =
|
|
28710
|
+
const temporary = join12(projectDir, `.project.json.${process.pid}.${uuidv7()}.tmp`);
|
|
28384
28711
|
const handle = await open5(temporary, "wx", 384);
|
|
28385
28712
|
try {
|
|
28386
28713
|
await handle.writeFile(`${JSON.stringify(document)}
|
|
@@ -28414,42 +28741,14 @@ async function ensureProject(options) {
|
|
|
28414
28741
|
}
|
|
28415
28742
|
__name(ensureProject, "ensureProject");
|
|
28416
28743
|
function tempRoot(options = {}) {
|
|
28417
|
-
const platform2 = options.platform ?? process.platform;
|
|
28418
|
-
const getuid = "getuid" in options ? options.getuid : process.getuid?.bind(process);
|
|
28419
|
-
let user = "user";
|
|
28420
|
-
if (typeof getuid === "function") {
|
|
28421
|
-
user = String(getuid());
|
|
28422
|
-
} else {
|
|
28423
|
-
try {
|
|
28424
|
-
const name2 = (options.username ?? (() => userInfo().username))();
|
|
28425
|
-
if (name2.length > 0)
|
|
28426
|
-
user = sha256Hex3(name2).slice(0, 12);
|
|
28427
|
-
} catch {
|
|
28428
|
-
}
|
|
28429
|
-
}
|
|
28430
|
-
const root = join11(options.tmpdir ?? tmpdir(), `namzu-${user}`);
|
|
28431
28744
|
try {
|
|
28432
|
-
|
|
28745
|
+
return privateTempRoot(options);
|
|
28433
28746
|
} catch (error) {
|
|
28434
|
-
if (error.
|
|
28435
|
-
throw error;
|
|
28436
|
-
}
|
|
28437
|
-
const entry = lstatSync(root);
|
|
28438
|
-
if (entry.isSymbolicLink()) {
|
|
28439
|
-
throw new SessionPathError(`Refusing temporary root ${root}: it is a symbolic link.`);
|
|
28440
|
-
}
|
|
28441
|
-
if (!entry.isDirectory()) {
|
|
28442
|
-
throw new SessionPathError(`Refusing temporary root ${root}: it is not a directory.`);
|
|
28443
|
-
}
|
|
28444
|
-
if (platform2 !== "win32" && typeof getuid === "function") {
|
|
28445
|
-
if (entry.uid !== getuid()) {
|
|
28446
|
-
throw new SessionPathError(`Refusing temporary root ${root}: it belongs to uid ${entry.uid}.`);
|
|
28447
|
-
}
|
|
28448
|
-
if ((entry.mode & 63) !== 0) {
|
|
28449
|
-
throw new SessionPathError(`Refusing temporary root ${root}: mode ${(entry.mode & 511).toString(8)} lets other users in; it must be 700.`);
|
|
28747
|
+
if (error instanceof TempDirectoryError && error.reason === "refused") {
|
|
28748
|
+
throw new SessionPathError(error.message);
|
|
28450
28749
|
}
|
|
28750
|
+
throw error;
|
|
28451
28751
|
}
|
|
28452
|
-
return root;
|
|
28453
28752
|
}
|
|
28454
28753
|
__name(tempRoot, "tempRoot");
|
|
28455
28754
|
var SessionPaths = class {
|
|
@@ -28469,40 +28768,40 @@ var SessionPaths = class {
|
|
|
28469
28768
|
}
|
|
28470
28769
|
/** `$NAMZU_HOME/index.sqlite`. */
|
|
28471
28770
|
indexFile() {
|
|
28472
|
-
return
|
|
28771
|
+
return join12(this.home, "index.sqlite");
|
|
28473
28772
|
}
|
|
28474
28773
|
projectDir() {
|
|
28475
|
-
return
|
|
28774
|
+
return join12(this.home, "projects", this.slug);
|
|
28476
28775
|
}
|
|
28477
28776
|
projectFile() {
|
|
28478
|
-
return
|
|
28777
|
+
return join12(this.projectDir(), "project.json");
|
|
28479
28778
|
}
|
|
28480
28779
|
memoryDir() {
|
|
28481
|
-
return
|
|
28780
|
+
return join12(this.projectDir(), "memory");
|
|
28482
28781
|
}
|
|
28483
28782
|
residentDir(agentKey) {
|
|
28484
|
-
return
|
|
28783
|
+
return join12(this.projectDir(), "residents", checkName(agentKey, "resident agent key"));
|
|
28485
28784
|
}
|
|
28486
28785
|
/** The `GitWorktreeManager` default root, or one labelled worktree inside it. */
|
|
28487
28786
|
worktrees(label6) {
|
|
28488
|
-
const root =
|
|
28489
|
-
return label6 === void 0 ? root :
|
|
28787
|
+
const root = join12(this.projectDir(), "worktrees");
|
|
28788
|
+
return label6 === void 0 ? root : join12(root, checkName(label6, "worktree label"));
|
|
28490
28789
|
}
|
|
28491
28790
|
/** The directory that holds `<session-id>.jsonl`: the project for a root session, `subagents/` of its parent otherwise. */
|
|
28492
28791
|
#logParent(locator) {
|
|
28493
28792
|
let parent = this.projectDir();
|
|
28494
28793
|
for (const ancestor of locator.ancestors ?? []) {
|
|
28495
|
-
parent =
|
|
28794
|
+
parent = join12(parent, checkId(ancestor, "session"), "subagents");
|
|
28496
28795
|
}
|
|
28497
28796
|
return parent;
|
|
28498
28797
|
}
|
|
28499
28798
|
/** `<session-id>.jsonl`, or `…/subagents/<child-id>.jsonl` for a child session. */
|
|
28500
28799
|
sessionLog(locator) {
|
|
28501
|
-
return
|
|
28800
|
+
return join12(this.#logParent(locator), `${checkId(locator.sessionId, "session")}.jsonl`);
|
|
28502
28801
|
}
|
|
28503
28802
|
/** The session's own directory, beside its log. */
|
|
28504
28803
|
sessionDir(locator) {
|
|
28505
|
-
return
|
|
28804
|
+
return join12(this.#logParent(locator), checkId(locator.sessionId, "session"));
|
|
28506
28805
|
}
|
|
28507
28806
|
#child(parent, childId) {
|
|
28508
28807
|
return { sessionId: childId, ancestors: [...parent.ancestors ?? [], parent.sessionId] };
|
|
@@ -28512,67 +28811,74 @@ var SessionPaths = class {
|
|
|
28512
28811
|
}
|
|
28513
28812
|
/** `<parent-dir>/subagents/<child-id>.meta.json`. */
|
|
28514
28813
|
subagentMeta(parent, childId) {
|
|
28515
|
-
return
|
|
28814
|
+
return join12(this.sessionDir(parent), "subagents", `${checkId(childId, "session")}.meta.json`);
|
|
28516
28815
|
}
|
|
28517
28816
|
toolResults(locator) {
|
|
28518
|
-
return
|
|
28817
|
+
return join12(this.sessionDir(locator), "tool-results");
|
|
28519
28818
|
}
|
|
28520
28819
|
/** A spilled tool result, named by the SHA-256 of its provider tool-use id; the manifest is `<file>.manifest.json`. */
|
|
28521
28820
|
toolResultFile(locator, toolUseId3) {
|
|
28522
28821
|
if (toolUseId3.length === 0)
|
|
28523
28822
|
throw new SessionPathError("A tool-use id is required.");
|
|
28524
|
-
return
|
|
28823
|
+
return join12(this.toolResults(locator), `${sha256Hex4(toolUseId3)}.txt`);
|
|
28525
28824
|
}
|
|
28526
28825
|
checkpoints(locator) {
|
|
28527
|
-
return
|
|
28826
|
+
return join12(this.sessionDir(locator), "checkpoints");
|
|
28528
28827
|
}
|
|
28529
28828
|
checkpointFile(locator, checkpointId4) {
|
|
28530
|
-
return
|
|
28829
|
+
return join12(this.checkpoints(locator), `${checkId(checkpointId4, "checkpoint")}.json`);
|
|
28531
28830
|
}
|
|
28532
28831
|
/** Token ledgers; written for root sessions only. */
|
|
28533
28832
|
budgets(locator) {
|
|
28534
|
-
return
|
|
28833
|
+
return join12(this.sessionDir(locator), "budgets");
|
|
28535
28834
|
}
|
|
28536
28835
|
budgetFile(locator, rootTurnId) {
|
|
28537
|
-
return
|
|
28836
|
+
return join12(this.budgets(locator), `${checkId(rootTurnId, "turn")}.json`);
|
|
28538
28837
|
}
|
|
28539
28838
|
tasks(locator) {
|
|
28540
|
-
return
|
|
28839
|
+
return join12(this.sessionDir(locator), "tasks");
|
|
28541
28840
|
}
|
|
28542
28841
|
/** The session's plan directory; a host that has a plan mode keeps its one plan file here. */
|
|
28543
28842
|
plans(locator) {
|
|
28544
|
-
return
|
|
28843
|
+
return join12(this.sessionDir(locator), "plans");
|
|
28545
28844
|
}
|
|
28546
28845
|
/** The one file a session's plan mode may write: `<session-id>/plans/plan.md`. */
|
|
28547
28846
|
planFile(locator) {
|
|
28548
|
-
return
|
|
28847
|
+
return join12(this.plans(locator), "plan.md");
|
|
28549
28848
|
}
|
|
28550
28849
|
taskFile(locator, taskId) {
|
|
28551
|
-
return
|
|
28850
|
+
return join12(this.tasks(locator), `${checkId(taskId, "task")}.json`);
|
|
28552
28851
|
}
|
|
28553
28852
|
feedback(locator) {
|
|
28554
|
-
return
|
|
28853
|
+
return join12(this.sessionDir(locator), "feedback");
|
|
28555
28854
|
}
|
|
28556
28855
|
feedbackFile(locator, messageId4) {
|
|
28557
|
-
return
|
|
28856
|
+
return join12(this.feedback(locator), `${checkId(messageId4, "message")}.json`);
|
|
28558
28857
|
}
|
|
28559
28858
|
goals(locator) {
|
|
28560
|
-
return
|
|
28859
|
+
return join12(this.sessionDir(locator), "goals");
|
|
28561
28860
|
}
|
|
28562
28861
|
goalFile(locator, goalId) {
|
|
28563
|
-
return
|
|
28862
|
+
return join12(this.goals(locator), `${checkId(goalId, "goal")}.json`);
|
|
28564
28863
|
}
|
|
28565
28864
|
/** File snapshots a CLI `/restore` rolls back to. */
|
|
28566
28865
|
fileHistory(locator) {
|
|
28567
|
-
return
|
|
28866
|
+
return join12(this.sessionDir(locator), "file-history");
|
|
28568
28867
|
}
|
|
28569
28868
|
lease(locator) {
|
|
28570
|
-
return
|
|
28869
|
+
return join12(this.sessionDir(locator), "lease.json");
|
|
28571
28870
|
}
|
|
28572
|
-
/**
|
|
28871
|
+
/** `<temp base>/namzu-<user>/<slug>/<session-id>/scratchpad`. Not created; the per-user root is. */
|
|
28573
28872
|
tempDir(sessionId5) {
|
|
28574
28873
|
this.#tempRoot ??= tempRoot();
|
|
28575
|
-
return
|
|
28874
|
+
return join12(this.#tempRoot, this.slug, checkId(sessionId5, "session"), "scratchpad");
|
|
28875
|
+
}
|
|
28876
|
+
/**
|
|
28877
|
+
* Where {@link tempDir} is, creating and checking nothing, not even the
|
|
28878
|
+
* per-user root: for a caller that makes the folder only when it is first used.
|
|
28879
|
+
*/
|
|
28880
|
+
scratchpadPath(sessionId5) {
|
|
28881
|
+
return join12(this.#tempRoot ?? privateTempRootPath(), this.slug, checkId(sessionId5, "session"), "scratchpad");
|
|
28576
28882
|
}
|
|
28577
28883
|
};
|
|
28578
28884
|
|
|
@@ -28687,7 +28993,8 @@ var DiskSessionLog = class _DiskSessionLog extends SessionLogCore {
|
|
|
28687
28993
|
spillAboveBytes: options.spillAboveBytes,
|
|
28688
28994
|
compactionSpillAboveBytes: options.compactionSpillAboveBytes,
|
|
28689
28995
|
structuredResultSpilling: options.structuredResultSpilling,
|
|
28690
|
-
sync: options.sync
|
|
28996
|
+
sync: options.sync,
|
|
28997
|
+
degradedBufferBytes: options.degradedBufferBytes
|
|
28691
28998
|
});
|
|
28692
28999
|
this.file = options.file;
|
|
28693
29000
|
this.sessionDir = options.sessionDir;
|
|
@@ -28824,7 +29131,7 @@ async function readStructuredResultSpill(log, ref, signal) {
|
|
|
28824
29131
|
throw new SpillIntegrityError(ref.path, "Invalid or oversized structured result reference.");
|
|
28825
29132
|
const json2 = await awaitWithAbort(log.readSpill(ref, { maxBytes: STRUCTURED_RESULT_MAX_BYTES, signal }), signal);
|
|
28826
29133
|
signal?.throwIfAborted();
|
|
28827
|
-
if (typeof json2 !== "string" || Buffer.byteLength(json2, "utf8") !== ref.bytes ||
|
|
29134
|
+
if (typeof json2 !== "string" || Buffer.byteLength(json2, "utf8") !== ref.bytes || sha256Hex3(json2) !== ref.sha256) {
|
|
28828
29135
|
throw new SpillIntegrityError(ref.path, "Structured result bytes do not match their recorded length and SHA-256.");
|
|
28829
29136
|
}
|
|
28830
29137
|
let value;
|
|
@@ -29329,6 +29636,10 @@ var TurnRecorder = class {
|
|
|
29329
29636
|
this.#leaseHeartbeat = setInterval(() => this.#queueLeaseRenewal(), this.#leaseTtlMs / 2);
|
|
29330
29637
|
this.#leaseHeartbeat.unref();
|
|
29331
29638
|
}
|
|
29639
|
+
this.#stopWatchingHealth ??= this.log.onWriteHealth?.((change) => {
|
|
29640
|
+
for (const listener of this.#healthListeners)
|
|
29641
|
+
listener(change);
|
|
29642
|
+
});
|
|
29332
29643
|
const head2 = await this.log.head();
|
|
29333
29644
|
if (head2 === null) {
|
|
29334
29645
|
this.#lastEntry = await this.log.append(lease, {
|
|
@@ -29358,6 +29669,19 @@ var TurnRecorder = class {
|
|
|
29358
29669
|
throw error;
|
|
29359
29670
|
}
|
|
29360
29671
|
}
|
|
29672
|
+
/**
|
|
29673
|
+
* Be told when the session log stops writing (the disk is full) and when
|
|
29674
|
+
* it writes again. Sent while the recorder holds the log, from `open` to
|
|
29675
|
+
* `release`.
|
|
29676
|
+
*/
|
|
29677
|
+
onLogWriteHealth(listener) {
|
|
29678
|
+
this.#healthListeners.add(listener);
|
|
29679
|
+
return () => {
|
|
29680
|
+
this.#healthListeners.delete(listener);
|
|
29681
|
+
};
|
|
29682
|
+
}
|
|
29683
|
+
#healthListeners = /* @__PURE__ */ new Set();
|
|
29684
|
+
#stopWatchingHealth;
|
|
29361
29685
|
/** Serialize timer and write-triggered renewals so release uses the latest token. */
|
|
29362
29686
|
#queueLeaseRenewal() {
|
|
29363
29687
|
this.#leaseRenewal = this.#leaseRenewal.then(async () => {
|
|
@@ -29404,6 +29728,8 @@ var TurnRecorder = class {
|
|
|
29404
29728
|
}
|
|
29405
29729
|
/** Give up a lease the recorder claimed. Never throws. */
|
|
29406
29730
|
async release() {
|
|
29731
|
+
this.#stopWatchingHealth?.();
|
|
29732
|
+
this.#stopWatchingHealth = void 0;
|
|
29407
29733
|
if (!this.#ownsLease || !this.#lease)
|
|
29408
29734
|
return;
|
|
29409
29735
|
this.#released = true;
|
|
@@ -32617,12 +32943,12 @@ var AwaitedJobs = class {
|
|
|
32617
32943
|
return Promise.resolve();
|
|
32618
32944
|
if (this.outstanding.size === 0 && this.monitors.size === 0)
|
|
32619
32945
|
return Promise.resolve();
|
|
32620
|
-
return new Promise((
|
|
32946
|
+
return new Promise((resolve35) => {
|
|
32621
32947
|
const finish2 = /* @__PURE__ */ __name(() => {
|
|
32622
32948
|
clearTimeout(timer);
|
|
32623
32949
|
this.arrivals.delete(finish2);
|
|
32624
32950
|
signal?.removeEventListener("abort", finish2);
|
|
32625
|
-
|
|
32951
|
+
resolve35();
|
|
32626
32952
|
}, "finish");
|
|
32627
32953
|
const timer = setTimeout(finish2, timeoutMs);
|
|
32628
32954
|
timer.unref?.();
|
|
@@ -34122,7 +34448,7 @@ var DetachedCalls = class {
|
|
|
34122
34448
|
return Promise.resolve();
|
|
34123
34449
|
if (signal.aborted)
|
|
34124
34450
|
return Promise.reject(signal.reason);
|
|
34125
|
-
return new Promise((
|
|
34451
|
+
return new Promise((resolve35, reject2) => {
|
|
34126
34452
|
const done = /* @__PURE__ */ __name(() => {
|
|
34127
34453
|
clearTimeout(timer);
|
|
34128
34454
|
this.waiters.delete(wake);
|
|
@@ -34130,7 +34456,7 @@ var DetachedCalls = class {
|
|
|
34130
34456
|
}, "done");
|
|
34131
34457
|
const wake = /* @__PURE__ */ __name(() => {
|
|
34132
34458
|
done();
|
|
34133
|
-
|
|
34459
|
+
resolve35();
|
|
34134
34460
|
}, "wake");
|
|
34135
34461
|
const abort = /* @__PURE__ */ __name(() => {
|
|
34136
34462
|
done();
|
|
@@ -34148,10 +34474,10 @@ var DetachedCalls = class {
|
|
|
34148
34474
|
};
|
|
34149
34475
|
|
|
34150
34476
|
// ../sdk/dist/store/memory/digest.js
|
|
34151
|
-
import { createHash as
|
|
34477
|
+
import { createHash as createHash9 } from "node:crypto";
|
|
34152
34478
|
var KNOWLEDGE_TAG_PREFIX = "knowledge:";
|
|
34153
34479
|
function knowledgeDigest(value) {
|
|
34154
|
-
return
|
|
34480
|
+
return createHash9("sha256").update(JSON.stringify(value)).digest("hex");
|
|
34155
34481
|
}
|
|
34156
34482
|
__name(knowledgeDigest, "knowledgeDigest");
|
|
34157
34483
|
async function holdsKnowledgeDigest(store, tags, digest8, isWriter) {
|
|
@@ -34955,12 +35281,12 @@ var CompletionInbox = class {
|
|
|
34955
35281
|
return Promise.resolve();
|
|
34956
35282
|
if (!this.hasPendingWork)
|
|
34957
35283
|
return Promise.resolve();
|
|
34958
|
-
return new Promise((
|
|
35284
|
+
return new Promise((resolve35) => {
|
|
34959
35285
|
const finish2 = /* @__PURE__ */ __name(() => {
|
|
34960
35286
|
clearTimeout(timer);
|
|
34961
35287
|
this.arrivals.delete(finish2);
|
|
34962
35288
|
signal?.removeEventListener("abort", finish2);
|
|
34963
|
-
|
|
35289
|
+
resolve35();
|
|
34964
35290
|
}, "finish");
|
|
34965
35291
|
const timer = setTimeout(finish2, timeoutMs);
|
|
34966
35292
|
timer.unref?.();
|
|
@@ -35128,11 +35454,11 @@ ${JSON.stringify({ tasks: tasks2 })}`;
|
|
|
35128
35454
|
});
|
|
35129
35455
|
if (settlements.length === 0)
|
|
35130
35456
|
return this.drain();
|
|
35131
|
-
await new Promise((
|
|
35457
|
+
await new Promise((resolve35) => {
|
|
35132
35458
|
const finish2 = /* @__PURE__ */ __name(() => {
|
|
35133
35459
|
signal?.removeEventListener("abort", finish2);
|
|
35134
35460
|
this.drains.delete(finish2);
|
|
35135
|
-
|
|
35461
|
+
resolve35();
|
|
35136
35462
|
}, "finish");
|
|
35137
35463
|
this.drains.add(finish2);
|
|
35138
35464
|
signal?.addEventListener("abort", finish2, { once: true });
|
|
@@ -35391,7 +35717,7 @@ async function deliverDurableInbound(recorder, source, signal) {
|
|
|
35391
35717
|
__name(deliverDurableInbound, "deliverDurableInbound");
|
|
35392
35718
|
|
|
35393
35719
|
// ../sdk/dist/runtime/query/observation-context.js
|
|
35394
|
-
import { createHash as
|
|
35720
|
+
import { createHash as createHash12 } from "node:crypto";
|
|
35395
35721
|
|
|
35396
35722
|
// ../sdk/dist/compaction/retention.js
|
|
35397
35723
|
var isAssistantWithCalls = /* @__PURE__ */ __name((m) => m.role === "assistant" && Array.isArray(m.toolCalls), "isAssistantWithCalls");
|
|
@@ -35467,12 +35793,12 @@ function findRetainedIndices(messages) {
|
|
|
35467
35793
|
__name(findRetainedIndices, "findRetainedIndices");
|
|
35468
35794
|
|
|
35469
35795
|
// ../sdk/dist/runtime/query/tool-output-budget.js
|
|
35470
|
-
import { createHash as
|
|
35796
|
+
import { createHash as createHash11 } from "node:crypto";
|
|
35471
35797
|
import { mkdirSync as mkdirSync3, writeFileSync as writeFileSync2 } from "node:fs";
|
|
35472
|
-
import { join as
|
|
35798
|
+
import { join as join13 } from "node:path";
|
|
35473
35799
|
|
|
35474
35800
|
// ../sdk/dist/store/evidence/format.js
|
|
35475
|
-
import { createHash as
|
|
35801
|
+
import { createHash as createHash10 } from "node:crypto";
|
|
35476
35802
|
|
|
35477
35803
|
// ../sdk/dist/utils/evidence-tokens.js
|
|
35478
35804
|
function evidenceTokens(text10) {
|
|
@@ -35511,7 +35837,7 @@ var SEARCH_OVERLAP_BYTES = 1024;
|
|
|
35511
35837
|
var FILTER_BYTES = 1024;
|
|
35512
35838
|
var TOKEN_FILTER_PREFIX = `tokens-v1:${digest2(`${process.version}:${process.versions.v8}:${process.versions.unicode}`).slice(0, 16)}:`;
|
|
35513
35839
|
function digest2(value) {
|
|
35514
|
-
return
|
|
35840
|
+
return createHash10("sha256").update(value).digest("hex");
|
|
35515
35841
|
}
|
|
35516
35842
|
__name(digest2, "digest");
|
|
35517
35843
|
function hashAt(text10, offset) {
|
|
@@ -35776,8 +36102,8 @@ __name(applyToolOutputBudget, "applyToolOutputBudget");
|
|
|
35776
36102
|
function spill2(dir, toolUseId3, content, onError) {
|
|
35777
36103
|
try {
|
|
35778
36104
|
mkdirSync3(dir, { recursive: true, mode: 448 });
|
|
35779
|
-
const name2 =
|
|
35780
|
-
const path3 =
|
|
36105
|
+
const name2 = createHash11("sha256").update(toolUseId3).digest("hex");
|
|
36106
|
+
const path3 = join13(dir, `${name2}.txt`);
|
|
35781
36107
|
const bytes = Buffer.from(content, "utf8");
|
|
35782
36108
|
writeFileSync2(path3, bytes, { flag: "wx", mode: 384 });
|
|
35783
36109
|
try {
|
|
@@ -35998,7 +36324,7 @@ function projectObservationContext(messages, tools, preserveToolResultsFrom = []
|
|
|
35998
36324
|
}
|
|
35999
36325
|
if (executionKey === void 0)
|
|
36000
36326
|
continue;
|
|
36001
|
-
const key6 =
|
|
36327
|
+
const key6 = createHash12("sha256").update(JSON.stringify([
|
|
36002
36328
|
call2.function.name,
|
|
36003
36329
|
call2.function.arguments,
|
|
36004
36330
|
message.content,
|
|
@@ -36025,7 +36351,7 @@ function projectObservationContext(messages, tools, preserveToolResultsFrom = []
|
|
|
36025
36351
|
__name(projectObservationContext, "projectObservationContext");
|
|
36026
36352
|
|
|
36027
36353
|
// ../sdk/dist/runtime/query/request-context.js
|
|
36028
|
-
import { createHash as
|
|
36354
|
+
import { createHash as createHash13 } from "node:crypto";
|
|
36029
36355
|
function canonicalJson2(value) {
|
|
36030
36356
|
return JSON.stringify(value, (_key, item) => {
|
|
36031
36357
|
if (!item || typeof item !== "object" || Array.isArray(item))
|
|
@@ -36044,7 +36370,7 @@ function snapshotRequestContext(messages) {
|
|
|
36044
36370
|
partIndex: partIndex++,
|
|
36045
36371
|
role: message.role,
|
|
36046
36372
|
kind,
|
|
36047
|
-
digest:
|
|
36373
|
+
digest: createHash13("sha256").update(canonicalJson2(payload)).digest("hex"),
|
|
36048
36374
|
...toolCallId !== void 0 ? { toolCallId } : {},
|
|
36049
36375
|
...message.role === "tool" ? { isError: message.isError === true } : {}
|
|
36050
36376
|
}));
|
|
@@ -36671,21 +36997,21 @@ async function waitForTaskWithBounds(gateway, taskId, bounds, now = Date.now) {
|
|
|
36671
36997
|
throw err;
|
|
36672
36998
|
}
|
|
36673
36999
|
);
|
|
36674
|
-
const expiry = new Promise((
|
|
37000
|
+
const expiry = new Promise((resolve35) => {
|
|
36675
37001
|
const tick = setInterval(() => {
|
|
36676
37002
|
if (settled)
|
|
36677
37003
|
return;
|
|
36678
37004
|
const elapsed = now() - startedAt;
|
|
36679
37005
|
if (elapsed >= bounds.wallMs) {
|
|
36680
37006
|
clearInterval(tick);
|
|
36681
|
-
|
|
37007
|
+
resolve35({ kind: "timeout", cause: "wall", elapsedMs: elapsed, idleBoundArmed });
|
|
36682
37008
|
return;
|
|
36683
37009
|
}
|
|
36684
37010
|
if (idleBoundArmed && bounds.idleMs !== void 0) {
|
|
36685
37011
|
const quietFor = now() - lastProgressAt;
|
|
36686
37012
|
if (quietFor >= bounds.idleMs) {
|
|
36687
37013
|
clearInterval(tick);
|
|
36688
|
-
|
|
37014
|
+
resolve35({ kind: "timeout", cause: "idle", elapsedMs: elapsed, idleBoundArmed });
|
|
36689
37015
|
}
|
|
36690
37016
|
}
|
|
36691
37017
|
}, POLL_INTERVAL_MS);
|
|
@@ -40165,14 +40491,14 @@ async function awaitDecisionDurably(ctx, checkpoint, request, scope) {
|
|
|
40165
40491
|
}, "record");
|
|
40166
40492
|
let parkTimer;
|
|
40167
40493
|
let recording = false;
|
|
40168
|
-
const recordIfSlow = new Promise((
|
|
40494
|
+
const recordIfSlow = new Promise((resolve35) => {
|
|
40169
40495
|
parkTimer = setTimeout(() => {
|
|
40170
40496
|
if (settled) {
|
|
40171
|
-
|
|
40497
|
+
resolve35();
|
|
40172
40498
|
return;
|
|
40173
40499
|
}
|
|
40174
40500
|
recording = true;
|
|
40175
|
-
record3().then(
|
|
40501
|
+
record3().then(resolve35, resolve35);
|
|
40176
40502
|
}, delay2);
|
|
40177
40503
|
});
|
|
40178
40504
|
try {
|
|
@@ -40221,13 +40547,13 @@ async function awaitDecisionOrAbort(ctx, request, scope) {
|
|
|
40221
40547
|
const abortedDecision = /* @__PURE__ */ __name(() => scope && !turnSignal?.aborted ? scope.closedAs() : { action: "abort", reason: "run aborted while parked for HITL" }, "abortedDecision");
|
|
40222
40548
|
if (signal.aborted)
|
|
40223
40549
|
return abortedDecision();
|
|
40224
|
-
return new Promise((
|
|
40550
|
+
return new Promise((resolve35) => {
|
|
40225
40551
|
let settled = false;
|
|
40226
40552
|
const onAbort = /* @__PURE__ */ __name(() => {
|
|
40227
40553
|
if (settled)
|
|
40228
40554
|
return;
|
|
40229
40555
|
settled = true;
|
|
40230
|
-
|
|
40556
|
+
resolve35(abortedDecision());
|
|
40231
40557
|
}, "onAbort");
|
|
40232
40558
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
40233
40559
|
Promise.resolve(ctx.resumeHandler(request, resumeContext)).then((decision2) => {
|
|
@@ -40235,13 +40561,13 @@ async function awaitDecisionOrAbort(ctx, request, scope) {
|
|
|
40235
40561
|
return;
|
|
40236
40562
|
settled = true;
|
|
40237
40563
|
signal.removeEventListener("abort", onAbort);
|
|
40238
|
-
|
|
40564
|
+
resolve35(decision2);
|
|
40239
40565
|
}, (err) => {
|
|
40240
40566
|
if (settled)
|
|
40241
40567
|
return;
|
|
40242
40568
|
settled = true;
|
|
40243
40569
|
signal.removeEventListener("abort", onAbort);
|
|
40244
|
-
|
|
40570
|
+
resolve35({
|
|
40245
40571
|
action: "abort",
|
|
40246
40572
|
reason: err instanceof Error ? err.message : "resume handler failed"
|
|
40247
40573
|
});
|
|
@@ -40447,7 +40773,7 @@ var DECLINED_TOOL_CALL_FEEDBACK = "The user declined this. Do not get the same c
|
|
|
40447
40773
|
import { isDeepStrictEqual as isDeepStrictEqual2 } from "node:util";
|
|
40448
40774
|
async function awaitProjectInstructionCallback(signal, start) {
|
|
40449
40775
|
signal.throwIfAborted();
|
|
40450
|
-
return new Promise((
|
|
40776
|
+
return new Promise((resolve35, reject2) => {
|
|
40451
40777
|
let settled = false;
|
|
40452
40778
|
const cleanup = /* @__PURE__ */ __name(() => signal.removeEventListener("abort", onAbort), "cleanup");
|
|
40453
40779
|
const rejectOnce = /* @__PURE__ */ __name((reason2) => {
|
|
@@ -40462,7 +40788,7 @@ async function awaitProjectInstructionCallback(signal, start) {
|
|
|
40462
40788
|
return;
|
|
40463
40789
|
settled = true;
|
|
40464
40790
|
cleanup();
|
|
40465
|
-
|
|
40791
|
+
resolve35(value);
|
|
40466
40792
|
}, "resolveOnce");
|
|
40467
40793
|
const onAbort = /* @__PURE__ */ __name(() => rejectOnce(signal.reason), "onAbort");
|
|
40468
40794
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
@@ -40606,7 +40932,7 @@ function replaceProjectInstructionSnapshot(messages, snapshot, placement = "appe
|
|
|
40606
40932
|
__name(replaceProjectInstructionSnapshot, "replaceProjectInstructionSnapshot");
|
|
40607
40933
|
|
|
40608
40934
|
// ../sdk/dist/runtime/query/repeat-call.js
|
|
40609
|
-
import { createHash as
|
|
40935
|
+
import { createHash as createHash14 } from "node:crypto";
|
|
40610
40936
|
|
|
40611
40937
|
// ../sdk/dist/runtime/query/tool-grants.js
|
|
40612
40938
|
function toolGrantKeys(call2) {
|
|
@@ -40715,7 +41041,7 @@ var RepeatCallTracker = class {
|
|
|
40715
41041
|
this.failures.delete(key6);
|
|
40716
41042
|
return;
|
|
40717
41043
|
}
|
|
40718
|
-
const fingerprint =
|
|
41044
|
+
const fingerprint = createHash14("sha256").update(stableStringify(outcome.result ?? null)).digest("hex");
|
|
40719
41045
|
const previous = this.failures.get(key6);
|
|
40720
41046
|
this.failures.set(key6, {
|
|
40721
41047
|
fingerprint,
|
|
@@ -42105,19 +42431,17 @@ __name(pushRedirection, "pushRedirection");
|
|
|
42105
42431
|
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
42106
42432
|
import { statSync } from "node:fs";
|
|
42107
42433
|
import { rm } from "node:fs/promises";
|
|
42108
|
-
import { tmpdir as tmpdir2 } from "node:os";
|
|
42109
|
-
import { join as join14 } from "node:path";
|
|
42110
42434
|
|
|
42111
42435
|
// ../sdk/dist/tools/paths.js
|
|
42112
42436
|
import { realpath as realpath2 } from "node:fs/promises";
|
|
42113
|
-
import { basename as basename5, dirname as dirname8, isAbsolute as
|
|
42437
|
+
import { basename as basename5, dirname as dirname8, isAbsolute as isAbsolute4, join as join14, relative as relative2, resolve as resolve4 } from "node:path";
|
|
42114
42438
|
function resolveWithin(root, candidate) {
|
|
42115
42439
|
if (candidate === void 0 || candidate === "")
|
|
42116
|
-
return
|
|
42117
|
-
const resolvedRoot =
|
|
42118
|
-
const resolved2 =
|
|
42119
|
-
const rel =
|
|
42120
|
-
if (rel.startsWith("..") ||
|
|
42440
|
+
return resolve4(root);
|
|
42441
|
+
const resolvedRoot = resolve4(root);
|
|
42442
|
+
const resolved2 = resolve4(resolvedRoot, candidate);
|
|
42443
|
+
const rel = relative2(resolvedRoot, resolved2);
|
|
42444
|
+
if (rel.startsWith("..") || isAbsolute4(rel)) {
|
|
42121
42445
|
throw new Error(`Path escapes the working directory: ${candidate}. ${OUTSIDE_ROOTS_GUIDANCE(`inside ${resolvedRoot}`)}`);
|
|
42122
42446
|
}
|
|
42123
42447
|
return resolved2;
|
|
@@ -42142,12 +42466,12 @@ async function pathOutsideRoots(roots, candidate) {
|
|
|
42142
42466
|
await resolveWithinAnyReal(roots, candidate);
|
|
42143
42467
|
return void 0;
|
|
42144
42468
|
} catch {
|
|
42145
|
-
return
|
|
42469
|
+
return resolve4(resolve4(first), candidate);
|
|
42146
42470
|
}
|
|
42147
42471
|
}
|
|
42148
42472
|
__name(pathOutsideRoots, "pathOutsideRoots");
|
|
42149
42473
|
function describeRoots(roots) {
|
|
42150
|
-
return roots.length === 1 ? `inside ${
|
|
42474
|
+
return roots.length === 1 ? `inside ${resolve4(roots[0])}` : `inside ${resolve4(roots[0])} or the added directories ${roots.slice(1).map((r) => resolve4(r)).join(", ")}`;
|
|
42151
42475
|
}
|
|
42152
42476
|
__name(describeRoots, "describeRoots");
|
|
42153
42477
|
function resolveWithinAny(roots, candidate) {
|
|
@@ -42156,7 +42480,7 @@ function resolveWithinAny(roots, candidate) {
|
|
|
42156
42480
|
throw new Error("No root to resolve within.");
|
|
42157
42481
|
if (rest.length === 0)
|
|
42158
42482
|
return resolveWithin(first, candidate);
|
|
42159
|
-
const resolved2 = candidate === void 0 || candidate === "" ?
|
|
42483
|
+
const resolved2 = candidate === void 0 || candidate === "" ? resolve4(first) : resolve4(resolve4(first), candidate);
|
|
42160
42484
|
for (const root of roots) {
|
|
42161
42485
|
if (isWithin(root, resolved2))
|
|
42162
42486
|
return resolveWithin(root, resolved2);
|
|
@@ -42170,7 +42494,7 @@ async function resolveWithinAnyReal(roots, candidate) {
|
|
|
42170
42494
|
throw new Error("No root to resolve within.");
|
|
42171
42495
|
if (rest.length === 0)
|
|
42172
42496
|
return resolveWithinReal(first, candidate);
|
|
42173
|
-
const resolved2 = candidate === void 0 || candidate === "" ?
|
|
42497
|
+
const resolved2 = candidate === void 0 || candidate === "" ? resolve4(first) : resolve4(resolve4(first), candidate);
|
|
42174
42498
|
let firstError;
|
|
42175
42499
|
for (const root of roots) {
|
|
42176
42500
|
try {
|
|
@@ -42193,10 +42517,10 @@ function isWithin(root, candidate) {
|
|
|
42193
42517
|
__name(isWithin, "isWithin");
|
|
42194
42518
|
async function resolveWithinReal(root, candidate) {
|
|
42195
42519
|
const lexical = resolveWithin(root, candidate);
|
|
42196
|
-
const realRoot = await canonicalize(
|
|
42520
|
+
const realRoot = await canonicalize(resolve4(root));
|
|
42197
42521
|
const canonical3 = await canonicalize(lexical);
|
|
42198
|
-
const rel =
|
|
42199
|
-
if (rel.startsWith("..") ||
|
|
42522
|
+
const rel = relative2(realRoot, canonical3);
|
|
42523
|
+
if (rel.startsWith("..") || isAbsolute4(rel)) {
|
|
42200
42524
|
throw new Error(`Path escapes the working directory: ${candidate}. It resolves through a link to ${canonical3}, outside ${realRoot}. ${OUTSIDE_ROOTS_GUIDANCE(`inside ${realRoot}`)}`);
|
|
42201
42525
|
}
|
|
42202
42526
|
return canonical3;
|
|
@@ -42208,11 +42532,11 @@ async function canonicalize(absolute) {
|
|
|
42208
42532
|
for (; ; ) {
|
|
42209
42533
|
const found = await realpath2(existing).then((value) => value, () => void 0);
|
|
42210
42534
|
if (found !== void 0)
|
|
42211
|
-
return remainder ?
|
|
42535
|
+
return remainder ? join14(found, remainder) : found;
|
|
42212
42536
|
const parent = dirname8(existing);
|
|
42213
42537
|
if (parent === existing)
|
|
42214
42538
|
return absolute;
|
|
42215
|
-
remainder = remainder ?
|
|
42539
|
+
remainder = remainder ? join14(basename5(existing), remainder) : basename5(existing);
|
|
42216
42540
|
existing = parent;
|
|
42217
42541
|
}
|
|
42218
42542
|
}
|
|
@@ -42300,7 +42624,7 @@ exit $__namzu_status`;
|
|
|
42300
42624
|
}
|
|
42301
42625
|
__name(withCwdCapture, "withCwdCapture");
|
|
42302
42626
|
function newCwdFile() {
|
|
42303
|
-
return
|
|
42627
|
+
return tempFilePath(`cwd-${randomUUID3()}`);
|
|
42304
42628
|
}
|
|
42305
42629
|
__name(newCwdFile, "newCwdFile");
|
|
42306
42630
|
function startingDirectory(sessionId5, base3) {
|
|
@@ -43393,16 +43717,16 @@ function split(command) {
|
|
|
43393
43717
|
continue;
|
|
43394
43718
|
}
|
|
43395
43719
|
if (ch === "|" || ch === "&" || ch === ";" || ch === "\n") {
|
|
43396
|
-
let
|
|
43720
|
+
let sep18 = ch;
|
|
43397
43721
|
if ((ch === "|" || ch === "&") && next2 === ch) {
|
|
43398
|
-
|
|
43722
|
+
sep18 = ch + ch;
|
|
43399
43723
|
i += 1;
|
|
43400
43724
|
} else if (ch === "|" && next2 === "&") {
|
|
43401
|
-
|
|
43725
|
+
sep18 = "|&";
|
|
43402
43726
|
i += 1;
|
|
43403
43727
|
}
|
|
43404
43728
|
push();
|
|
43405
|
-
pending2 =
|
|
43729
|
+
pending2 = sep18 === "\n" ? ";" : sep18;
|
|
43406
43730
|
continue;
|
|
43407
43731
|
}
|
|
43408
43732
|
current += ch;
|
|
@@ -43593,7 +43917,7 @@ function shellProgress(report) {
|
|
|
43593
43917
|
__name(shellProgress, "shellProgress");
|
|
43594
43918
|
function execHostShell(command, options) {
|
|
43595
43919
|
options.signal?.throwIfAborted();
|
|
43596
|
-
return new Promise((
|
|
43920
|
+
return new Promise((resolve35, reject2) => {
|
|
43597
43921
|
const child = spawnHostShell(command, {
|
|
43598
43922
|
cwd: options.cwd,
|
|
43599
43923
|
env: options.env,
|
|
@@ -43694,7 +44018,7 @@ function execHostShell(command, options) {
|
|
|
43694
44018
|
const stdout = decodeCapture("stdout");
|
|
43695
44019
|
const stderr = decodeCapture("stderr");
|
|
43696
44020
|
if (!failure2 && cause === void 0 && code === 0 && signal === null) {
|
|
43697
|
-
|
|
44021
|
+
resolve35({
|
|
43698
44022
|
stdout,
|
|
43699
44023
|
stderr,
|
|
43700
44024
|
stdoutBytes: captures.stdout.bytes,
|
|
@@ -43745,7 +44069,7 @@ ${stderr}`));
|
|
|
43745
44069
|
child.off("close", onClose);
|
|
43746
44070
|
child.off("error", onError);
|
|
43747
44071
|
child.off("spawn", onSpawn);
|
|
43748
|
-
|
|
44072
|
+
resolve35({
|
|
43749
44073
|
backgroundedJobId: jobId,
|
|
43750
44074
|
backgroundedBy: reason2,
|
|
43751
44075
|
stdout: decodeCapture("stdout"),
|
|
@@ -44151,14 +44475,14 @@ __name(backoffProportional, "backoffProportional");
|
|
|
44151
44475
|
function sleep(ms, signal) {
|
|
44152
44476
|
if (ms <= 0)
|
|
44153
44477
|
return Promise.resolve();
|
|
44154
|
-
return new Promise((
|
|
44478
|
+
return new Promise((resolve35, reject2) => {
|
|
44155
44479
|
if (signal?.aborted) {
|
|
44156
44480
|
reject2(signal.reason);
|
|
44157
44481
|
return;
|
|
44158
44482
|
}
|
|
44159
44483
|
const timer = setTimeout(() => {
|
|
44160
44484
|
signal?.removeEventListener("abort", onAbort);
|
|
44161
|
-
|
|
44485
|
+
resolve35();
|
|
44162
44486
|
}, ms);
|
|
44163
44487
|
const onAbort = /* @__PURE__ */ __name(() => {
|
|
44164
44488
|
clearTimeout(timer);
|
|
@@ -44646,7 +44970,7 @@ __name(createAutoReviewClassifier, "createAutoReviewClassifier");
|
|
|
44646
44970
|
|
|
44647
44971
|
// ../sdk/dist/runtime/query/path-escalation.js
|
|
44648
44972
|
import { homedir as homedir2 } from "node:os";
|
|
44649
|
-
import { isAbsolute as
|
|
44973
|
+
import { isAbsolute as isAbsolute6, relative as relative3, resolve as resolve6, sep as sep5 } from "node:path";
|
|
44650
44974
|
|
|
44651
44975
|
// ../sdk/dist/authorization/protected-paths.js
|
|
44652
44976
|
var PROTECTED_DIRECTORIES = [
|
|
@@ -44747,7 +45071,7 @@ __name(isProtectedPath, "isProtectedPath");
|
|
|
44747
45071
|
// ../sdk/dist/authorization/removal.js
|
|
44748
45072
|
import { existsSync as existsSync2, realpathSync } from "node:fs";
|
|
44749
45073
|
import { homedir } from "node:os";
|
|
44750
|
-
import { dirname as dirname9, isAbsolute as
|
|
45074
|
+
import { dirname as dirname9, isAbsolute as isAbsolute5, join as join15, normalize as normalize5, basename as pathBasename, resolve as resolve5, sep as sep4 } from "node:path";
|
|
44751
45075
|
var TOP_LEVEL = "bin|boot|dev|etc|home|lib|lib32|lib64|libx32|media|mnt|opt|proc|root|run|sbin|srv|sys|tmp|usr|var|snap|nix|lost\\+found|private|cores|Applications|Library|System|Users|Volumes|Windows|ProgramData|cygdrive";
|
|
44752
45076
|
var VAR = "(?:\\{([A-Za-z_][A-Za-z0-9_]*)(?::?-[^}]*)?\\}|([A-Za-z_][A-Za-z0-9_]*))";
|
|
44753
45077
|
var EMPTY_VARIABLE_ROOT = new RegExp(`^\\$${VAR}/(?:[*?[{]|\\$|/|$)`);
|
|
@@ -44844,13 +45168,13 @@ function dangerousRemoval(reading, changesDirectory, context2) {
|
|
|
44844
45168
|
return void 0;
|
|
44845
45169
|
const home = context2.home ?? homedir();
|
|
44846
45170
|
const env = context2.env ?? process.env;
|
|
44847
|
-
const cwd =
|
|
45171
|
+
const cwd = resolve5(context2.cwd);
|
|
44848
45172
|
const homes = [home, canonical2(home)];
|
|
44849
45173
|
const workdirs = [cwd, canonical2(cwd)];
|
|
44850
45174
|
const everyDirectory = [
|
|
44851
45175
|
.../* @__PURE__ */ new Set([
|
|
44852
45176
|
...workdirs,
|
|
44853
|
-
...(context2.additionalDirectories ?? []).flatMap((d) => [
|
|
45177
|
+
...(context2.additionalDirectories ?? []).flatMap((d) => [resolve5(d), canonical2(resolve5(d))])
|
|
44854
45178
|
])
|
|
44855
45179
|
];
|
|
44856
45180
|
for (const removal of removals) {
|
|
@@ -44907,32 +45231,32 @@ __name(checkRemoval, "checkRemoval");
|
|
|
44907
45231
|
var GLOB_TAIL = /[\\/]\.?\*$/;
|
|
44908
45232
|
function checkTarget(program, args, spelled, word2, scope) {
|
|
44909
45233
|
const expanded = expandTilde(spelled, scope.home);
|
|
44910
|
-
const
|
|
45234
|
+
const relative17 = !isAbsolute5(expanded);
|
|
44911
45235
|
if (expandsAtRuntime(word2) && /[$`]/.test(expanded)) {
|
|
44912
45236
|
return void 0;
|
|
44913
45237
|
}
|
|
44914
|
-
const absolute =
|
|
45238
|
+
const absolute = relative17 ? resolve5(scope.cwd, expanded) : resolve5(expanded);
|
|
44915
45239
|
let settled = absolute;
|
|
44916
45240
|
for (let previous = ""; previous !== settled; ) {
|
|
44917
45241
|
previous = settled;
|
|
44918
|
-
const stripped = settled.replace(/([\\/]\.?\*+)+[\\/]*$/, "") ||
|
|
45242
|
+
const stripped = settled.replace(/([\\/]\.?\*+)+[\\/]*$/, "") || sep4;
|
|
44919
45243
|
if (stripped !== settled)
|
|
44920
45244
|
settled = /[\\/]/.test(stripped) ? normalize5(stripped) : stripped;
|
|
44921
45245
|
}
|
|
44922
45246
|
const globbed = settled !== absolute;
|
|
44923
45247
|
const original = expanded;
|
|
44924
|
-
if (scope.changesDirectory && globbed &&
|
|
45248
|
+
if (scope.changesDirectory && globbed && relative17 && GLOB_TAIL.test(absolute)) {
|
|
44925
45249
|
return `${program} ${spelled}: a relative glob after a cd cannot be resolved before the line runs`;
|
|
44926
45250
|
}
|
|
44927
45251
|
let below = settled;
|
|
44928
|
-
if (
|
|
44929
|
-
const prefix = scope.cwd.endsWith(
|
|
45252
|
+
if (relative17) {
|
|
45253
|
+
const prefix = scope.cwd.endsWith(sep4) ? scope.cwd : scope.cwd + sep4;
|
|
44930
45254
|
if (settled.startsWith(prefix))
|
|
44931
45255
|
below = settled.slice(prefix.length);
|
|
44932
45256
|
else if (settled === scope.cwd)
|
|
44933
45257
|
below = "";
|
|
44934
45258
|
}
|
|
44935
|
-
if (globbed && (hasParentAfterName(original) || original.startsWith("~") || /^[\\/]{2}/.test(original) ||
|
|
45259
|
+
if (globbed && (hasParentAfterName(original) || original.startsWith("~") || /^[\\/]{2}/.test(original) || relative17 && /(^|[\\/])\.\.([\\/]|$)/.test(original) && GLOB_TAIL.test(absolute) || program === "rmdir" && GLOB_TAIL.test(absolute) && args.some((a) => /^--p/.test(a.value) || /^-[a-z]*p/.test(a.value)) || relative17 && /\*[\\/]+$/.test(original) && GLOB_TAIL.test(absolute))) {
|
|
44936
45260
|
return `${program} ${spelled}: the target cannot be resolved to a directory before the line runs`;
|
|
44937
45261
|
}
|
|
44938
45262
|
if (!globbed || !/[*?[]/.test(below)) {
|
|
@@ -44980,9 +45304,9 @@ __name(hasParentAfterName, "hasParentAfterName");
|
|
|
44980
45304
|
function protectedScope(absolute, roots) {
|
|
44981
45305
|
let best;
|
|
44982
45306
|
for (const root of roots) {
|
|
44983
|
-
const base3 =
|
|
44984
|
-
const below =
|
|
44985
|
-
if (below === "" || below.startsWith("..") ||
|
|
45307
|
+
const base3 = resolve6(root);
|
|
45308
|
+
const below = relative3(base3, absolute);
|
|
45309
|
+
if (below === "" || below.startsWith("..") || isAbsolute6(below))
|
|
44986
45310
|
continue;
|
|
44987
45311
|
if (best === void 0 || below.length < best.length)
|
|
44988
45312
|
best = below;
|
|
@@ -44991,12 +45315,12 @@ function protectedScope(absolute, roots) {
|
|
|
44991
45315
|
}
|
|
44992
45316
|
__name(protectedScope, "protectedScope");
|
|
44993
45317
|
async function isProtectedWrite(spelled, absolute, roots) {
|
|
44994
|
-
if (isProtectedPath(
|
|
45318
|
+
if (isProtectedPath(isAbsolute6(spelled) ? protectedScope(absolute, roots) : spelled))
|
|
44995
45319
|
return true;
|
|
44996
45320
|
if (isProtectedPath(protectedScope(absolute, roots)))
|
|
44997
45321
|
return true;
|
|
44998
45322
|
const real = await canonicalize(absolute);
|
|
44999
|
-
const realRoots = await Promise.all(roots.map((root) => canonicalize(
|
|
45323
|
+
const realRoots = await Promise.all(roots.map((root) => canonicalize(resolve6(root))));
|
|
45000
45324
|
return isProtectedPath(protectedScope(real, [...roots, ...realRoots]));
|
|
45001
45325
|
}
|
|
45002
45326
|
__name(isProtectedWrite, "isProtectedWrite");
|
|
@@ -45045,12 +45369,12 @@ function settle(value, home) {
|
|
|
45045
45369
|
if (value === "~")
|
|
45046
45370
|
return { path: home };
|
|
45047
45371
|
if (value.startsWith("~/"))
|
|
45048
|
-
return { path:
|
|
45372
|
+
return { path: resolve6(home, value.slice(2)) };
|
|
45049
45373
|
if (value.startsWith("~"))
|
|
45050
45374
|
return { unresolved: true };
|
|
45051
45375
|
const variable = /^\$(?:\{HOME\}|HOME)(?=\/|$)/.exec(value);
|
|
45052
45376
|
if (variable !== null)
|
|
45053
|
-
return { path:
|
|
45377
|
+
return { path: resolve6(home, `.${value.slice(variable[0].length)}`) };
|
|
45054
45378
|
if (/[$`]/.test(value))
|
|
45055
45379
|
return { unresolved: true };
|
|
45056
45380
|
return { path: value };
|
|
@@ -45068,7 +45392,7 @@ async function declaredWriteEscalation(roots, value) {
|
|
|
45068
45392
|
const [first] = roots;
|
|
45069
45393
|
if (first === void 0 || value === "")
|
|
45070
45394
|
return void 0;
|
|
45071
|
-
const absolute =
|
|
45395
|
+
const absolute = resolve6(resolve6(first), value);
|
|
45072
45396
|
return await isProtectedWrite(value, absolute, roots) ? absolute : void 0;
|
|
45073
45397
|
}
|
|
45074
45398
|
__name(declaredWriteEscalation, "declaredWriteEscalation");
|
|
@@ -45080,17 +45404,17 @@ async function shellEscalations(line, dialect, context2) {
|
|
|
45080
45404
|
const protectedPaths = /* @__PURE__ */ new Set();
|
|
45081
45405
|
const home = homedir2();
|
|
45082
45406
|
if (cwd !== void 0) {
|
|
45083
|
-
const madeHere = reading.invocations.filter((invocation) => invocation.program === "ln").flatMap((invocation) => invocation.args.map((arg) => arg.value)).filter((value) => value !== "" && !value.startsWith("-")).map((value) =>
|
|
45407
|
+
const madeHere = reading.invocations.filter((invocation) => invocation.program === "ln").flatMap((invocation) => invocation.args.map((arg) => arg.value)).filter((value) => value !== "" && !value.startsWith("-")).map((value) => resolve6(cwd, value));
|
|
45084
45408
|
for (const use of access.uses) {
|
|
45085
45409
|
for (const spelled of expandBraces(use.path)) {
|
|
45086
45410
|
const settled = settle(spelled, home);
|
|
45087
45411
|
const unresolved = use.unresolved || "unresolved" in settled;
|
|
45088
45412
|
const base3 = "path" in settled ? settled.path : spelled;
|
|
45089
45413
|
const starts = [cwd];
|
|
45090
|
-
const moved = use.directory !== void 0 && "relative" in use.directory ?
|
|
45414
|
+
const moved = use.directory !== void 0 && "relative" in use.directory ? resolve6(cwd, use.directory.relative) : void 0;
|
|
45091
45415
|
if (moved !== void 0)
|
|
45092
45416
|
starts.push(moved);
|
|
45093
|
-
const absolutes =
|
|
45417
|
+
const absolutes = isAbsolute6(base3) ? [resolve6(base3)] : starts.map((from) => resolve6(from, base3));
|
|
45094
45418
|
if (use.access === "write") {
|
|
45095
45419
|
for (const candidate of absolutes) {
|
|
45096
45420
|
if (await isProtectedWrite(spelled, candidate, context2.roots))
|
|
@@ -45104,12 +45428,12 @@ async function shellEscalations(line, dialect, context2) {
|
|
|
45104
45428
|
outside.add(spelled);
|
|
45105
45429
|
continue;
|
|
45106
45430
|
}
|
|
45107
|
-
if (use.directory !== void 0 && "unknown" in use.directory && use.access === "write" && !
|
|
45431
|
+
if (use.directory !== void 0 && "unknown" in use.directory && use.access === "write" && !isAbsolute6(base3) && !spelled.startsWith("~")) {
|
|
45108
45432
|
outside.add(spelled);
|
|
45109
45433
|
continue;
|
|
45110
45434
|
}
|
|
45111
45435
|
for (const candidate of absolutes) {
|
|
45112
|
-
if (madeHere.some((link6) => candidate === link6 || candidate.startsWith(`${link6}${
|
|
45436
|
+
if (madeHere.some((link6) => candidate === link6 || candidate.startsWith(`${link6}${sep5}`))) {
|
|
45113
45437
|
outside.add(candidate);
|
|
45114
45438
|
continue;
|
|
45115
45439
|
}
|
|
@@ -45563,7 +45887,8 @@ function createReviewHandler(options = {}) {
|
|
|
45563
45887
|
answered = answer2;
|
|
45564
45888
|
}
|
|
45565
45889
|
const isPlanFileWrite = /* @__PURE__ */ __name((tc) => mode === "plan" && options.planModeWrite?.(tc) === true && tc.authorization?.decision !== "deny", "isPlanFileWrite");
|
|
45566
|
-
const
|
|
45890
|
+
const isScratchpadWrite = /* @__PURE__ */ __name((tc) => mode !== "strict" && tc.scratchpadWrite === true && tc.escalation === void 0 && tc.requiresApproval !== true && !tc.authorization?.explicitReview && tc.authorization?.decision !== "deny", "isScratchpadWrite");
|
|
45891
|
+
const reviewable = request.toolCalls.filter((tc) => !(isPlanFileWrite(tc) && !tc.authorization?.explicitReview) && !isScratchpadWrite(tc));
|
|
45567
45892
|
if (!batchNeedsReview(reviewable, exempt)) {
|
|
45568
45893
|
return { action: "approve_tools" };
|
|
45569
45894
|
}
|
|
@@ -45574,7 +45899,7 @@ function createReviewHandler(options = {}) {
|
|
|
45574
45899
|
)))).every(Boolean)) {
|
|
45575
45900
|
return { action: "approve_tools" };
|
|
45576
45901
|
}
|
|
45577
|
-
if (mode === "plan" && !onlyReadsOutsideRoots(reviewable.filter((tc) => !isPlanFileWrite(tc)), exempt)) {
|
|
45902
|
+
if (mode === "plan" && !onlyReadsOutsideRoots(reviewable.filter((tc) => !isPlanFileWrite(tc) && !isScratchpadWrite(tc)), exempt)) {
|
|
45578
45903
|
return { action: "reject_tools", feedback: PLAN_MODE_REFUSAL };
|
|
45579
45904
|
}
|
|
45580
45905
|
if (mode === "strict")
|
|
@@ -45795,8 +46120,8 @@ function createReviewPolicy(options = {}) {
|
|
|
45795
46120
|
__name(createReviewPolicy, "createReviewPolicy");
|
|
45796
46121
|
|
|
45797
46122
|
// ../sdk/dist/runtime/query/executor.js
|
|
45798
|
-
import { createHash as
|
|
45799
|
-
import { join as join18, resolve as
|
|
46123
|
+
import { createHash as createHash18 } from "node:crypto";
|
|
46124
|
+
import { isAbsolute as isAbsolute8, join as join18, resolve as resolve9 } from "node:path";
|
|
45800
46125
|
|
|
45801
46126
|
// ../sdk/dist/probe/context.js
|
|
45802
46127
|
function buildProbeContext(input = {}) {
|
|
@@ -46077,9 +46402,9 @@ function createProbeRegistry() {
|
|
|
46077
46402
|
__name(createProbeRegistry, "createProbeRegistry");
|
|
46078
46403
|
|
|
46079
46404
|
// ../sdk/dist/tools/builtins/content-fingerprint.js
|
|
46080
|
-
import { createHash as
|
|
46405
|
+
import { createHash as createHash15 } from "node:crypto";
|
|
46081
46406
|
function fingerprintContent(content) {
|
|
46082
|
-
return
|
|
46407
|
+
return createHash15("sha256").update(content, "utf-8").digest("hex").slice(0, 16);
|
|
46083
46408
|
}
|
|
46084
46409
|
__name(fingerprintContent, "fingerprintContent");
|
|
46085
46410
|
function staleFileError(path3, operation = "edit") {
|
|
@@ -46220,21 +46545,21 @@ __name(createFileReadTracker, "createFileReadTracker");
|
|
|
46220
46545
|
|
|
46221
46546
|
// ../sdk/dist/tools/retained-output.js
|
|
46222
46547
|
import { lstat as lstat2, realpath as realpath3 } from "node:fs/promises";
|
|
46223
|
-
import { dirname as dirname10, extname, isAbsolute as
|
|
46548
|
+
import { dirname as dirname10, extname, isAbsolute as isAbsolute7, relative as relative4, resolve as resolve7 } from "node:path";
|
|
46224
46549
|
function inside(root, path3) {
|
|
46225
|
-
const rel =
|
|
46226
|
-
return rel !== "" && !rel.startsWith("..") && !
|
|
46550
|
+
const rel = relative4(root, path3);
|
|
46551
|
+
return rel !== "" && !rel.startsWith("..") && !isAbsolute7(rel);
|
|
46227
46552
|
}
|
|
46228
46553
|
__name(inside, "inside");
|
|
46229
46554
|
async function resolveRetainedOutput(directory, candidate) {
|
|
46230
|
-
if (!directory || !candidate || !
|
|
46555
|
+
if (!directory || !candidate || !isAbsolute7(candidate) || candidate.includes("\0"))
|
|
46231
46556
|
return void 0;
|
|
46232
46557
|
try {
|
|
46233
46558
|
const base3 = await realpath3(directory);
|
|
46234
|
-
const lexical =
|
|
46559
|
+
const lexical = resolve7(candidate);
|
|
46235
46560
|
if (extname(lexical).toLowerCase() !== ".txt")
|
|
46236
46561
|
return void 0;
|
|
46237
|
-
if (!inside(
|
|
46562
|
+
if (!inside(resolve7(directory), lexical) && !inside(base3, lexical))
|
|
46238
46563
|
return void 0;
|
|
46239
46564
|
const stat17 = await lstat2(lexical);
|
|
46240
46565
|
if (stat17.isSymbolicLink() || !stat17.isFile() || stat17.nlink !== 1)
|
|
@@ -46773,8 +47098,7 @@ import { extname as extname2 } from "node:path";
|
|
|
46773
47098
|
|
|
46774
47099
|
// ../sdk/dist/tools/builtins/read-media.js
|
|
46775
47100
|
import { spawn } from "node:child_process";
|
|
46776
|
-
import {
|
|
46777
|
-
import { tmpdir as tmpdir3 } from "node:os";
|
|
47101
|
+
import { readdir as readdir3, rm as rm3 } from "node:fs/promises";
|
|
46778
47102
|
import { join as join16 } from "node:path";
|
|
46779
47103
|
|
|
46780
47104
|
// ../sdk/dist/tools/builtins/computer-use-image.js
|
|
@@ -46958,7 +47282,7 @@ async function cropAndFitPng(data, rect, limits) {
|
|
|
46958
47282
|
__name(cropAndFitPng, "cropAndFitPng");
|
|
46959
47283
|
|
|
46960
47284
|
// ../sdk/dist/tools/builtins/view-image.js
|
|
46961
|
-
import { createHash as
|
|
47285
|
+
import { createHash as createHash16 } from "node:crypto";
|
|
46962
47286
|
import { open as open8 } from "node:fs/promises";
|
|
46963
47287
|
import { inflateSync } from "node:zlib";
|
|
46964
47288
|
|
|
@@ -47578,7 +47902,7 @@ ${validation === "container" ? "The complete container and dimensions were valid
|
|
|
47578
47902
|
width: image.width,
|
|
47579
47903
|
height: image.height,
|
|
47580
47904
|
sourceBytes: artifact.bytes.length,
|
|
47581
|
-
sha256:
|
|
47905
|
+
sha256: createHash16("sha256").update(artifact.bytes).digest("hex"),
|
|
47582
47906
|
validation
|
|
47583
47907
|
}
|
|
47584
47908
|
};
|
|
@@ -47657,7 +47981,7 @@ function checkPageRange(value) {
|
|
|
47657
47981
|
}
|
|
47658
47982
|
__name(checkPageRange, "checkPageRange");
|
|
47659
47983
|
function run(command, args, input, signal, timeoutMs) {
|
|
47660
|
-
return new Promise((
|
|
47984
|
+
return new Promise((resolve35) => {
|
|
47661
47985
|
const child = spawn(command, [...args], { stdio: ["pipe", "pipe", "pipe"], signal });
|
|
47662
47986
|
let stdout = "";
|
|
47663
47987
|
let stderr = "";
|
|
@@ -47678,11 +48002,11 @@ function run(command, args, input, signal, timeoutMs) {
|
|
|
47678
48002
|
child.on("error", (error) => {
|
|
47679
48003
|
missing2 = error.code === "ENOENT";
|
|
47680
48004
|
clearTimeout(timer);
|
|
47681
|
-
|
|
48005
|
+
resolve35({ code: null, stdout, stderr: stderr || error.message, missing: missing2, timedOut });
|
|
47682
48006
|
});
|
|
47683
48007
|
child.on("close", (code) => {
|
|
47684
48008
|
clearTimeout(timer);
|
|
47685
|
-
|
|
48009
|
+
resolve35({ code, stdout, stderr, missing: missing2, timedOut });
|
|
47686
48010
|
});
|
|
47687
48011
|
child.stdin.on("error", () => {
|
|
47688
48012
|
});
|
|
@@ -47785,7 +48109,7 @@ async function readPdfPages(bytes, pagesArgument, label6, signal) {
|
|
|
47785
48109
|
}
|
|
47786
48110
|
last = total === null ? PDF_WHOLE_READ_MAX_PAGES : total;
|
|
47787
48111
|
}
|
|
47788
|
-
const directory = await
|
|
48112
|
+
const directory = await createTempDir("pdf-");
|
|
47789
48113
|
try {
|
|
47790
48114
|
const rendered = await renderPages(bytes, first, last, directory, signal);
|
|
47791
48115
|
if (!rendered.ok)
|
|
@@ -48485,7 +48809,7 @@ function buildStructuredBinaryGuidance(path3, format, extractor) {
|
|
|
48485
48809
|
__name(buildStructuredBinaryGuidance, "buildStructuredBinaryGuidance");
|
|
48486
48810
|
|
|
48487
48811
|
// ../sdk/dist/runtime/query/file-evidence-replay.js
|
|
48488
|
-
import { resolve as
|
|
48812
|
+
import { resolve as resolve8 } from "node:path";
|
|
48489
48813
|
|
|
48490
48814
|
// ../sdk/dist/tools/builtins/edit-match.js
|
|
48491
48815
|
var LEFT_SINGLE_QUOTE = "\u2018";
|
|
@@ -48963,8 +49287,8 @@ async function withFileMutationLock(key6, operation) {
|
|
|
48963
49287
|
const previous = mutationTails.get(key6) ?? Promise.resolve();
|
|
48964
49288
|
let release2 = /* @__PURE__ */ __name(() => {
|
|
48965
49289
|
}, "release");
|
|
48966
|
-
const current = new Promise((
|
|
48967
|
-
release2 =
|
|
49290
|
+
const current = new Promise((resolve35) => {
|
|
49291
|
+
release2 = resolve35;
|
|
48968
49292
|
});
|
|
48969
49293
|
const tail = previous.then(() => current);
|
|
48970
49294
|
mutationTails.set(key6, tail);
|
|
@@ -50145,7 +50469,7 @@ import { mkdir as mkdir9, readFile as readFile9 } from "node:fs/promises";
|
|
|
50145
50469
|
import { dirname as dirname12 } from "node:path";
|
|
50146
50470
|
|
|
50147
50471
|
// ../sdk/dist/tools/builtins/file-write-result.js
|
|
50148
|
-
import { createHash as
|
|
50472
|
+
import { createHash as createHash17 } from "node:crypto";
|
|
50149
50473
|
function previewSide(hunks2, changed) {
|
|
50150
50474
|
return hunks2.flatMap((hunk) => hunk.lines).filter((row) => row.startsWith(" ") || row.startsWith(changed)).map((row) => `${row.slice(1)}
|
|
50151
50475
|
`).join("");
|
|
@@ -50187,7 +50511,7 @@ function fileWriteResult(path3, before, after, sandboxed = false) {
|
|
|
50187
50511
|
}
|
|
50188
50512
|
},
|
|
50189
50513
|
bytes,
|
|
50190
|
-
sha256:
|
|
50514
|
+
sha256: createHash17("sha256").update(after, "utf8").digest("hex"),
|
|
50191
50515
|
...before === null ? {} : { added: diff.added, removed: diff.removed, newlineChanged }
|
|
50192
50516
|
}
|
|
50193
50517
|
}
|
|
@@ -50392,7 +50716,7 @@ function parseArguments3(call2) {
|
|
|
50392
50716
|
}
|
|
50393
50717
|
__name(parseArguments3, "parseArguments");
|
|
50394
50718
|
function lexicalFileKeys(workingDirectory, sandboxed) {
|
|
50395
|
-
return (path3) => sandboxed ? path3 :
|
|
50719
|
+
return (path3) => sandboxed ? path3 : resolve8(workingDirectory, path3);
|
|
50396
50720
|
}
|
|
50397
50721
|
__name(lexicalFileKeys, "lexicalFileKeys");
|
|
50398
50722
|
function indexVisibleHistory(messages, keyOf) {
|
|
@@ -51113,8 +51437,8 @@ var ToolCallBudget = class {
|
|
|
51113
51437
|
signal.throwIfAborted();
|
|
51114
51438
|
const previous = this.chain;
|
|
51115
51439
|
let release2;
|
|
51116
|
-
this.chain = new Promise((
|
|
51117
|
-
release2 =
|
|
51440
|
+
this.chain = new Promise((resolve35) => {
|
|
51441
|
+
release2 = resolve35;
|
|
51118
51442
|
});
|
|
51119
51443
|
try {
|
|
51120
51444
|
await previous;
|
|
@@ -51355,6 +51679,67 @@ var ToolExecutor = class {
|
|
|
51355
51679
|
await this.sandboxGate?.();
|
|
51356
51680
|
}
|
|
51357
51681
|
/** True once the turn has a sandbox, or is certain to get one before a tool runs. */
|
|
51682
|
+
/** The scratch folder, once a call has named it and it has been made and checked. */
|
|
51683
|
+
scratchpadReady;
|
|
51684
|
+
/** The tools' roots now: the turn's, plus the scratch folder once it is ready. */
|
|
51685
|
+
rootsNow() {
|
|
51686
|
+
return toolRoots({
|
|
51687
|
+
workingDirectory: this.config.workingDirectory,
|
|
51688
|
+
additionalDirectories: this.additionalDirectoriesNow()
|
|
51689
|
+
});
|
|
51690
|
+
}
|
|
51691
|
+
additionalDirectoriesNow() {
|
|
51692
|
+
if (this.scratchpadReady === void 0)
|
|
51693
|
+
return this.config.additionalDirectories;
|
|
51694
|
+
return [...this.config.additionalDirectories ?? [], this.scratchpadReady];
|
|
51695
|
+
}
|
|
51696
|
+
/**
|
|
51697
|
+
* Make the session's scratch folder a root when a call names it. Lazy: a
|
|
51698
|
+
* session that never uses it leaves nothing on disk. The folder must be
|
|
51699
|
+
* inside the private temporary root with no link on the way; otherwise it
|
|
51700
|
+
* stays outside the roots and a path in it is asked about like any other.
|
|
51701
|
+
*/
|
|
51702
|
+
admitScratchpad(call2) {
|
|
51703
|
+
const directory = this.config.scratchpadDirectory;
|
|
51704
|
+
if (directory === void 0 || this.scratchpadReady !== void 0 || this.sandboxed)
|
|
51705
|
+
return;
|
|
51706
|
+
if (call2.kind === "synthetic")
|
|
51707
|
+
return;
|
|
51708
|
+
let named = false;
|
|
51709
|
+
try {
|
|
51710
|
+
named = JSON.stringify(call2.input)?.includes(JSON.stringify(directory).slice(1, -1)) === true;
|
|
51711
|
+
} catch {
|
|
51712
|
+
}
|
|
51713
|
+
if (!named)
|
|
51714
|
+
return;
|
|
51715
|
+
try {
|
|
51716
|
+
this.scratchpadReady = ensureScratchpadDirectory(directory);
|
|
51717
|
+
} catch (error) {
|
|
51718
|
+
this.log.warn("The session scratch folder could not be made, so it stays outside the roots", {
|
|
51719
|
+
"exception.message": error instanceof Error ? error.message : String(error)
|
|
51720
|
+
});
|
|
51721
|
+
}
|
|
51722
|
+
}
|
|
51723
|
+
/** Whether `call` writes a file inside the ready scratch folder and nothing else about it is notable. */
|
|
51724
|
+
async writesScratchpad(call2, escalation) {
|
|
51725
|
+
const root = this.scratchpadReady;
|
|
51726
|
+
if (root === void 0 || escalation !== void 0 || call2.kind === "synthetic")
|
|
51727
|
+
return false;
|
|
51728
|
+
if (call2.toolName !== "write" && call2.toolName !== "edit")
|
|
51729
|
+
return false;
|
|
51730
|
+
const tool = this.config.tools.get(call2.toolName);
|
|
51731
|
+
if (!tool?.pathArgument || call2.input === null || typeof call2.input !== "object")
|
|
51732
|
+
return false;
|
|
51733
|
+
const value = call2.input[tool.pathArgument];
|
|
51734
|
+
if (typeof value !== "string" || !isAbsolute8(value))
|
|
51735
|
+
return false;
|
|
51736
|
+
try {
|
|
51737
|
+
await resolveWithinAnyReal([root], value);
|
|
51738
|
+
return true;
|
|
51739
|
+
} catch {
|
|
51740
|
+
return false;
|
|
51741
|
+
}
|
|
51742
|
+
}
|
|
51358
51743
|
get sandboxed() {
|
|
51359
51744
|
return this.config.sandbox !== void 0 || this.sandboxGate !== void 0;
|
|
51360
51745
|
}
|
|
@@ -51364,7 +51749,7 @@ var ToolExecutor = class {
|
|
|
51364
51749
|
return recorded !== void 0 && message.toolCallId === call2.id && !message.isError && typeof message.content === "string" && this.config.tools.get(recorded.toolName) === recorded.definition && recorded.fingerprint === this.observationFingerprint(call2, message.content) ? recorded.inputFingerprint : void 0;
|
|
51365
51750
|
}
|
|
51366
51751
|
observationFingerprint(call2, content) {
|
|
51367
|
-
return
|
|
51752
|
+
return createHash18("sha256").update(JSON.stringify([call2.function.name, call2.function.arguments, content])).digest("hex");
|
|
51368
51753
|
}
|
|
51369
51754
|
recordExecutedObservation(call2, toolName, definition, input, content) {
|
|
51370
51755
|
if (typeof content !== "string" || this.config.tools.get(toolName) !== definition)
|
|
@@ -51376,7 +51761,7 @@ var ToolExecutor = class {
|
|
|
51376
51761
|
toolName,
|
|
51377
51762
|
definition,
|
|
51378
51763
|
fingerprint: this.observationFingerprint(call2, content),
|
|
51379
|
-
inputFingerprint:
|
|
51764
|
+
inputFingerprint: createHash18("sha256").update(JSON.stringify([toolName, input])).digest("hex")
|
|
51380
51765
|
});
|
|
51381
51766
|
} catch {
|
|
51382
51767
|
}
|
|
@@ -51605,6 +51990,7 @@ var ToolExecutor = class {
|
|
|
51605
51990
|
await this.awaitSandbox();
|
|
51606
51991
|
const calls = /* @__PURE__ */ new Map();
|
|
51607
51992
|
const escalations = /* @__PURE__ */ new Map();
|
|
51993
|
+
const scratchpadWrites = /* @__PURE__ */ new Set();
|
|
51608
51994
|
const earlierPaths = [];
|
|
51609
51995
|
for (const toolCall of response.message.toolCalls ?? []) {
|
|
51610
51996
|
const prepared = await prepareDirectCall(this.admissionHost(), toolCall, !hostModifiedCallIds?.has(toolCall.id));
|
|
@@ -51613,12 +51999,15 @@ var ToolExecutor = class {
|
|
|
51613
51999
|
if (path3 !== void 0)
|
|
51614
52000
|
earlierPaths.push(path3);
|
|
51615
52001
|
calls.set(toolCall.id, call2);
|
|
52002
|
+
this.admitScratchpad(call2);
|
|
51616
52003
|
const escalation = await this.escalationOrUnfinished(call2);
|
|
51617
52004
|
if (escalation)
|
|
51618
52005
|
escalations.set(toolCall.id, escalation);
|
|
52006
|
+
if (await this.writesScratchpad(call2, escalation))
|
|
52007
|
+
scratchpadWrites.add(toolCall.id);
|
|
51619
52008
|
}
|
|
51620
52009
|
this.config.abortSignal.throwIfAborted();
|
|
51621
|
-
return this.publishPreparedBatch(calls, escalations);
|
|
52010
|
+
return this.publishPreparedBatch(calls, escalations, scratchpadWrites);
|
|
51622
52011
|
}
|
|
51623
52012
|
/**
|
|
51624
52013
|
* A ready call the tool already knows cannot run, answered now instead of
|
|
@@ -51636,8 +52025,8 @@ var ToolExecutor = class {
|
|
|
51636
52025
|
return call2;
|
|
51637
52026
|
const path3 = inputPathOf(call2);
|
|
51638
52027
|
if (path3 !== void 0) {
|
|
51639
|
-
const target =
|
|
51640
|
-
if (earlierPaths.some((p) =>
|
|
52028
|
+
const target = resolve9(this.config.workingDirectory, path3);
|
|
52029
|
+
if (earlierPaths.some((p) => resolve9(this.config.workingDirectory, p) === target))
|
|
51641
52030
|
return call2;
|
|
51642
52031
|
}
|
|
51643
52032
|
try {
|
|
@@ -51705,7 +52094,7 @@ var ToolExecutor = class {
|
|
|
51705
52094
|
const value = input[tool.pathArgument];
|
|
51706
52095
|
if (typeof value === "string") {
|
|
51707
52096
|
const retained = tool.name === "read" && await resolveRetainedOutput(this.outputDirectory(), value);
|
|
51708
|
-
const outside = retained ? void 0 : await pathOutsideRoots(
|
|
52097
|
+
const outside = retained ? void 0 : await pathOutsideRoots(this.rootsNow(), value);
|
|
51709
52098
|
if (outside !== void 0)
|
|
51710
52099
|
outsidePaths = [outside];
|
|
51711
52100
|
}
|
|
@@ -51740,7 +52129,7 @@ var ToolExecutor = class {
|
|
|
51740
52129
|
* file tools' own does.
|
|
51741
52130
|
*/
|
|
51742
52131
|
async pathEscalationsOf(tool, input, sandboxed, shellCwd) {
|
|
51743
|
-
const roots =
|
|
52132
|
+
const roots = this.rootsNow();
|
|
51744
52133
|
const protectedPaths = [];
|
|
51745
52134
|
let outsidePaths = [];
|
|
51746
52135
|
let removal;
|
|
@@ -51799,16 +52188,22 @@ var ToolExecutor = class {
|
|
|
51799
52188
|
}
|
|
51800
52189
|
const calls = new Map(previous.calls);
|
|
51801
52190
|
const escalations = new Map(previous.escalations);
|
|
52191
|
+
const scratchpadWrites = new Set(previous.scratchpadWrites);
|
|
51802
52192
|
const earlierPaths = [];
|
|
51803
52193
|
for (const toolCall of response.message.toolCalls ?? []) {
|
|
51804
52194
|
if (changedCallIds.has(toolCall.id)) {
|
|
51805
52195
|
const call2 = await this.refusedBeforeReview(await prepareDirectCall(this.admissionHost(), toolCall, false), earlierPaths);
|
|
51806
52196
|
calls.set(toolCall.id, call2);
|
|
52197
|
+
this.admitScratchpad(call2);
|
|
51807
52198
|
const escalation = await this.escalationOrUnfinished(call2);
|
|
51808
52199
|
if (escalation)
|
|
51809
52200
|
escalations.set(toolCall.id, escalation);
|
|
51810
52201
|
else
|
|
51811
52202
|
escalations.delete(toolCall.id);
|
|
52203
|
+
if (await this.writesScratchpad(call2, escalation))
|
|
52204
|
+
scratchpadWrites.add(toolCall.id);
|
|
52205
|
+
else
|
|
52206
|
+
scratchpadWrites.delete(toolCall.id);
|
|
51812
52207
|
}
|
|
51813
52208
|
const prepared = calls.get(toolCall.id);
|
|
51814
52209
|
const path3 = prepared ? inputPathOf(prepared) : void 0;
|
|
@@ -51816,9 +52211,9 @@ var ToolExecutor = class {
|
|
|
51816
52211
|
earlierPaths.push(path3);
|
|
51817
52212
|
}
|
|
51818
52213
|
this.config.abortSignal.throwIfAborted();
|
|
51819
|
-
return this.publishPreparedBatch(calls, escalations);
|
|
52214
|
+
return this.publishPreparedBatch(calls, escalations, scratchpadWrites);
|
|
51820
52215
|
}
|
|
51821
|
-
publishPreparedBatch(calls, escalations) {
|
|
52216
|
+
publishPreparedBatch(calls, escalations, scratchpadWrites) {
|
|
51822
52217
|
const reviewCalls = [...calls.values()].filter((call2) => call2.kind !== "synthetic").map((call2) => {
|
|
51823
52218
|
const escalation = escalations.get(call2.toolCall.id);
|
|
51824
52219
|
const hookPermission = call2.hook?.permission;
|
|
@@ -51827,13 +52222,15 @@ var ToolExecutor = class {
|
|
|
51827
52222
|
name: call2.toolName,
|
|
51828
52223
|
input: call2.input,
|
|
51829
52224
|
...escalation ? { escalation } : {},
|
|
51830
|
-
...hookPermission ? { hookPermission } : {}
|
|
52225
|
+
...hookPermission ? { hookPermission } : {},
|
|
52226
|
+
...scratchpadWrites.has(call2.toolCall.id) ? { scratchpadWrite: true } : {}
|
|
51831
52227
|
};
|
|
51832
52228
|
});
|
|
51833
52229
|
const batch = Object.freeze({
|
|
51834
52230
|
reviewCalls: Object.freeze(reviewCalls),
|
|
51835
52231
|
calls: new Map(calls),
|
|
51836
|
-
escalations: new Map(escalations)
|
|
52232
|
+
escalations: new Map(escalations),
|
|
52233
|
+
scratchpadWrites: new Set(scratchpadWrites)
|
|
51837
52234
|
});
|
|
51838
52235
|
this.preparedBatches.add(batch);
|
|
51839
52236
|
return batch;
|
|
@@ -52113,7 +52510,7 @@ var ToolExecutor = class {
|
|
|
52113
52510
|
let failure2;
|
|
52114
52511
|
const settledUnits = /* @__PURE__ */ new Map();
|
|
52115
52512
|
const refusedAfterEnd = "An earlier call in this batch was refused and the turn was stopped, so this call was not run.";
|
|
52116
|
-
await new Promise((
|
|
52513
|
+
await new Promise((resolve35) => {
|
|
52117
52514
|
const start = /* @__PURE__ */ __name((unit) => {
|
|
52118
52515
|
inFlight.add(unit);
|
|
52119
52516
|
let settledUnit;
|
|
@@ -52161,7 +52558,7 @@ var ToolExecutor = class {
|
|
|
52161
52558
|
start(unit);
|
|
52162
52559
|
}
|
|
52163
52560
|
if (cursor >= units.length && inFlight.size === 0)
|
|
52164
|
-
|
|
52561
|
+
resolve35();
|
|
52165
52562
|
}, "pump");
|
|
52166
52563
|
review.ended.addEventListener("abort", pump, { once: true });
|
|
52167
52564
|
pump();
|
|
@@ -52293,6 +52690,7 @@ var ToolExecutor = class {
|
|
|
52293
52690
|
} catch {
|
|
52294
52691
|
needsApproval = true;
|
|
52295
52692
|
}
|
|
52693
|
+
this.admitScratchpad(preparedCall);
|
|
52296
52694
|
const nestedEscalation = await this.escalationOrUnfinished(preparedCall);
|
|
52297
52695
|
if (nestedEscalation || needsApproval || gateResult && gateResult.decision !== "allow") {
|
|
52298
52696
|
const reason2 = nestedEscalation ? "Blocked: this nested call reaches a protected path, removal floor, outside-root boundary or another safety escalation. Call it directly so it can be reviewed." : needsApproval ? `Blocked: "${name2}" requires the person's approval for every call, and an approval cannot be requested from inside another tool. Call it directly.` : gateResult?.decision === "deny" ? `Blocked by the authorization gate: ${gateResult.reason}` : `Blocked by the authorization gate: this nested call requires an explicit allow rule because an operator review cannot be opened from inside another tool. ${gateResult?.reason}`;
|
|
@@ -52476,7 +52874,7 @@ var ToolExecutor = class {
|
|
|
52476
52874
|
sessionId: this.config.sessionId,
|
|
52477
52875
|
turnId: this.config.turnId,
|
|
52478
52876
|
workingDirectory: this.config.workingDirectory,
|
|
52479
|
-
...this.
|
|
52877
|
+
...this.additionalDirectoriesNow()?.length ? { additionalDirectories: this.additionalDirectoriesNow() } : {},
|
|
52480
52878
|
...this.config.authorizationGate ? {
|
|
52481
52879
|
readDenied: /* @__PURE__ */ __name((absolutePath) => this.evaluatePreparedAuthorization("read", { path: absolutePath })?.decision === "deny", "readDenied")
|
|
52482
52880
|
} : {},
|
|
@@ -52927,21 +53325,21 @@ ${note}`;
|
|
|
52927
53325
|
let invocationOpen = true;
|
|
52928
53326
|
const nestedDispatches = /* @__PURE__ */ new Set();
|
|
52929
53327
|
try {
|
|
52930
|
-
const expired = Number.isFinite(timeoutMs) && timeoutMs > 0 ? new Promise((
|
|
53328
|
+
const expired = Number.isFinite(timeoutMs) && timeoutMs > 0 ? new Promise((resolve35) => {
|
|
52931
53329
|
timer = setTimeout(() => {
|
|
52932
53330
|
timedOut = true;
|
|
52933
53331
|
controller.abort(new Error(`Tool "${toolName}" exceeded ${timeoutMs}ms`));
|
|
52934
|
-
|
|
53332
|
+
resolve35("timeout");
|
|
52935
53333
|
}, timeoutMs);
|
|
52936
53334
|
}) : void 0;
|
|
52937
|
-
const aborted = new Promise((
|
|
53335
|
+
const aborted = new Promise((resolve35) => {
|
|
52938
53336
|
if (controller.signal.aborted && !timedOut) {
|
|
52939
|
-
|
|
53337
|
+
resolve35("aborted");
|
|
52940
53338
|
return;
|
|
52941
53339
|
}
|
|
52942
53340
|
controller.signal.addEventListener("abort", () => {
|
|
52943
53341
|
if (!timedOut)
|
|
52944
|
-
|
|
53342
|
+
resolve35("aborted");
|
|
52945
53343
|
}, { once: true });
|
|
52946
53344
|
});
|
|
52947
53345
|
const inheritedDispatch = toolContext.dispatchTool;
|
|
@@ -53490,8 +53888,8 @@ var Semaphore = class {
|
|
|
53490
53888
|
this.available--;
|
|
53491
53889
|
return Promise.resolve();
|
|
53492
53890
|
}
|
|
53493
|
-
return new Promise((
|
|
53494
|
-
this.waiters.push(
|
|
53891
|
+
return new Promise((resolve35) => {
|
|
53892
|
+
this.waiters.push(resolve35);
|
|
53495
53893
|
});
|
|
53496
53894
|
}
|
|
53497
53895
|
release() {
|
|
@@ -54363,8 +54761,8 @@ var PerCallReview = class {
|
|
|
54363
54761
|
async admit(call2) {
|
|
54364
54762
|
const before = this.#line;
|
|
54365
54763
|
let leave;
|
|
54366
|
-
this.#line = new Promise((
|
|
54367
|
-
leave =
|
|
54764
|
+
this.#line = new Promise((resolve35) => {
|
|
54765
|
+
leave = resolve35;
|
|
54368
54766
|
});
|
|
54369
54767
|
try {
|
|
54370
54768
|
const verdict = await this.#decide(call2, before, leave);
|
|
@@ -54714,7 +55112,7 @@ function watchForOperator(ctx, startedAt) {
|
|
|
54714
55112
|
return void 0;
|
|
54715
55113
|
const watching = new AbortController();
|
|
54716
55114
|
let timer;
|
|
54717
|
-
const requested = new Promise((
|
|
55115
|
+
const requested = new Promise((resolve35) => {
|
|
54718
55116
|
const settled = Promise.race(wakes.map((wake) => {
|
|
54719
55117
|
try {
|
|
54720
55118
|
return wake(watching.signal);
|
|
@@ -54728,7 +55126,7 @@ function watchForOperator(ctx, startedAt) {
|
|
|
54728
55126
|
if (watching.signal.aborted)
|
|
54729
55127
|
return;
|
|
54730
55128
|
const wait = Math.max(0, startedAt + DETACH_AFTER_MS - Date.now());
|
|
54731
|
-
timer = setTimeout(
|
|
55129
|
+
timer = setTimeout(resolve35, wait);
|
|
54732
55130
|
},
|
|
54733
55131
|
// An aborted wait is the batch ending, which is not a message.
|
|
54734
55132
|
() => {
|
|
@@ -54807,7 +55205,9 @@ async function* runToolReview(ctx, response, iterationNum) {
|
|
|
54807
55205
|
} : { decision: "review" },
|
|
54808
55206
|
...requiresApproval2 ? { requiresApproval: true } : {},
|
|
54809
55207
|
...escalation ? { escalation } : {},
|
|
54810
|
-
...hookPermission ? { hookPermission } : {}
|
|
55208
|
+
...hookPermission ? { hookPermission } : {},
|
|
55209
|
+
..."scratchpadWrite" in tc && tc.scratchpadWrite ? { scratchpadWrite: true } : {},
|
|
55210
|
+
..."scratchpadWrite" in tc && tc.scratchpadWrite ? { scratchpadWrite: true } : {}
|
|
54811
55211
|
};
|
|
54812
55212
|
});
|
|
54813
55213
|
}, "summariesFor");
|
|
@@ -54984,8 +55384,8 @@ async function* runToolReview(ctx, response, iterationNum) {
|
|
|
54984
55384
|
}
|
|
54985
55385
|
const wakeup = /* @__PURE__ */ __name(() => {
|
|
54986
55386
|
let notify;
|
|
54987
|
-
const promise = new Promise((
|
|
54988
|
-
notify =
|
|
55387
|
+
const promise = new Promise((resolve35) => {
|
|
55388
|
+
notify = resolve35;
|
|
54989
55389
|
});
|
|
54990
55390
|
return { promise, notify };
|
|
54991
55391
|
}, "wakeup");
|
|
@@ -55737,7 +56137,7 @@ function appendRecordedContext(recorder, items, log, at = /* @__PURE__ */ new Da
|
|
|
55737
56137
|
__name(appendRecordedContext, "appendRecordedContext");
|
|
55738
56138
|
|
|
55739
56139
|
// ../sdk/dist/runtime/query/iteration/request-repair.js
|
|
55740
|
-
import { createHash as
|
|
56140
|
+
import { createHash as createHash19 } from "node:crypto";
|
|
55741
56141
|
var MAX_REPAIRS_PER_REQUEST = 5;
|
|
55742
56142
|
var MAX_STRIPS_PER_INDEX = 3;
|
|
55743
56143
|
var GENERIC_MEDIA_LIMITS = [510, 255, 127];
|
|
@@ -55850,7 +56250,7 @@ function isAccepted(chunk) {
|
|
|
55850
56250
|
return Boolean(chunk.delta.content || chunk.delta.toolCalls?.length || chunk.delta.toolCallEnd || chunk.delta.reasoning || chunk.delta.citation || chunk.finishReason !== void 0 || chunk.usage !== void 0 || chunk.replayState !== void 0 || chunk.textParts !== void 0);
|
|
55851
56251
|
}
|
|
55852
56252
|
__name(isAccepted, "isAccepted");
|
|
55853
|
-
var mediaFingerprint = /* @__PURE__ */ __name((data, mediaType) =>
|
|
56253
|
+
var mediaFingerprint = /* @__PURE__ */ __name((data, mediaType) => createHash19("sha256").update(mediaType).update("\0").update(data).digest("hex"), "mediaFingerprint");
|
|
55854
56254
|
var FAULT_NOTE = "the provider could not process it. The file may be unsupported or corrupt; do not retry reading it. If you need to inspect it, use a shell command instead.";
|
|
55855
56255
|
var LIMIT_NOTE = "this conversation holds more files than the provider accepts at once, so the oldest are left out of the request. They are still in the conversation.";
|
|
55856
56256
|
var removedNote = /* @__PURE__ */ __name((kind, limit) => `[${kind} removed: ${limit ? LIMIT_NOTE : FAULT_NOTE}]`, "removedNote");
|
|
@@ -59914,7 +60314,7 @@ async function awaitStoreRead(signal, start) {
|
|
|
59914
60314
|
if (!signal)
|
|
59915
60315
|
return await start();
|
|
59916
60316
|
signal.throwIfAborted();
|
|
59917
|
-
return new Promise((
|
|
60317
|
+
return new Promise((resolve35, reject2) => {
|
|
59918
60318
|
let settled = false;
|
|
59919
60319
|
const cleanup = /* @__PURE__ */ __name(() => signal.removeEventListener("abort", onAbort), "cleanup");
|
|
59920
60320
|
const rejectOnce = /* @__PURE__ */ __name((reason2) => {
|
|
@@ -59929,7 +60329,7 @@ async function awaitStoreRead(signal, start) {
|
|
|
59929
60329
|
return;
|
|
59930
60330
|
settled = true;
|
|
59931
60331
|
cleanup();
|
|
59932
|
-
|
|
60332
|
+
resolve35(value);
|
|
59933
60333
|
}, "resolveOnce");
|
|
59934
60334
|
const onAbort = /* @__PURE__ */ __name(() => rejectOnce(signal.reason), "onAbort");
|
|
59935
60335
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
@@ -60529,10 +60929,10 @@ var TurnContextFactory = class _TurnContextFactory {
|
|
|
60529
60929
|
|
|
60530
60930
|
// ../sdk/dist/store/evidence/disk.js
|
|
60531
60931
|
import { lstat as lstat4 } from "node:fs/promises";
|
|
60532
|
-
import { resolve as
|
|
60932
|
+
import { resolve as resolve10 } from "node:path";
|
|
60533
60933
|
|
|
60534
60934
|
// ../sdk/dist/store/evidence/index-page.js
|
|
60535
|
-
import { createHash as
|
|
60935
|
+
import { createHash as createHash20, createHmac as createHmac2, timingSafeEqual as timingSafeEqual2 } from "node:crypto";
|
|
60536
60936
|
|
|
60537
60937
|
// ../sdk/dist/store/evidence/compaction-provenance.js
|
|
60538
60938
|
function record(value) {
|
|
@@ -60647,7 +61047,7 @@ var positionSchema = external_exports.object({
|
|
|
60647
61047
|
textIndex: integer2.default(0)
|
|
60648
61048
|
});
|
|
60649
61049
|
function evidenceSeal(sessionStart, sourceKey) {
|
|
60650
|
-
const key6 =
|
|
61050
|
+
const key6 = createHash20("sha256").update("namzu-session-evidence-v1\n").update(sessionStart).digest();
|
|
60651
61051
|
const mac = /* @__PURE__ */ __name((value) => createHmac2("sha256", key6).update(`${sourceKey}
|
|
60652
61052
|
${value}`).digest(), "mac");
|
|
60653
61053
|
return {
|
|
@@ -61224,7 +61624,7 @@ function createSource(options, mode, anchor) {
|
|
|
61224
61624
|
const consistency = external_exports.enum(["closed", "snapshot"]).parse(options.consistency ?? "closed");
|
|
61225
61625
|
const maxReadBytes = external_exports.number().int().min(1024 * 1024).max(PAGE_BYTES).parse(options.maxReadBytes ?? PAGE_BYTES);
|
|
61226
61626
|
const scope = Object.freeze(scopeSchema.parse(options.scope));
|
|
61227
|
-
const logPath =
|
|
61627
|
+
const logPath = resolve10(options.logPath);
|
|
61228
61628
|
if (!logPath.endsWith(".jsonl"))
|
|
61229
61629
|
throw new Error("A session log path ends in .jsonl.");
|
|
61230
61630
|
const sessionDir = logPath.slice(0, -".jsonl".length);
|
|
@@ -61507,14 +61907,27 @@ var EventTranslator = class {
|
|
|
61507
61907
|
this.recorder = recorder;
|
|
61508
61908
|
this.probes = probeRegistry;
|
|
61509
61909
|
this.log = resolveLogger(log).child({ [SCOPE_ATTRIBUTE]: "runtime/query/events" });
|
|
61910
|
+
recorder.onLogWriteHealth((change) => {
|
|
61911
|
+
void this.emitEvent(change.state === "degraded" ? {
|
|
61912
|
+
type: "session_log_degraded",
|
|
61913
|
+
cause: change.cause,
|
|
61914
|
+
bufferedRecords: change.bufferedRecords,
|
|
61915
|
+
bufferedBytes: change.bufferedBytes,
|
|
61916
|
+
...change.dropping ? { dropping: true } : {}
|
|
61917
|
+
} : {
|
|
61918
|
+
type: "session_log_recovered",
|
|
61919
|
+
flushedRecords: change.flushedRecords,
|
|
61920
|
+
droppedRecords: change.droppedRecords
|
|
61921
|
+
});
|
|
61922
|
+
});
|
|
61510
61923
|
}
|
|
61511
61924
|
/** Serializes appends and reads against each other. */
|
|
61512
61925
|
appendChain = Promise.resolve();
|
|
61513
61926
|
async withLogLock(operation) {
|
|
61514
61927
|
const previous = this.appendChain;
|
|
61515
61928
|
let release2;
|
|
61516
|
-
this.appendChain = new Promise((
|
|
61517
|
-
release2 =
|
|
61929
|
+
this.appendChain = new Promise((resolve35) => {
|
|
61930
|
+
release2 = resolve35;
|
|
61518
61931
|
});
|
|
61519
61932
|
try {
|
|
61520
61933
|
await previous;
|
|
@@ -61874,12 +62287,12 @@ var PreludeSessionLease = class _PreludeSessionLease {
|
|
|
61874
62287
|
|
|
61875
62288
|
// ../sdk/dist/runtime/query/session-storage.js
|
|
61876
62289
|
import { readdir as readdir5, realpath as realpath5 } from "node:fs/promises";
|
|
61877
|
-
import { basename as basename7, dirname as dirname15, join as join21, resolve as
|
|
62290
|
+
import { basename as basename7, dirname as dirname15, join as join21, resolve as resolve12 } from "node:path";
|
|
61878
62291
|
|
|
61879
62292
|
// ../sdk/dist/session/home.js
|
|
61880
62293
|
import { lstatSync as lstatSync2, realpathSync as realpathSync2 } from "node:fs";
|
|
61881
62294
|
import { homedir as homedir3 } from "node:os";
|
|
61882
|
-
import { parse as parse2, resolve as
|
|
62295
|
+
import { parse as parse2, resolve as resolve11 } from "node:path";
|
|
61883
62296
|
var NamzuHomeError = class extends Error {
|
|
61884
62297
|
static {
|
|
61885
62298
|
__name(this, "NamzuHomeError");
|
|
@@ -61890,7 +62303,7 @@ function resolveNamzuHome(options = {}) {
|
|
|
61890
62303
|
const env = options.env ?? process.env;
|
|
61891
62304
|
const configured = env.NAMZU_HOME;
|
|
61892
62305
|
if (configured === void 0 || configured.length === 0) {
|
|
61893
|
-
return
|
|
62306
|
+
return resolve11(options.home ?? homedir3(), ".namzu");
|
|
61894
62307
|
}
|
|
61895
62308
|
if (configured.includes("\0")) {
|
|
61896
62309
|
throw new NamzuHomeError("NAMZU_HOME contains a NUL byte and cannot name a directory.");
|
|
@@ -62778,7 +63191,7 @@ var InMemorySessionTokenBudgetStore = class {
|
|
|
62778
63191
|
};
|
|
62779
63192
|
|
|
62780
63193
|
// ../sdk/dist/store/checkpoint/contract.js
|
|
62781
|
-
import { createHash as
|
|
63194
|
+
import { createHash as createHash21 } from "node:crypto";
|
|
62782
63195
|
var CheckpointIntegrityError = class extends Error {
|
|
62783
63196
|
static {
|
|
62784
63197
|
__name(this, "CheckpointIntegrityError");
|
|
@@ -62812,10 +63225,10 @@ function serializeCheckpoint(checkpoint) {
|
|
|
62812
63225
|
`;
|
|
62813
63226
|
}
|
|
62814
63227
|
__name(serializeCheckpoint, "serializeCheckpoint");
|
|
62815
|
-
function
|
|
62816
|
-
return
|
|
63228
|
+
function sha256Hex5(text10) {
|
|
63229
|
+
return createHash21("sha256").update(text10, "utf8").digest("hex");
|
|
62817
63230
|
}
|
|
62818
|
-
__name(
|
|
63231
|
+
__name(sha256Hex5, "sha256Hex");
|
|
62819
63232
|
function checkpointRecordPath(checkpointId4) {
|
|
62820
63233
|
return `checkpoints/${asCheckpointId(checkpointId4)}.json`;
|
|
62821
63234
|
}
|
|
@@ -62849,7 +63262,7 @@ function writeReceipt(checkpoint, text10) {
|
|
|
62849
63262
|
throughSeq: checkpoint.throughSeq,
|
|
62850
63263
|
throughSha256: checkpoint.throughSha256,
|
|
62851
63264
|
path: checkpointRecordPath(checkpoint.checkpointId),
|
|
62852
|
-
docSha256:
|
|
63265
|
+
docSha256: sha256Hex5(text10)
|
|
62853
63266
|
};
|
|
62854
63267
|
}
|
|
62855
63268
|
__name(writeReceipt, "writeReceipt");
|
|
@@ -62857,7 +63270,7 @@ async function verifyCheckpoint(log, scope, checkpoint, text10) {
|
|
|
62857
63270
|
const recorded = await log.writtenDocSha256(scope, checkpoint.checkpointId);
|
|
62858
63271
|
if (recorded === null)
|
|
62859
63272
|
throw new CheckpointIntegrityError(checkpoint.checkpointId, "not-recorded");
|
|
62860
|
-
if (recorded !==
|
|
63273
|
+
if (recorded !== sha256Hex5(text10)) {
|
|
62861
63274
|
throw new CheckpointIntegrityError(checkpoint.checkpointId, "document-mismatch");
|
|
62862
63275
|
}
|
|
62863
63276
|
if (!await log.verifyThrough(scope, checkpoint.throughSeq, checkpoint.throughSha256)) {
|
|
@@ -63141,7 +63554,7 @@ async function placeInLayout(paths2, log) {
|
|
|
63141
63554
|
}
|
|
63142
63555
|
__name(placeInLayout, "placeInLayout");
|
|
63143
63556
|
async function canonicalPath(path3) {
|
|
63144
|
-
let existing =
|
|
63557
|
+
let existing = resolve12(path3);
|
|
63145
63558
|
let remainder = "";
|
|
63146
63559
|
for (; ; ) {
|
|
63147
63560
|
const found = await realpath5(existing).catch(() => void 0);
|
|
@@ -63149,7 +63562,7 @@ async function canonicalPath(path3) {
|
|
|
63149
63562
|
return remainder ? join21(found, remainder) : found;
|
|
63150
63563
|
const parent = dirname15(existing);
|
|
63151
63564
|
if (parent === existing)
|
|
63152
|
-
return
|
|
63565
|
+
return resolve12(path3);
|
|
63153
63566
|
remainder = remainder ? join21(basename7(existing), remainder) : basename7(existing);
|
|
63154
63567
|
existing = parent;
|
|
63155
63568
|
}
|
|
@@ -63360,8 +63773,8 @@ async function resolveProviderContextWindow(provider, model, signal, timeoutMs,
|
|
|
63360
63773
|
const resolverSignal = signal ? AbortSignal.any([signal, deadline.signal]) : deadline.signal;
|
|
63361
63774
|
const interrupted = /* @__PURE__ */ Symbol("provider-context-window-interrupted");
|
|
63362
63775
|
let onAbort;
|
|
63363
|
-
const interruption = new Promise((
|
|
63364
|
-
onAbort = /* @__PURE__ */ __name(() =>
|
|
63776
|
+
const interruption = new Promise((resolve35) => {
|
|
63777
|
+
onAbort = /* @__PURE__ */ __name(() => resolve35(interrupted), "onAbort");
|
|
63365
63778
|
resolverSignal.addEventListener("abort", onAbort, { once: true });
|
|
63366
63779
|
});
|
|
63367
63780
|
const deadlineMs = timeoutMs === 0 ? 5e3 : Math.min(Math.max(0, timeoutMs), 2147483647);
|
|
@@ -64212,6 +64625,7 @@ var ToolingBootstrap = class {
|
|
|
64212
64625
|
turnId: config.turnId,
|
|
64213
64626
|
workingDirectory: config.workingDirectory,
|
|
64214
64627
|
...config.additionalDirectories?.length ? { additionalDirectories: config.additionalDirectories } : {},
|
|
64628
|
+
...config.scratchpadDirectory ? { scratchpadDirectory: config.scratchpadDirectory } : {},
|
|
64215
64629
|
...config.outsideRootAccess ? { outsideRootAccess: config.outsideRootAccess } : {},
|
|
64216
64630
|
...config.sandboxEscape ? { sandboxEscape: config.sandboxEscape } : {},
|
|
64217
64631
|
permissionMode: config.permissionMode,
|
|
@@ -64519,6 +64933,14 @@ async function* query(params) {
|
|
|
64519
64933
|
}
|
|
64520
64934
|
}, "collectJob");
|
|
64521
64935
|
const skillGrants = new SkillGrantSet();
|
|
64936
|
+
let scratchpadDirectory;
|
|
64937
|
+
if (!params.sandboxProvider) {
|
|
64938
|
+
try {
|
|
64939
|
+
scratchpadDirectory = ctx.storage.paths?.scratchpadPath(ctx.sessionId);
|
|
64940
|
+
} catch {
|
|
64941
|
+
scratchpadDirectory = void 0;
|
|
64942
|
+
}
|
|
64943
|
+
}
|
|
64522
64944
|
const toolExecutor = ToolingBootstrap.init({
|
|
64523
64945
|
skillGrants,
|
|
64524
64946
|
tools: toolManager,
|
|
@@ -64527,6 +64949,7 @@ async function* query(params) {
|
|
|
64527
64949
|
turnId: ctx.turnId,
|
|
64528
64950
|
workingDirectory: ctx.cwd,
|
|
64529
64951
|
...params.additionalDirectories?.length ? { additionalDirectories: params.additionalDirectories } : {},
|
|
64952
|
+
...scratchpadDirectory ? { scratchpadDirectory } : {},
|
|
64530
64953
|
...params.outsideRootAccess ? { outsideRootAccess: params.outsideRootAccess } : {},
|
|
64531
64954
|
...params.sandboxEscape ? { sandboxEscape: params.sandboxEscape } : {},
|
|
64532
64955
|
permissionMode: /* @__PURE__ */ __name(() => ctx.permissionMode.current, "permissionMode"),
|
|
@@ -65544,8 +65967,8 @@ function createMockBidiProvider(script = {}) {
|
|
|
65544
65967
|
}
|
|
65545
65968
|
if (done)
|
|
65546
65969
|
return;
|
|
65547
|
-
await new Promise((
|
|
65548
|
-
wake =
|
|
65970
|
+
await new Promise((resolve35) => {
|
|
65971
|
+
wake = resolve35;
|
|
65549
65972
|
});
|
|
65550
65973
|
wake = void 0;
|
|
65551
65974
|
}
|
|
@@ -65813,8 +66236,8 @@ async function startBidiTurn(params) {
|
|
|
65813
66236
|
}
|
|
65814
66237
|
if (closed)
|
|
65815
66238
|
return;
|
|
65816
|
-
await new Promise((
|
|
65817
|
-
wake =
|
|
66239
|
+
await new Promise((resolve35) => {
|
|
66240
|
+
wake = resolve35;
|
|
65818
66241
|
});
|
|
65819
66242
|
wake = void 0;
|
|
65820
66243
|
}
|
|
@@ -65837,7 +66260,7 @@ async function startBidiTurn(params) {
|
|
|
65837
66260
|
__name(startBidiTurn, "startBidiTurn");
|
|
65838
66261
|
|
|
65839
66262
|
// ../sdk/dist/runtime/query/prompt-cache.js
|
|
65840
|
-
import { createHash as
|
|
66263
|
+
import { createHash as createHash22 } from "node:crypto";
|
|
65841
66264
|
var PromptCache = class {
|
|
65842
66265
|
static {
|
|
65843
66266
|
__name(this, "PromptCache");
|
|
@@ -65912,7 +66335,7 @@ var PromptCache = class {
|
|
|
65912
66335
|
this.cachedStaticHash = void 0;
|
|
65913
66336
|
}
|
|
65914
66337
|
computeStaticHash(staticSegment) {
|
|
65915
|
-
return
|
|
66338
|
+
return createHash22("sha256").update(staticSegment).digest("hex").slice(0, 16);
|
|
65916
66339
|
}
|
|
65917
66340
|
computeConfigHash(input, prompt) {
|
|
65918
66341
|
const parts = [
|
|
@@ -65922,7 +66345,7 @@ var PromptCache = class {
|
|
|
65922
66345
|
// unsegmented text happens to be identical.
|
|
65923
66346
|
input.contributions?.list().map((c) => [c.id, c.placement]) ?? []
|
|
65924
66347
|
];
|
|
65925
|
-
return
|
|
66348
|
+
return createHash22("sha256").update(JSON.stringify(parts)).digest("hex").slice(0, 16);
|
|
65926
66349
|
}
|
|
65927
66350
|
};
|
|
65928
66351
|
|
|
@@ -68815,6 +69238,8 @@ function createTurnReporter(parentLogger) {
|
|
|
68815
69238
|
case "tool_calls_admitted":
|
|
68816
69239
|
case "compaction_shed":
|
|
68817
69240
|
case "compaction_started":
|
|
69241
|
+
case "session_log_degraded":
|
|
69242
|
+
case "session_log_recovered":
|
|
68818
69243
|
break;
|
|
68819
69244
|
default: {
|
|
68820
69245
|
const _exhaustive = event;
|
|
@@ -68845,10 +69270,10 @@ __name(createTurnReporter, "createTurnReporter");
|
|
|
68845
69270
|
|
|
68846
69271
|
// ../sdk/dist/turn/drain.js
|
|
68847
69272
|
var DEFAULT_DRAIN_PAGE_SIZE = 100;
|
|
68848
|
-
function
|
|
69273
|
+
function refuse2(code, message, details) {
|
|
68849
69274
|
throw new NamzuError({ code, message, details });
|
|
68850
69275
|
}
|
|
68851
|
-
__name(
|
|
69276
|
+
__name(refuse2, "refuse");
|
|
68852
69277
|
function toMessage(err) {
|
|
68853
69278
|
return err instanceof Error ? err.message : String(err);
|
|
68854
69279
|
}
|
|
@@ -68895,14 +69320,14 @@ __name(describeTurn, "describeTurn");
|
|
|
68895
69320
|
async function drainParkedTurns(params) {
|
|
68896
69321
|
const { index, tenantId: tenantId2, holder, ttlMs, onTurn, park, signal } = params;
|
|
68897
69322
|
if (holder.trim().length === 0) {
|
|
68898
|
-
|
|
69323
|
+
refuse2("invalid_config", "drainParkedTurns: `holder` is empty. Use something per-process \u2014 a worker id, a pod name plus a pid.", { holder });
|
|
68899
69324
|
}
|
|
68900
69325
|
if (!Number.isFinite(ttlMs) || ttlMs <= 0) {
|
|
68901
|
-
|
|
69326
|
+
refuse2("invalid_config", `drainParkedTurns: ttlMs must be a positive number of milliseconds, got ${String(ttlMs)}. A lease that expires immediately is a lease every worker can take at once.`, { ttlMs });
|
|
68902
69327
|
}
|
|
68903
69328
|
const maxConcurrent = params.maxConcurrent ?? 1;
|
|
68904
69329
|
if (!Number.isInteger(maxConcurrent) || maxConcurrent < 1) {
|
|
68905
|
-
|
|
69330
|
+
refuse2("invalid_config", `drainParkedTurns: maxConcurrent must be a positive integer, got ${String(params.maxConcurrent)}.`, { maxConcurrent: params.maxConcurrent });
|
|
68906
69331
|
}
|
|
68907
69332
|
const pageSize = params.pageSize ?? DEFAULT_DRAIN_PAGE_SIZE;
|
|
68908
69333
|
const openLog = params.openLog ?? ((sessionId5, logPath) => new DiskSessionLog({ sessionId: sessionId5, file: logPath, sessionDir: logPath.replace(/\.jsonl$/, "") }));
|
|
@@ -68987,7 +69412,7 @@ __name(drainParkedTurns, "drainParkedTurns");
|
|
|
68987
69412
|
// ../sdk/dist/execution/local.js
|
|
68988
69413
|
import { spawn as spawn2 } from "node:child_process";
|
|
68989
69414
|
import { existsSync as existsSync4 } from "node:fs";
|
|
68990
|
-
import { resolve as
|
|
69415
|
+
import { resolve as resolve13 } from "node:path";
|
|
68991
69416
|
|
|
68992
69417
|
// ../sdk/dist/execution/base.js
|
|
68993
69418
|
var InitializationSupersededError = class extends Error {
|
|
@@ -69278,7 +69703,7 @@ var LocalExecutionContext = class extends BaseExecutionContext {
|
|
|
69278
69703
|
constructor(options) {
|
|
69279
69704
|
super(options.log);
|
|
69280
69705
|
this.id = options.id;
|
|
69281
|
-
this.cwd =
|
|
69706
|
+
this.cwd = resolve13(options.cwd);
|
|
69282
69707
|
this.fsAccess = options.fsAccess ?? true;
|
|
69283
69708
|
this.envVars = options.envVars ?? {};
|
|
69284
69709
|
this.capabilities = options.capabilities ?? ["filesystem", "process", "shell"];
|
|
@@ -69314,7 +69739,7 @@ var LocalExecutionContext = class extends BaseExecutionContext {
|
|
|
69314
69739
|
return this.cwd;
|
|
69315
69740
|
}
|
|
69316
69741
|
setCwd(newCwd) {
|
|
69317
|
-
const resolved2 =
|
|
69742
|
+
const resolved2 = resolve13(newCwd);
|
|
69318
69743
|
if (!existsSync4(resolved2)) {
|
|
69319
69744
|
throw new Error(`Working directory does not exist: ${resolved2}`);
|
|
69320
69745
|
}
|
|
@@ -69324,7 +69749,7 @@ var LocalExecutionContext = class extends BaseExecutionContext {
|
|
|
69324
69749
|
return this.fsAccess;
|
|
69325
69750
|
}
|
|
69326
69751
|
resolvePath(relativePath) {
|
|
69327
|
-
return
|
|
69752
|
+
return resolve13(this.cwd, relativePath);
|
|
69328
69753
|
}
|
|
69329
69754
|
getEnvVar(key6) {
|
|
69330
69755
|
return this.envVars[key6] ?? process.env[key6];
|
|
@@ -69352,7 +69777,7 @@ var LocalExecutionContext = class extends BaseExecutionContext {
|
|
|
69352
69777
|
durationMs: 0
|
|
69353
69778
|
};
|
|
69354
69779
|
}
|
|
69355
|
-
const cwd = options?.cwd ?
|
|
69780
|
+
const cwd = options?.cwd ? resolve13(this.cwd, options.cwd) : this.cwd;
|
|
69356
69781
|
const env = { ...process.env, ...this.envVars, ...options?.env };
|
|
69357
69782
|
const timeoutMs = options?.timeoutMs ?? LOCAL_COMMAND_DEFAULT_TIMEOUT_MS;
|
|
69358
69783
|
if (!Number.isInteger(timeoutMs) || timeoutMs < 0) {
|
|
@@ -69482,7 +69907,7 @@ var LocalExecutionContext = class extends BaseExecutionContext {
|
|
|
69482
69907
|
};
|
|
69483
69908
|
|
|
69484
69909
|
// ../sdk/dist/turn/workspace-fingerprint.js
|
|
69485
|
-
import { createHash as
|
|
69910
|
+
import { createHash as createHash23 } from "node:crypto";
|
|
69486
69911
|
import { lstat as lstat5, readFile as readFile12, readlink } from "node:fs/promises";
|
|
69487
69912
|
import { join as join25 } from "node:path";
|
|
69488
69913
|
var NODE_FS = { lstat: lstat5, readlink, readFile: readFile12 };
|
|
@@ -69498,7 +69923,7 @@ async function untrackedEntry(cwd, rel, fs) {
|
|
|
69498
69923
|
if (!stats.isFile())
|
|
69499
69924
|
return `? ${rel}`;
|
|
69500
69925
|
const body = await fs.readFile(abs);
|
|
69501
|
-
return `F ${rel}\0${
|
|
69926
|
+
return `F ${rel}\0${createHash23("sha256").update(body).digest("hex")}`;
|
|
69502
69927
|
} catch {
|
|
69503
69928
|
return null;
|
|
69504
69929
|
}
|
|
@@ -69543,7 +69968,7 @@ async function fingerprintWorkspace(options) {
|
|
|
69543
69968
|
return null;
|
|
69544
69969
|
parts.push(entry);
|
|
69545
69970
|
}
|
|
69546
|
-
const hash2 =
|
|
69971
|
+
const hash2 = createHash23("sha256");
|
|
69547
69972
|
for (const part2 of parts)
|
|
69548
69973
|
hash2.update(`${Buffer.byteLength(part2, "utf8")}:${part2}`);
|
|
69549
69974
|
return hash2.digest("hex");
|
|
@@ -69873,7 +70298,7 @@ var InMemoryMemoryIndex = class {
|
|
|
69873
70298
|
};
|
|
69874
70299
|
|
|
69875
70300
|
// ../sdk/dist/store/memory/naming.js
|
|
69876
|
-
import { sep as
|
|
70301
|
+
import { sep as sep6 } from "node:path";
|
|
69877
70302
|
|
|
69878
70303
|
// ../sdk/dist/types/memory/index.js
|
|
69879
70304
|
function assertMemoryStatus(status) {
|
|
@@ -70040,7 +70465,7 @@ function withOptionalFields(entry, fields2) {
|
|
|
70040
70465
|
}
|
|
70041
70466
|
__name(withOptionalFields, "withOptionalFields");
|
|
70042
70467
|
function entryPath(dir, stem, extension) {
|
|
70043
|
-
return dir +
|
|
70468
|
+
return dir + sep6 + stem + extension;
|
|
70044
70469
|
}
|
|
70045
70470
|
__name(entryPath, "entryPath");
|
|
70046
70471
|
|
|
@@ -70315,7 +70740,7 @@ function createMemoryRecallStep(options) {
|
|
|
70315
70740
|
__name(createMemoryRecallStep, "createMemoryRecallStep");
|
|
70316
70741
|
|
|
70317
70742
|
// ../sdk/dist/turn/json-claim-verifier.js
|
|
70318
|
-
import { createHash as
|
|
70743
|
+
import { createHash as createHash24, randomUUID as randomUUID5 } from "node:crypto";
|
|
70319
70744
|
import { performance as performance2 } from "node:perf_hooks";
|
|
70320
70745
|
function scalar(value) {
|
|
70321
70746
|
return value === null || typeof value === "boolean" || typeof value === "string" && value.length <= 2e3 || typeof value === "number" && Number.isSafeInteger(value);
|
|
@@ -70448,7 +70873,7 @@ function createJsonClaimVerifier(options) {
|
|
|
70448
70873
|
requestId: request.requestId,
|
|
70449
70874
|
observedAt: observation.observedAt,
|
|
70450
70875
|
bytes: bytes.byteLength,
|
|
70451
|
-
sha256:
|
|
70876
|
+
sha256: createHash24("sha256").update(bytes).digest("hex")
|
|
70452
70877
|
});
|
|
70453
70878
|
}
|
|
70454
70879
|
ensureActive();
|
|
@@ -71898,7 +72323,7 @@ import { pathToFileURL } from "node:url";
|
|
|
71898
72323
|
|
|
71899
72324
|
// ../sdk/dist/directory/scan.js
|
|
71900
72325
|
import { lstat as lstat6, readdir as readdir9, realpath as realpath6 } from "node:fs/promises";
|
|
71901
|
-
import { basename as basename10, extname as extname3, join as join28, relative as
|
|
72326
|
+
import { basename as basename10, extname as extname3, join as join28, relative as relative5, sep as sep7 } from "node:path";
|
|
71902
72327
|
var CODE_EXTENSIONS = /* @__PURE__ */ new Set([".ts", ".mts", ".cts", ".js", ".mjs", ".cjs"]);
|
|
71903
72328
|
async function scanSlot(root, slot, dirName) {
|
|
71904
72329
|
const dir = join28(root, dirName);
|
|
@@ -71963,7 +72388,7 @@ async function scanSlot(root, slot, dirName) {
|
|
|
71963
72388
|
}
|
|
71964
72389
|
let contained2;
|
|
71965
72390
|
try {
|
|
71966
|
-
contained2 = await resolveWithinReal(root,
|
|
72391
|
+
contained2 = await resolveWithinReal(root, relative5(root, candidate));
|
|
71967
72392
|
} catch {
|
|
71968
72393
|
diagnostics.push({
|
|
71969
72394
|
code: "path_escapes_root",
|
|
@@ -72007,8 +72432,8 @@ var ALL_SLOTS = [
|
|
|
72007
72432
|
var DEFAULT_MODULE_TIMEOUT_MS = 1e4;
|
|
72008
72433
|
async function importWithDeadline(fileUrl, importModule, timeoutMs) {
|
|
72009
72434
|
let timer;
|
|
72010
|
-
const deadline = new Promise((
|
|
72011
|
-
timer = setTimeout(() =>
|
|
72435
|
+
const deadline = new Promise((resolve35) => {
|
|
72436
|
+
timer = setTimeout(() => resolve35({ status: "abandoned" }), timeoutMs);
|
|
72012
72437
|
});
|
|
72013
72438
|
try {
|
|
72014
72439
|
const result = await Promise.race([
|
|
@@ -72462,7 +72887,7 @@ async function resolveForRun(entry, context2) {
|
|
|
72462
72887
|
if (!context2.signal)
|
|
72463
72888
|
return await entry.forRun(context2);
|
|
72464
72889
|
const signal = context2.signal;
|
|
72465
|
-
return await new Promise((
|
|
72890
|
+
return await new Promise((resolve35, reject2) => {
|
|
72466
72891
|
const onAbort = /* @__PURE__ */ __name(() => {
|
|
72467
72892
|
signal.removeEventListener("abort", onAbort);
|
|
72468
72893
|
reject2(signal.reason);
|
|
@@ -72472,7 +72897,7 @@ async function resolveForRun(entry, context2) {
|
|
|
72472
72897
|
onAbort();
|
|
72473
72898
|
return;
|
|
72474
72899
|
}
|
|
72475
|
-
Promise.resolve().then(() => entry.forRun(context2)).then(
|
|
72900
|
+
Promise.resolve().then(() => entry.forRun(context2)).then(resolve35, reject2).finally(() => signal.removeEventListener("abort", onAbort));
|
|
72476
72901
|
});
|
|
72477
72902
|
}
|
|
72478
72903
|
__name(resolveForRun, "resolveForRun");
|
|
@@ -75086,15 +75511,15 @@ var DiskTaskStore = class {
|
|
|
75086
75511
|
break;
|
|
75087
75512
|
await existing.catch(() => void 0);
|
|
75088
75513
|
}
|
|
75089
|
-
let
|
|
75514
|
+
let resolve35;
|
|
75090
75515
|
const lock = new Promise((r) => {
|
|
75091
|
-
|
|
75516
|
+
resolve35 = r;
|
|
75092
75517
|
});
|
|
75093
75518
|
this.locks.set(taskId, lock);
|
|
75094
75519
|
try {
|
|
75095
75520
|
return await fn();
|
|
75096
75521
|
} finally {
|
|
75097
|
-
|
|
75522
|
+
resolve35?.();
|
|
75098
75523
|
if (this.locks.get(taskId) === lock) {
|
|
75099
75524
|
this.locks.delete(taskId);
|
|
75100
75525
|
}
|
|
@@ -75413,7 +75838,7 @@ var DiskTaskStore = class {
|
|
|
75413
75838
|
};
|
|
75414
75839
|
|
|
75415
75840
|
// ../sdk/dist/store/memory/revision.js
|
|
75416
|
-
import { createHash as
|
|
75841
|
+
import { createHash as createHash25 } from "node:crypto";
|
|
75417
75842
|
var MemoryRevisionUnavailableError = class extends Error {
|
|
75418
75843
|
static {
|
|
75419
75844
|
__name(this, "MemoryRevisionUnavailableError");
|
|
@@ -75519,7 +75944,7 @@ function canonicalRecord(record3) {
|
|
|
75519
75944
|
}
|
|
75520
75945
|
__name(canonicalRecord, "canonicalRecord");
|
|
75521
75946
|
function memoryRevision(record3) {
|
|
75522
|
-
return `m2:${
|
|
75947
|
+
return `m2:${createHash25("sha256").update(canonicalRecord(record3)).digest("hex")}`;
|
|
75523
75948
|
}
|
|
75524
75949
|
__name(memoryRevision, "memoryRevision");
|
|
75525
75950
|
var MemoryRevisionConflictError = class extends NamzuError {
|
|
@@ -75671,7 +76096,7 @@ var InMemoryMemoryStore = class {
|
|
|
75671
76096
|
|
|
75672
76097
|
// ../sdk/dist/store/memory/disk.js
|
|
75673
76098
|
import { mkdir as mkdir14, realpath as realpath7, unlink as unlink11 } from "node:fs/promises";
|
|
75674
|
-
import { dirname as dirname17, join as join31, resolve as
|
|
76099
|
+
import { dirname as dirname17, join as join31, resolve as resolve14 } from "node:path";
|
|
75675
76100
|
|
|
75676
76101
|
// ../sdk/dist/store/memory/operation-lock.js
|
|
75677
76102
|
import { randomUUID as randomUUID6 } from "node:crypto";
|
|
@@ -75924,9 +76349,9 @@ function invalidContent(id3, reason2, details = {}) {
|
|
|
75924
76349
|
});
|
|
75925
76350
|
}
|
|
75926
76351
|
__name(invalidContent, "invalidContent");
|
|
75927
|
-
function assertStorageMemoryId(value,
|
|
76352
|
+
function assertStorageMemoryId(value, refuse5) {
|
|
75928
76353
|
if (!isEntityId(value, "memory")) {
|
|
75929
|
-
|
|
76354
|
+
refuse5("id must be a UUID; prefixed memory IDs are not supported");
|
|
75930
76355
|
}
|
|
75931
76356
|
}
|
|
75932
76357
|
__name(assertStorageMemoryId, "assertStorageMemoryId");
|
|
@@ -76020,7 +76445,7 @@ var DiskMemoryStore = class {
|
|
|
76020
76445
|
records = new DiskRecordStore(SCHEMA6);
|
|
76021
76446
|
indexRecords = new DiskRecordStore(SCHEMA6);
|
|
76022
76447
|
constructor(config) {
|
|
76023
|
-
this.baseDir = config.directory === void 0 ? join31(config.baseDir, "memory") :
|
|
76448
|
+
this.baseDir = config.directory === void 0 ? join31(config.baseDir, "memory") : resolve14(config.directory);
|
|
76024
76449
|
this.log = resolveLogger(config.logger).child({ [SCOPE_ATTRIBUTE]: "store/memory/disk" });
|
|
76025
76450
|
this.lockTimeoutMs = config.lockTimeoutMs ?? DEFAULT_MEMORY_LOCK_TIMEOUT_MS;
|
|
76026
76451
|
validateMemoryLockTimeout(this.lockTimeoutMs);
|
|
@@ -76047,7 +76472,7 @@ var DiskMemoryStore = class {
|
|
|
76047
76472
|
}
|
|
76048
76473
|
contentPath(location, id3) {
|
|
76049
76474
|
assertStorageMemoryId(id3, (reason2) => invalidContent(id3, reason2, { field: "id" }));
|
|
76050
|
-
const path3 =
|
|
76475
|
+
const path3 = resolve14(entryPath(location.contentDir, id3, ".json"));
|
|
76051
76476
|
if (dirname17(path3) !== location.contentDir) {
|
|
76052
76477
|
invalidContent(id3, "resolved path escapes the content directory", { field: "id" });
|
|
76053
76478
|
}
|
|
@@ -76279,9 +76704,9 @@ var DiskMemoryStore = class {
|
|
|
76279
76704
|
};
|
|
76280
76705
|
|
|
76281
76706
|
// ../sdk/dist/store/memory/markdown.js
|
|
76282
|
-
import { createHash as
|
|
76707
|
+
import { createHash as createHash26 } from "node:crypto";
|
|
76283
76708
|
import { lstat as lstat8, mkdir as mkdir15, readFile as readFile17, readdir as readdir11, realpath as realpath8, rename as rename6, unlink as unlink12 } from "node:fs/promises";
|
|
76284
|
-
import { dirname as dirname18, join as join32, resolve as
|
|
76709
|
+
import { dirname as dirname18, join as join32, resolve as resolve15 } from "node:path";
|
|
76285
76710
|
|
|
76286
76711
|
// ../sdk/dist/store/memory/index-file.js
|
|
76287
76712
|
var MEMORY_INDEX_MAX_LINES = 200;
|
|
@@ -76519,7 +76944,7 @@ function invalidFile(file, reason2, cause) {
|
|
|
76519
76944
|
}
|
|
76520
76945
|
__name(invalidFile, "invalidFile");
|
|
76521
76946
|
function derivedMemoryId(name2) {
|
|
76522
|
-
const hex2 =
|
|
76947
|
+
const hex2 = createHash26("sha256").update(`namzu-memory-name:${name2}`).digest("hex");
|
|
76523
76948
|
const variant = (Number.parseInt(hex2[16] ?? "0", 16) & 3 | 8).toString(16);
|
|
76524
76949
|
return `${hex2.slice(0, 8)}-${hex2.slice(8, 12)}-8${hex2.slice(13, 16)}-${variant}${hex2.slice(17, 20)}-${hex2.slice(20, 32)}`;
|
|
76525
76950
|
}
|
|
@@ -76639,7 +77064,7 @@ var MarkdownMemoryStore = class {
|
|
|
76639
77064
|
lockTimeoutMs;
|
|
76640
77065
|
canonical;
|
|
76641
77066
|
constructor(config) {
|
|
76642
|
-
this.directory =
|
|
77067
|
+
this.directory = resolve15(config.directory);
|
|
76643
77068
|
this.log = resolveLogger(config.logger).child({
|
|
76644
77069
|
[SCOPE_ATTRIBUTE]: "store/memory/markdown"
|
|
76645
77070
|
});
|
|
@@ -76660,7 +77085,7 @@ var MarkdownMemoryStore = class {
|
|
|
76660
77085
|
memoryPath(dir, name2) {
|
|
76661
77086
|
if (!isMemoryName(name2))
|
|
76662
77087
|
invalidFile(join32(dir, `${name2}.md`), "name is not a memory name");
|
|
76663
|
-
const path3 =
|
|
77088
|
+
const path3 = resolve15(entryPath(dir, name2, ".md"));
|
|
76664
77089
|
if (dirname18(path3) !== dir)
|
|
76665
77090
|
invalidFile(path3, "resolved path escapes the memory directory");
|
|
76666
77091
|
return path3;
|
|
@@ -77843,7 +78268,7 @@ var PluginRegistry = class extends ManagedRegistry {
|
|
|
77843
78268
|
// ../sdk/dist/plugin/loader.js
|
|
77844
78269
|
import { lstat as lstat9, readFile as readFile18, readdir as readdir12, realpath as realpath9 } from "node:fs/promises";
|
|
77845
78270
|
import { homedir as homedir4, platform } from "node:os";
|
|
77846
|
-
import { join as join34, resolve as
|
|
78271
|
+
import { join as join34, resolve as resolve16 } from "node:path";
|
|
77847
78272
|
|
|
77848
78273
|
// ../sdk/dist/types/plugin/index.js
|
|
77849
78274
|
function assertPluginScope(scope) {
|
|
@@ -78229,7 +78654,7 @@ async function samePhysicalDirectory(left, right) {
|
|
|
78229
78654
|
try {
|
|
78230
78655
|
value = await realpath9(path3);
|
|
78231
78656
|
} catch {
|
|
78232
|
-
value =
|
|
78657
|
+
value = resolve16(path3);
|
|
78233
78658
|
}
|
|
78234
78659
|
return platform() === "win32" ? value.toLocaleLowerCase("en-US") : value;
|
|
78235
78660
|
}, "canonical");
|
|
@@ -78462,10 +78887,10 @@ function describeType(declared) {
|
|
|
78462
78887
|
return `a \`${declared}\` parameter`;
|
|
78463
78888
|
}
|
|
78464
78889
|
__name(describeType, "describeType");
|
|
78465
|
-
function
|
|
78890
|
+
function refuse3(reason2) {
|
|
78466
78891
|
return { ok: false, reason: reason2 };
|
|
78467
78892
|
}
|
|
78468
|
-
__name(
|
|
78893
|
+
__name(refuse3, "refuse");
|
|
78469
78894
|
function validateMcpHeaderAnnotations(inputSchema22) {
|
|
78470
78895
|
if (!isPlainObject4(inputSchema22))
|
|
78471
78896
|
return NO_BINDINGS;
|
|
@@ -78478,28 +78903,28 @@ function validateMcpHeaderAnnotations(inputSchema22) {
|
|
|
78478
78903
|
const at = `at ${annotation.where}`;
|
|
78479
78904
|
const name2 = annotation.value;
|
|
78480
78905
|
if (typeof name2 !== "string") {
|
|
78481
|
-
return
|
|
78906
|
+
return refuse3(`\`x-mcp-header\` ${at} is ${quoted(name2)}, which is not a string`);
|
|
78482
78907
|
}
|
|
78483
78908
|
if (name2.length === 0) {
|
|
78484
|
-
return
|
|
78909
|
+
return refuse3(`\`x-mcp-header\` ${at} is empty`);
|
|
78485
78910
|
}
|
|
78486
78911
|
if (/[\r\n]/.test(name2)) {
|
|
78487
|
-
return
|
|
78912
|
+
return refuse3(`\`x-mcp-header\` ${quoted(name2)} ${at} contains a carriage return or line feed`);
|
|
78488
78913
|
}
|
|
78489
78914
|
if (!FIELD_NAME_TOKEN.test(name2)) {
|
|
78490
|
-
return
|
|
78915
|
+
return refuse3(`\`x-mcp-header\` ${quoted(name2)} ${at} is not HTTP field-name token syntax (RFC 9110 1*tchar)`);
|
|
78491
78916
|
}
|
|
78492
78917
|
const first = claimed.get(name2.toLowerCase());
|
|
78493
78918
|
if (first !== void 0) {
|
|
78494
|
-
return
|
|
78919
|
+
return refuse3(`\`x-mcp-header\` ${quoted(name2)} ${at} repeats ${quoted(first)}; header names are compared without regard to case`);
|
|
78495
78920
|
}
|
|
78496
78921
|
claimed.set(name2.toLowerCase(), name2);
|
|
78497
78922
|
if (annotation.path === void 0) {
|
|
78498
|
-
return
|
|
78923
|
+
return refuse3(`\`x-mcp-header\` ${quoted(name2)} ${at} is not statically reachable: the chain from the schema root must consist solely of \`properties\` keys`);
|
|
78499
78924
|
}
|
|
78500
78925
|
const declared = annotation.declaredType;
|
|
78501
78926
|
if (typeof declared !== "string" || !MIRRORABLE_TYPES.has(declared)) {
|
|
78502
|
-
return
|
|
78927
|
+
return refuse3(`\`x-mcp-header\` ${quoted(name2)} ${at} annotates ${describeType(declared)}; only \`string\`, \`boolean\` and \`integer\` may be mirrored, and \`number\` is excluded`);
|
|
78503
78928
|
}
|
|
78504
78929
|
bindings.push({
|
|
78505
78930
|
header: `${MCP_PARAM_HEADER_PREFIX}${name2}`,
|
|
@@ -79219,7 +79644,7 @@ var StdioTransport = class {
|
|
|
79219
79644
|
this.exitPending = false;
|
|
79220
79645
|
return;
|
|
79221
79646
|
}
|
|
79222
|
-
await new Promise((
|
|
79647
|
+
await new Promise((resolve35) => {
|
|
79223
79648
|
let settled = false;
|
|
79224
79649
|
const finish2 = /* @__PURE__ */ __name(() => {
|
|
79225
79650
|
if (settled)
|
|
@@ -79227,7 +79652,7 @@ var StdioTransport = class {
|
|
|
79227
79652
|
settled = true;
|
|
79228
79653
|
clearTimeout(escalate);
|
|
79229
79654
|
clearTimeout(giveUp);
|
|
79230
|
-
|
|
79655
|
+
resolve35();
|
|
79231
79656
|
}, "finish");
|
|
79232
79657
|
child.once("close", finish2);
|
|
79233
79658
|
child.once("error", finish2);
|
|
@@ -80183,7 +80608,7 @@ var MCPClient = class {
|
|
|
80183
80608
|
capabilities: this.config.capabilities ?? {}
|
|
80184
80609
|
});
|
|
80185
80610
|
const controller = new AbortController();
|
|
80186
|
-
return new Promise((
|
|
80611
|
+
return new Promise((resolve35) => {
|
|
80187
80612
|
let settled = false;
|
|
80188
80613
|
const finish2 = /* @__PURE__ */ __name((answer) => {
|
|
80189
80614
|
if (settled)
|
|
@@ -80192,7 +80617,7 @@ var MCPClient = class {
|
|
|
80192
80617
|
clearTimeout(timer);
|
|
80193
80618
|
if (this.pendingRequests.get(id3) === entry)
|
|
80194
80619
|
this.pendingRequests.delete(id3);
|
|
80195
|
-
|
|
80620
|
+
resolve35(answer);
|
|
80196
80621
|
}, "finish");
|
|
80197
80622
|
const entry = {
|
|
80198
80623
|
resolve: /* @__PURE__ */ __name((value) => finish2({ kind: "result", result: value }), "resolve"),
|
|
@@ -80766,8 +81191,8 @@ var MCPClient = class {
|
|
|
80766
81191
|
let settled = false;
|
|
80767
81192
|
let resolvePublic;
|
|
80768
81193
|
let rejectPublic;
|
|
80769
|
-
const result = new Promise((
|
|
80770
|
-
resolvePublic =
|
|
81194
|
+
const result = new Promise((resolve35, reject2) => {
|
|
81195
|
+
resolvePublic = resolve35;
|
|
80771
81196
|
rejectPublic = reject2;
|
|
80772
81197
|
});
|
|
80773
81198
|
const entry = {
|
|
@@ -81972,7 +82397,7 @@ function toolResultToMCPToolResult(result) {
|
|
|
81972
82397
|
__name(toolResultToMCPToolResult, "toolResultToMCPToolResult");
|
|
81973
82398
|
|
|
81974
82399
|
// ../sdk/dist/connector/mcp/policy.js
|
|
81975
|
-
import { createHash as
|
|
82400
|
+
import { createHash as createHash27 } from "node:crypto";
|
|
81976
82401
|
function applyToolPolicy(tools, policy) {
|
|
81977
82402
|
return applyNamePolicy(tools, policy);
|
|
81978
82403
|
}
|
|
@@ -82012,7 +82437,7 @@ function toolsHash(tools) {
|
|
|
82012
82437
|
// fingerprint built to catch exactly that rug-pull saw nothing.
|
|
82013
82438
|
annotations: stableStringify2(tool.annotations)
|
|
82014
82439
|
}));
|
|
82015
|
-
return
|
|
82440
|
+
return createHash27("sha256").update(JSON.stringify(canonical3)).digest("hex");
|
|
82016
82441
|
}
|
|
82017
82442
|
__name(toolsHash, "toolsHash");
|
|
82018
82443
|
function diffTools(before, after) {
|
|
@@ -82235,7 +82660,7 @@ var MCPToolDiscovery = class {
|
|
|
82235
82660
|
};
|
|
82236
82661
|
|
|
82237
82662
|
// ../sdk/dist/connector/mcp/mcp-toolset.js
|
|
82238
|
-
import { createHash as
|
|
82663
|
+
import { createHash as createHash28 } from "node:crypto";
|
|
82239
82664
|
|
|
82240
82665
|
// ../sdk/dist/connector/mcp/prompt-adapter.js
|
|
82241
82666
|
function renderPromptMessages(serverName, promptName, messages, description) {
|
|
@@ -82306,7 +82731,7 @@ function mcpToolsetName(serverName, ...segments) {
|
|
|
82306
82731
|
const full = ["mcp", serverName, ...segments].join("__");
|
|
82307
82732
|
if (full.length <= MCP_TOOLSET_NAME_MAX_LENGTH)
|
|
82308
82733
|
return full;
|
|
82309
|
-
const hash2 =
|
|
82734
|
+
const hash2 = createHash28("sha256").update(full).digest("hex").slice(0, 8);
|
|
82310
82735
|
const suffix = `_${hash2}`;
|
|
82311
82736
|
return `${full.slice(0, MCP_TOOLSET_NAME_MAX_LENGTH - suffix.length)}${suffix}`;
|
|
82312
82737
|
}
|
|
@@ -83561,21 +83986,21 @@ function guardedLookup(hostname, options, callback) {
|
|
|
83561
83986
|
}
|
|
83562
83987
|
__name(guardedLookup, "guardedLookup");
|
|
83563
83988
|
function postHookJson(input) {
|
|
83564
|
-
return new Promise((
|
|
83989
|
+
return new Promise((resolve35) => {
|
|
83565
83990
|
let url;
|
|
83566
83991
|
try {
|
|
83567
83992
|
url = new URL(input.url);
|
|
83568
83993
|
} catch {
|
|
83569
|
-
|
|
83994
|
+
resolve35({ status: null, body: "", timedOut: false, error: "the url is not valid" });
|
|
83570
83995
|
return;
|
|
83571
83996
|
}
|
|
83572
83997
|
if (url.protocol !== "http:" && url.protocol !== "https:") {
|
|
83573
|
-
|
|
83998
|
+
resolve35({ status: null, body: "", timedOut: false, error: "the url must be http or https" });
|
|
83574
83999
|
return;
|
|
83575
84000
|
}
|
|
83576
84001
|
const literal = url.hostname.replace(/^\[|\]$/g, "");
|
|
83577
84002
|
if (isIP3(literal) !== 0 && !isReachableHookAddress(literal)) {
|
|
83578
|
-
|
|
84003
|
+
resolve35({
|
|
83579
84004
|
status: null,
|
|
83580
84005
|
body: "",
|
|
83581
84006
|
timedOut: false,
|
|
@@ -83600,7 +84025,7 @@ function postHookJson(input) {
|
|
|
83600
84025
|
settled = true;
|
|
83601
84026
|
clearTimeout(timer);
|
|
83602
84027
|
input.signal?.removeEventListener("abort", onAbort);
|
|
83603
|
-
|
|
84028
|
+
resolve35(response);
|
|
83604
84029
|
}, "finish");
|
|
83605
84030
|
const onAbort = /* @__PURE__ */ __name(() => {
|
|
83606
84031
|
req.destroy();
|
|
@@ -83747,7 +84172,7 @@ function runShellHook(entry, input, signal) {
|
|
|
83747
84172
|
const payload = shellHookPayload(input);
|
|
83748
84173
|
const toolPath = pathOf(input.toolInput);
|
|
83749
84174
|
const { NAMZU_TURN_ID: _inheritedTurnId, ...inherited } = process.env;
|
|
83750
|
-
return new Promise((
|
|
84175
|
+
return new Promise((resolve35) => {
|
|
83751
84176
|
let child;
|
|
83752
84177
|
try {
|
|
83753
84178
|
const env = {
|
|
@@ -83778,7 +84203,7 @@ function runShellHook(entry, input, signal) {
|
|
|
83778
84203
|
...process.platform === "win32" ? {} : { shell: { path: "sh", dialect: "sh", source: "sh" } }
|
|
83779
84204
|
});
|
|
83780
84205
|
} catch (error) {
|
|
83781
|
-
|
|
84206
|
+
resolve35({
|
|
83782
84207
|
exitCode: null,
|
|
83783
84208
|
timedOut: false,
|
|
83784
84209
|
stdout: "",
|
|
@@ -83804,7 +84229,7 @@ function runShellHook(entry, input, signal) {
|
|
|
83804
84229
|
settled = true;
|
|
83805
84230
|
clearTimeout(timer);
|
|
83806
84231
|
signal?.removeEventListener("abort", onAbort);
|
|
83807
|
-
|
|
84232
|
+
resolve35(outcome);
|
|
83808
84233
|
}, "finish");
|
|
83809
84234
|
const killTree2 = /* @__PURE__ */ __name(() => {
|
|
83810
84235
|
if (child.pid !== void 0 && process.platform !== "win32") {
|
|
@@ -84200,8 +84625,8 @@ ${json2}`;
|
|
|
84200
84625
|
const combined = signal ? AbortSignal.any([signal, deadline]) : deadline;
|
|
84201
84626
|
let reply;
|
|
84202
84627
|
try {
|
|
84203
|
-
reply = await new Promise((
|
|
84204
|
-
const stop = /* @__PURE__ */ __name(() =>
|
|
84628
|
+
reply = await new Promise((resolve35, reject2) => {
|
|
84629
|
+
const stop = /* @__PURE__ */ __name(() => resolve35(void 0), "stop");
|
|
84205
84630
|
combined.addEventListener("abort", stop, { once: true });
|
|
84206
84631
|
judge({
|
|
84207
84632
|
instruction: PROMPT_HOOK_INSTRUCTION,
|
|
@@ -84209,7 +84634,7 @@ ${json2}`;
|
|
|
84209
84634
|
sessionId: input.sessionId,
|
|
84210
84635
|
...input.turnId !== void 0 ? { turnId: input.turnId } : {},
|
|
84211
84636
|
signal: combined
|
|
84212
|
-
}).then(
|
|
84637
|
+
}).then(resolve35, reject2);
|
|
84213
84638
|
});
|
|
84214
84639
|
} catch (error) {
|
|
84215
84640
|
log.warn("prompt hook failed", {
|
|
@@ -84431,8 +84856,8 @@ async function settleWithSignal(operation, signal, acceptAfterAbort) {
|
|
|
84431
84856
|
return operation;
|
|
84432
84857
|
const settled = operation.then((value) => ({ kind: "fulfilled", value }), (reason2) => ({ kind: "rejected", reason: reason2 }));
|
|
84433
84858
|
let onAbort;
|
|
84434
|
-
const aborted = new Promise((
|
|
84435
|
-
onAbort = /* @__PURE__ */ __name(() =>
|
|
84859
|
+
const aborted = new Promise((resolve35) => {
|
|
84860
|
+
onAbort = /* @__PURE__ */ __name(() => resolve35({ kind: "aborted" }), "onAbort");
|
|
84436
84861
|
if (signal.aborted) {
|
|
84437
84862
|
onAbort();
|
|
84438
84863
|
return;
|
|
@@ -84451,8 +84876,8 @@ async function settleWithSignal(operation, signal, acceptAfterAbort) {
|
|
|
84451
84876
|
let timer;
|
|
84452
84877
|
const grace = await Promise.race([
|
|
84453
84878
|
settled,
|
|
84454
|
-
new Promise((
|
|
84455
|
-
timer = setTimeout(() =>
|
|
84879
|
+
new Promise((resolve35) => {
|
|
84880
|
+
timer = setTimeout(() => resolve35({ kind: "grace_elapsed" }), 0);
|
|
84456
84881
|
})
|
|
84457
84882
|
]).finally(() => {
|
|
84458
84883
|
if (timer !== void 0)
|
|
@@ -85799,7 +86224,7 @@ __name(summarizeBlocking, "summarizeBlocking");
|
|
|
85799
86224
|
|
|
85800
86225
|
// ../sdk/dist/manager/agent/lifecycle.js
|
|
85801
86226
|
import { realpath as realpath10, rm as rm5, stat as stat11 } from "node:fs/promises";
|
|
85802
|
-
import { isAbsolute as
|
|
86227
|
+
import { isAbsolute as isAbsolute9, relative as relative6, resolve as resolve17, sep as sep8 } from "node:path";
|
|
85803
86228
|
|
|
85804
86229
|
// ../sdk/dist/session/handoff/capacity.js
|
|
85805
86230
|
var DelegationCapacityExceeded = class extends Error {
|
|
@@ -85972,14 +86397,14 @@ function mergeEnv(base3, override) {
|
|
|
85972
86397
|
__name(mergeEnv, "mergeEnv");
|
|
85973
86398
|
async function requireIsolatedWorktreePath(ref, callerCwd, subdirectory) {
|
|
85974
86399
|
const meta = ref?.meta;
|
|
85975
|
-
if (typeof ref?.id !== "string" || ref.id.length === 0 || meta?.backend !== "git-worktree" || typeof meta.repoRoot !== "string" || !
|
|
86400
|
+
if (typeof ref?.id !== "string" || ref.id.length === 0 || meta?.backend !== "git-worktree" || typeof meta.repoRoot !== "string" || !isAbsolute9(meta.repoRoot) || typeof meta.branch !== "string" || meta.branch.length === 0 || typeof meta.worktreePath !== "string" || !isAbsolute9(meta.worktreePath) || resolve17(meta.worktreePath) === resolve17(callerCwd ?? process.cwd())) {
|
|
85976
86401
|
throw new Error("Isolated git-worktree driver returned an invalid workspace ref or path");
|
|
85977
86402
|
}
|
|
85978
86403
|
let physicalPaths;
|
|
85979
86404
|
try {
|
|
85980
86405
|
physicalPaths = await Promise.all([
|
|
85981
86406
|
realpath10(meta.worktreePath),
|
|
85982
|
-
realpath10(
|
|
86407
|
+
realpath10(resolve17(callerCwd ?? process.cwd()))
|
|
85983
86408
|
]);
|
|
85984
86409
|
if (!(await stat11(physicalPaths[0])).isDirectory()) {
|
|
85985
86410
|
throw new Error("The worktree path is not a directory");
|
|
@@ -85994,12 +86419,12 @@ async function requireIsolatedWorktreePath(ref, callerCwd, subdirectory) {
|
|
|
85994
86419
|
}
|
|
85995
86420
|
if (subdirectory === void 0)
|
|
85996
86421
|
return meta.worktreePath;
|
|
85997
|
-
if (typeof subdirectory !== "string" || subdirectory.length === 0 ||
|
|
86422
|
+
if (typeof subdirectory !== "string" || subdirectory.length === 0 || isAbsolute9(subdirectory)) {
|
|
85998
86423
|
throw new Error("Isolated workspace subdirectory must be a nonempty relative path");
|
|
85999
86424
|
}
|
|
86000
|
-
const lexicalChild =
|
|
86001
|
-
const lexicalRelative =
|
|
86002
|
-
if (
|
|
86425
|
+
const lexicalChild = resolve17(meta.worktreePath, subdirectory);
|
|
86426
|
+
const lexicalRelative = relative6(resolve17(meta.worktreePath), lexicalChild);
|
|
86427
|
+
if (isAbsolute9(lexicalRelative) || lexicalRelative === ".." || lexicalRelative.startsWith(`..${sep8}`)) {
|
|
86003
86428
|
throw new Error("Isolated workspace subdirectory escapes the worktree");
|
|
86004
86429
|
}
|
|
86005
86430
|
let physicalChild;
|
|
@@ -86011,8 +86436,8 @@ async function requireIsolatedWorktreePath(ref, callerCwd, subdirectory) {
|
|
|
86011
86436
|
} catch (cause) {
|
|
86012
86437
|
throw new Error("Isolated workspace subdirectory is missing or not a directory", { cause });
|
|
86013
86438
|
}
|
|
86014
|
-
const physicalRelative =
|
|
86015
|
-
if (physicalRelative === "" ||
|
|
86439
|
+
const physicalRelative = relative6(physicalPaths[0], physicalChild);
|
|
86440
|
+
if (physicalRelative === "" || isAbsolute9(physicalRelative) || physicalRelative === ".." || physicalRelative.startsWith(`..${sep8}`)) {
|
|
86016
86441
|
throw new Error("Isolated workspace subdirectory resolves outside its worktree");
|
|
86017
86442
|
}
|
|
86018
86443
|
return physicalChild;
|
|
@@ -86807,9 +87232,9 @@ var AgentManager = class {
|
|
|
86807
87232
|
if (isTerminalAgentTaskState(agentTask.state)) {
|
|
86808
87233
|
return Promise.resolve();
|
|
86809
87234
|
}
|
|
86810
|
-
return new Promise((
|
|
87235
|
+
return new Promise((resolve35) => {
|
|
86811
87236
|
const existing = this.completionCallbacks.get(taskId) ?? [];
|
|
86812
|
-
existing.push(
|
|
87237
|
+
existing.push(resolve35);
|
|
86813
87238
|
this.completionCallbacks.set(taskId, existing);
|
|
86814
87239
|
});
|
|
86815
87240
|
}
|
|
@@ -87016,7 +87441,7 @@ var AgentManager = class {
|
|
|
87016
87441
|
origin,
|
|
87017
87442
|
topicId: context2.topicId,
|
|
87018
87443
|
projectId: context2.projectId,
|
|
87019
|
-
cwd:
|
|
87444
|
+
cwd: resolve17(options.input.workingDirectory ?? process.cwd()),
|
|
87020
87445
|
log,
|
|
87021
87446
|
activeSubSessionId: origin.subSessionId
|
|
87022
87447
|
});
|
|
@@ -87033,20 +87458,20 @@ var AgentManager = class {
|
|
|
87033
87458
|
* channel apply exactly as for a child that finished in this process.
|
|
87034
87459
|
*/
|
|
87035
87460
|
async restoreChildConversation(options, context2) {
|
|
87036
|
-
const
|
|
87461
|
+
const refuse5 = /* @__PURE__ */ __name((reason2) => ({
|
|
87037
87462
|
status: "refused",
|
|
87038
87463
|
reason: reason2
|
|
87039
87464
|
}), "refuse");
|
|
87040
87465
|
const id3 = options.childSessionId;
|
|
87041
87466
|
const retained = this.childConversations.get(id3);
|
|
87042
87467
|
if (retained?.activeSubSessionId)
|
|
87043
|
-
return
|
|
87468
|
+
return refuse5("running");
|
|
87044
87469
|
const paths2 = context2.childStorage?.kind === "disk" ? context2.childStorage.paths : this.deps.paths;
|
|
87045
87470
|
if (!paths2)
|
|
87046
|
-
return
|
|
87471
|
+
return refuse5("no-layout");
|
|
87047
87472
|
const store = this.deps.sessionStore;
|
|
87048
87473
|
if (store.supportsInvocationSummaries !== true || store.supportsOwnerVersionCas !== true)
|
|
87049
|
-
return
|
|
87474
|
+
return refuse5("not-resumable");
|
|
87050
87475
|
const ancestry = await store.getAncestry(context2.sessionId, context2.tenantId);
|
|
87051
87476
|
const parentLocator = {
|
|
87052
87477
|
sessionId: context2.sessionId,
|
|
@@ -87056,32 +87481,32 @@ var AgentManager = class {
|
|
|
87056
87481
|
try {
|
|
87057
87482
|
meta = await readChildSessionMeta(paths2.subagentMeta(parentLocator, id3));
|
|
87058
87483
|
} catch {
|
|
87059
|
-
return
|
|
87484
|
+
return refuse5("not-saved");
|
|
87060
87485
|
}
|
|
87061
87486
|
if (!meta)
|
|
87062
|
-
return
|
|
87487
|
+
return refuse5("not-saved");
|
|
87063
87488
|
if (meta.sessionId !== id3 || meta.parentSessionId !== context2.sessionId)
|
|
87064
|
-
return
|
|
87489
|
+
return refuse5("foreign");
|
|
87065
87490
|
const continuation = meta.continuation;
|
|
87066
87491
|
if (!continuation || continuation.workspace !== "shared")
|
|
87067
|
-
return
|
|
87492
|
+
return refuse5("not-resumable");
|
|
87068
87493
|
const agentId = options.agentFor(continuation.profile);
|
|
87069
87494
|
if (agentId === void 0 || !this.registry.has(agentId))
|
|
87070
|
-
return
|
|
87495
|
+
return refuse5("not-resumable");
|
|
87071
87496
|
const log = retained?.log ?? DiskSessionLog.at(paths2, { sessionId: id3, ancestors: ancestry });
|
|
87072
87497
|
const ended = await childSessionEnded(log);
|
|
87073
87498
|
if (!ended)
|
|
87074
|
-
return
|
|
87499
|
+
return refuse5("unsettled");
|
|
87075
87500
|
if (ended.status === "cancelled" || meta.status === "cancelled")
|
|
87076
|
-
return
|
|
87501
|
+
return refuse5("stopped");
|
|
87077
87502
|
const started = await log.head();
|
|
87078
87503
|
if (started === null)
|
|
87079
|
-
return
|
|
87504
|
+
return refuse5("unsettled");
|
|
87080
87505
|
for await (const { record: record3 } of log.read({ mode: "tolerant" })) {
|
|
87081
87506
|
if (record3.type !== "session_started")
|
|
87082
87507
|
continue;
|
|
87083
87508
|
if (record3.projectId !== context2.projectId || record3.topicId !== context2.topicId)
|
|
87084
|
-
return
|
|
87509
|
+
return refuse5("foreign");
|
|
87085
87510
|
break;
|
|
87086
87511
|
}
|
|
87087
87512
|
const placement = {
|
|
@@ -87105,7 +87530,7 @@ var AgentManager = class {
|
|
|
87105
87530
|
if (this.childConversations.size >= RETAINED_CHILD_CONVERSATION_CAP) {
|
|
87106
87531
|
const oldest = [...this.childConversations].find(([, value]) => !value.activeSubSessionId);
|
|
87107
87532
|
if (!oldest)
|
|
87108
|
-
return
|
|
87533
|
+
return refuse5("full");
|
|
87109
87534
|
this.childConversations.delete(oldest[0]);
|
|
87110
87535
|
}
|
|
87111
87536
|
const childActor = {
|
|
@@ -87121,7 +87546,7 @@ var AgentManager = class {
|
|
|
87121
87546
|
try {
|
|
87122
87547
|
if (child) {
|
|
87123
87548
|
if (child.status === "active" || child.status === "archived" || child.status === "locked" || child.projectId !== context2.projectId || child.topicId !== context2.topicId || child.currentActor?.kind !== "agent" || child.currentActor.agentId !== agentId)
|
|
87124
|
-
return
|
|
87549
|
+
return refuse5("running");
|
|
87125
87550
|
} else {
|
|
87126
87551
|
child = await store.createSession({ id: id3, topicId: context2.topicId, projectId: context2.projectId, currentActor: childActor }, context2.tenantId);
|
|
87127
87552
|
createdChild = true;
|
|
@@ -87161,7 +87586,7 @@ var AgentManager = class {
|
|
|
87161
87586
|
},
|
|
87162
87587
|
topicId: context2.topicId,
|
|
87163
87588
|
projectId: context2.projectId,
|
|
87164
|
-
cwd:
|
|
87589
|
+
cwd: resolve17(options.workingDirectory),
|
|
87165
87590
|
log
|
|
87166
87591
|
});
|
|
87167
87592
|
return restored;
|
|
@@ -87189,7 +87614,7 @@ var AgentManager = class {
|
|
|
87189
87614
|
throw new Error("Child conversation is still running or settling");
|
|
87190
87615
|
if (origin.workspaceRef || options.workspace?.mode === "isolated" || options.workspaceBackend)
|
|
87191
87616
|
throw new Error("Child continuation requires a shared workspace; isolated leases cannot be resumed");
|
|
87192
|
-
if (
|
|
87617
|
+
if (resolve17(options.input.workingDirectory ?? process.cwd()) !== conversation.cwd)
|
|
87193
87618
|
throw new Error("Child continuation cannot change its working directory");
|
|
87194
87619
|
const store = this.deps.sessionStore;
|
|
87195
87620
|
if (store.supportsInvocationSummaries !== true || store.supportsOwnerVersionCas !== true)
|
|
@@ -87542,8 +87967,8 @@ var AgentManager = class {
|
|
|
87542
87967
|
resolveCompletionCallbacks(taskId) {
|
|
87543
87968
|
const callbacks = this.completionCallbacks.get(taskId);
|
|
87544
87969
|
if (callbacks) {
|
|
87545
|
-
for (const
|
|
87546
|
-
|
|
87970
|
+
for (const resolve35 of callbacks)
|
|
87971
|
+
resolve35();
|
|
87547
87972
|
this.completionCallbacks.delete(taskId);
|
|
87548
87973
|
}
|
|
87549
87974
|
}
|
|
@@ -89091,7 +89516,7 @@ var MockLLMProvider = class {
|
|
|
89091
89516
|
async delay() {
|
|
89092
89517
|
if (this.responseDelayMs <= 0)
|
|
89093
89518
|
return;
|
|
89094
|
-
await new Promise((
|
|
89519
|
+
await new Promise((resolve35) => setTimeout(resolve35, this.responseDelayMs));
|
|
89095
89520
|
}
|
|
89096
89521
|
/**
|
|
89097
89522
|
* The turn to play. A script shorter than the turn repeats its last
|
|
@@ -89205,8 +89630,8 @@ registerMock();
|
|
|
89205
89630
|
import { spawn as spawn5, spawnSync } from "node:child_process";
|
|
89206
89631
|
import { constants as constants4, accessSync as accessSync2, existsSync as existsSync5, realpathSync as realpathSync3 } from "node:fs";
|
|
89207
89632
|
import { readFile as fsReadFile, writeFile as fsWriteFile, mkdir as mkdir16, open as open13, readdir as readdir13, rename as rename7, rm as rm6, stat as stat12 } from "node:fs/promises";
|
|
89208
|
-
import { tmpdir as
|
|
89209
|
-
import { dirname as dirname19, isAbsolute as
|
|
89633
|
+
import { tmpdir as tmpdir2 } from "node:os";
|
|
89634
|
+
import { dirname as dirname19, isAbsolute as isAbsolute11, join as join36, parse as parse3, resolve as resolve18 } from "node:path";
|
|
89210
89635
|
|
|
89211
89636
|
// ../sdk/dist/sandbox/denial.js
|
|
89212
89637
|
var RUNNER_PREFIX = {
|
|
@@ -89261,7 +89686,7 @@ __name(denial, "denial");
|
|
|
89261
89686
|
|
|
89262
89687
|
// ../sdk/dist/sandbox/file-walk.js
|
|
89263
89688
|
var import_brace_expansion2 = __toESM(require_brace_expansion(), 1);
|
|
89264
|
-
import { isAbsolute as
|
|
89689
|
+
import { isAbsolute as isAbsolute10, join as join35, posix as posix2 } from "node:path";
|
|
89265
89690
|
|
|
89266
89691
|
// ../../node_modules/.pnpm/minimatch@9.0.9/node_modules/minimatch/dist/esm/index.js
|
|
89267
89692
|
var import_brace_expansion = __toESM(require_brace_expansion(), 1);
|
|
@@ -90074,8 +90499,8 @@ var path = {
|
|
|
90074
90499
|
win32: { sep: "\\" },
|
|
90075
90500
|
posix: { sep: "/" }
|
|
90076
90501
|
};
|
|
90077
|
-
var
|
|
90078
|
-
minimatch.sep =
|
|
90502
|
+
var sep9 = defaultPlatform === "win32" ? path.win32.sep : path.posix.sep;
|
|
90503
|
+
minimatch.sep = sep9;
|
|
90079
90504
|
var GLOBSTAR = /* @__PURE__ */ Symbol("globstar **");
|
|
90080
90505
|
minimatch.GLOBSTAR = GLOBSTAR;
|
|
90081
90506
|
var qmark2 = "[^/]";
|
|
@@ -91144,7 +91569,7 @@ function positiveInteger(value, name2) {
|
|
|
91144
91569
|
}
|
|
91145
91570
|
__name(positiveInteger, "positiveInteger");
|
|
91146
91571
|
function planWalk(root, options) {
|
|
91147
|
-
if (!
|
|
91572
|
+
if (!isAbsolute10(root) && !posix2.isAbsolute(root)) {
|
|
91148
91573
|
throw new Error("File walk root must be an absolute path");
|
|
91149
91574
|
}
|
|
91150
91575
|
let pattern = options.pattern ?? "**/*";
|
|
@@ -91203,7 +91628,7 @@ function planWalk(root, options) {
|
|
|
91203
91628
|
__name(planWalk, "planWalk");
|
|
91204
91629
|
function directoryMatcher(plan) {
|
|
91205
91630
|
const patterns = plan.patterns.map((set3) => set3.map((part2) => typeof part2 === "object" && part2 !== null ? new RegExp(part2.source, `${part2.flags}s`) : part2));
|
|
91206
|
-
return (
|
|
91631
|
+
return (relative17) => patterns.some((pattern) => {
|
|
91207
91632
|
const closure = /* @__PURE__ */ __name((states2) => {
|
|
91208
91633
|
for (const index of states2)
|
|
91209
91634
|
if (pattern[index] === null)
|
|
@@ -91211,7 +91636,7 @@ function directoryMatcher(plan) {
|
|
|
91211
91636
|
return states2;
|
|
91212
91637
|
}, "closure");
|
|
91213
91638
|
let states = closure(/* @__PURE__ */ new Set([0]));
|
|
91214
|
-
for (const name2 of
|
|
91639
|
+
for (const name2 of relative17.split("/")) {
|
|
91215
91640
|
const next2 = /* @__PURE__ */ new Set();
|
|
91216
91641
|
for (const index of states) {
|
|
91217
91642
|
const segment2 = pattern[index];
|
|
@@ -91343,7 +91768,7 @@ async function* executeWalk(plan, signal, onSummary) {
|
|
|
91343
91768
|
}
|
|
91344
91769
|
if (plan.prefix.length >= maxDepth)
|
|
91345
91770
|
return;
|
|
91346
|
-
const openDirectory = /* @__PURE__ */ __name(async (absolute,
|
|
91771
|
+
const openDirectory = /* @__PURE__ */ __name(async (absolute, relative17, depth, layered) => {
|
|
91347
91772
|
check2();
|
|
91348
91773
|
try {
|
|
91349
91774
|
const dir = await wait(fs.opendir(absolute), (late2) => {
|
|
@@ -91352,7 +91777,7 @@ async function* executeWalk(plan, signal, onSummary) {
|
|
|
91352
91777
|
});
|
|
91353
91778
|
if (layered)
|
|
91354
91779
|
await ignore?.enter(absolute);
|
|
91355
|
-
open15.push({ dir, relative:
|
|
91780
|
+
open15.push({ dir, relative: relative17, depth, layered });
|
|
91356
91781
|
} catch (error) {
|
|
91357
91782
|
if (!missing2(error))
|
|
91358
91783
|
throw error;
|
|
@@ -91375,20 +91800,20 @@ async function* executeWalk(plan, signal, onSummary) {
|
|
|
91375
91800
|
return;
|
|
91376
91801
|
if (VCS_NAMES.has(entry.name))
|
|
91377
91802
|
continue;
|
|
91378
|
-
const
|
|
91379
|
-
const absolute = path3.join(plan.root,
|
|
91803
|
+
const relative17 = frame.relative ? `${frame.relative}/${entry.name}` : entry.name;
|
|
91804
|
+
const absolute = path3.join(plan.root, relative17);
|
|
91380
91805
|
const depth = frame.depth + 1;
|
|
91381
91806
|
if (entry.isDirectory()) {
|
|
91382
|
-
if (depth >= maxDepth || !canDescend(
|
|
91807
|
+
if (depth >= maxDepth || !canDescend(relative17))
|
|
91383
91808
|
continue;
|
|
91384
91809
|
if (ignore?.isIgnored(absolute, true)) {
|
|
91385
91810
|
ignoredDirectories += 1;
|
|
91386
91811
|
continue;
|
|
91387
91812
|
}
|
|
91388
|
-
await openDirectory(absolute,
|
|
91813
|
+
await openDirectory(absolute, relative17, depth, true);
|
|
91389
91814
|
continue;
|
|
91390
91815
|
}
|
|
91391
|
-
if (!entry.isFile() || !matchers.some((matcher) => matcher.test(
|
|
91816
|
+
if (!entry.isFile() || !matchers.some((matcher) => matcher.test(relative17)))
|
|
91392
91817
|
continue;
|
|
91393
91818
|
if (ignore?.isIgnored(absolute, false))
|
|
91394
91819
|
continue;
|
|
@@ -91476,8 +91901,8 @@ async function* walkFilesViaExec(exec, rootPath, options) {
|
|
|
91476
91901
|
if (record3.type !== "entry" || typeof record3.path !== "string" || typeof record3.size !== "number" || !Number.isSafeInteger(record3.size) || record3.size < 0) {
|
|
91477
91902
|
throw new Error("Invalid file walk entry");
|
|
91478
91903
|
}
|
|
91479
|
-
const
|
|
91480
|
-
if (!posix2.isAbsolute(record3.path) ||
|
|
91904
|
+
const relative17 = posix2.relative(rootPath, record3.path);
|
|
91905
|
+
if (!posix2.isAbsolute(record3.path) || relative17 === ".." || relative17.startsWith("../") || posix2.isAbsolute(relative17)) {
|
|
91481
91906
|
throw new Error("File walk entry escaped its requested root");
|
|
91482
91907
|
}
|
|
91483
91908
|
if (++received > plan.maxEntries)
|
|
@@ -91546,8 +91971,8 @@ async function* walkFilesViaExec(exec, rootPath, options) {
|
|
|
91546
91971
|
throw failure2;
|
|
91547
91972
|
if (settled)
|
|
91548
91973
|
break;
|
|
91549
|
-
await new Promise((
|
|
91550
|
-
wake =
|
|
91974
|
+
await new Promise((resolve35) => {
|
|
91975
|
+
wake = resolve35;
|
|
91551
91976
|
});
|
|
91552
91977
|
wake = void 0;
|
|
91553
91978
|
}
|
|
@@ -91661,7 +92086,7 @@ var CappedStream = class {
|
|
|
91661
92086
|
}
|
|
91662
92087
|
};
|
|
91663
92088
|
function requiredWrapper(request) {
|
|
91664
|
-
if (request.wrapperCommand === void 0 || !
|
|
92089
|
+
if (request.wrapperCommand === void 0 || !isAbsolute11(request.wrapperCommand)) {
|
|
91665
92090
|
throw new Error(`Sandbox environment ${request.environment} requires the absolute wrapper path that was probed`);
|
|
91666
92091
|
}
|
|
91667
92092
|
return request.wrapperCommand;
|
|
@@ -91716,7 +92141,7 @@ function detectEnvironment() {
|
|
|
91716
92141
|
const { platform: platform2 } = process;
|
|
91717
92142
|
if (platform2 === "linux") {
|
|
91718
92143
|
const bwrap = resolveTrustedWrapper("bwrap");
|
|
91719
|
-
if (bwrap !== void 0 && probeBwrapSpawn(bwrap, buildBwrapArgs(
|
|
92144
|
+
if (bwrap !== void 0 && probeBwrapSpawn(bwrap, buildBwrapArgs(resolveTempBase()))) {
|
|
91720
92145
|
return { environment: "linux-bwrap", wrapperCommand: bwrap };
|
|
91721
92146
|
}
|
|
91722
92147
|
const unshare = resolveTrustedWrapper("unshare");
|
|
@@ -91726,7 +92151,7 @@ function detectEnvironment() {
|
|
|
91726
92151
|
}
|
|
91727
92152
|
if (platform2 === "darwin") {
|
|
91728
92153
|
const seatbelt = resolveTrustedWrapper("sandbox-exec");
|
|
91729
|
-
if (seatbelt !== void 0 && probeSandboxSpawn(seatbelt, buildSeatbeltArgs(
|
|
92154
|
+
if (seatbelt !== void 0 && probeSandboxSpawn(seatbelt, buildSeatbeltArgs(resolveTempBase()))) {
|
|
91730
92155
|
return { environment: "macos-seatbelt", wrapperCommand: seatbelt };
|
|
91731
92156
|
}
|
|
91732
92157
|
}
|
|
@@ -91930,7 +92355,7 @@ var LocalSandbox = class {
|
|
|
91930
92355
|
this.rootDir = rootDir;
|
|
91931
92356
|
this.environment = environment;
|
|
91932
92357
|
this.config = config;
|
|
91933
|
-
this.additionalDirectories = (config.additionalDirectories ?? []).map((dir) => canonicalizePath(
|
|
92358
|
+
this.additionalDirectories = (config.additionalDirectories ?? []).map((dir) => canonicalizePath(resolve18(dir))).filter((dir) => dir !== rootDir);
|
|
91934
92359
|
this._status = "ready";
|
|
91935
92360
|
this.log = log.child({
|
|
91936
92361
|
[SCOPE_ATTRIBUTE]: "sandbox/provider/local",
|
|
@@ -92266,7 +92691,7 @@ var LocalSandbox = class {
|
|
|
92266
92691
|
exitCode,
|
|
92267
92692
|
stderr: stderr.text,
|
|
92268
92693
|
timedOut,
|
|
92269
|
-
allowedRoots: [...this.roots,
|
|
92694
|
+
allowedRoots: [...this.roots, tmpdir2(), resolveTempBase(), "/tmp", "/var/tmp", "/dev"]
|
|
92270
92695
|
});
|
|
92271
92696
|
resolvePromise({
|
|
92272
92697
|
exitCode,
|
|
@@ -92332,7 +92757,7 @@ var LocalSandboxProvider = class {
|
|
|
92332
92757
|
let rootDir;
|
|
92333
92758
|
let removeRootOnDestroy;
|
|
92334
92759
|
if (config?.workingDirectory !== void 0) {
|
|
92335
|
-
const requested =
|
|
92760
|
+
const requested = resolve18(config.workingDirectory);
|
|
92336
92761
|
let entry;
|
|
92337
92762
|
try {
|
|
92338
92763
|
entry = await stat12(requested);
|
|
@@ -92355,14 +92780,13 @@ var LocalSandboxProvider = class {
|
|
|
92355
92780
|
}
|
|
92356
92781
|
removeRootOnDestroy = false;
|
|
92357
92782
|
for (const dir of config.additionalDirectories ?? []) {
|
|
92358
|
-
const entry2 = await stat12(
|
|
92783
|
+
const entry2 = await stat12(resolve18(dir)).catch(() => null);
|
|
92359
92784
|
if (!entry2?.isDirectory()) {
|
|
92360
|
-
throw new Error(`Sandbox additional directory is not a directory: ${
|
|
92785
|
+
throw new Error(`Sandbox additional directory is not a directory: ${resolve18(dir)}`);
|
|
92361
92786
|
}
|
|
92362
92787
|
}
|
|
92363
92788
|
} else {
|
|
92364
|
-
const
|
|
92365
|
-
const rawDir = await mkdtemp2(join36(tmpdir4(), SANDBOX_TEMP_DIR_PREFIX));
|
|
92789
|
+
const rawDir = await createTempDir(SANDBOX_TEMP_DIR_PREFIX);
|
|
92366
92790
|
rootDir = canonicalizePath(rawDir);
|
|
92367
92791
|
removeRootOnDestroy = true;
|
|
92368
92792
|
}
|
|
@@ -92614,11 +93038,11 @@ var TextChunker = class {
|
|
|
92614
93038
|
const trimmed = text10.trim();
|
|
92615
93039
|
return trimmed.length > 0 ? [{ content: trimmed, index: startIndex }] : [];
|
|
92616
93040
|
}
|
|
92617
|
-
for (const
|
|
92618
|
-
const parts =
|
|
93041
|
+
for (const sep18 of separators) {
|
|
93042
|
+
const parts = sep18 === "" ? [...text10] : splitKeepingSeparator(text10, sep18).filter((p) => p.trim().length > 0);
|
|
92619
93043
|
if (parts.length <= 1)
|
|
92620
93044
|
continue;
|
|
92621
|
-
const remaining = separators.slice(separators.indexOf(
|
|
93045
|
+
const remaining = separators.slice(separators.indexOf(sep18) + 1);
|
|
92622
93046
|
const merged = this.mergeSmallParts(parts, config);
|
|
92623
93047
|
if (merged.every((c) => c.content.length <= config.chunkSize)) {
|
|
92624
93048
|
return merged;
|
|
@@ -92640,12 +93064,12 @@ var TextChunker = class {
|
|
|
92640
93064
|
}
|
|
92641
93065
|
splitBySeparators(text10, separators) {
|
|
92642
93066
|
let parts = [text10];
|
|
92643
|
-
for (const
|
|
93067
|
+
for (const sep18 of separators) {
|
|
92644
93068
|
const nextParts = [];
|
|
92645
93069
|
for (const part2 of parts) {
|
|
92646
|
-
const splits = part2.split(
|
|
93070
|
+
const splits = part2.split(sep18);
|
|
92647
93071
|
for (const [i, segment2] of splits.entries()) {
|
|
92648
|
-
const piece = i < splits.length - 1 ? segment2 +
|
|
93072
|
+
const piece = i < splits.length - 1 ? segment2 + sep18 : segment2;
|
|
92649
93073
|
if (piece.trim().length > 0) {
|
|
92650
93074
|
nextParts.push(piece);
|
|
92651
93075
|
}
|
|
@@ -92675,17 +93099,17 @@ var TextChunker = class {
|
|
|
92675
93099
|
return chunks;
|
|
92676
93100
|
}
|
|
92677
93101
|
};
|
|
92678
|
-
function splitKeepingSeparator(text10,
|
|
92679
|
-
if (
|
|
93102
|
+
function splitKeepingSeparator(text10, sep18) {
|
|
93103
|
+
if (sep18 === "")
|
|
92680
93104
|
return [text10];
|
|
92681
93105
|
const parts = [];
|
|
92682
93106
|
let start = 0;
|
|
92683
93107
|
for (; ; ) {
|
|
92684
|
-
const at = text10.indexOf(
|
|
93108
|
+
const at = text10.indexOf(sep18, start);
|
|
92685
93109
|
if (at === -1)
|
|
92686
93110
|
break;
|
|
92687
|
-
parts.push(text10.slice(start, at +
|
|
92688
|
-
start = at +
|
|
93111
|
+
parts.push(text10.slice(start, at + sep18.length));
|
|
93112
|
+
start = at + sep18.length;
|
|
92689
93113
|
}
|
|
92690
93114
|
if (start < text10.length)
|
|
92691
93115
|
parts.push(text10.slice(start));
|
|
@@ -94754,6 +95178,9 @@ var MAPPING = {
|
|
|
94754
95178
|
// a peer models a task lifecycle — shipping a session's deleted history over
|
|
94755
95179
|
// an external wire by default is a disclosure nobody asked for.
|
|
94756
95180
|
compaction_started: null,
|
|
95181
|
+
// Where this runtime keeps its own transcript is not a fact about a peer's task.
|
|
95182
|
+
session_log_degraded: null,
|
|
95183
|
+
session_log_recovered: null,
|
|
94757
95184
|
compaction_shed: null,
|
|
94758
95185
|
compaction_completed: null,
|
|
94759
95186
|
// Same reason as the two below: which of this runtime's context-relief
|
|
@@ -94922,8 +95349,8 @@ function operationBoundary(options) {
|
|
|
94922
95349
|
let cause;
|
|
94923
95350
|
let transportAbortArmed = options.abortTransportInitially;
|
|
94924
95351
|
let resolveStopped;
|
|
94925
|
-
const stopped = new Promise((
|
|
94926
|
-
resolveStopped =
|
|
95352
|
+
const stopped = new Promise((resolve35) => {
|
|
95353
|
+
resolveStopped = resolve35;
|
|
94927
95354
|
});
|
|
94928
95355
|
const stop = /* @__PURE__ */ __name((next2) => {
|
|
94929
95356
|
if (cause !== void 0)
|
|
@@ -95161,8 +95588,8 @@ var A2ADelegate = class {
|
|
|
95161
95588
|
*/
|
|
95162
95589
|
async recoverInitialTask(request) {
|
|
95163
95590
|
let timer;
|
|
95164
|
-
const expired = new Promise((
|
|
95165
|
-
timer = setTimeout(() =>
|
|
95591
|
+
const expired = new Promise((resolve35) => {
|
|
95592
|
+
timer = setTimeout(() => resolve35(void 0), PEER_CANCEL_GRACE_MS);
|
|
95166
95593
|
});
|
|
95167
95594
|
try {
|
|
95168
95595
|
const recovered = await Promise.race([
|
|
@@ -95256,7 +95683,7 @@ var A2ADelegate = class {
|
|
|
95256
95683
|
};
|
|
95257
95684
|
function sleep2(ms, signal) {
|
|
95258
95685
|
signal.throwIfAborted();
|
|
95259
|
-
return new Promise((
|
|
95686
|
+
return new Promise((resolve35, reject2) => {
|
|
95260
95687
|
let settled = false;
|
|
95261
95688
|
const cleanup = /* @__PURE__ */ __name(() => signal.removeEventListener("abort", onAbort), "cleanup");
|
|
95262
95689
|
const onAbort = /* @__PURE__ */ __name(() => {
|
|
@@ -95272,7 +95699,7 @@ function sleep2(ms, signal) {
|
|
|
95272
95699
|
return;
|
|
95273
95700
|
settled = true;
|
|
95274
95701
|
cleanup();
|
|
95275
|
-
|
|
95702
|
+
resolve35();
|
|
95276
95703
|
}, ms);
|
|
95277
95704
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
95278
95705
|
if (signal.aborted)
|
|
@@ -95415,6 +95842,22 @@ var MAPPING2 = {
|
|
|
95415
95842
|
failures: e.failures
|
|
95416
95843
|
}), "transform")
|
|
95417
95844
|
},
|
|
95845
|
+
session_log_degraded: {
|
|
95846
|
+
wire: "session_log.degraded",
|
|
95847
|
+
transform: /* @__PURE__ */ __name((e) => ({
|
|
95848
|
+
cause: e.cause,
|
|
95849
|
+
buffered_records: e.bufferedRecords,
|
|
95850
|
+
buffered_bytes: e.bufferedBytes,
|
|
95851
|
+
...e.dropping ? { dropping: true } : {}
|
|
95852
|
+
}), "transform")
|
|
95853
|
+
},
|
|
95854
|
+
session_log_recovered: {
|
|
95855
|
+
wire: "session_log.recovered",
|
|
95856
|
+
transform: /* @__PURE__ */ __name((e) => ({
|
|
95857
|
+
flushed_records: e.flushedRecords,
|
|
95858
|
+
dropped_records: e.droppedRecords
|
|
95859
|
+
}), "transform")
|
|
95860
|
+
},
|
|
95418
95861
|
compaction_started: {
|
|
95419
95862
|
wire: "compaction.started",
|
|
95420
95863
|
transform: /* @__PURE__ */ __name((e) => ({
|
|
@@ -95836,7 +96279,7 @@ __name(mapSessionEventToStreamEvent, "mapSessionEventToStreamEvent");
|
|
|
95836
96279
|
var mapSessionToStreamEvent = mapSessionEventToStreamEvent;
|
|
95837
96280
|
|
|
95838
96281
|
// ../sdk/dist/bridge/acp/server.js
|
|
95839
|
-
import { isAbsolute as
|
|
96282
|
+
import { isAbsolute as isAbsolute12 } from "node:path";
|
|
95840
96283
|
|
|
95841
96284
|
// ../sdk/dist/bridge/acp/tasks.js
|
|
95842
96285
|
function toAcpTaskUpdate(event, sessionId5) {
|
|
@@ -96139,7 +96582,7 @@ var ACPServer = class {
|
|
|
96139
96582
|
request(method, params, signal) {
|
|
96140
96583
|
this.requestSeq += 1;
|
|
96141
96584
|
const id3 = `agent_${this.requestSeq}`;
|
|
96142
|
-
return new Promise((
|
|
96585
|
+
return new Promise((resolve35, reject2) => {
|
|
96143
96586
|
const finish2 = /* @__PURE__ */ __name(() => {
|
|
96144
96587
|
if (this.pending.get(id3) !== entry)
|
|
96145
96588
|
return false;
|
|
@@ -96154,7 +96597,7 @@ var ACPServer = class {
|
|
|
96154
96597
|
const entry = {
|
|
96155
96598
|
resolve: /* @__PURE__ */ __name((value) => {
|
|
96156
96599
|
if (finish2())
|
|
96157
|
-
|
|
96600
|
+
resolve35(value);
|
|
96158
96601
|
}, "resolve"),
|
|
96159
96602
|
reject: /* @__PURE__ */ __name((error) => {
|
|
96160
96603
|
if (finish2())
|
|
@@ -96301,7 +96744,7 @@ var ACPServer = class {
|
|
|
96301
96744
|
}
|
|
96302
96745
|
requireAbsoluteCwd(cwd) {
|
|
96303
96746
|
const resolved2 = cwd ?? process.cwd();
|
|
96304
|
-
if (!
|
|
96747
|
+
if (!isAbsolute12(resolved2)) {
|
|
96305
96748
|
throw new AcpError(ACP_ERROR_CODES.INVALID_PARAMS, `ACP session cwd must be an absolute path; received ${JSON.stringify(resolved2)}.`);
|
|
96306
96749
|
}
|
|
96307
96750
|
return resolved2;
|
|
@@ -96844,7 +97287,7 @@ var FileLockManager = class {
|
|
|
96844
97287
|
return immediate;
|
|
96845
97288
|
const deadline = Date.now() + this.config.acquireTimeoutMs;
|
|
96846
97289
|
while (Date.now() < deadline) {
|
|
96847
|
-
await new Promise((
|
|
97290
|
+
await new Promise((resolve35) => setTimeout(resolve35, LOCK_ACQUIRE_POLL_INTERVAL_MS));
|
|
96848
97291
|
this.expireStale();
|
|
96849
97292
|
const retry = this.tryAcquire(filePath, owner);
|
|
96850
97293
|
if (retry.acquired)
|
|
@@ -97461,7 +97904,7 @@ var WorkspaceBackendRegistry = class {
|
|
|
97461
97904
|
import { execFile } from "node:child_process";
|
|
97462
97905
|
import { readFileSync as readFileSync3, realpathSync as realpathSync4 } from "node:fs";
|
|
97463
97906
|
import { realpath as realpath11 } from "node:fs/promises";
|
|
97464
|
-
import { basename as basename11, dirname as dirname20, isAbsolute as
|
|
97907
|
+
import { basename as basename11, dirname as dirname20, isAbsolute as isAbsolute13, join as join37, relative as relative7, resolve as resolve19, sep as sep10 } from "node:path";
|
|
97465
97908
|
import { promisify } from "node:util";
|
|
97466
97909
|
var execFileAsync = promisify(execFile);
|
|
97467
97910
|
var defaultExecFile = /* @__PURE__ */ __name(async (file, args) => execFileAsync(file, [...args]), "defaultExecFile");
|
|
@@ -97475,8 +97918,8 @@ var GitWorktreeDriver = class {
|
|
|
97475
97918
|
log;
|
|
97476
97919
|
exec;
|
|
97477
97920
|
constructor(config) {
|
|
97478
|
-
this.repoRoot =
|
|
97479
|
-
this.worktreesDir =
|
|
97921
|
+
this.repoRoot = resolve19(config.repoRoot);
|
|
97922
|
+
this.worktreesDir = resolve19(config.worktreesDir ?? defaultWorktreesDir(config.repoRoot));
|
|
97480
97923
|
this.log = config.logger.child({ [SCOPE_ATTRIBUTE]: "session/workspace/git-worktree" });
|
|
97481
97924
|
this.exec = config.execFile ?? defaultExecFile;
|
|
97482
97925
|
}
|
|
@@ -97489,7 +97932,7 @@ var GitWorktreeDriver = class {
|
|
|
97489
97932
|
try {
|
|
97490
97933
|
repoRoot = await canonicalizeThroughExisting(this.repoRoot);
|
|
97491
97934
|
worktreesDir = await canonicalizeThroughExisting(this.worktreesDir);
|
|
97492
|
-
const lexicalPath =
|
|
97935
|
+
const lexicalPath = resolve19(worktreesDir, label6);
|
|
97493
97936
|
if (!isStrictDescendant(worktreesDir, lexicalPath)) {
|
|
97494
97937
|
throw new Error(`Workspace label escapes the managed worktree directory: ${label6}`);
|
|
97495
97938
|
}
|
|
@@ -97497,13 +97940,13 @@ var GitWorktreeDriver = class {
|
|
|
97497
97940
|
if (!isStrictDescendant(worktreesDir, worktreePath)) {
|
|
97498
97941
|
throw new Error(`Workspace label resolves through a link outside the managed worktree directory: ${label6}`);
|
|
97499
97942
|
}
|
|
97500
|
-
if (
|
|
97943
|
+
if (relative7(worktreesDir, lexicalPath) !== relative7(worktreesDir, worktreePath)) {
|
|
97501
97944
|
throw new Error(`Workspace label resolves through a link to a different managed path: ${label6}`);
|
|
97502
97945
|
}
|
|
97503
97946
|
} catch (cause) {
|
|
97504
97947
|
throw new WorkspaceBackendError({ op: "create:ownership", kind: this.kind, cause });
|
|
97505
97948
|
}
|
|
97506
|
-
const relativePath =
|
|
97949
|
+
const relativePath = relative7(worktreesDir, worktreePath).split(sep10).join("/");
|
|
97507
97950
|
const branch = `namzu/${relativePath}`;
|
|
97508
97951
|
const argv = ["-C", repoRoot, "worktree", "add", "-b", branch, "--", worktreePath];
|
|
97509
97952
|
if (params.baseRef !== void 0) {
|
|
@@ -97677,7 +98120,7 @@ var GitWorktreeDriver = class {
|
|
|
97677
98120
|
if (!isStrictDescendant(worktreesDir, worktreePath)) {
|
|
97678
98121
|
throw new Error("Workspace reference escapes the managed worktree directory");
|
|
97679
98122
|
}
|
|
97680
|
-
const label6 =
|
|
98123
|
+
const label6 = relative7(worktreesDir, worktreePath).split(sep10).join("/");
|
|
97681
98124
|
const branch = `namzu/${label6}`;
|
|
97682
98125
|
if (ref.meta.branch !== branch) {
|
|
97683
98126
|
throw new Error("Workspace reference branch does not match its managed path");
|
|
@@ -97712,12 +98155,12 @@ var GitWorktreeDriver = class {
|
|
|
97712
98155
|
}
|
|
97713
98156
|
};
|
|
97714
98157
|
async function canonicalizeThroughExisting(input) {
|
|
97715
|
-
let existing =
|
|
98158
|
+
let existing = resolve19(input);
|
|
97716
98159
|
const remainder = [];
|
|
97717
98160
|
for (; ; ) {
|
|
97718
98161
|
try {
|
|
97719
98162
|
const canonical3 = await realpath11(existing);
|
|
97720
|
-
return
|
|
98163
|
+
return resolve19(canonical3, ...remainder);
|
|
97721
98164
|
} catch (cause) {
|
|
97722
98165
|
const code = cause.code;
|
|
97723
98166
|
if (code !== "ENOENT" && code !== "ENOTDIR")
|
|
@@ -97725,15 +98168,15 @@ async function canonicalizeThroughExisting(input) {
|
|
|
97725
98168
|
}
|
|
97726
98169
|
const parent = dirname20(existing);
|
|
97727
98170
|
if (parent === existing)
|
|
97728
|
-
return
|
|
98171
|
+
return resolve19(existing, ...remainder);
|
|
97729
98172
|
remainder.unshift(basename11(existing));
|
|
97730
98173
|
existing = parent;
|
|
97731
98174
|
}
|
|
97732
98175
|
}
|
|
97733
98176
|
__name(canonicalizeThroughExisting, "canonicalizeThroughExisting");
|
|
97734
98177
|
function isStrictDescendant(root, candidate) {
|
|
97735
|
-
const rel =
|
|
97736
|
-
return rel !== "" && rel !== ".." && !rel.startsWith(`..${
|
|
98178
|
+
const rel = relative7(root, candidate);
|
|
98179
|
+
return rel !== "" && rel !== ".." && !rel.startsWith(`..${sep10}`) && !isAbsolute13(rel);
|
|
97737
98180
|
}
|
|
97738
98181
|
__name(isStrictDescendant, "isStrictDescendant");
|
|
97739
98182
|
function parseWorktreeList(stdout, worktreePath) {
|
|
@@ -97767,7 +98210,7 @@ function defaultWorktreesDir(repoRoot) {
|
|
|
97767
98210
|
try {
|
|
97768
98211
|
cwd = realpathSync4(repoRoot);
|
|
97769
98212
|
} catch {
|
|
97770
|
-
cwd =
|
|
98213
|
+
cwd = resolve19(repoRoot);
|
|
97771
98214
|
}
|
|
97772
98215
|
const home = resolveNamzuHome();
|
|
97773
98216
|
let slug = slugForCwd(cwd);
|
|
@@ -97783,7 +98226,7 @@ __name(defaultWorktreesDir, "defaultWorktreesDir");
|
|
|
97783
98226
|
|
|
97784
98227
|
// ../sdk/dist/session/workspace/shared-session.js
|
|
97785
98228
|
import { mkdir as mkdir17, readFile as readFile19, rename as rename8, writeFile as writeFile6 } from "node:fs/promises";
|
|
97786
|
-
import { dirname as dirname21, join as join38, normalize as normalize6, relative as
|
|
98229
|
+
import { dirname as dirname21, join as join38, normalize as normalize6, relative as relative8, sep as sep11 } from "node:path";
|
|
97787
98230
|
import { posix as posix3 } from "node:path";
|
|
97788
98231
|
var SharedSessionWorkspace = class _SharedSessionWorkspace {
|
|
97789
98232
|
static {
|
|
@@ -97825,7 +98268,7 @@ var SharedSessionWorkspace = class _SharedSessionWorkspace {
|
|
|
97825
98268
|
runtimePath(...segments) {
|
|
97826
98269
|
if (segments.length === 0)
|
|
97827
98270
|
return this.runtimeRoot;
|
|
97828
|
-
return posix3.join(this.runtimeRoot, ...segments.map((segment2) => segment2.split(
|
|
98271
|
+
return posix3.join(this.runtimeRoot, ...segments.map((segment2) => segment2.split(sep11).join("/")));
|
|
97829
98272
|
}
|
|
97830
98273
|
async ensure() {
|
|
97831
98274
|
await Promise.all([
|
|
@@ -97998,8 +98441,8 @@ ${ensureTrailingNewline(input.sectionText)}` : ensureTrailingNewline(input.secti
|
|
|
97998
98441
|
};
|
|
97999
98442
|
function safeJoin(root, segments) {
|
|
98000
98443
|
const fullPath = normalize6(join38(root, ...segments));
|
|
98001
|
-
const rel =
|
|
98002
|
-
if (rel === "" || !rel.startsWith("..") && !rel.includes(`..${
|
|
98444
|
+
const rel = relative8(root, fullPath);
|
|
98445
|
+
if (rel === "" || !rel.startsWith("..") && !rel.includes(`..${sep11}`))
|
|
98003
98446
|
return fullPath;
|
|
98004
98447
|
throw new Error(`SharedSessionWorkspace path escapes root: ${segments.join("/")}`);
|
|
98005
98448
|
}
|
|
@@ -99015,13 +99458,13 @@ __name(readText, "readText");
|
|
|
99015
99458
|
|
|
99016
99459
|
// ../sdk/dist/store/session/memory.js
|
|
99017
99460
|
import { realpathSync as realpathSync5 } from "node:fs";
|
|
99018
|
-
import { resolve as
|
|
99461
|
+
import { resolve as resolve21 } from "node:path";
|
|
99019
99462
|
|
|
99020
99463
|
// ../sdk/dist/store/session/canonical-path.js
|
|
99021
99464
|
import { realpath as realpath12 } from "node:fs/promises";
|
|
99022
|
-
import { resolve as
|
|
99465
|
+
import { resolve as resolve20 } from "node:path";
|
|
99023
99466
|
async function canonicalizePath2(input) {
|
|
99024
|
-
const absolute =
|
|
99467
|
+
const absolute = resolve20(input);
|
|
99025
99468
|
try {
|
|
99026
99469
|
return await realpath12(absolute);
|
|
99027
99470
|
} catch (err) {
|
|
@@ -99115,7 +99558,7 @@ var InMemorySessionStore = class {
|
|
|
99115
99558
|
} catch (error) {
|
|
99116
99559
|
if (error.code !== "ENOENT")
|
|
99117
99560
|
throw error;
|
|
99118
|
-
rootPath =
|
|
99561
|
+
rootPath = resolve21(project.rootPath);
|
|
99119
99562
|
}
|
|
99120
99563
|
const key6 = `${project.tenantId}\0${rootPath}`;
|
|
99121
99564
|
const existingProjectId = roots.get(key6);
|
|
@@ -99497,9 +99940,9 @@ var InMemorySessionStore = class {
|
|
|
99497
99940
|
};
|
|
99498
99941
|
|
|
99499
99942
|
// ../sdk/dist/store/session/disk.js
|
|
99500
|
-
import { createHash as
|
|
99943
|
+
import { createHash as createHash29 } from "node:crypto";
|
|
99501
99944
|
import { mkdir as mkdir19, rm as rm7 } from "node:fs/promises";
|
|
99502
|
-
import { join as join40, resolve as
|
|
99945
|
+
import { join as join40, resolve as resolve22 } from "node:path";
|
|
99503
99946
|
var SCHEMA9 = defineSchema({
|
|
99504
99947
|
kind: "session-store",
|
|
99505
99948
|
current: 4,
|
|
@@ -99548,7 +99991,7 @@ var DiskSessionStore = class {
|
|
|
99548
99991
|
this.rootDir = config.rootDir;
|
|
99549
99992
|
}
|
|
99550
99993
|
async withSessionWrite(sessionId5, operation) {
|
|
99551
|
-
const key6 =
|
|
99994
|
+
const key6 = resolve22(this.rootDir, sessionId5);
|
|
99552
99995
|
const previous = sessionWriters.get(key6) ?? Promise.resolve();
|
|
99553
99996
|
let release2 = /* @__PURE__ */ __name(() => {
|
|
99554
99997
|
}, "release");
|
|
@@ -99666,7 +100109,7 @@ var DiskSessionStore = class {
|
|
|
99666
100109
|
}
|
|
99667
100110
|
rootPathBindingLocation(rootPath, tenantId2) {
|
|
99668
100111
|
const key6 = rootPathIndexKey(rootPath, tenantId2);
|
|
99669
|
-
const digest8 =
|
|
100112
|
+
const digest8 = createHash29("sha256").update(key6).digest("hex");
|
|
99670
100113
|
const root = join40(this.rootDir, "projects", ".root-path-index", digest8.slice(0, 2));
|
|
99671
100114
|
return {
|
|
99672
100115
|
legacyPath: join40(root, `${digest8.slice(2)}.json`),
|
|
@@ -101467,7 +101910,7 @@ function codingAgentDoctrineContribution(options = {}) {
|
|
|
101467
101910
|
__name(codingAgentDoctrineContribution, "codingAgentDoctrineContribution");
|
|
101468
101911
|
|
|
101469
101912
|
// ../sdk/dist/learning/skill.js
|
|
101470
|
-
import { createHash as
|
|
101913
|
+
import { createHash as createHash30 } from "node:crypto";
|
|
101471
101914
|
var label = external_exports.string().trim().min(1).max(256);
|
|
101472
101915
|
var name = external_exports.string().regex(/^[a-z0-9][a-z0-9_-]{0,63}$/);
|
|
101473
101916
|
var digest3 = external_exports.string().regex(/^[a-f0-9]{64}$/);
|
|
@@ -101620,7 +102063,7 @@ function reviseLearningProfile(current, input) {
|
|
|
101620
102063
|
__name(reviseLearningProfile, "reviseLearningProfile");
|
|
101621
102064
|
function hashLearningSkill(input) {
|
|
101622
102065
|
const candidate = candidateSchema.parse(input);
|
|
101623
|
-
return
|
|
102066
|
+
return createHash30("sha256").update(JSON.stringify([
|
|
101624
102067
|
candidate.name,
|
|
101625
102068
|
candidate.description,
|
|
101626
102069
|
candidate.body,
|
|
@@ -101660,13 +102103,13 @@ function promoteLearningSkill(current, input, evaluation, inputEvidence) {
|
|
|
101660
102103
|
verification: {
|
|
101661
102104
|
baselineHash,
|
|
101662
102105
|
candidateHash: hash2,
|
|
101663
|
-
evidenceDigest:
|
|
102106
|
+
evidenceDigest: createHash30("sha256").update(JSON.stringify({ ...evaluation, protection })).digest("hex"),
|
|
101664
102107
|
verificationTasks: review.verification.tasks.length,
|
|
101665
102108
|
confirmationTasks: review.confirmation?.tasks.length ?? 0,
|
|
101666
102109
|
protection: {
|
|
101667
102110
|
verificationTasks: protection.verification.length,
|
|
101668
102111
|
confirmationTasks: protection.confirmation.length,
|
|
101669
|
-
planDigest:
|
|
102112
|
+
planDigest: createHash30("sha256").update(JSON.stringify(protection)).digest("hex")
|
|
101670
102113
|
}
|
|
101671
102114
|
}
|
|
101672
102115
|
};
|
|
@@ -102273,12 +102716,12 @@ function openTerminalWith(pty, options, defaults2) {
|
|
|
102273
102716
|
for (const listener of listeners)
|
|
102274
102717
|
listener(chunk);
|
|
102275
102718
|
});
|
|
102276
|
-
const exited = new Promise((
|
|
102719
|
+
const exited = new Promise((resolve35) => {
|
|
102277
102720
|
const exitSub = child.onExit((event) => {
|
|
102278
102721
|
dataSub.dispose();
|
|
102279
102722
|
exitSub.dispose();
|
|
102280
102723
|
listeners.clear();
|
|
102281
|
-
|
|
102724
|
+
resolve35(event);
|
|
102282
102725
|
});
|
|
102283
102726
|
});
|
|
102284
102727
|
return {
|
|
@@ -102424,7 +102867,7 @@ function analyzeContextUsage(input) {
|
|
|
102424
102867
|
__name(analyzeContextUsage, "analyzeContextUsage");
|
|
102425
102868
|
|
|
102426
102869
|
// ../sdk/dist/manager/resident/store.js
|
|
102427
|
-
import { createHash as
|
|
102870
|
+
import { createHash as createHash31, randomUUID as randomUUID9 } from "node:crypto";
|
|
102428
102871
|
import { join as join41 } from "node:path";
|
|
102429
102872
|
var text7 = external_exports.string().trim().min(1).max(8e3);
|
|
102430
102873
|
var time = external_exports.number().int().nonnegative().safe();
|
|
@@ -102472,7 +102915,7 @@ var residentStateSchema = external_exports.object({
|
|
|
102472
102915
|
});
|
|
102473
102916
|
function residentKeySegment(key6) {
|
|
102474
102917
|
const encoded = revisionFileSegment(key6);
|
|
102475
|
-
return encoded.length <= 255 ? encoded : `~sha256-${
|
|
102918
|
+
return encoded.length <= 255 ? encoded : `~sha256-${createHash31("sha256").update(encoded).digest("hex")}`;
|
|
102476
102919
|
}
|
|
102477
102920
|
__name(residentKeySegment, "residentKeySegment");
|
|
102478
102921
|
var ResidentConflictError = class extends Error {
|
|
@@ -102666,13 +103109,13 @@ __name(runResident, "runResident");
|
|
|
102666
103109
|
|
|
102667
103110
|
// ../sdk/dist/manager/resident/agenda.js
|
|
102668
103111
|
import { randomUUID as randomUUID11 } from "node:crypto";
|
|
102669
|
-
import { join as join43, resolve as
|
|
103112
|
+
import { join as join43, resolve as resolve24 } from "node:path";
|
|
102670
103113
|
import { isDeepStrictEqual as isDeepStrictEqual6 } from "node:util";
|
|
102671
103114
|
|
|
102672
103115
|
// ../sdk/dist/manager/resident/history-disk.js
|
|
102673
103116
|
import { constants as constants5 } from "node:fs";
|
|
102674
103117
|
import { lstat as lstat10, open as open14 } from "node:fs/promises";
|
|
102675
|
-
import { join as join42, relative as
|
|
103118
|
+
import { join as join42, relative as relative9, resolve as resolve23, sep as sep12 } from "node:path";
|
|
102676
103119
|
var RECORD_BYTES2 = 4 * 1024 * 1024;
|
|
102677
103120
|
var ResidentHistoryPageLimit = class extends Error {
|
|
102678
103121
|
static {
|
|
@@ -102681,12 +103124,12 @@ var ResidentHistoryPageLimit = class extends Error {
|
|
|
102681
103124
|
};
|
|
102682
103125
|
async function readResidentHistoryRecord(root, path3, budget) {
|
|
102683
103126
|
budget.signal?.throwIfAborted();
|
|
102684
|
-
const base3 =
|
|
102685
|
-
const suffix =
|
|
102686
|
-
if (suffix === ".." || suffix.startsWith(`..${
|
|
103127
|
+
const base3 = resolve23(root);
|
|
103128
|
+
const suffix = relative9(base3, resolve23(path3));
|
|
103129
|
+
if (suffix === ".." || suffix.startsWith(`..${sep12}`))
|
|
102687
103130
|
throw new Error("Invalid history path.");
|
|
102688
103131
|
let current = base3;
|
|
102689
|
-
for (const part2 of ["", ...suffix.split(
|
|
103132
|
+
for (const part2 of ["", ...suffix.split(sep12).filter(Boolean)]) {
|
|
102690
103133
|
current = join42(current, part2);
|
|
102691
103134
|
if ((await lstat10(current)).isSymbolicLink())
|
|
102692
103135
|
throw new Error("History symlinks are refused.");
|
|
@@ -103410,8 +103853,8 @@ var DiskResidentAgenda = class {
|
|
|
103410
103853
|
revisionsDir: join43(directory, "revisions"),
|
|
103411
103854
|
publishLegacyProjection: false
|
|
103412
103855
|
};
|
|
103413
|
-
this.historyRoot =
|
|
103414
|
-
this.historyRevisions =
|
|
103856
|
+
this.historyRoot = resolve24(root);
|
|
103857
|
+
this.historyRevisions = resolve24(this.location.revisionsDir);
|
|
103415
103858
|
}
|
|
103416
103859
|
checked(record3) {
|
|
103417
103860
|
const agenda = agendaSchema.parse(record3);
|
|
@@ -104302,7 +104745,7 @@ function createResidentDeliveryWindow(config) {
|
|
|
104302
104745
|
__name(createResidentDeliveryWindow, "createResidentDeliveryWindow");
|
|
104303
104746
|
|
|
104304
104747
|
// ../sdk/dist/learning/cycle.js
|
|
104305
|
-
import { createHash as
|
|
104748
|
+
import { createHash as createHash32, randomUUID as randomUUID12 } from "node:crypto";
|
|
104306
104749
|
|
|
104307
104750
|
// ../sdk/dist/learning/leak-tripwire.js
|
|
104308
104751
|
import { randomBytes as randomBytes7 } from "node:crypto";
|
|
@@ -104690,7 +105133,7 @@ ${exploration.evidence.reason}`
|
|
|
104690
105133
|
}, { subject: "exploration.trace", text: exploration.trace });
|
|
104691
105134
|
await append("exploration", {
|
|
104692
105135
|
observations: exploration,
|
|
104693
|
-
digest:
|
|
105136
|
+
digest: createHash32("sha256").update(JSON.stringify(exploration)).digest("hex")
|
|
104694
105137
|
}, "explore");
|
|
104695
105138
|
const problem2 = resourceProblem(true);
|
|
104696
105139
|
if (problem2)
|
|
@@ -104739,7 +105182,7 @@ ${s.revision}`).join("\n"),
|
|
|
104739
105182
|
await append("evaluation", {
|
|
104740
105183
|
baselineRevision,
|
|
104741
105184
|
candidateRevision,
|
|
104742
|
-
digest:
|
|
105185
|
+
digest: createHash32("sha256").update(JSON.stringify(batch)).digest("hex"),
|
|
104743
105186
|
baselineTrajectories: batch.baseline.map((t) => t.trajectoryId),
|
|
104744
105187
|
candidateTrajectories: batch.candidate.map((t) => t.trajectoryId)
|
|
104745
105188
|
}, name2);
|
|
@@ -105151,7 +105594,7 @@ __name(selectLearningExperience, "selectLearningExperience");
|
|
|
105151
105594
|
// ../sdk/dist/learning/experience-store.js
|
|
105152
105595
|
import { mkdirSync as mkdirSync4 } from "node:fs";
|
|
105153
105596
|
import { createRequire as createRequire3 } from "node:module";
|
|
105154
|
-
import { dirname as dirname22, resolve as
|
|
105597
|
+
import { dirname as dirname22, resolve as resolve25 } from "node:path";
|
|
105155
105598
|
var SCHEMA10 = `
|
|
105156
105599
|
CREATE TABLE experience (
|
|
105157
105600
|
ordinal INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
@@ -105173,7 +105616,7 @@ var SqliteLearningExperienceStore = class {
|
|
|
105173
105616
|
scope;
|
|
105174
105617
|
readOnly;
|
|
105175
105618
|
constructor(options) {
|
|
105176
|
-
this.databasePath =
|
|
105619
|
+
this.databasePath = resolve25(options.databasePath);
|
|
105177
105620
|
this.scope = Object.freeze({
|
|
105178
105621
|
tenantId: asTenantId(options.scope.tenantId.toLowerCase()),
|
|
105179
105622
|
projectId: asProjectId(options.scope.projectId.toLowerCase()),
|
|
@@ -105731,10 +106174,10 @@ function createResidentEvidenceRecallStep(options) {
|
|
|
105731
106174
|
__name(createResidentEvidenceRecallStep, "createResidentEvidenceRecallStep");
|
|
105732
106175
|
|
|
105733
106176
|
// ../sdk/dist/learning/store.js
|
|
105734
|
-
import { createHash as
|
|
106177
|
+
import { createHash as createHash33, randomUUID as randomUUID14 } from "node:crypto";
|
|
105735
106178
|
import { closeSync, existsSync as existsSync6, fsyncSync, linkSync, lstatSync as lstatSync3, mkdirSync as mkdirSync5, openSync, readFileSync as readFileSync4, unlinkSync, writeFileSync as writeFileSync3 } from "node:fs";
|
|
105736
106179
|
import { createRequire as createRequire4 } from "node:module";
|
|
105737
|
-
import { dirname as dirname23, join as join44, resolve as
|
|
106180
|
+
import { dirname as dirname23, join as join44, resolve as resolve26 } from "node:path";
|
|
105738
106181
|
|
|
105739
106182
|
// ../sdk/dist/learning/observation.js
|
|
105740
106183
|
var label4 = external_exports.string().trim().min(1).max(256);
|
|
@@ -105760,7 +106203,7 @@ var learningObservationSchema = learningTargetSchema.extend({
|
|
|
105760
106203
|
|
|
105761
106204
|
// ../sdk/dist/learning/store.js
|
|
105762
106205
|
var uuid2 = external_exports.string().uuid().transform((id3) => id3.toLowerCase());
|
|
105763
|
-
var digest4 = /* @__PURE__ */ __name((text10) =>
|
|
106206
|
+
var digest4 = /* @__PURE__ */ __name((text10) => createHash33("sha256").update(text10).digest("hex"), "digest");
|
|
105764
106207
|
var MAX_EVENT_BYTES = 256 * 1024;
|
|
105765
106208
|
var MAX_ARTIFACT_BYTES = 8 * 1024 * 1024;
|
|
105766
106209
|
var MAX_EVENTS = 4096;
|
|
@@ -105864,8 +106307,8 @@ var SqliteLearningStore = class {
|
|
|
105864
106307
|
scope;
|
|
105865
106308
|
readOnly;
|
|
105866
106309
|
constructor(options) {
|
|
105867
|
-
this.databasePath =
|
|
105868
|
-
this.artifactsPath =
|
|
106310
|
+
this.databasePath = resolve26(options.databasePath);
|
|
106311
|
+
this.artifactsPath = resolve26(options.artifactsPath);
|
|
105869
106312
|
this.scope = Object.freeze({
|
|
105870
106313
|
tenantId: asTenantId(options.scope.tenantId.toLowerCase()),
|
|
105871
106314
|
projectId: asProjectId(options.scope.projectId.toLowerCase()),
|
|
@@ -106368,7 +106811,7 @@ import { join as join46 } from "node:path";
|
|
|
106368
106811
|
|
|
106369
106812
|
// ../sdk/dist/peers/dir.js
|
|
106370
106813
|
import { chmodSync, lstatSync as lstatSync4, mkdirSync as mkdirSync6 } from "node:fs";
|
|
106371
|
-
import { tmpdir as
|
|
106814
|
+
import { tmpdir as tmpdir3 } from "node:os";
|
|
106372
106815
|
import { join as join45 } from "node:path";
|
|
106373
106816
|
var PeerDirectoryError = class extends Error {
|
|
106374
106817
|
static {
|
|
@@ -106420,7 +106863,7 @@ function peerRuntimeDirCandidates(options) {
|
|
|
106420
106863
|
if (options.env.XDG_RUNTIME_DIR)
|
|
106421
106864
|
candidates.push(join45(options.env.XDG_RUNTIME_DIR, "namzu"));
|
|
106422
106865
|
candidates.push(join45(options.namzuHome, "run"));
|
|
106423
|
-
candidates.push(join45(options.tmpDir ??
|
|
106866
|
+
candidates.push(join45(options.tmpDir ?? tmpdir3(), `namzu-${options.uid ?? "user"}`));
|
|
106424
106867
|
return candidates;
|
|
106425
106868
|
}
|
|
106426
106869
|
__name(peerRuntimeDirCandidates, "peerRuntimeDirCandidates");
|
|
@@ -106487,7 +106930,7 @@ function parsePeerAddress(address2) {
|
|
|
106487
106930
|
__name(parsePeerAddress, "parsePeerAddress");
|
|
106488
106931
|
|
|
106489
106932
|
// ../sdk/dist/peers/record.js
|
|
106490
|
-
import { createHash as
|
|
106933
|
+
import { createHash as createHash34 } from "node:crypto";
|
|
106491
106934
|
|
|
106492
106935
|
// ../sdk/dist/peers/protocol.js
|
|
106493
106936
|
var PEER_PROTOCOL_VERSION = "namzu-peer/1";
|
|
@@ -106617,7 +107060,7 @@ var PeerRecordSchema = external_exports.object({
|
|
|
106617
107060
|
var PeerRecordReaderSchema = PeerRecordSchema.strip();
|
|
106618
107061
|
var PEER_REF_HEX_LENGTH = 6;
|
|
106619
107062
|
function derivePeerRef(sessionId5) {
|
|
106620
|
-
return
|
|
107063
|
+
return createHash34("sha256").update(sessionId5, "utf8").digest("hex").slice(0, PEER_REF_HEX_LENGTH);
|
|
106621
107064
|
}
|
|
106622
107065
|
__name(derivePeerRef, "derivePeerRef");
|
|
106623
107066
|
|
|
@@ -106644,7 +107087,7 @@ function connectPath(address2) {
|
|
|
106644
107087
|
}
|
|
106645
107088
|
__name(connectPath, "connectPath");
|
|
106646
107089
|
function sendPeerRequest(address2, request, parseResponse, timeoutMs) {
|
|
106647
|
-
return new Promise((
|
|
107090
|
+
return new Promise((resolve35) => {
|
|
106648
107091
|
let settled = false;
|
|
106649
107092
|
const finish2 = /* @__PURE__ */ __name((result) => {
|
|
106650
107093
|
if (settled)
|
|
@@ -106652,7 +107095,7 @@ function sendPeerRequest(address2, request, parseResponse, timeoutMs) {
|
|
|
106652
107095
|
settled = true;
|
|
106653
107096
|
clearTimeout(timer);
|
|
106654
107097
|
socket.destroy();
|
|
106655
|
-
|
|
107098
|
+
resolve35(result);
|
|
106656
107099
|
}, "finish");
|
|
106657
107100
|
const unreachable = /* @__PURE__ */ __name((error) => finish2({
|
|
106658
107101
|
kind: "unreachable",
|
|
@@ -106664,7 +107107,7 @@ function sendPeerRequest(address2, request, parseResponse, timeoutMs) {
|
|
|
106664
107107
|
path3 = connectPath(address2);
|
|
106665
107108
|
} catch (error) {
|
|
106666
107109
|
clearTimeout(timer);
|
|
106667
|
-
|
|
107110
|
+
resolve35({
|
|
106668
107111
|
kind: "unreachable",
|
|
106669
107112
|
reason: error instanceof Error ? error.message : String(error)
|
|
106670
107113
|
});
|
|
@@ -107213,23 +107656,23 @@ async function createPeerEndpoint(options) {
|
|
|
107213
107656
|
void handleLine(buffered.subarray(0, newline)).catch(() => socket.destroy());
|
|
107214
107657
|
});
|
|
107215
107658
|
});
|
|
107216
|
-
await new Promise((
|
|
107659
|
+
await new Promise((resolve35, reject2) => {
|
|
107217
107660
|
const failed = /* @__PURE__ */ __name((error) => reject2(error), "failed");
|
|
107218
107661
|
server.once("error", failed);
|
|
107219
107662
|
server.listen({ path: listenPath }, () => {
|
|
107220
107663
|
server.removeListener("error", failed);
|
|
107221
|
-
|
|
107664
|
+
resolve35();
|
|
107222
107665
|
});
|
|
107223
107666
|
});
|
|
107224
107667
|
server.on("error", () => {
|
|
107225
107668
|
});
|
|
107226
107669
|
if (parsed.scheme === "uds")
|
|
107227
107670
|
chmodSync2(listenPath, 384);
|
|
107228
|
-
const close = /* @__PURE__ */ __name(() => new Promise((
|
|
107671
|
+
const close = /* @__PURE__ */ __name(() => new Promise((resolve35) => {
|
|
107229
107672
|
closing = true;
|
|
107230
107673
|
for (const socket of sockets)
|
|
107231
107674
|
socket.destroy();
|
|
107232
|
-
server.close(() =>
|
|
107675
|
+
server.close(() => resolve35());
|
|
107233
107676
|
}), "close");
|
|
107234
107677
|
return {
|
|
107235
107678
|
address: options.address,
|
|
@@ -107322,7 +107765,7 @@ __name(formatPeerNotice, "formatPeerNotice");
|
|
|
107322
107765
|
// ../sdk/dist/account/registry.js
|
|
107323
107766
|
import { randomBytes as randomBytes11 } from "node:crypto";
|
|
107324
107767
|
import { chmodSync as chmodSync3, closeSync as closeSync4, fsyncSync as fsyncSync3, mkdirSync as mkdirSync8, openSync as openSync4, readFileSync as readFileSync7, realpathSync as realpathSync6, renameSync as renameSync2, rmSync as rmSync2, unlinkSync as unlinkSync4, writeSync as writeSync3 } from "node:fs";
|
|
107325
|
-
import { basename as basename14, dirname as dirname26, isAbsolute as
|
|
107768
|
+
import { basename as basename14, dirname as dirname26, isAbsolute as isAbsolute14, join as join49, relative as relative10, resolve as resolve27 } from "node:path";
|
|
107326
107769
|
|
|
107327
107770
|
// ../sdk/dist/account/lock.js
|
|
107328
107771
|
import { randomBytes as randomBytes10 } from "node:crypto";
|
|
@@ -107653,7 +108096,7 @@ function createAccountRegistry(options = {}) {
|
|
|
107653
108096
|
}
|
|
107654
108097
|
__name(checkEndpointAndModel, "checkEndpointAndModel");
|
|
107655
108098
|
function realOrSelf(target) {
|
|
107656
|
-
let existing =
|
|
108099
|
+
let existing = resolve27(target);
|
|
107657
108100
|
const rest = [];
|
|
107658
108101
|
for (; ; ) {
|
|
107659
108102
|
try {
|
|
@@ -107661,7 +108104,7 @@ function createAccountRegistry(options = {}) {
|
|
|
107661
108104
|
} catch {
|
|
107662
108105
|
const parent = dirname26(existing);
|
|
107663
108106
|
if (parent === existing)
|
|
107664
|
-
return
|
|
108107
|
+
return resolve27(target);
|
|
107665
108108
|
rest.push(basename14(existing));
|
|
107666
108109
|
existing = parent;
|
|
107667
108110
|
}
|
|
@@ -107669,13 +108112,13 @@ function createAccountRegistry(options = {}) {
|
|
|
107669
108112
|
}
|
|
107670
108113
|
__name(realOrSelf, "realOrSelf");
|
|
107671
108114
|
function insideAccountsRoot(dir) {
|
|
107672
|
-
const rel =
|
|
107673
|
-
return rel !== "" && !rel.startsWith("..") && !
|
|
108115
|
+
const rel = relative10(realOrSelf(accountsRoot), realOrSelf(dir));
|
|
108116
|
+
return rel !== "" && !rel.startsWith("..") && !isAbsolute14(rel);
|
|
107674
108117
|
}
|
|
107675
108118
|
__name(insideAccountsRoot, "insideAccountsRoot");
|
|
107676
108119
|
function nests(outer, inner) {
|
|
107677
|
-
const rel =
|
|
107678
|
-
return rel === "" || !rel.startsWith("..") && !
|
|
108120
|
+
const rel = relative10(realOrSelf(outer), realOrSelf(inner));
|
|
108121
|
+
return rel === "" || !rel.startsWith("..") && !isAbsolute14(rel);
|
|
107679
108122
|
}
|
|
107680
108123
|
__name(nests, "nests");
|
|
107681
108124
|
const registry = {
|
|
@@ -107724,7 +108167,7 @@ function createAccountRegistry(options = {}) {
|
|
|
107724
108167
|
if (input.provider !== CODEX_PROVIDER) {
|
|
107725
108168
|
throw new AccountRegistryError("A Codex home account belongs to the codex provider only.");
|
|
107726
108169
|
}
|
|
107727
|
-
const dir =
|
|
108170
|
+
const dir = resolve27(input.dir ?? join49(accountsRoot, "codex", input.label));
|
|
107728
108171
|
if (!insideAccountsRoot(dir)) {
|
|
107729
108172
|
throw new AccountRegistryError("A Codex account directory must live under the Namzu accounts folder.");
|
|
107730
108173
|
}
|
|
@@ -107845,7 +108288,7 @@ __name(resolveBoundAccount, "resolveBoundAccount");
|
|
|
107845
108288
|
// ../sdk/dist/pals/store.js
|
|
107846
108289
|
import { randomUUID as randomUUID15 } from "node:crypto";
|
|
107847
108290
|
import { chmodSync as chmodSync4, closeSync as closeSync5, fsyncSync as fsyncSync4, linkSync as linkSync2, lstatSync as lstatSync7, mkdirSync as mkdirSync9, openSync as openSync5, readFileSync as readFileSync8, readdirSync as readdirSync3, realpathSync as realpathSync7, unlinkSync as unlinkSync5, writeSync as writeSync4 } from "node:fs";
|
|
107848
|
-
import { dirname as dirname27, isAbsolute as
|
|
108291
|
+
import { dirname as dirname27, isAbsolute as isAbsolute15, join as join50, relative as relative11, resolve as resolve28, sep as sep13 } from "node:path";
|
|
107849
108292
|
var ID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/u;
|
|
107850
108293
|
var REVISION_FILE = /^[1-9][0-9]*\.json$/u;
|
|
107851
108294
|
var PalConflictError = class extends Error {
|
|
@@ -107866,7 +108309,7 @@ function palId(id3) {
|
|
|
107866
108309
|
}
|
|
107867
108310
|
__name(palId, "palId");
|
|
107868
108311
|
function homePath(home) {
|
|
107869
|
-
const path3 =
|
|
108312
|
+
const path3 = resolve28(home);
|
|
107870
108313
|
mkdirSync9(path3, { recursive: true, mode: 448 });
|
|
107871
108314
|
const entry = lstatSync7(path3);
|
|
107872
108315
|
if (!entry.isDirectory() || entry.isSymbolicLink())
|
|
@@ -107878,8 +108321,8 @@ function homePath(home) {
|
|
|
107878
108321
|
}
|
|
107879
108322
|
__name(homePath, "homePath");
|
|
107880
108323
|
function contained(path3, root) {
|
|
107881
|
-
const rel =
|
|
107882
|
-
return rel === "" || !
|
|
108324
|
+
const rel = relative11(root, path3);
|
|
108325
|
+
return rel === "" || !isAbsolute15(rel) && rel !== ".." && !rel.startsWith(`..${sep13}`);
|
|
107883
108326
|
}
|
|
107884
108327
|
__name(contained, "contained");
|
|
107885
108328
|
function paths(home, workspaceRoot, id3) {
|
|
@@ -108113,7 +108556,7 @@ var DiskPalStore = class {
|
|
|
108113
108556
|
}
|
|
108114
108557
|
/** Exact validated host control directory; never an execution-computer claim. */
|
|
108115
108558
|
atWorkspace(cwd) {
|
|
108116
|
-
const lexical =
|
|
108559
|
+
const lexical = resolve28(cwd);
|
|
108117
108560
|
const canonical3 = realpathSync7(lexical);
|
|
108118
108561
|
const lexicalReserved = contained(lexical, this.workspaceRoot);
|
|
108119
108562
|
const canonicalReserved = contained(canonical3, this.workspaceRoot);
|
|
@@ -108121,7 +108564,7 @@ var DiskPalStore = class {
|
|
|
108121
108564
|
return null;
|
|
108122
108565
|
if (lexical !== canonical3)
|
|
108123
108566
|
throw new Error("Pal workspace is a symlink alias.");
|
|
108124
|
-
const rel =
|
|
108567
|
+
const rel = relative11(this.workspaceRoot, canonical3);
|
|
108125
108568
|
if (!ID.test(rel))
|
|
108126
108569
|
throw new Error("Reserved Pal control directories cannot run ordinary host sessions. Open the exact Pal workspace.");
|
|
108127
108570
|
const pal = this.get(rel);
|
|
@@ -108773,7 +109216,7 @@ var PAL_WORK_GUIDANCE = [
|
|
|
108773
109216
|
].join("\n\n");
|
|
108774
109217
|
|
|
108775
109218
|
// ../sdk/dist/pals/reference-images.js
|
|
108776
|
-
import { createHash as
|
|
109219
|
+
import { createHash as createHash35, randomUUID as randomUUID16 } from "node:crypto";
|
|
108777
109220
|
import { posix as posix4 } from "node:path";
|
|
108778
109221
|
var MAX_IMAGES = 8;
|
|
108779
109222
|
var MAX_IMAGE_BYTES = 3 * 1024 * 1024;
|
|
@@ -108817,7 +109260,7 @@ function preparePalReferenceImages(attachments) {
|
|
|
108817
109260
|
attachmentIndex: index + 1,
|
|
108818
109261
|
mediaType: attachment.mediaType,
|
|
108819
109262
|
data: attachment.data,
|
|
108820
|
-
sha256:
|
|
109263
|
+
sha256: createHash35("sha256").update(bytes).digest("hex"),
|
|
108821
109264
|
bytes: bytes.length
|
|
108822
109265
|
}));
|
|
108823
109266
|
}
|
|
@@ -108997,14 +109440,14 @@ __name(createPalReferenceImageTool, "createPalReferenceImageTool");
|
|
|
108997
109440
|
// ../sdk/dist/pals/communication/store.js
|
|
108998
109441
|
import { randomUUID as randomUUID17 } from "node:crypto";
|
|
108999
109442
|
import { chmodSync as chmodSync5, lstatSync as lstatSync8, mkdirSync as mkdirSync10, readdirSync as readdirSync4, realpathSync as realpathSync8 } from "node:fs";
|
|
109000
|
-
import { join as join51, resolve as
|
|
109443
|
+
import { join as join51, resolve as resolve29 } from "node:path";
|
|
109001
109444
|
import { isDeepStrictEqual as isDeepStrictEqual9 } from "node:util";
|
|
109002
109445
|
|
|
109003
109446
|
// ../sdk/dist/pals/communication/ingress-schema.js
|
|
109004
109447
|
import { isDeepStrictEqual as isDeepStrictEqual7 } from "node:util";
|
|
109005
109448
|
|
|
109006
109449
|
// ../sdk/dist/pals/communication/schema.js
|
|
109007
|
-
import { createHash as
|
|
109450
|
+
import { createHash as createHash36 } from "node:crypto";
|
|
109008
109451
|
var id2 = external_exports.string().uuid();
|
|
109009
109452
|
var sessionId3 = external_exports.custom((s) => isEntityId(s, "session"));
|
|
109010
109453
|
var turnId4 = external_exports.custom((s) => isEntityId(s, "turn"));
|
|
@@ -109099,7 +109542,7 @@ function freezeCommunicationValue(value) {
|
|
|
109099
109542
|
}
|
|
109100
109543
|
__name(freezeCommunicationValue, "freezeCommunicationValue");
|
|
109101
109544
|
function hash(value) {
|
|
109102
|
-
return
|
|
109545
|
+
return createHash36("sha256").update(JSON.stringify(value)).digest("hex");
|
|
109103
109546
|
}
|
|
109104
109547
|
__name(hash, "hash");
|
|
109105
109548
|
function addressTuple(value) {
|
|
@@ -109807,7 +110250,7 @@ var DiskPalCommunicationStore = class {
|
|
|
109807
110250
|
migrations: { 1: (value) => value }
|
|
109808
110251
|
}), "Pal communication", (record3) => record3.revision);
|
|
109809
110252
|
constructor(options) {
|
|
109810
|
-
this.root =
|
|
110253
|
+
this.root = resolve29(options.root);
|
|
109811
110254
|
this.secure = options.secureDirectory ?? ((path3) => {
|
|
109812
110255
|
if (process.platform !== "win32")
|
|
109813
110256
|
chmodSync5(path3, 448);
|
|
@@ -110675,7 +111118,7 @@ __name(dispatchPalMessagesOnce, "dispatchPalMessagesOnce");
|
|
|
110675
111118
|
|
|
110676
111119
|
// ../sdk/dist/pals/communication/policy.js
|
|
110677
111120
|
import { chmodSync as chmodSync6, lstatSync as lstatSync9, mkdirSync as mkdirSync11, readdirSync as readdirSync5, realpathSync as realpathSync9 } from "node:fs";
|
|
110678
|
-
import { join as join52, resolve as
|
|
111121
|
+
import { join as join52, resolve as resolve30 } from "node:path";
|
|
110679
111122
|
var PalMessagePermissionConflictError = class extends Error {
|
|
110680
111123
|
static {
|
|
110681
111124
|
__name(this, "PalMessagePermissionConflictError");
|
|
@@ -110711,7 +111154,7 @@ var DiskPalMessagePolicy = class {
|
|
|
110711
111154
|
secure;
|
|
110712
111155
|
records = new DiskRevisionRecordStore(defineSchema({ kind: "pal-message-permission", current: 1, migrations: {} }), "Pal message permission", (value) => value.revision);
|
|
110713
111156
|
constructor(options) {
|
|
110714
|
-
this.root =
|
|
111157
|
+
this.root = resolve30(options.root);
|
|
110715
111158
|
this.secure = options.secureDirectory ?? ((path3) => {
|
|
110716
111159
|
if (process.platform !== "win32")
|
|
110717
111160
|
chmodSync6(path3, 448);
|
|
@@ -110807,10 +111250,10 @@ var DiskPalMessagePolicy = class {
|
|
|
110807
111250
|
};
|
|
110808
111251
|
|
|
110809
111252
|
// ../sdk/dist/pals/activity/source.js
|
|
110810
|
-
import { createHash as
|
|
111253
|
+
import { createHash as createHash38 } from "node:crypto";
|
|
110811
111254
|
|
|
110812
111255
|
// ../sdk/dist/pals/activity/projection.js
|
|
110813
|
-
import { createHash as
|
|
111256
|
+
import { createHash as createHash37 } from "node:crypto";
|
|
110814
111257
|
var activityId2 = external_exports.custom((value) => isEntityId(value, "activity"));
|
|
110815
111258
|
var checkpointId3 = external_exports.custom((value) => isEntityId(value, "checkpoint"));
|
|
110816
111259
|
var toolUseId2 = external_exports.string().min(1).max(512).regex(/^[A-Za-z0-9_.:-]+$/);
|
|
@@ -110869,7 +111312,7 @@ function projectPalActivity(entry, scopeHash) {
|
|
|
110869
111312
|
return null;
|
|
110870
111313
|
}
|
|
110871
111314
|
return Object.freeze({
|
|
110872
|
-
id:
|
|
111315
|
+
id: createHash37("sha256").update(JSON.stringify(["pal-activity/1", scopeHash, pointer2])).digest("hex"),
|
|
110873
111316
|
type: record3.type,
|
|
110874
111317
|
sessionId: record3.sessionId,
|
|
110875
111318
|
..."turnId" in record3 ? { turnId: record3.turnId } : {},
|
|
@@ -110963,7 +111406,7 @@ function createPalActivitySource(options) {
|
|
|
110963
111406
|
if (definition.id !== scope.palId || definition.revision !== scope.profileRevision)
|
|
110964
111407
|
throw new PalActivityIntegrityError();
|
|
110965
111408
|
const workspace = definition.workspace;
|
|
110966
|
-
const scopeHash =
|
|
111409
|
+
const scopeHash = createHash38("sha256").update(JSON.stringify([
|
|
110967
111410
|
"pal-activity/1",
|
|
110968
111411
|
scope.tenantId,
|
|
110969
111412
|
scope.projectId,
|
|
@@ -111352,11 +111795,11 @@ __name(dispatchPalIngressOnce, "dispatchPalIngressOnce");
|
|
|
111352
111795
|
|
|
111353
111796
|
// ../sdk/dist/pals/channels/routes.js
|
|
111354
111797
|
import { chmodSync as chmodSync7, lstatSync as lstatSync10, mkdirSync as mkdirSync12, readdirSync as readdirSync6, realpathSync as realpathSync10 } from "node:fs";
|
|
111355
|
-
import { join as join53, resolve as
|
|
111798
|
+
import { join as join53, resolve as resolve31 } from "node:path";
|
|
111356
111799
|
import { isDeepStrictEqual as isDeepStrictEqual10 } from "node:util";
|
|
111357
111800
|
|
|
111358
111801
|
// ../sdk/dist/pals/channels/schema.js
|
|
111359
|
-
import { createHash as
|
|
111802
|
+
import { createHash as createHash39 } from "node:crypto";
|
|
111360
111803
|
var connectionSchema = external_exports.object({
|
|
111361
111804
|
tenantId: addressSchema2.shape.tenantId,
|
|
111362
111805
|
provider: label5,
|
|
@@ -111387,7 +111830,7 @@ var verifiedActionSchema = external_exports.object({
|
|
|
111387
111830
|
actionId: label5,
|
|
111388
111831
|
payloadDigest: external_exports.string().regex(/^[a-f0-9]{64}$/),
|
|
111389
111832
|
payload: external_exports.string().min(1).max(32e3).refine((value) => !value.includes("\0"))
|
|
111390
|
-
}).strict().refine((value) =>
|
|
111833
|
+
}).strict().refine((value) => createHash39("sha256").update(value.payload).digest("hex") === value.payloadDigest, "Channel action payload does not match its authenticated digest.");
|
|
111391
111834
|
var routeDecisionSchema = external_exports.object({
|
|
111392
111835
|
v: external_exports.literal(1),
|
|
111393
111836
|
revision: external_exports.literal(1),
|
|
@@ -111460,7 +111903,7 @@ var DiskPalChannelRoutes = class {
|
|
|
111460
111903
|
secure;
|
|
111461
111904
|
records = new DiskRevisionRecordStore(defineSchema({ kind: "pal-channel-route", current: 1, migrations: {} }), "Pal channel route", (record3) => record3.revision);
|
|
111462
111905
|
constructor(options) {
|
|
111463
|
-
this.root =
|
|
111906
|
+
this.root = resolve31(options.root);
|
|
111464
111907
|
this.secure = options.secureDirectory ?? ((path3) => {
|
|
111465
111908
|
if (process.platform !== "win32")
|
|
111466
111909
|
chmodSync7(path3, 448);
|
|
@@ -111782,7 +112225,7 @@ var PalChannelRouter = class {
|
|
|
111782
112225
|
|
|
111783
112226
|
// ../sdk/dist/pals/activity/subscription-store.js
|
|
111784
112227
|
import { chmodSync as chmodSync8, lstatSync as lstatSync11, mkdirSync as mkdirSync13, readdirSync as readdirSync7, realpathSync as realpathSync11 } from "node:fs";
|
|
111785
|
-
import { join as join54, resolve as
|
|
112228
|
+
import { join as join54, resolve as resolve32 } from "node:path";
|
|
111786
112229
|
import { isDeepStrictEqual as isDeepStrictEqual13 } from "node:util";
|
|
111787
112230
|
|
|
111788
112231
|
// ../sdk/dist/pals/activity/subscription-schema.js
|
|
@@ -111821,7 +112264,7 @@ var DiskPalActivitySubscriptionStore = class {
|
|
|
111821
112264
|
migrations: {}
|
|
111822
112265
|
}), "Pal activity subscription", (value) => value.revision);
|
|
111823
112266
|
constructor(options) {
|
|
111824
|
-
this.root =
|
|
112267
|
+
this.root = resolve32(options.root);
|
|
111825
112268
|
this.secure = options.secureDirectory ?? ((path3) => {
|
|
111826
112269
|
if (process.platform !== "win32")
|
|
111827
112270
|
chmodSync8(path3, 448);
|
|
@@ -111943,7 +112386,7 @@ var DiskPalActivitySubscriptionStore = class {
|
|
|
111943
112386
|
|
|
111944
112387
|
// ../sdk/dist/pals/activity/subscription-policy.js
|
|
111945
112388
|
import { chmodSync as chmodSync9, lstatSync as lstatSync12, mkdirSync as mkdirSync14, readdirSync as readdirSync8, realpathSync as realpathSync12 } from "node:fs";
|
|
111946
|
-
import { join as join55, resolve as
|
|
112389
|
+
import { join as join55, resolve as resolve33 } from "node:path";
|
|
111947
112390
|
import { isDeepStrictEqual as isDeepStrictEqual14 } from "node:util";
|
|
111948
112391
|
var PalActivitySubscriptionPermissionConflictError = class extends Error {
|
|
111949
112392
|
static {
|
|
@@ -111978,7 +112421,7 @@ var DiskPalActivitySubscriptionPolicy = class {
|
|
|
111978
112421
|
migrations: {}
|
|
111979
112422
|
}), "Pal activity subscription permission", (value) => value.revision);
|
|
111980
112423
|
constructor(options) {
|
|
111981
|
-
this.root =
|
|
112424
|
+
this.root = resolve33(options.root);
|
|
111982
112425
|
this.subscriptions = options.subscriptions;
|
|
111983
112426
|
this.secure = options.secureDirectory ?? ((path3) => {
|
|
111984
112427
|
if (process.platform !== "win32")
|
|
@@ -112240,7 +112683,7 @@ async function publishPalActivityOnce(options, id3, input) {
|
|
|
112240
112683
|
__name(publishPalActivityOnce, "publishPalActivityOnce");
|
|
112241
112684
|
|
|
112242
112685
|
// ../sdk/dist/pals/activity/causality.js
|
|
112243
|
-
import { createHash as
|
|
112686
|
+
import { createHash as createHash40 } from "node:crypto";
|
|
112244
112687
|
import { isDeepStrictEqual as isDeepStrictEqual16 } from "node:util";
|
|
112245
112688
|
var requestMarkerSchema = external_exports.object({
|
|
112246
112689
|
type: external_exports.literal("request_envelope"),
|
|
@@ -112319,7 +112762,7 @@ function createPalActivityCausalityResolver(options) {
|
|
|
112319
112762
|
const root = entries2[0]?.record;
|
|
112320
112763
|
if (root?.type !== "session_started" || root.parent || root.forkedFrom || root.tenantId !== scope.tenantId || root.projectId !== scope.projectId || root.cwd !== workspace || root.origin?.protocol !== "desktop" || root.origin.externalSessionId !== JSON.stringify(["namzu-pal", scope.palId, scope.profileRevision, scope.sessionId]))
|
|
112321
112764
|
unavailable3();
|
|
112322
|
-
const scopeHash =
|
|
112765
|
+
const scopeHash = createHash40("sha256").update(JSON.stringify([
|
|
112323
112766
|
"pal-activity/1",
|
|
112324
112767
|
scope.tenantId,
|
|
112325
112768
|
scope.projectId,
|
|
@@ -112558,7 +113001,7 @@ function admitToolFacts(value) {
|
|
|
112558
113001
|
__name(admitToolFacts, "admitToolFacts");
|
|
112559
113002
|
|
|
112560
113003
|
// ../sdk/dist/tools/builtins/glob.js
|
|
112561
|
-
import { isAbsolute as
|
|
113004
|
+
import { isAbsolute as isAbsolute17, join as join56, relative as relative13, sep as sep15 } from "node:path";
|
|
112562
113005
|
|
|
112563
113006
|
// ../sdk/dist/tools/posix-path.js
|
|
112564
113007
|
function normalizeSegments(path3) {
|
|
@@ -112608,7 +113051,7 @@ function resolveWithinPosix(root, candidate) {
|
|
|
112608
113051
|
__name(resolveWithinPosix, "resolveWithinPosix");
|
|
112609
113052
|
|
|
112610
113053
|
// ../sdk/dist/tools/builtins/search-support.js
|
|
112611
|
-
import { isAbsolute as
|
|
113054
|
+
import { isAbsolute as isAbsolute16, join as joinPath, posix as posix5, relative as relative12, sep as sep14 } from "node:path";
|
|
112612
113055
|
var SEARCH_BUDGET_MS = 12e3;
|
|
112613
113056
|
var MAX_FILES_SEARCHED = 5e4;
|
|
112614
113057
|
function openSearchBudget(parent, budgetMs = SEARCH_BUDGET_MS) {
|
|
@@ -112630,12 +113073,12 @@ function openSearchBudget(parent, budgetMs = SEARCH_BUDGET_MS) {
|
|
|
112630
113073
|
}
|
|
112631
113074
|
__name(openSearchBudget, "openSearchBudget");
|
|
112632
113075
|
function hostDisplayPath(workingDirectory, absolute) {
|
|
112633
|
-
const rel =
|
|
113076
|
+
const rel = relative12(workingDirectory, absolute);
|
|
112634
113077
|
if (rel === "")
|
|
112635
113078
|
return ".";
|
|
112636
|
-
if (rel === ".." || rel.startsWith(`..${
|
|
113079
|
+
if (rel === ".." || rel.startsWith(`..${sep14}`) || isAbsolute16(rel))
|
|
112637
113080
|
return absolute;
|
|
112638
|
-
return
|
|
113081
|
+
return sep14 === "/" ? rel : rel.split(sep14).join("/");
|
|
112639
113082
|
}
|
|
112640
113083
|
__name(hostDisplayPath, "hostDisplayPath");
|
|
112641
113084
|
function quoteControlPath(path3) {
|
|
@@ -112664,10 +113107,10 @@ function isReadDenied(context2, path3, sandboxRoot) {
|
|
|
112664
113107
|
return false;
|
|
112665
113108
|
if (sandboxRoot === void 0)
|
|
112666
113109
|
return context2.readDenied(path3);
|
|
112667
|
-
const
|
|
112668
|
-
if (
|
|
113110
|
+
const relative17 = posix5.relative(sandboxRoot, path3);
|
|
113111
|
+
if (relative17 === ".." || relative17.startsWith("../") || posix5.isAbsolute(relative17))
|
|
112669
113112
|
return true;
|
|
112670
|
-
return context2.readDenied(joinPath(context2.workingDirectory,
|
|
113113
|
+
return context2.readDenied(joinPath(context2.workingDirectory, relative17));
|
|
112671
113114
|
}
|
|
112672
113115
|
__name(isReadDenied, "isReadDenied");
|
|
112673
113116
|
|
|
@@ -112680,13 +113123,13 @@ var inputSchema9 = external_exports.object({
|
|
|
112680
113123
|
include_ignored: external_exports.boolean().optional().describe("Also return files that .gitignore and .ignore rules exclude, such as build output and dependencies. Default: false.")
|
|
112681
113124
|
});
|
|
112682
113125
|
function relativePattern(pattern, root, sandboxed) {
|
|
112683
|
-
let result = sandboxed ? pattern : pattern.split(
|
|
113126
|
+
let result = sandboxed ? pattern : pattern.split(sep15).join("/");
|
|
112684
113127
|
if (result.split("/").includes("..")) {
|
|
112685
113128
|
throw new Error('Glob pattern escapes the search directory through "..". Choose a contained path and a relative pattern.');
|
|
112686
113129
|
}
|
|
112687
|
-
if (sandboxed ? result.startsWith("/") :
|
|
113130
|
+
if (sandboxed ? result.startsWith("/") : isAbsolute17(pattern)) {
|
|
112688
113131
|
const contained2 = sandboxed ? resolveWithinPosix(root, result) : resolveWithin(root, pattern);
|
|
112689
|
-
result = sandboxed ? relativePosix(root, contained2) :
|
|
113132
|
+
result = sandboxed ? relativePosix(root, contained2) : relative13(root, contained2).split(sep15).join("/");
|
|
112690
113133
|
}
|
|
112691
113134
|
while (result.startsWith("./"))
|
|
112692
113135
|
result = result.slice(2);
|
|
@@ -112763,7 +113206,7 @@ var GlobTool = defineTool({
|
|
|
112763
113206
|
capped = true;
|
|
112764
113207
|
break;
|
|
112765
113208
|
}
|
|
112766
|
-
files.push(sandbox ? relativePosix(sandbox.rootDir, absolute) : hostDisplayPath(context2.workingDirectory, join56(lexicalRoot,
|
|
113209
|
+
files.push(sandbox ? relativePosix(sandbox.rootDir, absolute) : hostDisplayPath(context2.workingDirectory, join56(lexicalRoot, relative13(root, absolute))));
|
|
112767
113210
|
}
|
|
112768
113211
|
} catch (error) {
|
|
112769
113212
|
if (context2.abortSignal?.aborted)
|
|
@@ -112823,7 +113266,7 @@ ${ignoredHint(ignored)}` : "";
|
|
|
112823
113266
|
|
|
112824
113267
|
// ../sdk/dist/tools/builtins/code-analysis.js
|
|
112825
113268
|
import { realpath as realpath13, stat as stat13 } from "node:fs/promises";
|
|
112826
|
-
import { isAbsolute as
|
|
113269
|
+
import { isAbsolute as isAbsolute18, relative as relative14, sep as sep16 } from "node:path";
|
|
112827
113270
|
var DEFAULT_LIMIT = 50;
|
|
112828
113271
|
var MAX_LIMIT = 200;
|
|
112829
113272
|
var DEFAULT_MAX_CHARS = 2e4;
|
|
@@ -113103,10 +113546,10 @@ async function owningRoot(roots, target) {
|
|
|
113103
113546
|
}
|
|
113104
113547
|
__name(owningRoot, "owningRoot");
|
|
113105
113548
|
function relativeTo(root, path3) {
|
|
113106
|
-
const rel =
|
|
113107
|
-
if (rel === "" || rel === ".." || rel.startsWith(`..${
|
|
113549
|
+
const rel = relative14(root, path3);
|
|
113550
|
+
if (rel === "" || rel === ".." || rel.startsWith(`..${sep16}`) || isAbsolute18(rel))
|
|
113108
113551
|
return path3;
|
|
113109
|
-
return
|
|
113552
|
+
return sep16 === "/" ? rel : rel.split(sep16).join("/");
|
|
113110
113553
|
}
|
|
113111
113554
|
__name(relativeTo, "relativeTo");
|
|
113112
113555
|
function shortFunction(fn) {
|
|
@@ -113325,7 +113768,7 @@ __name(getCodeNavigationTools, "getCodeNavigationTools");
|
|
|
113325
113768
|
|
|
113326
113769
|
// ../sdk/dist/tools/builtins/grep.js
|
|
113327
113770
|
import { stat as stat14 } from "node:fs/promises";
|
|
113328
|
-
import { isAbsolute as
|
|
113771
|
+
import { isAbsolute as isAbsolute19, join as join57, relative as relative15, sep as sep17 } from "node:path";
|
|
113329
113772
|
async function readWithSignal(read, signal) {
|
|
113330
113773
|
signal?.throwIfAborted();
|
|
113331
113774
|
if (!signal)
|
|
@@ -113348,12 +113791,12 @@ async function readWithSignal(read, signal) {
|
|
|
113348
113791
|
}
|
|
113349
113792
|
__name(readWithSignal, "readWithSignal");
|
|
113350
113793
|
function relativeInclude(include, root, sandboxed) {
|
|
113351
|
-
let pattern = sandboxed ? include : include.split(
|
|
113794
|
+
let pattern = sandboxed ? include : include.split(sep17).join("/");
|
|
113352
113795
|
if (pattern.split("/").includes(".."))
|
|
113353
113796
|
throw new Error("Include pattern escapes the search directory");
|
|
113354
|
-
if (sandboxed ? pattern.startsWith("/") :
|
|
113797
|
+
if (sandboxed ? pattern.startsWith("/") : isAbsolute19(include)) {
|
|
113355
113798
|
const absolute = sandboxed ? resolveWithinPosix(root, pattern) : resolveWithin(root, include);
|
|
113356
|
-
pattern = sandboxed ? relativePosix(root, absolute) :
|
|
113799
|
+
pattern = sandboxed ? relativePosix(root, absolute) : relative15(root, absolute).split(sep17).join("/");
|
|
113357
113800
|
}
|
|
113358
113801
|
while (pattern.startsWith("./"))
|
|
113359
113802
|
pattern = pattern.slice(2);
|
|
@@ -113558,7 +114001,7 @@ var GrepTool = defineTool({
|
|
|
113558
114001
|
}
|
|
113559
114002
|
const lines = content.split("\n");
|
|
113560
114003
|
let fileMatches = 0;
|
|
113561
|
-
const relPath = sandbox ? relativePosix(sandbox.rootDir, filePath) : hostDisplayPath(context2.workingDirectory, join57(lexicalRoot,
|
|
114004
|
+
const relPath = sandbox ? relativePosix(sandbox.rootDir, filePath) : hostDisplayPath(context2.workingDirectory, join57(lexicalRoot, relative15(root, filePath)));
|
|
113562
114005
|
if (mode === "content" && input.only_matching) {
|
|
113563
114006
|
for (const fragment of matchingFragments(content, regex, multiline)) {
|
|
113564
114007
|
signal?.throwIfAborted();
|
|
@@ -114242,7 +114685,7 @@ async function waitForJobWithBounds(jobs, id3, options, now = Date.now) {
|
|
|
114242
114685
|
omittedOutputBytes
|
|
114243
114686
|
};
|
|
114244
114687
|
});
|
|
114245
|
-
const expiry = new Promise((
|
|
114688
|
+
const expiry = new Promise((resolve35) => {
|
|
114246
114689
|
const tick = setInterval(() => {
|
|
114247
114690
|
if (settled)
|
|
114248
114691
|
return;
|
|
@@ -114250,7 +114693,7 @@ async function waitForJobWithBounds(jobs, id3, options, now = Date.now) {
|
|
|
114250
114693
|
const elapsed = now() - startedAt;
|
|
114251
114694
|
if (elapsed >= options.wallMs) {
|
|
114252
114695
|
clearInterval(tick);
|
|
114253
|
-
|
|
114696
|
+
resolve35({
|
|
114254
114697
|
kind: "timeout",
|
|
114255
114698
|
cause: "wall",
|
|
114256
114699
|
elapsedMs: elapsed,
|
|
@@ -114266,7 +114709,7 @@ async function waitForJobWithBounds(jobs, id3, options, now = Date.now) {
|
|
|
114266
114709
|
const quietFor = now() - lastProgressAt;
|
|
114267
114710
|
if (quietFor >= options.idleMs) {
|
|
114268
114711
|
clearInterval(tick);
|
|
114269
|
-
|
|
114712
|
+
resolve35({
|
|
114270
114713
|
kind: "timeout",
|
|
114271
114714
|
cause: "idle",
|
|
114272
114715
|
elapsedMs: elapsed,
|
|
@@ -114503,7 +114946,7 @@ ${observed}
|
|
|
114503
114946
|
});
|
|
114504
114947
|
|
|
114505
114948
|
// ../sdk/dist/tools/builtins/skill.js
|
|
114506
|
-
import { createHash as
|
|
114949
|
+
import { createHash as createHash41 } from "node:crypto";
|
|
114507
114950
|
var inputSchema16 = external_exports.object({
|
|
114508
114951
|
name: external_exports.string().min(1).optional().describe("The skill to load, exactly as listed in the available-skills manifest. Omit it to list model-invocable skills."),
|
|
114509
114952
|
args: external_exports.string().max(8e3).optional().describe("What to apply the skill to, in your own words. A skill that runs as a delegated agent sees only this and its own instructions, so say what it needs. Omit it on a continuation."),
|
|
@@ -114514,7 +114957,7 @@ var LIST_CURSOR_PATTERN = /^v1\.list\.(0|[1-9][0-9]*)\.([01])\.([A-Za-z0-9_-]{43
|
|
|
114514
114957
|
var MAX_SKILLS_PER_PAGE = 20;
|
|
114515
114958
|
var OVERSIZED_CATALOG_WARNING = "Some skills were omitted because their metadata is too large for this response budget.";
|
|
114516
114959
|
function snapshotDigest(snapshot) {
|
|
114517
|
-
return
|
|
114960
|
+
return createHash41("sha256").update(JSON.stringify({
|
|
114518
114961
|
version: 1,
|
|
114519
114962
|
name: snapshot.name,
|
|
114520
114963
|
body: snapshot.body,
|
|
@@ -114558,7 +115001,7 @@ function activeOutputCap(maxChars2) {
|
|
|
114558
115001
|
}
|
|
114559
115002
|
__name(activeOutputCap, "activeOutputCap");
|
|
114560
115003
|
function listDigest(skills, maxChars2) {
|
|
114561
|
-
return
|
|
115004
|
+
return createHash41("sha256").update(JSON.stringify({ version: 1, kind: "list", maxChars: maxChars2 ?? null, skills })).digest("base64url");
|
|
114562
115005
|
}
|
|
114563
115006
|
__name(listDigest, "listDigest");
|
|
114564
115007
|
function serializeListPage(page) {
|
|
@@ -115309,7 +115752,7 @@ __name(buildRunCodeTool, "buildRunCodeTool");
|
|
|
115309
115752
|
|
|
115310
115753
|
// ../sdk/dist/tools/builtins/ls.js
|
|
115311
115754
|
import { readdir as readdir15, stat as stat15 } from "node:fs/promises";
|
|
115312
|
-
import { join as join58, relative as
|
|
115755
|
+
import { join as join58, relative as relative16 } from "node:path";
|
|
115313
115756
|
var inputSchema18 = external_exports.object({
|
|
115314
115757
|
path: external_exports.string().default(".").describe("Directory path to list. Defaults to working directory."),
|
|
115315
115758
|
all: external_exports.boolean().default(false).describe("Include hidden files (dotfiles)"),
|
|
@@ -115366,7 +115809,7 @@ async function listRecursive(basePath, currentPath, showHidden, maxDepth, depth,
|
|
|
115366
115809
|
for (const entry of entries2) {
|
|
115367
115810
|
if (count7.value >= MAX_ENTRIES)
|
|
115368
115811
|
break;
|
|
115369
|
-
const relPath = `./${
|
|
115812
|
+
const relPath = `./${relative16(basePath, join58(currentPath, entry.name))}`;
|
|
115370
115813
|
const suffix = entry.type === "dir" ? "/" : "";
|
|
115371
115814
|
const sizeStr = entry.type === "file" ? ` (${formatSize2(entry.size)})` : "";
|
|
115372
115815
|
output.push(`${relPath}${suffix}${sizeStr}`);
|
|
@@ -115487,7 +115930,7 @@ var LsTool = defineTool({
|
|
|
115487
115930
|
|
|
115488
115931
|
// ../sdk/dist/tools/builtins/verify-outputs.js
|
|
115489
115932
|
import { stat as stat16 } from "node:fs/promises";
|
|
115490
|
-
import { resolve as
|
|
115933
|
+
import { resolve as resolve34 } from "node:path";
|
|
115491
115934
|
var inputSchema19 = external_exports.object({
|
|
115492
115935
|
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."),
|
|
115493
115936
|
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).")
|
|
@@ -115543,7 +115986,7 @@ async function verifyOne(input) {
|
|
|
115543
115986
|
};
|
|
115544
115987
|
}
|
|
115545
115988
|
}
|
|
115546
|
-
const filePath =
|
|
115989
|
+
const filePath = resolve34(context2.workingDirectory, path3);
|
|
115547
115990
|
try {
|
|
115548
115991
|
const info = await stat16(filePath);
|
|
115549
115992
|
if (!info.isFile()) {
|
|
@@ -119176,10 +119619,10 @@ var inputSchema20 = external_exports.object({
|
|
|
119176
119619
|
job: external_exports.string().optional().describe("update/pause/resume/delete: job name"),
|
|
119177
119620
|
allFolders: external_exports.boolean().optional().describe("list: include jobs of other folders (names only)")
|
|
119178
119621
|
});
|
|
119179
|
-
function
|
|
119622
|
+
function refuse4(error) {
|
|
119180
119623
|
return { success: false, output: "", error };
|
|
119181
119624
|
}
|
|
119182
|
-
__name(
|
|
119625
|
+
__name(refuse4, "refuse");
|
|
119183
119626
|
function effectsOf(rule) {
|
|
119184
119627
|
if (typeof rule === "string")
|
|
119185
119628
|
return [rule];
|
|
@@ -119268,27 +119711,27 @@ async function create(host, input, signal) {
|
|
|
119268
119711
|
if (runKind !== "agent" && input.script === void 0)
|
|
119269
119712
|
required.push("script");
|
|
119270
119713
|
if (required.length > 0) {
|
|
119271
|
-
return
|
|
119714
|
+
return refuse4(`create needs ${required.join(", ")}. permissions is required: propose an explicit set (a preset and/or rules, plus unmatched).`);
|
|
119272
119715
|
}
|
|
119273
119716
|
if (runKind === "agent" && input.script !== void 0) {
|
|
119274
|
-
return
|
|
119717
|
+
return refuse4("an agent job has no script; omit kind (or set it to agent) to use one");
|
|
119275
119718
|
}
|
|
119276
119719
|
if (input.workspace === "none" && runKind !== "script")
|
|
119277
|
-
return
|
|
119720
|
+
return refuse4("workspace: 'none' is only for a pure script job");
|
|
119278
119721
|
if (input.workspace === "none" && input.folder !== void 0)
|
|
119279
|
-
return
|
|
119722
|
+
return refuse4("workspace: 'none' cannot be combined with folder; omit folder");
|
|
119280
119723
|
if (input.script?.report !== void 0 && runKind !== "script")
|
|
119281
|
-
return
|
|
119724
|
+
return refuse4("script.report is only for a pure script job");
|
|
119282
119725
|
if (runKind === "script" && input.prompt !== void 0)
|
|
119283
|
-
return
|
|
119726
|
+
return refuse4("a pure script job has no prompt; remove prompt");
|
|
119284
119727
|
if (runKind === "script" && input.budget !== void 0) {
|
|
119285
|
-
return
|
|
119728
|
+
return refuse4("a pure script job has no agent budget; remove budget and use script.timeoutMs for its timeout");
|
|
119286
119729
|
}
|
|
119287
119730
|
if (runKind === "script" && input.permissions?.browser !== void 0)
|
|
119288
|
-
return
|
|
119731
|
+
return refuse4("a pure script job cannot use a browser grant; remove permissions.browser");
|
|
119289
119732
|
const checked2 = checkPermissions(host, input.permissions);
|
|
119290
119733
|
if (!checked2.ok)
|
|
119291
|
-
return
|
|
119734
|
+
return refuse4(checked2.error);
|
|
119292
119735
|
const permissions = checked2.permissions;
|
|
119293
119736
|
const draft = {
|
|
119294
119737
|
name: input.name,
|
|
@@ -119304,12 +119747,12 @@ async function create(host, input, signal) {
|
|
|
119304
119747
|
...input.budget ? { budget: input.budget } : {}
|
|
119305
119748
|
};
|
|
119306
119749
|
if (networkWithHostShell(draft))
|
|
119307
|
-
return
|
|
119750
|
+
return refuse4(NETWORK_WITH_HOST_SHELL);
|
|
119308
119751
|
let preview2;
|
|
119309
119752
|
try {
|
|
119310
119753
|
preview2 = await host.preview(draft);
|
|
119311
119754
|
} catch (error) {
|
|
119312
|
-
return
|
|
119755
|
+
return refuse4(error instanceof Error ? error.message : String(error));
|
|
119313
119756
|
}
|
|
119314
119757
|
let answer;
|
|
119315
119758
|
try {
|
|
@@ -119345,7 +119788,7 @@ async function list(host, input) {
|
|
|
119345
119788
|
try {
|
|
119346
119789
|
jobs = await host.list({ allFolders: input.allFolders === true });
|
|
119347
119790
|
} catch (error) {
|
|
119348
|
-
return
|
|
119791
|
+
return refuse4(error instanceof Error ? error.message : String(error));
|
|
119349
119792
|
}
|
|
119350
119793
|
if (jobs.length === 0)
|
|
119351
119794
|
return { success: true, output: "No scheduled jobs.", data: { jobs: [] } };
|
|
@@ -119367,31 +119810,31 @@ var CHANGEABLE = [
|
|
|
119367
119810
|
];
|
|
119368
119811
|
async function update(host, input, signal) {
|
|
119369
119812
|
if (!host.previewUpdate || !host.confirmUpdate || !host.update) {
|
|
119370
|
-
return
|
|
119813
|
+
return refuse4("This host cannot change a scheduled job. Ask the operator to change it themselves; do not delete and create it again, which loses its history.");
|
|
119371
119814
|
}
|
|
119372
119815
|
if (!input.job)
|
|
119373
|
-
return
|
|
119816
|
+
return refuse4("update needs job (the job's name) and the fields to change.");
|
|
119374
119817
|
if (input.name !== void 0) {
|
|
119375
|
-
return
|
|
119818
|
+
return refuse4("update cannot rename a job: name the job to change with job, and leave name out.");
|
|
119376
119819
|
}
|
|
119377
119820
|
const given = CHANGEABLE.filter((k) => input[k] !== void 0);
|
|
119378
119821
|
if (given.length === 0) {
|
|
119379
|
-
return
|
|
119822
|
+
return refuse4(`update needs at least one of ${CHANGEABLE.join(", ")} to change.`);
|
|
119380
119823
|
}
|
|
119381
119824
|
if (input.kind === "agent" && input.script !== void 0) {
|
|
119382
|
-
return
|
|
119825
|
+
return refuse4("update cannot set kind to agent while also giving a script; drop script to make it an agent job, or leave kind unset (or as script/script+agent) to keep one.");
|
|
119383
119826
|
}
|
|
119384
119827
|
if (input.workspace === "none" && input.folder !== void 0)
|
|
119385
|
-
return
|
|
119828
|
+
return refuse4("workspace: 'none' cannot be combined with folder; omit folder");
|
|
119386
119829
|
if (input.workspace === "none" && input.kind !== void 0 && input.kind !== "script")
|
|
119387
|
-
return
|
|
119830
|
+
return refuse4("workspace: 'none' is only for a pure script job");
|
|
119388
119831
|
if (input.script?.report !== void 0 && input.kind !== void 0 && input.kind !== "script")
|
|
119389
|
-
return
|
|
119832
|
+
return refuse4("script.report is only for a pure script job");
|
|
119390
119833
|
let permissions;
|
|
119391
119834
|
if (input.permissions) {
|
|
119392
119835
|
const checked2 = checkPermissions(host, input.permissions);
|
|
119393
119836
|
if (!checked2.ok)
|
|
119394
|
-
return
|
|
119837
|
+
return refuse4(checked2.error);
|
|
119395
119838
|
permissions = checked2.permissions;
|
|
119396
119839
|
if (networkWithHostShell({
|
|
119397
119840
|
name: "",
|
|
@@ -119400,7 +119843,7 @@ async function update(host, input, signal) {
|
|
|
119400
119843
|
...input.kind !== void 0 ? { runKind: input.kind } : {},
|
|
119401
119844
|
permissions
|
|
119402
119845
|
}))
|
|
119403
|
-
return
|
|
119846
|
+
return refuse4(NETWORK_WITH_HOST_SHELL);
|
|
119404
119847
|
}
|
|
119405
119848
|
const changes = {
|
|
119406
119849
|
...input.prompt !== void 0 ? { prompt: input.prompt } : {},
|
|
@@ -119418,11 +119861,11 @@ async function update(host, input, signal) {
|
|
|
119418
119861
|
try {
|
|
119419
119862
|
proposal = await host.previewUpdate(input.job, changes);
|
|
119420
119863
|
} catch (error) {
|
|
119421
|
-
return
|
|
119864
|
+
return refuse4(error instanceof Error ? error.message : String(error));
|
|
119422
119865
|
}
|
|
119423
119866
|
const effectiveKind = input.kind ?? proposal.preview.runKind ?? "agent";
|
|
119424
119867
|
if ((effectiveKind === "script" || effectiveKind === "script+agent") && proposal.preview.execution === "host" && (proposal.preview.networkGrantAccess ?? proposal.preview.networkAccess)) {
|
|
119425
|
-
return
|
|
119868
|
+
return refuse4(NETWORK_WITH_HOST_SHELL);
|
|
119426
119869
|
}
|
|
119427
119870
|
let confirmed = false;
|
|
119428
119871
|
try {
|
|
@@ -119438,7 +119881,7 @@ async function update(host, input, signal) {
|
|
|
119438
119881
|
confirmed = false;
|
|
119439
119882
|
if (!confirmed) {
|
|
119440
119883
|
return {
|
|
119441
|
-
...
|
|
119884
|
+
...refuse4(`The operator did not confirm the change; "${proposal.preview.name}" was not changed.`),
|
|
119442
119885
|
data: { cancelled: true }
|
|
119443
119886
|
};
|
|
119444
119887
|
}
|
|
@@ -119446,7 +119889,7 @@ async function update(host, input, signal) {
|
|
|
119446
119889
|
try {
|
|
119447
119890
|
saved = await host.update(proposal.preview);
|
|
119448
119891
|
} catch (error) {
|
|
119449
|
-
return
|
|
119892
|
+
return refuse4(error instanceof Error ? error.message : String(error));
|
|
119450
119893
|
}
|
|
119451
119894
|
const said = `Job "${saved.name}" was updated in place and keeps its history. It runs ${proposal.preview.schedule}.`;
|
|
119452
119895
|
return {
|
|
@@ -119458,10 +119901,10 @@ async function update(host, input, signal) {
|
|
|
119458
119901
|
__name(update, "update");
|
|
119459
119902
|
async function lifecycle(host, input, action, signal) {
|
|
119460
119903
|
if (!input.job)
|
|
119461
|
-
return
|
|
119904
|
+
return refuse4(`${action} needs job (the job's name).`);
|
|
119462
119905
|
const job = await host.find(input.job);
|
|
119463
119906
|
if (!job)
|
|
119464
|
-
return
|
|
119907
|
+
return refuse4(`No scheduled job is named "${input.job}".`);
|
|
119465
119908
|
if (action !== "pause") {
|
|
119466
119909
|
let confirmed = false;
|
|
119467
119910
|
try {
|
|
@@ -119473,7 +119916,7 @@ async function lifecycle(host, input, action, signal) {
|
|
|
119473
119916
|
confirmed = false;
|
|
119474
119917
|
if (!confirmed)
|
|
119475
119918
|
return {
|
|
119476
|
-
...
|
|
119919
|
+
...refuse4(`The operator did not confirm; "${job.name}" was not changed.`),
|
|
119477
119920
|
data: { cancelled: true }
|
|
119478
119921
|
};
|
|
119479
119922
|
}
|
|
@@ -119485,7 +119928,7 @@ async function lifecycle(host, input, action, signal) {
|
|
|
119485
119928
|
try {
|
|
119486
119929
|
await host.delete(job.name);
|
|
119487
119930
|
} catch (error) {
|
|
119488
|
-
return
|
|
119931
|
+
return refuse4(error instanceof Error ? error.message : String(error));
|
|
119489
119932
|
}
|
|
119490
119933
|
}
|
|
119491
119934
|
const verb = action === "pause" ? "paused" : action === "resume" ? "resumed" : "deleted";
|
|
@@ -120410,6 +120853,15 @@ export {
|
|
|
120410
120853
|
compressShellOutputFull,
|
|
120411
120854
|
compressShellOutput,
|
|
120412
120855
|
memoizeAsync,
|
|
120856
|
+
NAMZU_TMPDIR_ENV,
|
|
120857
|
+
TempDirectoryError,
|
|
120858
|
+
resolveTempBase,
|
|
120859
|
+
privateTempRootPath,
|
|
120860
|
+
privateTempRoot,
|
|
120861
|
+
createTempDirSync,
|
|
120862
|
+
createTempDir,
|
|
120863
|
+
tempFilePath,
|
|
120864
|
+
ensureScratchpadDirectory,
|
|
120413
120865
|
extractFinalResponse,
|
|
120414
120866
|
resolveTaskModel,
|
|
120415
120867
|
assertThinkingUnsupported,
|
|
@@ -120544,6 +120996,8 @@ export {
|
|
|
120544
120996
|
DiskSessionLeaseStore,
|
|
120545
120997
|
readSessionLease,
|
|
120546
120998
|
InMemorySessionLeaseStore,
|
|
120999
|
+
sessionLogDegradedCause,
|
|
121000
|
+
DEFAULT_DEGRADED_BUFFER_BYTES,
|
|
120547
121001
|
InvalidSessionRecordError,
|
|
120548
121002
|
SessionLogConflictError,
|
|
120549
121003
|
SessionLogCore,
|
|
@@ -121415,4 +121869,4 @@ export {
|
|
|
121415
121869
|
WakeBudget,
|
|
121416
121870
|
wakeBudgetFromEnv
|
|
121417
121871
|
};
|
|
121418
|
-
//# sourceMappingURL=chunk-
|
|
121872
|
+
//# sourceMappingURL=chunk-VGLTZY7A.js.map
|