@qwen-code/qwen-code 0.23.5-preview.0 → 0.24.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/bundled/qc-helper/docs/features/_meta.ts +1 -0
- package/bundled/qc-helper/docs/features/goals.md +4 -2
- package/bundled/qc-helper/docs/features/omni-fixed-policies-preset.json +242 -0
- package/bundled/qc-helper/docs/features/omni-media-policies.md +443 -0
- package/bundled/qc-helper/docs/overview.md +1 -1
- package/bundled/qc-helper/docs/quickstart.md +2 -3
- package/chunks/MaxSizedBox-I5COUCHZ.js +148 -0
- package/chunks/{StandaloneSessionPicker-V635V72I.js → StandaloneSessionPicker-KUGOBVEW.js} +114 -90
- package/chunks/acp-subagent-executor-PRPMLKVJ.js +164 -0
- package/chunks/{acpAgent-3DPWZTNC.js → acpAgent-EHXZXVUB.js} +269 -194
- package/chunks/{agent-KIHGINKN.js → agent-FWPNJI6N.js} +59 -49
- package/chunks/agent-headless-M5Z7WIDL.js +104 -0
- package/chunks/{anthropicContentGenerator-4FGOM5LK.js → anthropicContentGenerator-FLTEUSIQ.js} +30 -27
- package/chunks/{artifact-tool-MUTNH4NI.js → artifact-tool-3MWM6SN2.js} +11 -7
- package/chunks/{askUserQuestion-AKIRLVB5.js → askUserQuestion-YFFBB4K3.js} +6 -4
- package/chunks/bridge-EWCKRGWY.js +156 -0
- package/chunks/{build-5KWQBWEQ.js → build-5OQN7CDU.js} +1 -1
- package/chunks/caption-audio-UXXLI3JZ.js +443 -0
- package/chunks/caption-image-B7O4TUFP.js +247 -0
- package/chunks/{channel-management-service-RRILWSXX.js → channel-management-service-GRJG5R46.js} +1 -1
- package/chunks/channel-settings-store-NXZNLT5L.js +158 -0
- package/chunks/{channel-worker-group-3DUJFZJR.js → channel-worker-group-SCSKCSBJ.js} +4 -4
- package/chunks/{channel-worker-manager-E5UW2VLA.js → channel-worker-manager-AHCZCKON.js} +4 -4
- package/chunks/{channel-worker-supervisor-VN33GSEC.js → channel-worker-supervisor-BGUAVITB.js} +3 -3
- package/chunks/{chunk-3LLEB5CU.js → chunk-24ZB2JNI.js} +2 -2
- package/chunks/{chunk-5NUKK2DT.js → chunk-25FMWESU.js} +47 -8
- package/chunks/{chunk-3WWPEFMX.js → chunk-2FQM443D.js} +82 -4
- package/chunks/{chunk-VEXUA6DX.js → chunk-2FRZ4ZP2.js} +13 -11
- package/chunks/{chunk-WBSJ6VPZ.js → chunk-2GNZTJRK.js} +3 -3
- package/chunks/{chunk-YP2K3WOS.js → chunk-2VWXODMY.js} +7 -4
- package/chunks/{chunk-L2A5VBDL.js → chunk-2ZCLSPE4.js} +9 -9
- package/chunks/{chunk-KEM7MWS7.js → chunk-366JNNY7.js} +6 -4
- package/chunks/{chunk-TKF4JINY.js → chunk-3FEGERVL.js} +1 -1
- package/chunks/{chunk-TDKUXSJO.js → chunk-3MW6PPA5.js} +1 -1
- package/chunks/{chunk-4LIPOIXS.js → chunk-3NHJLWOD.js} +1 -1
- package/chunks/{chunk-3UGMLA4V.js → chunk-3V7RNGLC.js} +10 -10
- package/chunks/{chunk-XICCGDWF.js → chunk-3WIPATJX.js} +2 -2
- package/chunks/chunk-43QUA4MC.js +135 -0
- package/chunks/{chunk-Q2SAQTEJ.js → chunk-4B7U3KQP.js} +1 -1
- package/chunks/{chunk-SFL6U7U7.js → chunk-4JFRCIMW.js} +2 -2
- package/chunks/{chunk-TPY6HW55.js → chunk-4OZY6LN2.js} +12 -6
- package/chunks/{chunk-IVFTLUZD.js → chunk-4SZ2636R.js} +3 -3
- package/chunks/{chunk-7CLLH5TI.js → chunk-4YS7RMCB.js} +6 -4
- package/chunks/{chunk-NQ272MQG.js → chunk-5XK2YELE.js} +7 -5
- package/chunks/{chunk-HX4WXX3H.js → chunk-65YADOPT.js} +89 -74
- package/chunks/chunk-6C3D7BKK.js +153 -0
- package/chunks/{chunk-DC4ZNGH4.js → chunk-6DB6UHY3.js} +3 -3
- package/chunks/{chunk-WZWTY7SG.js → chunk-6IW6SX75.js} +6 -6
- package/chunks/{chunk-HYHSMTRA.js → chunk-6XRR4RYH.js} +4 -4
- package/chunks/{chunk-AXPOOQAW.js → chunk-736AZVPL.js} +2 -2
- package/chunks/{chunk-UQGRJTDK.js → chunk-7JWD2EML.js} +3 -3
- package/chunks/{chunk-BUQN5LTI.js → chunk-7PQ65Z5F.js} +2 -2
- package/chunks/{chunk-43Y26NPF.js → chunk-A5EWSUYT.js} +3 -3
- package/chunks/{chunk-VQDWCQOE.js → chunk-ANKISCKU.js} +1 -0
- package/chunks/{chunk-NXUZFW3G.js → chunk-AUFTA63J.js} +1 -1
- package/chunks/{chunk-4QPVZA5J.js → chunk-AVVSSP4R.js} +3 -3
- package/chunks/{chunk-36SDZ2Q4.js → chunk-B3HGO6BB.js} +7 -5
- package/chunks/{chunk-6USYH3EU.js → chunk-B3XJFEEH.js} +5 -3
- package/chunks/{chunk-GSKX53AN.js → chunk-BA6AXQDA.js} +1 -1
- package/chunks/{chunk-FBY32737.js → chunk-BHHR5MEI.js} +4 -4
- package/chunks/{chunk-FX6PZBOV.js → chunk-BJ2TJY7V.js} +4 -4
- package/chunks/chunk-BKVPLSEI.js +133 -0
- package/chunks/chunk-BQMSZSG6.js +21 -0
- package/chunks/{chunk-BW2SMO6L.js → chunk-BXAU2UKM.js} +1 -1
- package/chunks/{chunk-3LMDSCLU.js → chunk-C4FISGDN.js} +2 -2
- package/chunks/{chunk-XFFRI3WM.js → chunk-CA63HYHU.js} +4 -2
- package/chunks/{chunk-IXO2OCIP.js → chunk-CKNBSVBC.js} +12 -8
- package/chunks/{chunk-347O2YZJ.js → chunk-CNG7ILRW.js} +39 -61
- package/chunks/chunk-CQULG2GJ.js +1330 -0
- package/chunks/{chunk-VVI7MK3V.js → chunk-CTGMXP4A.js} +9 -7
- package/chunks/{chunk-QT6Z2IBF.js → chunk-CYFQLCCG.js} +2 -2
- package/chunks/chunk-DBDJRURL.js +42 -0
- package/chunks/{chunk-X7AYIXC7.js → chunk-DJLCK66M.js} +5 -3
- package/chunks/chunk-DJYHML3Y.js +121 -0
- package/chunks/{chunk-MO4XID7S.js → chunk-DNDECZXY.js} +3 -3
- package/chunks/{chunk-D7JMO2GP.js → chunk-DNHL4S5B.js} +1 -1
- package/chunks/{chunk-WL36KHUQ.js → chunk-DTSG4EHA.js} +11 -9
- package/chunks/{chunk-M23GFJ5B.js → chunk-EHMLJKF5.js} +1 -1
- package/chunks/{chunk-TIGXX4PA.js → chunk-EKBQJ627.js} +2 -2
- package/chunks/{chunk-RSWBT7AZ.js → chunk-ERIBG3BX.js} +35 -551
- package/chunks/{chunk-PPJSG2PU.js → chunk-EVZT24AF.js} +6 -142
- package/chunks/{chunk-E2VSBAFA.js → chunk-FL2EJUOY.js} +5 -5
- package/chunks/{chunk-2C5TR6HN.js → chunk-FSNLTHNG.js} +1 -1
- package/chunks/chunk-FTKXJMQV.js +255 -0
- package/chunks/{chunk-TRZ22SG5.js → chunk-FXPP7VLM.js} +6 -4
- package/chunks/{chunk-CDDP4ONL.js → chunk-G3PBYAGM.js} +60 -134
- package/chunks/{chunk-AEWCOE64.js → chunk-GACWUBXV.js} +2 -2
- package/chunks/{chunk-OWUAZXXN.js → chunk-GHG4PQY2.js} +3 -3
- package/chunks/{chunk-VU3XMZ5I.js → chunk-GHZJQCSZ.js} +3 -3
- package/chunks/{chunk-FIJODK52.js → chunk-GJHAV2F7.js} +3 -3
- package/chunks/{chunk-36NRLIR6.js → chunk-GQZA7EYC.js} +11 -11
- package/chunks/{chunk-4JFLRHNE.js → chunk-GVHYY2RS.js} +1 -1
- package/chunks/{chunk-H6L4NEAT.js → chunk-GVMXFXQG.js} +1 -1
- package/chunks/{chunk-G45B3INR.js → chunk-GVTAFLWB.js} +2 -2
- package/chunks/{chunk-GJKP6XOB.js → chunk-GW5SJ3II.js} +16 -19
- package/chunks/{chunk-AQP3H22J.js → chunk-GY7FOHQP.js} +1 -1
- package/chunks/chunk-GZ5MEGA3.js +44 -0
- package/chunks/{chunk-FCPJXKDG.js → chunk-HA6DKD44.js} +9 -9
- package/chunks/{chunk-FEDFZBGR.js → chunk-HR4OWLKI.js} +3 -3
- package/chunks/{chunk-CXY6BICQ.js → chunk-HWKWZSZY.js} +162 -109
- package/chunks/{chunk-K4XMAIRX.js → chunk-I3NKMMHS.js} +12 -12
- package/chunks/{chunk-QMENOK5T.js → chunk-IH4TNUVS.js} +9 -7
- package/chunks/{chunk-FASYATAZ.js → chunk-IHUOMYBO.js} +1 -1
- package/chunks/{chunk-IZ2U57NY.js → chunk-IITTKFWM.js} +4 -2
- package/chunks/{chunk-M22WLKLI.js → chunk-IQGEZOGN.js} +7 -7
- package/chunks/chunk-IVPSLX4P.js +578 -0
- package/chunks/{chunk-BTICBRPL.js → chunk-IWMYX5LB.js} +3 -3
- package/chunks/{chunk-V4JJAVHQ.js → chunk-JCIDHFSB.js} +2 -2
- package/chunks/{chunk-PF7GAP6K.js → chunk-JENFAGVX.js} +65 -54
- package/chunks/{chunk-LO2UWNO5.js → chunk-JFEWKEKG.js} +3 -3
- package/chunks/{chunk-BHG3H6OZ.js → chunk-JJVDKHQU.js} +1 -1
- package/chunks/chunk-JYGESWZM.js +149 -0
- package/chunks/{chunk-KVC7HZWK.js → chunk-JYTJ5FCM.js} +1 -1
- package/chunks/{chunk-KVQ3QL4K.js → chunk-KCL6OMCX.js} +3 -3
- package/chunks/{chunk-3HTUE6ZR.js → chunk-KCRV4F3G.js} +4 -4
- package/chunks/{chunk-3WILPKTJ.js → chunk-KKPIFWTZ.js} +11 -6
- package/chunks/{chunk-CXONOVBN.js → chunk-KS6F6LZQ.js} +8 -6
- package/chunks/chunk-KSEKRQJO.js +253 -0
- package/chunks/{chunk-P42KMMU6.js → chunk-KWTLCPYY.js} +19 -6
- package/chunks/{chunk-U4AASWUQ.js → chunk-L4GF4IK2.js} +3 -3
- package/chunks/{chunk-5FK4MSHB.js → chunk-LADOQIYQ.js} +6 -4
- package/chunks/{chunk-DJXSOEFB.js → chunk-LAE6RY3L.js} +1 -1
- package/chunks/{chunk-CQPM66MG.js → chunk-LG475XAV.js} +4 -4
- package/chunks/{chunk-3BZI5GDP.js → chunk-M5YIHMXP.js} +6 -4
- package/chunks/{chunk-6WXVEDT2.js → chunk-MC2RYJMU.js} +5 -3
- package/chunks/chunk-MNU36NGH.js +233 -0
- package/chunks/{chunk-M4U2LTD2.js → chunk-MS4SXNJ6.js} +1 -1
- package/chunks/{chunk-ZFHKUQZ4.js → chunk-NEVUE35Z.js} +5 -5
- package/chunks/{chunk-DRAX5YAI.js → chunk-NFC4WTY2.js} +6 -4
- package/chunks/{chunk-SOLRBF7L.js → chunk-NSKNTJHU.js} +10 -10
- package/chunks/{chunk-B5TJK7B3.js → chunk-NZRX5WYI.js} +1 -1
- package/chunks/{chunk-YM6KUQ2S.js → chunk-O4A2B6V2.js} +3 -3
- package/chunks/{chunk-DX6JTDMR.js → chunk-OB57Y2WH.js} +1 -1
- package/chunks/{chunk-INN5ORKX.js → chunk-OLFTIODD.js} +1 -1
- package/chunks/chunk-PF3RVYRK.js +108 -0
- package/chunks/{chunk-WSJI6ODG.js → chunk-PGMF3LSO.js} +29 -27
- package/chunks/{chunk-OALXNGUA.js → chunk-PJ3GAHED.js} +10 -10
- package/chunks/{chunk-XWJFDJZK.js → chunk-PJSZXERN.js} +1 -1
- package/chunks/{chunk-GSAOVDTH.js → chunk-POMFSBEC.js} +4 -4
- package/chunks/{chunk-EWNKP4V4.js → chunk-PPVM7YLS.js} +1 -1
- package/chunks/{chunk-WK6DEH3Q.js → chunk-PQQV3OBW.js} +6 -4
- package/chunks/{chunk-BHVF3R6B.js → chunk-PZT2654P.js} +4 -4
- package/chunks/{chunk-ZSTCM3MX.js → chunk-Q5N5NEVT.js} +1 -1
- package/chunks/{chunk-KFFCDLKV.js → chunk-QE36VXWP.js} +1 -1
- package/chunks/{chunk-V545KI73.js → chunk-QPTE6BKL.js} +1 -1
- package/chunks/{chunk-5VQR2DD7.js → chunk-QQPRTJOM.js} +5 -3
- package/chunks/{chunk-QIPLWW6Q.js → chunk-QU7T5PKF.js} +1 -1
- package/chunks/{chunk-Y2KJC55Y.js → chunk-QYT7J3UM.js} +4 -4
- package/chunks/{chunk-SFHX5G2S.js → chunk-R34ALEH5.js} +14 -14
- package/chunks/{chunk-TXTCM3TC.js → chunk-R4DAJXOV.js} +18 -14
- package/chunks/{chunk-2GP6BQ2J.js → chunk-RA6PKQVM.js} +2 -2
- package/chunks/{chunk-HXUI5D4H.js → chunk-RDN5ITXF.js} +1 -1
- package/chunks/{chunk-G6UUOCUT.js → chunk-RMI3DKMV.js} +1 -1
- package/chunks/chunk-RSFNJ6UU.js +1252 -0
- package/chunks/{chunk-EDIDYZBT.js → chunk-RVT5L74D.js} +1 -1
- package/chunks/{chunk-GI7SLDOI.js → chunk-RXP5FVC4.js} +6 -6
- package/chunks/chunk-S34QJ6IR.js +290 -0
- package/chunks/chunk-S5BHLTHK.js +190 -0
- package/chunks/{chunk-2XRE4KE4.js → chunk-S7BE3FMA.js} +1 -1
- package/chunks/{chunk-7O5PYQ3M.js → chunk-SBP43AO6.js} +1 -1
- package/chunks/chunk-SLHYLVRW.js +1377 -0
- package/chunks/{chunk-HNFKYKHH.js → chunk-SMAAYU3F.js} +16 -16
- package/chunks/{chunk-KAYC5FBN.js → chunk-SNPYTKXI.js} +825 -234
- package/chunks/{chunk-IKBEIDOH.js → chunk-SOZJODVX.js} +13 -13
- package/chunks/{chunk-Y4NNIGYO.js → chunk-SSFOFDNL.js} +1 -1
- package/chunks/{chunk-WNQIJTOP.js → chunk-SSGVTJ2W.js} +243 -17
- package/chunks/{chunk-NFXXBWSE.js → chunk-SU64336V.js} +2 -2
- package/chunks/chunk-TFDCK56Y.js +154 -0
- package/chunks/{chunk-JRHKM3YQ.js → chunk-TS4JJ7NN.js} +2 -2
- package/chunks/{chunk-C4HBZQNH.js → chunk-U3MTHCJF.js} +1 -1
- package/chunks/{chunk-AUX2FL5T.js → chunk-UBQVV7MX.js} +625 -6
- package/chunks/{chunk-B6RMK4ED.js → chunk-UHBYCY7U.js} +9 -7
- package/chunks/{chunk-Y53DG2HA.js → chunk-UIWUFHRJ.js} +1 -1
- package/chunks/chunk-UQRDQCWF.js +102 -0
- package/chunks/{chunk-NKTMUPHJ.js → chunk-UVMU7DDP.js} +5 -3
- package/chunks/chunk-UXEI7POA.js +273 -0
- package/chunks/chunk-V2XJJTAB.js +228 -0
- package/chunks/chunk-VDNCKE2O.js +24 -0
- package/chunks/{chunk-YQQ2U7AS.js → chunk-VISF4MEY.js} +1 -1
- package/chunks/{chunk-RRI764F7.js → chunk-VPFKSRAB.js} +13 -11
- package/chunks/chunk-VPGRGNNH.js +578 -0
- package/chunks/{chunk-SYMXYRM5.js → chunk-W7JWIIRC.js} +1 -1
- package/chunks/{chunk-AZCTY64Z.js → chunk-WEUQIY3Q.js} +1 -1
- package/chunks/{chunk-SSWTA7CH.js → chunk-WIKUMTAB.js} +12 -12
- package/chunks/chunk-WL2CTQGT.js +1625 -0
- package/chunks/chunk-WL2V7PTE.js +78 -0
- package/chunks/{chunk-Q54O3EIA.js → chunk-WSZ6VS24.js} +45 -30
- package/chunks/{chunk-UZSB57EV.js → chunk-WX4W3FCV.js} +5 -5
- package/chunks/{chunk-OSG23MR3.js → chunk-X3T5IOX6.js} +2 -2
- package/chunks/{chunk-EIBECN2J.js → chunk-XGHVF5DC.js} +5 -5
- package/chunks/{chunk-D3KVGQUV.js → chunk-XJ52OCCN.js} +4 -4
- package/chunks/{chunk-YZXSDPOQ.js → chunk-XMAIUTED.js} +84 -40
- package/chunks/{chunk-QGEISOJ2.js → chunk-XQBZZVJA.js} +3 -3
- package/chunks/{chunk-OZEV3R3S.js → chunk-XYAB5R6E.js} +3 -3
- package/chunks/chunk-XZA32HII.js +19 -0
- package/chunks/{chunk-4FLUQWJ4.js → chunk-Y3Q5OK4D.js} +1 -1
- package/chunks/chunk-YDERQ7ZV.js +248 -0
- package/chunks/{chunk-AKRSSKUT.js → chunk-YFHX6MOF.js} +10 -10
- package/chunks/{chunk-ZMYKNKET.js → chunk-YPJZDZMP.js} +3 -3
- package/chunks/{chunk-3XBUCOWS.js → chunk-YSD6IY6F.js} +2 -2
- package/chunks/{chunk-CH2YDT6X.js → chunk-YVYK3JYU.js} +5 -3
- package/chunks/{chunk-YL3UJML3.js → chunk-YWDVNBGE.js} +4 -4
- package/chunks/{chunk-C3T6HPNM.js → chunk-ZGADNVME.js} +5 -5
- package/chunks/{chunk-M3JGHRMQ.js → chunk-ZJ7KIWG5.js} +1 -1
- package/chunks/{chunk-QHSOINX6.js → chunk-ZJBYZN5D.js} +2 -2
- package/chunks/{chunk-SYROIHU7.js → chunk-ZRQGTRHA.js} +4 -2
- package/chunks/{chunk-NCPFOLM2.js → chunk-ZTBP4SFC.js} +78 -18
- package/chunks/{chunk-ZAFYHRVY.js → chunk-ZYDMQCQP.js} +4 -274
- package/chunks/clip-audio-SH4L7AEY.js +255 -0
- package/chunks/clip-image-BQRPECIS.js +239 -0
- package/chunks/clip-video-JIRMV5IH.js +277 -0
- package/chunks/{codex-subagent-executor-AEAIQZDC.js → codex-subagent-executor-Y5ILNWG6.js} +92 -68
- package/chunks/config-3X4AXU45.js +21 -0
- package/chunks/config-T5RO4NJV.js +17 -0
- package/chunks/config-utils-3YNEDKT4.js +151 -0
- package/chunks/contextCommand-7JVXVYN4.js +144 -0
- package/chunks/convert-image-D52K2FFB.js +231 -0
- package/chunks/{core-runtime-ZI4RTOJQ.js → core-runtime-6IZNPJUN.js} +92 -67
- package/chunks/{create-sub-session-BBWFQARJ.js → create-sub-session-5XHUO2PW.js} +90 -66
- package/chunks/{create-sub-session-MSGNIM37.js → create-sub-session-6EDEANCD.js} +7 -5
- package/chunks/{cron-create-U2JJ5CCF.js → cron-create-GS7ORRO6.js} +8 -5
- package/chunks/{cron-delete-7DM4LJWD.js → cron-delete-3GGDNNXD.js} +8 -5
- package/chunks/{cron-list-VCUSZK2Y.js → cron-list-EX27DW4H.js} +8 -5
- package/chunks/{daemon-git-worktree-guard-KECEMV6A.js → daemon-git-worktree-guard-BULXRIDA.js} +90 -66
- package/chunks/daemon-status-provider-VSVXVY4O.js +155 -0
- package/chunks/daemon-trust-policy-WVSDS2WT.js +150 -0
- package/chunks/{daemon-trust-policy-monitor-546N5ZVL.js → daemon-trust-policy-monitor-HXQ2GLTX.js} +95 -71
- package/chunks/deferred-core-runtime-EXI7LXLE.js +153 -0
- package/chunks/{display-image-QTHALY6N.js → display-image-FTWDRBOP.js} +10 -7
- package/chunks/{dist-BNW423XT.js → dist-CXDHIHN4.js} +5 -0
- package/chunks/downsample-audio-LPDWX6GF.js +217 -0
- package/chunks/downsample-image-A5JEYIV5.js +249 -0
- package/chunks/downscale-video-4W5BX5KO.js +249 -0
- package/chunks/{earlyInputCapture-BXP7V2P3.js → earlyInputCapture-UJ3KFVZQ.js} +3 -2
- package/chunks/{edit-CMSQB7NP.js → edit-JJ34NKRC.js} +68 -56
- package/chunks/{en-56QLKXS2.js → en-FCK6MBTI.js} +16 -0
- package/chunks/{enter-worktree-DA6A4XC5.js → enter-worktree-QK7DR5EF.js} +12 -9
- package/chunks/{enterPlanMode-UDPMNESD.js → enterPlanMode-H6FBPVLB.js} +62 -51
- package/chunks/environment-7DMLANWW.js +167 -0
- package/chunks/errors-OH3DYEDL.js +151 -0
- package/chunks/{exec-RPKEY6HP.js → exec-7CFNHYCV.js} +31 -9
- package/chunks/{exit-worktree-4H6Z2VQI.js → exit-worktree-62COYIHF.js} +14 -10
- package/chunks/exitPlanMode-5YR5VWXS.js +102 -0
- package/chunks/extract-audio-GSSZQV6G.js +229 -0
- package/chunks/extract-keyframes-Q6DRMQAJ.js +621 -0
- package/chunks/{fast-path-F2CYDDZ4.js → fast-path-4DS2GR5O.js} +5 -5
- package/chunks/ffmpeg-N4LIIVNR.js +21 -0
- package/chunks/{glob-Z2JMJKKN.js → glob-GFID3F3R.js} +63 -51
- package/chunks/{goal-tools-HXVVLGCV.js → goal-tools-2OB5WPNH.js} +59 -49
- package/chunks/{grep-H2I33VAO.js → grep-JB5DGQ3B.js} +13 -9
- package/chunks/handleAutoUpdate-5OQL4YBU.js +147 -0
- package/chunks/i18n-TV5G7SXO.js +164 -0
- package/chunks/{image-gen-HIAZCB5T.js → image-gen-LX3C4V3R.js} +16 -11
- package/chunks/initializer-R2EI4UJ6.js +151 -0
- package/chunks/installationInfo-HYOWC3BN.js +145 -0
- package/chunks/{keychain-token-storage-NQ5XWIPX.js → keychain-token-storage-ZZNRE6D4.js} +3 -2
- package/chunks/list-ORJQQUNR.js +154 -0
- package/chunks/{list-agents-EWDCEPIW.js → list-agents-HS6HH4DJ.js} +10 -7
- package/chunks/{llm-LSUBOJAR.js → llm-YKBQVN7S.js} +159 -134
- package/chunks/{llm-content-generator-MLIONRXE.js → llm-content-generator-QJBXJRKT.js} +11 -9
- package/chunks/loadedSettingsAdapter-4FQH6Y3D.js +148 -0
- package/chunks/{loggingContentGenerator-TUPEXFMM.js → loggingContentGenerator-DEOANG3F.js} +74 -63
- package/chunks/{loop-wakeup-ZBVRI6VH.js → loop-wakeup-4B7OY3TV.js} +9 -6
- package/chunks/{ls-6ZB3BEIR.js → ls-EZ5PSWU2.js} +8 -5
- package/chunks/{lsp-M54FQARP.js → lsp-DYFFHKB3.js} +6 -3
- package/chunks/{managed-npm-update-WEA5XMFZ.js → managed-npm-update-36U25ZEZ.js} +91 -67
- package/chunks/mcp-ZI7LXLAQ.js +148 -0
- package/chunks/memory-side-query-DRV7FXK4.js +221 -0
- package/chunks/model-call-collection-RX7C24YP.js +171 -0
- package/chunks/model-configuration-3JIO6IRV.js +161 -0
- package/chunks/modelConfigUtils-2BJQI2S4.js +140 -0
- package/chunks/{monitor-CI7YE7MT.js → monitor-LXQRI2IF.js} +63 -51
- package/chunks/nonInteractiveCli-HRXVUV2H.js +235 -0
- package/chunks/nonInteractiveToolExecutor-QPAIKNPL.js +101 -0
- package/chunks/{notebook-edit-3WCVRNGL.js → notebook-edit-5CM3VYNK.js} +63 -52
- package/chunks/ocr-image-Q4HYJ3U7.js +252 -0
- package/chunks/omni-A5XLPNSH.js +147 -0
- package/chunks/{openaiContentGenerator-OGILGUZE.js → openaiContentGenerator-O5G3QCHX.js} +36 -31
- package/chunks/{openaiResponsesContentGenerator-NXOXUPFM.js → openaiResponsesContentGenerator-W2V7AYVE.js} +12 -10
- package/chunks/pidfile-MI5FGYF5.js +151 -0
- package/chunks/{processUtils-O4II3RYH.js → processUtils-EWKUPVJH.js} +2 -2
- package/chunks/prompt-terminal-ledger-5HEXZMWT.js +143 -0
- package/chunks/{qwenContentGenerator-I4LRYADV.js → qwenContentGenerator-HHNDIW2Q.js} +70 -60
- package/chunks/{qwenOAuth2-3J66TOT5.js → qwenOAuth2-GD3UIYUP.js} +9 -8
- package/chunks/reactive-degrade-KWCJUHXH.js +375 -0
- package/chunks/read-file-ZQKBXJSH.js +37 -0
- package/chunks/{read-mcp-resource-LPSWXVOD.js → read-mcp-resource-INJIV3UC.js} +8 -4
- package/chunks/recall-media-memory-tool-PEE2BWRY.js +198 -0
- package/chunks/{record-artifact-L3CFJOMA.js → record-artifact-KKW3AIMJ.js} +6 -4
- package/chunks/record-source-2VSQINX6.js +24 -0
- package/chunks/{report-findings-LY5HQY4K.js → report-findings-OZSLWYAS.js} +7 -5
- package/chunks/{request-shutdown-53SNYGVR.js → request-shutdown-3RUGTWRR.js} +12 -9
- package/chunks/resumeHistoryUtils-5V3KISJ6.js +156 -0
- package/chunks/ripGrep-F5MM4HGA.js +43 -0
- package/chunks/{run-qwen-serve-ZVEKGS7Y.js → run-qwen-serve-3K3D5MSR.js} +70 -70
- package/chunks/{runtime-SJCRYNPA.js → runtime-FAWN3GQH.js} +98 -74
- package/chunks/sandbox-BPRE7KYF.js +170 -0
- package/chunks/sandboxConfig-V3OHETXW.js +138 -0
- package/chunks/scheduled-tasks-LB2PINB3.js +167 -0
- package/chunks/scheduler-NHAWKARI.js +160 -0
- package/chunks/{sdk-exporters-http-DR4G663K.js → sdk-exporters-http-SWXTEEVT.js} +3 -2
- package/chunks/{sdk-impl-SJR26MQF.js → sdk-impl-FK4JY6LX.js} +5 -4
- package/chunks/{send-message-DN76MXDX.js → send-message-TLF36UW2.js} +16 -13
- package/chunks/serve-UQL5X5K7.js +156 -0
- package/chunks/{server-UHMKPCAZ.js → server-3HUUEDUC.js} +286 -261
- package/chunks/{session-ZLUK7E4P.js → session-XODWSTJ3.js} +151 -127
- package/chunks/session-attachments-root-BENUIMZM.js +141 -0
- package/chunks/{session-pr-refresh-3OMTQWCZ.js → session-pr-refresh-CSRULMTI.js} +95 -71
- package/chunks/{settings-P4DHIIUP.js → settings-42FFX5TK.js} +94 -70
- package/chunks/{shell-IMFUVQQ5.js → shell-NLNU2TPF.js} +59 -49
- package/chunks/{skill-NB5RJGZW.js → skill-KIRNNJMK.js} +22 -17
- package/chunks/skill-settings-MPHPE43F.js +164 -0
- package/chunks/spawnChannel-TXNLXP2R.js +152 -0
- package/chunks/standalone-update-XAC364AM.js +156 -0
- package/chunks/{start-opentui-ui-JKAIWGF7.js → start-opentui-ui-3OLDXRMX.js} +223 -189
- package/chunks/{startInteractiveUI-YRPOT6GH.js → startInteractiveUI-UB2HRTV7.js} +339 -295
- package/chunks/storage-VZECDJNX.js +17 -0
- package/chunks/{syntheticOutput-EX5L5GYI.js → syntheticOutput-SSXJ2NEY.js} +5 -3
- package/chunks/task-create-EEMYF6LY.js +30 -0
- package/chunks/{task-list-ZLJSMRFA.js → task-list-GA5GOR74.js} +9 -6
- package/chunks/{task-stop-MD7P6QGK.js → task-stop-3MXTDL7H.js} +6 -3
- package/chunks/{task-update-3LSYQDRW.js → task-update-JSBHKL4L.js} +16 -13
- package/chunks/{team-create-2XTBYRJF.js → team-create-VES6TOBA.js} +62 -51
- package/chunks/{team-delete-RIDINW6I.js → team-delete-V2CROTI6.js} +9 -6
- package/chunks/{team-plan-approval-CFNWW7ZQ.js → team-plan-approval-ZMCHBBUM.js} +61 -50
- package/chunks/terminal-image-renderer-73NDY7OJ.js +156 -0
- package/chunks/theme-manager-YG3L7BV6.js +140 -0
- package/chunks/{todoWrite-XSTG2VT5.js → todoWrite-CMBHPR66.js} +8 -5
- package/chunks/tool-result-media-V3LNDB5Q.js +45 -0
- package/chunks/{tool-search-ZHTJU2MV.js → tool-search-7XR7RHMB.js} +43 -21
- package/chunks/total-session-admission-QUZYGACG.js +151 -0
- package/chunks/transcribe-audio-AJQZPNEV.js +30 -0
- package/chunks/trustedFolders-QRII2BL7.js +160 -0
- package/chunks/understand-video-segments-5TMRDQUB.js +438 -0
- package/chunks/{update-relaunch-LI7GRP36.js → update-relaunch-735DXN5P.js} +5 -5
- package/chunks/updateCheck-FXXOM4YS.js +156 -0
- package/chunks/upload-cache-5YULQVZZ.js +17 -0
- package/chunks/upload-config-CKDIXTPK.js +25 -0
- package/chunks/useAutoAcceptIndicator-KXXTKOGD.js +158 -0
- package/chunks/{validateNonInterActiveAuth-YFPCYYNL.js → validateNonInterActiveAuth-DXCBDHIX.js} +143 -119
- package/chunks/{version-4MTL4JVU.js → version-76T4NBMQ.js} +1 -1
- package/chunks/{web-fetch-O6RG6ISB.js → web-fetch-UIDZX5RN.js} +27 -20
- package/chunks/{web-search-JHAXVEMD.js → web-search-VETWDOUJ.js} +14 -11
- package/chunks/{web-shell-static-FFWCUUZS.js → web-shell-static-XSCCMXKQ.js} +3 -3
- package/chunks/{workflow-O7L6VDYU.js → workflow-MHYBJHPP.js} +63 -52
- package/chunks/workspace-providers-status-WFBT3LS5.js +154 -0
- package/chunks/{workspace-registration-store-7G4E7YPY.js → workspace-registration-store-M3WKKBJQ.js} +1 -1
- package/chunks/workspace-registry-FIUB7MGD.js +160 -0
- package/chunks/workspace-runtime-coordinator-5Z7M36W7.js +163 -0
- package/chunks/workspace-service-TP4VRTZF.js +165 -0
- package/chunks/workspace-skills-status-CILWVQHU.js +151 -0
- package/chunks/{workspace-trust-reconciler-XEBW5FUL.js → workspace-trust-reconciler-2OPSTQNS.js} +98 -74
- package/chunks/write-file-N7NBKIYD.js +107 -0
- package/chunks/{zh-TW-S3YTQ4DS.js → zh-TW-SRB5QSER.js} +16 -0
- package/chunks/{zh-F76MZTL3.js → zh-UBQIFP4A.js} +16 -0
- package/chunks/{zoom-image-RDPRTP4B.js → zoom-image-3GHVMYEW.js} +18 -13
- package/cli.js +14 -14
- package/export-transcript-document.js +3 -3
- package/locales/en.js +18 -0
- package/locales/zh-TW.js +17 -0
- package/locales/zh.js +17 -0
- package/package.json +3 -3
- package/web-shell/assets/{abnfDiagram-VCTEODGH-RxykUDmi.js → abnfDiagram-VCTEODGH-vfbwxn7H.js} +1 -1
- package/web-shell/assets/{arc-CZpgGCJC.js → arc-BT0KMrP5.js} +1 -1
- package/web-shell/assets/{architectureDiagram-5GKGNRK7-BHSMzNDT.js → architectureDiagram-5GKGNRK7-B3TlGgP4.js} +1 -1
- package/web-shell/assets/{blockDiagram-NRAW4CY4-Bn4mF9SZ.js → blockDiagram-NRAW4CY4-DnwF5xi-.js} +1 -1
- package/web-shell/assets/{c4Diagram-UCG6FXSJ-CBM-Bj6t.js → c4Diagram-UCG6FXSJ-8qvMMfFg.js} +1 -1
- package/web-shell/assets/channel-CTm0xByY.js +1 -0
- package/web-shell/assets/{chunk-2Q5K7J3B-D5Fin58O.js → chunk-2Q5K7J3B-CHM51UX6.js} +1 -1
- package/web-shell/assets/{chunk-5VM5RSS4-CY05weF7.js → chunk-5VM5RSS4-BNXaOtyN.js} +1 -1
- package/web-shell/assets/{chunk-F27PBJKO-3neZnj5Y.js → chunk-F27PBJKO-DT-vcF3X.js} +1 -1
- package/web-shell/assets/{chunk-G27WJ6UU-Cd7EU4BE.js → chunk-G27WJ6UU-BXz8438J.js} +1 -1
- package/web-shell/assets/{chunk-JWPE2WC7-DwK1mqFw.js → chunk-JWPE2WC7-CP2ozL3M.js} +1 -1
- package/web-shell/assets/{chunk-LCL6LL3I-Sl7vY22C.js → chunk-LCL6LL3I-DTAWXvja.js} +1 -1
- package/web-shell/assets/{chunk-POPQ4Y6H-BXNzpbVg.js → chunk-POPQ4Y6H-DZENJpGx.js} +1 -1
- package/web-shell/assets/{chunk-SVP7TREG-DjjButcp.js → chunk-SVP7TREG-Dl8djRwv.js} +1 -1
- package/web-shell/assets/{chunk-XXDRQBXY-DNOiCjOJ.js → chunk-XXDRQBXY-B3lJllMA.js} +1 -1
- package/web-shell/assets/classDiagram-DTDB5LWJ-DhMuMK_E.js +1 -0
- package/web-shell/assets/classDiagram-v2-JRS7N3AN-DhMuMK_E.js +1 -0
- package/web-shell/assets/{cose-bilkent-JH36ORCC-BUnker7a.js → cose-bilkent-JH36ORCC-DeosJDcB.js} +1 -1
- package/web-shell/assets/{cynefin-OW5HDTMX-DcUgdWE5.js → cynefin-OW5HDTMX-BvqcLoHm.js} +1 -1
- package/web-shell/assets/{cynefinDiagram-5FMLGOSQ-CvDKsZsL.js → cynefinDiagram-5FMLGOSQ-BYS0pmSs.js} +1 -1
- package/web-shell/assets/{dagre-3AP2YEHR-jpCmUbr1.js → dagre-3AP2YEHR-IDScuL-R.js} +1 -1
- package/web-shell/assets/{diagram-S7CK7UJ4-DBe_bKE5.js → diagram-S7CK7UJ4-EYNlkkKJ.js} +1 -1
- package/web-shell/assets/{diagram-UQ7AKVKN-oXvPpDgs.js → diagram-UQ7AKVKN-D3x9g8Ep.js} +1 -1
- package/web-shell/assets/{diagram-VSXAHHWV-BD7-_SGh.js → diagram-VSXAHHWV-C35O1dtR.js} +1 -1
- package/web-shell/assets/{diagram-VX7I27RA-DOJL0wub.js → diagram-VX7I27RA-XvMv2aCN.js} +1 -1
- package/web-shell/assets/{diagram-Z3DM3KII-DRIiodDD.js → diagram-Z3DM3KII-CeryNvru.js} +1 -1
- package/web-shell/assets/{ebnfDiagram-PWID7BFC-Db31Ulmb.js → ebnfDiagram-PWID7BFC-DAmepjvB.js} +1 -1
- package/web-shell/assets/{erDiagram-SSCWMZ5O-CVHhwI2_.js → erDiagram-SSCWMZ5O-BkGfBZt_.js} +1 -1
- package/web-shell/assets/{flowDiagram-A5DVABFB-DWOFy1FK.js → flowDiagram-A5DVABFB-CzUCgun9.js} +1 -1
- package/web-shell/assets/{ganttDiagram-EL5Y4UJY-C0sxQtPd.js → ganttDiagram-EL5Y4UJY-BIFST90r.js} +1 -1
- package/web-shell/assets/{gitGraphDiagram-WWUBYQGX-CNituBYC.js → gitGraphDiagram-WWUBYQGX-jVvRSGcu.js} +1 -1
- package/web-shell/assets/{index-B15NlwB8.js → index-M1TfOjx2.js} +457 -457
- package/web-shell/assets/{index-gm9tLk7h.js → index-krCDFzE6.js} +1 -1
- package/web-shell/assets/{infoDiagram-RXCK75RN-CxhJYtIR.js → infoDiagram-RXCK75RN-DsU7vA4Q.js} +1 -1
- package/web-shell/assets/{ishikawaDiagram-5VMMS53U-By2mchUy.js → ishikawaDiagram-5VMMS53U-K9mTNAbN.js} +1 -1
- package/web-shell/assets/{journeyDiagram-EYS64GPL-CVH-OweI.js → journeyDiagram-EYS64GPL-BKuHLGxv.js} +1 -1
- package/web-shell/assets/{kanban-definition-3QL26DDD-Cc9dQXLy.js → kanban-definition-3QL26DDD-CXG9frQ_.js} +1 -1
- package/web-shell/assets/{layout-C_60ysHw.js → layout-6G_l7UoH.js} +1 -1
- package/web-shell/assets/{linear-BvAVfqwu.js → linear-DYpvB2mh.js} +1 -1
- package/web-shell/assets/{mermaid.core-C3CoBKAc.js → mermaid.core-Sj3dJttQ.js} +6 -6
- package/web-shell/assets/{mindmap-definition-FBJOCRG2-Cuu8Q8LM.js → mindmap-definition-FBJOCRG2-DNJ1e6qd.js} +1 -1
- package/web-shell/assets/{pegDiagram-XKGWAZYB-DmAeyDO2.js → pegDiagram-XKGWAZYB-D-KPklHv.js} +1 -1
- package/web-shell/assets/{pieDiagram-E7YTZNPT-B7vbB_xv.js → pieDiagram-E7YTZNPT-BQPm03g2.js} +1 -1
- package/web-shell/assets/{quadrantDiagram-AXDQQJYC-BqOBkRR7.js → quadrantDiagram-AXDQQJYC-BubBXSqD.js} +1 -1
- package/web-shell/assets/{railroadDiagram-O6MQD6OU-sI06lZIu.js → railroadDiagram-O6MQD6OU-DatD6KIT.js} +1 -1
- package/web-shell/assets/{requirementDiagram-EFPCY7ZU-Bg13d10S.js → requirementDiagram-EFPCY7ZU-DiQ6jsZY.js} +1 -1
- package/web-shell/assets/{sankeyDiagram-P5KCCOFB-WFOzZHrR.js → sankeyDiagram-P5KCCOFB-C07fyxbH.js} +1 -1
- package/web-shell/assets/{sequenceDiagram-WJ2MYXX4-CCdRbA4E.js → sequenceDiagram-WJ2MYXX4-DWXtsWzI.js} +1 -1
- package/web-shell/assets/{sizeCapture-X5ZJPWSS-BH5F3bGg.js → sizeCapture-X5ZJPWSS-B0cQ1v0l.js} +1 -1
- package/web-shell/assets/{stateDiagram-HBIQ2CUA-NwS2X3QB.js → stateDiagram-HBIQ2CUA-zHgWc00n.js} +1 -1
- package/web-shell/assets/stateDiagram-v2-4QOOHH4V-C-3ZC2nf.js +1 -0
- package/web-shell/assets/{swimlanes-XN3QIQJK-Bm38pM28.js → swimlanes-XN3QIQJK-Dnrrhu0H.js} +1 -1
- package/web-shell/assets/swimlanesDiagram-VK2B7HYN-Ded1L5cw.js +8 -0
- package/web-shell/assets/{timeline-definition-24CTP7MA-Do-agLSo.js → timeline-definition-24CTP7MA-8BV7W2Xq.js} +1 -1
- package/web-shell/assets/{vennDiagram-4TSXK5OY-aggLfZzl.js → vennDiagram-4TSXK5OY-tmBBtlnj.js} +1 -1
- package/web-shell/assets/{wardleyDiagram-VM6X3IG4-D5JR3mXX.js → wardleyDiagram-VM6X3IG4-Cq96T3gb.js} +1 -1
- package/web-shell/assets/{xychartDiagram-S5SC5T6Z-DhtLDuXs.js → xychartDiagram-S5SC5T6Z-Dpzx_ZGQ.js} +1 -1
- package/web-shell/index.html +1 -1
- package/chunks/MaxSizedBox-FCF6M53W.js +0 -124
- package/chunks/acp-subagent-executor-TND6W2O5.js +0 -140
- package/chunks/agent-headless-EJ4QOUSM.js +0 -94
- package/chunks/bridge-MUX5YJZT.js +0 -132
- package/chunks/channel-settings-store-7CBIRZER.js +0 -134
- package/chunks/config-utils-KX2YS725.js +0 -127
- package/chunks/contextCommand-RV6Y5LNJ.js +0 -120
- package/chunks/daemon-status-provider-NULJNAEV.js +0 -131
- package/chunks/daemon-trust-policy-S4KWGPV3.js +0 -126
- package/chunks/deferred-core-runtime-T23ZT443.js +0 -128
- package/chunks/environment-TSQJUTPV.js +0 -143
- package/chunks/errors-RIVYJS6T.js +0 -127
- package/chunks/exitPlanMode-BYBBFN2T.js +0 -92
- package/chunks/handleAutoUpdate-FZP45KOR.js +0 -123
- package/chunks/i18n-OTB62AKW.js +0 -140
- package/chunks/initializer-4JXZEC4B.js +0 -127
- package/chunks/installationInfo-2IJV5QKC.js +0 -121
- package/chunks/list-KQSQ4A5G.js +0 -130
- package/chunks/loadedSettingsAdapter-TZTTNRHI.js +0 -124
- package/chunks/mcp-TFDTUPIA.js +0 -124
- package/chunks/model-configuration-ZCAKKIOF.js +0 -137
- package/chunks/modelConfigUtils-J3ZPW7ZK.js +0 -116
- package/chunks/nonInteractiveCli-GPT3TVOK.js +0 -211
- package/chunks/pidfile-GBTBIGHF.js +0 -127
- package/chunks/prompt-terminal-ledger-ILIXZI3E.js +0 -119
- package/chunks/read-file-G4XKW2CS.js +0 -31
- package/chunks/record-source-2GSY5JD5.js +0 -22
- package/chunks/resumeHistoryUtils-YPJU4XFE.js +0 -132
- package/chunks/ripGrep-AAKMALLM.js +0 -39
- package/chunks/sandbox-UIXL423Z.js +0 -146
- package/chunks/sandboxConfig-CY343YNJ.js +0 -114
- package/chunks/scheduled-tasks-5UGBEVNZ.js +0 -143
- package/chunks/scheduler-GCZYLZ2P.js +0 -136
- package/chunks/serve-2XXQLVK2.js +0 -132
- package/chunks/session-attachments-root-DHQM5IEZ.js +0 -117
- package/chunks/skill-settings-IXG5CTQO.js +0 -140
- package/chunks/spawnChannel-Q3YALTCJ.js +0 -128
- package/chunks/standalone-update-H5OJ7MM7.js +0 -132
- package/chunks/task-create-75HVPEAH.js +0 -28
- package/chunks/terminal-image-renderer-UDPJPGPQ.js +0 -132
- package/chunks/theme-manager-SK57EKMO.js +0 -116
- package/chunks/total-session-admission-UUZBDQCG.js +0 -127
- package/chunks/trustedFolders-4LDBLNTS.js +0 -136
- package/chunks/updateCheck-PKSSORPO.js +0 -132
- package/chunks/useAutoAcceptIndicator-I32UEQPI.js +0 -134
- package/chunks/workspace-providers-status-WRX6CJM4.js +0 -130
- package/chunks/workspace-registry-SXIMGT4D.js +0 -136
- package/chunks/workspace-runtime-coordinator-7DOEHXYT.js +0 -139
- package/chunks/workspace-service-HDXOZMYC.js +0 -141
- package/chunks/workspace-skills-status-VN4L37CA.js +0 -127
- package/chunks/write-file-LKX4ETIO.js +0 -97
- package/web-shell/assets/channel-DFYs_LlK.js +0 -1
- package/web-shell/assets/classDiagram-DTDB5LWJ-DnGrKXoM.js +0 -1
- package/web-shell/assets/classDiagram-v2-JRS7N3AN-DnGrKXoM.js +0 -1
- package/web-shell/assets/stateDiagram-v2-4QOOHH4V-1aU2JZXO.js +0 -1
- package/web-shell/assets/swimlanesDiagram-VK2B7HYN-Dp-u6kQG.js +0 -8
- package/chunks/{chunk-XAJZFGD2.js → chunk-PXXYQOZO.js} +8 -8
- package/chunks/{chunk-WVURIAEE.js → chunk-SVWWF5TZ.js} +3 -3
- package/chunks/{dist-G5UMXIGF.js → dist-I6D6XOWV.js} +1 -1
- package/chunks/{dist-UXVNLQHG.js → dist-VIKOMAGG.js} +3 -3
|
@@ -0,0 +1,1625 @@
|
|
|
1
|
+
// Force strict mode and setup for ESM
|
|
2
|
+
"use strict";
|
|
3
|
+
import {
|
|
4
|
+
DashScopeUploader
|
|
5
|
+
} from "./chunk-V2XJJTAB.js";
|
|
6
|
+
import {
|
|
7
|
+
OmniDegradationCache,
|
|
8
|
+
OmniTransportGuardError,
|
|
9
|
+
assertWithinByteLimit,
|
|
10
|
+
assertWithinDurationLimit,
|
|
11
|
+
assertWithinTokenLimit,
|
|
12
|
+
effectiveMaxUploadFileBytes,
|
|
13
|
+
effectiveOmniStorageMaxTotalBytes,
|
|
14
|
+
estimateRawResourceTokens,
|
|
15
|
+
runFixedPolicies,
|
|
16
|
+
runOmniGcOnce
|
|
17
|
+
} from "./chunk-CQULG2GJ.js";
|
|
18
|
+
import {
|
|
19
|
+
MEDIA_DETECTOR_VERSION,
|
|
20
|
+
MediaMemoryService
|
|
21
|
+
} from "./chunk-SLHYLVRW.js";
|
|
22
|
+
import {
|
|
23
|
+
runStartupRecoveryOnce
|
|
24
|
+
} from "./chunk-RSFNJ6UU.js";
|
|
25
|
+
import {
|
|
26
|
+
DEFAULT_UPLOAD_CACHE_TTL_HOURS,
|
|
27
|
+
OmniUploadCache
|
|
28
|
+
} from "./chunk-JYGESWZM.js";
|
|
29
|
+
import {
|
|
30
|
+
OmniObjectStore,
|
|
31
|
+
prepareOmniDownloadsDir
|
|
32
|
+
} from "./chunk-FTKXJMQV.js";
|
|
33
|
+
import {
|
|
34
|
+
extensionForMime,
|
|
35
|
+
hashFileSha256,
|
|
36
|
+
recognizeMediaFile,
|
|
37
|
+
sniffMediaType
|
|
38
|
+
} from "./chunk-S5BHLTHK.js";
|
|
39
|
+
import {
|
|
40
|
+
isFfmpegAvailable,
|
|
41
|
+
isFfprobeAvailable
|
|
42
|
+
} from "./chunk-KSEKRQJO.js";
|
|
43
|
+
import {
|
|
44
|
+
resolveNetworkTarget
|
|
45
|
+
} from "./chunk-6C3D7BKK.js";
|
|
46
|
+
import {
|
|
47
|
+
isOmniDeliveryActive
|
|
48
|
+
} from "./chunk-DBDJRURL.js";
|
|
49
|
+
import {
|
|
50
|
+
requireEffectiveOmniUploadConfig
|
|
51
|
+
} from "./chunk-UQRDQCWF.js";
|
|
52
|
+
import {
|
|
53
|
+
OMNI_DISCLOSURE_TEXT_PREFIX,
|
|
54
|
+
OMNI_OMISSION_TEXT_PREFIX,
|
|
55
|
+
OMNI_RESOURCE_HANDLE_TEXT_PREFIX,
|
|
56
|
+
OMNI_RESOURCE_PATH_TEXT_PREFIX,
|
|
57
|
+
OMNI_TRANSCRIPT_TEXT_PREFIX,
|
|
58
|
+
formatDisclosureText,
|
|
59
|
+
formatOmissionText,
|
|
60
|
+
formatResourceHandleText,
|
|
61
|
+
formatTranscriptText,
|
|
62
|
+
harnessPathAnnotationPart,
|
|
63
|
+
isHarnessAnnotationPart,
|
|
64
|
+
parseResourceHandleText,
|
|
65
|
+
parseResourcePathText,
|
|
66
|
+
splitAnnotationBody,
|
|
67
|
+
unescapeAnnotationName
|
|
68
|
+
} from "./chunk-BKVPLSEI.js";
|
|
69
|
+
import {
|
|
70
|
+
isPermittedRedirect,
|
|
71
|
+
isPrivateHost
|
|
72
|
+
} from "./chunk-KKPIFWTZ.js";
|
|
73
|
+
import {
|
|
74
|
+
detectRuntime,
|
|
75
|
+
loadUndici
|
|
76
|
+
} from "./chunk-SBP43AO6.js";
|
|
77
|
+
import {
|
|
78
|
+
createDebugLogger
|
|
79
|
+
} from "./chunk-ZYDMQCQP.js";
|
|
80
|
+
import {
|
|
81
|
+
isAbortError
|
|
82
|
+
} from "./chunk-S34QJ6IR.js";
|
|
83
|
+
import {
|
|
84
|
+
init_esbuild_shims
|
|
85
|
+
} from "./chunk-5O2XNYP6.js";
|
|
86
|
+
import {
|
|
87
|
+
__name
|
|
88
|
+
} from "./chunk-J2S4EL5Y.js";
|
|
89
|
+
|
|
90
|
+
// packages/core/src/omni/index.ts
|
|
91
|
+
init_esbuild_shims();
|
|
92
|
+
import { createHash } from "node:crypto";
|
|
93
|
+
import path4 from "node:path";
|
|
94
|
+
import fs4 from "node:fs/promises";
|
|
95
|
+
|
|
96
|
+
// packages/core/src/omni/policy/session-context.ts
|
|
97
|
+
init_esbuild_shims();
|
|
98
|
+
function buildSessionConditionNamespace(config, reservedOutputTokens) {
|
|
99
|
+
const session = {
|
|
100
|
+
reservedOutputTokens
|
|
101
|
+
};
|
|
102
|
+
const windowSize = config.getContentGeneratorConfig?.()?.contextWindowSize;
|
|
103
|
+
const contextWindowTokens = typeof windowSize === "number" && Number.isFinite(windowSize) && windowSize > 0 ? windowSize : void 0;
|
|
104
|
+
if (contextWindowTokens !== void 0) {
|
|
105
|
+
session.contextWindowTokens = contextWindowTokens;
|
|
106
|
+
}
|
|
107
|
+
let promptTokenCount;
|
|
108
|
+
try {
|
|
109
|
+
const count = config.getGeminiClient?.()?.getChat?.()?.getLastPromptTokenCount();
|
|
110
|
+
if (typeof count === "number" && Number.isFinite(count) && count >= 0) {
|
|
111
|
+
promptTokenCount = count;
|
|
112
|
+
}
|
|
113
|
+
} catch {
|
|
114
|
+
}
|
|
115
|
+
if (promptTokenCount !== void 0) {
|
|
116
|
+
session.promptTokenCount = promptTokenCount;
|
|
117
|
+
}
|
|
118
|
+
if (contextWindowTokens !== void 0 && promptTokenCount !== void 0) {
|
|
119
|
+
session.availableContextTokens = Math.max(
|
|
120
|
+
0,
|
|
121
|
+
contextWindowTokens - promptTokenCount - reservedOutputTokens
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
return session;
|
|
125
|
+
}
|
|
126
|
+
__name(buildSessionConditionNamespace, "buildSessionConditionNamespace");
|
|
127
|
+
|
|
128
|
+
// packages/core/src/omni/download.ts
|
|
129
|
+
init_esbuild_shims();
|
|
130
|
+
import { randomBytes } from "node:crypto";
|
|
131
|
+
import { once } from "node:events";
|
|
132
|
+
import { createWriteStream } from "node:fs";
|
|
133
|
+
import fs from "node:fs/promises";
|
|
134
|
+
import path from "node:path";
|
|
135
|
+
import { Readable } from "node:stream";
|
|
136
|
+
import { pipeline } from "node:stream/promises";
|
|
137
|
+
var debugLogger = createDebugLogger("omni:download");
|
|
138
|
+
var OmniDownloadError = class extends Error {
|
|
139
|
+
static {
|
|
140
|
+
__name(this, "OmniDownloadError");
|
|
141
|
+
}
|
|
142
|
+
constructor(message, options) {
|
|
143
|
+
super(message, options);
|
|
144
|
+
this.name = "OmniDownloadError";
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
var RESOLVE_TIMEOUT_MS = 3e4;
|
|
148
|
+
var HEADER_TIMEOUT_MS = 3e4;
|
|
149
|
+
var IDLE_TIMEOUT_MS = 6e4;
|
|
150
|
+
var MAX_REDIRECTS = 5;
|
|
151
|
+
function parseHttpUrlRef(pathName) {
|
|
152
|
+
if (!/^https?:\/\//i.test(pathName)) return null;
|
|
153
|
+
try {
|
|
154
|
+
return new URL(pathName);
|
|
155
|
+
} catch {
|
|
156
|
+
return null;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
__name(parseHttpUrlRef, "parseHttpUrlRef");
|
|
160
|
+
function scrubPathsFromMessage(message) {
|
|
161
|
+
return message.replace(
|
|
162
|
+
/(?:[A-Za-z]:)?(?:[\\/][^\s'"`\\/]+){2,}[\\/]?/g,
|
|
163
|
+
(match) => path.basename(match)
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
__name(scrubPathsFromMessage, "scrubPathsFromMessage");
|
|
167
|
+
function formatCauseChain(err) {
|
|
168
|
+
const parts = [];
|
|
169
|
+
let cause = err instanceof Error ? err.cause : void 0;
|
|
170
|
+
for (let depth = 0; cause != null && depth < 4; depth++) {
|
|
171
|
+
const code = cause.code;
|
|
172
|
+
const message = cause instanceof Error ? cause.message : typeof cause === "string" ? cause : void 0;
|
|
173
|
+
if (typeof code === "string" && message && !message.includes(code)) {
|
|
174
|
+
parts.push(`${code}: ${message}`);
|
|
175
|
+
} else if (message) {
|
|
176
|
+
parts.push(message);
|
|
177
|
+
} else if (typeof code === "string") {
|
|
178
|
+
parts.push(code);
|
|
179
|
+
}
|
|
180
|
+
cause = cause instanceof Error ? cause.cause : void 0;
|
|
181
|
+
}
|
|
182
|
+
return parts.length > 0 ? scrubPathsFromMessage(parts.join("; ")) : void 0;
|
|
183
|
+
}
|
|
184
|
+
__name(formatCauseChain, "formatCauseChain");
|
|
185
|
+
function detectConfiguredProxy(undici) {
|
|
186
|
+
for (const key of [
|
|
187
|
+
"https_proxy",
|
|
188
|
+
"HTTPS_PROXY",
|
|
189
|
+
"http_proxy",
|
|
190
|
+
"HTTP_PROXY",
|
|
191
|
+
"all_proxy",
|
|
192
|
+
"ALL_PROXY"
|
|
193
|
+
]) {
|
|
194
|
+
if (process.env[key]) return true;
|
|
195
|
+
}
|
|
196
|
+
try {
|
|
197
|
+
return undici.getGlobalDispatcher() instanceof undici.EnvHttpProxyAgent;
|
|
198
|
+
} catch {
|
|
199
|
+
return false;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
__name(detectConfiguredProxy, "detectConfiguredProxy");
|
|
203
|
+
async function downloadMediaUrl(params) {
|
|
204
|
+
const {
|
|
205
|
+
url,
|
|
206
|
+
downloadsDir,
|
|
207
|
+
maxBytes,
|
|
208
|
+
signal,
|
|
209
|
+
resolveTimeoutMs = RESOLVE_TIMEOUT_MS,
|
|
210
|
+
headerTimeoutMs = HEADER_TIMEOUT_MS,
|
|
211
|
+
idleTimeoutMs = IDLE_TIMEOUT_MS
|
|
212
|
+
} = params;
|
|
213
|
+
const resolveTarget = params.resolveTarget ?? ((target) => resolveNetworkTarget(target, "public", signal));
|
|
214
|
+
if (isPrivateHost(url)) {
|
|
215
|
+
throw new OmniDownloadError(
|
|
216
|
+
`URL host is not publicly routable (refused for safety): ${new URL(url).hostname}`
|
|
217
|
+
);
|
|
218
|
+
}
|
|
219
|
+
let parsed;
|
|
220
|
+
try {
|
|
221
|
+
parsed = new URL(url);
|
|
222
|
+
} catch {
|
|
223
|
+
throw new OmniDownloadError("URL media ref is not a valid URL (refused).");
|
|
224
|
+
}
|
|
225
|
+
if (parsed.protocol !== "https:") {
|
|
226
|
+
throw new OmniDownloadError(
|
|
227
|
+
`URL media must be https (refused for safety): ${parsed.protocol}//${parsed.hostname}`
|
|
228
|
+
);
|
|
229
|
+
}
|
|
230
|
+
if (parsed.username || parsed.password) {
|
|
231
|
+
throw new OmniDownloadError(
|
|
232
|
+
`URL media must not embed credentials (refused for safety): ${parsed.hostname}`
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
const runtime = detectRuntime();
|
|
236
|
+
if (runtime !== "node") {
|
|
237
|
+
throw new OmniDownloadError(
|
|
238
|
+
`URL media requires the Node runtime to verify the connection target (refused for safety on ${runtime}): use a local file path instead of a URL, or run under Node.`
|
|
239
|
+
);
|
|
240
|
+
}
|
|
241
|
+
const undici = await loadUndici();
|
|
242
|
+
const proxied = params.detectProxy ? params.detectProxy() : detectConfiguredProxy(undici);
|
|
243
|
+
if (proxied) {
|
|
244
|
+
throw new OmniDownloadError(
|
|
245
|
+
`URL media fetching is not supported behind a proxy yet (refused): the connection pinning that enforces SSRF protection cannot be applied through a proxy. Download the file manually and use a local path instead.`
|
|
246
|
+
);
|
|
247
|
+
}
|
|
248
|
+
try {
|
|
249
|
+
await prepareOmniDownloadsDir(downloadsDir);
|
|
250
|
+
} catch (err) {
|
|
251
|
+
throw new OmniDownloadError(
|
|
252
|
+
`Could not prepare the downloads directory for URL media: ${err instanceof Error ? scrubPathsFromMessage(err.message) : String(err)}`,
|
|
253
|
+
{ cause: err }
|
|
254
|
+
);
|
|
255
|
+
}
|
|
256
|
+
const partPath = path.join(
|
|
257
|
+
downloadsDir,
|
|
258
|
+
`${randomBytes(8).toString("hex")}.part`
|
|
259
|
+
);
|
|
260
|
+
let currentUrl = url;
|
|
261
|
+
let dispatcher;
|
|
262
|
+
try {
|
|
263
|
+
for (let redirects = 0; ; redirects++) {
|
|
264
|
+
let target;
|
|
265
|
+
const resolveAbort = new AbortController();
|
|
266
|
+
const resolveTimer = setTimeout(
|
|
267
|
+
() => resolveAbort.abort(new Error("resolve timeout")),
|
|
268
|
+
resolveTimeoutMs
|
|
269
|
+
);
|
|
270
|
+
try {
|
|
271
|
+
const pending = resolveTarget(currentUrl);
|
|
272
|
+
pending.catch(() => {
|
|
273
|
+
});
|
|
274
|
+
target = await Promise.race([
|
|
275
|
+
pending,
|
|
276
|
+
new Promise((_, reject) => {
|
|
277
|
+
resolveAbort.signal.addEventListener(
|
|
278
|
+
"abort",
|
|
279
|
+
() => reject(resolveAbort.signal.reason),
|
|
280
|
+
{ once: true }
|
|
281
|
+
);
|
|
282
|
+
})
|
|
283
|
+
]);
|
|
284
|
+
} catch (err) {
|
|
285
|
+
if (signal?.aborted) throw err;
|
|
286
|
+
if (resolveAbort.signal.aborted) {
|
|
287
|
+
throw new OmniDownloadError(
|
|
288
|
+
`Download timed out resolving ${new URL(currentUrl).hostname} (${resolveTimeoutMs / 1e3}s)`
|
|
289
|
+
);
|
|
290
|
+
}
|
|
291
|
+
const text = err instanceof Error ? err.message : String(err);
|
|
292
|
+
const reason = /blocked address/i.test(text) ? "resolved to a non-public address" : /did not resolve/i.test(text) ? "did not resolve" : "could not be verified";
|
|
293
|
+
throw new OmniDownloadError(
|
|
294
|
+
`URL host ${reason} (refused for safety): ${new URL(currentUrl).hostname}`,
|
|
295
|
+
{ cause: err }
|
|
296
|
+
);
|
|
297
|
+
} finally {
|
|
298
|
+
clearTimeout(resolveTimer);
|
|
299
|
+
}
|
|
300
|
+
if (!target.lookup) {
|
|
301
|
+
throw new OmniDownloadError(
|
|
302
|
+
`URL host cannot be safely bound to a verified address (refused for safety): ${new URL(currentUrl).hostname}`
|
|
303
|
+
);
|
|
304
|
+
}
|
|
305
|
+
const fetchFn = params.fetchFn ?? undici.fetch;
|
|
306
|
+
const previousDispatcher = dispatcher;
|
|
307
|
+
dispatcher = new undici.Agent({ connect: { lookup: target.lookup } });
|
|
308
|
+
await previousDispatcher?.close().catch(() => {
|
|
309
|
+
});
|
|
310
|
+
const headerAbort = new AbortController();
|
|
311
|
+
const headerTimer = setTimeout(
|
|
312
|
+
() => headerAbort.abort(new Error("header timeout")),
|
|
313
|
+
headerTimeoutMs
|
|
314
|
+
);
|
|
315
|
+
const combined = AbortSignal.any(
|
|
316
|
+
signal ? [signal, headerAbort.signal] : [headerAbort.signal]
|
|
317
|
+
);
|
|
318
|
+
let res;
|
|
319
|
+
try {
|
|
320
|
+
res = await fetchFn(currentUrl, {
|
|
321
|
+
redirect: "manual",
|
|
322
|
+
signal: combined,
|
|
323
|
+
// Not in the DOM RequestInit type; undici reads it (same cast as
|
|
324
|
+
// services/image-generation-service.ts).
|
|
325
|
+
dispatcher
|
|
326
|
+
});
|
|
327
|
+
} catch (err) {
|
|
328
|
+
if (signal?.aborted) throw err;
|
|
329
|
+
if (headerAbort.signal.aborted) {
|
|
330
|
+
throw new OmniDownloadError(
|
|
331
|
+
`Download timed out waiting for response headers from ${new URL(currentUrl).hostname} (${headerTimeoutMs / 1e3}s)`
|
|
332
|
+
);
|
|
333
|
+
}
|
|
334
|
+
const detail = err instanceof Error ? scrubPathsFromMessage(err.message) : String(err);
|
|
335
|
+
const causeDetail = formatCauseChain(err);
|
|
336
|
+
throw new OmniDownloadError(
|
|
337
|
+
`Download request failed for ${new URL(currentUrl).hostname}: ${detail}${causeDetail ? ` (${causeDetail})` : ""}`,
|
|
338
|
+
{ cause: err }
|
|
339
|
+
);
|
|
340
|
+
} finally {
|
|
341
|
+
clearTimeout(headerTimer);
|
|
342
|
+
}
|
|
343
|
+
if (res.status >= 300 && res.status < 400) {
|
|
344
|
+
await res.body?.cancel().catch(() => {
|
|
345
|
+
});
|
|
346
|
+
const location = res.headers.get("location");
|
|
347
|
+
if (!location || redirects >= MAX_REDIRECTS) {
|
|
348
|
+
throw new OmniDownloadError(
|
|
349
|
+
`Too many or invalid redirects downloading from ${new URL(currentUrl).hostname}`
|
|
350
|
+
);
|
|
351
|
+
}
|
|
352
|
+
let redirectUrl;
|
|
353
|
+
try {
|
|
354
|
+
redirectUrl = new URL(location, currentUrl).toString();
|
|
355
|
+
} catch {
|
|
356
|
+
throw new OmniDownloadError(
|
|
357
|
+
`Redirect with a malformed Location header from ${new URL(currentUrl).hostname}`
|
|
358
|
+
);
|
|
359
|
+
}
|
|
360
|
+
if (!isPermittedRedirect(currentUrl, redirectUrl)) {
|
|
361
|
+
throw new OmniDownloadError(
|
|
362
|
+
`Cross-origin redirect refused: ${new URL(currentUrl).hostname} \u2192 ${new URL(redirectUrl).hostname}`
|
|
363
|
+
);
|
|
364
|
+
}
|
|
365
|
+
currentUrl = redirectUrl;
|
|
366
|
+
continue;
|
|
367
|
+
}
|
|
368
|
+
if (!res.ok) {
|
|
369
|
+
await res.body?.cancel().catch(() => {
|
|
370
|
+
});
|
|
371
|
+
throw new OmniDownloadError(
|
|
372
|
+
`Download failed: HTTP ${res.status} from ${new URL(currentUrl).hostname}`
|
|
373
|
+
);
|
|
374
|
+
}
|
|
375
|
+
const contentLength = Number(res.headers.get("content-length"));
|
|
376
|
+
if (Number.isFinite(contentLength) && contentLength > maxBytes) {
|
|
377
|
+
await res.body?.cancel().catch(() => {
|
|
378
|
+
});
|
|
379
|
+
throw new OmniDownloadError(
|
|
380
|
+
`Download exceeds the omni media limit: Content-Length ${contentLength} > ${maxBytes} bytes.`
|
|
381
|
+
);
|
|
382
|
+
}
|
|
383
|
+
if (!res.body) {
|
|
384
|
+
throw new OmniDownloadError("Download response had no body.");
|
|
385
|
+
}
|
|
386
|
+
let written = 0;
|
|
387
|
+
const idleAbort = new AbortController();
|
|
388
|
+
let idleTimer = setTimeout(
|
|
389
|
+
() => idleAbort.abort(new Error("idle timeout")),
|
|
390
|
+
idleTimeoutMs
|
|
391
|
+
);
|
|
392
|
+
const streamSignal = AbortSignal.any(
|
|
393
|
+
signal ? [signal, idleAbort.signal] : [idleAbort.signal]
|
|
394
|
+
);
|
|
395
|
+
try {
|
|
396
|
+
const source = Readable.fromWeb(
|
|
397
|
+
res.body,
|
|
398
|
+
{ signal: streamSignal }
|
|
399
|
+
);
|
|
400
|
+
const counter = /* @__PURE__ */ __name(async function* (src) {
|
|
401
|
+
for await (const chunk of src) {
|
|
402
|
+
clearTimeout(idleTimer);
|
|
403
|
+
idleTimer = setTimeout(
|
|
404
|
+
() => idleAbort.abort(new Error("idle timeout")),
|
|
405
|
+
idleTimeoutMs
|
|
406
|
+
);
|
|
407
|
+
written += chunk.length;
|
|
408
|
+
if (written > maxBytes) {
|
|
409
|
+
throw new OmniDownloadError(
|
|
410
|
+
`Download exceeds the omni media limit: >${maxBytes} bytes received.`
|
|
411
|
+
);
|
|
412
|
+
}
|
|
413
|
+
yield chunk;
|
|
414
|
+
}
|
|
415
|
+
}, "counter");
|
|
416
|
+
const destination = createWriteStream(partPath, { mode: 384 });
|
|
417
|
+
await once(destination, "open");
|
|
418
|
+
await pipeline(source, counter, destination);
|
|
419
|
+
} catch (err) {
|
|
420
|
+
if (signal?.aborted) throw err;
|
|
421
|
+
if (err instanceof OmniDownloadError) throw err;
|
|
422
|
+
if (idleAbort.signal.aborted) {
|
|
423
|
+
throw new OmniDownloadError(
|
|
424
|
+
`Download stalled from ${new URL(currentUrl).hostname}: no data for ${idleTimeoutMs / 1e3}s`
|
|
425
|
+
);
|
|
426
|
+
}
|
|
427
|
+
throw new OmniDownloadError(
|
|
428
|
+
`Download interrupted from ${new URL(currentUrl).hostname}: ${err instanceof Error ? scrubPathsFromMessage(err.message) : String(err)}`,
|
|
429
|
+
{ cause: err }
|
|
430
|
+
);
|
|
431
|
+
} finally {
|
|
432
|
+
clearTimeout(idleTimer);
|
|
433
|
+
}
|
|
434
|
+
debugLogger.debug(
|
|
435
|
+
`downloaded ${written} bytes from ${new URL(currentUrl).hostname}`
|
|
436
|
+
);
|
|
437
|
+
return { partPath };
|
|
438
|
+
}
|
|
439
|
+
} catch (err) {
|
|
440
|
+
await fs.rm(partPath, { force: true });
|
|
441
|
+
throw err;
|
|
442
|
+
} finally {
|
|
443
|
+
await dispatcher?.close().catch(() => {
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
__name(downloadMediaUrl, "downloadMediaUrl");
|
|
448
|
+
|
|
449
|
+
// packages/core/src/omni/tool-result-media.ts
|
|
450
|
+
init_esbuild_shims();
|
|
451
|
+
import { randomBytes as randomBytes2 } from "node:crypto";
|
|
452
|
+
import fs2 from "node:fs/promises";
|
|
453
|
+
import path2 from "node:path";
|
|
454
|
+
var debugLogger2 = createDebugLogger("omni:tool-result");
|
|
455
|
+
var MAX_UPLOADS_PER_TOOL_RESULT = 8;
|
|
456
|
+
var MAX_UPLOAD_BYTES_PER_TOOL_RESULT = 128 * 1024 * 1024;
|
|
457
|
+
async function processToolResultOmniMedia(responseParts, config, signal) {
|
|
458
|
+
if (!isOmniDeliveryActive(config)) return responseParts;
|
|
459
|
+
const modalities = config.getContentGeneratorConfig?.()?.modalities ?? {};
|
|
460
|
+
let changed = false;
|
|
461
|
+
let uploadsRemaining = MAX_UPLOADS_PER_TOOL_RESULT;
|
|
462
|
+
let uploadBytesRemaining = MAX_UPLOAD_BYTES_PER_TOOL_RESULT;
|
|
463
|
+
const convertPart = /* @__PURE__ */ __name(async (part) => {
|
|
464
|
+
const inline = part.inlineData;
|
|
465
|
+
if (!inline?.data || !inline.mimeType) return [part];
|
|
466
|
+
const top = inline.mimeType.split("/")[0];
|
|
467
|
+
if (top !== "image" && top !== "audio" && top !== "video") return [part];
|
|
468
|
+
const bytes = Buffer.from(inline.data, "base64");
|
|
469
|
+
const sniffed = sniffMediaType(bytes.subarray(0, 4096));
|
|
470
|
+
if (!sniffed) return [part];
|
|
471
|
+
if (!modalities[sniffed.modality]) return [part];
|
|
472
|
+
if (uploadsRemaining <= 0 || bytes.length > uploadBytesRemaining) {
|
|
473
|
+
debugLogger2.debug(
|
|
474
|
+
`tool-result media budget exhausted; keeping part inline (${bytes.length} bytes)`
|
|
475
|
+
);
|
|
476
|
+
return [part];
|
|
477
|
+
}
|
|
478
|
+
const store = new OmniObjectStore(config.storage.getQwenDir());
|
|
479
|
+
let tempPath;
|
|
480
|
+
const displayName = inline.displayName ?? `tool-media.${top}`;
|
|
481
|
+
try {
|
|
482
|
+
const stagingDir = await prepareOmniDownloadsDir(
|
|
483
|
+
path2.join(store.getOmniRootDir(), "downloads")
|
|
484
|
+
);
|
|
485
|
+
tempPath = path2.join(
|
|
486
|
+
stagingDir,
|
|
487
|
+
`${randomBytes2(8).toString("hex")}.part`
|
|
488
|
+
);
|
|
489
|
+
await fs2.writeFile(tempPath, bytes, { mode: 384 });
|
|
490
|
+
const delivery = await processMediaForOmniDelivery(tempPath, config, {
|
|
491
|
+
expectedModality: sniffed.modality,
|
|
492
|
+
signal,
|
|
493
|
+
displayName,
|
|
494
|
+
origin: "tool"
|
|
495
|
+
});
|
|
496
|
+
const transcriptParts = buildTranscriptParts(
|
|
497
|
+
displayName,
|
|
498
|
+
delivery.transcripts
|
|
499
|
+
);
|
|
500
|
+
const additionalParts = buildAdditionalMediaParts(
|
|
501
|
+
displayName,
|
|
502
|
+
delivery.additionalMedia
|
|
503
|
+
);
|
|
504
|
+
uploadsRemaining -= delivery.additionalMedia?.filter((e) => !e.omission).length ?? 0;
|
|
505
|
+
const handleParts = delivery.resourceId ? [
|
|
506
|
+
{
|
|
507
|
+
text: formatResourceHandleText(displayName, delivery.resourceId)
|
|
508
|
+
}
|
|
509
|
+
] : [];
|
|
510
|
+
if (delivery.omission) {
|
|
511
|
+
changed = true;
|
|
512
|
+
return [
|
|
513
|
+
...handleParts,
|
|
514
|
+
{ text: formatOmissionText(displayName, delivery.omission.reason) },
|
|
515
|
+
...additionalParts,
|
|
516
|
+
...transcriptParts
|
|
517
|
+
];
|
|
518
|
+
}
|
|
519
|
+
if (!delivery.fileUri && transcriptParts.length > 0) {
|
|
520
|
+
changed = true;
|
|
521
|
+
return delivery.disclosure ? [
|
|
522
|
+
...handleParts,
|
|
523
|
+
{ text: formatDisclosureText(displayName, delivery.disclosure) },
|
|
524
|
+
...additionalParts,
|
|
525
|
+
...transcriptParts
|
|
526
|
+
] : [...handleParts, ...additionalParts, ...transcriptParts];
|
|
527
|
+
}
|
|
528
|
+
changed = true;
|
|
529
|
+
uploadsRemaining--;
|
|
530
|
+
uploadBytesRemaining -= bytes.length;
|
|
531
|
+
const fileDataPart = {
|
|
532
|
+
fileData: {
|
|
533
|
+
fileUri: delivery.fileUri,
|
|
534
|
+
mimeType: delivery.mimeType,
|
|
535
|
+
displayName
|
|
536
|
+
}
|
|
537
|
+
};
|
|
538
|
+
return delivery.disclosure ? [
|
|
539
|
+
...handleParts,
|
|
540
|
+
{ text: formatDisclosureText(displayName, delivery.disclosure) },
|
|
541
|
+
fileDataPart,
|
|
542
|
+
...additionalParts,
|
|
543
|
+
...transcriptParts
|
|
544
|
+
] : [
|
|
545
|
+
...handleParts,
|
|
546
|
+
fileDataPart,
|
|
547
|
+
...additionalParts,
|
|
548
|
+
...transcriptParts
|
|
549
|
+
];
|
|
550
|
+
} catch (err) {
|
|
551
|
+
if (signal.aborted) throw err;
|
|
552
|
+
if (err instanceof OmniTransportGuardError) {
|
|
553
|
+
changed = true;
|
|
554
|
+
return [
|
|
555
|
+
...err.sessionResourceId ? [
|
|
556
|
+
{
|
|
557
|
+
text: formatResourceHandleText(
|
|
558
|
+
displayName,
|
|
559
|
+
err.sessionResourceId
|
|
560
|
+
)
|
|
561
|
+
}
|
|
562
|
+
] : [],
|
|
563
|
+
{
|
|
564
|
+
text: `[Tool media part withheld by the omni transport guard: ${err.message}]`
|
|
565
|
+
}
|
|
566
|
+
];
|
|
567
|
+
}
|
|
568
|
+
debugLogger2.debug(
|
|
569
|
+
`tool-result media upload failed, keeping inline: ${err instanceof Error ? err.message : String(err)}`
|
|
570
|
+
);
|
|
571
|
+
return [part];
|
|
572
|
+
} finally {
|
|
573
|
+
if (tempPath !== void 0) {
|
|
574
|
+
await fs2.rm(tempPath, { force: true }).catch(() => {
|
|
575
|
+
});
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
}, "convertPart");
|
|
579
|
+
const result = [];
|
|
580
|
+
for (const part of responseParts) {
|
|
581
|
+
const nested = part.functionResponse?.parts;
|
|
582
|
+
if (Array.isArray(nested) && nested.length > 0) {
|
|
583
|
+
const convertedNested = [];
|
|
584
|
+
let nestedChanged = false;
|
|
585
|
+
for (const nestedPart of nested) {
|
|
586
|
+
const converted = await convertPart(nestedPart);
|
|
587
|
+
if (converted.length !== 1 || converted[0] !== nestedPart) {
|
|
588
|
+
nestedChanged = true;
|
|
589
|
+
}
|
|
590
|
+
convertedNested.push(...converted);
|
|
591
|
+
}
|
|
592
|
+
if (nestedChanged) {
|
|
593
|
+
result.push({
|
|
594
|
+
...part,
|
|
595
|
+
functionResponse: {
|
|
596
|
+
...part.functionResponse,
|
|
597
|
+
parts: convertedNested
|
|
598
|
+
}
|
|
599
|
+
});
|
|
600
|
+
changed = true;
|
|
601
|
+
} else {
|
|
602
|
+
result.push(part);
|
|
603
|
+
}
|
|
604
|
+
continue;
|
|
605
|
+
}
|
|
606
|
+
result.push(...await convertPart(part));
|
|
607
|
+
}
|
|
608
|
+
return changed ? result : responseParts;
|
|
609
|
+
}
|
|
610
|
+
__name(processToolResultOmniMedia, "processToolResultOmniMedia");
|
|
611
|
+
|
|
612
|
+
// packages/core/src/omni/export.ts
|
|
613
|
+
init_esbuild_shims();
|
|
614
|
+
import fs3 from "node:fs/promises";
|
|
615
|
+
import path3 from "node:path";
|
|
616
|
+
var debugLogger3 = createDebugLogger("omni:export");
|
|
617
|
+
function textOfPart(part) {
|
|
618
|
+
if (typeof part === "string") return part;
|
|
619
|
+
if (typeof part === "object" && part !== null && "text" in part) {
|
|
620
|
+
const text = part.text;
|
|
621
|
+
return typeof text === "string" ? text : void 0;
|
|
622
|
+
}
|
|
623
|
+
return void 0;
|
|
624
|
+
}
|
|
625
|
+
__name(textOfPart, "textOfPart");
|
|
626
|
+
function functionResponseOfPart(part) {
|
|
627
|
+
if (typeof part !== "object" || part === null) return void 0;
|
|
628
|
+
const response = part.functionResponse;
|
|
629
|
+
if (typeof response !== "object" || response === null) return void 0;
|
|
630
|
+
const { id, parts } = response;
|
|
631
|
+
return { id, ...Array.isArray(parts) ? { parts } : {} };
|
|
632
|
+
}
|
|
633
|
+
__name(functionResponseOfPart, "functionResponseOfPart");
|
|
634
|
+
function isThoughtPart(part) {
|
|
635
|
+
return typeof part === "object" && part !== null && part.thought === true;
|
|
636
|
+
}
|
|
637
|
+
__name(isThoughtPart, "isThoughtPart");
|
|
638
|
+
function functionCallOfPart(part) {
|
|
639
|
+
if (typeof part !== "object" || part === null) return void 0;
|
|
640
|
+
const fc = part.functionCall;
|
|
641
|
+
if (typeof fc !== "object" || fc === null) return void 0;
|
|
642
|
+
const { id, name, args } = fc;
|
|
643
|
+
if (typeof name !== "string") return void 0;
|
|
644
|
+
const cleanArgs = typeof args === "object" && args !== null ? { ...args } : void 0;
|
|
645
|
+
return {
|
|
646
|
+
...typeof id === "string" ? { callId: id } : {},
|
|
647
|
+
name,
|
|
648
|
+
...cleanArgs ? { args: cleanArgs } : {}
|
|
649
|
+
};
|
|
650
|
+
}
|
|
651
|
+
__name(functionCallOfPart, "functionCallOfPart");
|
|
652
|
+
function stripSystemReminders(text) {
|
|
653
|
+
return text.replace(/<system-reminder>[\s\S]*?<\/system-reminder>/g, "");
|
|
654
|
+
}
|
|
655
|
+
__name(stripSystemReminders, "stripSystemReminders");
|
|
656
|
+
function mediaFor(turn, name) {
|
|
657
|
+
let media = turn.media.get(name);
|
|
658
|
+
if (!media) {
|
|
659
|
+
media = { name, disclosures: [], transcripts: [] };
|
|
660
|
+
turn.media.set(name, media);
|
|
661
|
+
}
|
|
662
|
+
return media;
|
|
663
|
+
}
|
|
664
|
+
__name(mediaFor, "mediaFor");
|
|
665
|
+
function consumeAnnotationPart(turn, text, isHarnessAnnotation) {
|
|
666
|
+
if (text.startsWith(OMNI_RESOURCE_HANDLE_TEXT_PREFIX)) {
|
|
667
|
+
const resourceId = parseResourceHandleText(text);
|
|
668
|
+
if (resourceId) {
|
|
669
|
+
const body = text.slice(OMNI_RESOURCE_HANDLE_TEXT_PREFIX.length);
|
|
670
|
+
const name = unescapeAnnotationName(
|
|
671
|
+
body.slice(0, body.length - resourceId.length - 1)
|
|
672
|
+
);
|
|
673
|
+
mediaFor(turn, name).resourceId = resourceId;
|
|
674
|
+
return true;
|
|
675
|
+
}
|
|
676
|
+
return false;
|
|
677
|
+
}
|
|
678
|
+
if (text.startsWith(OMNI_RESOURCE_PATH_TEXT_PREFIX)) {
|
|
679
|
+
if (!isHarnessAnnotation) return false;
|
|
680
|
+
const filePath = parseResourcePathText(text);
|
|
681
|
+
if (filePath) {
|
|
682
|
+
mediaFor(turn, filePath.split(/[\\/]/).pop() ?? filePath);
|
|
683
|
+
return true;
|
|
684
|
+
}
|
|
685
|
+
return false;
|
|
686
|
+
}
|
|
687
|
+
for (const [prefix, apply] of [
|
|
688
|
+
[
|
|
689
|
+
OMNI_DISCLOSURE_TEXT_PREFIX,
|
|
690
|
+
(m, payload) => {
|
|
691
|
+
m.disclosures.push(payload);
|
|
692
|
+
}
|
|
693
|
+
],
|
|
694
|
+
[
|
|
695
|
+
OMNI_OMISSION_TEXT_PREFIX,
|
|
696
|
+
(m, payload) => {
|
|
697
|
+
m.omitted = payload;
|
|
698
|
+
}
|
|
699
|
+
],
|
|
700
|
+
[
|
|
701
|
+
OMNI_TRANSCRIPT_TEXT_PREFIX,
|
|
702
|
+
(m, payload) => {
|
|
703
|
+
m.transcripts.push(payload);
|
|
704
|
+
}
|
|
705
|
+
]
|
|
706
|
+
]) {
|
|
707
|
+
if (!text.startsWith(prefix)) continue;
|
|
708
|
+
const split = splitAnnotationBody(text.slice(prefix.length));
|
|
709
|
+
if (!split) return false;
|
|
710
|
+
apply(mediaFor(turn, split.name), split.payload);
|
|
711
|
+
return true;
|
|
712
|
+
}
|
|
713
|
+
return false;
|
|
714
|
+
}
|
|
715
|
+
__name(consumeAnnotationPart, "consumeAnnotationPart");
|
|
716
|
+
function consumeRecordParts(turn, record, collectProse) {
|
|
717
|
+
const parts = (record.message?.parts ?? []).flatMap((part) => [
|
|
718
|
+
part,
|
|
719
|
+
...functionResponseOfPart(part)?.parts ?? []
|
|
720
|
+
]);
|
|
721
|
+
for (const part of parts) {
|
|
722
|
+
const raw = textOfPart(part);
|
|
723
|
+
if (raw === void 0) continue;
|
|
724
|
+
const withoutReminders = stripSystemReminders(raw);
|
|
725
|
+
const forAnnotation = withoutReminders.replace(/^\s+/, "");
|
|
726
|
+
if (consumeAnnotationPart(turn, forAnnotation, isHarnessAnnotationPart(part)))
|
|
727
|
+
continue;
|
|
728
|
+
const prose = withoutReminders.trim();
|
|
729
|
+
if (!prose) continue;
|
|
730
|
+
if (collectProse) turn.requestTexts.push(prose);
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
__name(consumeRecordParts, "consumeRecordParts");
|
|
734
|
+
function finishTurn(turn, sessionId) {
|
|
735
|
+
return {
|
|
736
|
+
kind: "turn",
|
|
737
|
+
sessionId,
|
|
738
|
+
turnIndex: turn.turnIndex,
|
|
739
|
+
...turn.timestamp !== void 0 ? { timestamp: turn.timestamp } : {},
|
|
740
|
+
request: {
|
|
741
|
+
text: turn.requestTexts.join("\n"),
|
|
742
|
+
media: [...turn.media.values()],
|
|
743
|
+
...turn.recall !== void 0 ? { recall: turn.recall } : {}
|
|
744
|
+
},
|
|
745
|
+
response: {
|
|
746
|
+
text: turn.responseTexts.join("\n"),
|
|
747
|
+
toolCalls: turn.toolCalls
|
|
748
|
+
}
|
|
749
|
+
};
|
|
750
|
+
}
|
|
751
|
+
__name(finishTurn, "finishTurn");
|
|
752
|
+
function activeChainRecords(records) {
|
|
753
|
+
const byUuid = /* @__PURE__ */ new Map();
|
|
754
|
+
for (const record of records) {
|
|
755
|
+
if (typeof record.uuid === "string") byUuid.set(record.uuid, record);
|
|
756
|
+
}
|
|
757
|
+
if (byUuid.size === 0) return records;
|
|
758
|
+
let leaf;
|
|
759
|
+
for (let i = records.length - 1; i >= 0; i--) {
|
|
760
|
+
if (typeof records[i].uuid === "string") {
|
|
761
|
+
leaf = records[i];
|
|
762
|
+
break;
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
if (!leaf) return records;
|
|
766
|
+
const active = /* @__PURE__ */ new Set();
|
|
767
|
+
let current = leaf;
|
|
768
|
+
while (current?.uuid && !active.has(current.uuid)) {
|
|
769
|
+
active.add(current.uuid);
|
|
770
|
+
current = typeof current.parentUuid === "string" ? byUuid.get(current.parentUuid) : void 0;
|
|
771
|
+
}
|
|
772
|
+
return records.filter(
|
|
773
|
+
(r) => typeof r.uuid !== "string" || active.has(r.uuid)
|
|
774
|
+
);
|
|
775
|
+
}
|
|
776
|
+
__name(activeChainRecords, "activeChainRecords");
|
|
777
|
+
function buildTurnRecords(transcriptLines) {
|
|
778
|
+
const turns = [];
|
|
779
|
+
let sessionId = "";
|
|
780
|
+
let current;
|
|
781
|
+
for (const record of activeChainRecords(transcriptLines)) {
|
|
782
|
+
if (typeof record.sessionId === "string" && sessionId === "") {
|
|
783
|
+
sessionId = record.sessionId;
|
|
784
|
+
}
|
|
785
|
+
if (record.type === "user" && record.subtype === void 0) {
|
|
786
|
+
if (current) turns.push(finishTurn(current, sessionId));
|
|
787
|
+
current = {
|
|
788
|
+
turnIndex: turns.length,
|
|
789
|
+
...record.timestamp !== void 0 ? { timestamp: record.timestamp } : {},
|
|
790
|
+
requestTexts: [],
|
|
791
|
+
media: /* @__PURE__ */ new Map(),
|
|
792
|
+
responseTexts: [],
|
|
793
|
+
toolCalls: []
|
|
794
|
+
};
|
|
795
|
+
consumeRecordParts(current, record, true);
|
|
796
|
+
continue;
|
|
797
|
+
}
|
|
798
|
+
if (!current) continue;
|
|
799
|
+
if (record.type === "system" && record.subtype === "omni_recall") {
|
|
800
|
+
current.recall = record.systemPayload;
|
|
801
|
+
continue;
|
|
802
|
+
}
|
|
803
|
+
if (record.type === "tool_result") {
|
|
804
|
+
consumeRecordParts(current, record, false);
|
|
805
|
+
continue;
|
|
806
|
+
}
|
|
807
|
+
if (record.type === "assistant") {
|
|
808
|
+
for (const part of record.message?.parts ?? []) {
|
|
809
|
+
if (isThoughtPart(part)) continue;
|
|
810
|
+
const text = textOfPart(part);
|
|
811
|
+
if (text !== void 0 && text.trim()) {
|
|
812
|
+
current.responseTexts.push(text);
|
|
813
|
+
continue;
|
|
814
|
+
}
|
|
815
|
+
const call = functionCallOfPart(part);
|
|
816
|
+
if (call) current.toolCalls.push(call);
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
if (current) turns.push(finishTurn(current, sessionId));
|
|
821
|
+
return turns;
|
|
822
|
+
}
|
|
823
|
+
__name(buildTurnRecords, "buildTurnRecords");
|
|
824
|
+
async function readSnapshotRaw(omniRootDir) {
|
|
825
|
+
const filePath = path3.join(omniRootDir, "memory.json");
|
|
826
|
+
let raw;
|
|
827
|
+
try {
|
|
828
|
+
raw = await fs3.readFile(filePath, "utf8");
|
|
829
|
+
} catch {
|
|
830
|
+
return void 0;
|
|
831
|
+
}
|
|
832
|
+
try {
|
|
833
|
+
const parsed = JSON.parse(raw);
|
|
834
|
+
if (typeof parsed !== "object" || parsed === null || [parsed.files, parsed.versions, parsed.executions, parsed.entries].some(
|
|
835
|
+
(c) => typeof c !== "object" || c === null || Array.isArray(c)
|
|
836
|
+
)) {
|
|
837
|
+
throw new Error("unexpected snapshot shape");
|
|
838
|
+
}
|
|
839
|
+
return parsed;
|
|
840
|
+
} catch (err) {
|
|
841
|
+
debugLogger3.debug(
|
|
842
|
+
`trajectory export: memory unreadable, exporting transcript only: ${err instanceof Error ? err.message : err}`
|
|
843
|
+
);
|
|
844
|
+
return void 0;
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
__name(readSnapshotRaw, "readSnapshotRaw");
|
|
848
|
+
function buildMemoryRecords(snapshot) {
|
|
849
|
+
const files = [];
|
|
850
|
+
const executions = [];
|
|
851
|
+
for (const version of Object.values(snapshot.versions)) {
|
|
852
|
+
try {
|
|
853
|
+
const file = snapshot.files[version.fileId];
|
|
854
|
+
if (!file) continue;
|
|
855
|
+
files.push({
|
|
856
|
+
kind: "file",
|
|
857
|
+
fileId: version.fileId,
|
|
858
|
+
fileVersionId: version.fileVersionId,
|
|
859
|
+
rootFileId: file.rootFileId,
|
|
860
|
+
sha256: version.sha256,
|
|
861
|
+
mediaType: version.mediaType,
|
|
862
|
+
origin: file.origin,
|
|
863
|
+
sizeBytes: version.sizeBytes,
|
|
864
|
+
mimeType: version.mimeType,
|
|
865
|
+
source: version.source,
|
|
866
|
+
...version.producedByExecutionId !== void 0 ? { producedByExecutionId: version.producedByExecutionId } : {},
|
|
867
|
+
...version.parentVersionId !== void 0 ? { parentVersionId: version.parentVersionId } : {},
|
|
868
|
+
createdAt: version.createdAt
|
|
869
|
+
});
|
|
870
|
+
} catch {
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
for (const execution of Object.values(snapshot.executions)) {
|
|
874
|
+
try {
|
|
875
|
+
const outputs = execution.outputRefs.flatMap((entryId) => {
|
|
876
|
+
const entry = snapshot.entries[entryId];
|
|
877
|
+
if (!entry) return [];
|
|
878
|
+
return [
|
|
879
|
+
{
|
|
880
|
+
kind: entry.kind,
|
|
881
|
+
...entry.role !== void 0 ? { role: entry.role } : {},
|
|
882
|
+
...entry.artifactRef?.managedId?.startsWith("sha256/") ? { sha256: entry.artifactRef.managedId.slice("sha256/".length) } : {},
|
|
883
|
+
...entry.artifactRef?.mimeType !== void 0 ? { mimeType: entry.artifactRef.mimeType } : {},
|
|
884
|
+
...entry.artifactRef?.sizeBytes !== void 0 ? { sizeBytes: entry.artifactRef.sizeBytes } : {},
|
|
885
|
+
...entry.disclosure !== void 0 ? { disclosure: entry.disclosure } : {}
|
|
886
|
+
}
|
|
887
|
+
];
|
|
888
|
+
});
|
|
889
|
+
executions.push({
|
|
890
|
+
kind: "execution",
|
|
891
|
+
executionId: execution.executionId,
|
|
892
|
+
invocationId: execution.invocationId,
|
|
893
|
+
executionOrigin: execution.executionOrigin,
|
|
894
|
+
toolName: execution.toolName,
|
|
895
|
+
...execution.toolVersion !== void 0 ? { toolVersion: execution.toolVersion } : {},
|
|
896
|
+
finalArguments: execution.finalArguments,
|
|
897
|
+
omniConfigHash: execution.omniConfigHash,
|
|
898
|
+
sourceVersionId: execution.sourceVersionId,
|
|
899
|
+
rootFileId: execution.rootFileId,
|
|
900
|
+
startedAt: execution.startedAt,
|
|
901
|
+
completedAt: execution.completedAt,
|
|
902
|
+
...execution.reusedExecutionId !== void 0 ? { reusedExecutionId: execution.reusedExecutionId } : {},
|
|
903
|
+
outputs
|
|
904
|
+
});
|
|
905
|
+
} catch {
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
return { files, executions };
|
|
909
|
+
}
|
|
910
|
+
__name(buildMemoryRecords, "buildMemoryRecords");
|
|
911
|
+
function filterToSession(memory, turns, transcriptLines) {
|
|
912
|
+
const callIds = /* @__PURE__ */ new Set();
|
|
913
|
+
for (const record of activeChainRecords(transcriptLines)) {
|
|
914
|
+
if (record.type !== "tool_result") continue;
|
|
915
|
+
for (const part of record.message?.parts ?? []) {
|
|
916
|
+
const id = functionResponseOfPart(part)?.id;
|
|
917
|
+
if (typeof id === "string") callIds.add(id);
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
const mediaNames = /* @__PURE__ */ new Set();
|
|
921
|
+
for (const turn of turns) {
|
|
922
|
+
for (const call of turn.response.toolCalls) {
|
|
923
|
+
if (call.callId) callIds.add(call.callId);
|
|
924
|
+
}
|
|
925
|
+
for (const media of turn.request.media) mediaNames.add(media.name);
|
|
926
|
+
}
|
|
927
|
+
const filesByVersion = new Map(memory.files.map((f) => [f.fileVersionId, f]));
|
|
928
|
+
const versionsByFile = /* @__PURE__ */ new Map();
|
|
929
|
+
for (const f of memory.files) {
|
|
930
|
+
const list = versionsByFile.get(f.fileId) ?? [];
|
|
931
|
+
list.push(f);
|
|
932
|
+
versionsByFile.set(f.fileId, list);
|
|
933
|
+
}
|
|
934
|
+
const includedFiles = /* @__PURE__ */ new Set();
|
|
935
|
+
const includedExecutions = /* @__PURE__ */ new Set();
|
|
936
|
+
const includeFile = /* @__PURE__ */ __name((fileId) => {
|
|
937
|
+
if (!fileId || includedFiles.has(fileId)) return false;
|
|
938
|
+
if (!versionsByFile.has(fileId)) return false;
|
|
939
|
+
includedFiles.add(fileId);
|
|
940
|
+
return true;
|
|
941
|
+
}, "includeFile");
|
|
942
|
+
for (const f of memory.files) {
|
|
943
|
+
if (mediaNames.has(f.source.locator)) includeFile(f.fileId);
|
|
944
|
+
}
|
|
945
|
+
for (const e of memory.executions) {
|
|
946
|
+
if (callIds.has(e.invocationId)) includedExecutions.add(e.executionId);
|
|
947
|
+
}
|
|
948
|
+
let changed = true;
|
|
949
|
+
while (changed) {
|
|
950
|
+
changed = false;
|
|
951
|
+
for (const e of memory.executions) {
|
|
952
|
+
const sourceFile = filesByVersion.get(e.sourceVersionId)?.fileId;
|
|
953
|
+
if (!includedExecutions.has(e.executionId)) {
|
|
954
|
+
if (sourceFile && includedFiles.has(sourceFile)) {
|
|
955
|
+
includedExecutions.add(e.executionId);
|
|
956
|
+
changed = true;
|
|
957
|
+
} else {
|
|
958
|
+
continue;
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
if (includeFile(sourceFile)) changed = true;
|
|
962
|
+
}
|
|
963
|
+
for (const f of memory.files) {
|
|
964
|
+
if (includedFiles.has(f.fileId)) continue;
|
|
965
|
+
if (f.producedByExecutionId !== void 0 && includedExecutions.has(f.producedByExecutionId)) {
|
|
966
|
+
includeFile(f.fileId);
|
|
967
|
+
changed = true;
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
return {
|
|
972
|
+
files: memory.files.filter((f) => includedFiles.has(f.fileId)),
|
|
973
|
+
executions: memory.executions.filter(
|
|
974
|
+
(e) => includedExecutions.has(e.executionId)
|
|
975
|
+
)
|
|
976
|
+
};
|
|
977
|
+
}
|
|
978
|
+
__name(filterToSession, "filterToSession");
|
|
979
|
+
async function exportOmniTrajectory(options) {
|
|
980
|
+
const raw = await fs3.readFile(options.transcriptPath, "utf8");
|
|
981
|
+
const transcriptLines = [];
|
|
982
|
+
for (const line of raw.split("\n")) {
|
|
983
|
+
if (!line.trim()) continue;
|
|
984
|
+
try {
|
|
985
|
+
transcriptLines.push(JSON.parse(line));
|
|
986
|
+
} catch {
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
const turns = buildTurnRecords(transcriptLines);
|
|
990
|
+
const records = [...turns];
|
|
991
|
+
const snapshot = await readSnapshotRaw(options.omniRootDir);
|
|
992
|
+
const memoryRecords = snapshot ? filterToSession(buildMemoryRecords(snapshot), turns, transcriptLines) : { files: [], executions: [] };
|
|
993
|
+
records.push(
|
|
994
|
+
...memoryRecords.files.sort(
|
|
995
|
+
(a, b) => a.fileVersionId.localeCompare(b.fileVersionId)
|
|
996
|
+
),
|
|
997
|
+
...memoryRecords.executions.sort(
|
|
998
|
+
(a, b) => a.executionId.localeCompare(b.executionId)
|
|
999
|
+
)
|
|
1000
|
+
);
|
|
1001
|
+
return records;
|
|
1002
|
+
}
|
|
1003
|
+
__name(exportOmniTrajectory, "exportOmniTrajectory");
|
|
1004
|
+
function serializeOmniTrajectory(records) {
|
|
1005
|
+
return records.map((r) => JSON.stringify(r)).join("\n") + "\n";
|
|
1006
|
+
}
|
|
1007
|
+
__name(serializeOmniTrajectory, "serializeOmniTrajectory");
|
|
1008
|
+
async function writeOmniTrajectoryJsonl(options) {
|
|
1009
|
+
const outPath = path3.resolve(options.outPath);
|
|
1010
|
+
if (outPath === path3.resolve(options.transcriptPath)) {
|
|
1011
|
+
throw new Error("trajectory outPath must differ from the transcript path");
|
|
1012
|
+
}
|
|
1013
|
+
const records = await exportOmniTrajectory(options);
|
|
1014
|
+
await fs3.mkdir(path3.dirname(outPath), { recursive: true });
|
|
1015
|
+
await fs3.writeFile(outPath, serializeOmniTrajectory(records), "utf8");
|
|
1016
|
+
return { records: records.length };
|
|
1017
|
+
}
|
|
1018
|
+
__name(writeOmniTrajectoryJsonl, "writeOmniTrajectoryJsonl");
|
|
1019
|
+
|
|
1020
|
+
// packages/core/src/omni/index.ts
|
|
1021
|
+
var debugLogger4 = createDebugLogger("omni");
|
|
1022
|
+
function sanitizeErrorMessage(err, knownPaths = []) {
|
|
1023
|
+
let msg = err instanceof Error ? err.message : String(err);
|
|
1024
|
+
for (const known of knownPaths) {
|
|
1025
|
+
if (known) msg = msg.split(known).join(path4.basename(known));
|
|
1026
|
+
}
|
|
1027
|
+
return msg.replace(/(?:\/[^/\s'"]+)+\/([^/\s'"]+)/g, "$1").replace(/(?:[A-Za-z]:)?(?:\\[^\\\s'"]+)+\\([^\\\s'"]+)/g, "$1");
|
|
1028
|
+
}
|
|
1029
|
+
__name(sanitizeErrorMessage, "sanitizeErrorMessage");
|
|
1030
|
+
function buildAdditionalMediaParts(displayName, additionalMedia) {
|
|
1031
|
+
const parts = [];
|
|
1032
|
+
for (const extra of additionalMedia ?? []) {
|
|
1033
|
+
if (extra.disclosure) {
|
|
1034
|
+
parts.push({ text: formatDisclosureText(displayName, extra.disclosure) });
|
|
1035
|
+
}
|
|
1036
|
+
if (extra.omission) {
|
|
1037
|
+
parts.push({
|
|
1038
|
+
text: formatOmissionText(displayName, extra.omission.reason)
|
|
1039
|
+
});
|
|
1040
|
+
} else {
|
|
1041
|
+
parts.push({
|
|
1042
|
+
fileData: {
|
|
1043
|
+
fileUri: extra.fileUri,
|
|
1044
|
+
mimeType: extra.mimeType,
|
|
1045
|
+
displayName
|
|
1046
|
+
}
|
|
1047
|
+
});
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1050
|
+
return parts;
|
|
1051
|
+
}
|
|
1052
|
+
__name(buildAdditionalMediaParts, "buildAdditionalMediaParts");
|
|
1053
|
+
function buildTranscriptParts(displayName, transcripts) {
|
|
1054
|
+
const parts = [];
|
|
1055
|
+
for (const t of transcripts ?? []) {
|
|
1056
|
+
if (t.disclosure) {
|
|
1057
|
+
parts.push({ text: formatDisclosureText(displayName, t.disclosure) });
|
|
1058
|
+
}
|
|
1059
|
+
parts.push({ text: formatTranscriptText(displayName, t.text) });
|
|
1060
|
+
}
|
|
1061
|
+
return parts;
|
|
1062
|
+
}
|
|
1063
|
+
__name(buildTranscriptParts, "buildTranscriptParts");
|
|
1064
|
+
var OmniDeliveryError = class extends Error {
|
|
1065
|
+
static {
|
|
1066
|
+
__name(this, "OmniDeliveryError");
|
|
1067
|
+
}
|
|
1068
|
+
constructor(message, options) {
|
|
1069
|
+
super(message, options);
|
|
1070
|
+
this.name = "OmniDeliveryError";
|
|
1071
|
+
}
|
|
1072
|
+
};
|
|
1073
|
+
function evaluateTransportLimits(config, recognized, displayName) {
|
|
1074
|
+
try {
|
|
1075
|
+
assertWithinByteLimit(config, recognized.sizeBytes, displayName);
|
|
1076
|
+
assertWithinDurationLimit(config, recognized, displayName);
|
|
1077
|
+
return {
|
|
1078
|
+
estimate: assertWithinTokenLimit(config, recognized, displayName)
|
|
1079
|
+
};
|
|
1080
|
+
} catch (err) {
|
|
1081
|
+
if (err instanceof OmniTransportGuardError) {
|
|
1082
|
+
return {
|
|
1083
|
+
estimate: estimateRawResourceTokens(recognized),
|
|
1084
|
+
violation: err.message
|
|
1085
|
+
};
|
|
1086
|
+
}
|
|
1087
|
+
throw err;
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1090
|
+
__name(evaluateTransportLimits, "evaluateTransportLimits");
|
|
1091
|
+
async function processMediaForOmniDelivery(filePath, config, options) {
|
|
1092
|
+
const { expectedModality, signal } = options ?? {};
|
|
1093
|
+
const displayName = options?.displayName ?? path4.basename(filePath);
|
|
1094
|
+
const [ffmpeg, ffprobe] = await Promise.all([
|
|
1095
|
+
isFfmpegAvailable(),
|
|
1096
|
+
isFfprobeAvailable()
|
|
1097
|
+
]);
|
|
1098
|
+
if (!ffmpeg || !ffprobe) {
|
|
1099
|
+
throw new OmniDeliveryError(
|
|
1100
|
+
"ffmpeg/ffprobe not available; omni media delivery requires both on PATH."
|
|
1101
|
+
);
|
|
1102
|
+
}
|
|
1103
|
+
await fs4.stat(filePath).catch((err) => {
|
|
1104
|
+
throw new OmniDeliveryError(
|
|
1105
|
+
`Cannot stat media file ${displayName}: ${sanitizeErrorMessage(err, [filePath])}`,
|
|
1106
|
+
{ cause: err }
|
|
1107
|
+
);
|
|
1108
|
+
});
|
|
1109
|
+
let recognized;
|
|
1110
|
+
try {
|
|
1111
|
+
recognized = await recognizeMediaFile(filePath, {
|
|
1112
|
+
expectedModality,
|
|
1113
|
+
signal
|
|
1114
|
+
});
|
|
1115
|
+
} catch (err) {
|
|
1116
|
+
if (signal?.aborted) throw err;
|
|
1117
|
+
throw new OmniDeliveryError(
|
|
1118
|
+
`Media recognition failed for ${displayName}: ${sanitizeErrorMessage(err, [filePath])}`,
|
|
1119
|
+
{ cause: err }
|
|
1120
|
+
);
|
|
1121
|
+
}
|
|
1122
|
+
const store = new OmniObjectStore(config.storage.getQwenDir());
|
|
1123
|
+
const uploadConfig = requireEffectiveOmniUploadConfig(config);
|
|
1124
|
+
const cacheScope = createHash("sha256").update(`${uploadConfig.baseUrl}|${uploadConfig.apiKey}`).digest("hex").slice(0, 16);
|
|
1125
|
+
const configuredTtl = config.getOmniUploadUrlTtlHours?.();
|
|
1126
|
+
const uploadCache = new OmniUploadCache(
|
|
1127
|
+
store.getOmniRootDir(),
|
|
1128
|
+
configuredTtl === void 0 ? DEFAULT_UPLOAD_CACHE_TTL_HOURS : configuredTtl,
|
|
1129
|
+
cacheScope
|
|
1130
|
+
);
|
|
1131
|
+
await runStartupRecoveryOnce(store, uploadCache, {
|
|
1132
|
+
quarantineRetentionDays: config.getOmniQuarantineRetentionDays?.(),
|
|
1133
|
+
quarantineMaxBytes: config.getOmniQuarantineMaxBytes?.(),
|
|
1134
|
+
// Corrupt-object deletion must also invalidate degradation-cache
|
|
1135
|
+
// entries (as source or derivative) — otherwise policy-cache.json
|
|
1136
|
+
// accumulates orphans that can never be served again.
|
|
1137
|
+
degradationCache: new OmniDegradationCache(store.getOmniRootDir())
|
|
1138
|
+
});
|
|
1139
|
+
const processingConfig = config.getOmniProcessingConfig?.();
|
|
1140
|
+
const conditionContext = processingConfig ? {
|
|
1141
|
+
session: buildSessionConditionNamespace(
|
|
1142
|
+
config,
|
|
1143
|
+
processingConfig.limits.reservedOutputTokens
|
|
1144
|
+
)
|
|
1145
|
+
} : void 0;
|
|
1146
|
+
const memoryConfig = config.getOmniMemoryConfig?.();
|
|
1147
|
+
const memoryService = memoryConfig ? new MediaMemoryService(store.getOmniRootDir(), {
|
|
1148
|
+
maxInlineTextBytes: memoryConfig.collection.maxInlineTextBytes
|
|
1149
|
+
}) : void 0;
|
|
1150
|
+
if (memoryService) {
|
|
1151
|
+
void runOmniGcOnce({
|
|
1152
|
+
store,
|
|
1153
|
+
memoryService,
|
|
1154
|
+
registry: config.getOmniMediaResourceRegistry?.(),
|
|
1155
|
+
uploadCache,
|
|
1156
|
+
degradationCache: new OmniDegradationCache(store.getOmniRootDir()),
|
|
1157
|
+
retentionDays: config.getOmniStorageRetentionDays?.() ?? 14,
|
|
1158
|
+
// Floor-clamped: a budget below 10× the single-media limit cannot
|
|
1159
|
+
// hold normal artifacts and would read as permanent suspension.
|
|
1160
|
+
maxTotalBytes: typeof config.getOmniStorageMaxTotalBytes === "function" ? effectiveOmniStorageMaxTotalBytes(config) : 20 * 1024 * 1024 * 1024
|
|
1161
|
+
});
|
|
1162
|
+
}
|
|
1163
|
+
const registry = memoryService ? config.getOmniMediaResourceRegistry?.() : void 0;
|
|
1164
|
+
const bindSessionResource = /* @__PURE__ */ __name((item, fileRefOverride) => registry && item.memoryBinding ? registry.bind({
|
|
1165
|
+
...item.memoryBinding,
|
|
1166
|
+
fileRef: fileRefOverride ?? item.filePath,
|
|
1167
|
+
mediaType: item.recognized.modality
|
|
1168
|
+
}) : void 0, "bindSessionResource");
|
|
1169
|
+
let sourceSha256;
|
|
1170
|
+
let sourceBinding;
|
|
1171
|
+
let sourceFileRef = filePath;
|
|
1172
|
+
if (memoryService) {
|
|
1173
|
+
try {
|
|
1174
|
+
sourceSha256 = await hashFileSha256(filePath, signal);
|
|
1175
|
+
} catch (err) {
|
|
1176
|
+
if (signal?.aborted) throw err;
|
|
1177
|
+
debugLogger4.debug(
|
|
1178
|
+
`omni memory: hashing ${displayName} failed, skipping collection: ${sanitizeErrorMessage(err, [filePath])}`
|
|
1179
|
+
);
|
|
1180
|
+
}
|
|
1181
|
+
if (sourceSha256) {
|
|
1182
|
+
const origin = options?.origin ?? "user";
|
|
1183
|
+
const ephemeralSource = origin === "tool" || options?.sourceUrl !== void 0;
|
|
1184
|
+
sourceFileRef = ephemeralSource ? store.objectPathFor(
|
|
1185
|
+
sourceSha256,
|
|
1186
|
+
extensionForMime(recognized.detectedMimeType)
|
|
1187
|
+
) : filePath;
|
|
1188
|
+
sourceBinding = await memoryService.recordFileRecognized({
|
|
1189
|
+
fileRef: sourceFileRef,
|
|
1190
|
+
sha256: sourceSha256,
|
|
1191
|
+
mediaType: recognized.modality,
|
|
1192
|
+
metadata: recognized.metadata,
|
|
1193
|
+
sizeBytes: recognized.sizeBytes,
|
|
1194
|
+
mimeType: recognized.detectedMimeType,
|
|
1195
|
+
origin,
|
|
1196
|
+
source: options?.sourceUrl !== void 0 ? { protocol: "url", locator: options.sourceUrl } : origin === "tool" ? { protocol: "managed", locator: `sha256/${sourceSha256}` } : { protocol: "local", locator: displayName },
|
|
1197
|
+
recognition: {
|
|
1198
|
+
ingestionConfigHash: "",
|
|
1199
|
+
detectorVersion: MEDIA_DETECTOR_VERSION,
|
|
1200
|
+
probeStatus: "complete"
|
|
1201
|
+
}
|
|
1202
|
+
});
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1205
|
+
let final = {
|
|
1206
|
+
filePath,
|
|
1207
|
+
recognized,
|
|
1208
|
+
sha256: sourceSha256,
|
|
1209
|
+
memoryBinding: sourceBinding
|
|
1210
|
+
};
|
|
1211
|
+
const sessionResourceId = bindSessionResource(
|
|
1212
|
+
final,
|
|
1213
|
+
sourceFileRef
|
|
1214
|
+
)?.resourceId;
|
|
1215
|
+
const guardRejection = /* @__PURE__ */ __name((message, options2) => {
|
|
1216
|
+
const err = new OmniTransportGuardError(message, options2);
|
|
1217
|
+
if (sessionResourceId !== void 0) {
|
|
1218
|
+
err.sessionResourceId = sessionResourceId;
|
|
1219
|
+
}
|
|
1220
|
+
return err;
|
|
1221
|
+
}, "guardRejection");
|
|
1222
|
+
let extraDeliveries = [];
|
|
1223
|
+
const transcripts = [];
|
|
1224
|
+
const collectTranscripts = /* @__PURE__ */ __name((files) => {
|
|
1225
|
+
for (const file of files) {
|
|
1226
|
+
transcripts.push({ text: file.text, disclosure: file.disclosure });
|
|
1227
|
+
}
|
|
1228
|
+
}, "collectTranscripts");
|
|
1229
|
+
const textOnlyDelivery = /* @__PURE__ */ __name((recognizedFinal, tokenEstimate2, extras) => ({
|
|
1230
|
+
fileUri: "",
|
|
1231
|
+
mimeType: recognizedFinal.detectedMimeType,
|
|
1232
|
+
sha256: "",
|
|
1233
|
+
recognized: recognizedFinal,
|
|
1234
|
+
tokenEstimate: tokenEstimate2,
|
|
1235
|
+
deduped: false,
|
|
1236
|
+
uploadCacheHit: false,
|
|
1237
|
+
degraded: true,
|
|
1238
|
+
transcripts,
|
|
1239
|
+
resourceId: sessionResourceId,
|
|
1240
|
+
...extras
|
|
1241
|
+
}), "textOnlyDelivery");
|
|
1242
|
+
const policies = processingConfig?.fixedPolicies ?? [];
|
|
1243
|
+
if (policies.length > 0) {
|
|
1244
|
+
let deliveries;
|
|
1245
|
+
let fileDeliveries;
|
|
1246
|
+
try {
|
|
1247
|
+
({ deliveries, fileDeliveries } = await runFixedPolicies(
|
|
1248
|
+
config,
|
|
1249
|
+
{
|
|
1250
|
+
filePath,
|
|
1251
|
+
recognized,
|
|
1252
|
+
displayName,
|
|
1253
|
+
origin: options?.origin ?? "user",
|
|
1254
|
+
sha256: sourceSha256
|
|
1255
|
+
},
|
|
1256
|
+
{
|
|
1257
|
+
store,
|
|
1258
|
+
policies,
|
|
1259
|
+
signal,
|
|
1260
|
+
limits: processingConfig?.limits,
|
|
1261
|
+
conditionContext,
|
|
1262
|
+
memory: memoryService ? { service: memoryService, sourceBinding } : void 0
|
|
1263
|
+
}
|
|
1264
|
+
));
|
|
1265
|
+
} catch (err) {
|
|
1266
|
+
if (signal?.aborted) throw err;
|
|
1267
|
+
throw new OmniDeliveryError(
|
|
1268
|
+
`Fixed-policy processing failed for ${displayName}: ${sanitizeErrorMessage(err, [filePath, store.getOmniRootDir()])}`,
|
|
1269
|
+
{ cause: err }
|
|
1270
|
+
);
|
|
1271
|
+
}
|
|
1272
|
+
collectTranscripts(fileDeliveries);
|
|
1273
|
+
if (deliveries.length === 0 && transcripts.length > 0) {
|
|
1274
|
+
return textOnlyDelivery(
|
|
1275
|
+
recognized,
|
|
1276
|
+
evaluateTransportLimits(config, recognized, displayName).estimate
|
|
1277
|
+
);
|
|
1278
|
+
}
|
|
1279
|
+
if (deliveries.length === 0) {
|
|
1280
|
+
throw new OmniDeliveryError(
|
|
1281
|
+
`Fixed policies produced 0 media deliverables for ${displayName}; exactly one is supported.`
|
|
1282
|
+
);
|
|
1283
|
+
}
|
|
1284
|
+
final = deliveries[0];
|
|
1285
|
+
extraDeliveries = deliveries.slice(1);
|
|
1286
|
+
for (const delivery of deliveries) bindSessionResource(delivery);
|
|
1287
|
+
}
|
|
1288
|
+
const uploadModel = uploadConfig.model;
|
|
1289
|
+
const uploadResource = /* @__PURE__ */ __name(async (item, estimate) => {
|
|
1290
|
+
let sha256;
|
|
1291
|
+
try {
|
|
1292
|
+
sha256 = item.sha256 ?? await hashFileSha256(item.filePath, signal);
|
|
1293
|
+
} catch (err) {
|
|
1294
|
+
if (signal?.aborted) throw err;
|
|
1295
|
+
throw new OmniDeliveryError(
|
|
1296
|
+
`Failed to hash media file ${displayName}: ${sanitizeErrorMessage(err, [item.filePath])}`,
|
|
1297
|
+
{ cause: err }
|
|
1298
|
+
);
|
|
1299
|
+
}
|
|
1300
|
+
const cachedUrl = await uploadCache.get(sha256, uploadModel);
|
|
1301
|
+
if (cachedUrl) {
|
|
1302
|
+
debugLogger4.debug(
|
|
1303
|
+
`omni upload cache hit: sha256=${sha256.slice(0, 12)}\u2026 model=${uploadModel}`
|
|
1304
|
+
);
|
|
1305
|
+
return {
|
|
1306
|
+
fileUri: cachedUrl,
|
|
1307
|
+
sha256,
|
|
1308
|
+
deduped: true,
|
|
1309
|
+
uploadCacheHit: true
|
|
1310
|
+
};
|
|
1311
|
+
}
|
|
1312
|
+
const extension = extensionForMime(item.recognized.detectedMimeType);
|
|
1313
|
+
let objectPath;
|
|
1314
|
+
let deduped;
|
|
1315
|
+
try {
|
|
1316
|
+
const put = await store.putFile(item.filePath, sha256, extension, signal);
|
|
1317
|
+
objectPath = put.objectPath;
|
|
1318
|
+
deduped = put.deduped;
|
|
1319
|
+
} catch (err) {
|
|
1320
|
+
if (signal?.aborted) throw err;
|
|
1321
|
+
throw new OmniDeliveryError(
|
|
1322
|
+
`Failed to store media in the omni object store: ${sanitizeErrorMessage(err, [item.filePath, store.getOmniRootDir()])}`,
|
|
1323
|
+
{ cause: err }
|
|
1324
|
+
);
|
|
1325
|
+
}
|
|
1326
|
+
const uploader = new DashScopeUploader({
|
|
1327
|
+
apiKey: uploadConfig.apiKey,
|
|
1328
|
+
baseUrl: uploadConfig.baseUrl
|
|
1329
|
+
});
|
|
1330
|
+
let fileUri;
|
|
1331
|
+
try {
|
|
1332
|
+
fileUri = await uploader.uploadFile({
|
|
1333
|
+
filePath: objectPath,
|
|
1334
|
+
model: uploadModel,
|
|
1335
|
+
mimeType: item.recognized.detectedMimeType,
|
|
1336
|
+
signal
|
|
1337
|
+
});
|
|
1338
|
+
} catch (err) {
|
|
1339
|
+
if (signal?.aborted) throw err;
|
|
1340
|
+
throw new OmniDeliveryError(
|
|
1341
|
+
sanitizeErrorMessage(err, [objectPath, store.getOmniRootDir()]),
|
|
1342
|
+
{ cause: err }
|
|
1343
|
+
);
|
|
1344
|
+
}
|
|
1345
|
+
debugLogger4.debug(
|
|
1346
|
+
`omni ${item.recognized.modality} delivered: sha256=${sha256.slice(0, 12)}\u2026 size=${item.recognized.sizeBytes} est=${estimate.estimatedTokenCount}(${estimate.status}) deduped=${deduped} degraded=${item.degraded === true} uri=${fileUri}`
|
|
1347
|
+
);
|
|
1348
|
+
await uploadCache.put(sha256, uploadModel, fileUri);
|
|
1349
|
+
return { fileUri, sha256, deduped, uploadCacheHit: false };
|
|
1350
|
+
}, "uploadResource");
|
|
1351
|
+
const processAdditionalMedia = /* @__PURE__ */ __name(async () => {
|
|
1352
|
+
if (extraDeliveries.length === 0) return void 0;
|
|
1353
|
+
return Promise.all(
|
|
1354
|
+
extraDeliveries.map(
|
|
1355
|
+
async (extra) => {
|
|
1356
|
+
const extraGuard = evaluateTransportLimits(
|
|
1357
|
+
config,
|
|
1358
|
+
extra.recognized,
|
|
1359
|
+
displayName
|
|
1360
|
+
);
|
|
1361
|
+
if (extraGuard.violation) {
|
|
1362
|
+
debugLogger4.debug(
|
|
1363
|
+
`omni additional ${extra.recognized.modality} explicitly omitted (transport guard): ${extraGuard.violation}`
|
|
1364
|
+
);
|
|
1365
|
+
return {
|
|
1366
|
+
fileUri: "",
|
|
1367
|
+
mimeType: extra.recognized.detectedMimeType,
|
|
1368
|
+
sha256: extra.sha256 ?? "",
|
|
1369
|
+
disclosure: extra.disclosure,
|
|
1370
|
+
omission: { reason: extraGuard.violation }
|
|
1371
|
+
};
|
|
1372
|
+
}
|
|
1373
|
+
const uploaded2 = await uploadResource(extra, extraGuard.estimate);
|
|
1374
|
+
return {
|
|
1375
|
+
fileUri: uploaded2.fileUri,
|
|
1376
|
+
mimeType: extra.recognized.detectedMimeType,
|
|
1377
|
+
sha256: uploaded2.sha256,
|
|
1378
|
+
disclosure: extra.disclosure
|
|
1379
|
+
};
|
|
1380
|
+
}
|
|
1381
|
+
)
|
|
1382
|
+
);
|
|
1383
|
+
}, "processAdditionalMedia");
|
|
1384
|
+
let guard = evaluateTransportLimits(config, final.recognized, displayName);
|
|
1385
|
+
if (guard.violation && processingConfig) {
|
|
1386
|
+
const maxPasses = processingConfig.limits.maxTransportPasses;
|
|
1387
|
+
for (let pass = 0; guard.violation && pass < maxPasses; pass++) {
|
|
1388
|
+
const guardPolicies = processingConfig.transportGuardPolicies.filter(
|
|
1389
|
+
(p) => p.mediaTypes.includes(final.recognized.modality)
|
|
1390
|
+
);
|
|
1391
|
+
if (guardPolicies.length === 0) break;
|
|
1392
|
+
let deliveries;
|
|
1393
|
+
let fileDeliveries;
|
|
1394
|
+
try {
|
|
1395
|
+
({ deliveries, fileDeliveries } = await runFixedPolicies(
|
|
1396
|
+
config,
|
|
1397
|
+
{
|
|
1398
|
+
filePath: final.filePath,
|
|
1399
|
+
recognized: final.recognized,
|
|
1400
|
+
displayName,
|
|
1401
|
+
origin: options?.origin ?? "user",
|
|
1402
|
+
sha256: final.sha256
|
|
1403
|
+
},
|
|
1404
|
+
{
|
|
1405
|
+
store,
|
|
1406
|
+
policies: guardPolicies,
|
|
1407
|
+
signal,
|
|
1408
|
+
limits: processingConfig.limits,
|
|
1409
|
+
conditionContext,
|
|
1410
|
+
// The guard pass derives FROM the current final resource, so
|
|
1411
|
+
// its memory lineage hangs off that resource's own binding
|
|
1412
|
+
// (a derivative's version when preprocessing degraded it).
|
|
1413
|
+
memory: memoryService ? { service: memoryService, sourceBinding: final.memoryBinding } : void 0
|
|
1414
|
+
}
|
|
1415
|
+
));
|
|
1416
|
+
} catch (err) {
|
|
1417
|
+
if (signal?.aborted) throw err;
|
|
1418
|
+
throw guardRejection(
|
|
1419
|
+
`Transport-guard processing failed for ${displayName}: ${sanitizeErrorMessage(err, [final.filePath, store.getOmniRootDir()])}`,
|
|
1420
|
+
{ cause: err }
|
|
1421
|
+
);
|
|
1422
|
+
}
|
|
1423
|
+
collectTranscripts(fileDeliveries);
|
|
1424
|
+
if (deliveries.length === 0 && fileDeliveries.length > 0) {
|
|
1425
|
+
return textOnlyDelivery(final.recognized, guard.estimate, {
|
|
1426
|
+
disclosure: final.disclosure,
|
|
1427
|
+
additionalMedia: await processAdditionalMedia()
|
|
1428
|
+
});
|
|
1429
|
+
}
|
|
1430
|
+
if (deliveries.length !== 1) {
|
|
1431
|
+
throw guardRejection(
|
|
1432
|
+
`Transport-guard policies produced ${deliveries.length} media deliverables for ${displayName}; exactly one is supported.`
|
|
1433
|
+
);
|
|
1434
|
+
}
|
|
1435
|
+
if (deliveries[0].filePath === final.filePath) {
|
|
1436
|
+
break;
|
|
1437
|
+
}
|
|
1438
|
+
const priorDisclosure = final.disclosure;
|
|
1439
|
+
final = deliveries[0];
|
|
1440
|
+
if (priorDisclosure && final.disclosure) {
|
|
1441
|
+
final = {
|
|
1442
|
+
...final,
|
|
1443
|
+
disclosure: `${priorDisclosure}\uFF1B${final.disclosure}`
|
|
1444
|
+
};
|
|
1445
|
+
} else if (priorDisclosure) {
|
|
1446
|
+
final = { ...final, disclosure: priorDisclosure };
|
|
1447
|
+
}
|
|
1448
|
+
bindSessionResource(final);
|
|
1449
|
+
guard = evaluateTransportLimits(config, final.recognized, displayName);
|
|
1450
|
+
}
|
|
1451
|
+
}
|
|
1452
|
+
if (guard.violation) {
|
|
1453
|
+
if (!processingConfig) {
|
|
1454
|
+
throw guardRejection(guard.violation);
|
|
1455
|
+
}
|
|
1456
|
+
debugLogger4.debug(
|
|
1457
|
+
`omni ${final.recognized.modality} explicitly omitted (transport guard): ${guard.violation}`
|
|
1458
|
+
);
|
|
1459
|
+
return {
|
|
1460
|
+
fileUri: "",
|
|
1461
|
+
mimeType: final.recognized.detectedMimeType,
|
|
1462
|
+
sha256: final.sha256 ?? "",
|
|
1463
|
+
recognized: final.recognized,
|
|
1464
|
+
tokenEstimate: guard.estimate,
|
|
1465
|
+
deduped: false,
|
|
1466
|
+
uploadCacheHit: false,
|
|
1467
|
+
disclosure: final.disclosure,
|
|
1468
|
+
degraded: final.degraded,
|
|
1469
|
+
omission: { reason: guard.violation },
|
|
1470
|
+
transcripts: transcripts.length > 0 ? transcripts : void 0,
|
|
1471
|
+
additionalMedia: await processAdditionalMedia(),
|
|
1472
|
+
resourceId: sessionResourceId
|
|
1473
|
+
};
|
|
1474
|
+
}
|
|
1475
|
+
const tokenEstimate = guard.estimate;
|
|
1476
|
+
const uploaded = await uploadResource(final, tokenEstimate);
|
|
1477
|
+
return {
|
|
1478
|
+
fileUri: uploaded.fileUri,
|
|
1479
|
+
mimeType: final.recognized.detectedMimeType,
|
|
1480
|
+
sha256: uploaded.sha256,
|
|
1481
|
+
recognized: final.recognized,
|
|
1482
|
+
tokenEstimate,
|
|
1483
|
+
deduped: uploaded.deduped,
|
|
1484
|
+
uploadCacheHit: uploaded.uploadCacheHit,
|
|
1485
|
+
disclosure: final.disclosure,
|
|
1486
|
+
degraded: final.degraded,
|
|
1487
|
+
transcripts: transcripts.length > 0 ? transcripts : void 0,
|
|
1488
|
+
additionalMedia: await processAdditionalMedia(),
|
|
1489
|
+
resourceId: sessionResourceId
|
|
1490
|
+
};
|
|
1491
|
+
}
|
|
1492
|
+
__name(processMediaForOmniDelivery, "processMediaForOmniDelivery");
|
|
1493
|
+
async function readMediaViaOmniDelivery(params) {
|
|
1494
|
+
const {
|
|
1495
|
+
filePath,
|
|
1496
|
+
config,
|
|
1497
|
+
displayName,
|
|
1498
|
+
relativePathForDisplay,
|
|
1499
|
+
expectedModality,
|
|
1500
|
+
signal
|
|
1501
|
+
} = params;
|
|
1502
|
+
try {
|
|
1503
|
+
const delivery = await processMediaForOmniDelivery(filePath, config, {
|
|
1504
|
+
expectedModality,
|
|
1505
|
+
signal
|
|
1506
|
+
});
|
|
1507
|
+
const transcriptParts = buildTranscriptParts(
|
|
1508
|
+
displayName,
|
|
1509
|
+
delivery.transcripts
|
|
1510
|
+
);
|
|
1511
|
+
const additionalParts = buildAdditionalMediaParts(
|
|
1512
|
+
displayName,
|
|
1513
|
+
delivery.additionalMedia
|
|
1514
|
+
);
|
|
1515
|
+
const handleParts = (() => {
|
|
1516
|
+
if (!delivery.resourceId) return [];
|
|
1517
|
+
const binding = config.getOmniMediaResourceRegistry?.()?.resolve(delivery.resourceId);
|
|
1518
|
+
if (binding && binding.fileRef === filePath && !/[\r\n]/.test(filePath)) {
|
|
1519
|
+
return [harnessPathAnnotationPart(filePath)];
|
|
1520
|
+
}
|
|
1521
|
+
return [
|
|
1522
|
+
{ text: formatResourceHandleText(displayName, delivery.resourceId) }
|
|
1523
|
+
];
|
|
1524
|
+
})();
|
|
1525
|
+
if (delivery.omission) {
|
|
1526
|
+
const omissionPart = {
|
|
1527
|
+
text: formatOmissionText(displayName, delivery.omission.reason)
|
|
1528
|
+
};
|
|
1529
|
+
return {
|
|
1530
|
+
llmContent: transcriptParts.length > 0 || additionalParts.length > 0 || handleParts.length > 0 ? [
|
|
1531
|
+
...handleParts,
|
|
1532
|
+
omissionPart,
|
|
1533
|
+
...additionalParts,
|
|
1534
|
+
...transcriptParts
|
|
1535
|
+
] : omissionPart.text,
|
|
1536
|
+
returnDisplay: `Media omitted by the omni transport guard: ${relativePathForDisplay}`,
|
|
1537
|
+
tokenEstimate: delivery.tokenEstimate
|
|
1538
|
+
};
|
|
1539
|
+
}
|
|
1540
|
+
if (!delivery.fileUri && transcriptParts.length > 0) {
|
|
1541
|
+
const disclosureParts = delivery.disclosure ? [{ text: formatDisclosureText(displayName, delivery.disclosure) }] : [];
|
|
1542
|
+
return {
|
|
1543
|
+
llmContent: [
|
|
1544
|
+
...handleParts,
|
|
1545
|
+
...disclosureParts,
|
|
1546
|
+
...additionalParts,
|
|
1547
|
+
...transcriptParts
|
|
1548
|
+
],
|
|
1549
|
+
returnDisplay: `Read ${delivery.recognized.modality} as transcript (omni policy): ${relativePathForDisplay}`,
|
|
1550
|
+
tokenEstimate: delivery.tokenEstimate
|
|
1551
|
+
};
|
|
1552
|
+
}
|
|
1553
|
+
const fileDataPart = {
|
|
1554
|
+
fileData: {
|
|
1555
|
+
fileUri: delivery.fileUri,
|
|
1556
|
+
mimeType: delivery.mimeType,
|
|
1557
|
+
displayName
|
|
1558
|
+
}
|
|
1559
|
+
};
|
|
1560
|
+
const parts = [
|
|
1561
|
+
...handleParts
|
|
1562
|
+
];
|
|
1563
|
+
const { width, height } = delivery.recognized.metadata;
|
|
1564
|
+
if (delivery.recognized.modality === "image" && width !== void 0 && height !== void 0) {
|
|
1565
|
+
parts.push({
|
|
1566
|
+
text: delivery.disclosure ? `Image ${displayName}: delivered at ${width}x${height} px after degradation. Use zoom_image to inspect details \u2014 it reads the original file.` : `Image ${displayName}: full resolution ${width}x${height} px. Use zoom_image for a closer look at details.`
|
|
1567
|
+
});
|
|
1568
|
+
}
|
|
1569
|
+
if (delivery.disclosure) {
|
|
1570
|
+
parts.push({
|
|
1571
|
+
text: formatDisclosureText(displayName, delivery.disclosure)
|
|
1572
|
+
});
|
|
1573
|
+
}
|
|
1574
|
+
parts.push(fileDataPart);
|
|
1575
|
+
parts.push(...additionalParts);
|
|
1576
|
+
parts.push(...transcriptParts);
|
|
1577
|
+
const llmContent = parts.length === 1 ? fileDataPart : parts;
|
|
1578
|
+
return {
|
|
1579
|
+
llmContent,
|
|
1580
|
+
returnDisplay: `Read ${delivery.recognized.modality} file (omni upload): ${relativePathForDisplay}`,
|
|
1581
|
+
tokenEstimate: delivery.tokenEstimate
|
|
1582
|
+
};
|
|
1583
|
+
} catch (err) {
|
|
1584
|
+
if (isAbortError(err) || signal?.aborted) throw err;
|
|
1585
|
+
const message = sanitizeErrorMessage(err, [filePath]);
|
|
1586
|
+
return {
|
|
1587
|
+
llmContent: `[Omni media delivery failed for ${displayName}: ${message}]`,
|
|
1588
|
+
returnDisplay: `Failed to deliver media via omni upload: ${relativePathForDisplay}`,
|
|
1589
|
+
error: `Omni media delivery failed: ${displayName}: ${message}`,
|
|
1590
|
+
errorType: "read_content_failure" /* READ_CONTENT_FAILURE */
|
|
1591
|
+
};
|
|
1592
|
+
}
|
|
1593
|
+
}
|
|
1594
|
+
__name(readMediaViaOmniDelivery, "readMediaViaOmniDelivery");
|
|
1595
|
+
function effectiveMaxDownloadFileBytes(config) {
|
|
1596
|
+
const uploadCap = effectiveMaxUploadFileBytes(config);
|
|
1597
|
+
const configured = config.getOmniUrlDownloadMaxFileBytes?.();
|
|
1598
|
+
if (configured !== void 0 && configured > 0) {
|
|
1599
|
+
return Math.min(configured, uploadCap);
|
|
1600
|
+
}
|
|
1601
|
+
return uploadCap;
|
|
1602
|
+
}
|
|
1603
|
+
__name(effectiveMaxDownloadFileBytes, "effectiveMaxDownloadFileBytes");
|
|
1604
|
+
|
|
1605
|
+
export {
|
|
1606
|
+
OmniDownloadError,
|
|
1607
|
+
parseHttpUrlRef,
|
|
1608
|
+
downloadMediaUrl,
|
|
1609
|
+
exportOmniTrajectory,
|
|
1610
|
+
serializeOmniTrajectory,
|
|
1611
|
+
writeOmniTrajectoryJsonl,
|
|
1612
|
+
sanitizeErrorMessage,
|
|
1613
|
+
buildAdditionalMediaParts,
|
|
1614
|
+
buildTranscriptParts,
|
|
1615
|
+
OmniDeliveryError,
|
|
1616
|
+
processMediaForOmniDelivery,
|
|
1617
|
+
readMediaViaOmniDelivery,
|
|
1618
|
+
effectiveMaxDownloadFileBytes,
|
|
1619
|
+
processToolResultOmniMedia
|
|
1620
|
+
};
|
|
1621
|
+
/**
|
|
1622
|
+
* @license
|
|
1623
|
+
* Copyright 2025 Google LLC
|
|
1624
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
1625
|
+
*/
|