@qwen-code/qwen-code 0.24.5-preview.0 → 0.24.5
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/browser-use/SKILL.md +11 -10
- package/bundled/browser-use/runtime/index.js +70 -31
- package/bundled/browser-use/runtime/native-host.js +1 -0
- package/bundled/browser-use/runtime/scripts/native-host-setup.js +1 -0
- package/bundled/computer-use/SKILL.md +182 -224
- package/bundled/qc-helper/docs/configuration/model-providers.md +13 -2
- package/bundled/qc-helper/docs/conversations-recovery.md +10 -0
- package/bundled/qc-helper/docs/features/browser-use.md +22 -12
- package/bundled/qc-helper/docs/features/channels/dingtalk.md +2 -2
- package/bundled/qc-helper/docs/features/channels/dws.md +7 -7
- package/bundled/qc-helper/docs/features/channels/feishu.md +1 -1
- package/bundled/qc-helper/docs/features/channels/github.md +13 -9
- package/bundled/qc-helper/docs/features/channels/gitlab.md +12 -5
- package/bundled/qc-helper/docs/features/channels/overview.md +121 -46
- package/bundled/qc-helper/docs/features/channels/plugins.md +12 -12
- package/bundled/qc-helper/docs/features/channels/qqbot.md +5 -5
- package/bundled/qc-helper/docs/features/channels/telegram.md +5 -5
- package/bundled/qc-helper/docs/features/channels/wecom.md +5 -4
- package/bundled/qc-helper/docs/features/channels/weixin.md +3 -3
- package/bundled/qc-helper/docs/features/code-review.md +4 -0
- package/bundled/qc-helper/docs/features/computer-use.md +1 -1
- package/bundled/qc-helper/docs/quickstart.md +14 -14
- package/bundled/qc-helper/docs/qwen-serve.md +10 -4
- package/bundled/review/SKILL.md +44 -9
- package/bundled/review/references/persistence.md +3 -4
- package/chunks/{MaxSizedBox-3RXPTLCS.js → MaxSizedBox-4MLWQHF3.js} +33 -31
- package/chunks/{StandaloneSessionPicker-74775YBZ.js → StandaloneSessionPicker-PDNU6KJJ.js} +50 -48
- package/chunks/{acp-subagent-executor-OQXOMTFK.js → acp-subagent-executor-JB2J6N73.js} +35 -33
- package/chunks/{acpAgent-MD56LD7L.js → acpAgent-CAPZFZCW.js} +123 -97
- package/chunks/{agent-75EZNG2Q.js → agent-MTWGIPWC.js} +18 -16
- package/chunks/{agent-headless-TQ6MWUDT.js → agent-headless-Z27XJSXK.js} +18 -16
- package/chunks/{anthropicContentGenerator-DCDXTX3R.js → anthropicContentGenerator-VAFZRJWG.js} +3 -3
- package/chunks/{askUserQuestion-2NU6CXK2.js → askUserQuestion-V4OFZD5D.js} +1 -1
- package/chunks/{bridge-KGJYQUWD.js → bridge-BUCSJHCE.js} +35 -33
- package/chunks/{channel-management-service-YN4A3BJ6.js → channel-management-service-Q2B7WUPL.js} +27 -10
- package/chunks/{channel-settings-store-773UOD6B.js → channel-settings-store-U25CVEL6.js} +42 -40
- package/chunks/{channel-worker-group-AKPVHRUO.js → channel-worker-group-QNX4OIMZ.js} +5 -5
- package/chunks/{channel-worker-manager-TDAQSKWX.js → channel-worker-manager-IJCPV4WY.js} +24 -5
- package/chunks/{channel-worker-supervisor-PUMSN4J2.js → channel-worker-supervisor-ENJ2AE2N.js} +4 -4
- package/chunks/{chunk-OU4ZCLGJ.js → chunk-242INZ6Y.js} +1 -1
- package/chunks/{chunk-JOFZBTVL.js → chunk-245NB3M4.js} +1 -1
- package/chunks/{chunk-LISITUEH.js → chunk-26KGIWIW.js} +1 -1
- package/chunks/{chunk-WPHZEGFC.js → chunk-2RQEWY2P.js} +1 -1
- package/chunks/{chunk-DCTJ3GVF.js → chunk-2SCE6YR2.js} +3 -3
- package/chunks/{chunk-STKUN7BR.js → chunk-2XNGG7R3.js} +1 -1
- package/chunks/{chunk-OQE7AA2W.js → chunk-36ZMEEBW.js} +16 -12
- package/chunks/{chunk-Y53WH7VD.js → chunk-44K6Q5AW.js} +3 -3
- package/chunks/{chunk-N4VKU36J.js → chunk-465XOJLQ.js} +1 -1
- package/chunks/{chunk-HD4IXPPC.js → chunk-4A4XNQEZ.js} +3 -3
- package/chunks/{chunk-RXB6Y33E.js → chunk-4VULJ3LV.js} +1 -1
- package/chunks/{chunk-EBRC4GX2.js → chunk-4XXUGJJS.js} +1 -1
- package/chunks/{chunk-MVC4XLNM.js → chunk-53IRNMPU.js} +118 -5
- package/chunks/{chunk-VGLXXHTF.js → chunk-5BLOZPTW.js} +1 -1
- package/chunks/{chunk-3SK2A75W.js → chunk-5OJQLD3P.js} +3 -3
- package/chunks/{chunk-WVNCMGAO.js → chunk-6FURC4LI.js} +1 -1
- package/chunks/{chunk-WVTM33Q3.js → chunk-6KXQIDK2.js} +4 -4
- package/chunks/{chunk-ZKDUQHU4.js → chunk-7MNHZUTA.js} +35 -18
- package/chunks/{chunk-JEIPBSGX.js → chunk-7P5WZQXF.js} +7 -7
- package/chunks/{chunk-GGUOO2XC.js → chunk-7RCAMBLN.js} +1 -1
- package/chunks/{chunk-FBLGI2SO.js → chunk-AAOMFXVZ.js} +7 -7
- package/chunks/{chunk-JM76TMGV.js → chunk-ACLD6C3R.js} +8798 -7901
- package/chunks/{chunk-4FCWKBOC.js → chunk-ALTMZEBU.js} +6 -6
- package/chunks/{chunk-ZHQSWNO6.js → chunk-AN62TPO6.js} +1 -1
- package/chunks/{chunk-U5DPG7JW.js → chunk-AYTI24XN.js} +1 -1
- package/chunks/{chunk-B53FO7JN.js → chunk-AZN2GSLM.js} +2 -2
- package/chunks/{chunk-6KQQPPFF.js → chunk-B3J4BSPL.js} +1 -1
- package/chunks/{chunk-SLSH5TFD.js → chunk-BMCDSO77.js} +4 -4
- package/chunks/{chunk-DBYUN4U3.js → chunk-BUDUHXX3.js} +1 -1
- package/chunks/{chunk-TS4Y2MHO.js → chunk-CGREZDGO.js} +1 -1
- package/chunks/chunk-CLNDQINM.js +523 -0
- package/chunks/{chunk-LNUQA3OE.js → chunk-CVRZNFXO.js} +1 -1
- package/chunks/{chunk-3DBI3LLL.js → chunk-CWLTXYKP.js} +4 -4
- package/chunks/{chunk-B3XMX4SN.js → chunk-DACCX4JI.js} +4 -4
- package/chunks/{chunk-YWZOEHBT.js → chunk-DE2WI7RU.js} +192 -62
- package/chunks/{chunk-3TQVPDCN.js → chunk-DU53RB7A.js} +2 -2
- package/chunks/{chunk-2KZURPTB.js → chunk-DZCTQ2MF.js} +6 -1
- package/chunks/{chunk-35SABQFH.js → chunk-DZUNDX4M.js} +1 -1
- package/chunks/{chunk-4INF7OYV.js → chunk-ELY2U74S.js} +2 -2
- package/chunks/chunk-EMGHODF7.js +56 -0
- package/chunks/{chunk-5FZKG4JB.js → chunk-EMOTEATH.js} +1 -1
- package/chunks/{chunk-LW7WW3Z5.js → chunk-ERGQUKZ2.js} +1 -1
- package/chunks/{chunk-TNWJJEDT.js → chunk-ES6EQNGR.js} +6 -6
- package/chunks/{chunk-E3TLOFX7.js → chunk-EUHSEMO4.js} +62 -7
- package/chunks/{chunk-N25B6FZN.js → chunk-EYCDA5MN.js} +2 -0
- package/chunks/{chunk-GPTEZLRR.js → chunk-F4ERRMCO.js} +25 -23
- package/chunks/{chunk-SXFZ5P7F.js → chunk-FE7D3WKV.js} +1 -1
- package/chunks/{chunk-XEXNBTYX.js → chunk-FH45BQGZ.js} +3 -3
- package/chunks/{chunk-CAORZAZD.js → chunk-FLBUHGL4.js} +10 -10
- package/chunks/{chunk-X2R47SFR.js → chunk-FLVPNMCS.js} +1 -1
- package/chunks/{chunk-5SZSV2CK.js → chunk-FVIJFKEQ.js} +3 -3
- package/chunks/{chunk-KFLDZ3HB.js → chunk-G6XRNTXF.js} +1 -1
- package/chunks/{chunk-2JHQ2J3Y.js → chunk-G72UHXC3.js} +5 -5
- package/chunks/{chunk-4A255ZI6.js → chunk-GAHZJLQG.js} +2 -2
- package/chunks/{chunk-7IVZOKKW.js → chunk-GKJGKTWJ.js} +3 -3
- package/chunks/{chunk-KY4HZXLV.js → chunk-GLPNIOEV.js} +33 -2
- package/chunks/{chunk-6PRSQUPJ.js → chunk-GQZZGEMS.js} +1 -1
- package/chunks/{chunk-G2AE7GYZ.js → chunk-GRUASRWC.js} +1 -1
- package/chunks/{chunk-HH7R6RLK.js → chunk-GTQ35GRO.js} +1 -1
- package/chunks/{chunk-LWRJLRZS.js → chunk-GYLDOFLU.js} +3 -3
- package/chunks/{chunk-MZRJ2JJS.js → chunk-HDSI3RDN.js} +136 -9
- package/chunks/{chunk-RO5K7QUL.js → chunk-HHMJ5ONX.js} +45 -31
- package/chunks/{chunk-E4HNTYHK.js → chunk-HVVQYSBA.js} +32 -9
- package/chunks/{chunk-H2GVLBFU.js → chunk-I36GIR6K.js} +64 -2
- package/chunks/{chunk-VTFLRL55.js → chunk-IBRV4T3I.js} +2 -2
- package/chunks/{chunk-4VSTV4C2.js → chunk-IH22ZGZI.js} +53 -2
- package/chunks/{chunk-AOW7WIWE.js → chunk-IQH7Q5OP.js} +4 -4
- package/chunks/{chunk-OB444SG3.js → chunk-IYKGSUTA.js} +1 -1
- package/chunks/{chunk-HS5OZTQF.js → chunk-J2FLXQJM.js} +1 -1
- package/chunks/{chunk-BBCH7PBA.js → chunk-KACKEW2M.js} +2 -2
- package/chunks/{chunk-JE3J5HFM.js → chunk-KAOHUUM7.js} +62 -251
- package/chunks/{chunk-JCMDVGPR.js → chunk-KGLPVCX7.js} +2 -2
- package/chunks/{chunk-QKXZOHHQ.js → chunk-LDURD6EP.js} +15 -62
- package/chunks/{chunk-O4IH5UEC.js → chunk-LLIYDIGU.js} +20 -20
- package/chunks/{chunk-3XHMOJCP.js → chunk-MBC3PULP.js} +1 -1
- package/chunks/{chunk-SRZA7OU4.js → chunk-MMCGLNPP.js} +6 -6
- package/chunks/{chunk-3NG2ZQAJ.js → chunk-NZC74TT2.js} +1 -1
- package/chunks/{chunk-47C3HPMW.js → chunk-O5YL6KSX.js} +47 -18
- package/chunks/{chunk-EIHZ4FFM.js → chunk-O6PPYFQN.js} +3 -3
- package/chunks/{chunk-XCU752HT.js → chunk-OICDXWXP.js} +13 -19
- package/chunks/{chunk-VJCKLKZX.js → chunk-OOU7XOZF.js} +3 -3
- package/chunks/{chunk-OM5NSL25.js → chunk-P4P7CH7H.js} +38 -38
- package/chunks/{chunk-CIS4SY3R.js → chunk-PPBZHGEQ.js} +3 -3
- package/chunks/{chunk-PB7JBAHF.js → chunk-PVBIEIVZ.js} +0 -1
- package/chunks/{chunk-GG3MO6NO.js → chunk-PWGMHXIV.js} +2 -2
- package/chunks/{chunk-6N2PJAZG.js → chunk-PX2ZOOGQ.js} +1 -1
- package/chunks/{chunk-NNN2PKPV.js → chunk-PYYPSK6Q.js} +36 -495
- package/chunks/{chunk-TKOQGFRE.js → chunk-PZOWKCPJ.js} +1 -1
- package/chunks/{chunk-PJ546DX4.js → chunk-Q36IJ74U.js} +17 -11
- package/chunks/chunk-Q4FJVWI4.js +78 -0
- package/chunks/{chunk-PA4HU5IQ.js → chunk-QATPE3SN.js} +13 -7
- package/chunks/{chunk-MBUUQJPV.js → chunk-QGKAYDES.js} +5 -5
- package/chunks/{chunk-TFBQ5CKI.js → chunk-QNEBHC2E.js} +1 -1
- package/chunks/{chunk-6NA357SF.js → chunk-QTNSMJKU.js} +1 -1
- package/chunks/{chunk-TDLEDOJN.js → chunk-QU7VULWX.js} +5 -4
- package/chunks/{chunk-LOTGIM6V.js → chunk-R3IFSY55.js} +20 -20
- package/chunks/{chunk-ZX6EZ7EH.js → chunk-RBE3WRSN.js} +3 -3
- package/chunks/{chunk-YSZ2XZTG.js → chunk-RBKZ6SK4.js} +5 -5
- package/chunks/{chunk-FLRFAPDA.js → chunk-RCL6OXZC.js} +5 -5
- package/chunks/{chunk-H4W6TJFJ.js → chunk-RONRTFAQ.js} +1 -1
- package/chunks/{chunk-ZEGLZ3MN.js → chunk-SCYKHWRM.js} +5 -5
- package/chunks/{chunk-STUJ7IMZ.js → chunk-SI7XKACY.js} +56 -56
- package/chunks/{chunk-RL2HSTEB.js → chunk-SYZPPX3O.js} +1492 -1140
- package/chunks/{chunk-VUYJRNG5.js → chunk-T7TJPVTY.js} +3 -3
- package/chunks/{chunk-4V5YKOBI.js → chunk-TF7UC7F6.js} +3 -3
- package/chunks/{chunk-NXZD3VNX.js → chunk-TL7DSR47.js} +1 -1
- package/chunks/{chunk-BVFBDXI2.js → chunk-TPFV5YZK.js} +1 -1
- package/chunks/{chunk-YIHOHHJL.js → chunk-TZHXHWEW.js} +1 -1
- package/chunks/{chunk-3X5BDEXS.js → chunk-U6RMVE5X.js} +8 -8
- package/chunks/{chunk-HRVFPNGT.js → chunk-VFNKO4FK.js} +4 -4
- package/chunks/{chunk-VPALWDQL.js → chunk-VUIH3BQL.js} +31 -12
- package/chunks/{chunk-WVNML4HH.js → chunk-VW33WARJ.js} +1 -1
- package/chunks/{chunk-MICQVBPI.js → chunk-WCLHOKAZ.js} +1 -1
- package/chunks/{chunk-KMQ2ZH3Q.js → chunk-WVWCRZ6M.js} +2 -2
- package/chunks/{chunk-5NFAKADR.js → chunk-WZCVB2ER.js} +1 -36
- package/chunks/{chunk-JNQEW7B2.js → chunk-X3A72KX5.js} +6 -6
- package/chunks/{chunk-3JSIWFNA.js → chunk-XHHUGXYW.js} +527 -135
- package/chunks/{chunk-VIA4STCR.js → chunk-YCCBLTSL.js} +3 -3
- package/chunks/{chunk-Q5IEY2TN.js → chunk-Z3I5B4DH.js} +1 -1
- package/chunks/{chunk-O346IB64.js → chunk-ZAJNI63I.js} +1 -1
- package/chunks/{chunk-QR4U27UW.js → chunk-ZJFCDRVP.js} +4 -4
- package/chunks/{codex-subagent-executor-437LQYGM.js → codex-subagent-executor-IKWULWIZ.js} +35 -33
- package/chunks/{config-utils-CVLI36KM.js → config-utils-3IOTAFBG.js} +38 -34
- package/chunks/{contextCommand-2KSW7H5F.js → contextCommand-ZKG2JFCR.js} +33 -31
- package/chunks/{core-runtime-4IB27E7J.js → core-runtime-5CAK5DSM.js} +32 -30
- package/chunks/{create-sub-session-A73TQDAN.js → create-sub-session-DG4CVOQC.js} +33 -31
- package/chunks/{daemon-Y6AOK7LF.js → daemon-D4OAVQKB.js} +1 -1
- package/chunks/{daemon-git-worktree-guard-BTKVV3DZ.js → daemon-git-worktree-guard-S3SFT3H7.js} +32 -30
- package/chunks/{daemon-status-provider-ETDIOWMS.js → daemon-status-provider-GG64ZJR3.js} +40 -38
- package/chunks/{daemon-trust-policy-U5SPHJLP.js → daemon-trust-policy-XNWYLQ32.js} +38 -36
- package/chunks/{daemon-trust-policy-monitor-QKRCO5WI.js → daemon-trust-policy-monitor-DR5CRWMM.js} +38 -36
- package/chunks/{deferred-core-runtime-FRELZPIE.js → deferred-core-runtime-V4Q674KN.js} +32 -30
- package/chunks/{dist-54LGNLWW.js → dist-3M75XY4G.js} +1 -1
- package/chunks/{dist-YZBMQPNS.js → dist-6U5NQYA7.js} +5 -5
- package/chunks/{dist-FVMLRUVM.js → dist-AS2RPYOB.js} +1 -1
- package/chunks/{dist-HANHY2MK.js → dist-GFT4GU72.js} +2 -2
- package/chunks/{dist-Y5GP7SWL.js → dist-J7JK3GPY.js} +10 -9
- package/chunks/{dist-O723VE2K.js → dist-JTPRKF5H.js} +30 -27
- package/chunks/{dist-MGZKUISU.js → dist-MOO5VOC5.js} +7 -20
- package/chunks/{dist-IZ66D5A3.js → dist-NJ2L5QKL.js} +1 -1
- package/chunks/{dist-EI2XAB4W.js → dist-YC6LDCKH.js} +22 -28
- package/chunks/{edit-TQ3CABYP.js → edit-FPIWTN3L.js} +20 -18
- package/chunks/{enter-worktree-J46XVFRS.js → enter-worktree-55OWD4LT.js} +4 -3
- package/chunks/{enterPlanMode-JHOWELZO.js → enterPlanMode-GDZVXYB2.js} +18 -16
- package/chunks/{environment-LUM7XX27.js → environment-Q2BVTUQO.js} +36 -32
- package/chunks/{errors-SH32ID5I.js → errors-MZTLVUEM.js} +34 -32
- package/chunks/{execution-sandbox-settings-HIYVUBII.js → execution-sandbox-settings-3WJ67GX3.js} +3 -1
- package/chunks/{execution-tool-IIEL25CL.js → execution-tool-DZ4XSEFZ.js} +21 -19
- package/chunks/{execution-worker-NKKEZ4XF.js → execution-worker-L3TM3F5D.js} +24 -22
- package/chunks/{exit-worktree-BC4SDZCC.js → exit-worktree-MI6N4OUP.js} +4 -3
- package/chunks/{exitPlanMode-PUICCCQ5.js → exitPlanMode-VIGOD2KP.js} +18 -16
- package/chunks/{fast-path-QH3QTZZA.js → fast-path-JCKEFUUL.js} +4 -4
- package/chunks/{fast-path-settings-TQAYWLXR.js → fast-path-settings-VIYSH3SD.js} +2 -2
- package/chunks/{glob-OEB4WH3Z.js → glob-UOKQZHKL.js} +18 -16
- package/chunks/{goal-tools-KWGKFUSK.js → goal-tools-G4RIX4ER.js} +18 -16
- package/chunks/{handleAutoUpdate-KEA7JSUD.js → handleAutoUpdate-UZZEGL3N.js} +34 -32
- package/chunks/{i18n-AC3MUXKZ.js → i18n-IL33FVND.js} +32 -30
- package/chunks/{initializer-WBD32BEX.js → initializer-BCXBRM6Y.js} +38 -36
- package/chunks/{installationInfo-JRGFTKWY.js → installationInfo-V7OKUOJV.js} +32 -30
- package/chunks/{list-S7KW7NBX.js → list-LQHG6SXA.js} +41 -39
- package/chunks/{llm-E32WLISX.js → llm-JWCANCDC.js} +85 -74
- package/chunks/{llm-content-generator-OMKJHC5P.js → llm-content-generator-OXMMHUVK.js} +3 -3
- package/chunks/{loadedSettingsAdapter-5OSU3J46.js → loadedSettingsAdapter-EKXSRWMY.js} +38 -36
- package/chunks/{local-execution-environment-IQHCTUJ5.js → local-execution-environment-XIQLRMLF.js} +24 -22
- package/chunks/{loggingContentGenerator-JIYG3LJS.js → loggingContentGenerator-6KHNZDTZ.js} +20 -18
- package/chunks/{managed-npm-update-RKAT7AMQ.js → managed-npm-update-MBUH5TIX.js} +32 -30
- package/chunks/managed-runtime-attestation-worker-G23AEEMF.js +367 -0
- package/chunks/{mcp-SV72BZKG.js → mcp-AYVCEEN7.js} +38 -36
- package/chunks/{model-call-collection-PKDMVCZN.js → model-call-collection-OKUGOY4B.js} +1 -1
- package/chunks/{model-configuration-A52XMQW7.js → model-configuration-Q3MNGG3B.js} +38 -36
- package/chunks/{modelConfigUtils-7O4P3SLE.js → modelConfigUtils-WC5XDR34.js} +33 -31
- package/chunks/{monitor-ZXRV2DJB.js → monitor-7JUZXYZN.js} +18 -16
- package/chunks/{nonInteractiveCli-UPSGIYRC.js → nonInteractiveCli-B3GCZ6NJ.js} +74 -73
- package/chunks/{nonInteractiveToolExecutor-TDKVR43J.js → nonInteractiveToolExecutor-IUHO7PXG.js} +19 -17
- package/chunks/{notebook-edit-FBVHAHYM.js → notebook-edit-IYDACZDW.js} +19 -17
- package/chunks/{omni-3NREMV2Q.js → omni-DLBHISHC.js} +10 -7
- package/chunks/{openaiContentGenerator-EWPBZFIT.js → openaiContentGenerator-W5GN6H6Z.js} +12 -10
- package/chunks/{openaiResponsesContentGenerator-3CI3PINB.js → openaiResponsesContentGenerator-BXXRYJQQ.js} +5 -5
- package/chunks/{pidfile-BBUANGZX.js → pidfile-QIBF53CW.js} +32 -30
- package/chunks/{processUtils-6OHQLG7W.js → processUtils-2LU22KCR.js} +2 -2
- package/chunks/{prompt-terminal-ledger-ZBFYXJ4L.js → prompt-terminal-ledger-LXFVLR6C.js} +33 -31
- package/chunks/{qwenContentGenerator-62F5IKXJ.js → qwenContentGenerator-LYMLXBWI.js} +21 -19
- package/chunks/{reactive-degrade-URJMXJ7N.js → reactive-degrade-HPYBJHYA.js} +6 -6
- package/chunks/{read-file-IM4Q5TKI.js → read-file-SXS2MKDY.js} +6 -3
- package/chunks/{record-artifact-K4XSMW4X.js → record-artifact-XP3X7RE5.js} +3 -2
- package/chunks/{record-source-XZCI3IGU.js → record-source-2VBLKVIE.js} +2 -2
- package/chunks/{report-findings-MCGXBQFX.js → report-findings-D2QUYUOG.js} +4 -3
- package/chunks/{request-shutdown-TT62PREA.js → request-shutdown-R5SA5GE3.js} +1 -1
- package/chunks/{resumeHistoryUtils-O3NQMDVR.js → resumeHistoryUtils-UPGZGP5V.js} +35 -33
- package/chunks/{ripGrep-BG2FEVIV.js → ripGrep-X33VVIN5.js} +8 -5
- package/chunks/{run-qwen-serve-GMLWJITM.js → run-qwen-serve-CUB2NZ6P.js} +278 -79
- package/chunks/{runtime-SSGPOXRZ.js → runtime-2DAVBADX.js} +43 -41
- package/chunks/{sandboxConfig-ALYLLNWY.js → sandboxConfig-ESBH3F27.js} +34 -32
- package/chunks/{scheduled-tasks-QJTC5XQ7.js → scheduled-tasks-TGWYXZWW.js} +38 -36
- package/chunks/{scheduler-PEXTY7IG.js → scheduler-XGLZCXPN.js} +34 -32
- package/chunks/{send-message-3UM7XRTB.js → send-message-FBU6WDID.js} +1 -1
- package/chunks/{serve-OVAUTKXK.js → serve-7RX4AIID.js} +38 -36
- package/chunks/{server-3MMYOOJW.js → server-MJETIFJS.js} +1789 -375
- package/chunks/{session-PZBIKBQJ.js → session-7AVYU3TC.js} +75 -74
- package/chunks/{session-attachments-root-ESP5CNBV.js → session-attachments-root-RONFQ3D3.js} +32 -30
- package/chunks/{session-pr-refresh-B3N7PKUP.js → session-pr-refresh-ZPT6TAD4.js} +37 -35
- package/chunks/{settings-KSQ2DGPY.js → settings-FPMUAVWD.js} +37 -35
- package/chunks/{shell-3V26EVNC.js → shell-THD5EYOK.js} +18 -16
- package/chunks/{skill-XP7F3LBV.js → skill-2D6KXDC5.js} +52 -13
- package/chunks/{skill-settings-PDESL7S3.js → skill-settings-XW7X244B.js} +38 -36
- package/chunks/{spawnChannel-NVO7CCBW.js → spawnChannel-DBSAAUUT.js} +34 -32
- package/chunks/{standalone-update-FDWS2EGF.js → standalone-update-TFAWA676.js} +33 -31
- package/chunks/{start-opentui-ui-WIFFY5UD.js → start-opentui-ui-VYMAXPBH.js} +87 -86
- package/chunks/{startInteractiveUI-YBLIRIHD.js → startInteractiveUI-Z54XKH35.js} +1037 -966
- package/chunks/{task-create-PEI7AJLE.js → task-create-PVF66J3R.js} +2 -2
- package/chunks/{task-update-MQZRWBGK.js → task-update-RSIITTOK.js} +2 -2
- package/chunks/{team-create-Z5JUEMB7.js → team-create-TPCELNBJ.js} +18 -16
- package/chunks/{team-plan-approval-ZLLHMEQN.js → team-plan-approval-RUURGHQL.js} +18 -16
- package/chunks/{terminal-image-renderer-QFO2JTTT.js → terminal-image-renderer-SLJVUD4Z.js} +32 -30
- package/chunks/{theme-manager-N7ILUTRY.js → theme-manager-VBOIN2KT.js} +32 -30
- package/chunks/{tool-call-PLSQ34VE.js → tool-call-DUHP6UXC.js} +2 -2
- package/chunks/{tool-result-media-OAHUKGRK.js → tool-result-media-WU6QAREN.js} +10 -7
- package/chunks/{tool-search-534QKE2X.js → tool-search-ET4NH2LK.js} +7 -4
- package/chunks/{total-session-admission-EZJQKTPF.js → total-session-admission-UWMJWTWP.js} +35 -33
- package/chunks/{trustedFolders-4ZEV6RXD.js → trustedFolders-3WNZBUH7.js} +33 -31
- package/chunks/{update-relaunch-GB3SGRDP.js → update-relaunch-SHS3BD6V.js} +5 -5
- package/chunks/{updateCheck-DVAGAEQ4.js → updateCheck-MDF2FCRN.js} +32 -30
- package/chunks/{upload-config-DMZVTDH7.js → upload-config-LVVUIKA2.js} +4 -4
- package/chunks/{useAutoAcceptIndicator-PTQBS42B.js → useAutoAcceptIndicator-26OOM7OM.js} +41 -39
- package/chunks/{validateNonInterActiveAuth-DU3WXVSU.js → validateNonInterActiveAuth-TBCZCQIN.js} +72 -71
- package/chunks/{version-PNMZGKCV.js → version-MICV7I4Y.js} +1 -1
- package/chunks/{web-fetch-LMCOAHW6.js → web-fetch-3O2DFRE5.js} +13 -9
- package/chunks/{web-search-N7RR74LA.js → web-search-5FS3NB3D.js} +4 -4
- package/chunks/{web-shell-static-GI6FVIMI.js → web-shell-static-E3O6NW7Y.js} +4 -3
- package/chunks/{workflow-ZZPHI7FK.js → workflow-FRJO5ZUI.js} +19 -17
- package/chunks/{workspace-providers-status-TU73CNRF.js → workspace-providers-status-I5MO7Z2T.js} +43 -41
- package/chunks/{workspace-registration-store-743FRSOU.js → workspace-registration-store-CBHKV34L.js} +1 -1
- package/chunks/{workspace-registry-S7QTXFWM.js → workspace-registry-2UKNZO5M.js} +35 -33
- package/chunks/{workspace-runtime-coordinator-GWNDUIGO.js → workspace-runtime-coordinator-TKCI5WJW.js} +36 -34
- package/chunks/{workspace-service-CERZFJ3B.js → workspace-service-M3ZKR6WL.js} +40 -38
- package/chunks/{workspace-skills-status-5M3EIAUY.js → workspace-skills-status-OC3EYL7U.js} +41 -39
- package/chunks/{workspace-trust-reconciler-Q3LUKMQB.js → workspace-trust-reconciler-YQZSUOH4.js} +41 -39
- package/chunks/{write-file-CT54LXQL.js → write-file-BATJLBJX.js} +21 -19
- package/chunks/{zoom-image-EU3PGSZM.js → zoom-image-5I7DDLQE.js} +10 -6
- package/cli-entry.js +13 -0
- package/cli.js +24 -12
- package/execution-worker.js +1 -1
- package/export-transcript-document.css +1 -1
- package/export-transcript-document.js +104 -104
- package/package.json +3 -3
- package/web-shell/assets/{abnfDiagram-VCTEODGH-DDYEvG-M.js → abnfDiagram-VCTEODGH-DQHroFS1.js} +1 -1
- package/web-shell/assets/{arc-DQncKWFX.js → arc-BrOc_HVh.js} +1 -1
- package/web-shell/assets/{architectureDiagram-5GKGNRK7-C0-8u9zj.js → architectureDiagram-5GKGNRK7-DXce8IH6.js} +1 -1
- package/web-shell/assets/{blockDiagram-NRAW4CY4-Cpt59Ge5.js → blockDiagram-NRAW4CY4-96A3Q3-l.js} +1 -1
- package/web-shell/assets/{c4Diagram-UCG6FXSJ-BvESWh83.js → c4Diagram-UCG6FXSJ-CQBg2PSg.js} +1 -1
- package/web-shell/assets/channel-CBP6pwSs.js +1 -0
- package/web-shell/assets/{chunk-2Q5K7J3B-wKulGIU6.js → chunk-2Q5K7J3B-i_jhVz-t.js} +1 -1
- package/web-shell/assets/{chunk-5VM5RSS4-BX6kRoq7.js → chunk-5VM5RSS4-Cx3gMrWT.js} +1 -1
- package/web-shell/assets/{chunk-F27PBJKO-wA4IqTt-.js → chunk-F27PBJKO-B9WwW7C0.js} +1 -1
- package/web-shell/assets/{chunk-G27WJ6UU-B7hzevlb.js → chunk-G27WJ6UU-B8t0FNPI.js} +1 -1
- package/web-shell/assets/{chunk-JWPE2WC7-BdBg9pJg.js → chunk-JWPE2WC7-Dg0__6CF.js} +1 -1
- package/web-shell/assets/{chunk-LCL6LL3I-DghmF6LJ.js → chunk-LCL6LL3I-DUwE5g3m.js} +1 -1
- package/web-shell/assets/{chunk-POPQ4Y6H-BbReTOod.js → chunk-POPQ4Y6H-BirYW5iS.js} +1 -1
- package/web-shell/assets/{chunk-SVP7TREG-C1t0_19D.js → chunk-SVP7TREG-_ONJKtFF.js} +1 -1
- package/web-shell/assets/{chunk-XXDRQBXY-DQBby5mI.js → chunk-XXDRQBXY-DGi0chgj.js} +1 -1
- package/web-shell/assets/classDiagram-DTDB5LWJ-_4_fFrN3.js +1 -0
- package/web-shell/assets/classDiagram-v2-JRS7N3AN-_4_fFrN3.js +1 -0
- package/web-shell/assets/{cose-bilkent-JH36ORCC-CNrSyg7B.js → cose-bilkent-JH36ORCC-BSSFxREn.js} +1 -1
- package/web-shell/assets/{cynefin-OW5HDTMX-DoxgDRN-.js → cynefin-OW5HDTMX-h-oYVCez.js} +1 -1
- package/web-shell/assets/{cynefinDiagram-5FMLGOSQ-BmUwbS8Q.js → cynefinDiagram-5FMLGOSQ-CXj6T7Pm.js} +1 -1
- package/web-shell/assets/{dagre-3AP2YEHR-BJrOVIjc.js → dagre-3AP2YEHR-Ch9GIhJm.js} +1 -1
- package/web-shell/assets/{diagram-S7CK7UJ4-TDX4KU9V.js → diagram-S7CK7UJ4-Cq3W541T.js} +1 -1
- package/web-shell/assets/{diagram-UQ7AKVKN-D3VUQkGl.js → diagram-UQ7AKVKN-Bm1R5-sN.js} +1 -1
- package/web-shell/assets/{diagram-VSXAHHWV-CqCpgViy.js → diagram-VSXAHHWV-BW2qG6Vh.js} +1 -1
- package/web-shell/assets/{diagram-VX7I27RA-CthqfwCs.js → diagram-VX7I27RA-DN96PhRe.js} +1 -1
- package/web-shell/assets/{diagram-Z3DM3KII-BRY3Ahvu.js → diagram-Z3DM3KII-A8MnwaJr.js} +1 -1
- package/web-shell/assets/{ebnfDiagram-PWID7BFC-tJvTnIwp.js → ebnfDiagram-PWID7BFC-CZTpUypI.js} +1 -1
- package/web-shell/assets/{erDiagram-SSCWMZ5O-DT4b7w5B.js → erDiagram-SSCWMZ5O-CbxCRFru.js} +1 -1
- package/web-shell/assets/{flowDiagram-A5DVABFB-C5oirWSf.js → flowDiagram-A5DVABFB-Bt1PM2Dy.js} +1 -1
- package/web-shell/assets/{ganttDiagram-EL5Y4UJY-ZD3kNlO4.js → ganttDiagram-EL5Y4UJY-CTgim3LX.js} +1 -1
- package/web-shell/assets/{gitGraphDiagram-WWUBYQGX-Bp1sg_wH.js → gitGraphDiagram-WWUBYQGX-h4jX7S4l.js} +1 -1
- package/web-shell/assets/{index-DSIzVof7.js → index-BDxWHGNm.js} +1 -1
- package/web-shell/assets/index-Bd3iA5Er.js +2407 -0
- package/web-shell/assets/index-DuwfO01z.css +36 -0
- package/web-shell/assets/{infoDiagram-RXCK75RN-Btumz_CZ.js → infoDiagram-RXCK75RN-DsIsFmZ4.js} +1 -1
- package/web-shell/assets/{ishikawaDiagram-5VMMS53U-Dx8_uvso.js → ishikawaDiagram-5VMMS53U-BgF2V3rC.js} +1 -1
- package/web-shell/assets/{journeyDiagram-EYS64GPL-DS5spUhj.js → journeyDiagram-EYS64GPL-CJ2ibWhB.js} +1 -1
- package/web-shell/assets/{kanban-definition-3QL26DDD-DttC9d4D.js → kanban-definition-3QL26DDD-oqNfpjND.js} +1 -1
- package/web-shell/assets/{layout-BDOJQJbX.js → layout-DKF2f-UC.js} +1 -1
- package/web-shell/assets/{linear-BsUVMxld.js → linear-CadmYA8J.js} +1 -1
- package/web-shell/assets/{mermaid.core-De4-EW4Z.js → mermaid.core-BSD13L-h.js} +6 -6
- package/web-shell/assets/{mindmap-definition-FBJOCRG2-BsYY98Wv.js → mindmap-definition-FBJOCRG2-Cg3jlHzV.js} +1 -1
- package/web-shell/assets/{pegDiagram-XKGWAZYB-DXnnQrVY.js → pegDiagram-XKGWAZYB-BGzqlBWk.js} +1 -1
- package/web-shell/assets/{pieDiagram-E7YTZNPT-DGLAGUYR.js → pieDiagram-E7YTZNPT-BVDdPYnC.js} +1 -1
- package/web-shell/assets/{quadrantDiagram-AXDQQJYC-Y8DcMTa5.js → quadrantDiagram-AXDQQJYC-D7maRW6r.js} +1 -1
- package/web-shell/assets/{railroadDiagram-O6MQD6OU-ZgauslUZ.js → railroadDiagram-O6MQD6OU-C7J0Nnqc.js} +1 -1
- package/web-shell/assets/{requirementDiagram-EFPCY7ZU-Kxtu4twe.js → requirementDiagram-EFPCY7ZU-CDEpUB7S.js} +1 -1
- package/web-shell/assets/{sankeyDiagram-P5KCCOFB-BKsLF9EA.js → sankeyDiagram-P5KCCOFB-DoA0BWeR.js} +1 -1
- package/web-shell/assets/{sequenceDiagram-WJ2MYXX4-D8sCv1NK.js → sequenceDiagram-WJ2MYXX4-DlqRjDLl.js} +1 -1
- package/web-shell/assets/{sizeCapture-X5ZJPWSS-BX8sokZX.js → sizeCapture-X5ZJPWSS-3l2EJ1DB.js} +1 -1
- package/web-shell/assets/{stateDiagram-HBIQ2CUA-DFMl58kv.js → stateDiagram-HBIQ2CUA-Bdq0N6Lr.js} +1 -1
- package/web-shell/assets/stateDiagram-v2-4QOOHH4V-DtdYpKZp.js +1 -0
- package/web-shell/assets/{swimlanes-XN3QIQJK-BnMwURLN.js → swimlanes-XN3QIQJK-B4ArxdLV.js} +1 -1
- package/web-shell/assets/swimlanesDiagram-VK2B7HYN-B_iL0Dc4.js +8 -0
- package/web-shell/assets/{timeline-definition-24CTP7MA-C8y77DDz.js → timeline-definition-24CTP7MA-B_Ug6D_k.js} +1 -1
- package/web-shell/assets/{vennDiagram-4TSXK5OY-DOWQgX9u.js → vennDiagram-4TSXK5OY-BR9tvaDT.js} +1 -1
- package/web-shell/assets/{wardleyDiagram-VM6X3IG4-BM0AVIzE.js → wardleyDiagram-VM6X3IG4-BdGIt6qE.js} +1 -1
- package/web-shell/assets/{xychartDiagram-S5SC5T6Z-B18-YghG.js → xychartDiagram-S5SC5T6Z-NxS8XkXN.js} +1 -1
- package/web-shell/index.html +2 -2
- package/web-shell/sw.js +1 -1
- package/bundled/computer-use/references/macos.md +0 -208
- package/bundled/computer-use/references/windows-linux.md +0 -247
- package/web-shell/assets/channel-B88Zt8_x.js +0 -1
- package/web-shell/assets/classDiagram-DTDB5LWJ-Dp-7ruHm.js +0 -1
- package/web-shell/assets/classDiagram-v2-JRS7N3AN-Dp-7ruHm.js +0 -1
- package/web-shell/assets/index-CpxLhWqx.js +0 -2337
- package/web-shell/assets/index-mr0Sw0G-.css +0 -36
- package/web-shell/assets/stateDiagram-v2-4QOOHH4V-B3HSbbo2.js +0 -1
- package/web-shell/assets/swimlanesDiagram-VK2B7HYN-FnO0SUMi.js +0 -8
|
@@ -83,7 +83,7 @@ import {
|
|
|
83
83
|
worktreeBranchForSlug,
|
|
84
84
|
writeRuntimeStatus,
|
|
85
85
|
writeWorktreeSessionMarker
|
|
86
|
-
} from "./chunk-
|
|
86
|
+
} from "./chunk-PX2ZOOGQ.js";
|
|
87
87
|
import {
|
|
88
88
|
SessionArtifactSnapshotAccumulator,
|
|
89
89
|
aggregateTranscriptRecordFragments,
|
|
@@ -182,10 +182,10 @@ import {
|
|
|
182
182
|
stringify,
|
|
183
183
|
validateGoalProposalReason,
|
|
184
184
|
validateSkillName
|
|
185
|
-
} from "./chunk-
|
|
185
|
+
} from "./chunk-QNEBHC2E.js";
|
|
186
186
|
import {
|
|
187
187
|
canUseRipgrep
|
|
188
|
-
} from "./chunk-
|
|
188
|
+
} from "./chunk-465XOJLQ.js";
|
|
189
189
|
import {
|
|
190
190
|
CODE_MODE_MAX_MEDIA_BYTES,
|
|
191
191
|
CODE_MODE_MAX_MEDIA_ITEMS
|
|
@@ -219,7 +219,7 @@ import {
|
|
|
219
219
|
} from "./chunk-6C3D7BKK.js";
|
|
220
220
|
import {
|
|
221
221
|
isOmniDeliveryActive
|
|
222
|
-
} from "./chunk-
|
|
222
|
+
} from "./chunk-TPFV5YZK.js";
|
|
223
223
|
import {
|
|
224
224
|
MediaResourceRegistry,
|
|
225
225
|
evaluateMediaPolicyToolCall,
|
|
@@ -283,7 +283,7 @@ import {
|
|
|
283
283
|
DEFERRED_TOOL_CALL_CANCELLATION_PREFIX,
|
|
284
284
|
DEFERRED_TOOL_CALL_REFUSAL_PREFIX,
|
|
285
285
|
resolveDeferredToolCall
|
|
286
|
-
} from "./chunk-
|
|
286
|
+
} from "./chunk-CVRZNFXO.js";
|
|
287
287
|
import {
|
|
288
288
|
EXCLUDED_TOOLS_FOR_SUBAGENTS,
|
|
289
289
|
READ_ONLY_INSPECTION_TOOLS,
|
|
@@ -312,7 +312,7 @@ import {
|
|
|
312
312
|
splitCompoundCommand,
|
|
313
313
|
splitCompoundCommandSegments,
|
|
314
314
|
toolMatchesRuleToolName
|
|
315
|
-
} from "./chunk-
|
|
315
|
+
} from "./chunk-O5YL6KSX.js";
|
|
316
316
|
import {
|
|
317
317
|
APPROVAL_MODES
|
|
318
318
|
} from "./chunk-JX6XHPTX.js";
|
|
@@ -333,7 +333,7 @@ import {
|
|
|
333
333
|
resolveEffectiveOutputStyle,
|
|
334
334
|
resolveInteractionMode,
|
|
335
335
|
resolveMainSessionOutputStyle
|
|
336
|
-
} from "./chunk-
|
|
336
|
+
} from "./chunk-KAOHUUM7.js";
|
|
337
337
|
import {
|
|
338
338
|
NO_EXEC_CONFIG,
|
|
339
339
|
findGitRoot,
|
|
@@ -346,11 +346,10 @@ import {
|
|
|
346
346
|
import {
|
|
347
347
|
InMemoryImagePayloadStore,
|
|
348
348
|
buildReattachParts,
|
|
349
|
-
clampInlineMediaPart,
|
|
350
349
|
countAllInlineImages,
|
|
351
350
|
replaceImagePayloadsInPlace,
|
|
352
351
|
supportsOpenAIPrefixCaching
|
|
353
|
-
} from "./chunk-
|
|
352
|
+
} from "./chunk-LDURD6EP.js";
|
|
354
353
|
import {
|
|
355
354
|
OMNI_DISCLOSURE_TEXT_PREFIX,
|
|
356
355
|
OMNI_OMISSION_TEXT_PREFIX,
|
|
@@ -361,7 +360,7 @@ import {
|
|
|
361
360
|
import {
|
|
362
361
|
DashScopeOpenAICompatibleProvider,
|
|
363
362
|
selectDashScopeThinkingKnob
|
|
364
|
-
} from "./chunk-
|
|
363
|
+
} from "./chunk-PWGMHXIV.js";
|
|
365
364
|
import {
|
|
366
365
|
childLaunchDepth,
|
|
367
366
|
getCurrentAgentConfiguredToolAllowlist,
|
|
@@ -386,16 +385,6 @@ import {
|
|
|
386
385
|
getResponsesMessage,
|
|
387
386
|
sameResponsesMessage
|
|
388
387
|
} from "./chunk-Z72PLR74.js";
|
|
389
|
-
import {
|
|
390
|
-
DEFAULT_IMAGE_TOKEN_ESTIMATE,
|
|
391
|
-
TOKEN_TO_CHAR_RATIO,
|
|
392
|
-
estimateContentChars,
|
|
393
|
-
getFunctionResponseParts,
|
|
394
|
-
resolveCompactionTuning,
|
|
395
|
-
resolveSlimmingConfig,
|
|
396
|
-
sanitizeMimeForPlaceholder,
|
|
397
|
-
slimCompactionInput
|
|
398
|
-
} from "./chunk-GC3J5W2O.js";
|
|
399
388
|
import {
|
|
400
389
|
openBrowserSecurely,
|
|
401
390
|
shouldAttemptBrowserLaunch
|
|
@@ -446,7 +435,7 @@ import {
|
|
|
446
435
|
resolveReasoningForModel,
|
|
447
436
|
stripRuntimeSnapshotPrefix,
|
|
448
437
|
validateReasoningCapabilities
|
|
449
|
-
} from "./chunk-
|
|
438
|
+
} from "./chunk-242INZ6Y.js";
|
|
450
439
|
import {
|
|
451
440
|
addDaemonRequestAttribute
|
|
452
441
|
} from "./chunk-KBVGO6H4.js";
|
|
@@ -542,7 +531,7 @@ import {
|
|
|
542
531
|
updateMCPServerStatus,
|
|
543
532
|
writeLine,
|
|
544
533
|
writeLineSync
|
|
545
|
-
} from "./chunk-
|
|
534
|
+
} from "./chunk-HDSI3RDN.js";
|
|
546
535
|
import {
|
|
547
536
|
Mutex
|
|
548
537
|
} from "./chunk-VBT4BMCQ.js";
|
|
@@ -556,7 +545,7 @@ import {
|
|
|
556
545
|
readTextCursorWindowFromHandle,
|
|
557
546
|
readTextRangeFromHandle,
|
|
558
547
|
setMemoryFilename
|
|
559
|
-
} from "./chunk-
|
|
548
|
+
} from "./chunk-PYYPSK6Q.js";
|
|
560
549
|
import {
|
|
561
550
|
extractCodeModeImageContent,
|
|
562
551
|
getCurrentToolCallSource,
|
|
@@ -587,6 +576,9 @@ import {
|
|
|
587
576
|
import {
|
|
588
577
|
runSideQuery
|
|
589
578
|
} from "./chunk-GHKVBSBY.js";
|
|
579
|
+
import {
|
|
580
|
+
clampInlineMediaPart
|
|
581
|
+
} from "./chunk-Q4FJVWI4.js";
|
|
590
582
|
import {
|
|
591
583
|
getSystemEncoding
|
|
592
584
|
} from "./chunk-GMTJ3YQW.js";
|
|
@@ -594,6 +586,16 @@ import {
|
|
|
594
586
|
getInvocationContext,
|
|
595
587
|
runWithInvocationContext
|
|
596
588
|
} from "./chunk-5ETULJLP.js";
|
|
589
|
+
import {
|
|
590
|
+
DEFAULT_IMAGE_TOKEN_ESTIMATE,
|
|
591
|
+
TOKEN_TO_CHAR_RATIO,
|
|
592
|
+
estimateContentChars,
|
|
593
|
+
getFunctionResponseParts,
|
|
594
|
+
resolveCompactionTuning,
|
|
595
|
+
resolveSlimmingConfig,
|
|
596
|
+
sanitizeMimeForPlaceholder,
|
|
597
|
+
slimCompactionInput
|
|
598
|
+
} from "./chunk-GC3J5W2O.js";
|
|
597
599
|
import {
|
|
598
600
|
normalizeMcpToolName,
|
|
599
601
|
sanitizeToolNameForProvider
|
|
@@ -622,7 +624,7 @@ import {
|
|
|
622
624
|
resolveContentGeneratorConfigWithSources,
|
|
623
625
|
setGeneratorReasoningEffort,
|
|
624
626
|
tokenLimit
|
|
625
|
-
} from "./chunk-
|
|
627
|
+
} from "./chunk-ALTMZEBU.js";
|
|
626
628
|
import {
|
|
627
629
|
DEFAULT_QWEN_MODEL
|
|
628
630
|
} from "./chunk-XZA32HII.js";
|
|
@@ -1444,13 +1446,13 @@ var require_cross_spawn = __commonJS({
|
|
|
1444
1446
|
var cp = __require("child_process");
|
|
1445
1447
|
var parse12 = require_parse();
|
|
1446
1448
|
var enoent = require_enoent();
|
|
1447
|
-
function
|
|
1449
|
+
function spawn8(command, args, options2) {
|
|
1448
1450
|
const parsed = parse12(command, args, options2);
|
|
1449
1451
|
const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
|
|
1450
1452
|
enoent.hookChildProcess(spawned, parsed);
|
|
1451
1453
|
return spawned;
|
|
1452
1454
|
}
|
|
1453
|
-
__name(
|
|
1455
|
+
__name(spawn8, "spawn");
|
|
1454
1456
|
function spawnSync3(command, args, options2) {
|
|
1455
1457
|
const parsed = parse12(command, args, options2);
|
|
1456
1458
|
const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
|
|
@@ -1458,8 +1460,8 @@ var require_cross_spawn = __commonJS({
|
|
|
1458
1460
|
return result;
|
|
1459
1461
|
}
|
|
1460
1462
|
__name(spawnSync3, "spawnSync");
|
|
1461
|
-
module2.exports =
|
|
1462
|
-
module2.exports.spawn =
|
|
1463
|
+
module2.exports = spawn8;
|
|
1464
|
+
module2.exports.spawn = spawn8;
|
|
1463
1465
|
module2.exports.sync = spawnSync3;
|
|
1464
1466
|
module2.exports._parse = parse12;
|
|
1465
1467
|
module2.exports._enoent = enoent;
|
|
@@ -15903,10 +15905,10 @@ import {
|
|
|
15903
15905
|
mkdir as mkdir2,
|
|
15904
15906
|
open as open2,
|
|
15905
15907
|
readFile as readFile3,
|
|
15906
|
-
stat as
|
|
15908
|
+
stat as stat3,
|
|
15907
15909
|
unlink as unlink3
|
|
15908
15910
|
} from "node:fs/promises";
|
|
15909
|
-
import { dirname, isAbsolute as isAbsolute2, join as
|
|
15911
|
+
import { dirname, isAbsolute as isAbsolute2, join as join8, relative as relative2, resolve as resolve4, sep as sep2 } from "node:path";
|
|
15910
15912
|
|
|
15911
15913
|
// node_modules/diff/lib/index.mjs
|
|
15912
15914
|
init_esbuild_shims();
|
|
@@ -16750,12 +16752,990 @@ __name(splitLines, "splitLines");
|
|
|
16750
16752
|
|
|
16751
16753
|
// packages/core/src/utils/gitDiff.ts
|
|
16752
16754
|
init_esbuild_shims();
|
|
16753
|
-
import { execFile } from "node:child_process";
|
|
16754
|
-
import { access, lstat as
|
|
16755
|
-
import * as
|
|
16755
|
+
import { execFile as execFile2 } from "node:child_process";
|
|
16756
|
+
import { access as access2, lstat as lstat3, open, readFile as readFile2, stat as stat2 } from "node:fs/promises";
|
|
16757
|
+
import * as path7 from "node:path";
|
|
16758
|
+
import { promisify as promisify2 } from "node:util";
|
|
16759
|
+
|
|
16760
|
+
// packages/core/src/utils/git-branches.ts
|
|
16761
|
+
init_esbuild_shims();
|
|
16762
|
+
import { execFile, spawn } from "node:child_process";
|
|
16763
|
+
import * as fs7 from "node:fs";
|
|
16764
|
+
import * as path6 from "node:path";
|
|
16756
16765
|
import { promisify } from "node:util";
|
|
16766
|
+
|
|
16767
|
+
// packages/core/src/utils/gitDirect.ts
|
|
16768
|
+
init_esbuild_shims();
|
|
16769
|
+
import * as fs6 from "node:fs";
|
|
16770
|
+
import * as fsPromises from "node:fs/promises";
|
|
16771
|
+
import * as path5 from "node:path";
|
|
16772
|
+
var SHORT_SHA_LENGTH = 7;
|
|
16773
|
+
var debug = createDebugLogger("gitDirect");
|
|
16774
|
+
var MAX_REF_COMPONENT_LENGTH = 255;
|
|
16775
|
+
var INVALID_REF_CHARS = /[\x00-\x20\x7f-\x9f\u200b-\u200d\u2028\u2029\u202a-\u202e\u2066-\u2069\ufeff~^:?*[\\]/;
|
|
16776
|
+
function isValidRefName(name) {
|
|
16777
|
+
if (!name || name === "HEAD") return false;
|
|
16778
|
+
if (name.startsWith("/") || name.endsWith("/")) return false;
|
|
16779
|
+
if (name.startsWith(".") || name.endsWith(".")) return false;
|
|
16780
|
+
if (name.endsWith(".lock")) return false;
|
|
16781
|
+
if (name.includes("..") || name.includes("//")) return false;
|
|
16782
|
+
if (name.includes("/.") || name.includes("./") || name.includes(".lock/")) {
|
|
16783
|
+
return false;
|
|
16784
|
+
}
|
|
16785
|
+
if (name.includes("@{")) return false;
|
|
16786
|
+
if (INVALID_REF_CHARS.test(name)) return false;
|
|
16787
|
+
if (name.split("/").some((c) => c.length > MAX_REF_COMPONENT_LENGTH)) {
|
|
16788
|
+
return false;
|
|
16789
|
+
}
|
|
16790
|
+
return true;
|
|
16791
|
+
}
|
|
16792
|
+
__name(isValidRefName, "isValidRefName");
|
|
16793
|
+
function isValidGitSha(value) {
|
|
16794
|
+
return /^[0-9a-f]{40}$/.test(value) || /^[0-9a-f]{64}$/.test(value);
|
|
16795
|
+
}
|
|
16796
|
+
__name(isValidGitSha, "isValidGitSha");
|
|
16797
|
+
var gitDirCache = /* @__PURE__ */ new Map();
|
|
16798
|
+
async function isDir(p2) {
|
|
16799
|
+
try {
|
|
16800
|
+
return (await fsPromises.stat(p2)).isDirectory();
|
|
16801
|
+
} catch {
|
|
16802
|
+
return false;
|
|
16803
|
+
}
|
|
16804
|
+
}
|
|
16805
|
+
__name(isDir, "isDir");
|
|
16806
|
+
async function hasGitStore(dir) {
|
|
16807
|
+
const [objects, refs] = await Promise.all([
|
|
16808
|
+
isDir(path5.join(dir, "objects")),
|
|
16809
|
+
isDir(path5.join(dir, "refs"))
|
|
16810
|
+
]);
|
|
16811
|
+
return objects && refs;
|
|
16812
|
+
}
|
|
16813
|
+
__name(hasGitStore, "hasGitStore");
|
|
16814
|
+
async function isRealGitDir(gitDir) {
|
|
16815
|
+
if (await hasGitStore(gitDir)) return true;
|
|
16816
|
+
const rel = await readFirstLineNoFollow(path5.join(gitDir, "commondir"));
|
|
16817
|
+
if (!rel) return false;
|
|
16818
|
+
return hasGitStore(path5.resolve(gitDir, rel.trim()));
|
|
16819
|
+
}
|
|
16820
|
+
__name(isRealGitDir, "isRealGitDir");
|
|
16821
|
+
async function resolveTrustedGitDir(cwd) {
|
|
16822
|
+
const gitDir = await resolveGitDir(cwd);
|
|
16823
|
+
if (!gitDir) return null;
|
|
16824
|
+
return await isRealGitDir(gitDir) ? gitDir : null;
|
|
16825
|
+
}
|
|
16826
|
+
__name(resolveTrustedGitDir, "resolveTrustedGitDir");
|
|
16827
|
+
async function getCachedGitDir(cwd) {
|
|
16828
|
+
const key = path5.resolve(cwd);
|
|
16829
|
+
const cached3 = gitDirCache.get(key);
|
|
16830
|
+
if (cached3 !== void 0) return cached3;
|
|
16831
|
+
const gitDir = await resolveTrustedGitDir(key);
|
|
16832
|
+
if (gitDir !== null) gitDirCache.set(key, gitDir);
|
|
16833
|
+
return gitDir;
|
|
16834
|
+
}
|
|
16835
|
+
__name(getCachedGitDir, "getCachedGitDir");
|
|
16836
|
+
async function readGitHead(gitDir) {
|
|
16837
|
+
const firstLine = await readFirstLineNoFollow(path5.join(gitDir, "HEAD"));
|
|
16838
|
+
if (firstLine === null) return null;
|
|
16839
|
+
const content = firstLine.trim();
|
|
16840
|
+
if (content.startsWith("ref:")) {
|
|
16841
|
+
const ref = content.slice(4).trim();
|
|
16842
|
+
if (!ref.startsWith("refs/heads/")) return null;
|
|
16843
|
+
const name = ref.slice("refs/heads/".length);
|
|
16844
|
+
if (!isValidRefName(name)) return null;
|
|
16845
|
+
return { type: "branch", name };
|
|
16846
|
+
}
|
|
16847
|
+
if (isValidGitSha(content)) {
|
|
16848
|
+
return { type: "detached", name: content };
|
|
16849
|
+
}
|
|
16850
|
+
return null;
|
|
16851
|
+
}
|
|
16852
|
+
__name(readGitHead, "readGitHead");
|
|
16853
|
+
async function resolveBranchName(cwd) {
|
|
16854
|
+
const gitDir = await getCachedGitDir(cwd);
|
|
16855
|
+
if (!gitDir) return void 0;
|
|
16856
|
+
const head = await readGitHead(gitDir);
|
|
16857
|
+
if (!head) return void 0;
|
|
16858
|
+
return head.type === "branch" ? head.name : head.name.slice(0, SHORT_SHA_LENGTH);
|
|
16859
|
+
}
|
|
16860
|
+
__name(resolveBranchName, "resolveBranchName");
|
|
16861
|
+
var repoBranchWatches = /* @__PURE__ */ new Map();
|
|
16862
|
+
async function watchRepoBranch(cwd, onChange) {
|
|
16863
|
+
const gitDir = await getCachedGitDir(cwd);
|
|
16864
|
+
if (!gitDir) return () => {
|
|
16865
|
+
};
|
|
16866
|
+
let entry = repoBranchWatches.get(gitDir);
|
|
16867
|
+
if (!entry) {
|
|
16868
|
+
const logsHeadPath = path5.join(gitDir, "logs", "HEAD");
|
|
16869
|
+
try {
|
|
16870
|
+
await fsPromises.access(logsHeadPath, fs6.constants?.F_OK ?? 0);
|
|
16871
|
+
if ((await fsPromises.lstat(logsHeadPath)).isSymbolicLink()) {
|
|
16872
|
+
return () => {
|
|
16873
|
+
};
|
|
16874
|
+
}
|
|
16875
|
+
} catch {
|
|
16876
|
+
return () => {
|
|
16877
|
+
};
|
|
16878
|
+
}
|
|
16879
|
+
const existing = repoBranchWatches.get(gitDir);
|
|
16880
|
+
if (existing) {
|
|
16881
|
+
entry = existing;
|
|
16882
|
+
} else {
|
|
16883
|
+
let watcher;
|
|
16884
|
+
try {
|
|
16885
|
+
watcher = fs6.watch(logsHeadPath, (eventType) => {
|
|
16886
|
+
if (eventType === "change" || eventType === "rename") {
|
|
16887
|
+
repoBranchWatches.get(gitDir)?.subscribers.forEach((cb) => {
|
|
16888
|
+
try {
|
|
16889
|
+
cb();
|
|
16890
|
+
} catch {
|
|
16891
|
+
}
|
|
16892
|
+
});
|
|
16893
|
+
}
|
|
16894
|
+
});
|
|
16895
|
+
} catch (err) {
|
|
16896
|
+
debug.warn(`failed to watch reflog for ${gitDir}: ${err}`);
|
|
16897
|
+
return () => {
|
|
16898
|
+
};
|
|
16899
|
+
}
|
|
16900
|
+
watcher.on("error", (err) => {
|
|
16901
|
+
debug.warn(
|
|
16902
|
+
`reflog watcher error for ${gitDir}; branch will no longer auto-update: ${err?.message}`
|
|
16903
|
+
);
|
|
16904
|
+
const current = repoBranchWatches.get(gitDir);
|
|
16905
|
+
if (current?.watcher === watcher) {
|
|
16906
|
+
try {
|
|
16907
|
+
watcher.close();
|
|
16908
|
+
} catch {
|
|
16909
|
+
}
|
|
16910
|
+
repoBranchWatches.delete(gitDir);
|
|
16911
|
+
}
|
|
16912
|
+
});
|
|
16913
|
+
entry = { watcher, subscribers: /* @__PURE__ */ new Set() };
|
|
16914
|
+
repoBranchWatches.set(gitDir, entry);
|
|
16915
|
+
}
|
|
16916
|
+
}
|
|
16917
|
+
entry.subscribers.add(onChange);
|
|
16918
|
+
let disposed = false;
|
|
16919
|
+
return () => {
|
|
16920
|
+
if (disposed) return;
|
|
16921
|
+
disposed = true;
|
|
16922
|
+
const e = repoBranchWatches.get(gitDir);
|
|
16923
|
+
if (!e) return;
|
|
16924
|
+
e.subscribers.delete(onChange);
|
|
16925
|
+
if (e.subscribers.size === 0) {
|
|
16926
|
+
e.watcher.close();
|
|
16927
|
+
repoBranchWatches.delete(gitDir);
|
|
16928
|
+
}
|
|
16929
|
+
};
|
|
16930
|
+
}
|
|
16931
|
+
__name(watchRepoBranch, "watchRepoBranch");
|
|
16932
|
+
|
|
16933
|
+
// packages/core/src/utils/git-branches.ts
|
|
16934
|
+
var debugLogger12 = createDebugLogger("GIT_BRANCHES");
|
|
16757
16935
|
var execFileAsync = promisify(execFile);
|
|
16758
|
-
var GIT_TIMEOUT_MS =
|
|
16936
|
+
var GIT_TIMEOUT_MS = 3e4;
|
|
16937
|
+
var MAX_RECENT_BRANCHES = 20;
|
|
16938
|
+
var MAX_REFLOG_ENTRIES = 200;
|
|
16939
|
+
var GIT_ENV_VARS_TO_CLEAR = [
|
|
16940
|
+
"GIT_DIR",
|
|
16941
|
+
"GIT_WORK_TREE",
|
|
16942
|
+
"GIT_COMMON_DIR",
|
|
16943
|
+
"GIT_INDEX_FILE",
|
|
16944
|
+
"GIT_CONFIG_GLOBAL",
|
|
16945
|
+
"GIT_CONFIG_SYSTEM",
|
|
16946
|
+
"GIT_CONFIG_NOSYSTEM",
|
|
16947
|
+
// Repository selectors that an inherited daemon environment could use to
|
|
16948
|
+
// redirect a trusted-workspace git/gh invocation to a different repository
|
|
16949
|
+
// or object database despite the resolved cwd.
|
|
16950
|
+
"GH_REPO",
|
|
16951
|
+
"GIT_CONFIG_COUNT",
|
|
16952
|
+
"GIT_CONFIG_PARAMETERS",
|
|
16953
|
+
"GIT_OBJECT_DIRECTORY",
|
|
16954
|
+
"GIT_ALTERNATE_OBJECT_DIRECTORIES"
|
|
16955
|
+
];
|
|
16956
|
+
var GIT_ENV_PREFIXES_TO_CLEAR = ["GIT_CONFIG_KEY_", "GIT_CONFIG_VALUE_"];
|
|
16957
|
+
var HELPER_PROTOCOLS = /* @__PURE__ */ new Set(["ext", "fd"]);
|
|
16958
|
+
function gitEnv(base) {
|
|
16959
|
+
const env = { ...base ?? process.env };
|
|
16960
|
+
for (const key of GIT_ENV_VARS_TO_CLEAR) {
|
|
16961
|
+
delete env[key];
|
|
16962
|
+
}
|
|
16963
|
+
for (const key of Object.keys(env)) {
|
|
16964
|
+
if (GIT_ENV_PREFIXES_TO_CLEAR.some((prefix) => key.startsWith(prefix))) {
|
|
16965
|
+
delete env[key];
|
|
16966
|
+
}
|
|
16967
|
+
}
|
|
16968
|
+
const inheritedAllow = env["GIT_ALLOW_PROTOCOL"];
|
|
16969
|
+
if (inheritedAllow !== void 0) {
|
|
16970
|
+
env["GIT_ALLOW_PROTOCOL"] = inheritedAllow.split(":").filter((p2) => !HELPER_PROTOCOLS.has(p2.trim().toLowerCase())).join(":");
|
|
16971
|
+
}
|
|
16972
|
+
env["LC_ALL"] = "C";
|
|
16973
|
+
env["LANG"] = "C";
|
|
16974
|
+
return env;
|
|
16975
|
+
}
|
|
16976
|
+
__name(gitEnv, "gitEnv");
|
|
16977
|
+
function streamGitRecords(cwd, args, onRecord, env, options2 = {}) {
|
|
16978
|
+
return new Promise((resolve37, reject) => {
|
|
16979
|
+
const child = spawn("git", args, {
|
|
16980
|
+
cwd,
|
|
16981
|
+
env: gitEnv(env),
|
|
16982
|
+
windowsHide: true
|
|
16983
|
+
});
|
|
16984
|
+
let settled = false;
|
|
16985
|
+
const settle = /* @__PURE__ */ __name((outcome) => {
|
|
16986
|
+
if (settled) return;
|
|
16987
|
+
settled = true;
|
|
16988
|
+
clearTimeout(timer);
|
|
16989
|
+
child.kill("SIGKILL");
|
|
16990
|
+
outcome();
|
|
16991
|
+
}, "settle");
|
|
16992
|
+
const subcommand = args.find((arg, i) => !arg.startsWith("-") && args[i - 1] !== "-c") ?? "git";
|
|
16993
|
+
const timer = setTimeout(
|
|
16994
|
+
() => settle(() => reject(new Error(`git ${subcommand} timed out`))),
|
|
16995
|
+
options2.timeoutMs ?? GIT_TIMEOUT_MS
|
|
16996
|
+
);
|
|
16997
|
+
const deliver = /* @__PURE__ */ __name((record4) => {
|
|
16998
|
+
try {
|
|
16999
|
+
if (!onRecord(record4)) return false;
|
|
17000
|
+
settle(() => resolve37(true));
|
|
17001
|
+
} catch (err) {
|
|
17002
|
+
settle(() => reject(err));
|
|
17003
|
+
}
|
|
17004
|
+
return true;
|
|
17005
|
+
}, "deliver");
|
|
17006
|
+
let pending = Buffer.alloc(0);
|
|
17007
|
+
child.stdout.on("data", (chunk) => {
|
|
17008
|
+
if (settled) return;
|
|
17009
|
+
pending = pending.length ? Buffer.concat([pending, chunk]) : chunk;
|
|
17010
|
+
let at2 = pending.indexOf(0);
|
|
17011
|
+
while (at2 !== -1) {
|
|
17012
|
+
const record4 = pending.subarray(0, at2);
|
|
17013
|
+
pending = pending.subarray(at2 + 1);
|
|
17014
|
+
if (deliver(record4)) return;
|
|
17015
|
+
at2 = pending.indexOf(0);
|
|
17016
|
+
}
|
|
17017
|
+
});
|
|
17018
|
+
let stderr = "";
|
|
17019
|
+
child.stderr.setEncoding("utf8");
|
|
17020
|
+
child.stderr.on("data", (chunk) => {
|
|
17021
|
+
if (stderr.length < 8192) stderr += chunk;
|
|
17022
|
+
});
|
|
17023
|
+
child.on("error", (err) => settle(() => reject(err)));
|
|
17024
|
+
child.on("close", (code, signal) => {
|
|
17025
|
+
if (settled) return;
|
|
17026
|
+
if (code !== 0) {
|
|
17027
|
+
settle(
|
|
17028
|
+
() => reject(
|
|
17029
|
+
new Error(
|
|
17030
|
+
stderr.trim() || `git ${subcommand} exited with ${code ?? signal}`
|
|
17031
|
+
)
|
|
17032
|
+
)
|
|
17033
|
+
);
|
|
17034
|
+
return;
|
|
17035
|
+
}
|
|
17036
|
+
if (pending.length > 0 && deliver(pending)) return;
|
|
17037
|
+
settle(() => resolve37(false));
|
|
17038
|
+
});
|
|
17039
|
+
});
|
|
17040
|
+
}
|
|
17041
|
+
__name(streamGitRecords, "streamGitRecords");
|
|
17042
|
+
function runGitCapture(cwd, args, env) {
|
|
17043
|
+
return execFileAsync("git", args, {
|
|
17044
|
+
cwd,
|
|
17045
|
+
timeout: GIT_TIMEOUT_MS,
|
|
17046
|
+
maxBuffer: 10 * 1024 * 1024,
|
|
17047
|
+
env: gitEnv(env)
|
|
17048
|
+
}).then(({ stdout, stderr }) => ({ stdout, stderr }));
|
|
17049
|
+
}
|
|
17050
|
+
__name(runGitCapture, "runGitCapture");
|
|
17051
|
+
function runGit(cwd, args, env) {
|
|
17052
|
+
return runGitCapture(cwd, args, env).then(({ stdout }) => stdout);
|
|
17053
|
+
}
|
|
17054
|
+
__name(runGit, "runGit");
|
|
17055
|
+
var SEPARATOR = "\0";
|
|
17056
|
+
async function fetchGitBranches(cwd, env) {
|
|
17057
|
+
await runGit(cwd, ["rev-parse", "--git-dir"], env);
|
|
17058
|
+
const [localRaw, remoteRaw, tagsRaw, headRaw, reflogRaw] = await Promise.all([
|
|
17059
|
+
runGit(
|
|
17060
|
+
cwd,
|
|
17061
|
+
[
|
|
17062
|
+
"for-each-ref",
|
|
17063
|
+
"--format=%(refname:short)%00%(HEAD)%00%(upstream:short)%00%(upstream:track,nobracket)%00%(committerdate:unix)%00%(subject)%00%(symref)%00%(push:short)%00%(push:track,nobracket)",
|
|
17064
|
+
"refs/heads/"
|
|
17065
|
+
],
|
|
17066
|
+
env
|
|
17067
|
+
).catch(() => ""),
|
|
17068
|
+
runGit(
|
|
17069
|
+
cwd,
|
|
17070
|
+
[
|
|
17071
|
+
"for-each-ref",
|
|
17072
|
+
"--format=%(refname:short)%00%(HEAD)%00%(upstream:short)%00%(upstream:track,nobracket)%00%(committerdate:unix)%00%(subject)%00%(symref)%00%(push:short)%00%(push:track,nobracket)",
|
|
17073
|
+
"refs/remotes/"
|
|
17074
|
+
],
|
|
17075
|
+
env
|
|
17076
|
+
).catch(() => ""),
|
|
17077
|
+
runGit(
|
|
17078
|
+
cwd,
|
|
17079
|
+
[
|
|
17080
|
+
"for-each-ref",
|
|
17081
|
+
"--format=%(refname:short)%00%(creatordate:unix)%00%(subject)",
|
|
17082
|
+
"--sort=-creatordate",
|
|
17083
|
+
"refs/tags/"
|
|
17084
|
+
],
|
|
17085
|
+
env
|
|
17086
|
+
).catch(() => ""),
|
|
17087
|
+
runGit(cwd, ["symbolic-ref", "--short", "HEAD"], env).catch(() => ""),
|
|
17088
|
+
runGit(
|
|
17089
|
+
cwd,
|
|
17090
|
+
["reflog", "show", "--format=%gs", `-${MAX_REFLOG_ENTRIES}`],
|
|
17091
|
+
env
|
|
17092
|
+
).catch(() => "")
|
|
17093
|
+
]);
|
|
17094
|
+
const local = parseBranchLines(localRaw);
|
|
17095
|
+
const remote = parseBranchLines(remoteRaw);
|
|
17096
|
+
const tags = parseTagLines(tagsRaw);
|
|
17097
|
+
const recent = parseRecentBranches(reflogRaw, headRaw.trim());
|
|
17098
|
+
const headTrimmed = headRaw.trim();
|
|
17099
|
+
const detached = !headTrimmed;
|
|
17100
|
+
return {
|
|
17101
|
+
local,
|
|
17102
|
+
remote,
|
|
17103
|
+
tags,
|
|
17104
|
+
recent,
|
|
17105
|
+
head: headTrimmed || await getDetachedHead(cwd, env),
|
|
17106
|
+
detached
|
|
17107
|
+
};
|
|
17108
|
+
}
|
|
17109
|
+
__name(fetchGitBranches, "fetchGitBranches");
|
|
17110
|
+
function parseBranchLines(raw) {
|
|
17111
|
+
if (!raw.trim()) return [];
|
|
17112
|
+
return raw.trim().split("\n").filter(Boolean).filter((line) => {
|
|
17113
|
+
const parts2 = line.split(SEPARATOR);
|
|
17114
|
+
return !(parts2[6] ?? "");
|
|
17115
|
+
}).map((line) => {
|
|
17116
|
+
const parts2 = line.split(SEPARATOR);
|
|
17117
|
+
const name = parts2[0] ?? "";
|
|
17118
|
+
const isHead = parts2[1] === "*";
|
|
17119
|
+
const upstream = parts2[2] || void 0;
|
|
17120
|
+
const track = parts2[3] ?? "";
|
|
17121
|
+
const commitDate = parseInt(parts2[4] ?? "0", 10) || 0;
|
|
17122
|
+
const commitSubject = parts2[5] ?? "";
|
|
17123
|
+
let ahead = 0;
|
|
17124
|
+
let behind = 0;
|
|
17125
|
+
const aheadMatch = /ahead (\d+)/.exec(track);
|
|
17126
|
+
const behindMatch = /behind (\d+)/.exec(track);
|
|
17127
|
+
if (aheadMatch) ahead = parseInt(aheadMatch[1], 10);
|
|
17128
|
+
if (behindMatch) behind = parseInt(behindMatch[1], 10);
|
|
17129
|
+
const upstreamGone = upstream !== void 0 && /\bgone\b/.test(track);
|
|
17130
|
+
const pushTarget = parts2[7] || void 0;
|
|
17131
|
+
const pushTrack = parts2[8] ?? "";
|
|
17132
|
+
const pushGone = pushTarget !== void 0 && /\bgone\b/.test(pushTrack);
|
|
17133
|
+
let pushAhead;
|
|
17134
|
+
let pushBehind;
|
|
17135
|
+
if (pushTarget !== void 0 && !pushGone) {
|
|
17136
|
+
const pa = /ahead (\d+)/.exec(pushTrack);
|
|
17137
|
+
const pb = /behind (\d+)/.exec(pushTrack);
|
|
17138
|
+
pushAhead = pa ? parseInt(pa[1], 10) : 0;
|
|
17139
|
+
pushBehind = pb ? parseInt(pb[1], 10) : 0;
|
|
17140
|
+
}
|
|
17141
|
+
return {
|
|
17142
|
+
name,
|
|
17143
|
+
isHead,
|
|
17144
|
+
upstream,
|
|
17145
|
+
...upstreamGone ? { upstreamGone } : {},
|
|
17146
|
+
ahead,
|
|
17147
|
+
behind,
|
|
17148
|
+
...pushTarget !== void 0 ? { pushTarget } : {},
|
|
17149
|
+
...pushAhead !== void 0 ? { pushAhead } : {},
|
|
17150
|
+
...pushBehind !== void 0 ? { pushBehind } : {},
|
|
17151
|
+
...pushGone ? { pushGone } : {},
|
|
17152
|
+
commitDate,
|
|
17153
|
+
commitSubject
|
|
17154
|
+
};
|
|
17155
|
+
});
|
|
17156
|
+
}
|
|
17157
|
+
__name(parseBranchLines, "parseBranchLines");
|
|
17158
|
+
function parseTagLines(raw) {
|
|
17159
|
+
if (!raw.trim()) return [];
|
|
17160
|
+
return raw.trim().split("\n").filter(Boolean).map((line) => {
|
|
17161
|
+
const parts2 = line.split(SEPARATOR);
|
|
17162
|
+
return {
|
|
17163
|
+
name: parts2[0] ?? "",
|
|
17164
|
+
date: parseInt(parts2[1] ?? "0", 10) || 0,
|
|
17165
|
+
subject: parts2[2] ?? ""
|
|
17166
|
+
};
|
|
17167
|
+
});
|
|
17168
|
+
}
|
|
17169
|
+
__name(parseTagLines, "parseTagLines");
|
|
17170
|
+
function parseRecentBranches(reflogRaw, currentHead) {
|
|
17171
|
+
if (!reflogRaw.trim()) return [];
|
|
17172
|
+
const seen = /* @__PURE__ */ new Set();
|
|
17173
|
+
const result = [];
|
|
17174
|
+
for (const line of reflogRaw.trim().split("\n")) {
|
|
17175
|
+
if (!line.startsWith("checkout: moving from ")) continue;
|
|
17176
|
+
const idx = line.indexOf(" to ");
|
|
17177
|
+
if (idx === -1) continue;
|
|
17178
|
+
const branch = line.slice(idx + 4);
|
|
17179
|
+
if (branch && !seen.has(branch) && branch !== currentHead && !/^[0-9a-f]{7,40}$/.test(branch)) {
|
|
17180
|
+
seen.add(branch);
|
|
17181
|
+
result.push(branch);
|
|
17182
|
+
if (result.length >= MAX_RECENT_BRANCHES) break;
|
|
17183
|
+
}
|
|
17184
|
+
}
|
|
17185
|
+
return result;
|
|
17186
|
+
}
|
|
17187
|
+
__name(parseRecentBranches, "parseRecentBranches");
|
|
17188
|
+
async function getDetachedHead(cwd, env) {
|
|
17189
|
+
try {
|
|
17190
|
+
const sha = await runGit(cwd, ["rev-parse", "--short", "HEAD"], env);
|
|
17191
|
+
return sha.trim();
|
|
17192
|
+
} catch {
|
|
17193
|
+
return "";
|
|
17194
|
+
}
|
|
17195
|
+
}
|
|
17196
|
+
__name(getDetachedHead, "getDetachedHead");
|
|
17197
|
+
function isValidCheckoutRef(value) {
|
|
17198
|
+
const ref = value.trim();
|
|
17199
|
+
if (!ref || ref.startsWith("-")) return false;
|
|
17200
|
+
if (ref === "HEAD") return true;
|
|
17201
|
+
return isValidRefName(ref) || isValidGitSha(ref);
|
|
17202
|
+
}
|
|
17203
|
+
__name(isValidCheckoutRef, "isValidCheckoutRef");
|
|
17204
|
+
async function gitCheckout(cwd, ref, env) {
|
|
17205
|
+
if (!isValidCheckoutRef(ref)) {
|
|
17206
|
+
throw new Error(`invalid checkout ref: ${ref}`);
|
|
17207
|
+
}
|
|
17208
|
+
const isRemoteTracking = await runGit(
|
|
17209
|
+
cwd,
|
|
17210
|
+
["show-ref", "--verify", "--quiet", `refs/remotes/${ref}`],
|
|
17211
|
+
env
|
|
17212
|
+
).then(() => true).catch(() => false);
|
|
17213
|
+
if (isRemoteTracking) {
|
|
17214
|
+
const localName = ref.slice(ref.indexOf("/") + 1);
|
|
17215
|
+
if (!isValidCheckoutRef(localName)) {
|
|
17216
|
+
throw new Error(
|
|
17217
|
+
`invalid local branch name derived from remote ref: ${localName}`
|
|
17218
|
+
);
|
|
17219
|
+
}
|
|
17220
|
+
const hasLocal = await runGit(
|
|
17221
|
+
cwd,
|
|
17222
|
+
["show-ref", "--verify", "--quiet", `refs/heads/${localName}`],
|
|
17223
|
+
env
|
|
17224
|
+
).then(() => true).catch(() => false);
|
|
17225
|
+
if (hasLocal) {
|
|
17226
|
+
await runGit(cwd, ["checkout", localName, "--"], env);
|
|
17227
|
+
} else {
|
|
17228
|
+
await runGit(cwd, ["checkout", "--track", ref], env);
|
|
17229
|
+
}
|
|
17230
|
+
const head = (await runGit(cwd, ["symbolic-ref", "--short", "HEAD"], env)).trim();
|
|
17231
|
+
return { branch: head, detached: false };
|
|
17232
|
+
}
|
|
17233
|
+
await runGit(cwd, ["checkout", ref, "--"], env);
|
|
17234
|
+
const headRaw = await runGit(
|
|
17235
|
+
cwd,
|
|
17236
|
+
["symbolic-ref", "--short", "HEAD"],
|
|
17237
|
+
env
|
|
17238
|
+
).catch(() => "");
|
|
17239
|
+
const trimmed = headRaw.trim();
|
|
17240
|
+
if (trimmed) {
|
|
17241
|
+
return { branch: trimmed, detached: false };
|
|
17242
|
+
}
|
|
17243
|
+
const sha = await runGit(cwd, ["rev-parse", "--short", "HEAD"], env);
|
|
17244
|
+
return { branch: sha.trim(), detached: true };
|
|
17245
|
+
}
|
|
17246
|
+
__name(gitCheckout, "gitCheckout");
|
|
17247
|
+
async function gitCreateBranch(cwd, name, startPoint, env) {
|
|
17248
|
+
if (!isValidRefName(name) || name.startsWith("-")) {
|
|
17249
|
+
throw new Error(`invalid branch name: ${name}`);
|
|
17250
|
+
}
|
|
17251
|
+
const args = ["checkout", "-b", name];
|
|
17252
|
+
if (startPoint) {
|
|
17253
|
+
if (!isValidCheckoutRef(startPoint)) {
|
|
17254
|
+
throw new Error(`invalid start point: ${startPoint}`);
|
|
17255
|
+
}
|
|
17256
|
+
args.push(startPoint);
|
|
17257
|
+
}
|
|
17258
|
+
args.push("--");
|
|
17259
|
+
const originalRef = (await runGit(
|
|
17260
|
+
cwd,
|
|
17261
|
+
["symbolic-ref", "--quiet", "--short", "HEAD"],
|
|
17262
|
+
env
|
|
17263
|
+
).catch(() => "")).trim();
|
|
17264
|
+
const originalCommit = originalRef ? "" : (await runGit(cwd, ["rev-parse", "HEAD"], env).catch(() => "")).trim();
|
|
17265
|
+
const startCommit = (await runGit(
|
|
17266
|
+
cwd,
|
|
17267
|
+
["rev-parse", "--verify", `${startPoint || "HEAD"}^{commit}`],
|
|
17268
|
+
env
|
|
17269
|
+
).catch(() => "")).trim();
|
|
17270
|
+
try {
|
|
17271
|
+
await runGit(cwd, args, env);
|
|
17272
|
+
} catch (err) {
|
|
17273
|
+
const nowOn = (await runGit(
|
|
17274
|
+
cwd,
|
|
17275
|
+
["symbolic-ref", "--quiet", "--short", "HEAD"],
|
|
17276
|
+
env
|
|
17277
|
+
).catch(() => "")).trim();
|
|
17278
|
+
if (nowOn === name) {
|
|
17279
|
+
if (originalRef) {
|
|
17280
|
+
await runGit(cwd, ["checkout", originalRef, "--"], env).catch(() => {
|
|
17281
|
+
});
|
|
17282
|
+
} else if (originalCommit) {
|
|
17283
|
+
await runGit(
|
|
17284
|
+
cwd,
|
|
17285
|
+
["checkout", "--detach", originalCommit, "--"],
|
|
17286
|
+
env
|
|
17287
|
+
).catch(() => {
|
|
17288
|
+
});
|
|
17289
|
+
}
|
|
17290
|
+
const newHead = (await runGit(cwd, ["rev-parse", `refs/heads/${name}`], env).catch(
|
|
17291
|
+
() => ""
|
|
17292
|
+
)).trim();
|
|
17293
|
+
if (newHead && newHead !== startCommit) {
|
|
17294
|
+
debugLogger12.warn(
|
|
17295
|
+
`gitCreateBranch: keeping branch "${name}" because it contains commits created after checkout (likely by a failing post-checkout hook)`
|
|
17296
|
+
);
|
|
17297
|
+
} else {
|
|
17298
|
+
await runGit(cwd, ["branch", "-D", name], env).catch(() => {
|
|
17299
|
+
});
|
|
17300
|
+
}
|
|
17301
|
+
}
|
|
17302
|
+
throw err;
|
|
17303
|
+
}
|
|
17304
|
+
return { branch: name, detached: false };
|
|
17305
|
+
}
|
|
17306
|
+
__name(gitCreateBranch, "gitCreateBranch");
|
|
17307
|
+
async function gitPush(cwd, opts, env) {
|
|
17308
|
+
const args = ["push"];
|
|
17309
|
+
if (opts?.force) args.push("--force-with-lease");
|
|
17310
|
+
if (opts?.setUpstream) {
|
|
17311
|
+
let branch;
|
|
17312
|
+
try {
|
|
17313
|
+
branch = (await runGit(cwd, ["symbolic-ref", "--short", "HEAD"], env)).trim();
|
|
17314
|
+
} catch {
|
|
17315
|
+
throw new Error(
|
|
17316
|
+
"cannot push with --set-upstream in detached HEAD state; check out a branch first"
|
|
17317
|
+
);
|
|
17318
|
+
}
|
|
17319
|
+
const hasUpstream = await runGit(
|
|
17320
|
+
cwd,
|
|
17321
|
+
["rev-parse", "--abbrev-ref", `${branch}@{u}`],
|
|
17322
|
+
env
|
|
17323
|
+
).catch(() => "");
|
|
17324
|
+
if (hasUpstream.trim()) {
|
|
17325
|
+
const output2 = await runGit(cwd, args, env);
|
|
17326
|
+
return { success: true, output: output2.trim() };
|
|
17327
|
+
}
|
|
17328
|
+
let remote = (await runGit(cwd, ["config", `branch.${branch}.pushRemote`], env).catch(
|
|
17329
|
+
() => ""
|
|
17330
|
+
)).trim();
|
|
17331
|
+
if (!remote) {
|
|
17332
|
+
remote = (await runGit(cwd, ["config", "remote.pushDefault"], env).catch(() => "")).trim();
|
|
17333
|
+
}
|
|
17334
|
+
if (!remote) {
|
|
17335
|
+
remote = (await runGit(cwd, ["config", `branch.${branch}.remote`], env).catch(
|
|
17336
|
+
() => ""
|
|
17337
|
+
)).trim();
|
|
17338
|
+
}
|
|
17339
|
+
if (!remote) {
|
|
17340
|
+
const remotes = (await runGit(cwd, ["remote"], env).catch(() => "")).trim();
|
|
17341
|
+
const remoteList = remotes ? remotes.split("\n") : [];
|
|
17342
|
+
remote = remoteList.length === 1 ? remoteList[0] ?? "origin" : "origin";
|
|
17343
|
+
}
|
|
17344
|
+
args.push("--set-upstream", remote, branch);
|
|
17345
|
+
}
|
|
17346
|
+
const output = await runGit(cwd, args, env);
|
|
17347
|
+
return { success: true, output: output.trim() };
|
|
17348
|
+
}
|
|
17349
|
+
__name(gitPush, "gitPush");
|
|
17350
|
+
var GitPullFailure = class extends Error {
|
|
17351
|
+
static {
|
|
17352
|
+
__name(this, "GitPullFailure");
|
|
17353
|
+
}
|
|
17354
|
+
code;
|
|
17355
|
+
constructor(code, message) {
|
|
17356
|
+
super(message);
|
|
17357
|
+
this.name = "GitPullFailure";
|
|
17358
|
+
this.code = code;
|
|
17359
|
+
}
|
|
17360
|
+
};
|
|
17361
|
+
var AUTO_STASH_MESSAGE = "qwen-code: auto-stash before pull";
|
|
17362
|
+
var OPERATION_STATE_PATHS = [
|
|
17363
|
+
["MERGE_HEAD", "merge"],
|
|
17364
|
+
["CHERRY_PICK_HEAD", "cherry-pick"],
|
|
17365
|
+
["REVERT_HEAD", "revert"],
|
|
17366
|
+
["rebase-merge", "rebase"],
|
|
17367
|
+
["rebase-apply", "rebase or am"]
|
|
17368
|
+
];
|
|
17369
|
+
function gitDetail(err) {
|
|
17370
|
+
if (err && typeof err === "object" && ("stdout" in err || "stderr" in err)) {
|
|
17371
|
+
const e = err;
|
|
17372
|
+
const detail = `${e.stdout ?? ""}
|
|
17373
|
+
${e.stderr ?? ""}`.trim();
|
|
17374
|
+
if (detail) return detail;
|
|
17375
|
+
return "git exited without diagnostic output; a stale lock file (e.g. .git/index.lock) or another git process is the usual cause";
|
|
17376
|
+
}
|
|
17377
|
+
return err instanceof Error ? err.message : String(err);
|
|
17378
|
+
}
|
|
17379
|
+
__name(gitDetail, "gitDetail");
|
|
17380
|
+
function exitCode(err) {
|
|
17381
|
+
const code = err?.code;
|
|
17382
|
+
return typeof code === "number" ? code : void 0;
|
|
17383
|
+
}
|
|
17384
|
+
__name(exitCode, "exitCode");
|
|
17385
|
+
function pullExitCode(err) {
|
|
17386
|
+
const code = exitCode(err);
|
|
17387
|
+
if (code !== void 0) return code;
|
|
17388
|
+
const e = err;
|
|
17389
|
+
if (e && (e.killed === true || typeof e.signal === "string")) return 1;
|
|
17390
|
+
return void 0;
|
|
17391
|
+
}
|
|
17392
|
+
__name(pullExitCode, "pullExitCode");
|
|
17393
|
+
async function gitPaths(cwd, names, env) {
|
|
17394
|
+
const args = ["rev-parse"];
|
|
17395
|
+
for (const name of names) args.push("--git-path", name);
|
|
17396
|
+
return (await runGit(cwd, args, env)).trim().split("\n").map((line) => path6.resolve(cwd, line));
|
|
17397
|
+
}
|
|
17398
|
+
__name(gitPaths, "gitPaths");
|
|
17399
|
+
async function operationInProgress(cwd, env) {
|
|
17400
|
+
const paths = await gitPaths(
|
|
17401
|
+
cwd,
|
|
17402
|
+
OPERATION_STATE_PATHS.map(([statePath]) => statePath),
|
|
17403
|
+
env
|
|
17404
|
+
);
|
|
17405
|
+
for (let i = 0; i < OPERATION_STATE_PATHS.length; i++) {
|
|
17406
|
+
if (fs7.existsSync(paths[i])) return OPERATION_STATE_PATHS[i][1];
|
|
17407
|
+
}
|
|
17408
|
+
return void 0;
|
|
17409
|
+
}
|
|
17410
|
+
__name(operationInProgress, "operationInProgress");
|
|
17411
|
+
async function refuseOperationInProgress(cwd, env) {
|
|
17412
|
+
const operation = await operationInProgress(cwd, env);
|
|
17413
|
+
if (operation) {
|
|
17414
|
+
throw new GitPullFailure(
|
|
17415
|
+
"operation_in_progress",
|
|
17416
|
+
`cannot update: a ${operation} is in progress; finish or abort it from a terminal first`
|
|
17417
|
+
);
|
|
17418
|
+
}
|
|
17419
|
+
}
|
|
17420
|
+
__name(refuseOperationInProgress, "refuseOperationInProgress");
|
|
17421
|
+
async function upstreamSha(cwd, env, ref = "") {
|
|
17422
|
+
try {
|
|
17423
|
+
return (await runGit(
|
|
17424
|
+
cwd,
|
|
17425
|
+
["rev-parse", "--verify", "--quiet", `${ref}@{upstream}`],
|
|
17426
|
+
env
|
|
17427
|
+
)).trim();
|
|
17428
|
+
} catch {
|
|
17429
|
+
return "";
|
|
17430
|
+
}
|
|
17431
|
+
}
|
|
17432
|
+
__name(upstreamSha, "upstreamSha");
|
|
17433
|
+
function readTrimmed(file) {
|
|
17434
|
+
try {
|
|
17435
|
+
return fs7.readFileSync(file, "utf8").trim();
|
|
17436
|
+
} catch {
|
|
17437
|
+
return "";
|
|
17438
|
+
}
|
|
17439
|
+
}
|
|
17440
|
+
__name(readTrimmed, "readTrimmed");
|
|
17441
|
+
async function abortOwnPullState(cwd, pullExitCode2, env) {
|
|
17442
|
+
if (pullExitCode2 !== 1) return;
|
|
17443
|
+
try {
|
|
17444
|
+
const [mergeHead, rebaseMergeDir, rebaseApplyDir] = await gitPaths(
|
|
17445
|
+
cwd,
|
|
17446
|
+
["MERGE_HEAD", "rebase-merge", "rebase-apply"],
|
|
17447
|
+
env
|
|
17448
|
+
);
|
|
17449
|
+
if (fs7.existsSync(mergeHead)) {
|
|
17450
|
+
const upstream = await upstreamSha(cwd, env);
|
|
17451
|
+
if (upstream && readTrimmed(mergeHead) === upstream) {
|
|
17452
|
+
await runGit(cwd, ["merge", "--abort"], env);
|
|
17453
|
+
}
|
|
17454
|
+
return;
|
|
17455
|
+
}
|
|
17456
|
+
for (const dir of [rebaseMergeDir, rebaseApplyDir]) {
|
|
17457
|
+
if (!fs7.existsSync(dir)) continue;
|
|
17458
|
+
const headName = readTrimmed(path6.join(dir, "head-name")).replace(
|
|
17459
|
+
/^refs\/heads\//,
|
|
17460
|
+
""
|
|
17461
|
+
);
|
|
17462
|
+
const upstream = headName ? await upstreamSha(cwd, env, headName) : "";
|
|
17463
|
+
if (upstream && readTrimmed(path6.join(dir, "onto")) === upstream) {
|
|
17464
|
+
await runGit(cwd, ["rebase", "--abort"], env);
|
|
17465
|
+
}
|
|
17466
|
+
return;
|
|
17467
|
+
}
|
|
17468
|
+
} catch {
|
|
17469
|
+
}
|
|
17470
|
+
}
|
|
17471
|
+
__name(abortOwnPullState, "abortOwnPullState");
|
|
17472
|
+
async function stashEntries(cwd, env) {
|
|
17473
|
+
const raw = await runGit(cwd, ["stash", "list", "--format=%H%x00%s"], env);
|
|
17474
|
+
return raw.split("\n").filter((line) => line.includes("\0")).map((line) => {
|
|
17475
|
+
const [sha, subject] = line.split("\0");
|
|
17476
|
+
return { sha, subject: subject ?? "" };
|
|
17477
|
+
});
|
|
17478
|
+
}
|
|
17479
|
+
__name(stashEntries, "stashEntries");
|
|
17480
|
+
function parseDroppedStashSha(output) {
|
|
17481
|
+
const match = /\(([0-9a-f]{40,64})\)\s*$/m.exec(output.trim());
|
|
17482
|
+
return match?.[1];
|
|
17483
|
+
}
|
|
17484
|
+
__name(parseDroppedStashSha, "parseDroppedStashSha");
|
|
17485
|
+
async function restoreStash(cwd, sha, env) {
|
|
17486
|
+
let output = "";
|
|
17487
|
+
try {
|
|
17488
|
+
await runGit(cwd, ["stash", "apply", sha], env);
|
|
17489
|
+
} catch (err) {
|
|
17490
|
+
return { restored: false, output: gitDetail(err) };
|
|
17491
|
+
}
|
|
17492
|
+
let entries;
|
|
17493
|
+
try {
|
|
17494
|
+
entries = await stashEntries(cwd, env);
|
|
17495
|
+
} catch (err) {
|
|
17496
|
+
return {
|
|
17497
|
+
restored: true,
|
|
17498
|
+
output: `restored, but stash entry ${sha} was kept because the stash could not be listed:
|
|
17499
|
+
${gitDetail(err)}`
|
|
17500
|
+
};
|
|
17501
|
+
}
|
|
17502
|
+
const index = entries.findIndex((entry) => entry.sha === sha);
|
|
17503
|
+
if (index === -1) return { restored: true, output };
|
|
17504
|
+
const slot = `stash@{${index}}`;
|
|
17505
|
+
let dropped;
|
|
17506
|
+
try {
|
|
17507
|
+
dropped = parseDroppedStashSha(
|
|
17508
|
+
await runGit(cwd, ["stash", "drop", slot], env)
|
|
17509
|
+
);
|
|
17510
|
+
} catch (err) {
|
|
17511
|
+
return {
|
|
17512
|
+
restored: true,
|
|
17513
|
+
output: `restored, but stash entry ${slot} (${sha}) could not be dropped:
|
|
17514
|
+
${gitDetail(err)}`
|
|
17515
|
+
};
|
|
17516
|
+
}
|
|
17517
|
+
if (dropped !== void 0 && dropped !== sha) {
|
|
17518
|
+
const subject = (await runGit(cwd, ["log", "-1", "--format=%s", dropped], env).catch(
|
|
17519
|
+
() => ""
|
|
17520
|
+
)).trim();
|
|
17521
|
+
const storeArgs = ["stash", "store", "--quiet"];
|
|
17522
|
+
if (subject) storeArgs.push("-m", subject);
|
|
17523
|
+
storeArgs.push(dropped);
|
|
17524
|
+
const stored = await runGit(cwd, storeArgs, env).then(() => true).catch(() => false);
|
|
17525
|
+
output = stored ? `restored; stash entry ${sha} was kept because the stash changed while dropping it` : `restored; stash entry ${sha} was kept because the stash changed while dropping it, and the displaced entry ${dropped} could not be stored back \u2014 recover it with: git stash store ${dropped}`;
|
|
17526
|
+
}
|
|
17527
|
+
return { restored: true, output };
|
|
17528
|
+
}
|
|
17529
|
+
__name(restoreStash, "restoreStash");
|
|
17530
|
+
function pullArgs(opts) {
|
|
17531
|
+
const args = ["pull"];
|
|
17532
|
+
if (opts?.rebase) args.push("--rebase");
|
|
17533
|
+
return args;
|
|
17534
|
+
}
|
|
17535
|
+
__name(pullArgs, "pullArgs");
|
|
17536
|
+
async function validatedUpstream(cwd, env) {
|
|
17537
|
+
const sha = await upstreamSha(cwd, env);
|
|
17538
|
+
if (sha) return sha;
|
|
17539
|
+
let branch;
|
|
17540
|
+
try {
|
|
17541
|
+
branch = (await runGit(cwd, ["symbolic-ref", "--quiet", "--short", "HEAD"], env)).trim();
|
|
17542
|
+
} catch {
|
|
17543
|
+
throw new GitPullFailure(
|
|
17544
|
+
"pull_failed",
|
|
17545
|
+
"cannot update: HEAD is detached; check out a branch from a terminal first"
|
|
17546
|
+
);
|
|
17547
|
+
}
|
|
17548
|
+
const configured = (await runGit(
|
|
17549
|
+
cwd,
|
|
17550
|
+
["for-each-ref", "--format=%(upstream)", `refs/heads/${branch}`],
|
|
17551
|
+
env
|
|
17552
|
+
).catch(() => "")).trim();
|
|
17553
|
+
if (configured) {
|
|
17554
|
+
throw new GitPullFailure(
|
|
17555
|
+
"pull_failed",
|
|
17556
|
+
"cannot update: the upstream branch no longer exists on the remote; nothing was changed"
|
|
17557
|
+
);
|
|
17558
|
+
}
|
|
17559
|
+
await runGit(cwd, ["rev-parse", "--abbrev-ref", "@{upstream}"], env);
|
|
17560
|
+
throw new GitPullFailure(
|
|
17561
|
+
"pull_failed",
|
|
17562
|
+
"cannot update: the upstream branch could not be resolved; nothing was changed"
|
|
17563
|
+
);
|
|
17564
|
+
}
|
|
17565
|
+
__name(validatedUpstream, "validatedUpstream");
|
|
17566
|
+
async function pushAutoStash(cwd, env) {
|
|
17567
|
+
const before = new Set((await stashEntries(cwd, env)).map((e) => e.sha));
|
|
17568
|
+
await refuseOperationInProgress(cwd, env);
|
|
17569
|
+
try {
|
|
17570
|
+
await runGit(
|
|
17571
|
+
cwd,
|
|
17572
|
+
["stash", "push", "--include-untracked", "-m", AUTO_STASH_MESSAGE],
|
|
17573
|
+
env
|
|
17574
|
+
);
|
|
17575
|
+
} catch (err) {
|
|
17576
|
+
throw new GitPullFailure(
|
|
17577
|
+
"pull_failed",
|
|
17578
|
+
`cannot stash the local changes, so the update was not attempted:
|
|
17579
|
+
${gitDetail(err)}`
|
|
17580
|
+
);
|
|
17581
|
+
}
|
|
17582
|
+
let after;
|
|
17583
|
+
try {
|
|
17584
|
+
after = await stashEntries(cwd, env);
|
|
17585
|
+
} catch (err) {
|
|
17586
|
+
throw new GitPullFailure(
|
|
17587
|
+
"pull_failed",
|
|
17588
|
+
`cannot identify the auto-stash entry, so the update was not attempted; your changes are in the entry labelled "${AUTO_STASH_MESSAGE}" in git stash list:
|
|
17589
|
+
${gitDetail(err)}`
|
|
17590
|
+
);
|
|
17591
|
+
}
|
|
17592
|
+
const created = after.filter(
|
|
17593
|
+
(e) => !before.has(e.sha) && e.subject.endsWith(AUTO_STASH_MESSAGE)
|
|
17594
|
+
);
|
|
17595
|
+
return created.length > 0 ? created[created.length - 1].sha : void 0;
|
|
17596
|
+
}
|
|
17597
|
+
__name(pushAutoStash, "pushAutoStash");
|
|
17598
|
+
async function stashPull(cwd, opts, env) {
|
|
17599
|
+
await refuseOperationInProgress(cwd, env);
|
|
17600
|
+
await runGit(cwd, ["fetch", "--prune"], env);
|
|
17601
|
+
await validatedUpstream(cwd, env);
|
|
17602
|
+
const stashed = await pushAutoStash(cwd, env);
|
|
17603
|
+
let output;
|
|
17604
|
+
try {
|
|
17605
|
+
output = (await runGit(cwd, pullArgs(opts), env)).trim();
|
|
17606
|
+
} catch (err) {
|
|
17607
|
+
const detail = gitDetail(err);
|
|
17608
|
+
await abortOwnPullState(cwd, pullExitCode(err), env);
|
|
17609
|
+
if (stashed === void 0) {
|
|
17610
|
+
throw new GitPullFailure("pull_failed", `update failed:
|
|
17611
|
+
${detail}`);
|
|
17612
|
+
}
|
|
17613
|
+
const restore2 = await restoreStash(cwd, stashed, env);
|
|
17614
|
+
throw new GitPullFailure(
|
|
17615
|
+
"pull_failed",
|
|
17616
|
+
restore2.restored ? `update failed; your local changes were restored${restore2.output ? ` (${restore2.output})` : ""}:
|
|
17617
|
+
${detail}` : `update failed and your local changes could not be restored automatically; they are kept in stash entry ${stashed}:
|
|
17618
|
+
${restore2.output}
|
|
17619
|
+
${detail}`
|
|
17620
|
+
);
|
|
17621
|
+
}
|
|
17622
|
+
if (stashed === void 0) return { success: true, output };
|
|
17623
|
+
const restore = await restoreStash(cwd, stashed, env);
|
|
17624
|
+
if (restore.restored) {
|
|
17625
|
+
if (restore.output === "") return { success: true, output };
|
|
17626
|
+
return {
|
|
17627
|
+
success: true,
|
|
17628
|
+
stashKept: true,
|
|
17629
|
+
stashSha: stashed,
|
|
17630
|
+
output: `${output}
|
|
17631
|
+
${restore.output}`.trim()
|
|
17632
|
+
};
|
|
17633
|
+
}
|
|
17634
|
+
return {
|
|
17635
|
+
success: true,
|
|
17636
|
+
stashRestoreConflict: true,
|
|
17637
|
+
stashSha: stashed,
|
|
17638
|
+
output: `${output}
|
|
17639
|
+
restoring your local changes failed; they are kept in stash entry ${stashed}:
|
|
17640
|
+
${restore.output}`.trim()
|
|
17641
|
+
};
|
|
17642
|
+
}
|
|
17643
|
+
__name(stashPull, "stashPull");
|
|
17644
|
+
async function forcePull(cwd, env) {
|
|
17645
|
+
await refuseOperationInProgress(cwd, env);
|
|
17646
|
+
const toplevel = (await runGit(cwd, ["rev-parse", "--show-toplevel"], env)).trim();
|
|
17647
|
+
if (await fs7.promises.realpath(cwd) !== await fs7.promises.realpath(toplevel)) {
|
|
17648
|
+
throw new GitPullFailure(
|
|
17649
|
+
"force_unsupported",
|
|
17650
|
+
"cannot discard changes: the workspace is a subdirectory of its repository, so discarding would also reset changes outside the workspace; resolve them from a terminal"
|
|
17651
|
+
);
|
|
17652
|
+
}
|
|
17653
|
+
await runGit(cwd, ["fetch", "--prune"], env);
|
|
17654
|
+
const validated = await validatedUpstream(cwd, env);
|
|
17655
|
+
try {
|
|
17656
|
+
await runGit(cwd, ["merge-base", "--is-ancestor", "HEAD", validated], env);
|
|
17657
|
+
} catch (err) {
|
|
17658
|
+
if (exitCode(err) === 1) {
|
|
17659
|
+
throw new GitPullFailure(
|
|
17660
|
+
"diverged",
|
|
17661
|
+
"cannot discard and update: the branch has diverged from its upstream; merge or rebase the local commits from a terminal first"
|
|
17662
|
+
);
|
|
17663
|
+
}
|
|
17664
|
+
throw err;
|
|
17665
|
+
}
|
|
17666
|
+
await refuseOperationInProgress(cwd, env);
|
|
17667
|
+
await runGit(cwd, ["reset", "--hard"], env);
|
|
17668
|
+
await runGit(cwd, ["clean", "-fd"], env);
|
|
17669
|
+
let output;
|
|
17670
|
+
try {
|
|
17671
|
+
output = await runGit(cwd, ["merge", "--ff-only", validated], env);
|
|
17672
|
+
} catch (err) {
|
|
17673
|
+
throw new GitPullFailure(
|
|
17674
|
+
"pull_failed",
|
|
17675
|
+
`discard applied, but the update failed:
|
|
17676
|
+
${gitDetail(err)}`
|
|
17677
|
+
);
|
|
17678
|
+
}
|
|
17679
|
+
return { success: true, output: output.trim() };
|
|
17680
|
+
}
|
|
17681
|
+
__name(forcePull, "forcePull");
|
|
17682
|
+
async function gitPull(cwd, opts, env) {
|
|
17683
|
+
if (opts?.stash && opts?.force) {
|
|
17684
|
+
throw new Error("stash and force are mutually exclusive");
|
|
17685
|
+
}
|
|
17686
|
+
if (opts?.fetchOnly && (opts?.stash || opts?.force)) {
|
|
17687
|
+
throw new Error("fetchOnly cannot be combined with stash or force");
|
|
17688
|
+
}
|
|
17689
|
+
if (opts?.fetchOnly) {
|
|
17690
|
+
const output2 = await runGit(cwd, ["fetch", "--all", "--prune"], env);
|
|
17691
|
+
return { success: true, output: output2.trim() };
|
|
17692
|
+
}
|
|
17693
|
+
if (opts?.force) return forcePull(cwd, env);
|
|
17694
|
+
if (opts?.stash) return stashPull(cwd, opts, env);
|
|
17695
|
+
const output = await runGit(cwd, pullArgs(opts), env);
|
|
17696
|
+
return { success: true, output: output.trim() };
|
|
17697
|
+
}
|
|
17698
|
+
__name(gitPull, "gitPull");
|
|
17699
|
+
async function gitCommit(cwd, message, opts, env) {
|
|
17700
|
+
let savedIndex = null;
|
|
17701
|
+
if (opts?.all) {
|
|
17702
|
+
const tree = (await runGit(cwd, ["write-tree"], env).catch(() => "")).trim();
|
|
17703
|
+
if (tree) {
|
|
17704
|
+
savedIndex = tree;
|
|
17705
|
+
} else {
|
|
17706
|
+
const unmerged = (await runGit(cwd, ["ls-files", "--unmerged"], env)).trim();
|
|
17707
|
+
if (unmerged) {
|
|
17708
|
+
throw new Error(
|
|
17709
|
+
"cannot stage all changes: unresolved merge conflicts in the index"
|
|
17710
|
+
);
|
|
17711
|
+
}
|
|
17712
|
+
throw new Error(
|
|
17713
|
+
"cannot stage all changes: failed to snapshot index (write-tree failed)"
|
|
17714
|
+
);
|
|
17715
|
+
}
|
|
17716
|
+
}
|
|
17717
|
+
try {
|
|
17718
|
+
if (opts?.all) {
|
|
17719
|
+
await runGit(cwd, ["add", "-A"], env);
|
|
17720
|
+
}
|
|
17721
|
+
await runGit(cwd, ["commit", "-m", message], env);
|
|
17722
|
+
} catch (err) {
|
|
17723
|
+
if (savedIndex) {
|
|
17724
|
+
await runGit(cwd, ["read-tree", savedIndex], env).catch((rollbackErr) => {
|
|
17725
|
+
console.error("git index rollback failed:", rollbackErr);
|
|
17726
|
+
});
|
|
17727
|
+
}
|
|
17728
|
+
throw err;
|
|
17729
|
+
}
|
|
17730
|
+
const sha = (await runGit(cwd, ["rev-parse", "--short", "HEAD"], env)).trim();
|
|
17731
|
+
const subject = (await runGit(cwd, ["log", "-1", "--format=%s"], env)).trim();
|
|
17732
|
+
return { sha, subject };
|
|
17733
|
+
}
|
|
17734
|
+
__name(gitCommit, "gitCommit");
|
|
17735
|
+
|
|
17736
|
+
// packages/core/src/utils/gitDiff.ts
|
|
17737
|
+
var execFileAsync2 = promisify2(execFile2);
|
|
17738
|
+
var GIT_TIMEOUT_MS2 = 5e3;
|
|
16759
17739
|
var MAX_FILES = 50;
|
|
16760
17740
|
var MAX_DIFF_SIZE_BYTES = 1e6;
|
|
16761
17741
|
var MAX_LINES_PER_FILE = 400;
|
|
@@ -16786,7 +17766,7 @@ async function fetchGitDiff(cwd) {
|
|
|
16786
17766
|
if (!gitRoot) return null;
|
|
16787
17767
|
if (await isInTransientGitState(gitRoot)) return null;
|
|
16788
17768
|
const [shortstatOut, untrackedOut] = await Promise.all([
|
|
16789
|
-
|
|
17769
|
+
runGit2(
|
|
16790
17770
|
[
|
|
16791
17771
|
"--no-optional-locks",
|
|
16792
17772
|
"diff",
|
|
@@ -16797,7 +17777,7 @@ async function fetchGitDiff(cwd) {
|
|
|
16797
17777
|
],
|
|
16798
17778
|
gitRoot
|
|
16799
17779
|
),
|
|
16800
|
-
|
|
17780
|
+
runGit2(
|
|
16801
17781
|
[
|
|
16802
17782
|
"--no-optional-locks",
|
|
16803
17783
|
"ls-files",
|
|
@@ -16820,7 +17800,7 @@ async function fetchGitDiff(cwd) {
|
|
|
16820
17800
|
};
|
|
16821
17801
|
}
|
|
16822
17802
|
const [numstatOut, nameStatusOut] = await Promise.all([
|
|
16823
|
-
|
|
17803
|
+
runGit2(
|
|
16824
17804
|
[
|
|
16825
17805
|
"--no-optional-locks",
|
|
16826
17806
|
"diff",
|
|
@@ -16832,7 +17812,7 @@ async function fetchGitDiff(cwd) {
|
|
|
16832
17812
|
],
|
|
16833
17813
|
gitRoot
|
|
16834
17814
|
),
|
|
16835
|
-
|
|
17815
|
+
runGit2(
|
|
16836
17816
|
[
|
|
16837
17817
|
"--no-optional-locks",
|
|
16838
17818
|
"diff",
|
|
@@ -16859,7 +17839,7 @@ async function fetchGitDiff(cwd) {
|
|
|
16859
17839
|
const lineStats = await mapWithConcurrency(
|
|
16860
17840
|
untrackedPaths,
|
|
16861
17841
|
MAX_FILES,
|
|
16862
|
-
(relPath) => countUntrackedLines(
|
|
17842
|
+
(relPath) => countUntrackedLines(path7.join(gitRoot, relPath))
|
|
16863
17843
|
);
|
|
16864
17844
|
for (const s3 of lineStats) stats.linesAdded += s3.added;
|
|
16865
17845
|
const remainingSlots = Math.max(0, MAX_FILES - perFileStats.size);
|
|
@@ -16887,7 +17867,7 @@ async function fetchGitDiffHunks(cwd) {
|
|
|
16887
17867
|
const gitRoot = findGitRoot(cwd);
|
|
16888
17868
|
if (!gitRoot) return /* @__PURE__ */ new Map();
|
|
16889
17869
|
if (await isInTransientGitState(gitRoot)) return /* @__PURE__ */ new Map();
|
|
16890
|
-
const diffOut = await
|
|
17870
|
+
const diffOut = await runGit2(
|
|
16891
17871
|
["--no-optional-locks", "diff", "--no-ext-diff", "--no-textconv", "HEAD"],
|
|
16892
17872
|
gitRoot
|
|
16893
17873
|
);
|
|
@@ -16912,7 +17892,7 @@ async function fetchGitDiffHunksForFile(cwd, filePath, oldPath) {
|
|
|
16912
17892
|
diffArgs.push("HEAD", "--");
|
|
16913
17893
|
if (oldRelPath != null) diffArgs.push(oldRelPath);
|
|
16914
17894
|
diffArgs.push(relPath);
|
|
16915
|
-
const diffOut = await
|
|
17895
|
+
const diffOut = await runGit2(diffArgs, gitRoot);
|
|
16916
17896
|
if (diffOut == null) return null;
|
|
16917
17897
|
const truncatedPaths = /* @__PURE__ */ new Set();
|
|
16918
17898
|
const parsed = parseGitDiff(diffOut, truncatedPaths);
|
|
@@ -16920,7 +17900,7 @@ async function fetchGitDiffHunksForFile(cwd, filePath, oldPath) {
|
|
|
16920
17900
|
const [key, hunks] = parsed.entries().next().value;
|
|
16921
17901
|
return { hunks: hunks ?? [], truncated: truncatedPaths.has(key) };
|
|
16922
17902
|
}
|
|
16923
|
-
const untrackedOut = await
|
|
17903
|
+
const untrackedOut = await runGit2(
|
|
16924
17904
|
[
|
|
16925
17905
|
"--no-optional-locks",
|
|
16926
17906
|
"ls-files",
|
|
@@ -16938,7 +17918,7 @@ async function fetchGitDiffHunksForFile(cwd, filePath, oldPath) {
|
|
|
16938
17918
|
}
|
|
16939
17919
|
__name(fetchGitDiffHunksForFile, "fetchGitDiffHunksForFile");
|
|
16940
17920
|
function toRepoRelativePath(gitRoot, filePath) {
|
|
16941
|
-
if (!
|
|
17921
|
+
if (!path7.isAbsolute(filePath)) {
|
|
16942
17922
|
if (filePath.length === 0) return null;
|
|
16943
17923
|
if (filePath.startsWith("/") || filePath.startsWith("\\")) return null;
|
|
16944
17924
|
if (/^[A-Za-z]:/.test(filePath)) return null;
|
|
@@ -16946,16 +17926,16 @@ function toRepoRelativePath(gitRoot, filePath) {
|
|
|
16946
17926
|
return null;
|
|
16947
17927
|
return filePath;
|
|
16948
17928
|
}
|
|
16949
|
-
const rel =
|
|
16950
|
-
if (rel === "" || rel === ".." || rel.startsWith(`..${
|
|
17929
|
+
const rel = path7.relative(gitRoot, filePath);
|
|
17930
|
+
if (rel === "" || rel === ".." || rel.startsWith(`..${path7.sep}`) || path7.isAbsolute(rel))
|
|
16951
17931
|
return null;
|
|
16952
17932
|
return rel;
|
|
16953
17933
|
}
|
|
16954
17934
|
__name(toRepoRelativePath, "toRepoRelativePath");
|
|
16955
17935
|
async function synthesizeUntrackedHunk(gitRoot, filePath) {
|
|
16956
|
-
const absPath =
|
|
17936
|
+
const absPath = path7.join(gitRoot, filePath);
|
|
16957
17937
|
try {
|
|
16958
|
-
const lst = await
|
|
17938
|
+
const lst = await lstat3(absPath);
|
|
16959
17939
|
if (!lst.isFile()) return null;
|
|
16960
17940
|
} catch {
|
|
16961
17941
|
return null;
|
|
@@ -17286,7 +18266,7 @@ __name(splitNulDelimited, "splitNulDelimited");
|
|
|
17286
18266
|
async function countUntrackedLines(absPath) {
|
|
17287
18267
|
let st2;
|
|
17288
18268
|
try {
|
|
17289
|
-
st2 = await
|
|
18269
|
+
st2 = await lstat3(absPath);
|
|
17290
18270
|
} catch {
|
|
17291
18271
|
return { added: 0, isBinary: true, truncated: false };
|
|
17292
18272
|
}
|
|
@@ -17348,16 +18328,16 @@ async function resolveGitDir(cwd) {
|
|
|
17348
18328
|
}
|
|
17349
18329
|
__name(resolveGitDir, "resolveGitDir");
|
|
17350
18330
|
async function resolveGitDirFromRoot(gitRoot) {
|
|
17351
|
-
const dotGit =
|
|
18331
|
+
const dotGit = path7.join(gitRoot, ".git");
|
|
17352
18332
|
try {
|
|
17353
|
-
const s3 = await
|
|
18333
|
+
const s3 = await stat2(dotGit);
|
|
17354
18334
|
if (s3.isDirectory()) return dotGit;
|
|
17355
18335
|
if (!s3.isFile()) return null;
|
|
17356
18336
|
const content = await readFile2(dotGit, "utf8");
|
|
17357
18337
|
const match = content.match(/^gitdir:\s*(.+?)\s*$/m);
|
|
17358
18338
|
if (!match || !match[1]) return null;
|
|
17359
18339
|
const raw = match[1];
|
|
17360
|
-
return
|
|
18340
|
+
return path7.isAbsolute(raw) ? raw : path7.resolve(gitRoot, raw);
|
|
17361
18341
|
} catch {
|
|
17362
18342
|
return null;
|
|
17363
18343
|
}
|
|
@@ -17375,7 +18355,7 @@ async function isInTransientGitState(gitRoot) {
|
|
|
17375
18355
|
];
|
|
17376
18356
|
const results = await Promise.all(
|
|
17377
18357
|
transientPaths.map(
|
|
17378
|
-
(name) =>
|
|
18358
|
+
(name) => access2(path7.join(gitDir, name)).then(() => true).catch(() => false)
|
|
17379
18359
|
)
|
|
17380
18360
|
);
|
|
17381
18361
|
return results.some(Boolean);
|
|
@@ -17395,28 +18375,45 @@ async function mapWithConcurrency(items, limit, fn) {
|
|
|
17395
18375
|
return results;
|
|
17396
18376
|
}
|
|
17397
18377
|
__name(mapWithConcurrency, "mapWithConcurrency");
|
|
17398
|
-
async function
|
|
18378
|
+
async function runGit2(args, cwd, env) {
|
|
17399
18379
|
const fullArgs = ["-c", "core.quotepath=false", ...NO_EXEC_CONFIG, ...args];
|
|
17400
18380
|
try {
|
|
17401
|
-
const { stdout } = await
|
|
18381
|
+
const { stdout } = await execFileAsync2("git", fullArgs, {
|
|
17402
18382
|
cwd,
|
|
17403
|
-
timeout:
|
|
18383
|
+
timeout: GIT_TIMEOUT_MS2,
|
|
17404
18384
|
maxBuffer: 64 * 1024 * 1024,
|
|
17405
18385
|
windowsHide: true,
|
|
17406
|
-
encoding: "utf8"
|
|
18386
|
+
encoding: "utf8",
|
|
18387
|
+
// Given one, the caller's environment and not the process's: a daemon
|
|
18388
|
+
// serving several workspaces runs git for each in that workspace's own
|
|
18389
|
+
// environment, with the variables that would point git at some other
|
|
18390
|
+
// repository taken out. Without one, the process's, as before.
|
|
18391
|
+
...env ? { env: gitEnv(env) } : {}
|
|
17407
18392
|
});
|
|
17408
18393
|
return stdout;
|
|
17409
18394
|
} catch {
|
|
17410
18395
|
return null;
|
|
17411
18396
|
}
|
|
17412
18397
|
}
|
|
17413
|
-
__name(
|
|
17414
|
-
async function getGitWorkingTreeStatus(cwd) {
|
|
18398
|
+
__name(runGit2, "runGit");
|
|
18399
|
+
async function getGitWorkingTreeStatus(cwd, options2 = {}) {
|
|
17415
18400
|
const gitRoot = findGitRoot(cwd);
|
|
17416
18401
|
if (!gitRoot) return null;
|
|
17417
|
-
const stdout = await
|
|
17418
|
-
[
|
|
17419
|
-
|
|
18402
|
+
const stdout = await runGit2(
|
|
18403
|
+
[
|
|
18404
|
+
"--no-optional-locks",
|
|
18405
|
+
// A repository can set `status.showUntrackedFiles = no`, which hides
|
|
18406
|
+
// untracked files from `git status` — and from git's own safety check.
|
|
18407
|
+
// A caller about to destroy the directory asks for them anyway;
|
|
18408
|
+
// `normal` is the default, so the output it gets is the ordinary one.
|
|
18409
|
+
...options2.countHiddenUntracked ? ["-c", "status.showUntrackedFiles=normal"] : [],
|
|
18410
|
+
"status",
|
|
18411
|
+
"--porcelain=v1",
|
|
18412
|
+
"--branch",
|
|
18413
|
+
"-z"
|
|
18414
|
+
],
|
|
18415
|
+
gitRoot,
|
|
18416
|
+
options2.env
|
|
17420
18417
|
);
|
|
17421
18418
|
if (stdout == null) return null;
|
|
17422
18419
|
const tokens = stdout.split("\0");
|
|
@@ -17522,7 +18519,7 @@ async function detectGitOperation(gitRoot) {
|
|
|
17522
18519
|
];
|
|
17523
18520
|
for (const [name, op] of checks) {
|
|
17524
18521
|
try {
|
|
17525
|
-
await
|
|
18522
|
+
await access2(path7.join(gitDir, name));
|
|
17526
18523
|
return op;
|
|
17527
18524
|
} catch {
|
|
17528
18525
|
}
|
|
@@ -17531,18 +18528,18 @@ async function detectGitOperation(gitRoot) {
|
|
|
17531
18528
|
}
|
|
17532
18529
|
__name(detectGitOperation, "detectGitOperation");
|
|
17533
18530
|
async function resolveCommonGitDir(gitDir) {
|
|
17534
|
-
const raw = (await readFirstLineNoFollow(
|
|
18531
|
+
const raw = (await readFirstLineNoFollow(path7.join(gitDir, "commondir")))?.trim();
|
|
17535
18532
|
if (!raw) return gitDir;
|
|
17536
|
-
return
|
|
18533
|
+
return path7.isAbsolute(raw) ? raw : path7.resolve(gitDir, raw);
|
|
17537
18534
|
}
|
|
17538
18535
|
__name(resolveCommonGitDir, "resolveCommonGitDir");
|
|
17539
18536
|
async function countStashEntries(gitRoot) {
|
|
17540
18537
|
const gitDir = await resolveGitDirFromRoot(gitRoot);
|
|
17541
18538
|
if (!gitDir) return 0;
|
|
17542
18539
|
const commonDir = await resolveCommonGitDir(gitDir);
|
|
17543
|
-
const stashLog =
|
|
18540
|
+
const stashLog = path7.join(commonDir, "logs", "refs", "stash");
|
|
17544
18541
|
try {
|
|
17545
|
-
const st2 = await
|
|
18542
|
+
const st2 = await lstat3(stashLog);
|
|
17546
18543
|
if (!st2.isFile()) return 0;
|
|
17547
18544
|
} catch {
|
|
17548
18545
|
return 0;
|
|
@@ -17604,7 +18601,7 @@ async function fetchGitLog(cwd, options2) {
|
|
|
17604
18601
|
if (search) {
|
|
17605
18602
|
return searchGitLog(gitRoot, revisions, search, limit, skip);
|
|
17606
18603
|
}
|
|
17607
|
-
const stdout = await
|
|
18604
|
+
const stdout = await runGit2(
|
|
17608
18605
|
[
|
|
17609
18606
|
"--no-optional-locks",
|
|
17610
18607
|
"log",
|
|
@@ -17620,7 +18617,7 @@ async function fetchGitLog(cwd, options2) {
|
|
|
17620
18617
|
gitRoot
|
|
17621
18618
|
);
|
|
17622
18619
|
if (stdout === null) {
|
|
17623
|
-
const head = await
|
|
18620
|
+
const head = await runGit2(["rev-parse", "--verify", "HEAD"], gitRoot);
|
|
17624
18621
|
return head === null ? { entries: [], hasMore: false } : null;
|
|
17625
18622
|
}
|
|
17626
18623
|
const entries = parseLogRecords(stdout);
|
|
@@ -17629,7 +18626,7 @@ async function fetchGitLog(cwd, options2) {
|
|
|
17629
18626
|
__name(fetchGitLog, "fetchGitLog");
|
|
17630
18627
|
async function searchGitLog(gitRoot, revisions, query, limit, skip) {
|
|
17631
18628
|
const window2 = String(skip + limit + 1);
|
|
17632
|
-
const walk = /* @__PURE__ */ __name((filter) =>
|
|
18629
|
+
const walk = /* @__PURE__ */ __name((filter) => runGit2(
|
|
17633
18630
|
[
|
|
17634
18631
|
"--no-optional-locks",
|
|
17635
18632
|
"log",
|
|
@@ -17649,7 +18646,7 @@ async function searchGitLog(gitRoot, revisions, query, limit, skip) {
|
|
|
17649
18646
|
const runs = [walk(`--grep=${query}`), walk(`--author=${query}`)];
|
|
17650
18647
|
if (/^[0-9a-f]{4,40}$/i.test(query)) {
|
|
17651
18648
|
runs.push(
|
|
17652
|
-
|
|
18649
|
+
runGit2(
|
|
17653
18650
|
[
|
|
17654
18651
|
"rev-parse",
|
|
17655
18652
|
"--verify",
|
|
@@ -17659,7 +18656,7 @@ async function searchGitLog(gitRoot, revisions, query, limit, skip) {
|
|
|
17659
18656
|
],
|
|
17660
18657
|
gitRoot
|
|
17661
18658
|
).then(
|
|
17662
|
-
(sha) => sha ?
|
|
18659
|
+
(sha) => sha ? runGit2(
|
|
17663
18660
|
[
|
|
17664
18661
|
"--no-optional-locks",
|
|
17665
18662
|
"log",
|
|
@@ -17692,7 +18689,7 @@ async function fetchGitCommitDetail(cwd, sha) {
|
|
|
17692
18689
|
if (!/^[0-9a-f]{7,40}$/i.test(sha)) return null;
|
|
17693
18690
|
const gitRoot = findGitRoot(cwd);
|
|
17694
18691
|
if (!gitRoot) return null;
|
|
17695
|
-
const metaRaw = await
|
|
18692
|
+
const metaRaw = await runGit2(
|
|
17696
18693
|
[
|
|
17697
18694
|
"--no-optional-locks",
|
|
17698
18695
|
"log",
|
|
@@ -17739,7 +18736,7 @@ async function fetchGitCommitDetail(cwd, sha) {
|
|
|
17739
18736
|
"--root",
|
|
17740
18737
|
sha
|
|
17741
18738
|
];
|
|
17742
|
-
const numstatRaw = await
|
|
18739
|
+
const numstatRaw = await runGit2(diffTreeArgs, gitRoot);
|
|
17743
18740
|
const files = [];
|
|
17744
18741
|
let filesCount = 0;
|
|
17745
18742
|
let linesAdded = 0;
|
|
@@ -17779,7 +18776,7 @@ async function fetchGitCommitDetail(cwd, sha) {
|
|
|
17779
18776
|
__name(fetchGitCommitDetail, "fetchGitCommitDetail");
|
|
17780
18777
|
|
|
17781
18778
|
// packages/core/src/services/fileHistoryService.ts
|
|
17782
|
-
var
|
|
18779
|
+
var debugLogger13 = createDebugLogger("FILE_HISTORY");
|
|
17783
18780
|
var MAX_SNAPSHOTS = 100;
|
|
17784
18781
|
var FILE_HISTORY_DIR = "file-history";
|
|
17785
18782
|
function serializeSnapshot(s3) {
|
|
@@ -17831,7 +18828,7 @@ function isENOENT(e) {
|
|
|
17831
18828
|
__name(isENOENT, "isENOENT");
|
|
17832
18829
|
async function pathExists(filePath) {
|
|
17833
18830
|
try {
|
|
17834
|
-
await
|
|
18831
|
+
await stat3(filePath);
|
|
17835
18832
|
return true;
|
|
17836
18833
|
} catch {
|
|
17837
18834
|
return false;
|
|
@@ -17852,12 +18849,12 @@ function getBackupFileName(filePath, version3) {
|
|
|
17852
18849
|
}
|
|
17853
18850
|
__name(getBackupFileName, "getBackupFileName");
|
|
17854
18851
|
function resolveBackupPath(backupFileName, sessionId) {
|
|
17855
|
-
const baseDir =
|
|
18852
|
+
const baseDir = resolve4(
|
|
17856
18853
|
Storage.getGlobalQwenDir(),
|
|
17857
18854
|
FILE_HISTORY_DIR,
|
|
17858
18855
|
sessionId
|
|
17859
18856
|
);
|
|
17860
|
-
const backupPath =
|
|
18857
|
+
const backupPath = resolve4(baseDir, backupFileName);
|
|
17861
18858
|
if (!backupPath.startsWith(baseDir + sep2)) {
|
|
17862
18859
|
throw new Error(`backupFileName escapes base directory: ${backupFileName}`);
|
|
17863
18860
|
}
|
|
@@ -17882,7 +18879,7 @@ async function createBackup(filePath, version3, sessionId) {
|
|
|
17882
18879
|
const backupPath = resolveBackupPath(backupFileName, sessionId);
|
|
17883
18880
|
let srcStats;
|
|
17884
18881
|
try {
|
|
17885
|
-
srcStats = await
|
|
18882
|
+
srcStats = await stat3(filePath);
|
|
17886
18883
|
} catch (e) {
|
|
17887
18884
|
if (isENOENT(e)) {
|
|
17888
18885
|
return { backupFileName: null, version: version3, backupTime: /* @__PURE__ */ new Date() };
|
|
@@ -17901,17 +18898,17 @@ async function restoreBackup(filePath, backupFileName, sessionId) {
|
|
|
17901
18898
|
const backupPath = resolveBackupPath(backupFileName, sessionId);
|
|
17902
18899
|
let backupStats;
|
|
17903
18900
|
try {
|
|
17904
|
-
backupStats = await
|
|
18901
|
+
backupStats = await stat3(backupPath);
|
|
17905
18902
|
} catch (e) {
|
|
17906
18903
|
if (isENOENT(e)) {
|
|
17907
|
-
|
|
18904
|
+
debugLogger13.error(`FileHistory: Backup file not found: ${backupPath}`);
|
|
17908
18905
|
return false;
|
|
17909
18906
|
}
|
|
17910
18907
|
throw e;
|
|
17911
18908
|
}
|
|
17912
18909
|
const result = await safeCopyFile(backupPath, filePath);
|
|
17913
18910
|
if (result === "src-missing") {
|
|
17914
|
-
|
|
18911
|
+
debugLogger13.error(
|
|
17915
18912
|
`FileHistory: Backup file disappeared during restore: ${backupPath}`
|
|
17916
18913
|
);
|
|
17917
18914
|
return false;
|
|
@@ -17925,14 +18922,14 @@ async function checkOriginFileChanged(originalFile, backupFileName, sessionId, o
|
|
|
17925
18922
|
let originalStats = originalStatsHint ?? null;
|
|
17926
18923
|
if (!originalStats) {
|
|
17927
18924
|
try {
|
|
17928
|
-
originalStats = await
|
|
18925
|
+
originalStats = await stat3(originalFile);
|
|
17929
18926
|
} catch (e) {
|
|
17930
18927
|
if (!isENOENT(e)) return true;
|
|
17931
18928
|
}
|
|
17932
18929
|
}
|
|
17933
18930
|
let backupStats;
|
|
17934
18931
|
try {
|
|
17935
|
-
backupStats = await
|
|
18932
|
+
backupStats = await stat3(backupPath);
|
|
17936
18933
|
} catch {
|
|
17937
18934
|
return true;
|
|
17938
18935
|
}
|
|
@@ -17972,7 +18969,7 @@ async function computeDiffStatsForFile(originalFile, backupFileName, sessionId)
|
|
|
17972
18969
|
if (c.removed) deletions += c.count || 0;
|
|
17973
18970
|
}
|
|
17974
18971
|
} catch (error3) {
|
|
17975
|
-
|
|
18972
|
+
debugLogger13.error(`FileHistory: Error generating diffStats: ${error3}`);
|
|
17976
18973
|
}
|
|
17977
18974
|
return { filesChanged, insertions, deletions };
|
|
17978
18975
|
}
|
|
@@ -18000,7 +18997,7 @@ async function readPathWithSizeGuard(path81, kind) {
|
|
|
18000
18997
|
}
|
|
18001
18998
|
return { kind: "unreadable" };
|
|
18002
18999
|
}
|
|
18003
|
-
|
|
19000
|
+
debugLogger13.error(`FileHistory: ${kind} open failed for ${path81}: ${e}`);
|
|
18004
19001
|
return { kind: "unreadable" };
|
|
18005
19002
|
}
|
|
18006
19003
|
try {
|
|
@@ -18012,7 +19009,7 @@ async function readPathWithSizeGuard(path81, kind) {
|
|
|
18012
19009
|
const text = await fh.readFile("utf-8");
|
|
18013
19010
|
return { kind: "ok", content: text, exists: true };
|
|
18014
19011
|
} catch (e) {
|
|
18015
|
-
|
|
19012
|
+
debugLogger13.error(`FileHistory: ${kind} read failed for ${path81}: ${e}`);
|
|
18016
19013
|
return { kind: "unreadable" };
|
|
18017
19014
|
}
|
|
18018
19015
|
} finally {
|
|
@@ -18074,7 +19071,7 @@ var FileHistoryService = class {
|
|
|
18074
19071
|
try {
|
|
18075
19072
|
this.onSnapshotUpdated?.(snapshot);
|
|
18076
19073
|
} catch (error3) {
|
|
18077
|
-
|
|
19074
|
+
debugLogger13.error(`FileHistory: recordSnapshotUpdate failed: ${error3}`);
|
|
18078
19075
|
}
|
|
18079
19076
|
}
|
|
18080
19077
|
restoreFromSnapshots(snapshots) {
|
|
@@ -18115,7 +19112,7 @@ var FileHistoryService = class {
|
|
|
18115
19112
|
try {
|
|
18116
19113
|
backupPath = resolveBackupPath(name, this.sessionId);
|
|
18117
19114
|
} catch (e) {
|
|
18118
|
-
|
|
19115
|
+
debugLogger13.error(
|
|
18119
19116
|
`FileHistory: rejected backupFileName during validation: ${name}: ${e}`
|
|
18120
19117
|
);
|
|
18121
19118
|
return false;
|
|
@@ -18140,7 +19137,7 @@ var FileHistoryService = class {
|
|
|
18140
19137
|
for (const snapshot of affectedSnapshots) {
|
|
18141
19138
|
this.recordSnapshotUpdate(snapshot);
|
|
18142
19139
|
}
|
|
18143
|
-
|
|
19140
|
+
debugLogger13.warn(
|
|
18144
19141
|
`FileHistory: ${missing.size} restored backup file(s) missing on disk`
|
|
18145
19142
|
);
|
|
18146
19143
|
}
|
|
@@ -18149,7 +19146,7 @@ var FileHistoryService = class {
|
|
|
18149
19146
|
const trackingPath = this.maybeShortenFilePath(filePath);
|
|
18150
19147
|
const mostRecent = this.state.snapshots.at(-1);
|
|
18151
19148
|
if (!mostRecent) {
|
|
18152
|
-
|
|
19149
|
+
debugLogger13.error("FileHistory: Missing most recent snapshot");
|
|
18153
19150
|
return;
|
|
18154
19151
|
}
|
|
18155
19152
|
const existing = mostRecent.trackedFileBackups[trackingPath];
|
|
@@ -18161,7 +19158,7 @@ var FileHistoryService = class {
|
|
|
18161
19158
|
try {
|
|
18162
19159
|
backup = await createBackup(filePath, maxVersion + 1, this.sessionId);
|
|
18163
19160
|
} catch (error3) {
|
|
18164
|
-
|
|
19161
|
+
debugLogger13.error(`FileHistory: trackEdit failed: ${error3}`);
|
|
18165
19162
|
return;
|
|
18166
19163
|
}
|
|
18167
19164
|
if (!this.state.snapshots.includes(mostRecent)) {
|
|
@@ -18172,7 +19169,7 @@ var FileHistoryService = class {
|
|
|
18172
19169
|
mostRecent.trackedFileBackups[trackingPath] = backup;
|
|
18173
19170
|
this.state.trackedFiles.add(trackingPath);
|
|
18174
19171
|
this.recordSnapshotUpdate(mostRecent);
|
|
18175
|
-
|
|
19172
|
+
debugLogger13.debug(
|
|
18176
19173
|
`FileHistory: Tracked file modification for ${filePath}`
|
|
18177
19174
|
);
|
|
18178
19175
|
}
|
|
@@ -18194,7 +19191,7 @@ var FileHistoryService = class {
|
|
|
18194
19191
|
const nextVersion = this.getMaxVersion(trackingPath) + 1;
|
|
18195
19192
|
let fileStats;
|
|
18196
19193
|
try {
|
|
18197
|
-
fileStats = await
|
|
19194
|
+
fileStats = await stat3(filePath);
|
|
18198
19195
|
} catch (e) {
|
|
18199
19196
|
if (!isENOENT(e)) throw e;
|
|
18200
19197
|
}
|
|
@@ -18221,7 +19218,7 @@ var FileHistoryService = class {
|
|
|
18221
19218
|
this.sessionId
|
|
18222
19219
|
);
|
|
18223
19220
|
} catch (error3) {
|
|
18224
|
-
|
|
19221
|
+
debugLogger13.error(
|
|
18225
19222
|
`FileHistory: Failed to backup file ${trackingPath}: ${error3}`
|
|
18226
19223
|
);
|
|
18227
19224
|
const previous = mostRecent?.trackedFileBackups[trackingPath];
|
|
@@ -18252,7 +19249,7 @@ var FileHistoryService = class {
|
|
|
18252
19249
|
this.state.snapshots = this.state.snapshots.slice(overflow);
|
|
18253
19250
|
await this.cleanupOrphanedBackups(removed);
|
|
18254
19251
|
}
|
|
18255
|
-
|
|
19252
|
+
debugLogger13.debug(
|
|
18256
19253
|
`FileHistory: Added snapshot for ${promptId}, tracking ${this.state.trackedFiles.size} files`
|
|
18257
19254
|
);
|
|
18258
19255
|
}
|
|
@@ -18262,7 +19259,7 @@ var FileHistoryService = class {
|
|
|
18262
19259
|
if (!targetSnapshot) {
|
|
18263
19260
|
throw new Error("The selected snapshot was not found");
|
|
18264
19261
|
}
|
|
18265
|
-
|
|
19262
|
+
debugLogger13.debug(`FileHistory: Rewinding to snapshot for ${promptId}`);
|
|
18266
19263
|
const result = await this.applySnapshot(targetSnapshot);
|
|
18267
19264
|
if (truncateHistory && result.filesFailed.length === 0) {
|
|
18268
19265
|
const targetIdx = this.state.snapshots.indexOf(targetSnapshot);
|
|
@@ -18277,7 +19274,7 @@ var FileHistoryService = class {
|
|
|
18277
19274
|
await this.cleanupOrphanedBackups(removed);
|
|
18278
19275
|
}
|
|
18279
19276
|
}
|
|
18280
|
-
|
|
19277
|
+
debugLogger13.debug(`FileHistory: Finished rewinding to ${promptId}`);
|
|
18281
19278
|
return result;
|
|
18282
19279
|
}
|
|
18283
19280
|
async getDiffStats(promptId) {
|
|
@@ -18305,7 +19302,7 @@ var FileHistoryService = class {
|
|
|
18305
19302
|
}
|
|
18306
19303
|
return null;
|
|
18307
19304
|
} catch (error3) {
|
|
18308
|
-
|
|
19305
|
+
debugLogger13.error(
|
|
18309
19306
|
`FileHistory: Error computing diff stats: ${error3}`
|
|
18310
19307
|
);
|
|
18311
19308
|
return null;
|
|
@@ -18351,7 +19348,7 @@ var FileHistoryService = class {
|
|
|
18351
19348
|
candidatePaths.length - MAX_TURN_DIFF_FILES
|
|
18352
19349
|
);
|
|
18353
19350
|
if (filesOmitted > 0) {
|
|
18354
|
-
|
|
19351
|
+
debugLogger13.warn(
|
|
18355
19352
|
`FileHistory: getTurnDiff truncating ${filesOmitted} files for prompt ${promptId} (cap: ${MAX_TURN_DIFF_FILES})`
|
|
18356
19353
|
);
|
|
18357
19354
|
}
|
|
@@ -18387,7 +19384,7 @@ var FileHistoryService = class {
|
|
|
18387
19384
|
try {
|
|
18388
19385
|
return await this.computeTurnFileDiffUnsafe(trackingPath, before, after);
|
|
18389
19386
|
} catch (e) {
|
|
18390
|
-
|
|
19387
|
+
debugLogger13.error(
|
|
18391
19388
|
`FileHistory: computeTurnFileDiff failed for ${trackingPath}: ${e}`
|
|
18392
19389
|
);
|
|
18393
19390
|
return null;
|
|
@@ -18414,14 +19411,14 @@ var FileHistoryService = class {
|
|
|
18414
19411
|
this.sessionId
|
|
18415
19412
|
);
|
|
18416
19413
|
if (beforeRead.kind === "unreadable") {
|
|
18417
|
-
|
|
19414
|
+
debugLogger13.warn(
|
|
18418
19415
|
`FileHistory: skipping turn diff for ${trackingPath}: before backup unreadable`
|
|
18419
19416
|
);
|
|
18420
19417
|
return null;
|
|
18421
19418
|
}
|
|
18422
19419
|
const afterRead = afterFromWorktree ? await readEndpointContent(void 0, absoluteFilePath, this.sessionId) : await readEndpointContent(afterBackup, void 0, this.sessionId);
|
|
18423
19420
|
if (afterRead.kind === "unreadable") {
|
|
18424
|
-
|
|
19421
|
+
debugLogger13.warn(
|
|
18425
19422
|
`FileHistory: skipping turn diff for ${trackingPath}: after ${afterFromWorktree ? "worktree" : "backup"} unreadable`
|
|
18426
19423
|
);
|
|
18427
19424
|
return null;
|
|
@@ -18531,7 +19528,7 @@ var FileHistoryService = class {
|
|
|
18531
19528
|
}
|
|
18532
19529
|
const backupFileName = targetBackup ? targetBackup.backupFileName : this.getBackupFileNameFirstVersion(trackingPath);
|
|
18533
19530
|
if (backupFileName === void 0) {
|
|
18534
|
-
|
|
19531
|
+
debugLogger13.error(
|
|
18535
19532
|
"FileHistory: Error finding the backup file to apply"
|
|
18536
19533
|
);
|
|
18537
19534
|
filesFailed.push(filePath);
|
|
@@ -18540,7 +19537,7 @@ var FileHistoryService = class {
|
|
|
18540
19537
|
if (backupFileName === null) {
|
|
18541
19538
|
try {
|
|
18542
19539
|
await unlink3(filePath);
|
|
18543
|
-
|
|
19540
|
+
debugLogger13.debug(`FileHistory: Deleted ${filePath}`);
|
|
18544
19541
|
filesChanged.push(filePath);
|
|
18545
19542
|
} catch (e) {
|
|
18546
19543
|
if (!isENOENT(e)) throw e;
|
|
@@ -18554,7 +19551,7 @@ var FileHistoryService = class {
|
|
|
18554
19551
|
this.sessionId
|
|
18555
19552
|
);
|
|
18556
19553
|
if (restored) {
|
|
18557
|
-
|
|
19554
|
+
debugLogger13.debug(
|
|
18558
19555
|
`FileHistory: Restored ${filePath} from ${backupFileName}`
|
|
18559
19556
|
);
|
|
18560
19557
|
filesChanged.push(filePath);
|
|
@@ -18563,7 +19560,7 @@ var FileHistoryService = class {
|
|
|
18563
19560
|
}
|
|
18564
19561
|
}
|
|
18565
19562
|
} catch (error3) {
|
|
18566
|
-
|
|
19563
|
+
debugLogger13.error(
|
|
18567
19564
|
`FileHistory: Error restoring file ${trackingPath}: ${error3}`
|
|
18568
19565
|
);
|
|
18569
19566
|
filesFailed.push(this.maybeExpandFilePath(trackingPath));
|
|
@@ -18615,7 +19612,7 @@ var FileHistoryService = class {
|
|
|
18615
19612
|
await unlink3(resolveBackupPath(name, this.sessionId));
|
|
18616
19613
|
} catch (e) {
|
|
18617
19614
|
if (!isENOENT(e)) {
|
|
18618
|
-
|
|
19615
|
+
debugLogger13.error(`FileHistory: cleanup failed for ${name}: ${e}`);
|
|
18619
19616
|
}
|
|
18620
19617
|
}
|
|
18621
19618
|
})
|
|
@@ -18630,7 +19627,7 @@ var FileHistoryService = class {
|
|
|
18630
19627
|
}
|
|
18631
19628
|
maybeExpandFilePath(filePath) {
|
|
18632
19629
|
if (isAbsolute2(filePath)) return filePath;
|
|
18633
|
-
return
|
|
19630
|
+
return join8(this.cwd, filePath);
|
|
18634
19631
|
}
|
|
18635
19632
|
};
|
|
18636
19633
|
|
|
@@ -18676,14 +19673,14 @@ var SessionFileHistoryAccumulator = class {
|
|
|
18676
19673
|
|
|
18677
19674
|
// packages/core/src/utils/sessionStorageUtils.ts
|
|
18678
19675
|
init_esbuild_shims();
|
|
18679
|
-
import
|
|
19676
|
+
import fs8 from "node:fs";
|
|
18680
19677
|
var LITE_READ_BUF_SIZE = 64 * 1024;
|
|
18681
19678
|
function readLatestTailIfGrown(fd, previousSize, buffer) {
|
|
18682
|
-
const currentSize =
|
|
19679
|
+
const currentSize = fs8.fstatSync(fd).size;
|
|
18683
19680
|
if (currentSize <= previousSize) return void 0;
|
|
18684
19681
|
const tailLength = Math.min(currentSize, LITE_READ_BUF_SIZE);
|
|
18685
19682
|
const tailOffset = currentSize - tailLength;
|
|
18686
|
-
const tailBytes =
|
|
19683
|
+
const tailBytes = fs8.readSync(fd, buffer, 0, tailLength, tailOffset);
|
|
18687
19684
|
if (tailBytes <= 0) return void 0;
|
|
18688
19685
|
return {
|
|
18689
19686
|
text: buffer.toString("utf-8", 0, tailBytes),
|
|
@@ -18897,7 +19894,7 @@ __name(extractJsonStringFieldFromLastMatchingLine, "extractJsonStringFieldFromLa
|
|
|
18897
19894
|
function readLastMatchingLineFieldSync(filePath, lineContains, key, scratchBuffer, recordMatches, readRecordField) {
|
|
18898
19895
|
let fd;
|
|
18899
19896
|
try {
|
|
18900
|
-
const stats =
|
|
19897
|
+
const stats = fs8.statSync(filePath);
|
|
18901
19898
|
const fileSize = stats.size;
|
|
18902
19899
|
if (fileSize === 0) return { matched: false, reason: "absent" };
|
|
18903
19900
|
fd = openSyncNoFollow(filePath);
|
|
@@ -18933,7 +19930,7 @@ function readLastMatchingLineFieldSync(filePath, lineContains, key, scratchBuffe
|
|
|
18933
19930
|
} finally {
|
|
18934
19931
|
if (fd !== void 0) {
|
|
18935
19932
|
try {
|
|
18936
|
-
|
|
19933
|
+
fs8.closeSync(fd);
|
|
18937
19934
|
} catch {
|
|
18938
19935
|
}
|
|
18939
19936
|
}
|
|
@@ -18969,14 +19966,14 @@ __name(extractLastJsonStringField, "extractLastJsonStringField");
|
|
|
18969
19966
|
function readLastJsonStringFieldSync(filePath, key, lineContains, scratchBuffer) {
|
|
18970
19967
|
let fd;
|
|
18971
19968
|
try {
|
|
18972
|
-
const stats =
|
|
19969
|
+
const stats = fs8.statSync(filePath);
|
|
18973
19970
|
const fileSize = stats.size;
|
|
18974
19971
|
if (fileSize === 0) return void 0;
|
|
18975
19972
|
fd = openSyncNoFollow(filePath);
|
|
18976
19973
|
const tailLength = Math.min(fileSize, LITE_READ_BUF_SIZE);
|
|
18977
19974
|
const tailOffset = fileSize - tailLength;
|
|
18978
19975
|
const buffer = scratchBuffer && scratchBuffer.length >= LITE_READ_BUF_SIZE ? scratchBuffer : Buffer.alloc(LITE_READ_BUF_SIZE);
|
|
18979
|
-
const tailBytes =
|
|
19976
|
+
const tailBytes = fs8.readSync(fd, buffer, 0, tailLength, tailOffset);
|
|
18980
19977
|
if (tailBytes > 0) {
|
|
18981
19978
|
const tailText = buffer.toString("utf-8", 0, tailBytes);
|
|
18982
19979
|
const tailHit = extractLastJsonStringField(tailText, key, lineContains);
|
|
@@ -18997,7 +19994,7 @@ function readLastJsonStringFieldSync(filePath, key, lineContains, scratchBuffer)
|
|
|
18997
19994
|
}
|
|
18998
19995
|
if (tailOffset === 0) return void 0;
|
|
18999
19996
|
const headLength = Math.min(fileSize, LITE_READ_BUF_SIZE);
|
|
19000
|
-
const headBytes =
|
|
19997
|
+
const headBytes = fs8.readSync(fd, buffer, 0, headLength, 0);
|
|
19001
19998
|
if (headBytes > 0) {
|
|
19002
19999
|
const rawHead = buffer.toString("utf-8", 0, headBytes);
|
|
19003
20000
|
const headText = headBytes < fileSize ? rawHead.slice(0, rawHead.lastIndexOf("\n") + 1) : rawHead;
|
|
@@ -19012,7 +20009,7 @@ function readLastJsonStringFieldSync(filePath, key, lineContains, scratchBuffer)
|
|
|
19012
20009
|
} finally {
|
|
19013
20010
|
if (fd !== void 0) {
|
|
19014
20011
|
try {
|
|
19015
|
-
|
|
20012
|
+
fs8.closeSync(fd);
|
|
19016
20013
|
} catch {
|
|
19017
20014
|
}
|
|
19018
20015
|
}
|
|
@@ -19025,14 +20022,14 @@ function readLastJsonStringFieldsSync(filePath, primaryKey, otherKeys, lineConta
|
|
|
19025
20022
|
for (const k2 of otherKeys) emptyResult[k2] = void 0;
|
|
19026
20023
|
let fd;
|
|
19027
20024
|
try {
|
|
19028
|
-
const stats =
|
|
20025
|
+
const stats = fs8.statSync(filePath);
|
|
19029
20026
|
const fileSize = stats.size;
|
|
19030
20027
|
if (fileSize === 0) return emptyResult;
|
|
19031
20028
|
fd = openSyncNoFollow(filePath);
|
|
19032
20029
|
const tailLength = Math.min(fileSize, LITE_READ_BUF_SIZE);
|
|
19033
20030
|
const tailOffset = fileSize - tailLength;
|
|
19034
20031
|
const buffer = scratchBuffer && scratchBuffer.length >= LITE_READ_BUF_SIZE ? scratchBuffer : Buffer.alloc(LITE_READ_BUF_SIZE);
|
|
19035
|
-
const tailBytes =
|
|
20032
|
+
const tailBytes = fs8.readSync(fd, buffer, 0, tailLength, tailOffset);
|
|
19036
20033
|
if (tailBytes > 0) {
|
|
19037
20034
|
const tailText = buffer.toString("utf-8", 0, tailBytes);
|
|
19038
20035
|
const hit = extractLastJsonStringFields(
|
|
@@ -19055,7 +20052,7 @@ function readLastJsonStringFieldsSync(filePath, primaryKey, otherKeys, lineConta
|
|
|
19055
20052
|
}
|
|
19056
20053
|
if (tailOffset === 0) return emptyResult;
|
|
19057
20054
|
const headLength = Math.min(fileSize, LITE_READ_BUF_SIZE);
|
|
19058
|
-
const headBytes =
|
|
20055
|
+
const headBytes = fs8.readSync(fd, buffer, 0, headLength, 0);
|
|
19059
20056
|
if (headBytes > 0) {
|
|
19060
20057
|
const rawHead = buffer.toString("utf-8", 0, headBytes);
|
|
19061
20058
|
const headText = headBytes < fileSize ? rawHead.slice(0, rawHead.lastIndexOf("\n") + 1) : rawHead;
|
|
@@ -19073,7 +20070,7 @@ function readLastJsonStringFieldsSync(filePath, primaryKey, otherKeys, lineConta
|
|
|
19073
20070
|
} finally {
|
|
19074
20071
|
if (fd !== void 0) {
|
|
19075
20072
|
try {
|
|
19076
|
-
|
|
20073
|
+
fs8.closeSync(fd);
|
|
19077
20074
|
} catch {
|
|
19078
20075
|
}
|
|
19079
20076
|
}
|
|
@@ -19099,8 +20096,8 @@ __name(readSessionTitleInfoFromFileSync, "readSessionTitleInfoFromFileSync");
|
|
|
19099
20096
|
// packages/core/src/services/session-organization-service.ts
|
|
19100
20097
|
init_esbuild_shims();
|
|
19101
20098
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
19102
|
-
import * as
|
|
19103
|
-
import * as
|
|
20099
|
+
import * as fs9 from "node:fs/promises";
|
|
20100
|
+
import * as path8 from "node:path";
|
|
19104
20101
|
var GROUP_COLOR_OPTIONS = [
|
|
19105
20102
|
"red",
|
|
19106
20103
|
"orange",
|
|
@@ -19243,7 +20240,7 @@ var SessionOrganizationService = class {
|
|
|
19243
20240
|
storage;
|
|
19244
20241
|
readFailed = false;
|
|
19245
20242
|
getStorePath() {
|
|
19246
|
-
return
|
|
20243
|
+
return path8.join(this.storage.getProjectDir(), STORE_FILE);
|
|
19247
20244
|
}
|
|
19248
20245
|
async listGroups() {
|
|
19249
20246
|
const store = await this.readStore();
|
|
@@ -19424,7 +20421,7 @@ var SessionOrganizationService = class {
|
|
|
19424
20421
|
async readStore() {
|
|
19425
20422
|
try {
|
|
19426
20423
|
const raw = JSON.parse(
|
|
19427
|
-
await
|
|
20424
|
+
await fs9.readFile(this.getStorePath(), "utf8")
|
|
19428
20425
|
);
|
|
19429
20426
|
if (!isPlainRecord(raw)) {
|
|
19430
20427
|
return this.handleUnreadableStore("store root is not an object");
|
|
@@ -19484,7 +20481,7 @@ var SessionOrganizationService = class {
|
|
|
19484
20481
|
return emptyStore();
|
|
19485
20482
|
}
|
|
19486
20483
|
async writeStore(store, options2 = {}) {
|
|
19487
|
-
await
|
|
20484
|
+
await fs9.mkdir(path8.dirname(this.getStorePath()), { recursive: true });
|
|
19488
20485
|
if (this.readFailed) {
|
|
19489
20486
|
throw new SessionOrganizationError(
|
|
19490
20487
|
`Cannot update session organization store because it could not be read: ${this.getStorePath()}. Delete the file to reset session organization (group/pin data will be lost), or restore it from backup.`,
|
|
@@ -19609,913 +20606,6 @@ import * as path9 from "node:path";
|
|
|
19609
20606
|
init_esbuild_shims();
|
|
19610
20607
|
import { execFile as execFile4 } from "node:child_process";
|
|
19611
20608
|
|
|
19612
|
-
// packages/core/src/utils/git-branches.ts
|
|
19613
|
-
init_esbuild_shims();
|
|
19614
|
-
import { execFile as execFile2 } from "node:child_process";
|
|
19615
|
-
import * as fs9 from "node:fs";
|
|
19616
|
-
import * as path8 from "node:path";
|
|
19617
|
-
import { promisify as promisify2 } from "node:util";
|
|
19618
|
-
|
|
19619
|
-
// packages/core/src/utils/gitDirect.ts
|
|
19620
|
-
init_esbuild_shims();
|
|
19621
|
-
import * as fs8 from "node:fs";
|
|
19622
|
-
import * as fsPromises from "node:fs/promises";
|
|
19623
|
-
import * as path7 from "node:path";
|
|
19624
|
-
var SHORT_SHA_LENGTH = 7;
|
|
19625
|
-
var debug = createDebugLogger("gitDirect");
|
|
19626
|
-
var MAX_REF_COMPONENT_LENGTH = 255;
|
|
19627
|
-
var INVALID_REF_CHARS = /[\x00-\x20\x7f-\x9f\u200b-\u200d\u2028\u2029\u202a-\u202e\u2066-\u2069\ufeff~^:?*[\\]/;
|
|
19628
|
-
function isValidRefName(name) {
|
|
19629
|
-
if (!name || name === "HEAD") return false;
|
|
19630
|
-
if (name.startsWith("/") || name.endsWith("/")) return false;
|
|
19631
|
-
if (name.startsWith(".") || name.endsWith(".")) return false;
|
|
19632
|
-
if (name.endsWith(".lock")) return false;
|
|
19633
|
-
if (name.includes("..") || name.includes("//")) return false;
|
|
19634
|
-
if (name.includes("/.") || name.includes("./") || name.includes(".lock/")) {
|
|
19635
|
-
return false;
|
|
19636
|
-
}
|
|
19637
|
-
if (name.includes("@{")) return false;
|
|
19638
|
-
if (INVALID_REF_CHARS.test(name)) return false;
|
|
19639
|
-
if (name.split("/").some((c) => c.length > MAX_REF_COMPONENT_LENGTH)) {
|
|
19640
|
-
return false;
|
|
19641
|
-
}
|
|
19642
|
-
return true;
|
|
19643
|
-
}
|
|
19644
|
-
__name(isValidRefName, "isValidRefName");
|
|
19645
|
-
function isValidGitSha(value) {
|
|
19646
|
-
return /^[0-9a-f]{40}$/.test(value) || /^[0-9a-f]{64}$/.test(value);
|
|
19647
|
-
}
|
|
19648
|
-
__name(isValidGitSha, "isValidGitSha");
|
|
19649
|
-
var gitDirCache = /* @__PURE__ */ new Map();
|
|
19650
|
-
async function isDir(p2) {
|
|
19651
|
-
try {
|
|
19652
|
-
return (await fsPromises.stat(p2)).isDirectory();
|
|
19653
|
-
} catch {
|
|
19654
|
-
return false;
|
|
19655
|
-
}
|
|
19656
|
-
}
|
|
19657
|
-
__name(isDir, "isDir");
|
|
19658
|
-
async function hasGitStore(dir) {
|
|
19659
|
-
const [objects, refs] = await Promise.all([
|
|
19660
|
-
isDir(path7.join(dir, "objects")),
|
|
19661
|
-
isDir(path7.join(dir, "refs"))
|
|
19662
|
-
]);
|
|
19663
|
-
return objects && refs;
|
|
19664
|
-
}
|
|
19665
|
-
__name(hasGitStore, "hasGitStore");
|
|
19666
|
-
async function isRealGitDir(gitDir) {
|
|
19667
|
-
if (await hasGitStore(gitDir)) return true;
|
|
19668
|
-
const rel = await readFirstLineNoFollow(path7.join(gitDir, "commondir"));
|
|
19669
|
-
if (!rel) return false;
|
|
19670
|
-
return hasGitStore(path7.resolve(gitDir, rel.trim()));
|
|
19671
|
-
}
|
|
19672
|
-
__name(isRealGitDir, "isRealGitDir");
|
|
19673
|
-
async function resolveTrustedGitDir(cwd) {
|
|
19674
|
-
const gitDir = await resolveGitDir(cwd);
|
|
19675
|
-
if (!gitDir) return null;
|
|
19676
|
-
return await isRealGitDir(gitDir) ? gitDir : null;
|
|
19677
|
-
}
|
|
19678
|
-
__name(resolveTrustedGitDir, "resolveTrustedGitDir");
|
|
19679
|
-
async function getCachedGitDir(cwd) {
|
|
19680
|
-
const key = path7.resolve(cwd);
|
|
19681
|
-
const cached3 = gitDirCache.get(key);
|
|
19682
|
-
if (cached3 !== void 0) return cached3;
|
|
19683
|
-
const gitDir = await resolveTrustedGitDir(key);
|
|
19684
|
-
if (gitDir !== null) gitDirCache.set(key, gitDir);
|
|
19685
|
-
return gitDir;
|
|
19686
|
-
}
|
|
19687
|
-
__name(getCachedGitDir, "getCachedGitDir");
|
|
19688
|
-
async function readGitHead(gitDir) {
|
|
19689
|
-
const firstLine = await readFirstLineNoFollow(path7.join(gitDir, "HEAD"));
|
|
19690
|
-
if (firstLine === null) return null;
|
|
19691
|
-
const content = firstLine.trim();
|
|
19692
|
-
if (content.startsWith("ref:")) {
|
|
19693
|
-
const ref = content.slice(4).trim();
|
|
19694
|
-
if (!ref.startsWith("refs/heads/")) return null;
|
|
19695
|
-
const name = ref.slice("refs/heads/".length);
|
|
19696
|
-
if (!isValidRefName(name)) return null;
|
|
19697
|
-
return { type: "branch", name };
|
|
19698
|
-
}
|
|
19699
|
-
if (isValidGitSha(content)) {
|
|
19700
|
-
return { type: "detached", name: content };
|
|
19701
|
-
}
|
|
19702
|
-
return null;
|
|
19703
|
-
}
|
|
19704
|
-
__name(readGitHead, "readGitHead");
|
|
19705
|
-
async function resolveBranchName(cwd) {
|
|
19706
|
-
const gitDir = await getCachedGitDir(cwd);
|
|
19707
|
-
if (!gitDir) return void 0;
|
|
19708
|
-
const head = await readGitHead(gitDir);
|
|
19709
|
-
if (!head) return void 0;
|
|
19710
|
-
return head.type === "branch" ? head.name : head.name.slice(0, SHORT_SHA_LENGTH);
|
|
19711
|
-
}
|
|
19712
|
-
__name(resolveBranchName, "resolveBranchName");
|
|
19713
|
-
var repoBranchWatches = /* @__PURE__ */ new Map();
|
|
19714
|
-
async function watchRepoBranch(cwd, onChange) {
|
|
19715
|
-
const gitDir = await getCachedGitDir(cwd);
|
|
19716
|
-
if (!gitDir) return () => {
|
|
19717
|
-
};
|
|
19718
|
-
let entry = repoBranchWatches.get(gitDir);
|
|
19719
|
-
if (!entry) {
|
|
19720
|
-
const logsHeadPath = path7.join(gitDir, "logs", "HEAD");
|
|
19721
|
-
try {
|
|
19722
|
-
await fsPromises.access(logsHeadPath, fs8.constants?.F_OK ?? 0);
|
|
19723
|
-
if ((await fsPromises.lstat(logsHeadPath)).isSymbolicLink()) {
|
|
19724
|
-
return () => {
|
|
19725
|
-
};
|
|
19726
|
-
}
|
|
19727
|
-
} catch {
|
|
19728
|
-
return () => {
|
|
19729
|
-
};
|
|
19730
|
-
}
|
|
19731
|
-
const existing = repoBranchWatches.get(gitDir);
|
|
19732
|
-
if (existing) {
|
|
19733
|
-
entry = existing;
|
|
19734
|
-
} else {
|
|
19735
|
-
let watcher;
|
|
19736
|
-
try {
|
|
19737
|
-
watcher = fs8.watch(logsHeadPath, (eventType) => {
|
|
19738
|
-
if (eventType === "change" || eventType === "rename") {
|
|
19739
|
-
repoBranchWatches.get(gitDir)?.subscribers.forEach((cb) => {
|
|
19740
|
-
try {
|
|
19741
|
-
cb();
|
|
19742
|
-
} catch {
|
|
19743
|
-
}
|
|
19744
|
-
});
|
|
19745
|
-
}
|
|
19746
|
-
});
|
|
19747
|
-
} catch (err) {
|
|
19748
|
-
debug.warn(`failed to watch reflog for ${gitDir}: ${err}`);
|
|
19749
|
-
return () => {
|
|
19750
|
-
};
|
|
19751
|
-
}
|
|
19752
|
-
watcher.on("error", (err) => {
|
|
19753
|
-
debug.warn(
|
|
19754
|
-
`reflog watcher error for ${gitDir}; branch will no longer auto-update: ${err?.message}`
|
|
19755
|
-
);
|
|
19756
|
-
const current = repoBranchWatches.get(gitDir);
|
|
19757
|
-
if (current?.watcher === watcher) {
|
|
19758
|
-
try {
|
|
19759
|
-
watcher.close();
|
|
19760
|
-
} catch {
|
|
19761
|
-
}
|
|
19762
|
-
repoBranchWatches.delete(gitDir);
|
|
19763
|
-
}
|
|
19764
|
-
});
|
|
19765
|
-
entry = { watcher, subscribers: /* @__PURE__ */ new Set() };
|
|
19766
|
-
repoBranchWatches.set(gitDir, entry);
|
|
19767
|
-
}
|
|
19768
|
-
}
|
|
19769
|
-
entry.subscribers.add(onChange);
|
|
19770
|
-
let disposed = false;
|
|
19771
|
-
return () => {
|
|
19772
|
-
if (disposed) return;
|
|
19773
|
-
disposed = true;
|
|
19774
|
-
const e = repoBranchWatches.get(gitDir);
|
|
19775
|
-
if (!e) return;
|
|
19776
|
-
e.subscribers.delete(onChange);
|
|
19777
|
-
if (e.subscribers.size === 0) {
|
|
19778
|
-
e.watcher.close();
|
|
19779
|
-
repoBranchWatches.delete(gitDir);
|
|
19780
|
-
}
|
|
19781
|
-
};
|
|
19782
|
-
}
|
|
19783
|
-
__name(watchRepoBranch, "watchRepoBranch");
|
|
19784
|
-
|
|
19785
|
-
// packages/core/src/utils/git-branches.ts
|
|
19786
|
-
var debugLogger13 = createDebugLogger("GIT_BRANCHES");
|
|
19787
|
-
var execFileAsync2 = promisify2(execFile2);
|
|
19788
|
-
var GIT_TIMEOUT_MS2 = 3e4;
|
|
19789
|
-
var MAX_RECENT_BRANCHES = 20;
|
|
19790
|
-
var MAX_REFLOG_ENTRIES = 200;
|
|
19791
|
-
var GIT_ENV_VARS_TO_CLEAR = [
|
|
19792
|
-
"GIT_DIR",
|
|
19793
|
-
"GIT_WORK_TREE",
|
|
19794
|
-
"GIT_COMMON_DIR",
|
|
19795
|
-
"GIT_INDEX_FILE",
|
|
19796
|
-
"GIT_CONFIG_GLOBAL",
|
|
19797
|
-
"GIT_CONFIG_SYSTEM",
|
|
19798
|
-
"GIT_CONFIG_NOSYSTEM",
|
|
19799
|
-
// Repository selectors that an inherited daemon environment could use to
|
|
19800
|
-
// redirect a trusted-workspace git/gh invocation to a different repository
|
|
19801
|
-
// or object database despite the resolved cwd.
|
|
19802
|
-
"GH_REPO",
|
|
19803
|
-
"GIT_CONFIG_COUNT",
|
|
19804
|
-
"GIT_CONFIG_PARAMETERS",
|
|
19805
|
-
"GIT_OBJECT_DIRECTORY",
|
|
19806
|
-
"GIT_ALTERNATE_OBJECT_DIRECTORIES"
|
|
19807
|
-
];
|
|
19808
|
-
var GIT_ENV_PREFIXES_TO_CLEAR = ["GIT_CONFIG_KEY_", "GIT_CONFIG_VALUE_"];
|
|
19809
|
-
var HELPER_PROTOCOLS = /* @__PURE__ */ new Set(["ext", "fd"]);
|
|
19810
|
-
function gitEnv(base) {
|
|
19811
|
-
const env = { ...base ?? process.env };
|
|
19812
|
-
for (const key of GIT_ENV_VARS_TO_CLEAR) {
|
|
19813
|
-
delete env[key];
|
|
19814
|
-
}
|
|
19815
|
-
for (const key of Object.keys(env)) {
|
|
19816
|
-
if (GIT_ENV_PREFIXES_TO_CLEAR.some((prefix) => key.startsWith(prefix))) {
|
|
19817
|
-
delete env[key];
|
|
19818
|
-
}
|
|
19819
|
-
}
|
|
19820
|
-
const inheritedAllow = env["GIT_ALLOW_PROTOCOL"];
|
|
19821
|
-
if (inheritedAllow !== void 0) {
|
|
19822
|
-
env["GIT_ALLOW_PROTOCOL"] = inheritedAllow.split(":").filter((p2) => !HELPER_PROTOCOLS.has(p2.trim().toLowerCase())).join(":");
|
|
19823
|
-
}
|
|
19824
|
-
env["LC_ALL"] = "C";
|
|
19825
|
-
env["LANG"] = "C";
|
|
19826
|
-
return env;
|
|
19827
|
-
}
|
|
19828
|
-
__name(gitEnv, "gitEnv");
|
|
19829
|
-
function runGit2(cwd, args, env) {
|
|
19830
|
-
return execFileAsync2("git", args, {
|
|
19831
|
-
cwd,
|
|
19832
|
-
timeout: GIT_TIMEOUT_MS2,
|
|
19833
|
-
maxBuffer: 10 * 1024 * 1024,
|
|
19834
|
-
env: gitEnv(env)
|
|
19835
|
-
}).then(({ stdout }) => stdout);
|
|
19836
|
-
}
|
|
19837
|
-
__name(runGit2, "runGit");
|
|
19838
|
-
var SEPARATOR = "\0";
|
|
19839
|
-
async function fetchGitBranches(cwd, env) {
|
|
19840
|
-
await runGit2(cwd, ["rev-parse", "--git-dir"], env);
|
|
19841
|
-
const [localRaw, remoteRaw, tagsRaw, headRaw, reflogRaw] = await Promise.all([
|
|
19842
|
-
runGit2(
|
|
19843
|
-
cwd,
|
|
19844
|
-
[
|
|
19845
|
-
"for-each-ref",
|
|
19846
|
-
"--format=%(refname:short)%00%(HEAD)%00%(upstream:short)%00%(upstream:track,nobracket)%00%(committerdate:unix)%00%(subject)%00%(symref)%00%(push:short)%00%(push:track,nobracket)",
|
|
19847
|
-
"refs/heads/"
|
|
19848
|
-
],
|
|
19849
|
-
env
|
|
19850
|
-
).catch(() => ""),
|
|
19851
|
-
runGit2(
|
|
19852
|
-
cwd,
|
|
19853
|
-
[
|
|
19854
|
-
"for-each-ref",
|
|
19855
|
-
"--format=%(refname:short)%00%(HEAD)%00%(upstream:short)%00%(upstream:track,nobracket)%00%(committerdate:unix)%00%(subject)%00%(symref)%00%(push:short)%00%(push:track,nobracket)",
|
|
19856
|
-
"refs/remotes/"
|
|
19857
|
-
],
|
|
19858
|
-
env
|
|
19859
|
-
).catch(() => ""),
|
|
19860
|
-
runGit2(
|
|
19861
|
-
cwd,
|
|
19862
|
-
[
|
|
19863
|
-
"for-each-ref",
|
|
19864
|
-
"--format=%(refname:short)%00%(creatordate:unix)%00%(subject)",
|
|
19865
|
-
"--sort=-creatordate",
|
|
19866
|
-
"refs/tags/"
|
|
19867
|
-
],
|
|
19868
|
-
env
|
|
19869
|
-
).catch(() => ""),
|
|
19870
|
-
runGit2(cwd, ["symbolic-ref", "--short", "HEAD"], env).catch(() => ""),
|
|
19871
|
-
runGit2(
|
|
19872
|
-
cwd,
|
|
19873
|
-
["reflog", "show", "--format=%gs", `-${MAX_REFLOG_ENTRIES}`],
|
|
19874
|
-
env
|
|
19875
|
-
).catch(() => "")
|
|
19876
|
-
]);
|
|
19877
|
-
const local = parseBranchLines(localRaw);
|
|
19878
|
-
const remote = parseBranchLines(remoteRaw);
|
|
19879
|
-
const tags = parseTagLines(tagsRaw);
|
|
19880
|
-
const recent = parseRecentBranches(reflogRaw, headRaw.trim());
|
|
19881
|
-
const headTrimmed = headRaw.trim();
|
|
19882
|
-
const detached = !headTrimmed;
|
|
19883
|
-
return {
|
|
19884
|
-
local,
|
|
19885
|
-
remote,
|
|
19886
|
-
tags,
|
|
19887
|
-
recent,
|
|
19888
|
-
head: headTrimmed || await getDetachedHead(cwd, env),
|
|
19889
|
-
detached
|
|
19890
|
-
};
|
|
19891
|
-
}
|
|
19892
|
-
__name(fetchGitBranches, "fetchGitBranches");
|
|
19893
|
-
function parseBranchLines(raw) {
|
|
19894
|
-
if (!raw.trim()) return [];
|
|
19895
|
-
return raw.trim().split("\n").filter(Boolean).filter((line) => {
|
|
19896
|
-
const parts2 = line.split(SEPARATOR);
|
|
19897
|
-
return !(parts2[6] ?? "");
|
|
19898
|
-
}).map((line) => {
|
|
19899
|
-
const parts2 = line.split(SEPARATOR);
|
|
19900
|
-
const name = parts2[0] ?? "";
|
|
19901
|
-
const isHead = parts2[1] === "*";
|
|
19902
|
-
const upstream = parts2[2] || void 0;
|
|
19903
|
-
const track = parts2[3] ?? "";
|
|
19904
|
-
const commitDate = parseInt(parts2[4] ?? "0", 10) || 0;
|
|
19905
|
-
const commitSubject = parts2[5] ?? "";
|
|
19906
|
-
let ahead = 0;
|
|
19907
|
-
let behind = 0;
|
|
19908
|
-
const aheadMatch = /ahead (\d+)/.exec(track);
|
|
19909
|
-
const behindMatch = /behind (\d+)/.exec(track);
|
|
19910
|
-
if (aheadMatch) ahead = parseInt(aheadMatch[1], 10);
|
|
19911
|
-
if (behindMatch) behind = parseInt(behindMatch[1], 10);
|
|
19912
|
-
const upstreamGone = upstream !== void 0 && /\bgone\b/.test(track);
|
|
19913
|
-
const pushTarget = parts2[7] || void 0;
|
|
19914
|
-
const pushTrack = parts2[8] ?? "";
|
|
19915
|
-
const pushGone = pushTarget !== void 0 && /\bgone\b/.test(pushTrack);
|
|
19916
|
-
let pushAhead;
|
|
19917
|
-
let pushBehind;
|
|
19918
|
-
if (pushTarget !== void 0 && !pushGone) {
|
|
19919
|
-
const pa = /ahead (\d+)/.exec(pushTrack);
|
|
19920
|
-
const pb = /behind (\d+)/.exec(pushTrack);
|
|
19921
|
-
pushAhead = pa ? parseInt(pa[1], 10) : 0;
|
|
19922
|
-
pushBehind = pb ? parseInt(pb[1], 10) : 0;
|
|
19923
|
-
}
|
|
19924
|
-
return {
|
|
19925
|
-
name,
|
|
19926
|
-
isHead,
|
|
19927
|
-
upstream,
|
|
19928
|
-
...upstreamGone ? { upstreamGone } : {},
|
|
19929
|
-
ahead,
|
|
19930
|
-
behind,
|
|
19931
|
-
...pushTarget !== void 0 ? { pushTarget } : {},
|
|
19932
|
-
...pushAhead !== void 0 ? { pushAhead } : {},
|
|
19933
|
-
...pushBehind !== void 0 ? { pushBehind } : {},
|
|
19934
|
-
...pushGone ? { pushGone } : {},
|
|
19935
|
-
commitDate,
|
|
19936
|
-
commitSubject
|
|
19937
|
-
};
|
|
19938
|
-
});
|
|
19939
|
-
}
|
|
19940
|
-
__name(parseBranchLines, "parseBranchLines");
|
|
19941
|
-
function parseTagLines(raw) {
|
|
19942
|
-
if (!raw.trim()) return [];
|
|
19943
|
-
return raw.trim().split("\n").filter(Boolean).map((line) => {
|
|
19944
|
-
const parts2 = line.split(SEPARATOR);
|
|
19945
|
-
return {
|
|
19946
|
-
name: parts2[0] ?? "",
|
|
19947
|
-
date: parseInt(parts2[1] ?? "0", 10) || 0,
|
|
19948
|
-
subject: parts2[2] ?? ""
|
|
19949
|
-
};
|
|
19950
|
-
});
|
|
19951
|
-
}
|
|
19952
|
-
__name(parseTagLines, "parseTagLines");
|
|
19953
|
-
function parseRecentBranches(reflogRaw, currentHead) {
|
|
19954
|
-
if (!reflogRaw.trim()) return [];
|
|
19955
|
-
const seen = /* @__PURE__ */ new Set();
|
|
19956
|
-
const result = [];
|
|
19957
|
-
for (const line of reflogRaw.trim().split("\n")) {
|
|
19958
|
-
if (!line.startsWith("checkout: moving from ")) continue;
|
|
19959
|
-
const idx = line.indexOf(" to ");
|
|
19960
|
-
if (idx === -1) continue;
|
|
19961
|
-
const branch = line.slice(idx + 4);
|
|
19962
|
-
if (branch && !seen.has(branch) && branch !== currentHead && !/^[0-9a-f]{7,40}$/.test(branch)) {
|
|
19963
|
-
seen.add(branch);
|
|
19964
|
-
result.push(branch);
|
|
19965
|
-
if (result.length >= MAX_RECENT_BRANCHES) break;
|
|
19966
|
-
}
|
|
19967
|
-
}
|
|
19968
|
-
return result;
|
|
19969
|
-
}
|
|
19970
|
-
__name(parseRecentBranches, "parseRecentBranches");
|
|
19971
|
-
async function getDetachedHead(cwd, env) {
|
|
19972
|
-
try {
|
|
19973
|
-
const sha = await runGit2(cwd, ["rev-parse", "--short", "HEAD"], env);
|
|
19974
|
-
return sha.trim();
|
|
19975
|
-
} catch {
|
|
19976
|
-
return "";
|
|
19977
|
-
}
|
|
19978
|
-
}
|
|
19979
|
-
__name(getDetachedHead, "getDetachedHead");
|
|
19980
|
-
function isValidCheckoutRef(value) {
|
|
19981
|
-
const ref = value.trim();
|
|
19982
|
-
if (!ref || ref.startsWith("-")) return false;
|
|
19983
|
-
if (ref === "HEAD") return true;
|
|
19984
|
-
return isValidRefName(ref) || isValidGitSha(ref);
|
|
19985
|
-
}
|
|
19986
|
-
__name(isValidCheckoutRef, "isValidCheckoutRef");
|
|
19987
|
-
async function gitCheckout(cwd, ref, env) {
|
|
19988
|
-
if (!isValidCheckoutRef(ref)) {
|
|
19989
|
-
throw new Error(`invalid checkout ref: ${ref}`);
|
|
19990
|
-
}
|
|
19991
|
-
const isRemoteTracking = await runGit2(
|
|
19992
|
-
cwd,
|
|
19993
|
-
["show-ref", "--verify", "--quiet", `refs/remotes/${ref}`],
|
|
19994
|
-
env
|
|
19995
|
-
).then(() => true).catch(() => false);
|
|
19996
|
-
if (isRemoteTracking) {
|
|
19997
|
-
const localName = ref.slice(ref.indexOf("/") + 1);
|
|
19998
|
-
if (!isValidCheckoutRef(localName)) {
|
|
19999
|
-
throw new Error(
|
|
20000
|
-
`invalid local branch name derived from remote ref: ${localName}`
|
|
20001
|
-
);
|
|
20002
|
-
}
|
|
20003
|
-
const hasLocal = await runGit2(
|
|
20004
|
-
cwd,
|
|
20005
|
-
["show-ref", "--verify", "--quiet", `refs/heads/${localName}`],
|
|
20006
|
-
env
|
|
20007
|
-
).then(() => true).catch(() => false);
|
|
20008
|
-
if (hasLocal) {
|
|
20009
|
-
await runGit2(cwd, ["checkout", localName, "--"], env);
|
|
20010
|
-
} else {
|
|
20011
|
-
await runGit2(cwd, ["checkout", "--track", ref], env);
|
|
20012
|
-
}
|
|
20013
|
-
const head = (await runGit2(cwd, ["symbolic-ref", "--short", "HEAD"], env)).trim();
|
|
20014
|
-
return { branch: head, detached: false };
|
|
20015
|
-
}
|
|
20016
|
-
await runGit2(cwd, ["checkout", ref, "--"], env);
|
|
20017
|
-
const headRaw = await runGit2(
|
|
20018
|
-
cwd,
|
|
20019
|
-
["symbolic-ref", "--short", "HEAD"],
|
|
20020
|
-
env
|
|
20021
|
-
).catch(() => "");
|
|
20022
|
-
const trimmed = headRaw.trim();
|
|
20023
|
-
if (trimmed) {
|
|
20024
|
-
return { branch: trimmed, detached: false };
|
|
20025
|
-
}
|
|
20026
|
-
const sha = await runGit2(cwd, ["rev-parse", "--short", "HEAD"], env);
|
|
20027
|
-
return { branch: sha.trim(), detached: true };
|
|
20028
|
-
}
|
|
20029
|
-
__name(gitCheckout, "gitCheckout");
|
|
20030
|
-
async function gitCreateBranch(cwd, name, startPoint, env) {
|
|
20031
|
-
if (!isValidRefName(name) || name.startsWith("-")) {
|
|
20032
|
-
throw new Error(`invalid branch name: ${name}`);
|
|
20033
|
-
}
|
|
20034
|
-
const args = ["checkout", "-b", name];
|
|
20035
|
-
if (startPoint) {
|
|
20036
|
-
if (!isValidCheckoutRef(startPoint)) {
|
|
20037
|
-
throw new Error(`invalid start point: ${startPoint}`);
|
|
20038
|
-
}
|
|
20039
|
-
args.push(startPoint);
|
|
20040
|
-
}
|
|
20041
|
-
args.push("--");
|
|
20042
|
-
const originalRef = (await runGit2(
|
|
20043
|
-
cwd,
|
|
20044
|
-
["symbolic-ref", "--quiet", "--short", "HEAD"],
|
|
20045
|
-
env
|
|
20046
|
-
).catch(() => "")).trim();
|
|
20047
|
-
const originalCommit = originalRef ? "" : (await runGit2(cwd, ["rev-parse", "HEAD"], env).catch(() => "")).trim();
|
|
20048
|
-
const startCommit = (await runGit2(
|
|
20049
|
-
cwd,
|
|
20050
|
-
["rev-parse", "--verify", `${startPoint || "HEAD"}^{commit}`],
|
|
20051
|
-
env
|
|
20052
|
-
).catch(() => "")).trim();
|
|
20053
|
-
try {
|
|
20054
|
-
await runGit2(cwd, args, env);
|
|
20055
|
-
} catch (err) {
|
|
20056
|
-
const nowOn = (await runGit2(
|
|
20057
|
-
cwd,
|
|
20058
|
-
["symbolic-ref", "--quiet", "--short", "HEAD"],
|
|
20059
|
-
env
|
|
20060
|
-
).catch(() => "")).trim();
|
|
20061
|
-
if (nowOn === name) {
|
|
20062
|
-
if (originalRef) {
|
|
20063
|
-
await runGit2(cwd, ["checkout", originalRef, "--"], env).catch(() => {
|
|
20064
|
-
});
|
|
20065
|
-
} else if (originalCommit) {
|
|
20066
|
-
await runGit2(
|
|
20067
|
-
cwd,
|
|
20068
|
-
["checkout", "--detach", originalCommit, "--"],
|
|
20069
|
-
env
|
|
20070
|
-
).catch(() => {
|
|
20071
|
-
});
|
|
20072
|
-
}
|
|
20073
|
-
const newHead = (await runGit2(cwd, ["rev-parse", `refs/heads/${name}`], env).catch(
|
|
20074
|
-
() => ""
|
|
20075
|
-
)).trim();
|
|
20076
|
-
if (newHead && newHead !== startCommit) {
|
|
20077
|
-
debugLogger13.warn(
|
|
20078
|
-
`gitCreateBranch: keeping branch "${name}" because it contains commits created after checkout (likely by a failing post-checkout hook)`
|
|
20079
|
-
);
|
|
20080
|
-
} else {
|
|
20081
|
-
await runGit2(cwd, ["branch", "-D", name], env).catch(() => {
|
|
20082
|
-
});
|
|
20083
|
-
}
|
|
20084
|
-
}
|
|
20085
|
-
throw err;
|
|
20086
|
-
}
|
|
20087
|
-
return { branch: name, detached: false };
|
|
20088
|
-
}
|
|
20089
|
-
__name(gitCreateBranch, "gitCreateBranch");
|
|
20090
|
-
async function gitPush(cwd, opts, env) {
|
|
20091
|
-
const args = ["push"];
|
|
20092
|
-
if (opts?.force) args.push("--force-with-lease");
|
|
20093
|
-
if (opts?.setUpstream) {
|
|
20094
|
-
let branch;
|
|
20095
|
-
try {
|
|
20096
|
-
branch = (await runGit2(cwd, ["symbolic-ref", "--short", "HEAD"], env)).trim();
|
|
20097
|
-
} catch {
|
|
20098
|
-
throw new Error(
|
|
20099
|
-
"cannot push with --set-upstream in detached HEAD state; check out a branch first"
|
|
20100
|
-
);
|
|
20101
|
-
}
|
|
20102
|
-
const hasUpstream = await runGit2(
|
|
20103
|
-
cwd,
|
|
20104
|
-
["rev-parse", "--abbrev-ref", `${branch}@{u}`],
|
|
20105
|
-
env
|
|
20106
|
-
).catch(() => "");
|
|
20107
|
-
if (hasUpstream.trim()) {
|
|
20108
|
-
const output2 = await runGit2(cwd, args, env);
|
|
20109
|
-
return { success: true, output: output2.trim() };
|
|
20110
|
-
}
|
|
20111
|
-
let remote = (await runGit2(cwd, ["config", `branch.${branch}.pushRemote`], env).catch(
|
|
20112
|
-
() => ""
|
|
20113
|
-
)).trim();
|
|
20114
|
-
if (!remote) {
|
|
20115
|
-
remote = (await runGit2(cwd, ["config", "remote.pushDefault"], env).catch(() => "")).trim();
|
|
20116
|
-
}
|
|
20117
|
-
if (!remote) {
|
|
20118
|
-
remote = (await runGit2(cwd, ["config", `branch.${branch}.remote`], env).catch(
|
|
20119
|
-
() => ""
|
|
20120
|
-
)).trim();
|
|
20121
|
-
}
|
|
20122
|
-
if (!remote) {
|
|
20123
|
-
const remotes = (await runGit2(cwd, ["remote"], env).catch(() => "")).trim();
|
|
20124
|
-
const remoteList = remotes ? remotes.split("\n") : [];
|
|
20125
|
-
remote = remoteList.length === 1 ? remoteList[0] ?? "origin" : "origin";
|
|
20126
|
-
}
|
|
20127
|
-
args.push("--set-upstream", remote, branch);
|
|
20128
|
-
}
|
|
20129
|
-
const output = await runGit2(cwd, args, env);
|
|
20130
|
-
return { success: true, output: output.trim() };
|
|
20131
|
-
}
|
|
20132
|
-
__name(gitPush, "gitPush");
|
|
20133
|
-
var GitPullFailure = class extends Error {
|
|
20134
|
-
static {
|
|
20135
|
-
__name(this, "GitPullFailure");
|
|
20136
|
-
}
|
|
20137
|
-
code;
|
|
20138
|
-
constructor(code, message) {
|
|
20139
|
-
super(message);
|
|
20140
|
-
this.name = "GitPullFailure";
|
|
20141
|
-
this.code = code;
|
|
20142
|
-
}
|
|
20143
|
-
};
|
|
20144
|
-
var AUTO_STASH_MESSAGE = "qwen-code: auto-stash before pull";
|
|
20145
|
-
var OPERATION_STATE_PATHS = [
|
|
20146
|
-
["MERGE_HEAD", "merge"],
|
|
20147
|
-
["CHERRY_PICK_HEAD", "cherry-pick"],
|
|
20148
|
-
["REVERT_HEAD", "revert"],
|
|
20149
|
-
["rebase-merge", "rebase"],
|
|
20150
|
-
["rebase-apply", "rebase or am"]
|
|
20151
|
-
];
|
|
20152
|
-
function gitDetail(err) {
|
|
20153
|
-
if (err && typeof err === "object" && ("stdout" in err || "stderr" in err)) {
|
|
20154
|
-
const e = err;
|
|
20155
|
-
const detail = `${e.stdout ?? ""}
|
|
20156
|
-
${e.stderr ?? ""}`.trim();
|
|
20157
|
-
if (detail) return detail;
|
|
20158
|
-
return "git exited without diagnostic output; a stale lock file (e.g. .git/index.lock) or another git process is the usual cause";
|
|
20159
|
-
}
|
|
20160
|
-
return err instanceof Error ? err.message : String(err);
|
|
20161
|
-
}
|
|
20162
|
-
__name(gitDetail, "gitDetail");
|
|
20163
|
-
function exitCode(err) {
|
|
20164
|
-
const code = err?.code;
|
|
20165
|
-
return typeof code === "number" ? code : void 0;
|
|
20166
|
-
}
|
|
20167
|
-
__name(exitCode, "exitCode");
|
|
20168
|
-
function pullExitCode(err) {
|
|
20169
|
-
const code = exitCode(err);
|
|
20170
|
-
if (code !== void 0) return code;
|
|
20171
|
-
const e = err;
|
|
20172
|
-
if (e && (e.killed === true || typeof e.signal === "string")) return 1;
|
|
20173
|
-
return void 0;
|
|
20174
|
-
}
|
|
20175
|
-
__name(pullExitCode, "pullExitCode");
|
|
20176
|
-
async function gitPaths(cwd, names, env) {
|
|
20177
|
-
const args = ["rev-parse"];
|
|
20178
|
-
for (const name of names) args.push("--git-path", name);
|
|
20179
|
-
return (await runGit2(cwd, args, env)).trim().split("\n").map((line) => path8.resolve(cwd, line));
|
|
20180
|
-
}
|
|
20181
|
-
__name(gitPaths, "gitPaths");
|
|
20182
|
-
async function operationInProgress(cwd, env) {
|
|
20183
|
-
const paths = await gitPaths(
|
|
20184
|
-
cwd,
|
|
20185
|
-
OPERATION_STATE_PATHS.map(([statePath]) => statePath),
|
|
20186
|
-
env
|
|
20187
|
-
);
|
|
20188
|
-
for (let i = 0; i < OPERATION_STATE_PATHS.length; i++) {
|
|
20189
|
-
if (fs9.existsSync(paths[i])) return OPERATION_STATE_PATHS[i][1];
|
|
20190
|
-
}
|
|
20191
|
-
return void 0;
|
|
20192
|
-
}
|
|
20193
|
-
__name(operationInProgress, "operationInProgress");
|
|
20194
|
-
async function refuseOperationInProgress(cwd, env) {
|
|
20195
|
-
const operation = await operationInProgress(cwd, env);
|
|
20196
|
-
if (operation) {
|
|
20197
|
-
throw new GitPullFailure(
|
|
20198
|
-
"operation_in_progress",
|
|
20199
|
-
`cannot update: a ${operation} is in progress; finish or abort it from a terminal first`
|
|
20200
|
-
);
|
|
20201
|
-
}
|
|
20202
|
-
}
|
|
20203
|
-
__name(refuseOperationInProgress, "refuseOperationInProgress");
|
|
20204
|
-
async function upstreamSha(cwd, env, ref = "") {
|
|
20205
|
-
try {
|
|
20206
|
-
return (await runGit2(
|
|
20207
|
-
cwd,
|
|
20208
|
-
["rev-parse", "--verify", "--quiet", `${ref}@{upstream}`],
|
|
20209
|
-
env
|
|
20210
|
-
)).trim();
|
|
20211
|
-
} catch {
|
|
20212
|
-
return "";
|
|
20213
|
-
}
|
|
20214
|
-
}
|
|
20215
|
-
__name(upstreamSha, "upstreamSha");
|
|
20216
|
-
function readTrimmed(file) {
|
|
20217
|
-
try {
|
|
20218
|
-
return fs9.readFileSync(file, "utf8").trim();
|
|
20219
|
-
} catch {
|
|
20220
|
-
return "";
|
|
20221
|
-
}
|
|
20222
|
-
}
|
|
20223
|
-
__name(readTrimmed, "readTrimmed");
|
|
20224
|
-
async function abortOwnPullState(cwd, pullExitCode2, env) {
|
|
20225
|
-
if (pullExitCode2 !== 1) return;
|
|
20226
|
-
try {
|
|
20227
|
-
const [mergeHead, rebaseMergeDir, rebaseApplyDir] = await gitPaths(
|
|
20228
|
-
cwd,
|
|
20229
|
-
["MERGE_HEAD", "rebase-merge", "rebase-apply"],
|
|
20230
|
-
env
|
|
20231
|
-
);
|
|
20232
|
-
if (fs9.existsSync(mergeHead)) {
|
|
20233
|
-
const upstream = await upstreamSha(cwd, env);
|
|
20234
|
-
if (upstream && readTrimmed(mergeHead) === upstream) {
|
|
20235
|
-
await runGit2(cwd, ["merge", "--abort"], env);
|
|
20236
|
-
}
|
|
20237
|
-
return;
|
|
20238
|
-
}
|
|
20239
|
-
for (const dir of [rebaseMergeDir, rebaseApplyDir]) {
|
|
20240
|
-
if (!fs9.existsSync(dir)) continue;
|
|
20241
|
-
const headName = readTrimmed(path8.join(dir, "head-name")).replace(
|
|
20242
|
-
/^refs\/heads\//,
|
|
20243
|
-
""
|
|
20244
|
-
);
|
|
20245
|
-
const upstream = headName ? await upstreamSha(cwd, env, headName) : "";
|
|
20246
|
-
if (upstream && readTrimmed(path8.join(dir, "onto")) === upstream) {
|
|
20247
|
-
await runGit2(cwd, ["rebase", "--abort"], env);
|
|
20248
|
-
}
|
|
20249
|
-
return;
|
|
20250
|
-
}
|
|
20251
|
-
} catch {
|
|
20252
|
-
}
|
|
20253
|
-
}
|
|
20254
|
-
__name(abortOwnPullState, "abortOwnPullState");
|
|
20255
|
-
async function stashEntries(cwd, env) {
|
|
20256
|
-
const raw = await runGit2(cwd, ["stash", "list", "--format=%H%x00%s"], env);
|
|
20257
|
-
return raw.split("\n").filter((line) => line.includes("\0")).map((line) => {
|
|
20258
|
-
const [sha, subject] = line.split("\0");
|
|
20259
|
-
return { sha, subject: subject ?? "" };
|
|
20260
|
-
});
|
|
20261
|
-
}
|
|
20262
|
-
__name(stashEntries, "stashEntries");
|
|
20263
|
-
function parseDroppedStashSha(output) {
|
|
20264
|
-
const match = /\(([0-9a-f]{40,64})\)\s*$/m.exec(output.trim());
|
|
20265
|
-
return match?.[1];
|
|
20266
|
-
}
|
|
20267
|
-
__name(parseDroppedStashSha, "parseDroppedStashSha");
|
|
20268
|
-
async function restoreStash(cwd, sha, env) {
|
|
20269
|
-
let output = "";
|
|
20270
|
-
try {
|
|
20271
|
-
await runGit2(cwd, ["stash", "apply", sha], env);
|
|
20272
|
-
} catch (err) {
|
|
20273
|
-
return { restored: false, output: gitDetail(err) };
|
|
20274
|
-
}
|
|
20275
|
-
let entries;
|
|
20276
|
-
try {
|
|
20277
|
-
entries = await stashEntries(cwd, env);
|
|
20278
|
-
} catch (err) {
|
|
20279
|
-
return {
|
|
20280
|
-
restored: true,
|
|
20281
|
-
output: `restored, but stash entry ${sha} was kept because the stash could not be listed:
|
|
20282
|
-
${gitDetail(err)}`
|
|
20283
|
-
};
|
|
20284
|
-
}
|
|
20285
|
-
const index = entries.findIndex((entry) => entry.sha === sha);
|
|
20286
|
-
if (index === -1) return { restored: true, output };
|
|
20287
|
-
const slot = `stash@{${index}}`;
|
|
20288
|
-
let dropped;
|
|
20289
|
-
try {
|
|
20290
|
-
dropped = parseDroppedStashSha(
|
|
20291
|
-
await runGit2(cwd, ["stash", "drop", slot], env)
|
|
20292
|
-
);
|
|
20293
|
-
} catch (err) {
|
|
20294
|
-
return {
|
|
20295
|
-
restored: true,
|
|
20296
|
-
output: `restored, but stash entry ${slot} (${sha}) could not be dropped:
|
|
20297
|
-
${gitDetail(err)}`
|
|
20298
|
-
};
|
|
20299
|
-
}
|
|
20300
|
-
if (dropped !== void 0 && dropped !== sha) {
|
|
20301
|
-
const subject = (await runGit2(cwd, ["log", "-1", "--format=%s", dropped], env).catch(
|
|
20302
|
-
() => ""
|
|
20303
|
-
)).trim();
|
|
20304
|
-
const storeArgs = ["stash", "store", "--quiet"];
|
|
20305
|
-
if (subject) storeArgs.push("-m", subject);
|
|
20306
|
-
storeArgs.push(dropped);
|
|
20307
|
-
const stored = await runGit2(cwd, storeArgs, env).then(() => true).catch(() => false);
|
|
20308
|
-
output = stored ? `restored; stash entry ${sha} was kept because the stash changed while dropping it` : `restored; stash entry ${sha} was kept because the stash changed while dropping it, and the displaced entry ${dropped} could not be stored back \u2014 recover it with: git stash store ${dropped}`;
|
|
20309
|
-
}
|
|
20310
|
-
return { restored: true, output };
|
|
20311
|
-
}
|
|
20312
|
-
__name(restoreStash, "restoreStash");
|
|
20313
|
-
function pullArgs(opts) {
|
|
20314
|
-
const args = ["pull"];
|
|
20315
|
-
if (opts?.rebase) args.push("--rebase");
|
|
20316
|
-
return args;
|
|
20317
|
-
}
|
|
20318
|
-
__name(pullArgs, "pullArgs");
|
|
20319
|
-
async function validatedUpstream(cwd, env) {
|
|
20320
|
-
const sha = await upstreamSha(cwd, env);
|
|
20321
|
-
if (sha) return sha;
|
|
20322
|
-
let branch;
|
|
20323
|
-
try {
|
|
20324
|
-
branch = (await runGit2(cwd, ["symbolic-ref", "--quiet", "--short", "HEAD"], env)).trim();
|
|
20325
|
-
} catch {
|
|
20326
|
-
throw new GitPullFailure(
|
|
20327
|
-
"pull_failed",
|
|
20328
|
-
"cannot update: HEAD is detached; check out a branch from a terminal first"
|
|
20329
|
-
);
|
|
20330
|
-
}
|
|
20331
|
-
const configured = (await runGit2(
|
|
20332
|
-
cwd,
|
|
20333
|
-
["for-each-ref", "--format=%(upstream)", `refs/heads/${branch}`],
|
|
20334
|
-
env
|
|
20335
|
-
).catch(() => "")).trim();
|
|
20336
|
-
if (configured) {
|
|
20337
|
-
throw new GitPullFailure(
|
|
20338
|
-
"pull_failed",
|
|
20339
|
-
"cannot update: the upstream branch no longer exists on the remote; nothing was changed"
|
|
20340
|
-
);
|
|
20341
|
-
}
|
|
20342
|
-
await runGit2(cwd, ["rev-parse", "--abbrev-ref", "@{upstream}"], env);
|
|
20343
|
-
throw new GitPullFailure(
|
|
20344
|
-
"pull_failed",
|
|
20345
|
-
"cannot update: the upstream branch could not be resolved; nothing was changed"
|
|
20346
|
-
);
|
|
20347
|
-
}
|
|
20348
|
-
__name(validatedUpstream, "validatedUpstream");
|
|
20349
|
-
async function pushAutoStash(cwd, env) {
|
|
20350
|
-
const before = new Set((await stashEntries(cwd, env)).map((e) => e.sha));
|
|
20351
|
-
await refuseOperationInProgress(cwd, env);
|
|
20352
|
-
try {
|
|
20353
|
-
await runGit2(
|
|
20354
|
-
cwd,
|
|
20355
|
-
["stash", "push", "--include-untracked", "-m", AUTO_STASH_MESSAGE],
|
|
20356
|
-
env
|
|
20357
|
-
);
|
|
20358
|
-
} catch (err) {
|
|
20359
|
-
throw new GitPullFailure(
|
|
20360
|
-
"pull_failed",
|
|
20361
|
-
`cannot stash the local changes, so the update was not attempted:
|
|
20362
|
-
${gitDetail(err)}`
|
|
20363
|
-
);
|
|
20364
|
-
}
|
|
20365
|
-
let after;
|
|
20366
|
-
try {
|
|
20367
|
-
after = await stashEntries(cwd, env);
|
|
20368
|
-
} catch (err) {
|
|
20369
|
-
throw new GitPullFailure(
|
|
20370
|
-
"pull_failed",
|
|
20371
|
-
`cannot identify the auto-stash entry, so the update was not attempted; your changes are in the entry labelled "${AUTO_STASH_MESSAGE}" in git stash list:
|
|
20372
|
-
${gitDetail(err)}`
|
|
20373
|
-
);
|
|
20374
|
-
}
|
|
20375
|
-
const created = after.filter(
|
|
20376
|
-
(e) => !before.has(e.sha) && e.subject.endsWith(AUTO_STASH_MESSAGE)
|
|
20377
|
-
);
|
|
20378
|
-
return created.length > 0 ? created[created.length - 1].sha : void 0;
|
|
20379
|
-
}
|
|
20380
|
-
__name(pushAutoStash, "pushAutoStash");
|
|
20381
|
-
async function stashPull(cwd, opts, env) {
|
|
20382
|
-
await refuseOperationInProgress(cwd, env);
|
|
20383
|
-
await runGit2(cwd, ["fetch", "--prune"], env);
|
|
20384
|
-
await validatedUpstream(cwd, env);
|
|
20385
|
-
const stashed = await pushAutoStash(cwd, env);
|
|
20386
|
-
let output;
|
|
20387
|
-
try {
|
|
20388
|
-
output = (await runGit2(cwd, pullArgs(opts), env)).trim();
|
|
20389
|
-
} catch (err) {
|
|
20390
|
-
const detail = gitDetail(err);
|
|
20391
|
-
await abortOwnPullState(cwd, pullExitCode(err), env);
|
|
20392
|
-
if (stashed === void 0) {
|
|
20393
|
-
throw new GitPullFailure("pull_failed", `update failed:
|
|
20394
|
-
${detail}`);
|
|
20395
|
-
}
|
|
20396
|
-
const restore2 = await restoreStash(cwd, stashed, env);
|
|
20397
|
-
throw new GitPullFailure(
|
|
20398
|
-
"pull_failed",
|
|
20399
|
-
restore2.restored ? `update failed; your local changes were restored${restore2.output ? ` (${restore2.output})` : ""}:
|
|
20400
|
-
${detail}` : `update failed and your local changes could not be restored automatically; they are kept in stash entry ${stashed}:
|
|
20401
|
-
${restore2.output}
|
|
20402
|
-
${detail}`
|
|
20403
|
-
);
|
|
20404
|
-
}
|
|
20405
|
-
if (stashed === void 0) return { success: true, output };
|
|
20406
|
-
const restore = await restoreStash(cwd, stashed, env);
|
|
20407
|
-
if (restore.restored) {
|
|
20408
|
-
if (restore.output === "") return { success: true, output };
|
|
20409
|
-
return {
|
|
20410
|
-
success: true,
|
|
20411
|
-
stashKept: true,
|
|
20412
|
-
stashSha: stashed,
|
|
20413
|
-
output: `${output}
|
|
20414
|
-
${restore.output}`.trim()
|
|
20415
|
-
};
|
|
20416
|
-
}
|
|
20417
|
-
return {
|
|
20418
|
-
success: true,
|
|
20419
|
-
stashRestoreConflict: true,
|
|
20420
|
-
stashSha: stashed,
|
|
20421
|
-
output: `${output}
|
|
20422
|
-
restoring your local changes failed; they are kept in stash entry ${stashed}:
|
|
20423
|
-
${restore.output}`.trim()
|
|
20424
|
-
};
|
|
20425
|
-
}
|
|
20426
|
-
__name(stashPull, "stashPull");
|
|
20427
|
-
async function forcePull(cwd, env) {
|
|
20428
|
-
await refuseOperationInProgress(cwd, env);
|
|
20429
|
-
const toplevel = (await runGit2(cwd, ["rev-parse", "--show-toplevel"], env)).trim();
|
|
20430
|
-
if (await fs9.promises.realpath(cwd) !== await fs9.promises.realpath(toplevel)) {
|
|
20431
|
-
throw new GitPullFailure(
|
|
20432
|
-
"force_unsupported",
|
|
20433
|
-
"cannot discard changes: the workspace is a subdirectory of its repository, so discarding would also reset changes outside the workspace; resolve them from a terminal"
|
|
20434
|
-
);
|
|
20435
|
-
}
|
|
20436
|
-
await runGit2(cwd, ["fetch", "--prune"], env);
|
|
20437
|
-
const validated = await validatedUpstream(cwd, env);
|
|
20438
|
-
try {
|
|
20439
|
-
await runGit2(cwd, ["merge-base", "--is-ancestor", "HEAD", validated], env);
|
|
20440
|
-
} catch (err) {
|
|
20441
|
-
if (exitCode(err) === 1) {
|
|
20442
|
-
throw new GitPullFailure(
|
|
20443
|
-
"diverged",
|
|
20444
|
-
"cannot discard and update: the branch has diverged from its upstream; merge or rebase the local commits from a terminal first"
|
|
20445
|
-
);
|
|
20446
|
-
}
|
|
20447
|
-
throw err;
|
|
20448
|
-
}
|
|
20449
|
-
await refuseOperationInProgress(cwd, env);
|
|
20450
|
-
await runGit2(cwd, ["reset", "--hard"], env);
|
|
20451
|
-
await runGit2(cwd, ["clean", "-fd"], env);
|
|
20452
|
-
let output;
|
|
20453
|
-
try {
|
|
20454
|
-
output = await runGit2(cwd, ["merge", "--ff-only", validated], env);
|
|
20455
|
-
} catch (err) {
|
|
20456
|
-
throw new GitPullFailure(
|
|
20457
|
-
"pull_failed",
|
|
20458
|
-
`discard applied, but the update failed:
|
|
20459
|
-
${gitDetail(err)}`
|
|
20460
|
-
);
|
|
20461
|
-
}
|
|
20462
|
-
return { success: true, output: output.trim() };
|
|
20463
|
-
}
|
|
20464
|
-
__name(forcePull, "forcePull");
|
|
20465
|
-
async function gitPull(cwd, opts, env) {
|
|
20466
|
-
if (opts?.stash && opts?.force) {
|
|
20467
|
-
throw new Error("stash and force are mutually exclusive");
|
|
20468
|
-
}
|
|
20469
|
-
if (opts?.fetchOnly && (opts?.stash || opts?.force)) {
|
|
20470
|
-
throw new Error("fetchOnly cannot be combined with stash or force");
|
|
20471
|
-
}
|
|
20472
|
-
if (opts?.fetchOnly) {
|
|
20473
|
-
const output2 = await runGit2(cwd, ["fetch", "--all", "--prune"], env);
|
|
20474
|
-
return { success: true, output: output2.trim() };
|
|
20475
|
-
}
|
|
20476
|
-
if (opts?.force) return forcePull(cwd, env);
|
|
20477
|
-
if (opts?.stash) return stashPull(cwd, opts, env);
|
|
20478
|
-
const output = await runGit2(cwd, pullArgs(opts), env);
|
|
20479
|
-
return { success: true, output: output.trim() };
|
|
20480
|
-
}
|
|
20481
|
-
__name(gitPull, "gitPull");
|
|
20482
|
-
async function gitCommit(cwd, message, opts, env) {
|
|
20483
|
-
let savedIndex = null;
|
|
20484
|
-
if (opts?.all) {
|
|
20485
|
-
const tree = (await runGit2(cwd, ["write-tree"], env).catch(() => "")).trim();
|
|
20486
|
-
if (tree) {
|
|
20487
|
-
savedIndex = tree;
|
|
20488
|
-
} else {
|
|
20489
|
-
const unmerged = (await runGit2(cwd, ["ls-files", "--unmerged"], env)).trim();
|
|
20490
|
-
if (unmerged) {
|
|
20491
|
-
throw new Error(
|
|
20492
|
-
"cannot stage all changes: unresolved merge conflicts in the index"
|
|
20493
|
-
);
|
|
20494
|
-
}
|
|
20495
|
-
throw new Error(
|
|
20496
|
-
"cannot stage all changes: failed to snapshot index (write-tree failed)"
|
|
20497
|
-
);
|
|
20498
|
-
}
|
|
20499
|
-
}
|
|
20500
|
-
try {
|
|
20501
|
-
if (opts?.all) {
|
|
20502
|
-
await runGit2(cwd, ["add", "-A"], env);
|
|
20503
|
-
}
|
|
20504
|
-
await runGit2(cwd, ["commit", "-m", message], env);
|
|
20505
|
-
} catch (err) {
|
|
20506
|
-
if (savedIndex) {
|
|
20507
|
-
await runGit2(cwd, ["read-tree", savedIndex], env).catch((rollbackErr) => {
|
|
20508
|
-
console.error("git index rollback failed:", rollbackErr);
|
|
20509
|
-
});
|
|
20510
|
-
}
|
|
20511
|
-
throw err;
|
|
20512
|
-
}
|
|
20513
|
-
const sha = (await runGit2(cwd, ["rev-parse", "--short", "HEAD"], env)).trim();
|
|
20514
|
-
const subject = (await runGit2(cwd, ["log", "-1", "--format=%s"], env)).trim();
|
|
20515
|
-
return { sha, subject };
|
|
20516
|
-
}
|
|
20517
|
-
__name(gitCommit, "gitCommit");
|
|
20518
|
-
|
|
20519
20609
|
// packages/core/src/utils/github-prs.ts
|
|
20520
20610
|
init_esbuild_shims();
|
|
20521
20611
|
import { execFile as execFile3 } from "node:child_process";
|
|
@@ -23028,7 +23118,7 @@ function estimateIndexCacheBytes(index) {
|
|
|
23028
23118
|
total += INDEX_ENTRY_BASE_BYTES + estimateStringBytes(gap.childUuid) + estimateStringBytes(gap.missingParentUuid);
|
|
23029
23119
|
}
|
|
23030
23120
|
for (const [uuid3, entry] of index.byUuid) {
|
|
23031
|
-
total += INDEX_ENTRY_BASE_BYTES + INDEX_HINT_BASE_BYTES * 2 + INDEX_MAP_ENTRY_BYTES + INDEX_CONTAINER_BASE_BYTES + entry.segments.length * INDEX_CONTAINER_SLOT_BYTES + estimateStringBytes(uuid3) + estimateStringBytes(entry.parentUuid) + estimateStringBytes(entry.type) + estimateStringBytes(entry.subtype) + estimateStringBytes(entry.navigationKind) + estimateStringBytes(entry.turnResultPromptId) + estimateStringBytes(entry.turnHint.turnParentUuid) + estimateStringBytes(entry.turnHint.backgroundNotificationTaskId) + entry.segments.length * INDEX_SEGMENT_BYTES;
|
|
23121
|
+
total += INDEX_ENTRY_BASE_BYTES + INDEX_HINT_BASE_BYTES * 2 + INDEX_MAP_ENTRY_BYTES + INDEX_CONTAINER_BASE_BYTES + entry.segments.length * INDEX_CONTAINER_SLOT_BYTES + estimateStringBytes(uuid3) + estimateStringBytes(entry.parentUuid) + estimateStringBytes(entry.type) + estimateStringBytes(entry.subtype) + estimateStringBytes(entry.navigationKind) + estimateStringBytes(entry.turnResultPromptId) + estimateStringBytes(entry.daemonPromptId) + estimateStringBytes(entry.turnHint.turnParentUuid) + estimateStringBytes(entry.turnHint.backgroundNotificationTaskId) + entry.segments.length * INDEX_SEGMENT_BYTES;
|
|
23032
23122
|
}
|
|
23033
23123
|
for (const turn of index.navigationTurns) {
|
|
23034
23124
|
total += INDEX_HINT_BASE_BYTES + INDEX_CONTAINER_SLOT_BYTES + estimateStringBytes(turn.turnId) + estimateStringBytes(turn.kind) + estimateStringBytes(turn.promptId) + estimateStringBytes(turn.finalAssistantRecordId);
|
|
@@ -23368,6 +23458,7 @@ async function buildIndex(params) {
|
|
|
23368
23458
|
goalRecoveryCandidate: isGoalRecoveryCandidate(chatRecord),
|
|
23369
23459
|
turnHint: getSessionTurnRecordHint(chatRecord, sessionId),
|
|
23370
23460
|
...navigationKind ? { navigationKind } : {},
|
|
23461
|
+
...typeof chatRecord.daemonPromptId === "string" ? { daemonPromptId: chatRecord.daemonPromptId } : {},
|
|
23371
23462
|
navigationTextSuppressed,
|
|
23372
23463
|
assistantPreviewCandidate: isAssistantPreviewCandidate(chatRecord),
|
|
23373
23464
|
...record4.subtype === "turn_result" && isTurnResultRecordPayload(record4.systemPayload) ? { turnResultPromptId: record4.systemPayload.promptId } : {},
|
|
@@ -23428,7 +23519,8 @@ async function buildIndex(params) {
|
|
|
23428
23519
|
const turn = {
|
|
23429
23520
|
turnId: uuid3,
|
|
23430
23521
|
replayPosition: position,
|
|
23431
|
-
kind: entry.navigationKind
|
|
23522
|
+
kind: entry.navigationKind,
|
|
23523
|
+
...entry.daemonPromptId ? { promptId: entry.daemonPromptId } : {}
|
|
23432
23524
|
};
|
|
23433
23525
|
entry.navigationOrdinal = navigationTurns.length;
|
|
23434
23526
|
navigationTurns.push(turn);
|
|
@@ -23445,7 +23537,7 @@ async function buildIndex(params) {
|
|
|
23445
23537
|
if (targetTurn) targetTurn.finalAssistantRecordId = uuid3;
|
|
23446
23538
|
}
|
|
23447
23539
|
if (entry?.turnResultPromptId && currentPromptTurn) {
|
|
23448
|
-
currentPromptTurn.promptId
|
|
23540
|
+
currentPromptTurn.promptId ??= entry.turnResultPromptId;
|
|
23449
23541
|
currentPromptTurn = void 0;
|
|
23450
23542
|
}
|
|
23451
23543
|
}
|
|
@@ -36235,7 +36327,7 @@ var LlmChat = class {
|
|
|
36235
36327
|
const degradeAttempt = omniMediaDegradeAttempts++;
|
|
36236
36328
|
let degradeOutcome;
|
|
36237
36329
|
try {
|
|
36238
|
-
const { degradeOmniMediaAfterServerReject } = await import("./reactive-degrade-
|
|
36330
|
+
const { degradeOmniMediaAfterServerReject } = await import("./reactive-degrade-HPYBJHYA.js");
|
|
36239
36331
|
degradeOutcome = await degradeOmniMediaAfterServerReject(
|
|
36240
36332
|
self2.config,
|
|
36241
36333
|
self2.history,
|
|
@@ -44196,6 +44288,15 @@ function extractLastUserPrompt(messages) {
|
|
|
44196
44288
|
}
|
|
44197
44289
|
__name(extractLastUserPrompt, "extractLastUserPrompt");
|
|
44198
44290
|
var sessionCommitShas = /* @__PURE__ */ new Set();
|
|
44291
|
+
var sessionCommitGeneration = 0;
|
|
44292
|
+
function getSessionCommitGeneration() {
|
|
44293
|
+
return sessionCommitGeneration;
|
|
44294
|
+
}
|
|
44295
|
+
__name(getSessionCommitGeneration, "getSessionCommitGeneration");
|
|
44296
|
+
function registerSessionCommit(sha) {
|
|
44297
|
+
sessionCommitShas.add(sha.trim());
|
|
44298
|
+
}
|
|
44299
|
+
__name(registerSessionCommit, "registerSessionCommit");
|
|
44199
44300
|
function isAmendOfSessionCommit(cwd) {
|
|
44200
44301
|
if (sessionCommitShas.size === 0) return false;
|
|
44201
44302
|
try {
|
|
@@ -44211,6 +44312,11 @@ function isAmendOfSessionCommit(cwd) {
|
|
|
44211
44312
|
}
|
|
44212
44313
|
}
|
|
44213
44314
|
__name(isAmendOfSessionCommit, "isAmendOfSessionCommit");
|
|
44315
|
+
function clearSessionCommits() {
|
|
44316
|
+
sessionCommitShas.clear();
|
|
44317
|
+
sessionCommitGeneration++;
|
|
44318
|
+
}
|
|
44319
|
+
__name(clearSessionCommits, "clearSessionCommits");
|
|
44214
44320
|
function isDestructiveCommand(command, userPrompt, cwd = process.cwd()) {
|
|
44215
44321
|
const expanded = command + " " + stripShellQuotes(command);
|
|
44216
44322
|
for (const pattern of DESTRUCTIVE_GIT_PATTERNS) {
|
|
@@ -44701,7 +44807,7 @@ async function evaluateAutoMode(input) {
|
|
|
44701
44807
|
const destructiveResult = isDestructiveCommand(
|
|
44702
44808
|
command,
|
|
44703
44809
|
userPrompt,
|
|
44704
|
-
input.ctx.cwd
|
|
44810
|
+
input.ctx.cwd ?? input.config.getTargetDir?.()
|
|
44705
44811
|
);
|
|
44706
44812
|
if (destructiveResult?.blocked) {
|
|
44707
44813
|
return {
|
|
@@ -44743,7 +44849,7 @@ init_esbuild_shims();
|
|
|
44743
44849
|
|
|
44744
44850
|
// packages/core/src/utils/editor.ts
|
|
44745
44851
|
init_esbuild_shims();
|
|
44746
|
-
import { execSync as execSync2, spawn, spawnSync as spawnSync2 } from "node:child_process";
|
|
44852
|
+
import { execSync as execSync2, spawn as spawn2, spawnSync as spawnSync2 } from "node:child_process";
|
|
44747
44853
|
import { existsSync as existsSync3 } from "node:fs";
|
|
44748
44854
|
import { homedir } from "node:os";
|
|
44749
44855
|
import { join as join14 } from "node:path";
|
|
@@ -44972,7 +45078,7 @@ async function openDiff(oldPath, newPath, editor, onEditorClose) {
|
|
|
44972
45078
|
return;
|
|
44973
45079
|
}
|
|
44974
45080
|
return new Promise((resolve37, reject) => {
|
|
44975
|
-
const childProcess2 =
|
|
45081
|
+
const childProcess2 = spawn2(diffCommand.command, diffCommand.args, {
|
|
44976
45082
|
stdio: "inherit",
|
|
44977
45083
|
shell: process.platform === "win32"
|
|
44978
45084
|
});
|
|
@@ -47158,14 +47264,46 @@ function parseGitInvocation(tokens) {
|
|
|
47158
47264
|
return { subcommand: void 0, changesCwd };
|
|
47159
47265
|
}
|
|
47160
47266
|
__name(parseGitInvocation, "parseGitInvocation");
|
|
47267
|
+
var COMMIT_RECOGNITION_LEADING_NOISE = /* @__PURE__ */ new Set([
|
|
47268
|
+
"if",
|
|
47269
|
+
"then",
|
|
47270
|
+
"else",
|
|
47271
|
+
"elif",
|
|
47272
|
+
"fi",
|
|
47273
|
+
"while",
|
|
47274
|
+
"until",
|
|
47275
|
+
"for",
|
|
47276
|
+
"do",
|
|
47277
|
+
"done",
|
|
47278
|
+
"time",
|
|
47279
|
+
"!",
|
|
47280
|
+
"{",
|
|
47281
|
+
"}"
|
|
47282
|
+
]);
|
|
47283
|
+
function skipCommitRecognitionNoise(tokens) {
|
|
47284
|
+
let i = 0;
|
|
47285
|
+
while (i < tokens.length && COMMIT_RECOGNITION_LEADING_NOISE.has(tokens[i])) {
|
|
47286
|
+
i++;
|
|
47287
|
+
}
|
|
47288
|
+
if (i >= tokens.length) return null;
|
|
47289
|
+
return tokens.slice(i);
|
|
47290
|
+
}
|
|
47291
|
+
__name(skipCommitRecognitionNoise, "skipCommitRecognitionNoise");
|
|
47292
|
+
function programBasename(program) {
|
|
47293
|
+
const base = program.split(/[\\/]/).pop();
|
|
47294
|
+
return base.endsWith(".exe") ? base.slice(0, -".exe".length) : base;
|
|
47295
|
+
}
|
|
47296
|
+
__name(programBasename, "programBasename");
|
|
47161
47297
|
function gitCommitContext(command) {
|
|
47162
47298
|
let hasCommit = false;
|
|
47163
47299
|
let attributable = false;
|
|
47164
47300
|
let cwdShifted = false;
|
|
47165
47301
|
for (const sub of splitCommands(command)) {
|
|
47166
|
-
const
|
|
47167
|
-
if (!
|
|
47168
|
-
const
|
|
47302
|
+
const rawTokens = tokeniseSegment(sub);
|
|
47303
|
+
if (!rawTokens || rawTokens.length === 0) continue;
|
|
47304
|
+
const tokens = skipCommitRecognitionNoise(rawTokens);
|
|
47305
|
+
if (!tokens) continue;
|
|
47306
|
+
const program = programBasename(tokens[0]);
|
|
47169
47307
|
if (program === "cd" || program === "pushd") {
|
|
47170
47308
|
if (!hasCommit && cdTargetMayChangeRepo(tokens)) cwdShifted = true;
|
|
47171
47309
|
continue;
|
|
@@ -47263,9 +47401,13 @@ function findAttributableCommitSegment(command) {
|
|
|
47263
47401
|
cursor = end;
|
|
47264
47402
|
const tokens = tokeniseSegment(sub);
|
|
47265
47403
|
if (!tokens || tokens.length === 0) continue;
|
|
47266
|
-
const
|
|
47404
|
+
const looseTokens = skipCommitRecognitionNoise(tokens);
|
|
47405
|
+
if (!looseTokens) continue;
|
|
47406
|
+
const program = programBasename(looseTokens[0]);
|
|
47267
47407
|
if (program === "cd" || program === "pushd") {
|
|
47268
|
-
if (!cwdShifted && cdTargetMayChangeRepo(
|
|
47408
|
+
if (!cwdShifted && cdTargetMayChangeRepo(looseTokens)) {
|
|
47409
|
+
cwdShifted = true;
|
|
47410
|
+
}
|
|
47269
47411
|
continue;
|
|
47270
47412
|
}
|
|
47271
47413
|
if (program === "popd") {
|
|
@@ -47273,11 +47415,13 @@ function findAttributableCommitSegment(command) {
|
|
|
47273
47415
|
continue;
|
|
47274
47416
|
}
|
|
47275
47417
|
if (program === "git") {
|
|
47276
|
-
const { subcommand, changesCwd } = parseGitInvocation(
|
|
47418
|
+
const { subcommand, changesCwd } = parseGitInvocation(looseTokens);
|
|
47277
47419
|
if (subcommand === "commit" && !cwdShifted && !changesCwd) {
|
|
47278
47420
|
return { start, end };
|
|
47279
47421
|
}
|
|
47280
|
-
if (changesCwd && !cwdShifted)
|
|
47422
|
+
if (subcommand !== "commit" && changesCwd && !cwdShifted) {
|
|
47423
|
+
cwdShifted = true;
|
|
47424
|
+
}
|
|
47281
47425
|
}
|
|
47282
47426
|
}
|
|
47283
47427
|
return null;
|
|
@@ -48484,7 +48628,8 @@ var ShellToolInvocation = class extends BaseToolInvocation {
|
|
|
48484
48628
|
cwd,
|
|
48485
48629
|
commandToExecute,
|
|
48486
48630
|
promoteAbortController,
|
|
48487
|
-
promoteArtifacts
|
|
48631
|
+
promoteArtifacts,
|
|
48632
|
+
preHead
|
|
48488
48633
|
);
|
|
48489
48634
|
return promotedToolResult;
|
|
48490
48635
|
}
|
|
@@ -48543,6 +48688,7 @@ ${result.output}`;
|
|
|
48543
48688
|
}
|
|
48544
48689
|
let attributionWarning = null;
|
|
48545
48690
|
if (!this.config.getShellExecutionSandbox?.() && commitCtx.attributableInCwd) {
|
|
48691
|
+
await this.trackSessionCommit(cwd, preHead);
|
|
48546
48692
|
const isAmend = isAmendCommit(strippedCommand);
|
|
48547
48693
|
attributionWarning = await this.attachCommitAttribution(
|
|
48548
48694
|
cwd,
|
|
@@ -48764,8 +48910,14 @@ ${longRunHint}` : ""),
|
|
|
48764
48910
|
* `executeForeground`. The `promoteArtifacts` parameter carries the
|
|
48765
48911
|
* pre-allocated buffer/stream slots that absorb the race between
|
|
48766
48912
|
* service-side promote-time data flush and this finalizer running.
|
|
48913
|
+
*
|
|
48914
|
+
* `preHead` is the HEAD captured synchronously before spawn (null
|
|
48915
|
+
* unless the command carried a commit recognisable as landing in our
|
|
48916
|
+
* cwd, unsandboxed). A promoted command settles after `execute()`
|
|
48917
|
+
* has returned, so the foreground registration block never runs for
|
|
48918
|
+
* it — registration happens here, at settle (#12514).
|
|
48767
48919
|
*/
|
|
48768
|
-
async handlePromotedForeground(result, cwd, commandToExecute, abortController, promoteArtifacts) {
|
|
48920
|
+
async handlePromotedForeground(result, cwd, commandToExecute, abortController, promoteArtifacts, preHead) {
|
|
48769
48921
|
const outputDir = path21.join(
|
|
48770
48922
|
this.config.storage.getProjectTempDir(),
|
|
48771
48923
|
"background-shells",
|
|
@@ -48968,7 +49120,37 @@ ${longRunHint}` : ""),
|
|
|
48968
49120
|
registry3.fail(shellId, cls.failMsg, info.endTime);
|
|
48969
49121
|
}
|
|
48970
49122
|
}, "transitionRegistry");
|
|
49123
|
+
let promotedCommitRegistration = null;
|
|
49124
|
+
const registrationGeneration = getSessionCommitGeneration();
|
|
49125
|
+
const registerPromotedCommit = /* @__PURE__ */ __name(() => {
|
|
49126
|
+
if (preHead === null || promotedCommitRegistration !== null) return;
|
|
49127
|
+
if (getSessionCommitGeneration() !== registrationGeneration) {
|
|
49128
|
+
debugLogger29.warn(
|
|
49129
|
+
`promote: skipping session-commit registration in ${cwd}: the session-commit registry was cleared (approval-mode transition or session end) after this command was promoted, so the exemption must not carry across that boundary.`
|
|
49130
|
+
);
|
|
49131
|
+
return;
|
|
49132
|
+
}
|
|
49133
|
+
promotedCommitRegistration = this.trackSessionCommit(
|
|
49134
|
+
cwd,
|
|
49135
|
+
preHead,
|
|
49136
|
+
// Lineage, not mere difference. This runs when the backgrounded
|
|
49137
|
+
// child exits — arbitrarily later than the caller's pre-spawn
|
|
49138
|
+
// capture — so a commit anybody else lands in this repository
|
|
49139
|
+
// while the child runs is the newest `commit:` entry by then,
|
|
49140
|
+
// and `head.sha !== preHead` alone would adopt it: the foreign
|
|
49141
|
+
// commit would earn the amend exemption and the promoted one
|
|
49142
|
+
// would lose its own. Requiring that entry to have moved HEAD
|
|
49143
|
+
// *from* `preHead` keeps the registered SHA one this command
|
|
49144
|
+
// created (see `trackSessionCommit`'s `requirePredecessor`).
|
|
49145
|
+
preHead
|
|
49146
|
+
).catch((err) => {
|
|
49147
|
+
debugLogger29.warn(
|
|
49148
|
+
`promote: session-commit registration failed: ${getErrorMessage(err)}`
|
|
49149
|
+
);
|
|
49150
|
+
});
|
|
49151
|
+
}, "registerPromotedCommit");
|
|
48971
49152
|
promoteArtifacts.onSettleWired = (info) => {
|
|
49153
|
+
registerPromotedCommit();
|
|
48972
49154
|
const cls = classifySettle(info);
|
|
48973
49155
|
postPromoteFinalStatus = cls.status;
|
|
48974
49156
|
postPromoteSettleObserved = true;
|
|
@@ -49002,6 +49184,7 @@ ${longRunHint}` : ""),
|
|
|
49002
49184
|
promoteArtifacts.settleQueued = null;
|
|
49003
49185
|
promoteArtifacts.onSettleWired(queued);
|
|
49004
49186
|
}
|
|
49187
|
+
await promotedCommitRegistration;
|
|
49005
49188
|
const statusLine = postPromoteSettleObserved ? `Status: ${postPromoteFinalStatus ?? "settled"}. PID: ${result.pid ?? "(unknown)"}.` : `Status: running. PID: ${result.pid ?? "(unknown)"}.`;
|
|
49006
49189
|
const statusFileLine = statusFileGuidance(outputPath);
|
|
49007
49190
|
const inspectLine = `To inspect: \`/tasks\` (text), the Background tasks dialog (\u2193 + Enter on the footer pill), or \`Read\` the output file directly.`;
|
|
@@ -49264,6 +49447,122 @@ To inspect: /tasks (text) or the interactive Background tasks dialog (focus the
|
|
|
49264
49447
|
return null;
|
|
49265
49448
|
}
|
|
49266
49449
|
}
|
|
49450
|
+
/**
|
|
49451
|
+
* Record HEAD in the session registry (`permissions/destructive-commands.ts`)
|
|
49452
|
+
* when a `git commit` put it there, so a later `git commit --amend` of it is
|
|
49453
|
+
* exempt from the Auto-mode destructive-command block.
|
|
49454
|
+
*
|
|
49455
|
+
* The criterion is "the newest HEAD reflog entry is a `commit` verb, and
|
|
49456
|
+
* HEAD moved". Exit code is too strict (`git commit -m x && npm test` can
|
|
49457
|
+
* land the commit and then fail). HEAD movement alone is too loose, and
|
|
49458
|
+
* fail-open: in `git pull && git commit -m x` with nothing staged, the pull
|
|
49459
|
+
* fast-forwards onto somebody else's commit and the commit then exits
|
|
49460
|
+
* non-zero — and because `gitCommitContext` does not treat
|
|
49461
|
+
* `pull`/`checkout`/`merge` as cwd-shifting and the call site has no
|
|
49462
|
+
* exit-code gate, that chain really does reach here. A movement-only test
|
|
49463
|
+
* would register a human's SHA, trading the deterministic Layer-0 block for
|
|
49464
|
+
* the classifier.
|
|
49465
|
+
*
|
|
49466
|
+
* Where the reflog cannot answer at all (`core.logAllRefUpdates` off, reflog
|
|
49467
|
+
* expired, git missing) nothing registers and the amend stays blocked, so
|
|
49468
|
+
* that branch costs a blocked amend and never a lifted one.
|
|
49469
|
+
*
|
|
49470
|
+
* The reflog read does *not* establish that this command's own `git commit`
|
|
49471
|
+
* created HEAD, and no local read can: `preHead` is taken before the spawn
|
|
49472
|
+
* and the reflog after the whole command, so a commit another process lands
|
|
49473
|
+
* in the same repository inside that window is the newest `commit:` entry
|
|
49474
|
+
* and registers instead — degrading the next amend's deterministic Layer-0
|
|
49475
|
+
* block to the L5.3 classifier, and costing the agent its own exemption,
|
|
49476
|
+
* since the foreign entry is the newest one. Binding an entry to this child
|
|
49477
|
+
* needs a signal not derivable from reflog shape, and the cheap candidate is
|
|
49478
|
+
* unsound: a chain-level `GIT_REFLOG_ACTION` stamp rewrites the action of
|
|
49479
|
+
* every reflog-writing git call in the single `/bin/bash -c` child, so a
|
|
49480
|
+
* trailing `checkout` would write a `commit:` verb too. Per-invocation
|
|
49481
|
+
* stamping means changing how the executor spawns. Tracked in #12523.
|
|
49482
|
+
*
|
|
49483
|
+
* No multi-commit guard, unlike {@link attachCommitAttribution}, which has
|
|
49484
|
+
* to *partition* per-file contribution and so bails. In `commit a &&
|
|
49485
|
+
* commit b` HEAD is `b`, created by this command, so registering it is
|
|
49486
|
+
* sound and `a` stays blocked.
|
|
49487
|
+
*
|
|
49488
|
+
* `requirePredecessor` is the promoted path's lineage guard and is
|
|
49489
|
+
* deliberately not applied to the foreground one. There, the window
|
|
49490
|
+
* between the pre-spawn capture and this reflog read is the command's
|
|
49491
|
+
* own duration — the trade-off #12523 tracks and this docblock
|
|
49492
|
+
* discloses. On a Ctrl+B promote the same window is the backgrounded
|
|
49493
|
+
* child's whole (deliberately long) lifetime, so a commit anybody else
|
|
49494
|
+
* lands in this repository meanwhile is not a narrow race but the
|
|
49495
|
+
* expected shape, and difference-from-`preHead` alone would adopt it.
|
|
49496
|
+
* Passing the captured `preHead` here requires the entry that created
|
|
49497
|
+
* HEAD to have moved it *from* that SHA, which only this command's own
|
|
49498
|
+
* commit does. Fail-closed both ways: a foreign commit never earns an
|
|
49499
|
+
* exemption, and a multi-commit promoted chain (`commit a && commit b`,
|
|
49500
|
+
* whose newest entry descends from `a`) loses one it had earned rather
|
|
49501
|
+
* than guessing. The foreground call site passes nothing and keeps the
|
|
49502
|
+
* disclosed window unchanged.
|
|
49503
|
+
*/
|
|
49504
|
+
async trackSessionCommit(cwd, preHead, requirePredecessor) {
|
|
49505
|
+
const head = await this.getGitHeadOrigin(cwd);
|
|
49506
|
+
if (head !== null && requirePredecessor !== void 0 && head.predecessor !== requirePredecessor) {
|
|
49507
|
+
debugLogger29.warn(
|
|
49508
|
+
`Session commit not registered in ${cwd}: the newest HEAD reflog entry descends from ${head.predecessor ?? "(no predecessor)"}, not from the pre-spawn HEAD ${requirePredecessor.slice(0, 12)}, so it was not created by this command.`
|
|
49509
|
+
);
|
|
49510
|
+
return;
|
|
49511
|
+
}
|
|
49512
|
+
if (head !== null && head.createdByCommit && head.sha !== preHead) {
|
|
49513
|
+
registerSessionCommit(head.sha);
|
|
49514
|
+
} else if (head === null) {
|
|
49515
|
+
debugLogger29.warn(
|
|
49516
|
+
`Session commit not registered in ${cwd}: the HEAD reflog could not answer, so a later amend stays blocked.`
|
|
49517
|
+
);
|
|
49518
|
+
}
|
|
49519
|
+
}
|
|
49520
|
+
/**
|
|
49521
|
+
* Read HEAD, the reflog action that last moved it, and the SHA that
|
|
49522
|
+
* entry moved it *from*, in one subprocess.
|
|
49523
|
+
*
|
|
49524
|
+
* `--no-show-signature` is required, not cosmetic: with
|
|
49525
|
+
* `log.showSignature=true` git prints the signature verdict ahead of the
|
|
49526
|
+
* formatted output, shifting both fields and making an agent's own signed
|
|
49527
|
+
* commit look uncommitted. Inert when nothing is signed.
|
|
49528
|
+
*
|
|
49529
|
+
* `-2` rather than `-1` so the second entry's SHA is available as the
|
|
49530
|
+
* newest entry's predecessor — the lineage input
|
|
49531
|
+
* {@link trackSessionCommit} requires on the promoted path. It costs one
|
|
49532
|
+
* extra reflog record inside the same 2 s budget.
|
|
49533
|
+
*
|
|
49534
|
+
* Returns `null` when git cannot answer (not a repo, no HEAD, reflog off or
|
|
49535
|
+
* expired, git missing) so every caller fails closed. `predecessor` is
|
|
49536
|
+
* `null` when the reflog holds a single entry (an initial commit, or one
|
|
49537
|
+
* expired down to a single record).
|
|
49538
|
+
*/
|
|
49539
|
+
async getGitHeadOrigin(cwd) {
|
|
49540
|
+
return new Promise((resolve37) => {
|
|
49541
|
+
const child = childProcess.execFile(
|
|
49542
|
+
"git",
|
|
49543
|
+
["log", "-g", "-2", "--no-show-signature", "--format=%H%n%gs", "HEAD"],
|
|
49544
|
+
{ cwd, timeout: 2e3, windowsHide: true },
|
|
49545
|
+
(error3, stdout) => {
|
|
49546
|
+
if (error3) {
|
|
49547
|
+
resolve37(null);
|
|
49548
|
+
return;
|
|
49549
|
+
}
|
|
49550
|
+
const [sha, subject, predecessor] = String(stdout).split("\n");
|
|
49551
|
+
if (!sha || !subject) {
|
|
49552
|
+
resolve37(null);
|
|
49553
|
+
return;
|
|
49554
|
+
}
|
|
49555
|
+
resolve37({
|
|
49556
|
+
sha: sha.trim(),
|
|
49557
|
+
createdByCommit: /^commit\b/.test(subject),
|
|
49558
|
+
predecessor: predecessor?.trim() || null
|
|
49559
|
+
});
|
|
49560
|
+
}
|
|
49561
|
+
);
|
|
49562
|
+
child.on("error", () => {
|
|
49563
|
+
});
|
|
49564
|
+
});
|
|
49565
|
+
}
|
|
49267
49566
|
/**
|
|
49268
49567
|
* After a successful git commit, attach per-file AI attribution metadata
|
|
49269
49568
|
* as git notes. Analyzes staged files via `git diff` to calculate real
|
|
@@ -57544,6 +57843,7 @@ function withPostToolBatchStop(completedCalls, stopReason) {
|
|
|
57544
57843
|
request: lastCall.request,
|
|
57545
57844
|
tool: lastCall.tool,
|
|
57546
57845
|
response,
|
|
57846
|
+
startTime: lastCall.startTime,
|
|
57547
57847
|
durationMs: lastCall.durationMs,
|
|
57548
57848
|
outcome: void 0
|
|
57549
57849
|
};
|
|
@@ -57635,7 +57935,9 @@ var CoreToolScheduler = class _CoreToolScheduler {
|
|
|
57635
57935
|
__name(this, "CoreToolScheduler");
|
|
57636
57936
|
}
|
|
57637
57937
|
schedulerOptions;
|
|
57638
|
-
toolRegistry
|
|
57938
|
+
get toolRegistry() {
|
|
57939
|
+
return this.config.getToolRegistry();
|
|
57940
|
+
}
|
|
57639
57941
|
toolCalls = [];
|
|
57640
57942
|
outputUpdateHandler;
|
|
57641
57943
|
onAllToolCallsComplete;
|
|
@@ -57708,7 +58010,6 @@ var CoreToolScheduler = class _CoreToolScheduler {
|
|
|
57708
58010
|
constructor(options2) {
|
|
57709
58011
|
this.schedulerOptions = options2;
|
|
57710
58012
|
this.config = options2.config;
|
|
57711
|
-
this.toolRegistry = options2.config.getToolRegistry();
|
|
57712
58013
|
this.outputUpdateHandler = options2.outputUpdateHandler;
|
|
57713
58014
|
this.onAllToolCallsComplete = options2.onAllToolCallsComplete;
|
|
57714
58015
|
this.onToolCallsUpdate = options2.onToolCallsUpdate;
|
|
@@ -57840,7 +58141,7 @@ var CoreToolScheduler = class _CoreToolScheduler {
|
|
|
57840
58141
|
const notices = [];
|
|
57841
58142
|
let omniProcessed = responseParts;
|
|
57842
58143
|
if (this.config.isOmniEnabled?.()) {
|
|
57843
|
-
const { processToolResultOmniMedia } = await import("./tool-result-media-
|
|
58144
|
+
const { processToolResultOmniMedia } = await import("./tool-result-media-WU6QAREN.js");
|
|
57844
58145
|
omniProcessed = await processToolResultOmniMedia(
|
|
57845
58146
|
responseParts,
|
|
57846
58147
|
this.config,
|
|
@@ -57895,6 +58196,7 @@ var CoreToolScheduler = class _CoreToolScheduler {
|
|
|
57895
58196
|
status: "success",
|
|
57896
58197
|
response: auxiliaryData,
|
|
57897
58198
|
durationMs,
|
|
58199
|
+
...durationMs !== void 0 ? { startTime: existingStartTime } : {},
|
|
57898
58200
|
outcome
|
|
57899
58201
|
};
|
|
57900
58202
|
}
|
|
@@ -57906,6 +58208,7 @@ var CoreToolScheduler = class _CoreToolScheduler {
|
|
|
57906
58208
|
tool: toolInstance,
|
|
57907
58209
|
response: auxiliaryData,
|
|
57908
58210
|
durationMs,
|
|
58211
|
+
...durationMs !== void 0 ? { startTime: existingStartTime } : {},
|
|
57909
58212
|
outcome
|
|
57910
58213
|
};
|
|
57911
58214
|
}
|
|
@@ -57989,6 +58292,7 @@ var CoreToolScheduler = class _CoreToolScheduler {
|
|
|
57989
58292
|
status: "cancelled",
|
|
57990
58293
|
response,
|
|
57991
58294
|
durationMs,
|
|
58295
|
+
...durationMs !== void 0 ? { startTime: existingStartTime } : {},
|
|
57992
58296
|
outcome
|
|
57993
58297
|
};
|
|
57994
58298
|
}
|
|
@@ -60986,7 +61290,7 @@ ${body}
|
|
|
60986
61290
|
artifacts: toolResult.artifacts
|
|
60987
61291
|
} : void 0;
|
|
60988
61292
|
if (policyArtifacts && policyArtifacts.executionOrigin.kind !== "fixed_policy" && scheduledCall.tool.mediaPolicyDescriptor) {
|
|
60989
|
-
const { collectModelPolicyCall } = await import("./model-call-collection-
|
|
61293
|
+
const { collectModelPolicyCall } = await import("./model-call-collection-OKUGOY4B.js");
|
|
60990
61294
|
await collectModelPolicyCall({
|
|
60991
61295
|
config: this.config,
|
|
60992
61296
|
batch: policyArtifacts,
|
|
@@ -65444,7 +65748,7 @@ import * as fs28 from "fs/promises";
|
|
|
65444
65748
|
import * as path27 from "path";
|
|
65445
65749
|
var debugLogger36 = createDebugLogger("SKILL_LOAD");
|
|
65446
65750
|
var SKILL_MANIFEST_FILE = "SKILL.md";
|
|
65447
|
-
async function loadSkillsFromDir(baseDir) {
|
|
65751
|
+
async function loadSkillsFromDir(baseDir, onError) {
|
|
65448
65752
|
debugLogger36.debug(`Loading skills from directory (skill-load): ${baseDir}`);
|
|
65449
65753
|
try {
|
|
65450
65754
|
const entries = await fs28.readdir(baseDir, { withFileTypes: true });
|
|
@@ -65465,6 +65769,9 @@ async function loadSkillsFromDir(baseDir) {
|
|
|
65465
65769
|
if (isSymlink) {
|
|
65466
65770
|
const check = await validateSymlinkTarget(skillDir);
|
|
65467
65771
|
if (!check.ok) {
|
|
65772
|
+
if (check.reason === "invalid" && !(isNodeError(check.error) && check.error.code === "ENOENT")) {
|
|
65773
|
+
onError?.(check.error);
|
|
65774
|
+
}
|
|
65468
65775
|
if (check.reason === "not-directory") {
|
|
65469
65776
|
debugLogger36.warn(
|
|
65470
65777
|
`Skipping symlink ${entry.name} that does not point to a directory`
|
|
@@ -65484,6 +65791,7 @@ async function loadSkillsFromDir(baseDir) {
|
|
|
65484
65791
|
const config3 = parseSkillContent(content, skillManifest);
|
|
65485
65792
|
skills.push(config3);
|
|
65486
65793
|
} catch (error3) {
|
|
65794
|
+
if (!(isNodeError(error3) && error3.code === "ENOENT")) onError?.(error3);
|
|
65487
65795
|
const errorMessage = error3 instanceof Error ? error3.message : "Unknown error";
|
|
65488
65796
|
debugLogger36.error(
|
|
65489
65797
|
`Failed to parse skill at ${skillDir}: ${errorMessage}`
|
|
@@ -65493,6 +65801,7 @@ async function loadSkillsFromDir(baseDir) {
|
|
|
65493
65801
|
}
|
|
65494
65802
|
return skills;
|
|
65495
65803
|
} catch (error3) {
|
|
65804
|
+
if (!(isNodeError(error3) && error3.code === "ENOENT")) onError?.(error3);
|
|
65496
65805
|
const errorMessage = error3 instanceof Error ? error3.message : "Unknown error";
|
|
65497
65806
|
debugLogger36.debug(
|
|
65498
65807
|
`Cannot read skills directory ${baseDir}: ${errorMessage}`
|
|
@@ -118061,7 +118370,7 @@ __name(isEnabled, "isEnabled");
|
|
|
118061
118370
|
|
|
118062
118371
|
// packages/core/src/tools/tool-registry.ts
|
|
118063
118372
|
init_esbuild_shims();
|
|
118064
|
-
import { spawn as
|
|
118373
|
+
import { spawn as spawn6 } from "node:child_process";
|
|
118065
118374
|
import { StringDecoder } from "node:string_decoder";
|
|
118066
118375
|
|
|
118067
118376
|
// packages/core/src/tools/mcp-client-manager.ts
|
|
@@ -120339,7 +120648,7 @@ var DiscoveredToolInvocation = class extends BaseToolInvocation {
|
|
|
120339
120648
|
}
|
|
120340
120649
|
async execute(_signal, _updateOutput) {
|
|
120341
120650
|
const callCommand = this.config.getToolCallCommand();
|
|
120342
|
-
const child =
|
|
120651
|
+
const child = spawn6(callCommand, [this.toolName], {
|
|
120343
120652
|
env: normalizePathEnvForWindows(sanitizeChildEnv(process.env))
|
|
120344
120653
|
});
|
|
120345
120654
|
child.stdin.write(JSON.stringify(this.params));
|
|
@@ -120792,7 +121101,7 @@ var ToolRegistry = class _ToolRegistry {
|
|
|
120792
121101
|
"Tool discovery command is empty or contains only whitespace."
|
|
120793
121102
|
);
|
|
120794
121103
|
}
|
|
120795
|
-
const proc =
|
|
121104
|
+
const proc = spawn6(cmdParts[0], cmdParts.slice(1), {
|
|
120796
121105
|
env: normalizePathEnvForWindows(sanitizeChildEnv(process.env))
|
|
120797
121106
|
});
|
|
120798
121107
|
let stdout = "";
|
|
@@ -123234,6 +123543,7 @@ var SkillManager = class {
|
|
|
123234
123543
|
// `slashCommandProcessor.ts:416`.
|
|
123235
123544
|
slashReloadSuppressed = false;
|
|
123236
123545
|
parseErrors = /* @__PURE__ */ new Map();
|
|
123546
|
+
discoveryHasErrors = false;
|
|
123237
123547
|
watchers = /* @__PURE__ */ new Map();
|
|
123238
123548
|
watchStarted = false;
|
|
123239
123549
|
refreshTimer = null;
|
|
@@ -123394,6 +123704,10 @@ var SkillManager = class {
|
|
|
123394
123704
|
if (this.skillsCache === null) return null;
|
|
123395
123705
|
return this.collectCachedSkills(level);
|
|
123396
123706
|
}
|
|
123707
|
+
/** Whether missing entries in the current cache might be discovery failures. */
|
|
123708
|
+
hasDiscoveryErrors() {
|
|
123709
|
+
return this.discoveryHasErrors;
|
|
123710
|
+
}
|
|
123397
123711
|
collectCachedSkills(level) {
|
|
123398
123712
|
const skills = [];
|
|
123399
123713
|
const seenNames = /* @__PURE__ */ new Set();
|
|
@@ -123502,10 +123816,17 @@ var SkillManager = class {
|
|
|
123502
123816
|
debugLogger81.info("Refreshing skills cache...");
|
|
123503
123817
|
const skillsCache = /* @__PURE__ */ new Map();
|
|
123504
123818
|
this.parseErrors.clear();
|
|
123819
|
+
let discoveryHasErrors = false;
|
|
123820
|
+
const onDiscoveryError = /* @__PURE__ */ __name(() => {
|
|
123821
|
+
discoveryHasErrors = true;
|
|
123822
|
+
}, "onDiscoveryError");
|
|
123505
123823
|
const levels = this.config.isSafeMode() ? ["bundled"] : ["project", "user", "extension", "bundled"];
|
|
123506
123824
|
const settled = await Promise.allSettled(
|
|
123507
123825
|
levels.map(async (level) => {
|
|
123508
|
-
const levelSkills = await this.listSkillsAtLevel(
|
|
123826
|
+
const levelSkills = await this.listSkillsAtLevel(
|
|
123827
|
+
level,
|
|
123828
|
+
onDiscoveryError
|
|
123829
|
+
);
|
|
123509
123830
|
debugLogger81.debug(`Loaded ${levelSkills.length} ${level} level skills`);
|
|
123510
123831
|
return [level, levelSkills];
|
|
123511
123832
|
})
|
|
@@ -123520,12 +123841,14 @@ var SkillManager = class {
|
|
|
123520
123841
|
totalSkills += levelSkills.length;
|
|
123521
123842
|
} else {
|
|
123522
123843
|
errors.push(result.reason);
|
|
123844
|
+
onDiscoveryError();
|
|
123523
123845
|
debugLogger81.warn(
|
|
123524
123846
|
`Failed to load ${levels[i]} level skills:`,
|
|
123525
123847
|
result.reason
|
|
123526
123848
|
);
|
|
123527
123849
|
}
|
|
123528
123850
|
}
|
|
123851
|
+
this.discoveryHasErrors = discoveryHasErrors;
|
|
123529
123852
|
this.skillsCache = skillsCache;
|
|
123530
123853
|
const seenForActivation = /* @__PURE__ */ new Set();
|
|
123531
123854
|
const eligibleForActivation = [];
|
|
@@ -123907,7 +124230,7 @@ var SkillManager = class {
|
|
|
123907
124230
|
* @param level - Storage level to scan
|
|
123908
124231
|
* @returns Array of skill configurations
|
|
123909
124232
|
*/
|
|
123910
|
-
async listSkillsAtLevel(level) {
|
|
124233
|
+
async listSkillsAtLevel(level, onDiscoveryError) {
|
|
123911
124234
|
if (this.config.getBareMode()) {
|
|
123912
124235
|
debugLogger81.debug(`Skipping ${level} level skills in bare mode`);
|
|
123913
124236
|
return [];
|
|
@@ -123929,6 +124252,7 @@ var SkillManager = class {
|
|
|
123929
124252
|
const extensions = this.config.getActiveExtensions();
|
|
123930
124253
|
const skills2 = [];
|
|
123931
124254
|
for (const extension of extensions) {
|
|
124255
|
+
if (extension.skillsDiscoveryHasErrors) onDiscoveryError?.();
|
|
123932
124256
|
extension.skills?.forEach((skill) => {
|
|
123933
124257
|
const hasInvalidPriority = skill.priority !== void 0 && (typeof skill.priority !== "number" || !Number.isFinite(skill.priority));
|
|
123934
124258
|
if (hasInvalidPriority) {
|
|
@@ -123961,14 +124285,12 @@ var SkillManager = class {
|
|
|
123961
124285
|
}
|
|
123962
124286
|
if (level === "bundled") {
|
|
123963
124287
|
const bundledDir = this.bundledSkillsDir;
|
|
123964
|
-
if (!fsSync2.existsSync(bundledDir)) {
|
|
123965
|
-
debugLogger81.warn(
|
|
123966
|
-
`Bundled skills directory not found: ${bundledDir}. This may indicate an incomplete installation.`
|
|
123967
|
-
);
|
|
123968
|
-
return [];
|
|
123969
|
-
}
|
|
123970
124288
|
debugLogger81.debug(`Loading bundled skills from: ${bundledDir}`);
|
|
123971
|
-
const skills2 = await this.loadSkillsFromDir(
|
|
124289
|
+
const skills2 = await this.loadSkillsFromDir(
|
|
124290
|
+
bundledDir,
|
|
124291
|
+
"bundled",
|
|
124292
|
+
onDiscoveryError
|
|
124293
|
+
);
|
|
123972
124294
|
debugLogger81.debug(`Loaded ${skills2.length} bundled skills`);
|
|
123973
124295
|
return skills2;
|
|
123974
124296
|
}
|
|
@@ -123976,7 +124298,7 @@ var SkillManager = class {
|
|
|
123976
124298
|
const perDirSkills = await Promise.all(
|
|
123977
124299
|
baseDirs.map((baseDir) => {
|
|
123978
124300
|
debugLogger81.debug(`Loading ${level} level skills from: ${baseDir}`);
|
|
123979
|
-
return this.loadSkillsFromDir(baseDir, level);
|
|
124301
|
+
return this.loadSkillsFromDir(baseDir, level, onDiscoveryError);
|
|
123980
124302
|
})
|
|
123981
124303
|
);
|
|
123982
124304
|
const skills = [];
|
|
@@ -123997,7 +124319,7 @@ var SkillManager = class {
|
|
|
123997
124319
|
debugLogger81.debug(`Loaded ${skills.length} ${level} level skills`);
|
|
123998
124320
|
return skills;
|
|
123999
124321
|
}
|
|
124000
|
-
async loadSkillsFromDir(baseDir, level) {
|
|
124322
|
+
async loadSkillsFromDir(baseDir, level, onDiscoveryError) {
|
|
124001
124323
|
debugLogger81.debug(`Loading skills from directory: ${baseDir}`);
|
|
124002
124324
|
try {
|
|
124003
124325
|
const entries = await fs48.readdir(baseDir, { withFileTypes: true });
|
|
@@ -124018,6 +124340,9 @@ var SkillManager = class {
|
|
|
124018
124340
|
if (isSymlink) {
|
|
124019
124341
|
const check = await validateSymlinkTarget(skillDir);
|
|
124020
124342
|
if (!check.ok) {
|
|
124343
|
+
if (check.reason === "invalid" && !(isNodeError(check.error) && check.error.code === "ENOENT")) {
|
|
124344
|
+
onDiscoveryError?.();
|
|
124345
|
+
}
|
|
124021
124346
|
if (check.reason === "not-directory") {
|
|
124022
124347
|
debugLogger81.warn(
|
|
124023
124348
|
`Skipping symlink ${entry.name} that does not point to a directory`
|
|
@@ -124035,6 +124360,9 @@ var SkillManager = class {
|
|
|
124035
124360
|
await fs48.access(skillManifest);
|
|
124036
124361
|
return await this.parseSkillFileInternal(skillManifest, level);
|
|
124037
124362
|
} catch (error3) {
|
|
124363
|
+
if (!(isNodeError(error3) && error3.code === "ENOENT")) {
|
|
124364
|
+
onDiscoveryError?.();
|
|
124365
|
+
}
|
|
124038
124366
|
if (error3 instanceof SkillError) {
|
|
124039
124367
|
debugLogger81.error(
|
|
124040
124368
|
`Failed to parse skill at ${skillDir}: ${error3.message}`
|
|
@@ -124050,6 +124378,13 @@ var SkillManager = class {
|
|
|
124050
124378
|
);
|
|
124051
124379
|
return loaded.filter((s3) => s3 !== null);
|
|
124052
124380
|
} catch (error3) {
|
|
124381
|
+
if (!(isNodeError(error3) && error3.code === "ENOENT")) {
|
|
124382
|
+
onDiscoveryError?.();
|
|
124383
|
+
} else if (level === "bundled") {
|
|
124384
|
+
debugLogger81.warn(
|
|
124385
|
+
`Bundled skills directory not found: ${baseDir}. This may indicate an incomplete installation.`
|
|
124386
|
+
);
|
|
124387
|
+
}
|
|
124053
124388
|
const errorMessage = error3 instanceof Error ? error3.message : "Unknown error";
|
|
124054
124389
|
debugLogger81.debug(
|
|
124055
124390
|
`Cannot read skills directory ${baseDir}: ${errorMessage}`
|
|
@@ -141383,7 +141718,7 @@ init_esbuild_shims();
|
|
|
141383
141718
|
import * as fs71 from "node:fs";
|
|
141384
141719
|
import * as path72 from "node:path";
|
|
141385
141720
|
var debugLogger102 = createDebugLogger("AGENT_PLUGINS_V1");
|
|
141386
|
-
async function loadAgentPluginSkills(pluginRoot) {
|
|
141721
|
+
async function loadAgentPluginSkills(pluginRoot, onError) {
|
|
141387
141722
|
const skillsPath = path72.join(pluginRoot, "skills");
|
|
141388
141723
|
let resolvedSkillsPath;
|
|
141389
141724
|
try {
|
|
@@ -141393,7 +141728,8 @@ async function loadAgentPluginSkills(pluginRoot) {
|
|
|
141393
141728
|
return [];
|
|
141394
141729
|
}
|
|
141395
141730
|
} catch (error3) {
|
|
141396
|
-
if (error3.code === "ENOENT") return [];
|
|
141731
|
+
if (isNodeError(error3) && error3.code === "ENOENT") return [];
|
|
141732
|
+
onError?.(error3);
|
|
141397
141733
|
debugLogger102.warn(
|
|
141398
141734
|
`Disabling Agent Plugins skills: ${error3 instanceof Error ? error3.message : String(error3)}`
|
|
141399
141735
|
);
|
|
@@ -141405,6 +141741,7 @@ async function loadAgentPluginSkills(pluginRoot) {
|
|
|
141405
141741
|
withFileTypes: true
|
|
141406
141742
|
});
|
|
141407
141743
|
} catch (error3) {
|
|
141744
|
+
if (!(isNodeError(error3) && error3.code === "ENOENT")) onError?.(error3);
|
|
141408
141745
|
debugLogger102.warn(
|
|
141409
141746
|
`Disabling Agent Plugins skills: ${error3 instanceof Error ? error3.message : String(error3)}`
|
|
141410
141747
|
);
|
|
@@ -141428,6 +141765,7 @@ async function loadAgentPluginSkills(pluginRoot) {
|
|
|
141428
141765
|
const content = await fs71.promises.readFile(resolvedManifest, "utf8");
|
|
141429
141766
|
skills.push(parseAgentPluginSkill(content, resolvedManifest, entry.name));
|
|
141430
141767
|
} catch (error3) {
|
|
141768
|
+
if (!(isNodeError(error3) && error3.code === "ENOENT")) onError?.(error3);
|
|
141431
141769
|
debugLogger102.warn(
|
|
141432
141770
|
`Skipping Agent Plugins skill "${entry.name}": ${error3 instanceof Error ? error3.message : String(error3)}`
|
|
141433
141771
|
);
|
|
@@ -142651,9 +142989,15 @@ var ExtensionManager = class _ExtensionManager {
|
|
|
142651
142989
|
const { loadedManifest } = head;
|
|
142652
142990
|
const config3 = extension.config;
|
|
142653
142991
|
const effectiveExtensionPath = extension.path;
|
|
142992
|
+
const onSkillsDiscoveryError = /* @__PURE__ */ __name(() => {
|
|
142993
|
+
head.extension.skillsDiscoveryHasErrors = true;
|
|
142994
|
+
}, "onSkillsDiscoveryError");
|
|
142654
142995
|
if (loadedManifest.format === "agent-plugins-v1") {
|
|
142655
142996
|
extension.commands = [];
|
|
142656
|
-
extension.skills = await loadAgentPluginSkills(
|
|
142997
|
+
extension.skills = await loadAgentPluginSkills(
|
|
142998
|
+
effectiveExtensionPath,
|
|
142999
|
+
onSkillsDiscoveryError
|
|
143000
|
+
);
|
|
142657
143001
|
extension.agents = [];
|
|
142658
143002
|
extension.workflows = [];
|
|
142659
143003
|
} else {
|
|
@@ -142664,7 +143008,8 @@ var ExtensionManager = class _ExtensionManager {
|
|
|
142664
143008
|
(contextFileName) => path73.join(effectiveExtensionPath, contextFileName)
|
|
142665
143009
|
).filter((contextFilePath) => fs72.existsSync(contextFilePath));
|
|
142666
143010
|
extension.skills = await loadSkillsFromDir(
|
|
142667
|
-
`${effectiveExtensionPath}/skills
|
|
143011
|
+
`${effectiveExtensionPath}/skills`,
|
|
143012
|
+
onSkillsDiscoveryError
|
|
142668
143013
|
);
|
|
142669
143014
|
const agentExecutorRefusals = /* @__PURE__ */ new Map();
|
|
142670
143015
|
extension.agents = await loadSubagentFromDir(
|
|
@@ -144318,7 +144663,7 @@ var HookRegistry = class {
|
|
|
144318
144663
|
|
|
144319
144664
|
// packages/core/src/hooks/hookRunner.ts
|
|
144320
144665
|
init_esbuild_shims();
|
|
144321
|
-
import { execFile as execFile10, spawn as
|
|
144666
|
+
import { execFile as execFile10, spawn as spawn7 } from "node:child_process";
|
|
144322
144667
|
import { randomUUID as randomUUID16 } from "node:crypto";
|
|
144323
144668
|
import { rmSync as rmSync6, writeFileSync as writeFileSync8 } from "node:fs";
|
|
144324
144669
|
import { tmpdir as tmpdir4 } from "node:os";
|
|
@@ -146800,7 +147145,7 @@ var HookRunner = class {
|
|
|
146800
147145
|
const supervisorEnv = { ...env };
|
|
146801
147146
|
delete supervisorEnv["NODE_OPTIONS"];
|
|
146802
147147
|
try {
|
|
146803
|
-
child =
|
|
147148
|
+
child = spawn7(
|
|
146804
147149
|
process.execPath,
|
|
146805
147150
|
[
|
|
146806
147151
|
"--input-type=commonjs",
|
|
@@ -146836,7 +147181,7 @@ var HookRunner = class {
|
|
|
146836
147181
|
}
|
|
146837
147182
|
} else {
|
|
146838
147183
|
resolveSupervisorStarted();
|
|
146839
|
-
child =
|
|
147184
|
+
child = spawn7(
|
|
146840
147185
|
shellConfig.executable,
|
|
146841
147186
|
[...shellConfig.argsPrefix, command],
|
|
146842
147187
|
{
|
|
@@ -155020,7 +155365,7 @@ var Config = class _Config {
|
|
|
155020
155365
|
await this.proxyDispatcherReady;
|
|
155021
155366
|
options2?.signal?.throwIfAborted();
|
|
155022
155367
|
if (this.isOmniEnabled()) {
|
|
155023
|
-
const { normalizeDedicatedOmniUploadConfig } = await import("./upload-config-
|
|
155368
|
+
const { normalizeDedicatedOmniUploadConfig } = await import("./upload-config-LVVUIKA2.js");
|
|
155024
155369
|
this.omniUploadConfig = normalizeDedicatedOmniUploadConfig({
|
|
155025
155370
|
baseUrl: this.omniUploadBaseUrl,
|
|
155026
155371
|
apiKeyEnv: this.omniUploadApiKeyEnv,
|
|
@@ -158421,6 +158766,9 @@ var Config = class _Config {
|
|
|
158421
158766
|
}
|
|
158422
158767
|
if (fromMode !== mode) {
|
|
158423
158768
|
this.autoModeDenialState = resetDenialState();
|
|
158769
|
+
if (!isDerivedConfig(this) && mode !== "plan" /* PLAN */ && fromMode !== "plan" /* PLAN */) {
|
|
158770
|
+
clearSessionCommits();
|
|
158771
|
+
}
|
|
158424
158772
|
}
|
|
158425
158773
|
this.approvalMode = mode;
|
|
158426
158774
|
if (mode !== "plan" /* PLAN */) this.planExecutionMode = void 0;
|
|
@@ -158959,7 +159307,7 @@ var Config = class _Config {
|
|
|
158959
159307
|
return this.omniPolicyTools;
|
|
158960
159308
|
}
|
|
158961
159309
|
async loadOmniMediaReader() {
|
|
158962
|
-
return import("./omni-
|
|
159310
|
+
return import("./omni-DLBHISHC.js");
|
|
158963
159311
|
}
|
|
158964
159312
|
/** Normalized `omni.processing` view. Undefined until tool warmup
|
|
158965
159313
|
* completes (or when omni is disabled). */
|
|
@@ -160535,7 +160883,7 @@ var Config = class _Config {
|
|
|
160535
160883
|
async registerWorkflowTool(registry3) {
|
|
160536
160884
|
if (registry3.getAllToolNames().includes(ToolNames.WORKFLOW)) return true;
|
|
160537
160885
|
await this.registerLazyTool(registry3, ToolNames.WORKFLOW, async () => {
|
|
160538
|
-
const { WorkflowTool } = await import("./workflow-
|
|
160886
|
+
const { WorkflowTool } = await import("./workflow-FRJO5ZUI.js");
|
|
160539
160887
|
return new WorkflowTool(this);
|
|
160540
160888
|
});
|
|
160541
160889
|
return registry3.getAllToolNames().includes(ToolNames.WORKFLOW);
|
|
@@ -160584,7 +160932,7 @@ var Config = class _Config {
|
|
|
160584
160932
|
return;
|
|
160585
160933
|
}
|
|
160586
160934
|
const factory = /* @__PURE__ */ __name(async () => {
|
|
160587
|
-
const { RecordSourceTool } = await import("./record-source-
|
|
160935
|
+
const { RecordSourceTool } = await import("./record-source-2VBLKVIE.js");
|
|
160588
160936
|
return new RecordSourceTool(this);
|
|
160589
160937
|
}, "factory");
|
|
160590
160938
|
if (status === "deferred") {
|
|
@@ -160615,16 +160963,16 @@ var Config = class _Config {
|
|
|
160615
160963
|
const registerGoalWorkerTools = /* @__PURE__ */ __name(async () => {
|
|
160616
160964
|
if (options2?.forSubAgent) return;
|
|
160617
160965
|
await registerLazy(ToolNames.GET_GOAL, async () => {
|
|
160618
|
-
const { GetGoalTool: GetGoalTool2 } = await import("./goal-tools-
|
|
160966
|
+
const { GetGoalTool: GetGoalTool2 } = await import("./goal-tools-G4RIX4ER.js");
|
|
160619
160967
|
return new GetGoalTool2(this);
|
|
160620
160968
|
});
|
|
160621
160969
|
await registerLazy(ToolNames.UPDATE_GOAL, async () => {
|
|
160622
|
-
const { UpdateGoalTool: UpdateGoalTool2 } = await import("./goal-tools-
|
|
160970
|
+
const { UpdateGoalTool: UpdateGoalTool2 } = await import("./goal-tools-G4RIX4ER.js");
|
|
160623
160971
|
return new UpdateGoalTool2(this);
|
|
160624
160972
|
});
|
|
160625
160973
|
if (this.getModelProposedGoals() !== "disabled" && (resolveInteractionMode(this) === "interactive" || this.goalProposalHostSupported)) {
|
|
160626
160974
|
await registerLazy(ToolNames.PROPOSE_GOAL, async () => {
|
|
160627
|
-
const { ProposeGoalTool: ProposeGoalTool2 } = await import("./goal-tools-
|
|
160975
|
+
const { ProposeGoalTool: ProposeGoalTool2 } = await import("./goal-tools-G4RIX4ER.js");
|
|
160628
160976
|
return new ProposeGoalTool2(this);
|
|
160629
160977
|
});
|
|
160630
160978
|
}
|
|
@@ -160644,16 +160992,16 @@ var Config = class _Config {
|
|
|
160644
160992
|
});
|
|
160645
160993
|
}
|
|
160646
160994
|
await registerLazy(ToolNames.WEB_FETCH, async () => {
|
|
160647
|
-
const { WebFetchTool } = await import("./web-fetch-
|
|
160995
|
+
const { WebFetchTool } = await import("./web-fetch-3O2DFRE5.js");
|
|
160648
160996
|
return new WebFetchTool(this);
|
|
160649
160997
|
});
|
|
160650
160998
|
const hasExplicitWebSearchBackend = !!this.webSearchSettings?.model?.trim() || !!this.webSearchSettings?.baseUrl;
|
|
160651
160999
|
if (!this.getBareMode() && !this.isSafeMode() && this.webSearchSettings?.enabled !== false && (this.webSearchSettings?.enabled === true || !hasExplicitWebSearchBackend)) {
|
|
160652
|
-
const { evaluateWebSearchGate } = await import("./web-search-
|
|
161000
|
+
const { evaluateWebSearchGate } = await import("./web-search-5FS3NB3D.js");
|
|
160653
161001
|
const gate = evaluateWebSearchGate(this);
|
|
160654
161002
|
if (gate.ok) {
|
|
160655
161003
|
await registerLazy(ToolNames.WEB_SEARCH, async () => {
|
|
160656
|
-
const { WebSearchTool } = await import("./web-search-
|
|
161004
|
+
const { WebSearchTool } = await import("./web-search-5FS3NB3D.js");
|
|
160657
161005
|
return new WebSearchTool(this);
|
|
160658
161006
|
});
|
|
160659
161007
|
} else if (!gate.silent && !this.webSearchNoticeEmitted && !options2?.forSubAgent) {
|
|
@@ -160670,8 +161018,8 @@ var Config = class _Config {
|
|
|
160670
161018
|
);
|
|
160671
161019
|
}
|
|
160672
161020
|
const [{ createExecutionTools }, { wrapExecutionTool }] = await Promise.all([
|
|
160673
|
-
import("./local-execution-environment-
|
|
160674
|
-
import("./execution-tool-
|
|
161021
|
+
import("./local-execution-environment-XIQLRMLF.js"),
|
|
161022
|
+
import("./execution-tool-DZ4XSEFZ.js")
|
|
160675
161023
|
]);
|
|
160676
161024
|
for (const [name, tool] of createExecutionTools(this)) {
|
|
160677
161025
|
if (environment.toolNames && !environment.toolNames.has(name)) continue;
|
|
@@ -160682,11 +161030,11 @@ var Config = class _Config {
|
|
|
160682
161030
|
);
|
|
160683
161031
|
}
|
|
160684
161032
|
await registerLazy(ToolNames.TOOL_CALL, async () => {
|
|
160685
|
-
const { ToolCallTool } = await import("./tool-call-
|
|
161033
|
+
const { ToolCallTool } = await import("./tool-call-DUHP6UXC.js");
|
|
160686
161034
|
return new ToolCallTool(registry3);
|
|
160687
161035
|
});
|
|
160688
161036
|
await registerLazy(ToolNames.TOOL_SEARCH, async () => {
|
|
160689
|
-
const { ToolSearchTool } = await import("./tool-search-
|
|
161037
|
+
const { ToolSearchTool } = await import("./tool-search-ET4NH2LK.js");
|
|
160690
161038
|
return new ToolSearchTool(this);
|
|
160691
161039
|
});
|
|
160692
161040
|
if (this.executionEnvironment && !options2?.forSubAgent) {
|
|
@@ -160698,7 +161046,7 @@ var Config = class _Config {
|
|
|
160698
161046
|
}
|
|
160699
161047
|
if (this.shellExecutionSandbox) {
|
|
160700
161048
|
await registerLazy(ToolNames.SHELL, async () => {
|
|
160701
|
-
const { ShellTool: ShellTool2 } = await import("./shell-
|
|
161049
|
+
const { ShellTool: ShellTool2 } = await import("./shell-THD5EYOK.js");
|
|
160702
161050
|
return new ShellTool2(this);
|
|
160703
161051
|
});
|
|
160704
161052
|
await registerLazy(ToolNames.TASK_STOP, async () => {
|
|
@@ -160706,27 +161054,27 @@ var Config = class _Config {
|
|
|
160706
161054
|
return new TaskStopTool(this);
|
|
160707
161055
|
});
|
|
160708
161056
|
await registerLazy(ToolNames.READ_FILE, async () => {
|
|
160709
|
-
const { ReadFileTool } = await import("./read-file-
|
|
161057
|
+
const { ReadFileTool } = await import("./read-file-SXS2MKDY.js");
|
|
160710
161058
|
return new ReadFileTool(this);
|
|
160711
161059
|
});
|
|
160712
161060
|
await registerLazy(ToolNames.WRITE_FILE, async () => {
|
|
160713
|
-
const { WriteFileTool } = await import("./write-file-
|
|
161061
|
+
const { WriteFileTool } = await import("./write-file-BATJLBJX.js");
|
|
160714
161062
|
return new WriteFileTool(this);
|
|
160715
161063
|
});
|
|
160716
161064
|
await registerLazy(ToolNames.EDIT, async () => {
|
|
160717
|
-
const { EditTool } = await import("./edit-
|
|
161065
|
+
const { EditTool } = await import("./edit-FPIWTN3L.js");
|
|
160718
161066
|
return new EditTool(this);
|
|
160719
161067
|
});
|
|
160720
161068
|
await registerLazy(ToolNames.MONITOR, async () => {
|
|
160721
|
-
const { MonitorTool } = await import("./monitor-
|
|
161069
|
+
const { MonitorTool } = await import("./monitor-7JUZXYZN.js");
|
|
160722
161070
|
return new MonitorTool(this);
|
|
160723
161071
|
});
|
|
160724
161072
|
await registerLazy(ToolNames.AGENT, async () => {
|
|
160725
|
-
const { AgentTool: AgentTool2 } = await import("./agent-
|
|
161073
|
+
const { AgentTool: AgentTool2 } = await import("./agent-MTWGIPWC.js");
|
|
160726
161074
|
return new AgentTool2(this);
|
|
160727
161075
|
});
|
|
160728
161076
|
await registerLazy(ToolNames.GLOB, async () => {
|
|
160729
|
-
const { GlobTool } = await import("./glob-
|
|
161077
|
+
const { GlobTool } = await import("./glob-UOKQZHKL.js");
|
|
160730
161078
|
return new GlobTool(this);
|
|
160731
161079
|
});
|
|
160732
161080
|
await registerLazy(ToolNames.LS, async () => {
|
|
@@ -160735,7 +161083,7 @@ var Config = class _Config {
|
|
|
160735
161083
|
});
|
|
160736
161084
|
if (resolveInteractionMode(this) !== "headless") {
|
|
160737
161085
|
await registerLazy(ToolNames.ASK_USER_QUESTION, async () => {
|
|
160738
|
-
const { AskUserQuestionTool: AskUserQuestionTool2 } = await import("./askUserQuestion-
|
|
161086
|
+
const { AskUserQuestionTool: AskUserQuestionTool2 } = await import("./askUserQuestion-V4OFZD5D.js");
|
|
160739
161087
|
return new AskUserQuestionTool2(this);
|
|
160740
161088
|
});
|
|
160741
161089
|
}
|
|
@@ -160745,19 +161093,19 @@ var Config = class _Config {
|
|
|
160745
161093
|
}
|
|
160746
161094
|
if (this.getBareMode()) {
|
|
160747
161095
|
await registerLazy(ToolNames.READ_FILE, async () => {
|
|
160748
|
-
const { ReadFileTool } = await import("./read-file-
|
|
161096
|
+
const { ReadFileTool } = await import("./read-file-SXS2MKDY.js");
|
|
160749
161097
|
return new ReadFileTool(this);
|
|
160750
161098
|
});
|
|
160751
161099
|
await registerLazy(ToolNames.EDIT, async () => {
|
|
160752
|
-
const { EditTool } = await import("./edit-
|
|
161100
|
+
const { EditTool } = await import("./edit-FPIWTN3L.js");
|
|
160753
161101
|
return new EditTool(this);
|
|
160754
161102
|
});
|
|
160755
161103
|
await registerLazy(ToolNames.NOTEBOOK_EDIT, async () => {
|
|
160756
|
-
const { NotebookEditTool } = await import("./notebook-edit-
|
|
161104
|
+
const { NotebookEditTool } = await import("./notebook-edit-IYDACZDW.js");
|
|
160757
161105
|
return new NotebookEditTool(this);
|
|
160758
161106
|
});
|
|
160759
161107
|
await registerLazy(ToolNames.SHELL, async () => {
|
|
160760
|
-
const { ShellTool: ShellTool2 } = await import("./shell-
|
|
161108
|
+
const { ShellTool: ShellTool2 } = await import("./shell-THD5EYOK.js");
|
|
160761
161109
|
return new ShellTool2(this);
|
|
160762
161110
|
});
|
|
160763
161111
|
await registerGoalWorkerTools();
|
|
@@ -160772,11 +161120,11 @@ var Config = class _Config {
|
|
|
160772
161120
|
await registerExecIfEnabled();
|
|
160773
161121
|
await registerGoalWorkerTools();
|
|
160774
161122
|
await registerLazy(ToolNames.TOOL_CALL, async () => {
|
|
160775
|
-
const { ToolCallTool } = await import("./tool-call-
|
|
161123
|
+
const { ToolCallTool } = await import("./tool-call-DUHP6UXC.js");
|
|
160776
161124
|
return new ToolCallTool(registry3);
|
|
160777
161125
|
});
|
|
160778
161126
|
await registerLazy(ToolNames.TOOL_SEARCH, async () => {
|
|
160779
|
-
const { ToolSearchTool } = await import("./tool-search-
|
|
161127
|
+
const { ToolSearchTool } = await import("./tool-search-ET4NH2LK.js");
|
|
160780
161128
|
return new ToolSearchTool(this);
|
|
160781
161129
|
});
|
|
160782
161130
|
await registerLazy(ToolNames.READ_MCP_RESOURCE, async () => {
|
|
@@ -160784,7 +161132,7 @@ var Config = class _Config {
|
|
|
160784
161132
|
return new ReadMcpResourceTool(this);
|
|
160785
161133
|
});
|
|
160786
161134
|
await registerLazy(ToolNames.AGENT, async () => {
|
|
160787
|
-
const { AgentTool: AgentTool2 } = await import("./agent-
|
|
161135
|
+
const { AgentTool: AgentTool2 } = await import("./agent-MTWGIPWC.js");
|
|
160788
161136
|
return new AgentTool2(this);
|
|
160789
161137
|
});
|
|
160790
161138
|
await registerLazy(ToolNames.LIST_AGENTS, async () => {
|
|
@@ -160796,11 +161144,11 @@ var Config = class _Config {
|
|
|
160796
161144
|
return new TaskStopTool(this);
|
|
160797
161145
|
});
|
|
160798
161146
|
await registerLazy(ToolNames.SEND_MESSAGE, async () => {
|
|
160799
|
-
const { SendMessageTool } = await import("./send-message-
|
|
161147
|
+
const { SendMessageTool } = await import("./send-message-FBU6WDID.js");
|
|
160800
161148
|
return new SendMessageTool(this);
|
|
160801
161149
|
});
|
|
160802
161150
|
await registerLazy(ToolNames.SKILL, async () => {
|
|
160803
|
-
const { SkillTool } = await import("./skill-
|
|
161151
|
+
const { SkillTool } = await import("./skill-2D6KXDC5.js");
|
|
160804
161152
|
return new SkillTool(this);
|
|
160805
161153
|
});
|
|
160806
161154
|
if (this.isLsToolEnabled()) {
|
|
@@ -160810,11 +161158,11 @@ var Config = class _Config {
|
|
|
160810
161158
|
});
|
|
160811
161159
|
}
|
|
160812
161160
|
await registerLazy(ToolNames.READ_FILE, async () => {
|
|
160813
|
-
const { ReadFileTool } = await import("./read-file-
|
|
161161
|
+
const { ReadFileTool } = await import("./read-file-SXS2MKDY.js");
|
|
160814
161162
|
return new ReadFileTool(this);
|
|
160815
161163
|
});
|
|
160816
161164
|
await registerLazy(ToolNames.ZOOM_IMAGE, async () => {
|
|
160817
|
-
const { ZoomImageTool } = await import("./zoom-image-
|
|
161165
|
+
const { ZoomImageTool } = await import("./zoom-image-5I7DDLQE.js");
|
|
160818
161166
|
return new ZoomImageTool(this);
|
|
160819
161167
|
});
|
|
160820
161168
|
if (this.getUseRipgrep()) {
|
|
@@ -160829,7 +161177,7 @@ var Config = class _Config {
|
|
|
160829
161177
|
recordStartupEvent("config_initialize_ripgrep_probe_end");
|
|
160830
161178
|
if (useRipgrep) {
|
|
160831
161179
|
await registerLazy(ToolNames.GREP, async () => {
|
|
160832
|
-
const { RipGrepTool } = await import("./ripGrep-
|
|
161180
|
+
const { RipGrepTool } = await import("./ripGrep-X33VVIN5.js");
|
|
160833
161181
|
return new RipGrepTool(this);
|
|
160834
161182
|
});
|
|
160835
161183
|
} else {
|
|
@@ -160855,54 +161203,54 @@ var Config = class _Config {
|
|
|
160855
161203
|
});
|
|
160856
161204
|
}
|
|
160857
161205
|
await registerLazy(ToolNames.GLOB, async () => {
|
|
160858
|
-
const { GlobTool } = await import("./glob-
|
|
161206
|
+
const { GlobTool } = await import("./glob-UOKQZHKL.js");
|
|
160859
161207
|
return new GlobTool(this);
|
|
160860
161208
|
});
|
|
160861
161209
|
await registerLazy(ToolNames.EDIT, async () => {
|
|
160862
|
-
const { EditTool } = await import("./edit-
|
|
161210
|
+
const { EditTool } = await import("./edit-FPIWTN3L.js");
|
|
160863
161211
|
return new EditTool(this);
|
|
160864
161212
|
});
|
|
160865
161213
|
await registerLazy(ToolNames.NOTEBOOK_EDIT, async () => {
|
|
160866
|
-
const { NotebookEditTool } = await import("./notebook-edit-
|
|
161214
|
+
const { NotebookEditTool } = await import("./notebook-edit-IYDACZDW.js");
|
|
160867
161215
|
return new NotebookEditTool(this);
|
|
160868
161216
|
});
|
|
160869
161217
|
await registerLazy(ToolNames.WRITE_FILE, async () => {
|
|
160870
|
-
const { WriteFileTool } = await import("./write-file-
|
|
161218
|
+
const { WriteFileTool } = await import("./write-file-BATJLBJX.js");
|
|
160871
161219
|
return new WriteFileTool(this);
|
|
160872
161220
|
});
|
|
160873
161221
|
await registerLazy(ToolNames.SHELL, async () => {
|
|
160874
|
-
const { ShellTool: ShellTool2 } = await import("./shell-
|
|
161222
|
+
const { ShellTool: ShellTool2 } = await import("./shell-THD5EYOK.js");
|
|
160875
161223
|
return new ShellTool2(this);
|
|
160876
161224
|
});
|
|
160877
161225
|
await registerLazy(ToolNames.REPORT_FINDINGS, async () => {
|
|
160878
|
-
const { ReportFindingsTool } = await import("./report-findings-
|
|
161226
|
+
const { ReportFindingsTool } = await import("./report-findings-D2QUYUOG.js");
|
|
160879
161227
|
return new ReportFindingsTool();
|
|
160880
161228
|
});
|
|
160881
161229
|
const supportsUserInteraction = resolveInteractionMode(this) !== "headless";
|
|
160882
161230
|
if (supportsUserInteraction) {
|
|
160883
161231
|
await registerLazy(ToolNames.ASK_USER_QUESTION, async () => {
|
|
160884
|
-
const { AskUserQuestionTool: AskUserQuestionTool2 } = await import("./askUserQuestion-
|
|
161232
|
+
const { AskUserQuestionTool: AskUserQuestionTool2 } = await import("./askUserQuestion-V4OFZD5D.js");
|
|
160885
161233
|
return new AskUserQuestionTool2(this);
|
|
160886
161234
|
});
|
|
160887
161235
|
}
|
|
160888
161236
|
if (!this.sdkMode && (supportsUserInteraction || options2?.forSubAgent)) {
|
|
160889
161237
|
await registerLazy(ToolNames.EXIT_PLAN_MODE, async () => {
|
|
160890
|
-
const { ExitPlanModeTool: ExitPlanModeTool2 } = await import("./exitPlanMode-
|
|
161238
|
+
const { ExitPlanModeTool: ExitPlanModeTool2 } = await import("./exitPlanMode-VIGOD2KP.js");
|
|
160891
161239
|
return new ExitPlanModeTool2(this);
|
|
160892
161240
|
});
|
|
160893
161241
|
}
|
|
160894
161242
|
if (!this.sdkMode && supportsUserInteraction) {
|
|
160895
161243
|
await registerLazy(ToolNames.ENTER_PLAN_MODE, async () => {
|
|
160896
|
-
const { EnterPlanModeTool } = await import("./enterPlanMode-
|
|
161244
|
+
const { EnterPlanModeTool } = await import("./enterPlanMode-GDZVXYB2.js");
|
|
160897
161245
|
return new EnterPlanModeTool(this);
|
|
160898
161246
|
});
|
|
160899
161247
|
}
|
|
160900
161248
|
await registerLazy(ToolNames.ENTER_WORKTREE, async () => {
|
|
160901
|
-
const { EnterWorktreeTool } = await import("./enter-worktree-
|
|
161249
|
+
const { EnterWorktreeTool } = await import("./enter-worktree-55OWD4LT.js");
|
|
160902
161250
|
return new EnterWorktreeTool(this);
|
|
160903
161251
|
});
|
|
160904
161252
|
await registerLazy(ToolNames.EXIT_WORKTREE, async () => {
|
|
160905
|
-
const { ExitWorktreeTool } = await import("./exit-worktree-
|
|
161253
|
+
const { ExitWorktreeTool } = await import("./exit-worktree-MI6N4OUP.js");
|
|
160906
161254
|
return new ExitWorktreeTool(this);
|
|
160907
161255
|
});
|
|
160908
161256
|
if (resolveInteractionMode(this) === "interactive" && !this.sdkMode && !this.getScreenReader() && !options2?.forSubAgent) {
|
|
@@ -160923,7 +161271,7 @@ var Config = class _Config {
|
|
|
160923
161271
|
}
|
|
160924
161272
|
if (this.isRecordArtifactEnabled()) {
|
|
160925
161273
|
await registerLazy(ToolNames.RECORD_ARTIFACT, async () => {
|
|
160926
|
-
const { RecordArtifactTool } = await import("./record-artifact-
|
|
161274
|
+
const { RecordArtifactTool } = await import("./record-artifact-XP3X7RE5.js");
|
|
160927
161275
|
return new RecordArtifactTool(this);
|
|
160928
161276
|
});
|
|
160929
161277
|
}
|
|
@@ -160960,7 +161308,7 @@ var Config = class _Config {
|
|
|
160960
161308
|
}
|
|
160961
161309
|
if (this.isAgentTeamEnabled()) {
|
|
160962
161310
|
await registerLazy(ToolNames.TEAM_CREATE, async () => {
|
|
160963
|
-
const { TeamCreateTool } = await import("./team-create-
|
|
161311
|
+
const { TeamCreateTool } = await import("./team-create-TPCELNBJ.js");
|
|
160964
161312
|
return new TeamCreateTool(this);
|
|
160965
161313
|
});
|
|
160966
161314
|
await registerLazy(ToolNames.TEAM_DELETE, async () => {
|
|
@@ -160968,21 +161316,21 @@ var Config = class _Config {
|
|
|
160968
161316
|
return new TeamDeleteTool(this);
|
|
160969
161317
|
});
|
|
160970
161318
|
await registerLazy(ToolNames.TEAM_PLAN_APPROVAL, async () => {
|
|
160971
|
-
const { TeamPlanApprovalTool } = await import("./team-plan-approval-
|
|
161319
|
+
const { TeamPlanApprovalTool } = await import("./team-plan-approval-RUURGHQL.js");
|
|
160972
161320
|
return new TeamPlanApprovalTool(this);
|
|
160973
161321
|
});
|
|
160974
161322
|
if (!options2?.forSubAgent) {
|
|
160975
161323
|
await registerLazy(ToolNames.REQUEST_SHUTDOWN, async () => {
|
|
160976
|
-
const { RequestShutdownTool } = await import("./request-shutdown-
|
|
161324
|
+
const { RequestShutdownTool } = await import("./request-shutdown-R5SA5GE3.js");
|
|
160977
161325
|
return new RequestShutdownTool(this);
|
|
160978
161326
|
});
|
|
160979
161327
|
}
|
|
160980
161328
|
await registerLazy(ToolNames.TASK_CREATE, async () => {
|
|
160981
|
-
const { TaskCreateTool } = await import("./task-create-
|
|
161329
|
+
const { TaskCreateTool } = await import("./task-create-PVF66J3R.js");
|
|
160982
161330
|
return new TaskCreateTool(this);
|
|
160983
161331
|
});
|
|
160984
161332
|
await registerLazy(ToolNames.TASK_UPDATE, async () => {
|
|
160985
|
-
const { TaskUpdateTool } = await import("./task-update-
|
|
161333
|
+
const { TaskUpdateTool } = await import("./task-update-RSIITTOK.js");
|
|
160986
161334
|
return new TaskUpdateTool(this);
|
|
160987
161335
|
});
|
|
160988
161336
|
await registerLazy(ToolNames.TASK_LIST, async () => {
|
|
@@ -161064,7 +161412,7 @@ var Config = class _Config {
|
|
|
161064
161412
|
}
|
|
161065
161413
|
}
|
|
161066
161414
|
await registerLazy(ToolNames.MONITOR, async () => {
|
|
161067
|
-
const { MonitorTool } = await import("./monitor-
|
|
161415
|
+
const { MonitorTool } = await import("./monitor-7JUZXYZN.js");
|
|
161068
161416
|
return new MonitorTool(this);
|
|
161069
161417
|
});
|
|
161070
161418
|
if (this.pendingMcpBudgetCallback) {
|
|
@@ -161789,6 +162137,21 @@ export {
|
|
|
161789
162137
|
loadUsageHistoryWithLive,
|
|
161790
162138
|
getTimeRangeBounds,
|
|
161791
162139
|
aggregateUsage,
|
|
162140
|
+
isValidRefName,
|
|
162141
|
+
resolveBranchName,
|
|
162142
|
+
watchRepoBranch,
|
|
162143
|
+
gitEnv,
|
|
162144
|
+
streamGitRecords,
|
|
162145
|
+
runGitCapture,
|
|
162146
|
+
runGit,
|
|
162147
|
+
fetchGitBranches,
|
|
162148
|
+
isValidCheckoutRef,
|
|
162149
|
+
gitCheckout,
|
|
162150
|
+
gitCreateBranch,
|
|
162151
|
+
gitPush,
|
|
162152
|
+
GitPullFailure,
|
|
162153
|
+
gitPull,
|
|
162154
|
+
gitCommit,
|
|
161792
162155
|
MAX_FILES,
|
|
161793
162156
|
MAX_DIFF_SIZE_BYTES,
|
|
161794
162157
|
MAX_LINES_PER_FILE,
|
|
@@ -161811,19 +162174,6 @@ export {
|
|
|
161811
162174
|
GROUP_COLOR_OPTIONS,
|
|
161812
162175
|
SessionOrganizationError,
|
|
161813
162176
|
SessionOrganizationService,
|
|
161814
|
-
isValidRefName,
|
|
161815
|
-
resolveBranchName,
|
|
161816
|
-
watchRepoBranch,
|
|
161817
|
-
gitEnv,
|
|
161818
|
-
runGit2 as runGit,
|
|
161819
|
-
fetchGitBranches,
|
|
161820
|
-
isValidCheckoutRef,
|
|
161821
|
-
gitCheckout,
|
|
161822
|
-
gitCreateBranch,
|
|
161823
|
-
gitPush,
|
|
161824
|
-
GitPullFailure,
|
|
161825
|
-
gitPull,
|
|
161826
|
-
gitCommit,
|
|
161827
162177
|
GITHUB_PR_ERROR_MESSAGE_MAX,
|
|
161828
162178
|
fetchGitHubPullRequests,
|
|
161829
162179
|
createGitHubPullRequest,
|
|
@@ -161856,6 +162206,8 @@ export {
|
|
|
161856
162206
|
SessionTranscriptPageTooLargeError,
|
|
161857
162207
|
SessionTranscriptCursorCodec,
|
|
161858
162208
|
encodeSessionTranscriptCursor,
|
|
162209
|
+
navigationKindForRecord,
|
|
162210
|
+
isReplayTurnStartType,
|
|
161859
162211
|
SessionTranscriptReader,
|
|
161860
162212
|
SessionWriterError,
|
|
161861
162213
|
SESSION_WRITER_RPC_CODES,
|