@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,1377 @@
|
|
|
1
|
+
// Force strict mode and setup for ESM
|
|
2
|
+
"use strict";
|
|
3
|
+
import {
|
|
4
|
+
serializeFileOperation
|
|
5
|
+
} from "./chunk-TFDCK56Y.js";
|
|
6
|
+
import {
|
|
7
|
+
resolveMediaReference
|
|
8
|
+
} from "./chunk-MNU36NGH.js";
|
|
9
|
+
import {
|
|
10
|
+
atomicWriteFile
|
|
11
|
+
} from "./chunk-CA63HYHU.js";
|
|
12
|
+
import {
|
|
13
|
+
createDebugLogger
|
|
14
|
+
} from "./chunk-ZYDMQCQP.js";
|
|
15
|
+
import {
|
|
16
|
+
init_esbuild_shims
|
|
17
|
+
} from "./chunk-5O2XNYP6.js";
|
|
18
|
+
import {
|
|
19
|
+
__name
|
|
20
|
+
} from "./chunk-J2S4EL5Y.js";
|
|
21
|
+
|
|
22
|
+
// packages/core/src/services/media-memory/service.ts
|
|
23
|
+
init_esbuild_shims();
|
|
24
|
+
import { createHash } from "node:crypto";
|
|
25
|
+
|
|
26
|
+
// packages/core/src/services/media-memory/store.ts
|
|
27
|
+
init_esbuild_shims();
|
|
28
|
+
import fs from "node:fs/promises";
|
|
29
|
+
import path from "node:path";
|
|
30
|
+
var debugLogger = createDebugLogger("omni:memory");
|
|
31
|
+
var MAX_CORRUPT_BACKUPS = 2;
|
|
32
|
+
var MEDIA_MEMORY_FILE_NAME = "memory.json";
|
|
33
|
+
function emptySnapshot() {
|
|
34
|
+
return {
|
|
35
|
+
schemaVersion: 1,
|
|
36
|
+
files: {},
|
|
37
|
+
versions: {},
|
|
38
|
+
executions: {},
|
|
39
|
+
entries: {}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
__name(emptySnapshot, "emptySnapshot");
|
|
43
|
+
function isPlainRecord(value) {
|
|
44
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
45
|
+
}
|
|
46
|
+
__name(isPlainRecord, "isPlainRecord");
|
|
47
|
+
function pruneMalformedRecords(snapshot) {
|
|
48
|
+
const dropped = [];
|
|
49
|
+
for (const collection of [
|
|
50
|
+
"files",
|
|
51
|
+
"versions",
|
|
52
|
+
"executions",
|
|
53
|
+
"entries"
|
|
54
|
+
]) {
|
|
55
|
+
const records = snapshot[collection];
|
|
56
|
+
for (const [key, value] of Object.entries(records)) {
|
|
57
|
+
if (!isPlainRecord(value)) {
|
|
58
|
+
delete records[key];
|
|
59
|
+
dropped.push(`${collection}/${key}`);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if (dropped.length > 0) {
|
|
64
|
+
debugLogger.debug(
|
|
65
|
+
`dropped ${dropped.length} malformed memory record${dropped.length === 1 ? "" : "s"}: ${dropped.join(", ")}`
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
__name(pruneMalformedRecords, "pruneMalformedRecords");
|
|
70
|
+
var MediaMemoryStore = class {
|
|
71
|
+
static {
|
|
72
|
+
__name(this, "MediaMemoryStore");
|
|
73
|
+
}
|
|
74
|
+
filePath;
|
|
75
|
+
omniRootDir;
|
|
76
|
+
constructor(omniRootDir) {
|
|
77
|
+
this.omniRootDir = omniRootDir;
|
|
78
|
+
this.filePath = path.join(omniRootDir, MEDIA_MEMORY_FILE_NAME);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Prefix (with trailing separator) under which the omni object store
|
|
82
|
+
* keeps its content-addressed copies. A version whose `fileRef` starts
|
|
83
|
+
* with this prefix anchors its only persistent bytes in the store —
|
|
84
|
+
* the GC root collection matches on it.
|
|
85
|
+
*/
|
|
86
|
+
omniObjectsPrefix() {
|
|
87
|
+
return path.join(this.omniRootDir, "objects") + path.sep;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Run one serialized operation against the snapshot. `fn` returns the
|
|
91
|
+
* operation result plus whether it mutated the snapshot (triggering an
|
|
92
|
+
* atomic save). When the document exists but cannot be read,
|
|
93
|
+
* `unreadableResult` is returned and nothing is saved.
|
|
94
|
+
*/
|
|
95
|
+
async transact(unreadableResult, fn) {
|
|
96
|
+
return serializeFileOperation(this.filePath, async () => {
|
|
97
|
+
const snapshot = await this.load();
|
|
98
|
+
if (!snapshot) return unreadableResult;
|
|
99
|
+
const { result, changed } = await fn(snapshot);
|
|
100
|
+
if (changed) await this.save(snapshot);
|
|
101
|
+
return result;
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
/** Read-only view over the snapshot (recall, queries). */
|
|
105
|
+
async read(unreadableResult, fn) {
|
|
106
|
+
return this.transact(unreadableResult, async (snapshot) => ({
|
|
107
|
+
result: await fn(snapshot)
|
|
108
|
+
}));
|
|
109
|
+
}
|
|
110
|
+
async load() {
|
|
111
|
+
let raw;
|
|
112
|
+
try {
|
|
113
|
+
raw = await fs.readFile(this.filePath, "utf8");
|
|
114
|
+
} catch (err) {
|
|
115
|
+
const code = err.code;
|
|
116
|
+
if (code === "ENOENT" || code === "ENOTDIR") return emptySnapshot();
|
|
117
|
+
debugLogger.debug(
|
|
118
|
+
`memory read failed, operation skipped: ${err instanceof Error ? err.message : err}`
|
|
119
|
+
);
|
|
120
|
+
return null;
|
|
121
|
+
}
|
|
122
|
+
try {
|
|
123
|
+
const parsed = JSON.parse(raw);
|
|
124
|
+
if (isPlainRecord(parsed) && parsed.schemaVersion === 1 && isPlainRecord(parsed.files) && isPlainRecord(parsed.versions) && isPlainRecord(parsed.executions) && isPlainRecord(parsed.entries)) {
|
|
125
|
+
pruneMalformedRecords(parsed);
|
|
126
|
+
return parsed;
|
|
127
|
+
}
|
|
128
|
+
throw new Error("unexpected shape");
|
|
129
|
+
} catch {
|
|
130
|
+
const backup = `${this.filePath}.corrupt-${Date.now()}`;
|
|
131
|
+
await fs.rename(this.filePath, backup).catch(() => {
|
|
132
|
+
});
|
|
133
|
+
await this.pruneCorruptBackups();
|
|
134
|
+
debugLogger.debug(`corrupt memory document backed up to ${backup}`);
|
|
135
|
+
return emptySnapshot();
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
async pruneCorruptBackups() {
|
|
139
|
+
const dir = path.dirname(this.filePath);
|
|
140
|
+
const prefix = `${path.basename(this.filePath)}.corrupt-`;
|
|
141
|
+
try {
|
|
142
|
+
const backups = (await fs.readdir(dir)).filter((n) => n.startsWith(prefix)).sort().reverse();
|
|
143
|
+
for (const name of backups.slice(MAX_CORRUPT_BACKUPS)) {
|
|
144
|
+
await fs.rm(path.join(dir, name), { force: true }).catch(() => {
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
} catch {
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
async save(snapshot) {
|
|
151
|
+
await fs.mkdir(path.dirname(this.filePath), {
|
|
152
|
+
recursive: true,
|
|
153
|
+
mode: 448
|
|
154
|
+
});
|
|
155
|
+
await atomicWriteFile(this.filePath, JSON.stringify(snapshot, null, 1), {
|
|
156
|
+
mode: 384,
|
|
157
|
+
forceMode: true,
|
|
158
|
+
noFollow: true
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
// packages/core/src/services/media-memory/service.ts
|
|
164
|
+
var debugLogger2 = createDebugLogger("omni:memory");
|
|
165
|
+
var DEFAULT_MAX_INLINE_TEXT_BYTES = 65536;
|
|
166
|
+
var MEDIA_DETECTOR_VERSION = "omni-sniff-ffprobe/1";
|
|
167
|
+
function hashId(prefix, material) {
|
|
168
|
+
return prefix + createHash("sha256").update(material).digest("hex").slice(0, 24);
|
|
169
|
+
}
|
|
170
|
+
__name(hashId, "hashId");
|
|
171
|
+
function fileIdFor(fileRef) {
|
|
172
|
+
return hashId("f", fileRef);
|
|
173
|
+
}
|
|
174
|
+
__name(fileIdFor, "fileIdFor");
|
|
175
|
+
function derivedFileIdFor(objectPath, rootFileId) {
|
|
176
|
+
return hashId("f", `${rootFileId}|${objectPath}`);
|
|
177
|
+
}
|
|
178
|
+
__name(derivedFileIdFor, "derivedFileIdFor");
|
|
179
|
+
function versionIdFor(fileId, sha256) {
|
|
180
|
+
return hashId("v", `${fileId}|${sha256}`);
|
|
181
|
+
}
|
|
182
|
+
__name(versionIdFor, "versionIdFor");
|
|
183
|
+
function channelsFor(mediaType, role) {
|
|
184
|
+
if (role === "transcript") return ["speech_text"];
|
|
185
|
+
if (role === "ocr") return ["onscreen_text"];
|
|
186
|
+
switch (mediaType) {
|
|
187
|
+
case "image":
|
|
188
|
+
return ["visual"];
|
|
189
|
+
case "audio":
|
|
190
|
+
return ["acoustic"];
|
|
191
|
+
case "video":
|
|
192
|
+
return ["visual", "acoustic"];
|
|
193
|
+
default:
|
|
194
|
+
return [];
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
__name(channelsFor, "channelsFor");
|
|
198
|
+
function coverageFor(role) {
|
|
199
|
+
if (role === "keyframe") return { mode: "sampled", scope: {} };
|
|
200
|
+
if (role === "clip") return { mode: "partial", scope: {} };
|
|
201
|
+
return { mode: "complete", scope: {} };
|
|
202
|
+
}
|
|
203
|
+
__name(coverageFor, "coverageFor");
|
|
204
|
+
function truncateUtf8(text, maxBytes) {
|
|
205
|
+
const encoder = new TextEncoder();
|
|
206
|
+
if (encoder.encode(text).byteLength <= maxBytes) return text;
|
|
207
|
+
let result = "";
|
|
208
|
+
let bytes = 0;
|
|
209
|
+
for (const ch of text) {
|
|
210
|
+
const chBytes = encoder.encode(ch).byteLength;
|
|
211
|
+
if (bytes + chBytes > maxBytes) break;
|
|
212
|
+
result += ch;
|
|
213
|
+
bytes += chBytes;
|
|
214
|
+
}
|
|
215
|
+
return result;
|
|
216
|
+
}
|
|
217
|
+
__name(truncateUtf8, "truncateUtf8");
|
|
218
|
+
var MediaMemoryService = class {
|
|
219
|
+
static {
|
|
220
|
+
__name(this, "MediaMemoryService");
|
|
221
|
+
}
|
|
222
|
+
store;
|
|
223
|
+
maxInlineTextBytes;
|
|
224
|
+
constructor(omniRootDir, options) {
|
|
225
|
+
this.store = new MediaMemoryStore(omniRootDir);
|
|
226
|
+
this.maxInlineTextBytes = options?.maxInlineTextBytes ?? DEFAULT_MAX_INLINE_TEXT_BYTES;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Collection trigger 1 — FileRecognized (M §6.1). Preconditions are the
|
|
230
|
+
* caller's contract: mediaType decided, FULL sha256 computed, metadata
|
|
231
|
+
* and a definite probeStatus in hand. Idempotent upsert: same fileRef +
|
|
232
|
+
* same content is a no-op; new content at a known fileRef creates a new
|
|
233
|
+
* immutable version and moves CURRENT_VERSION.
|
|
234
|
+
*
|
|
235
|
+
* Returns undefined when persistence failed (logged, never thrown).
|
|
236
|
+
*/
|
|
237
|
+
async recordFileRecognized(event) {
|
|
238
|
+
try {
|
|
239
|
+
return await this.store.transact(void 0, (snapshot) => {
|
|
240
|
+
const commit = upsertRecognizedFile(snapshot, event, this.now());
|
|
241
|
+
return { result: commit, changed: commit.changed };
|
|
242
|
+
});
|
|
243
|
+
} catch (err) {
|
|
244
|
+
debugLogger2.debug(
|
|
245
|
+
`recordFileRecognized failed for ${event.source.locator}: ${err instanceof Error ? err.message : err}`
|
|
246
|
+
);
|
|
247
|
+
return void 0;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Collection trigger 2 — OmniPolicySucceeded (M §6.4). One atomic
|
|
252
|
+
* transaction commits the execution record, a file+version per derived
|
|
253
|
+
* media output (DERIVED_FROM / PRODUCED_BY edges), and one entry per
|
|
254
|
+
* output (HAS_OUTPUT edges). The executionId is deterministic in the
|
|
255
|
+
* content-identity reuse key (source sha256 ⊕ omniConfigHash, M §11),
|
|
256
|
+
* so degradation-cache hits and invocation replays converge on the
|
|
257
|
+
* same execution node instead of duplicating it.
|
|
258
|
+
*
|
|
259
|
+
* Returns undefined when persistence failed (logged, never thrown) —
|
|
260
|
+
* the delivery proceeds regardless.
|
|
261
|
+
*/
|
|
262
|
+
async commitPolicySucceeded(input) {
|
|
263
|
+
try {
|
|
264
|
+
return await this.store.transact(void 0, (snapshot) => {
|
|
265
|
+
const result = commitExecution(
|
|
266
|
+
snapshot,
|
|
267
|
+
input,
|
|
268
|
+
this.maxInlineTextBytes,
|
|
269
|
+
this.now()
|
|
270
|
+
);
|
|
271
|
+
return { result: result.commit, changed: result.changed };
|
|
272
|
+
});
|
|
273
|
+
} catch (err) {
|
|
274
|
+
debugLogger2.debug(
|
|
275
|
+
`commitPolicySucceeded failed for ${input.toolName} (invocation ${input.invocationId}): ${err instanceof Error ? err.message : err}`
|
|
276
|
+
);
|
|
277
|
+
return void 0;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Recorded outputs of a prior execution that already performed THIS
|
|
282
|
+
* computation on THESE bytes (content-identity reuse key, M §11.3) —
|
|
283
|
+
* the read side of «同文件同 settings 二次触发同一 policy:直接复用,
|
|
284
|
+
* 无重复执行». Covers every output shape, so multi-output tools and text
|
|
285
|
+
* products (transcripts) are reusable too, unlike the S4 degradation
|
|
286
|
+
* cache which maps one input to a single media derivative.
|
|
287
|
+
*
|
|
288
|
+
* Returns locators and recorded provenance only: the caller must verify
|
|
289
|
+
* the bytes still exist and still hash to `sha256` before reusing them
|
|
290
|
+
* (memory.json is project-local and hand-editable — the same stance the
|
|
291
|
+
* degradation-cache hit path takes). Undefined when nothing matches or
|
|
292
|
+
* the store is unreadable (logged, never thrown).
|
|
293
|
+
*/
|
|
294
|
+
async findReusableOutputs(sourceSha256, omniConfigHash) {
|
|
295
|
+
try {
|
|
296
|
+
return await this.store.read(void 0, (snapshot) => {
|
|
297
|
+
const match = findReusableExecution(
|
|
298
|
+
snapshot,
|
|
299
|
+
`${sourceSha256}|${omniConfigHash}`,
|
|
300
|
+
""
|
|
301
|
+
);
|
|
302
|
+
if (!match) return void 0;
|
|
303
|
+
const outputs = [];
|
|
304
|
+
for (const entryId of match.outputRefs) {
|
|
305
|
+
const entry = snapshot.entries[entryId];
|
|
306
|
+
if (!entry?.artifactRef) return void 0;
|
|
307
|
+
const managedId = entry.artifactRef.managedId;
|
|
308
|
+
const sha256 = managedId?.startsWith("sha256/") ? managedId.slice("sha256/".length) : void 0;
|
|
309
|
+
if (sha256 === void 0) return void 0;
|
|
310
|
+
const version = entry.derivedVersionId ? snapshot.versions[entry.derivedVersionId] : void 0;
|
|
311
|
+
const objectPath = version ? snapshot.files[version.fileId]?.fileRef : void 0;
|
|
312
|
+
outputs.push({
|
|
313
|
+
kind: entry.kind === "derived_media" ? "media" : "text",
|
|
314
|
+
sha256,
|
|
315
|
+
...objectPath !== void 0 ? { objectPath } : {},
|
|
316
|
+
mimeType: entry.artifactRef.mimeType,
|
|
317
|
+
sizeBytes: entry.artifactRef.sizeBytes,
|
|
318
|
+
...entry.role !== void 0 ? { role: entry.role } : {},
|
|
319
|
+
...entry.disclosure !== void 0 ? { disclosure: entry.disclosure } : {}
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
if (outputs.length === 0) return void 0;
|
|
323
|
+
return { executionId: match.executionId, outputs };
|
|
324
|
+
});
|
|
325
|
+
} catch (err) {
|
|
326
|
+
debugLogger2.debug(
|
|
327
|
+
`findReusableOutputs failed: ${err instanceof Error ? err.message : err}`
|
|
328
|
+
);
|
|
329
|
+
return void 0;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* The `memory.*` fixed-policy condition namespace (policy design
|
|
334
|
+
* §4.1/4.4): the set of output ROLES recorded anywhere in the
|
|
335
|
+
* subgraph rooted at the binding's version — the version itself plus
|
|
336
|
+
* every version derived from it (DERIVED_FROM child edges), bounded to
|
|
337
|
+
* the binding's root graph. This is what lets a `when` condition ask
|
|
338
|
+
* "does memory already hold a transcript/OCR/caption for this file"
|
|
339
|
+
* before deciding to run a policy — e.g. the §4.1 chain parents the
|
|
340
|
+
* transcript entry to the EXTRACTED-AUDIO version, a child of the
|
|
341
|
+
* video version being matched, so a same-version-only lookup would
|
|
342
|
+
* never see it.
|
|
343
|
+
*
|
|
344
|
+
* Returns an EMPTY set when the version is unknown (nothing recorded
|
|
345
|
+
* yet — a determinate "no roles"), and undefined only when the store
|
|
346
|
+
* itself is unreadable (the caller maps that to condition
|
|
347
|
+
* `unavailable`, never silently false). Persistence errors are logged,
|
|
348
|
+
* never thrown (same failure stance as the rest of the facade).
|
|
349
|
+
*/
|
|
350
|
+
async collectVersionOutputRoles(binding) {
|
|
351
|
+
try {
|
|
352
|
+
return await this.store.read(void 0, (snapshot) => {
|
|
353
|
+
const start = snapshot.versions[binding.fileVersionId];
|
|
354
|
+
if (!start) return /* @__PURE__ */ new Set();
|
|
355
|
+
const roles = /* @__PURE__ */ new Set();
|
|
356
|
+
const visited = /* @__PURE__ */ new Set();
|
|
357
|
+
const queue = [start.fileVersionId];
|
|
358
|
+
while (queue.length > 0) {
|
|
359
|
+
const versionId = queue.shift();
|
|
360
|
+
if (visited.has(versionId)) continue;
|
|
361
|
+
visited.add(versionId);
|
|
362
|
+
const version = snapshot.versions[versionId];
|
|
363
|
+
if (!version) continue;
|
|
364
|
+
const file = snapshot.files[version.fileId];
|
|
365
|
+
if (!file || file.rootFileId !== binding.rootFileId) continue;
|
|
366
|
+
for (const entry of Object.values(snapshot.entries)) {
|
|
367
|
+
if (entry.parentVersionId === versionId && entry.role) {
|
|
368
|
+
roles.add(entry.role);
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
for (const child of Object.values(snapshot.versions)) {
|
|
372
|
+
if (child.parentVersionId === versionId) {
|
|
373
|
+
queue.push(child.fileVersionId);
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
return roles;
|
|
378
|
+
});
|
|
379
|
+
} catch (err) {
|
|
380
|
+
debugLogger2.debug(
|
|
381
|
+
`collectVersionOutputRoles failed: ${err instanceof Error ? err.message : err}`
|
|
382
|
+
);
|
|
383
|
+
return void 0;
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* Read-side lookup by LOCATOR, for the harness only (design M §9.2.1:
|
|
388
|
+
* path/hash lookup is a harness capability; the model is confined to
|
|
389
|
+
* session handles). Returns the CURRENT version of the File recorded at
|
|
390
|
+
* this locator, whether or not the bytes are still on disk — which is
|
|
391
|
+
* the point: it lets a remembered-but-missing file be re-anchored into a
|
|
392
|
+
* session so its memory stays reachable.
|
|
393
|
+
*/
|
|
394
|
+
async findBindingByFileRef(fileRef) {
|
|
395
|
+
try {
|
|
396
|
+
return await this.store.read(void 0, (snapshot) => {
|
|
397
|
+
for (const file of Object.values(snapshot.files)) {
|
|
398
|
+
if (file.fileRef !== fileRef) continue;
|
|
399
|
+
const version = snapshot.versions[file.currentVersionId];
|
|
400
|
+
if (!version) return void 0;
|
|
401
|
+
return {
|
|
402
|
+
binding: {
|
|
403
|
+
fileId: file.fileId,
|
|
404
|
+
fileVersionId: version.fileVersionId,
|
|
405
|
+
rootFileId: file.rootFileId
|
|
406
|
+
},
|
|
407
|
+
mediaType: version.mediaType,
|
|
408
|
+
sha256: version.sha256
|
|
409
|
+
};
|
|
410
|
+
}
|
|
411
|
+
return void 0;
|
|
412
|
+
});
|
|
413
|
+
} catch (err) {
|
|
414
|
+
debugLogger2.debug(
|
|
415
|
+
`findBindingByFileRef failed: ${err instanceof Error ? err.message : err}`
|
|
416
|
+
);
|
|
417
|
+
return void 0;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
* The GC root set (storage design §6.2): every object hash any memory
|
|
422
|
+
* record still references. Three distinct reference kinds exist and ALL
|
|
423
|
+
* count — `entries[].artifactRef.managedId` (policy outputs),
|
|
424
|
+
* managed-protocol `versions[].source.locator` (tool media anchor
|
|
425
|
+
* their file identity in the object store), and versions of files
|
|
426
|
+
* whose `fileRef` points INTO the object store while their source
|
|
427
|
+
* keeps a different protocol (URL media: `source.locator` is the
|
|
428
|
+
* original URL, but the staging download is deleted the turn it
|
|
429
|
+
* lands, so the store copy named by the file's `fileRef` is the only
|
|
430
|
+
* persistent bytes). The last kind is rooted by content hash: each
|
|
431
|
+
* such version's bytes live in the store under its own sha256.
|
|
432
|
+
*
|
|
433
|
+
* Returns null when the store exists but cannot be read — the caller
|
|
434
|
+
* must treat that as "roots unknown" and delete NOTHING (fail-closed:
|
|
435
|
+
* an unreadable ledger must never read as an empty one). A store that
|
|
436
|
+
* has never been written returns an empty set: nothing was ever
|
|
437
|
+
* recorded, so nothing is referenced.
|
|
438
|
+
*/
|
|
439
|
+
async collectManagedRefs() {
|
|
440
|
+
const UNREADABLE = null;
|
|
441
|
+
const objectsPrefix = this.store.omniObjectsPrefix();
|
|
442
|
+
try {
|
|
443
|
+
return await this.store.read(
|
|
444
|
+
UNREADABLE,
|
|
445
|
+
(snapshot) => {
|
|
446
|
+
const refs = /* @__PURE__ */ new Set();
|
|
447
|
+
const add = /* @__PURE__ */ __name((locator) => {
|
|
448
|
+
if (locator?.startsWith("sha256/")) {
|
|
449
|
+
refs.add(locator.slice("sha256/".length));
|
|
450
|
+
}
|
|
451
|
+
}, "add");
|
|
452
|
+
for (const entry of Object.values(snapshot.entries)) {
|
|
453
|
+
if (entry.artifactRef?.storage === "managed") {
|
|
454
|
+
add(entry.artifactRef.managedId);
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
for (const version of Object.values(snapshot.versions)) {
|
|
458
|
+
if (version.source.protocol === "managed") {
|
|
459
|
+
add(version.source.locator);
|
|
460
|
+
}
|
|
461
|
+
const file = snapshot.files[version.fileId];
|
|
462
|
+
if (file?.fileRef.startsWith(objectsPrefix)) {
|
|
463
|
+
refs.add(version.sha256);
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
return refs;
|
|
467
|
+
}
|
|
468
|
+
);
|
|
469
|
+
} catch (err) {
|
|
470
|
+
debugLogger2.debug(
|
|
471
|
+
`collectManagedRefs failed: ${err instanceof Error ? err.message : err}`
|
|
472
|
+
);
|
|
473
|
+
return null;
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
/**
|
|
477
|
+
* Read-side lookup for callers that hold bytes but no identity (the
|
|
478
|
+
* reactive degradation ladder re-recognizes a stored object without
|
|
479
|
+
* knowing which memory version it is). Returns the binding of the
|
|
480
|
+
* newest version whose content hash matches, or undefined when memory
|
|
481
|
+
* has never seen the content (or the store is unreadable — logged,
|
|
482
|
+
* never thrown).
|
|
483
|
+
*/
|
|
484
|
+
async findBindingBySha256(sha256) {
|
|
485
|
+
try {
|
|
486
|
+
return await this.store.read(void 0, (snapshot) => {
|
|
487
|
+
let found = null;
|
|
488
|
+
for (const version of Object.values(snapshot.versions)) {
|
|
489
|
+
if (version.sha256 !== sha256) continue;
|
|
490
|
+
const file = snapshot.files[version.fileId];
|
|
491
|
+
if (!file) continue;
|
|
492
|
+
if (found && found.createdAt >= version.createdAt) continue;
|
|
493
|
+
found = {
|
|
494
|
+
binding: {
|
|
495
|
+
fileId: version.fileId,
|
|
496
|
+
fileVersionId: version.fileVersionId,
|
|
497
|
+
rootFileId: file.rootFileId
|
|
498
|
+
},
|
|
499
|
+
createdAt: version.createdAt
|
|
500
|
+
};
|
|
501
|
+
}
|
|
502
|
+
return found?.binding;
|
|
503
|
+
});
|
|
504
|
+
} catch (err) {
|
|
505
|
+
debugLogger2.debug(
|
|
506
|
+
`findBindingBySha256 failed: ${err instanceof Error ? err.message : err}`
|
|
507
|
+
);
|
|
508
|
+
return void 0;
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
/** Injectable for tests via subclassing; records are stamped once per
|
|
512
|
+
* commit so all records of a transaction share one timestamp. */
|
|
513
|
+
now() {
|
|
514
|
+
return (/* @__PURE__ */ new Date()).toISOString();
|
|
515
|
+
}
|
|
516
|
+
};
|
|
517
|
+
function upsertRecognizedFile(snapshot, event, now) {
|
|
518
|
+
const fileId = event.origin === "policy" && event.rootFileId !== void 0 ? derivedFileIdFor(event.fileRef, event.rootFileId) : fileIdFor(event.fileRef);
|
|
519
|
+
const fileVersionId = versionIdFor(fileId, event.sha256);
|
|
520
|
+
let changed = false;
|
|
521
|
+
let file = snapshot.files[fileId];
|
|
522
|
+
if (!file) {
|
|
523
|
+
file = {
|
|
524
|
+
fileId,
|
|
525
|
+
rootFileId: event.rootFileId ?? fileId,
|
|
526
|
+
fileRef: event.fileRef,
|
|
527
|
+
origin: event.origin,
|
|
528
|
+
currentVersionId: fileVersionId,
|
|
529
|
+
createdAt: now
|
|
530
|
+
};
|
|
531
|
+
snapshot.files[fileId] = file;
|
|
532
|
+
changed = true;
|
|
533
|
+
}
|
|
534
|
+
let version = snapshot.versions[fileVersionId];
|
|
535
|
+
const created = !version;
|
|
536
|
+
if (!version) {
|
|
537
|
+
version = {
|
|
538
|
+
fileVersionId,
|
|
539
|
+
fileId,
|
|
540
|
+
sha256: event.sha256,
|
|
541
|
+
mediaType: event.mediaType,
|
|
542
|
+
metadata: event.metadata,
|
|
543
|
+
sizeBytes: event.sizeBytes,
|
|
544
|
+
mimeType: event.mimeType,
|
|
545
|
+
source: event.source,
|
|
546
|
+
recognition: event.recognition,
|
|
547
|
+
...event.parentVersionId !== void 0 ? { parentVersionId: event.parentVersionId } : {},
|
|
548
|
+
createdAt: now
|
|
549
|
+
};
|
|
550
|
+
snapshot.versions[fileVersionId] = version;
|
|
551
|
+
changed = true;
|
|
552
|
+
}
|
|
553
|
+
if (file.currentVersionId !== fileVersionId) {
|
|
554
|
+
file.currentVersionId = fileVersionId;
|
|
555
|
+
changed = true;
|
|
556
|
+
}
|
|
557
|
+
return {
|
|
558
|
+
fileId,
|
|
559
|
+
fileVersionId,
|
|
560
|
+
rootFileId: file.rootFileId,
|
|
561
|
+
created,
|
|
562
|
+
changed
|
|
563
|
+
};
|
|
564
|
+
}
|
|
565
|
+
__name(upsertRecognizedFile, "upsertRecognizedFile");
|
|
566
|
+
function reuseKeyOf(snapshot, execution) {
|
|
567
|
+
const sha = snapshot.versions[execution.sourceVersionId]?.sha256;
|
|
568
|
+
return sha === void 0 ? void 0 : `${sha}|${execution.omniConfigHash}`;
|
|
569
|
+
}
|
|
570
|
+
__name(reuseKeyOf, "reuseKeyOf");
|
|
571
|
+
function findReusableExecution(snapshot, reuseKey, selfExecutionId) {
|
|
572
|
+
let best;
|
|
573
|
+
for (const candidate of Object.values(snapshot.executions)) {
|
|
574
|
+
if (candidate.executionId === selfExecutionId) continue;
|
|
575
|
+
if (candidate.reusedExecutionId !== void 0) continue;
|
|
576
|
+
if (reuseKeyOf(snapshot, candidate) !== reuseKey) continue;
|
|
577
|
+
if (!best || candidate.completedAt < best.completedAt || candidate.completedAt === best.completedAt && candidate.executionId < best.executionId) {
|
|
578
|
+
best = candidate;
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
return best;
|
|
582
|
+
}
|
|
583
|
+
__name(findReusableExecution, "findReusableExecution");
|
|
584
|
+
function commitExecution(snapshot, input, maxInlineTextBytes, now) {
|
|
585
|
+
const sourceVersion = snapshot.versions[input.source.fileVersionId];
|
|
586
|
+
const sourceSha = sourceVersion?.sha256 ?? input.source.fileVersionId;
|
|
587
|
+
const executionId = hashId(
|
|
588
|
+
"x",
|
|
589
|
+
`${input.source.fileVersionId}|${input.omniConfigHash}`
|
|
590
|
+
);
|
|
591
|
+
const reuseKey = `${sourceSha}|${input.omniConfigHash}`;
|
|
592
|
+
const mediaBindings = /* @__PURE__ */ new Map();
|
|
593
|
+
const existing = snapshot.executions[executionId];
|
|
594
|
+
if (existing) {
|
|
595
|
+
for (const entryId of existing.outputRefs) {
|
|
596
|
+
const entry = snapshot.entries[entryId];
|
|
597
|
+
if (!entry?.derivedVersionId) continue;
|
|
598
|
+
const version = snapshot.versions[entry.derivedVersionId];
|
|
599
|
+
if (!version) continue;
|
|
600
|
+
mediaBindings.set(version.sha256, {
|
|
601
|
+
fileId: version.fileId,
|
|
602
|
+
fileVersionId: version.fileVersionId,
|
|
603
|
+
rootFileId: snapshot.files[version.fileId]?.rootFileId ?? input.source.rootFileId
|
|
604
|
+
});
|
|
605
|
+
}
|
|
606
|
+
return {
|
|
607
|
+
commit: { executionId, mediaBindings, created: false },
|
|
608
|
+
changed: false
|
|
609
|
+
};
|
|
610
|
+
}
|
|
611
|
+
const reused = findReusableExecution(snapshot, reuseKey, executionId);
|
|
612
|
+
const outputRefs = [];
|
|
613
|
+
for (const [index, output] of input.outputs.entries()) {
|
|
614
|
+
const entryId = hashId("e", `${executionId}|${index}|${output.sha256}`);
|
|
615
|
+
outputRefs.push(entryId);
|
|
616
|
+
let derivedVersionId;
|
|
617
|
+
if (output.kind === "media") {
|
|
618
|
+
const commit = upsertRecognizedFile(
|
|
619
|
+
snapshot,
|
|
620
|
+
{
|
|
621
|
+
fileRef: output.objectPath,
|
|
622
|
+
sha256: output.sha256,
|
|
623
|
+
mediaType: output.mediaType,
|
|
624
|
+
metadata: output.metadata,
|
|
625
|
+
sizeBytes: output.sizeBytes,
|
|
626
|
+
mimeType: output.mimeType,
|
|
627
|
+
origin: "policy",
|
|
628
|
+
rootFileId: input.source.rootFileId,
|
|
629
|
+
parentVersionId: input.source.fileVersionId,
|
|
630
|
+
source: {
|
|
631
|
+
protocol: "managed",
|
|
632
|
+
locator: `sha256/${output.sha256}`
|
|
633
|
+
},
|
|
634
|
+
recognition: {
|
|
635
|
+
ingestionConfigHash: input.omniConfigHash,
|
|
636
|
+
detectorVersion: MEDIA_DETECTOR_VERSION,
|
|
637
|
+
probeStatus: "complete"
|
|
638
|
+
}
|
|
639
|
+
},
|
|
640
|
+
now
|
|
641
|
+
);
|
|
642
|
+
derivedVersionId = commit.fileVersionId;
|
|
643
|
+
if (commit.created) {
|
|
644
|
+
snapshot.versions[commit.fileVersionId].producedByExecutionId = executionId;
|
|
645
|
+
}
|
|
646
|
+
mediaBindings.set(output.sha256, {
|
|
647
|
+
fileId: commit.fileId,
|
|
648
|
+
fileVersionId: commit.fileVersionId,
|
|
649
|
+
rootFileId: commit.rootFileId
|
|
650
|
+
});
|
|
651
|
+
}
|
|
652
|
+
const entry = {
|
|
653
|
+
outputId: entryId,
|
|
654
|
+
kind: output.kind === "media" ? "derived_media" : "policy_result",
|
|
655
|
+
...output.role !== void 0 ? { role: output.role } : {},
|
|
656
|
+
artifactRef: {
|
|
657
|
+
storage: "managed",
|
|
658
|
+
managedId: `sha256/${output.sha256}`,
|
|
659
|
+
mimeType: output.mimeType,
|
|
660
|
+
sizeBytes: output.sizeBytes
|
|
661
|
+
},
|
|
662
|
+
...output.kind === "text" ? { inlineText: truncateUtf8(output.text, maxInlineTextBytes) } : {},
|
|
663
|
+
...output.disclosure !== void 0 ? { disclosure: output.disclosure } : {},
|
|
664
|
+
scope: {},
|
|
665
|
+
channels: channelsFor(
|
|
666
|
+
output.kind === "media" ? output.mediaType : output.role === "caption" || output.role === "summary" ? sourceVersion?.mediaType : void 0,
|
|
667
|
+
output.role
|
|
668
|
+
),
|
|
669
|
+
coverage: coverageFor(output.role),
|
|
670
|
+
parentVersionId: input.source.fileVersionId,
|
|
671
|
+
producedByExecutionId: executionId,
|
|
672
|
+
...derivedVersionId !== void 0 ? { derivedVersionId } : {},
|
|
673
|
+
createdAt: now
|
|
674
|
+
};
|
|
675
|
+
snapshot.entries[entryId] = entry;
|
|
676
|
+
}
|
|
677
|
+
const execution = {
|
|
678
|
+
executionId,
|
|
679
|
+
invocationId: input.invocationId,
|
|
680
|
+
sourceVersionId: input.source.fileVersionId,
|
|
681
|
+
rootFileId: input.source.rootFileId,
|
|
682
|
+
executionOrigin: input.executionOrigin,
|
|
683
|
+
toolName: input.toolName,
|
|
684
|
+
toolVersion: input.toolVersion,
|
|
685
|
+
finalArguments: input.finalArguments,
|
|
686
|
+
inputScope: {},
|
|
687
|
+
omniConfigHash: input.omniConfigHash,
|
|
688
|
+
outputRefs,
|
|
689
|
+
...reused !== void 0 ? { reusedExecutionId: reused.executionId } : {},
|
|
690
|
+
startedAt: input.startedAt,
|
|
691
|
+
completedAt: input.completedAt
|
|
692
|
+
};
|
|
693
|
+
snapshot.executions[executionId] = execution;
|
|
694
|
+
return {
|
|
695
|
+
commit: { executionId, mediaBindings, created: true },
|
|
696
|
+
changed: true
|
|
697
|
+
};
|
|
698
|
+
}
|
|
699
|
+
__name(commitExecution, "commitExecution");
|
|
700
|
+
|
|
701
|
+
// packages/core/src/services/media-memory/recall.ts
|
|
702
|
+
init_esbuild_shims();
|
|
703
|
+
import fs2 from "node:fs/promises";
|
|
704
|
+
var debugLogger3 = createDebugLogger("omni:memory");
|
|
705
|
+
var CANDIDATE_DESCRIPTION_MAX_CHARS = 200;
|
|
706
|
+
var MediaMemoryRecallRejection = class extends Error {
|
|
707
|
+
constructor(reason, message) {
|
|
708
|
+
super(message);
|
|
709
|
+
this.reason = reason;
|
|
710
|
+
this.name = "MediaMemoryRecallRejection";
|
|
711
|
+
}
|
|
712
|
+
static {
|
|
713
|
+
__name(this, "MediaMemoryRecallRejection");
|
|
714
|
+
}
|
|
715
|
+
};
|
|
716
|
+
function truncateChars(text, maxChars) {
|
|
717
|
+
if (text.length <= maxChars) return text;
|
|
718
|
+
let cut = text.slice(0, maxChars);
|
|
719
|
+
const last = cut.charCodeAt(cut.length - 1);
|
|
720
|
+
if (last >= 55296 && last <= 56319) cut = cut.slice(0, -1);
|
|
721
|
+
return cut;
|
|
722
|
+
}
|
|
723
|
+
__name(truncateChars, "truncateChars");
|
|
724
|
+
function expectedChannels(mediaType) {
|
|
725
|
+
switch (mediaType) {
|
|
726
|
+
case "image":
|
|
727
|
+
return ["visual"];
|
|
728
|
+
case "audio":
|
|
729
|
+
return ["acoustic", "speech_text"];
|
|
730
|
+
case "video":
|
|
731
|
+
return ["visual", "acoustic", "speech_text"];
|
|
732
|
+
default:
|
|
733
|
+
return [];
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
__name(expectedChannels, "expectedChannels");
|
|
737
|
+
var UNSEGMENTED = /[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]/u;
|
|
738
|
+
var SEGMENT_RUN = /[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]+|[^\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]+/gu;
|
|
739
|
+
function tokenize(query) {
|
|
740
|
+
const tokens = /* @__PURE__ */ new Set();
|
|
741
|
+
for (const run of query.toLowerCase().split(/[^\p{L}\p{N}]+/u)) {
|
|
742
|
+
for (const segment of run.match(SEGMENT_RUN) ?? []) {
|
|
743
|
+
if (!UNSEGMENTED.test(segment)) {
|
|
744
|
+
if (segment.length > 1) tokens.add(segment);
|
|
745
|
+
continue;
|
|
746
|
+
}
|
|
747
|
+
const chars = [...segment];
|
|
748
|
+
if (chars.length === 1) {
|
|
749
|
+
tokens.add(segment);
|
|
750
|
+
continue;
|
|
751
|
+
}
|
|
752
|
+
for (let i = 0; i + 1 < chars.length; i++) {
|
|
753
|
+
tokens.add(chars[i] + chars[i + 1]);
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
return [...tokens];
|
|
758
|
+
}
|
|
759
|
+
__name(tokenize, "tokenize");
|
|
760
|
+
function scopeMatches(requested, entryScope) {
|
|
761
|
+
const want = requested?.temporal;
|
|
762
|
+
const have = entryScope.temporal;
|
|
763
|
+
if (!want || !have) return true;
|
|
764
|
+
return have.startMs < want.endMs && have.endMs > want.startMs;
|
|
765
|
+
}
|
|
766
|
+
__name(scopeMatches, "scopeMatches");
|
|
767
|
+
function orderCandidates(candidates) {
|
|
768
|
+
return [...candidates].sort(
|
|
769
|
+
(a, b) => b.createdAt.localeCompare(a.createdAt) || a.entry.entryId.localeCompare(b.entry.entryId)
|
|
770
|
+
);
|
|
771
|
+
}
|
|
772
|
+
__name(orderCandidates, "orderCandidates");
|
|
773
|
+
function indexSnapshot(snapshot) {
|
|
774
|
+
const childrenByParent = /* @__PURE__ */ new Map();
|
|
775
|
+
const versionsByFile = /* @__PURE__ */ new Map();
|
|
776
|
+
for (const version of Object.values(snapshot.versions)) {
|
|
777
|
+
if (version.parentVersionId) {
|
|
778
|
+
const list = childrenByParent.get(version.parentVersionId) ?? [];
|
|
779
|
+
list.push(version);
|
|
780
|
+
childrenByParent.set(version.parentVersionId, list);
|
|
781
|
+
}
|
|
782
|
+
const byFile = versionsByFile.get(version.fileId) ?? [];
|
|
783
|
+
byFile.push(version);
|
|
784
|
+
versionsByFile.set(version.fileId, byFile);
|
|
785
|
+
}
|
|
786
|
+
const entriesByParent = /* @__PURE__ */ new Map();
|
|
787
|
+
for (const entry of Object.values(snapshot.entries)) {
|
|
788
|
+
const list = entriesByParent.get(entry.parentVersionId) ?? [];
|
|
789
|
+
list.push(entry);
|
|
790
|
+
entriesByParent.set(entry.parentVersionId, list);
|
|
791
|
+
}
|
|
792
|
+
const executionsBySource = /* @__PURE__ */ new Map();
|
|
793
|
+
for (const execution of Object.values(snapshot.executions)) {
|
|
794
|
+
const list = executionsBySource.get(execution.sourceVersionId) ?? [];
|
|
795
|
+
list.push(execution);
|
|
796
|
+
executionsBySource.set(execution.sourceVersionId, list);
|
|
797
|
+
}
|
|
798
|
+
return {
|
|
799
|
+
childrenByParent,
|
|
800
|
+
entriesByParent,
|
|
801
|
+
executionsBySource,
|
|
802
|
+
versionsByFile
|
|
803
|
+
};
|
|
804
|
+
}
|
|
805
|
+
__name(indexSnapshot, "indexSnapshot");
|
|
806
|
+
function derivedSubgraph(snapshot, indexes, start, rootFileId) {
|
|
807
|
+
const result = [];
|
|
808
|
+
const visited = /* @__PURE__ */ new Set();
|
|
809
|
+
const queue = [start];
|
|
810
|
+
while (queue.length > 0) {
|
|
811
|
+
const version = queue.shift();
|
|
812
|
+
if (visited.has(version.fileVersionId)) continue;
|
|
813
|
+
visited.add(version.fileVersionId);
|
|
814
|
+
const file = snapshot.files[version.fileId];
|
|
815
|
+
if (!file || file.rootFileId !== rootFileId) continue;
|
|
816
|
+
result.push(version);
|
|
817
|
+
for (const child of indexes.childrenByParent.get(version.fileVersionId) ?? []) {
|
|
818
|
+
queue.push(child);
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
return result;
|
|
822
|
+
}
|
|
823
|
+
__name(derivedSubgraph, "derivedSubgraph");
|
|
824
|
+
function provenanceOf(execution) {
|
|
825
|
+
if (!execution) return { omniConfigHash: "" };
|
|
826
|
+
const origin = execution.executionOrigin;
|
|
827
|
+
return {
|
|
828
|
+
toolName: execution.toolName,
|
|
829
|
+
...execution.toolVersion !== void 0 ? { toolVersion: execution.toolVersion } : {},
|
|
830
|
+
...origin.kind === "fixed_policy" ? { policyId: origin.policyId, stage: origin.stage } : {},
|
|
831
|
+
omniConfigHash: execution.omniConfigHash
|
|
832
|
+
};
|
|
833
|
+
}
|
|
834
|
+
__name(provenanceOf, "provenanceOf");
|
|
835
|
+
var MediaMemoryRecallService = class {
|
|
836
|
+
constructor(omniRootDir, config, registry, options) {
|
|
837
|
+
this.config = config;
|
|
838
|
+
this.registry = registry;
|
|
839
|
+
this.options = options;
|
|
840
|
+
this.store = new MediaMemoryStore(omniRootDir);
|
|
841
|
+
}
|
|
842
|
+
static {
|
|
843
|
+
__name(this, "MediaMemoryRecallService");
|
|
844
|
+
}
|
|
845
|
+
store;
|
|
846
|
+
/**
|
|
847
|
+
* Execute one recall request. Throws {@link MediaMemoryRecallRejection}
|
|
848
|
+
* when the request itself is invalid (empty, or referencing a handle
|
|
849
|
+
* this session never issued); an unreadable store degrades to a plain
|
|
850
|
+
* miss — recall is an enhancement and must never break the caller.
|
|
851
|
+
*/
|
|
852
|
+
async recall(request) {
|
|
853
|
+
const bindings = this.resolveBindings(request.resourceIds);
|
|
854
|
+
const miss = {
|
|
855
|
+
status: "miss",
|
|
856
|
+
files: [],
|
|
857
|
+
entries: [],
|
|
858
|
+
gaps: []
|
|
859
|
+
};
|
|
860
|
+
try {
|
|
861
|
+
return await this.store.read(
|
|
862
|
+
miss,
|
|
863
|
+
(snapshot) => this.recallFromSnapshot(snapshot, request, bindings)
|
|
864
|
+
);
|
|
865
|
+
} catch (err) {
|
|
866
|
+
debugLogger3.debug(
|
|
867
|
+
`recall failed: ${err instanceof Error ? err.message : err}`
|
|
868
|
+
);
|
|
869
|
+
return miss;
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
/**
|
|
873
|
+
* Bounded candidate manifest for the sideQuery selector (M §9.3): every
|
|
874
|
+
* entry reachable from the named resources — same root-bounded walk as
|
|
875
|
+
* {@link recall}, configured kinds, current-version-first — summarized
|
|
876
|
+
* without full text/paths and capped at `sideQuery.maxCandidateEntries`
|
|
877
|
+
* (newest first; deterministic tiebreak). Rejections propagate like
|
|
878
|
+
* {@link recall}; an unreadable store degrades to an empty manifest.
|
|
879
|
+
*/
|
|
880
|
+
async candidateSummaries(resourceIds) {
|
|
881
|
+
const bindings = this.resolveBindings(resourceIds);
|
|
882
|
+
const request = { resourceIds, query: "" };
|
|
883
|
+
return await this.store.read(
|
|
884
|
+
[],
|
|
885
|
+
async (snapshot) => {
|
|
886
|
+
const { candidates } = await this.collectFromSnapshot(
|
|
887
|
+
snapshot,
|
|
888
|
+
request,
|
|
889
|
+
bindings
|
|
890
|
+
);
|
|
891
|
+
return orderCandidates([...candidates.values()]).slice(0, this.config.sideQuery.maxCandidateEntries).map((candidate) => ({
|
|
892
|
+
entryId: candidate.entry.entryId,
|
|
893
|
+
kind: candidate.entry.kind,
|
|
894
|
+
...candidate.entry.role !== void 0 ? { role: candidate.entry.role } : {},
|
|
895
|
+
scope: candidate.entry.scope,
|
|
896
|
+
channels: candidate.entry.channels,
|
|
897
|
+
coverage: candidate.entry.coverage,
|
|
898
|
+
...candidate.entry.content !== void 0 ? {
|
|
899
|
+
description: truncateChars(
|
|
900
|
+
candidate.entry.content,
|
|
901
|
+
CANDIDATE_DESCRIPTION_MAX_CHARS
|
|
902
|
+
)
|
|
903
|
+
} : {},
|
|
904
|
+
...candidate.entry.provenance.toolName !== void 0 ? { producer: candidate.entry.provenance.toolName } : {}
|
|
905
|
+
}));
|
|
906
|
+
}
|
|
907
|
+
);
|
|
908
|
+
}
|
|
909
|
+
/**
|
|
910
|
+
* Materialize a selector's picks by the unified protocol (M §9.3): the
|
|
911
|
+
* selection must be a subset of the manifest {@link candidateSummaries}
|
|
912
|
+
* would produce for the same resources and within
|
|
913
|
+
* `sideQuery.maxSelectedEntries` — anything else (unknown id, cross-root
|
|
914
|
+
* id, over budget) rejects the WHOLE selection with `invalid_selection`,
|
|
915
|
+
* never a partial fulfilment.
|
|
916
|
+
*/
|
|
917
|
+
async recallSelection(resourceIds, entryIds) {
|
|
918
|
+
const bindings = this.resolveBindings(resourceIds);
|
|
919
|
+
const selectedIds = [...new Set(entryIds)];
|
|
920
|
+
if (selectedIds.length > this.config.sideQuery.maxSelectedEntries) {
|
|
921
|
+
throw new MediaMemoryRecallRejection(
|
|
922
|
+
"invalid_selection",
|
|
923
|
+
`selector returned ${selectedIds.length} entryIds; at most ${this.config.sideQuery.maxSelectedEntries} may be selected`
|
|
924
|
+
);
|
|
925
|
+
}
|
|
926
|
+
const request = { resourceIds, query: "" };
|
|
927
|
+
return await this.store.read(
|
|
928
|
+
{
|
|
929
|
+
status: "miss",
|
|
930
|
+
files: [],
|
|
931
|
+
entries: [],
|
|
932
|
+
gaps: []
|
|
933
|
+
},
|
|
934
|
+
async (snapshot) => {
|
|
935
|
+
const collected = await this.collectFromSnapshot(
|
|
936
|
+
snapshot,
|
|
937
|
+
request,
|
|
938
|
+
bindings
|
|
939
|
+
);
|
|
940
|
+
const manifest = new Map(
|
|
941
|
+
orderCandidates([...collected.candidates.values()]).slice(0, this.config.sideQuery.maxCandidateEntries).map((candidate) => [candidate.entry.entryId, candidate])
|
|
942
|
+
);
|
|
943
|
+
const selected = [];
|
|
944
|
+
for (const entryId of selectedIds) {
|
|
945
|
+
const candidate = manifest.get(entryId);
|
|
946
|
+
if (!candidate) {
|
|
947
|
+
throw new MediaMemoryRecallRejection(
|
|
948
|
+
"invalid_selection",
|
|
949
|
+
`selector returned entryId ${entryId} that is not in the candidate manifest`
|
|
950
|
+
);
|
|
951
|
+
}
|
|
952
|
+
selected.push(candidate);
|
|
953
|
+
}
|
|
954
|
+
return this.finishResult(snapshot, selected, collected);
|
|
955
|
+
}
|
|
956
|
+
);
|
|
957
|
+
}
|
|
958
|
+
/** Shared request validation (M §9.2): every identifier must resolve to a
|
|
959
|
+
* binding THIS session issued; an empty list or an unresolvable identifier
|
|
960
|
+
* rejects the whole request.
|
|
961
|
+
*
|
|
962
|
+
* A model-visible local source is annotated with its ABSOLUTE PATH rather
|
|
963
|
+
* than a handle, and the model passes that path here. `resolveMediaReference`
|
|
964
|
+
* resolves each identifier as a handle first (the common case), then as a
|
|
965
|
+
* session-bound fileRef — the path form rides VERBATIM (never escaped), so a
|
|
966
|
+
* native Windows path or a `:`-bearing name matches the raw `fileRef` the
|
|
967
|
+
* registry stores byte-for-byte. So the displayed path recalls exactly as
|
|
968
|
+
* the handle would. An identifier that is neither still rejects the whole
|
|
969
|
+
* request. */
|
|
970
|
+
resolveBindings(resourceIds) {
|
|
971
|
+
if (resourceIds.length === 0) {
|
|
972
|
+
throw new MediaMemoryRecallRejection(
|
|
973
|
+
"empty_request",
|
|
974
|
+
"recall request must name at least one resourceId"
|
|
975
|
+
);
|
|
976
|
+
}
|
|
977
|
+
const seen = /* @__PURE__ */ new Set();
|
|
978
|
+
const bindings = [];
|
|
979
|
+
for (const resourceId of resourceIds) {
|
|
980
|
+
const binding = resolveMediaReference(this.registry, resourceId);
|
|
981
|
+
if (!binding) {
|
|
982
|
+
throw new MediaMemoryRecallRejection(
|
|
983
|
+
"unknown_resource",
|
|
984
|
+
`reference ${resourceId} matches no media delivered this session (neither a session handle nor the path of a file read this session)`
|
|
985
|
+
);
|
|
986
|
+
}
|
|
987
|
+
if (seen.has(binding.resourceId)) continue;
|
|
988
|
+
seen.add(binding.resourceId);
|
|
989
|
+
bindings.push(binding);
|
|
990
|
+
}
|
|
991
|
+
return bindings;
|
|
992
|
+
}
|
|
993
|
+
async recallFromSnapshot(snapshot, request, bindings) {
|
|
994
|
+
const collected = await this.collectFromSnapshot(
|
|
995
|
+
snapshot,
|
|
996
|
+
request,
|
|
997
|
+
bindings
|
|
998
|
+
);
|
|
999
|
+
const limit = Math.min(
|
|
1000
|
+
request.limit ?? this.config.maxEntries,
|
|
1001
|
+
this.config.maxEntries
|
|
1002
|
+
);
|
|
1003
|
+
const entries = rankAndSlice(
|
|
1004
|
+
[...collected.candidates.values()],
|
|
1005
|
+
request.query,
|
|
1006
|
+
limit
|
|
1007
|
+
);
|
|
1008
|
+
return this.finishResult(snapshot, entries, collected);
|
|
1009
|
+
}
|
|
1010
|
+
/** The shared walk both recall shapes sit on: resolve each binding to
|
|
1011
|
+
* its file, list consulted versions (current-first §9.5), collect
|
|
1012
|
+
* candidate entries across the root-bounded derivation subgraph, and
|
|
1013
|
+
* derive the CURRENT version's honest gaps. */
|
|
1014
|
+
async collectFromSnapshot(snapshot, request, bindings) {
|
|
1015
|
+
const indexes = indexSnapshot(snapshot);
|
|
1016
|
+
const kinds = this.effectiveKinds(request);
|
|
1017
|
+
const includeHistorical = request.includeHistoricalVersions ?? this.config.includeHistoricalVersions;
|
|
1018
|
+
const files = /* @__PURE__ */ new Map();
|
|
1019
|
+
const candidates = /* @__PURE__ */ new Map();
|
|
1020
|
+
const gaps = [];
|
|
1021
|
+
for (const binding of bindings) {
|
|
1022
|
+
if (!binding) continue;
|
|
1023
|
+
const boundVersion = snapshot.versions[binding.fileVersionId];
|
|
1024
|
+
const file = boundVersion ? snapshot.files[boundVersion.fileId] : void 0;
|
|
1025
|
+
if (!boundVersion || !file) {
|
|
1026
|
+
gaps.push({
|
|
1027
|
+
scope: {},
|
|
1028
|
+
channels: expectedChannels(binding.mediaType),
|
|
1029
|
+
reason: "artifact_unavailable",
|
|
1030
|
+
forResourceId: binding.resourceId,
|
|
1031
|
+
mediaType: binding.mediaType
|
|
1032
|
+
});
|
|
1033
|
+
continue;
|
|
1034
|
+
}
|
|
1035
|
+
const fileVersions = indexes.versionsByFile.get(file.fileId) ?? [];
|
|
1036
|
+
const currentVersion = snapshot.versions[file.currentVersionId];
|
|
1037
|
+
const consulted = includeHistorical ? [...fileVersions].sort(
|
|
1038
|
+
(a, b) => b.createdAt.localeCompare(a.createdAt)
|
|
1039
|
+
) : currentVersion ? [currentVersion] : [];
|
|
1040
|
+
for (const version of consulted) {
|
|
1041
|
+
files.set(version.fileVersionId, {
|
|
1042
|
+
fileId: file.fileId,
|
|
1043
|
+
fileVersionId: version.fileVersionId,
|
|
1044
|
+
current: version.fileVersionId === file.currentVersionId,
|
|
1045
|
+
mediaType: version.mediaType
|
|
1046
|
+
});
|
|
1047
|
+
}
|
|
1048
|
+
if (!files.has(binding.fileVersionId)) {
|
|
1049
|
+
files.set(binding.fileVersionId, {
|
|
1050
|
+
fileId: file.fileId,
|
|
1051
|
+
fileVersionId: binding.fileVersionId,
|
|
1052
|
+
current: false,
|
|
1053
|
+
mediaType: boundVersion.mediaType
|
|
1054
|
+
});
|
|
1055
|
+
}
|
|
1056
|
+
for (const version of consulted) {
|
|
1057
|
+
await this.collectVersion(
|
|
1058
|
+
snapshot,
|
|
1059
|
+
indexes,
|
|
1060
|
+
binding.resourceId,
|
|
1061
|
+
binding.rootFileId,
|
|
1062
|
+
version,
|
|
1063
|
+
kinds,
|
|
1064
|
+
request,
|
|
1065
|
+
candidates
|
|
1066
|
+
);
|
|
1067
|
+
}
|
|
1068
|
+
if (currentVersion) {
|
|
1069
|
+
gaps.push(
|
|
1070
|
+
...await this.gapsForVersion(
|
|
1071
|
+
snapshot,
|
|
1072
|
+
indexes,
|
|
1073
|
+
binding.resourceId,
|
|
1074
|
+
binding.rootFileId,
|
|
1075
|
+
file.fileRef,
|
|
1076
|
+
currentVersion
|
|
1077
|
+
)
|
|
1078
|
+
);
|
|
1079
|
+
}
|
|
1080
|
+
}
|
|
1081
|
+
return { files, candidates, gaps };
|
|
1082
|
+
}
|
|
1083
|
+
/** Availability pass + assembly shared by both recall shapes: bind a
|
|
1084
|
+
* session handle for each returned derived artifact still on disk,
|
|
1085
|
+
* degrade the lost ones to gaps, derive advisor suggestions and the
|
|
1086
|
+
* hit/partial/miss verdict. */
|
|
1087
|
+
async finishResult(snapshot, entries, collected) {
|
|
1088
|
+
const { files, gaps } = collected;
|
|
1089
|
+
for (const candidate of entries) {
|
|
1090
|
+
const derived = candidate.derived;
|
|
1091
|
+
if (!derived) continue;
|
|
1092
|
+
if (await pathExists(derived.fileRef)) {
|
|
1093
|
+
candidate.entry.resourceId = this.registry.bind({
|
|
1094
|
+
fileId: derived.fileId,
|
|
1095
|
+
fileVersionId: derived.versionId,
|
|
1096
|
+
rootFileId: snapshot.files[derived.fileId]?.rootFileId ?? derived.fileId,
|
|
1097
|
+
fileRef: derived.fileRef,
|
|
1098
|
+
mediaType: derived.mediaType
|
|
1099
|
+
}).resourceId;
|
|
1100
|
+
} else {
|
|
1101
|
+
gaps.push({
|
|
1102
|
+
scope: candidate.entry.scope,
|
|
1103
|
+
channels: candidate.entry.channels,
|
|
1104
|
+
reason: "artifact_unavailable",
|
|
1105
|
+
forResourceId: candidate.forResourceId,
|
|
1106
|
+
mediaType: derived.mediaType
|
|
1107
|
+
});
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1110
|
+
const resultEntries = entries.map((c) => c.entry);
|
|
1111
|
+
const resultGaps = gaps.map(
|
|
1112
|
+
({ scope, channels, reason }) => ({ scope, channels, reason })
|
|
1113
|
+
);
|
|
1114
|
+
const nextPolicyActions = this.options?.advise ? gaps.flatMap(
|
|
1115
|
+
(gap) => this.options.advise({
|
|
1116
|
+
resourceId: gap.forResourceId,
|
|
1117
|
+
mediaType: gap.mediaType,
|
|
1118
|
+
gap: {
|
|
1119
|
+
scope: gap.scope,
|
|
1120
|
+
channels: gap.channels,
|
|
1121
|
+
reason: gap.reason
|
|
1122
|
+
}
|
|
1123
|
+
})
|
|
1124
|
+
) : [];
|
|
1125
|
+
const status = resultEntries.length === 0 ? "miss" : resultGaps.length > 0 ? "partial" : "hit";
|
|
1126
|
+
const matched = collected.candidates.size;
|
|
1127
|
+
return {
|
|
1128
|
+
status,
|
|
1129
|
+
files: [...files.values()],
|
|
1130
|
+
entries: resultEntries,
|
|
1131
|
+
gaps: resultGaps,
|
|
1132
|
+
...nextPolicyActions.length > 0 ? { nextPolicyActions } : {},
|
|
1133
|
+
...matched > resultEntries.length ? { matchedEntries: matched } : {}
|
|
1134
|
+
};
|
|
1135
|
+
}
|
|
1136
|
+
/** Request kinds narrowed to what configuration allows; an absent
|
|
1137
|
+
* request filter means "everything configured". */
|
|
1138
|
+
effectiveKinds(request) {
|
|
1139
|
+
const allowed = new Set(this.config.kinds);
|
|
1140
|
+
if (!request.kinds) return allowed;
|
|
1141
|
+
return new Set(request.kinds.filter((k) => allowed.has(k)));
|
|
1142
|
+
}
|
|
1143
|
+
/** Collect every matching entry reachable from one consulted version:
|
|
1144
|
+
* synthesized metadata for the version itself, then policy outputs and
|
|
1145
|
+
* executions across its whole derivation subgraph (the transcript of an
|
|
1146
|
+
* extracted audio track parents on the AUDIO version — only the
|
|
1147
|
+
* subgraph walk surfaces it for the movie's handle). */
|
|
1148
|
+
async collectVersion(snapshot, indexes, forResourceId, rootFileId, version, kinds, request, out) {
|
|
1149
|
+
const rolesFilter = request.roles;
|
|
1150
|
+
if (kinds.has("metadata") && !rolesFilter) {
|
|
1151
|
+
const entryId = `metadata:${version.fileVersionId}`;
|
|
1152
|
+
out.set(entryId, {
|
|
1153
|
+
entry: {
|
|
1154
|
+
entryId,
|
|
1155
|
+
kind: "metadata",
|
|
1156
|
+
content: truncateChars(
|
|
1157
|
+
JSON.stringify({
|
|
1158
|
+
mediaType: version.mediaType,
|
|
1159
|
+
mimeType: version.mimeType,
|
|
1160
|
+
sizeBytes: version.sizeBytes,
|
|
1161
|
+
source: version.source,
|
|
1162
|
+
...version.metadata
|
|
1163
|
+
}),
|
|
1164
|
+
this.config.maxTextChars
|
|
1165
|
+
),
|
|
1166
|
+
scope: {},
|
|
1167
|
+
channels: ["technical_metadata"],
|
|
1168
|
+
coverage: { mode: "complete", scope: {} },
|
|
1169
|
+
evidenceRefs: [{ fileVersionId: version.fileVersionId }],
|
|
1170
|
+
provenance: {
|
|
1171
|
+
omniConfigHash: version.recognition.ingestionConfigHash
|
|
1172
|
+
}
|
|
1173
|
+
},
|
|
1174
|
+
createdAt: version.createdAt,
|
|
1175
|
+
forResourceId
|
|
1176
|
+
});
|
|
1177
|
+
}
|
|
1178
|
+
for (const node of derivedSubgraph(
|
|
1179
|
+
snapshot,
|
|
1180
|
+
indexes,
|
|
1181
|
+
version,
|
|
1182
|
+
rootFileId
|
|
1183
|
+
)) {
|
|
1184
|
+
if (kinds.has("derived_media") || kinds.has("policy_result")) {
|
|
1185
|
+
for (const entry of indexes.entriesByParent.get(node.fileVersionId) ?? []) {
|
|
1186
|
+
if (!kinds.has(entry.kind)) continue;
|
|
1187
|
+
if (rolesFilter && (!entry.role || !rolesFilter.includes(entry.role)))
|
|
1188
|
+
continue;
|
|
1189
|
+
if (!scopeMatches(request.scope, entry.scope)) continue;
|
|
1190
|
+
const execution = snapshot.executions[entry.producedByExecutionId];
|
|
1191
|
+
const derivedVersion = entry.derivedVersionId ? snapshot.versions[entry.derivedVersionId] : void 0;
|
|
1192
|
+
out.set(entry.outputId, {
|
|
1193
|
+
entry: {
|
|
1194
|
+
entryId: entry.outputId,
|
|
1195
|
+
kind: entry.kind,
|
|
1196
|
+
...entry.role !== void 0 ? { role: entry.role } : {},
|
|
1197
|
+
...entry.inlineText !== void 0 ? {
|
|
1198
|
+
content: truncateChars(
|
|
1199
|
+
entry.inlineText,
|
|
1200
|
+
this.config.maxTextChars
|
|
1201
|
+
),
|
|
1202
|
+
// Say so when the payload is a prefix: coverage speaks
|
|
1203
|
+
// for what was processed, so it stays `complete` and
|
|
1204
|
+
// no gap is raised — the flag is the only signal that
|
|
1205
|
+
// the model is not holding the whole text.
|
|
1206
|
+
...entry.inlineText.length > this.config.maxTextChars ? { contentTruncated: true } : {}
|
|
1207
|
+
} : {},
|
|
1208
|
+
...entry.disclosure !== void 0 ? { disclosure: entry.disclosure } : {},
|
|
1209
|
+
scope: entry.scope,
|
|
1210
|
+
channels: entry.channels,
|
|
1211
|
+
coverage: entry.coverage,
|
|
1212
|
+
evidenceRefs: [
|
|
1213
|
+
{
|
|
1214
|
+
fileVersionId: entry.parentVersionId,
|
|
1215
|
+
executionId: entry.producedByExecutionId
|
|
1216
|
+
}
|
|
1217
|
+
],
|
|
1218
|
+
provenance: provenanceOf(execution)
|
|
1219
|
+
},
|
|
1220
|
+
createdAt: entry.createdAt,
|
|
1221
|
+
forResourceId,
|
|
1222
|
+
...derivedVersion ? {
|
|
1223
|
+
derived: {
|
|
1224
|
+
versionId: derivedVersion.fileVersionId,
|
|
1225
|
+
fileId: derivedVersion.fileId,
|
|
1226
|
+
fileRef: snapshot.files[derivedVersion.fileId]?.fileRef ?? "",
|
|
1227
|
+
mediaType: derivedVersion.mediaType
|
|
1228
|
+
}
|
|
1229
|
+
} : {}
|
|
1230
|
+
});
|
|
1231
|
+
}
|
|
1232
|
+
}
|
|
1233
|
+
if (kinds.has("execution") && !rolesFilter) {
|
|
1234
|
+
for (const execution of indexes.executionsBySource.get(
|
|
1235
|
+
node.fileVersionId
|
|
1236
|
+
) ?? []) {
|
|
1237
|
+
if (!scopeMatches(request.scope, execution.inputScope)) continue;
|
|
1238
|
+
const entryId = `execution:${execution.executionId}`;
|
|
1239
|
+
out.set(entryId, {
|
|
1240
|
+
entry: {
|
|
1241
|
+
entryId,
|
|
1242
|
+
kind: "execution",
|
|
1243
|
+
content: truncateChars(
|
|
1244
|
+
JSON.stringify({
|
|
1245
|
+
toolName: execution.toolName,
|
|
1246
|
+
...execution.toolVersion !== void 0 ? { toolVersion: execution.toolVersion } : {},
|
|
1247
|
+
finalArguments: execution.finalArguments,
|
|
1248
|
+
completedAt: execution.completedAt,
|
|
1249
|
+
outputCount: execution.outputRefs.length
|
|
1250
|
+
}),
|
|
1251
|
+
this.config.maxTextChars
|
|
1252
|
+
),
|
|
1253
|
+
scope: execution.inputScope,
|
|
1254
|
+
channels: [],
|
|
1255
|
+
coverage: { mode: "complete", scope: execution.inputScope },
|
|
1256
|
+
evidenceRefs: [
|
|
1257
|
+
{
|
|
1258
|
+
fileVersionId: execution.sourceVersionId,
|
|
1259
|
+
executionId: execution.executionId
|
|
1260
|
+
}
|
|
1261
|
+
],
|
|
1262
|
+
provenance: provenanceOf(execution)
|
|
1263
|
+
},
|
|
1264
|
+
createdAt: execution.completedAt,
|
|
1265
|
+
forResourceId
|
|
1266
|
+
});
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1269
|
+
}
|
|
1270
|
+
}
|
|
1271
|
+
/** Honest-gaps derivation (§9.4) for one CURRENT version: which of the
|
|
1272
|
+
* modality's expected channels have no evidence (not_processed), only
|
|
1273
|
+
* sampled/partial evidence (partial_coverage), and whether the source
|
|
1274
|
+
* bytes themselves are still on disk (artifact_unavailable, D5). Gap
|
|
1275
|
+
* truth is computed from the FULL subgraph, unfiltered — what the
|
|
1276
|
+
* request chose to see never changes what was processed. */
|
|
1277
|
+
async gapsForVersion(snapshot, indexes, forResourceId, rootFileId, fileRef, version) {
|
|
1278
|
+
const gaps = [];
|
|
1279
|
+
if (!await pathExists(fileRef)) {
|
|
1280
|
+
return [
|
|
1281
|
+
{
|
|
1282
|
+
scope: {},
|
|
1283
|
+
channels: expectedChannels(version.mediaType),
|
|
1284
|
+
reason: "artifact_unavailable",
|
|
1285
|
+
forResourceId,
|
|
1286
|
+
mediaType: version.mediaType
|
|
1287
|
+
}
|
|
1288
|
+
];
|
|
1289
|
+
}
|
|
1290
|
+
const complete = /* @__PURE__ */ new Set();
|
|
1291
|
+
const partial = /* @__PURE__ */ new Set();
|
|
1292
|
+
for (const node of derivedSubgraph(
|
|
1293
|
+
snapshot,
|
|
1294
|
+
indexes,
|
|
1295
|
+
version,
|
|
1296
|
+
rootFileId
|
|
1297
|
+
)) {
|
|
1298
|
+
for (const entry of indexes.entriesByParent.get(node.fileVersionId) ?? []) {
|
|
1299
|
+
const full = entry.coverage.mode === "complete" || entry.coverage.mode === "continuous";
|
|
1300
|
+
for (const channel of entry.channels) {
|
|
1301
|
+
(full ? complete : partial).add(channel);
|
|
1302
|
+
}
|
|
1303
|
+
}
|
|
1304
|
+
}
|
|
1305
|
+
const notProcessed = [];
|
|
1306
|
+
const partialOnly = [];
|
|
1307
|
+
for (const channel of expectedChannels(version.mediaType)) {
|
|
1308
|
+
if (complete.has(channel)) continue;
|
|
1309
|
+
(partial.has(channel) ? partialOnly : notProcessed).push(channel);
|
|
1310
|
+
}
|
|
1311
|
+
if (notProcessed.length > 0) {
|
|
1312
|
+
gaps.push({
|
|
1313
|
+
scope: {},
|
|
1314
|
+
channels: notProcessed,
|
|
1315
|
+
reason: "not_processed",
|
|
1316
|
+
forResourceId,
|
|
1317
|
+
mediaType: version.mediaType
|
|
1318
|
+
});
|
|
1319
|
+
}
|
|
1320
|
+
if (partialOnly.length > 0) {
|
|
1321
|
+
gaps.push({
|
|
1322
|
+
scope: {},
|
|
1323
|
+
channels: partialOnly,
|
|
1324
|
+
reason: "partial_coverage",
|
|
1325
|
+
forResourceId,
|
|
1326
|
+
mediaType: version.mediaType
|
|
1327
|
+
});
|
|
1328
|
+
}
|
|
1329
|
+
return gaps;
|
|
1330
|
+
}
|
|
1331
|
+
};
|
|
1332
|
+
async function pathExists(fileRef) {
|
|
1333
|
+
if (!fileRef) return false;
|
|
1334
|
+
try {
|
|
1335
|
+
await fs2.access(fileRef);
|
|
1336
|
+
return true;
|
|
1337
|
+
} catch {
|
|
1338
|
+
return false;
|
|
1339
|
+
}
|
|
1340
|
+
}
|
|
1341
|
+
__name(pathExists, "pathExists");
|
|
1342
|
+
function rankAndSlice(candidates, query, limit) {
|
|
1343
|
+
const tokens = tokenize(query);
|
|
1344
|
+
const scored = candidates.map((candidate) => {
|
|
1345
|
+
const haystack = [
|
|
1346
|
+
candidate.entry.role ?? "",
|
|
1347
|
+
candidate.entry.content ?? "",
|
|
1348
|
+
candidate.entry.provenance.toolName ?? ""
|
|
1349
|
+
].join(" ").toLowerCase();
|
|
1350
|
+
let score = 0;
|
|
1351
|
+
for (const token of tokens) {
|
|
1352
|
+
if (haystack.includes(token)) score += 1;
|
|
1353
|
+
}
|
|
1354
|
+
return { candidate, score };
|
|
1355
|
+
});
|
|
1356
|
+
scored.sort(
|
|
1357
|
+
(a, b) => b.score - a.score || b.candidate.createdAt.localeCompare(a.candidate.createdAt) || a.candidate.entry.entryId.localeCompare(b.candidate.entry.entryId)
|
|
1358
|
+
);
|
|
1359
|
+
return scored.slice(0, Math.max(0, limit)).map((s) => s.candidate);
|
|
1360
|
+
}
|
|
1361
|
+
__name(rankAndSlice, "rankAndSlice");
|
|
1362
|
+
|
|
1363
|
+
// packages/core/src/services/media-memory/index.ts
|
|
1364
|
+
init_esbuild_shims();
|
|
1365
|
+
|
|
1366
|
+
export {
|
|
1367
|
+
MEDIA_MEMORY_FILE_NAME,
|
|
1368
|
+
MEDIA_DETECTOR_VERSION,
|
|
1369
|
+
MediaMemoryService,
|
|
1370
|
+
MediaMemoryRecallRejection,
|
|
1371
|
+
MediaMemoryRecallService
|
|
1372
|
+
};
|
|
1373
|
+
/**
|
|
1374
|
+
* @license
|
|
1375
|
+
* Copyright 2025 Google LLC
|
|
1376
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
1377
|
+
*/
|