@organizaone/o1-code 0.23.6 → 0.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- package/bundled/qc-helper/docs/configuration/settings.md +17 -9
- package/bundled/qc-helper/docs/support/tos-privacy.md +46 -9
- package/chunks/{MaxSizedBox-5A6YVHNU.js → MaxSizedBox-NW262WFI.js} +19 -20
- package/chunks/{StandaloneSessionPicker-PJ7OY7NU.js → StandaloneSessionPicker-BOHECLEP.js} +35 -36
- package/chunks/{acp-subagent-executor-2ZPRNNEN.js → acp-subagent-executor-2OUSOGPA.js} +22 -23
- package/chunks/{acpAgent-ROSUR5V5.js → acpAgent-R34ZNNS6.js} +63 -64
- package/chunks/{agent-MQPQSPI3.js → agent-SNMW6ERQ.js} +9 -10
- package/chunks/{agent-headless-O5TVVFJH.js → agent-headless-UEFKIYQS.js} +9 -10
- package/chunks/{all-providers-KR7IGRXW.js → all-providers-OYDP36LL.js} +2 -2
- package/chunks/{anthropicContentGenerator-GH5RSH2R.js → anthropicContentGenerator-WU44URNX.js} +4 -4
- package/chunks/{bridge-NWKP65DQ.js → bridge-UYNHUFJI.js} +22 -23
- package/chunks/{ca-RHSADBKV.js → ca-KPICWCC2.js} +1 -0
- package/chunks/{chunk-FTNIX7MV.js → chunk-2CJBQ4YG.js} +3 -3
- package/chunks/{chunk-RDB6TCBX.js → chunk-2GNBSOP4.js} +1 -1
- package/chunks/{chunk-ETYF6LYZ.js → chunk-2UCDNTD2.js} +1 -1
- package/chunks/{chunk-6WAQ7FHW.js → chunk-2YIQBT2C.js} +8 -8
- package/chunks/{chunk-BIZ2BU2R.js → chunk-34Z26OAQ.js} +1 -1
- package/chunks/{chunk-IGMGIUFK.js → chunk-36IJSJE2.js} +1 -1
- package/chunks/{chunk-HTVAOY4O.js → chunk-3DM3J46X.js} +2 -2
- package/chunks/{chunk-J6WYDHKN.js → chunk-3EDYFAU4.js} +3 -3
- package/chunks/{chunk-ID3UO626.js → chunk-3IYGC56V.js} +3 -3
- package/chunks/{chunk-BZYI5TLI.js → chunk-3QVQBDHI.js} +765 -104
- package/chunks/{chunk-G2F7N4LU.js → chunk-3WWUP2NW.js} +1 -1
- package/chunks/{chunk-2DEMKCA3.js → chunk-44NOS72H.js} +9 -9
- package/chunks/{chunk-IBU44H7B.js → chunk-4JL4O3E5.js} +3 -3
- package/chunks/{chunk-WWQPZYX5.js → chunk-5LEPITKL.js} +1 -1
- package/chunks/{chunk-CMOGRWCB.js → chunk-5R2TUBJU.js} +3 -3
- package/chunks/{chunk-LJDZX4VQ.js → chunk-63BOUM6Z.js} +5 -5
- package/chunks/{chunk-JTC5IEN7.js → chunk-64CIVB5J.js} +4 -4
- package/chunks/{chunk-KJHPBYQF.js → chunk-66AMVKR6.js} +12 -3
- package/chunks/{chunk-GRAOOEUB.js → chunk-6JVEPDU3.js} +31 -31
- package/chunks/{chunk-X3QJWMUS.js → chunk-6LMQD7ZE.js} +32 -31
- package/chunks/{chunk-6CNJPPFQ.js → chunk-6PEK3OUO.js} +2 -2
- package/chunks/{chunk-3OPD6SKW.js → chunk-7TZUSRNH.js} +1 -1
- package/chunks/{chunk-TASQRFKT.js → chunk-7ZTPEKFK.js} +1 -1
- package/chunks/{chunk-YGXPIUEI.js → chunk-AQDRP2A7.js} +2 -2
- package/chunks/{chunk-LLFQZCAH.js → chunk-ARHICYDP.js} +2 -2
- package/chunks/{chunk-WI6QV2NN.js → chunk-BDOUB4E3.js} +1 -1
- package/chunks/{chunk-RZPP3VY2.js → chunk-BEGEBCMX.js} +2 -2
- package/chunks/{chunk-A23F5S2K.js → chunk-C2YN37HW.js} +3 -3
- package/chunks/{chunk-QP6RBTM4.js → chunk-CHNSFIEU.js} +5 -5
- package/chunks/{chunk-QPGYYXO7.js → chunk-CJNSFVIZ.js} +1 -1
- package/chunks/{chunk-EVA537RP.js → chunk-DAPZIEPC.js} +34 -19
- package/chunks/{chunk-WBTYXDPX.js → chunk-EENXLL76.js} +5 -5
- package/chunks/{chunk-QMGEY2UY.js → chunk-EJW2UKS5.js} +2 -2
- package/chunks/{chunk-JMPUWQD3.js → chunk-ELP6GWFS.js} +7 -7
- package/chunks/{chunk-5ACLXRPB.js → chunk-EQHHF6S6.js} +1 -1
- package/chunks/{chunk-IEQ6NPJE.js → chunk-EQKGACYA.js} +1 -1
- package/chunks/{chunk-7FLIIJZS.js → chunk-EU6EPX73.js} +1 -1
- package/chunks/{chunk-CT7CAQHP.js → chunk-FKRAMAQF.js} +3 -3
- package/chunks/{chunk-QQXXDTSU.js → chunk-FMZNCMYH.js} +1 -1
- package/chunks/{chunk-QGIH3XTQ.js → chunk-FNNSDOOR.js} +1 -1
- package/chunks/{chunk-FKZLKS2Y.js → chunk-FNO7JO44.js} +6 -6
- package/chunks/{chunk-M52KEKEQ.js → chunk-GB3X2SWN.js} +3 -3
- package/chunks/{chunk-3MKWVUHT.js → chunk-GE7ZIINK.js} +1 -1
- package/chunks/{chunk-JWNNGKHN.js → chunk-GGHW4H75.js} +4 -4
- package/chunks/{chunk-D54VYWTE.js → chunk-GR257V6A.js} +1 -1
- package/chunks/{chunk-LPL2HPIA.js → chunk-HFP2JZHJ.js} +8 -8
- package/chunks/{chunk-EW22CPY6.js → chunk-HNM45NML.js} +2 -2
- package/chunks/{chunk-TARYKOVC.js → chunk-JL5EW2PU.js} +2 -2
- package/chunks/{chunk-UCONY426.js → chunk-JVBAE6OK.js} +5 -5
- package/chunks/{chunk-WORJQQZV.js → chunk-JZT4J3NV.js} +7 -7
- package/chunks/{chunk-PZ5JMLBW.js → chunk-K7C6CBTQ.js} +1 -1
- package/chunks/{chunk-OEIADC4I.js → chunk-KL5F53MI.js} +1 -1
- package/chunks/{chunk-A2C6XF4K.js → chunk-L3GVNOEE.js} +2 -2
- package/chunks/{chunk-PK6INTPC.js → chunk-L5FX6L3R.js} +1 -1
- package/chunks/{chunk-LXZAJXKF.js → chunk-LFC5TDYS.js} +9 -9
- package/chunks/{chunk-ZIWHK3AH.js → chunk-LPO2VYWD.js} +1 -1
- package/chunks/{chunk-35E4S7ST.js → chunk-LWXN3Q3G.js} +1 -1
- package/chunks/{chunk-UPBQTOA2.js → chunk-MEWLOSNA.js} +1 -1
- package/chunks/{chunk-H44SDTNA.js → chunk-OF7YPDIT.js} +1 -1
- package/chunks/{chunk-RUXCXLXJ.js → chunk-OFSATB6H.js} +3 -3
- package/chunks/{chunk-HFYL2VZG.js → chunk-ON5CGP6B.js} +1 -1
- package/chunks/{chunk-KCZRUX5N.js → chunk-OU5J6GPI.js} +1 -1
- package/chunks/{chunk-4MIZQ3C4.js → chunk-PVANGQVK.js} +4 -4
- package/chunks/{chunk-YYBOCLG4.js → chunk-QIUKEACF.js} +19 -8
- package/chunks/{chunk-UMXXMSBY.js → chunk-QJLOQHNR.js} +1 -1
- package/chunks/{chunk-LH7D54QG.js → chunk-QXMLP3XZ.js} +4 -4
- package/chunks/{chunk-W5ZH4ECA.js → chunk-RWENGGG4.js} +4 -4
- package/chunks/{chunk-AR2D2LDB.js → chunk-S7CKMFYO.js} +3 -3
- package/chunks/{chunk-27ZPT247.js → chunk-SVCTCXHN.js} +1 -1
- package/chunks/{chunk-BEANXNLH.js → chunk-SZM235C4.js} +6 -6
- package/chunks/{chunk-PVY6INBW.js → chunk-TEMHFHQV.js} +3 -3
- package/chunks/{chunk-ZRXKKB63.js → chunk-TRO6XIDF.js} +3 -3
- package/chunks/{chunk-LUCOEEAB.js → chunk-TVL24FJB.js} +8 -8
- package/chunks/{chunk-UBMMODJB.js → chunk-TXP5BHCF.js} +2 -2
- package/chunks/{chunk-J5HQL7OD.js → chunk-ULLCJNT5.js} +1 -1
- package/chunks/{chunk-XXQ2DA7F.js → chunk-USYQVZYJ.js} +2 -2
- package/chunks/{chunk-DGLZ7R67.js → chunk-V4SPTFEG.js} +3 -3
- package/chunks/{chunk-O63DUL4M.js → chunk-VDVSVZWL.js} +1 -1
- package/chunks/{chunk-NAHGNNZB.js → chunk-VEVQ3KOQ.js} +15 -15
- package/chunks/{chunk-3FDAQK6P.js → chunk-VFRSPZOW.js} +1 -1
- package/chunks/{chunk-EFK6RU3T.js → chunk-VIPQLTDR.js} +10 -10
- package/chunks/{chunk-5C43GL67.js → chunk-VN5T2QYU.js} +1 -1
- package/chunks/{chunk-AE4IQ5HU.js → chunk-VQCUTIBI.js} +1 -1
- package/chunks/{chunk-4AJKZMFN.js → chunk-VTNFDCQ7.js} +3 -3
- package/chunks/{chunk-57ZQZ7JI.js → chunk-VZOQANTZ.js} +54 -49
- package/chunks/{chunk-WRUO75DK.js → chunk-WCXEBLWO.js} +3 -3
- package/chunks/{chunk-RARNV4EH.js → chunk-WORPBFTT.js} +4 -4
- package/chunks/{chunk-LALBZLWX.js → chunk-WQEJFN6F.js} +3 -3
- package/chunks/{chunk-YFOXEHTY.js → chunk-XAZYQDOU.js} +4 -4
- package/chunks/{chunk-JPVHQJJL.js → chunk-XJJ4HAJ3.js} +2 -2
- package/chunks/{chunk-4LBEZCUL.js → chunk-Y4H5A6N7.js} +2 -2
- package/chunks/{chunk-TSXPF6BH.js → chunk-Z4RNAWAT.js} +2 -2
- package/chunks/{codex-subagent-executor-OOB7YKI7.js → codex-subagent-executor-N7XUDMMR.js} +22 -23
- package/chunks/{contextCommand-AUXKVKG3.js → contextCommand-3UGTHGWI.js} +21 -22
- package/chunks/{core-runtime-DXCLVHP7.js → core-runtime-2XWWOJBK.js} +19 -20
- package/chunks/{create-sub-session-7WGLBJIN.js → create-sub-session-7A3XG4EB.js} +20 -21
- package/chunks/{daemon-git-worktree-guard-PQJHEHBQ.js → daemon-git-worktree-guard-6R5CAJML.js} +19 -20
- package/chunks/{daemon-status-provider-QMJM7BR5.js → daemon-status-provider-LTXP4ZPC.js} +27 -28
- package/chunks/{daemon-trust-policy-5EX7GV5Z.js → daemon-trust-policy-BUHLBXK5.js} +25 -26
- package/chunks/{daemon-trust-policy-monitor-JEF7HPYA.js → daemon-trust-policy-monitor-FDMNA7XP.js} +25 -26
- package/chunks/{de-SJHLEQC4.js → de-XOVGUB4E.js} +1 -0
- package/chunks/{deferred-core-runtime-IZN37DMY.js → deferred-core-runtime-ESODQ2KQ.js} +19 -20
- package/chunks/{edit-LVDJRLUV.js → edit-XYJP2KNH.js} +11 -12
- package/chunks/{en-QZTJJ53G.js → en-ZRJL6ZFP.js} +12 -0
- package/chunks/{enterPlanMode-XVSKZDGB.js → enterPlanMode-4CRUU346.js} +9 -10
- package/chunks/{environment-C4MVG2DW.js → environment-OP72OBEN.js} +21 -22
- package/chunks/{errors-QTLX62VA.js → errors-O5NZTPS7.js} +21 -22
- package/chunks/{execution-tool-BHO5C2VQ.js → execution-tool-UOEMZ4JH.js} +11 -12
- package/chunks/{execution-worker-NMOR3MNG.js → execution-worker-AVMMC3VO.js} +14 -15
- package/chunks/{exitPlanMode-7MHEUFDV.js → exitPlanMode-674TFQOK.js} +9 -10
- package/chunks/{fast-path-VT2OPWKI.js → fast-path-BCYZT2KL.js} +2 -2
- package/chunks/{foreground-runner-K2QWPCZE.js → foreground-runner-HN72IMP6.js} +21 -22
- package/chunks/{fr-AKEMVHLD.js → fr-5BYN3TTH.js} +1 -0
- package/chunks/{gateway-models-OIKGYG7E.js → gateway-models-TJBRDGHL.js} +3 -3
- package/chunks/{glob-G255OEF6.js → glob-KG235VRI.js} +9 -10
- package/chunks/{goal-tools-RL5CWTHU.js → goal-tools-6IDXMQKW.js} +9 -10
- package/chunks/{handleAutoUpdate-SDFQDGCZ.js → handleAutoUpdate-AV4Q3YRO.js} +22 -23
- package/chunks/{i18n-5B7KH5SJ.js → i18n-RHYMG7VN.js} +20 -21
- package/chunks/{initializer-6MIEFQRW.js → initializer-KCHB7PDB.js} +25 -26
- package/chunks/{installationInfo-ODECMI3W.js → installationInfo-7N3QG56L.js} +19 -20
- package/chunks/{ja-P2B6FRH4.js → ja-YPJM4227.js} +1 -0
- package/chunks/{list-6ZK5SEMU.js → list-4PQFRRXT.js} +27 -28
- package/chunks/{llm-IFIIWNTL.js → llm-Q2LRDZO4.js} +58 -52
- package/chunks/{llm-content-generator-XNQGMFYV.js → llm-content-generator-YCIEYW2F.js} +5 -18
- package/chunks/{loadedSettingsAdapter-KJMHK55W.js → loadedSettingsAdapter-DQM3AZQR.js} +25 -26
- package/chunks/{local-execution-environment-GDPNG5NI.js → local-execution-environment-SIUMWD5D.js} +14 -15
- package/chunks/{loggingContentGenerator-7XAJ2A4G.js → loggingContentGenerator-HC7VOMHJ.js} +10 -11
- package/chunks/{managed-npm-update-D4JUQCQE.js → managed-npm-update-QCKGNRCE.js} +19 -20
- package/chunks/{mcp-TO2VWBD7.js → mcp-YGWHYFFO.js} +25 -26
- package/chunks/{model-call-collection-6PFJENXQ.js → model-call-collection-KBA6G3V6.js} +1 -1
- package/chunks/{model-configuration-ZJ6DE3FV.js → model-configuration-KIMDI7TW.js} +26 -27
- package/chunks/{modelConfigUtils-2LB4IWYJ.js → modelConfigUtils-UZEDX3FT.js} +21 -22
- package/chunks/{monitor-TJMX2NLL.js → monitor-ASQYO4GM.js} +9 -10
- package/chunks/{nonInteractiveCli-NLCACNXO.js → nonInteractiveCli-MF2FIH2O.js} +54 -55
- package/chunks/{nonInteractiveToolExecutor-2XCCGQVD.js → nonInteractiveToolExecutor-NDCIOIYA.js} +10 -11
- package/chunks/{notebook-edit-22CCHEKF.js → notebook-edit-NTZXXCOL.js} +10 -11
- package/chunks/{omni-GHWWZCTK.js → omni-UQEXZ4BK.js} +8 -8
- package/chunks/{openaiContentGenerator-4KZJGLHL.js → openaiContentGenerator-MCJFRRRD.js} +6 -7
- package/chunks/{openaiResponsesContentGenerator-XMSIHEXH.js → openaiResponsesContentGenerator-WH65SYNI.js} +3 -3
- package/chunks/{processUtils-G5XIHIEB.js → processUtils-LZ6A4WQW.js} +2 -2
- package/chunks/{prompt-terminal-ledger-EDQLBIDN.js → prompt-terminal-ledger-EICIC7RD.js} +20 -21
- package/chunks/{pt-KE77XTFU.js → pt-2EWDZAFN.js} +14 -1
- package/chunks/{reactive-degrade-GN7KK6DW.js → reactive-degrade-3VSDADKG.js} +7 -7
- package/chunks/{read-file-A4CXZWYH.js → read-file-SQ22CUV3.js} +2 -3
- package/chunks/{resumeHistoryUtils-DKTXJYOA.js → resumeHistoryUtils-UBYP65XN.js} +23 -24
- package/chunks/{ripGrep-D4DC66BW.js → ripGrep-BGA3IHCY.js} +3 -4
- package/chunks/{ru-MA3PS5E7.js → ru-5OPL2N6C.js} +1 -0
- package/chunks/{run-o1-code-serve-AEXABP6Z.js → run-o1-code-serve-F2VC5WU5.js} +32 -32
- package/chunks/{sandboxConfig-4LDHTJCR.js → sandboxConfig-LQ3GNTI3.js} +19 -20
- package/chunks/{scheduled-tasks-RBG6SOSD.js → scheduled-tasks-G3IFPCBU.js} +25 -26
- package/chunks/{scheduler-COH4ACGI.js → scheduler-SGFONO5S.js} +21 -22
- package/chunks/{serve-2BXYKN3V.js → serve-FTRLUIUN.js} +25 -26
- package/chunks/{server-WTXMKEIU.js → server-BZZH5CGH.js} +55 -56
- package/chunks/{session-H6WQHUHM.js → session-6H5CXEX7.js} +1 -1
- package/chunks/{session-MWHR5RKX.js → session-UI2PNFG3.js} +55 -56
- package/chunks/{session-attachments-root-N5USBADP.js → session-attachments-root-452F3VSU.js} +19 -20
- package/chunks/{session-pr-refresh-OUHCMC7D.js → session-pr-refresh-FXPK57QE.js} +24 -25
- package/chunks/{settings-3HZFXPLI.js → settings-4WK2SUTD.js} +24 -25
- package/chunks/{shell-EVILFWQQ.js → shell-XSXZX45R.js} +9 -10
- package/chunks/{skill-J2KGAN2V.js → skill-E7EQ7OCS.js} +3 -4
- package/chunks/{skill-settings-ACT6L5LV.js → skill-settings-PVGNKXS4.js} +25 -26
- package/chunks/{spawnChannel-X3THBSPW.js → spawnChannel-7PTECX7U.js} +21 -22
- package/chunks/{standalone-update-6QFNZ25N.js → standalone-update-XKIDAQJP.js} +21 -22
- package/chunks/{startInteractiveUI-FSE44WKV.js → startInteractiveUI-GDH6ENTN.js} +225 -163
- package/chunks/{supervisor-runner-2HPHLD33.js → supervisor-runner-3VG6JYOQ.js} +2 -2
- package/chunks/{team-create-BMDCZ6ON.js → team-create-2KXZ6OAD.js} +9 -10
- package/chunks/{team-plan-approval-CM7KG4VK.js → team-plan-approval-R4IUE6MT.js} +9 -10
- package/chunks/{terminal-image-renderer-FCOPZR55.js → terminal-image-renderer-RVGZDQ7O.js} +19 -20
- package/chunks/{theme-manager-FGCT4MJ4.js → theme-manager-MM2LI23D.js} +19 -20
- package/chunks/{tool-result-media-6ALUQCCK.js → tool-result-media-QQZVNJYE.js} +8 -8
- package/chunks/{tool-search-PI7BCUFL.js → tool-search-WSYXEHPX.js} +2 -3
- package/chunks/{total-session-admission-H4D6P5V3.js → total-session-admission-UWISNN3E.js} +22 -23
- package/chunks/{trustedFolders-IHXTSUQS.js → trustedFolders-IQF6LGEC.js} +20 -21
- package/chunks/{update-relaunch-Y6AUJ76M.js → update-relaunch-BQF3QA55.js} +5 -5
- package/chunks/{updateCheck-UYWXFZ2F.js → updateCheck-2HZGFVB2.js} +21 -22
- package/chunks/{upload-config-HGV6EP3I.js → upload-config-6WCS4KWI.js} +5 -5
- package/chunks/{useAutoAcceptIndicator-3UC36KZX.js → useAutoAcceptIndicator-RMS6JD7Q.js} +27 -28
- package/chunks/{validateNonInterActiveAuth-2GPESD6I.js → validateNonInterActiveAuth-BJGQQMTP.js} +51 -52
- package/chunks/{version-7P2HKCWW.js → version-OFS2KGHG.js} +1 -1
- package/chunks/{web-fetch-6JT5AFZC.js → web-fetch-DXHJIPFR.js} +2 -3
- package/chunks/{web-search-GIJKSYEU.js → web-search-2CZKPAEO.js} +5 -5
- package/chunks/{workflow-52ZDOZ2U.js → workflow-SWL56JZ7.js} +10 -11
- package/chunks/{workspace-providers-status-2YEJMZUJ.js → workspace-providers-status-W3NF7BSW.js} +31 -32
- package/chunks/{workspace-registration-store-IBPUQZDV.js → workspace-registration-store-2LKHCWUR.js} +1 -1
- package/chunks/{workspace-registry-DMVT27FO.js → workspace-registry-4BQ3HJ7V.js} +22 -23
- package/chunks/{workspace-runtime-coordinator-5MDFGBZH.js → workspace-runtime-coordinator-EGYPCB7P.js} +23 -24
- package/chunks/{workspace-service-7O3JOAVE.js → workspace-service-YSXEDPRL.js} +29 -30
- package/chunks/{workspace-skills-status-HEVD2N4F.js → workspace-skills-status-JE6VIEKK.js} +28 -29
- package/chunks/{workspace-trust-reconciler-DGRT7GIX.js → workspace-trust-reconciler-I36XWEA3.js} +28 -29
- package/chunks/{write-file-CTQPOA7R.js → write-file-AY2MQ57Y.js} +11 -12
- package/chunks/{zh-IAQUI2JQ.js → zh-JJGCFWTL.js} +1 -0
- package/chunks/{zh-TW-OJB2TVMP.js → zh-TW-7LWX7CCJ.js} +1 -0
- package/chunks/{zoom-image-OAEB4KD7.js → zoom-image-YCUUFF5K.js} +2 -3
- package/cli.js +15 -15
- package/execution-worker.js +1 -1
- package/export-transcript-document.js +1 -1
- package/locales/ca.js +1 -0
- package/locales/de.js +1 -0
- package/locales/en.js +18 -0
- package/locales/fr.js +1 -0
- package/locales/ja.js +1 -0
- package/locales/pt.js +22 -2
- package/locales/ru.js +1 -0
- package/locales/zh-TW.js +1 -0
- package/locales/zh.js +1 -0
- package/package.json +2 -2
- package/release-notes.json +13 -0
- package/vendor/o1-connect/.lintstagedrc.mjs +7 -0
- package/vendor/tree-sitter/tree-sitter-bash.wasm +0 -0
- package/vendor/tree-sitter/tree-sitter.wasm +0 -0
- package/web-shell/assets/{abnfDiagram-VCTEODGH-DX-WMq-5.js → abnfDiagram-VCTEODGH-DJqfEsci.js} +1 -1
- package/web-shell/assets/{arc-BTsycUPV.js → arc-DwKtjY60.js} +1 -1
- package/web-shell/assets/{architectureDiagram-5GKGNRK7-DDSm7j8E.js → architectureDiagram-5GKGNRK7-VM02_lKX.js} +1 -1
- package/web-shell/assets/{blockDiagram-NRAW4CY4-D6tFEZam.js → blockDiagram-NRAW4CY4-DHHAUVDx.js} +1 -1
- package/web-shell/assets/{c4Diagram-UCG6FXSJ-Bjy_QWLJ.js → c4Diagram-UCG6FXSJ-DoICQl3v.js} +1 -1
- package/web-shell/assets/channel-9IZtxCcP.js +1 -0
- package/web-shell/assets/{chunk-2Q5K7J3B-Cisyo9Dc.js → chunk-2Q5K7J3B-CCX9-GRY.js} +1 -1
- package/web-shell/assets/{chunk-5VM5RSS4-C0U4YghO.js → chunk-5VM5RSS4-DGzp5GbB.js} +1 -1
- package/web-shell/assets/{chunk-F27PBJKO-ChrcfQnU.js → chunk-F27PBJKO-BkIltNHV.js} +1 -1
- package/web-shell/assets/{chunk-G27WJ6UU-C6Xt2Op6.js → chunk-G27WJ6UU-6qfbGGi_.js} +1 -1
- package/web-shell/assets/{chunk-JWPE2WC7-__BIxbxL.js → chunk-JWPE2WC7-h2kgmECK.js} +1 -1
- package/web-shell/assets/{chunk-LCL6LL3I-BGm7osZW.js → chunk-LCL6LL3I-Bts05Qgz.js} +1 -1
- package/web-shell/assets/{chunk-POPQ4Y6H-DdFsl1Dw.js → chunk-POPQ4Y6H-CiW-js_k.js} +1 -1
- package/web-shell/assets/{chunk-SVP7TREG-BsMEsSe2.js → chunk-SVP7TREG-C-nBC0m1.js} +1 -1
- package/web-shell/assets/{chunk-XXDRQBXY-CL91xHLm.js → chunk-XXDRQBXY-B6dbvzNn.js} +1 -1
- package/web-shell/assets/classDiagram-DTDB5LWJ-C2d-V-B1.js +1 -0
- package/web-shell/assets/classDiagram-v2-JRS7N3AN-C2d-V-B1.js +1 -0
- package/web-shell/assets/{cose-bilkent-JH36ORCC-CCkiL4oo.js → cose-bilkent-JH36ORCC-CaNFLz_b.js} +1 -1
- package/web-shell/assets/{cynefin-OW5HDTMX-CSUZ1mkI.js → cynefin-OW5HDTMX-CfvtnSJ8.js} +1 -1
- package/web-shell/assets/{cynefinDiagram-5FMLGOSQ-BWX97QVr.js → cynefinDiagram-5FMLGOSQ-EyJXaNiT.js} +1 -1
- package/web-shell/assets/{dagre-3AP2YEHR-BqGHe5Nd.js → dagre-3AP2YEHR-Dfqppraz.js} +1 -1
- package/web-shell/assets/{diagram-S7CK7UJ4-BiJnzVoi.js → diagram-S7CK7UJ4-CoFgSAcK.js} +1 -1
- package/web-shell/assets/{diagram-UQ7AKVKN-pEu46e8x.js → diagram-UQ7AKVKN-CPkM_U3C.js} +1 -1
- package/web-shell/assets/{diagram-VSXAHHWV-7OpCXsso.js → diagram-VSXAHHWV-CxUsPmcQ.js} +1 -1
- package/web-shell/assets/{diagram-VX7I27RA-C2tOGWNB.js → diagram-VX7I27RA-CJ4xqC11.js} +1 -1
- package/web-shell/assets/{diagram-Z3DM3KII-CajemOIp.js → diagram-Z3DM3KII-BbpVhyGE.js} +1 -1
- package/web-shell/assets/{ebnfDiagram-PWID7BFC-BS_0Vcuk.js → ebnfDiagram-PWID7BFC-0g_6zZa6.js} +1 -1
- package/web-shell/assets/{erDiagram-SSCWMZ5O-DTl51hCc.js → erDiagram-SSCWMZ5O-CctfGwzh.js} +1 -1
- package/web-shell/assets/{flowDiagram-A5DVABFB-DEGnc-gk.js → flowDiagram-A5DVABFB-D52Yh-kY.js} +1 -1
- package/web-shell/assets/{ganttDiagram-EL5Y4UJY-CRRQ7NXM.js → ganttDiagram-EL5Y4UJY--V15ib0A.js} +1 -1
- package/web-shell/assets/{gitGraphDiagram-WWUBYQGX-Cuz0yxgq.js → gitGraphDiagram-WWUBYQGX-D4Ah0ltR.js} +1 -1
- package/web-shell/assets/{index-CabBtppt.js → index-BG19yWJ0.js} +1 -1
- package/web-shell/assets/{index-CwSc_wHq.js → index-DSDcyyHv.js} +3 -3
- package/web-shell/assets/{infoDiagram-RXCK75RN-__m4BRLE.js → infoDiagram-RXCK75RN-CxgOq49b.js} +1 -1
- package/web-shell/assets/{ishikawaDiagram-5VMMS53U-D9-giwSc.js → ishikawaDiagram-5VMMS53U-BZDGTKew.js} +1 -1
- package/web-shell/assets/{journeyDiagram-EYS64GPL-D6wcRzSR.js → journeyDiagram-EYS64GPL-DLJR_58Z.js} +1 -1
- package/web-shell/assets/{kanban-definition-3QL26DDD-C5U3RnTE.js → kanban-definition-3QL26DDD-C0F5MJ5k.js} +1 -1
- package/web-shell/assets/{layout-WWFI0sC8.js → layout-C5P3DPCU.js} +1 -1
- package/web-shell/assets/{linear-Chfo4D6Z.js → linear-NQ7gpy58.js} +1 -1
- package/web-shell/assets/{mermaid.core-B-VksWPM.js → mermaid.core-CRq5Hiko.js} +6 -6
- package/web-shell/assets/{mindmap-definition-FBJOCRG2-XM4KHyex.js → mindmap-definition-FBJOCRG2-CHxQjl37.js} +1 -1
- package/web-shell/assets/{pegDiagram-XKGWAZYB-BXt64I2s.js → pegDiagram-XKGWAZYB-CW_08JXd.js} +1 -1
- package/web-shell/assets/{pieDiagram-E7YTZNPT-BvfbAKpr.js → pieDiagram-E7YTZNPT-OPBIljdJ.js} +1 -1
- package/web-shell/assets/{quadrantDiagram-AXDQQJYC-DLB8Sxqr.js → quadrantDiagram-AXDQQJYC-DqqiukBo.js} +1 -1
- package/web-shell/assets/{railroadDiagram-O6MQD6OU-DwqZtLH2.js → railroadDiagram-O6MQD6OU-pCIab1na.js} +1 -1
- package/web-shell/assets/{requirementDiagram-EFPCY7ZU-D--ACyGX.js → requirementDiagram-EFPCY7ZU-W8-fLuK7.js} +1 -1
- package/web-shell/assets/{sankeyDiagram-P5KCCOFB-DvlrX2JB.js → sankeyDiagram-P5KCCOFB-Bwom-URo.js} +1 -1
- package/web-shell/assets/{sequenceDiagram-WJ2MYXX4-BRrJXThj.js → sequenceDiagram-WJ2MYXX4-Pk0GErkP.js} +1 -1
- package/web-shell/assets/{sizeCapture-X5ZJPWSS-BA-oi6RP.js → sizeCapture-X5ZJPWSS-CkowtnzF.js} +1 -1
- package/web-shell/assets/{stateDiagram-HBIQ2CUA-C1aCDG7D.js → stateDiagram-HBIQ2CUA-BEzw-aWX.js} +1 -1
- package/web-shell/assets/stateDiagram-v2-4QOOHH4V-C2Vexpwc.js +1 -0
- package/web-shell/assets/{swimlanes-XN3QIQJK-DnOwGDqw.js → swimlanes-XN3QIQJK-BkPUceuB.js} +1 -1
- package/web-shell/assets/swimlanesDiagram-VK2B7HYN-DOumBFMr.js +8 -0
- package/web-shell/assets/{timeline-definition-24CTP7MA-CBKIYQa1.js → timeline-definition-24CTP7MA-BZdCZ9lC.js} +1 -1
- package/web-shell/assets/{vennDiagram-4TSXK5OY-Dw-D7NXl.js → vennDiagram-4TSXK5OY-D3_JAiBx.js} +1 -1
- package/web-shell/assets/{wardleyDiagram-VM6X3IG4-BINiTZLS.js → wardleyDiagram-VM6X3IG4-BpruzF1j.js} +1 -1
- package/web-shell/assets/{xychartDiagram-S5SC5T6Z-BepJ-qL9.js → xychartDiagram-S5SC5T6Z-BIOPhU2U.js} +1 -1
- package/web-shell/index.html +1 -1
- package/web-shell/sw.js +1 -1
- package/chunks/chunk-HOPKSSYR.js +0 -78
- package/web-shell/assets/channel-DE7rYJuG.js +0 -1
- package/web-shell/assets/classDiagram-DTDB5LWJ-SxdhKxC5.js +0 -1
- package/web-shell/assets/classDiagram-v2-JRS7N3AN-SxdhKxC5.js +0 -1
- package/web-shell/assets/stateDiagram-v2-4QOOHH4V-CLW-6vrZ.js +0 -1
- package/web-shell/assets/swimlanesDiagram-VK2B7HYN-BElLo_er.js +0 -8
|
@@ -39,9 +39,6 @@ import {
|
|
|
39
39
|
generateLegacyMcpToolName,
|
|
40
40
|
normalizeToolNameForProvider
|
|
41
41
|
} from "./chunk-23AFREUQ.js";
|
|
42
|
-
import {
|
|
43
|
-
InstallationManager
|
|
44
|
-
} from "./chunk-HOPKSSYR.js";
|
|
45
42
|
import {
|
|
46
43
|
STRUCTURED_OUTPUT_REDACTED_ARGS
|
|
47
44
|
} from "./chunk-IMLPJ76O.js";
|
|
@@ -138,8 +135,13 @@ import {
|
|
|
138
135
|
defaultModalities
|
|
139
136
|
} from "./chunk-72EBG4FJ.js";
|
|
140
137
|
import {
|
|
141
|
-
atomicWriteFile
|
|
138
|
+
atomicWriteFile,
|
|
139
|
+
atomicWriteFileSync
|
|
142
140
|
} from "./chunk-EPJAMNLS.js";
|
|
141
|
+
import {
|
|
142
|
+
AuthType,
|
|
143
|
+
reachesOrganizaOne
|
|
144
|
+
} from "./chunk-VTIYMCRG.js";
|
|
143
145
|
import {
|
|
144
146
|
createDebugLogger
|
|
145
147
|
} from "./chunk-UK2KIU2V.js";
|
|
@@ -1704,8 +1706,8 @@ var require_lru_cache = __commonJS({
|
|
|
1704
1706
|
|
|
1705
1707
|
// packages/core/src/tools/read-file.ts
|
|
1706
1708
|
init_esbuild_shims();
|
|
1707
|
-
import
|
|
1708
|
-
import
|
|
1709
|
+
import path11 from "node:path";
|
|
1710
|
+
import fs8 from "node:fs/promises";
|
|
1709
1711
|
|
|
1710
1712
|
// packages/core/src/telemetry/telemetry-utils.ts
|
|
1711
1713
|
init_esbuild_shims();
|
|
@@ -1841,8 +1843,8 @@ __name(isInternalPromptId, "isInternalPromptId");
|
|
|
1841
1843
|
// packages/core/src/telemetry/o1-code-logger/o1-code-logger.ts
|
|
1842
1844
|
init_esbuild_shims();
|
|
1843
1845
|
import * as os from "node:os";
|
|
1844
|
-
import
|
|
1845
|
-
import
|
|
1846
|
+
import fs2 from "node:fs";
|
|
1847
|
+
import path3 from "node:path";
|
|
1846
1848
|
|
|
1847
1849
|
// packages/core/src/telemetry/sanitize.ts
|
|
1848
1850
|
init_esbuild_shims();
|
|
@@ -1867,6 +1869,58 @@ function sanitizeHookName(hookName) {
|
|
|
1867
1869
|
}
|
|
1868
1870
|
__name(sanitizeHookName, "sanitizeHookName");
|
|
1869
1871
|
|
|
1872
|
+
// packages/core/src/config/installationManager.ts
|
|
1873
|
+
init_esbuild_shims();
|
|
1874
|
+
import * as fs from "node:fs";
|
|
1875
|
+
import { randomUUID } from "node:crypto";
|
|
1876
|
+
import * as path2 from "node:path";
|
|
1877
|
+
var debugLogger = createDebugLogger("INSTALLATION");
|
|
1878
|
+
var InstallationManager = class {
|
|
1879
|
+
static {
|
|
1880
|
+
__name(this, "InstallationManager");
|
|
1881
|
+
}
|
|
1882
|
+
getInstallationIdPath() {
|
|
1883
|
+
return Storage.getInstallationIdPath();
|
|
1884
|
+
}
|
|
1885
|
+
readInstallationIdFromFile() {
|
|
1886
|
+
const installationIdFile = this.getInstallationIdPath();
|
|
1887
|
+
if (fs.existsSync(installationIdFile)) {
|
|
1888
|
+
const installationid = fs.readFileSync(installationIdFile, "utf-8").trim();
|
|
1889
|
+
return installationid || null;
|
|
1890
|
+
}
|
|
1891
|
+
return null;
|
|
1892
|
+
}
|
|
1893
|
+
writeInstallationIdToFile(installationId) {
|
|
1894
|
+
const installationIdFile = this.getInstallationIdPath();
|
|
1895
|
+
const dir = path2.dirname(installationIdFile);
|
|
1896
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
1897
|
+
atomicWriteFileSync(installationIdFile, installationId, {
|
|
1898
|
+
encoding: "utf-8"
|
|
1899
|
+
});
|
|
1900
|
+
}
|
|
1901
|
+
/**
|
|
1902
|
+
* Retrieves the installation ID from a file, creating it if it doesn't exist.
|
|
1903
|
+
* This ID is used for unique user installation tracking.
|
|
1904
|
+
* @returns A UUID string for the user.
|
|
1905
|
+
*/
|
|
1906
|
+
getInstallationId() {
|
|
1907
|
+
try {
|
|
1908
|
+
let installationId = this.readInstallationIdFromFile();
|
|
1909
|
+
if (!installationId) {
|
|
1910
|
+
installationId = randomUUID();
|
|
1911
|
+
this.writeInstallationIdToFile(installationId);
|
|
1912
|
+
}
|
|
1913
|
+
return installationId;
|
|
1914
|
+
} catch (error) {
|
|
1915
|
+
debugLogger.error(
|
|
1916
|
+
"Error accessing installation ID file, generating ephemeral ID:",
|
|
1917
|
+
error
|
|
1918
|
+
);
|
|
1919
|
+
return "123456789";
|
|
1920
|
+
}
|
|
1921
|
+
}
|
|
1922
|
+
};
|
|
1923
|
+
|
|
1870
1924
|
// node_modules/mnemonist/index.mjs
|
|
1871
1925
|
init_esbuild_shims();
|
|
1872
1926
|
var import_fibonacci_heap = __toESM(require_fibonacci_heap(), 1);
|
|
@@ -2055,12 +2109,12 @@ var O1CodeLogger = class _O1CodeLogger {
|
|
|
2055
2109
|
readSourceInfo() {
|
|
2056
2110
|
try {
|
|
2057
2111
|
const globalDir = Storage.getGlobalO1CodeDir();
|
|
2058
|
-
const sourceJsonPath =
|
|
2059
|
-
const legacyPath =
|
|
2060
|
-
const candidates =
|
|
2112
|
+
const sourceJsonPath = path3.join(globalDir, "source.json");
|
|
2113
|
+
const legacyPath = path3.join(os.homedir(), ".o1-code", "source.json");
|
|
2114
|
+
const candidates = path3.normalize(sourceJsonPath) !== path3.normalize(legacyPath) ? [sourceJsonPath, legacyPath] : [sourceJsonPath];
|
|
2061
2115
|
for (const candidate of candidates) {
|
|
2062
|
-
if (
|
|
2063
|
-
const sourceJsonContent =
|
|
2116
|
+
if (fs2.existsSync(candidate)) {
|
|
2117
|
+
const sourceJsonContent = fs2.readFileSync(candidate, "utf8");
|
|
2064
2118
|
const sourceData = JSON.parse(sourceJsonContent);
|
|
2065
2119
|
if (sourceData && typeof sourceData === "object" && sourceData.source && sourceData.source !== "unknown") {
|
|
2066
2120
|
return sourceData.source;
|
|
@@ -2703,6 +2757,589 @@ var O1CodeLogger = class _O1CodeLogger {
|
|
|
2703
2757
|
}
|
|
2704
2758
|
};
|
|
2705
2759
|
|
|
2760
|
+
// packages/core/src/telemetry/product/product-telemetry.ts
|
|
2761
|
+
init_esbuild_shims();
|
|
2762
|
+
import * as fs5 from "node:fs";
|
|
2763
|
+
import * as path6 from "node:path";
|
|
2764
|
+
|
|
2765
|
+
// packages/core/src/telemetry/product/usage-ledger.ts
|
|
2766
|
+
init_esbuild_shims();
|
|
2767
|
+
import * as fs3 from "node:fs";
|
|
2768
|
+
import * as path4 from "node:path";
|
|
2769
|
+
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
2770
|
+
var SESSION_MODES = [
|
|
2771
|
+
"interactive",
|
|
2772
|
+
"headless",
|
|
2773
|
+
"sdk"
|
|
2774
|
+
];
|
|
2775
|
+
var MAX_MAP_KEYS = 100;
|
|
2776
|
+
var MAX_DAYS = 31;
|
|
2777
|
+
var MAX_COUNT = 1e9;
|
|
2778
|
+
var FILE_PATTERN = /^(\d{4}-\d{2}-\d{2})\.[A-Za-z0-9-]+\.json$/;
|
|
2779
|
+
function localDay(date) {
|
|
2780
|
+
const pad = /* @__PURE__ */ __name((value) => String(value).padStart(2, "0"), "pad");
|
|
2781
|
+
return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`;
|
|
2782
|
+
}
|
|
2783
|
+
__name(localDay, "localDay");
|
|
2784
|
+
function emptyDay(day) {
|
|
2785
|
+
return {
|
|
2786
|
+
day,
|
|
2787
|
+
sessions: { interactive: 0, headless: 0, sdk: 0 },
|
|
2788
|
+
prompts: 0,
|
|
2789
|
+
toolCalls: {},
|
|
2790
|
+
slashCommands: {},
|
|
2791
|
+
providers: {},
|
|
2792
|
+
apiErrors: {},
|
|
2793
|
+
tokens: { input: 0, output: 0 },
|
|
2794
|
+
subagents: 0
|
|
2795
|
+
};
|
|
2796
|
+
}
|
|
2797
|
+
__name(emptyDay, "emptyDay");
|
|
2798
|
+
function clamp(value) {
|
|
2799
|
+
return Number.isFinite(value) ? Math.min(MAX_COUNT, Math.max(0, Math.round(value))) : 0;
|
|
2800
|
+
}
|
|
2801
|
+
__name(clamp, "clamp");
|
|
2802
|
+
var MAP_KEY = /^[A-Za-z][A-Za-z0-9_.:-]{0,63}$/;
|
|
2803
|
+
function addTo(map, key, amount = 1) {
|
|
2804
|
+
const name = Object.hasOwn(map, key) || Object.keys(map).length < MAX_MAP_KEYS ? key : "other";
|
|
2805
|
+
map[name] = clamp((Object.hasOwn(map, name) ? map[name] : 0) + amount);
|
|
2806
|
+
}
|
|
2807
|
+
__name(addTo, "addTo");
|
|
2808
|
+
function mergeMap(target, source) {
|
|
2809
|
+
if (source && typeof source === "object") {
|
|
2810
|
+
for (const [key, value] of Object.entries(source)) {
|
|
2811
|
+
if (typeof value === "number" && MAP_KEY.test(key)) {
|
|
2812
|
+
addTo(target, key, value);
|
|
2813
|
+
}
|
|
2814
|
+
}
|
|
2815
|
+
}
|
|
2816
|
+
return target;
|
|
2817
|
+
}
|
|
2818
|
+
__name(mergeMap, "mergeMap");
|
|
2819
|
+
function mergeDay(target, source) {
|
|
2820
|
+
for (const mode of SESSION_MODES) {
|
|
2821
|
+
target.sessions[mode] = clamp(
|
|
2822
|
+
target.sessions[mode] + (Number(source.sessions?.[mode]) || 0)
|
|
2823
|
+
);
|
|
2824
|
+
}
|
|
2825
|
+
target.prompts = clamp(target.prompts + (Number(source.prompts) || 0));
|
|
2826
|
+
mergeMap(target.toolCalls, source.toolCalls);
|
|
2827
|
+
mergeMap(target.slashCommands, source.slashCommands);
|
|
2828
|
+
mergeMap(target.providers, source.providers);
|
|
2829
|
+
mergeMap(target.apiErrors, source.apiErrors);
|
|
2830
|
+
target.tokens.input = clamp(
|
|
2831
|
+
target.tokens.input + (Number(source.tokens?.input) || 0)
|
|
2832
|
+
);
|
|
2833
|
+
target.tokens.output = clamp(
|
|
2834
|
+
target.tokens.output + (Number(source.tokens?.output) || 0)
|
|
2835
|
+
);
|
|
2836
|
+
target.subagents = clamp(target.subagents + (Number(source.subagents) || 0));
|
|
2837
|
+
return target;
|
|
2838
|
+
}
|
|
2839
|
+
__name(mergeDay, "mergeDay");
|
|
2840
|
+
var UsageLedger = class {
|
|
2841
|
+
constructor(directory, now = () => /* @__PURE__ */ new Date(), processKey = `${process.pid}-${randomUUID2().slice(0, 8)}`) {
|
|
2842
|
+
this.directory = directory;
|
|
2843
|
+
this.now = now;
|
|
2844
|
+
this.processKey = processKey;
|
|
2845
|
+
this.usage = emptyDay(localDay(this.now()));
|
|
2846
|
+
}
|
|
2847
|
+
static {
|
|
2848
|
+
__name(this, "UsageLedger");
|
|
2849
|
+
}
|
|
2850
|
+
usage;
|
|
2851
|
+
dirty = false;
|
|
2852
|
+
session(mode) {
|
|
2853
|
+
this.update((day) => day.sessions[mode] = clamp(day.sessions[mode] + 1));
|
|
2854
|
+
}
|
|
2855
|
+
prompt() {
|
|
2856
|
+
this.update((day) => day.prompts = clamp(day.prompts + 1));
|
|
2857
|
+
}
|
|
2858
|
+
toolCall(name) {
|
|
2859
|
+
this.update((day) => addTo(day.toolCalls, name));
|
|
2860
|
+
}
|
|
2861
|
+
slashCommand(name) {
|
|
2862
|
+
this.update((day) => addTo(day.slashCommands, name));
|
|
2863
|
+
}
|
|
2864
|
+
apiResponse(provider, input, output) {
|
|
2865
|
+
this.update((day) => {
|
|
2866
|
+
addTo(day.providers, provider);
|
|
2867
|
+
day.tokens.input = clamp(day.tokens.input + input);
|
|
2868
|
+
day.tokens.output = clamp(day.tokens.output + output);
|
|
2869
|
+
});
|
|
2870
|
+
}
|
|
2871
|
+
apiError(category) {
|
|
2872
|
+
this.update((day) => addTo(day.apiErrors, category));
|
|
2873
|
+
}
|
|
2874
|
+
subagent() {
|
|
2875
|
+
this.update((day) => day.subagents = clamp(day.subagents + 1));
|
|
2876
|
+
}
|
|
2877
|
+
/** Writes this process's totals for the current day, if they changed. */
|
|
2878
|
+
persist() {
|
|
2879
|
+
if (!this.dirty) return;
|
|
2880
|
+
try {
|
|
2881
|
+
fs3.mkdirSync(this.directory, { recursive: true });
|
|
2882
|
+
const file = path4.join(
|
|
2883
|
+
this.directory,
|
|
2884
|
+
`${this.usage.day}.${this.processKey}.json`
|
|
2885
|
+
);
|
|
2886
|
+
const temporary = `${file}.tmp`;
|
|
2887
|
+
fs3.writeFileSync(temporary, JSON.stringify(this.usage));
|
|
2888
|
+
fs3.renameSync(temporary, file);
|
|
2889
|
+
this.dirty = false;
|
|
2890
|
+
} catch {
|
|
2891
|
+
}
|
|
2892
|
+
}
|
|
2893
|
+
update(change) {
|
|
2894
|
+
const today = localDay(this.now());
|
|
2895
|
+
if (today !== this.usage.day) {
|
|
2896
|
+
this.persist();
|
|
2897
|
+
this.usage = emptyDay(today);
|
|
2898
|
+
}
|
|
2899
|
+
change(this.usage);
|
|
2900
|
+
this.dirty = true;
|
|
2901
|
+
}
|
|
2902
|
+
};
|
|
2903
|
+
function collectUsage(directory, now) {
|
|
2904
|
+
const today = localDay(now);
|
|
2905
|
+
const oldest = localDay(new Date(now.getTime() - MAX_DAYS * 864e5));
|
|
2906
|
+
const days = /* @__PURE__ */ new Map();
|
|
2907
|
+
const completedFiles = [];
|
|
2908
|
+
let names;
|
|
2909
|
+
try {
|
|
2910
|
+
names = fs3.readdirSync(directory);
|
|
2911
|
+
} catch {
|
|
2912
|
+
return { days: [], completedFiles };
|
|
2913
|
+
}
|
|
2914
|
+
for (const name of names) {
|
|
2915
|
+
const match = FILE_PATTERN.exec(name);
|
|
2916
|
+
if (!match) continue;
|
|
2917
|
+
const day = match[1];
|
|
2918
|
+
const file = path4.join(directory, name);
|
|
2919
|
+
if (day < oldest || day > today) {
|
|
2920
|
+
fs3.rmSync(file, { force: true });
|
|
2921
|
+
continue;
|
|
2922
|
+
}
|
|
2923
|
+
try {
|
|
2924
|
+
const content = JSON.parse(
|
|
2925
|
+
fs3.readFileSync(file, "utf8")
|
|
2926
|
+
);
|
|
2927
|
+
days.set(day, mergeDay(days.get(day) ?? emptyDay(day), content));
|
|
2928
|
+
} catch {
|
|
2929
|
+
fs3.rmSync(file, { force: true });
|
|
2930
|
+
continue;
|
|
2931
|
+
}
|
|
2932
|
+
if (day < today) completedFiles.push(file);
|
|
2933
|
+
}
|
|
2934
|
+
return {
|
|
2935
|
+
days: [...days.values()].sort((a, b) => a.day.localeCompare(b.day)),
|
|
2936
|
+
completedFiles
|
|
2937
|
+
};
|
|
2938
|
+
}
|
|
2939
|
+
__name(collectUsage, "collectUsage");
|
|
2940
|
+
|
|
2941
|
+
// packages/core/src/telemetry/product/error-reports.ts
|
|
2942
|
+
init_esbuild_shims();
|
|
2943
|
+
import * as fs4 from "node:fs";
|
|
2944
|
+
import * as os2 from "node:os";
|
|
2945
|
+
import * as path5 from "node:path";
|
|
2946
|
+
import { createHash } from "node:crypto";
|
|
2947
|
+
var MAX_MESSAGE_LENGTH = 500;
|
|
2948
|
+
var MAX_STACK_LENGTH = 8e3;
|
|
2949
|
+
var MAX_REPORTS_PER_SEND = 20;
|
|
2950
|
+
var MAX_STORED_REPORTS = 100;
|
|
2951
|
+
var FINGERPRINT_FRAMES = 5;
|
|
2952
|
+
function escapeRegExp(text) {
|
|
2953
|
+
return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
2954
|
+
}
|
|
2955
|
+
__name(escapeRegExp, "escapeRegExp");
|
|
2956
|
+
function sanitizeErrorText(text, homeDir = os2.homedir()) {
|
|
2957
|
+
let result = text;
|
|
2958
|
+
if (homeDir.length > 1) {
|
|
2959
|
+
const variants = /* @__PURE__ */ new Set([
|
|
2960
|
+
homeDir,
|
|
2961
|
+
homeDir.replace(/\\/g, "/"),
|
|
2962
|
+
homeDir.replace(/\//g, "\\")
|
|
2963
|
+
]);
|
|
2964
|
+
for (const variant of variants) {
|
|
2965
|
+
result = result.replace(new RegExp(escapeRegExp(variant), "gi"), "~");
|
|
2966
|
+
}
|
|
2967
|
+
}
|
|
2968
|
+
result = result.replace(/file:\/\/\/(?=[A-Za-z]:)/gi, "").replace(/file:\/\//gi, "").replace(/\b[a-z][a-z0-9+.-]*:\/\/[^\s'"`)]+/gi, "<url>").replace(/[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}/gi, "<email>").replace(
|
|
2969
|
+
/(?<!node:\w*)(?:~|[A-Za-z]:)?(?:[\\/][^\s\\/:'"`()]+)+[\\/]?([^\s\\/:'"`()]*)/g,
|
|
2970
|
+
(match) => shortenPath2(match)
|
|
2971
|
+
).replace(/\b(Bearer|Basic)\s+[^\s'"`,;)]+/gi, "$1 <redacted>").replace(
|
|
2972
|
+
/\b([\w-]*(?:password|passwd|secret|token|api[_-]?key|auth)[\w-]*)(["']?\s*[:=]\s*["']?)[^\s'"`,;)&]+/gi,
|
|
2973
|
+
"$1$2<redacted>"
|
|
2974
|
+
).replace(
|
|
2975
|
+
/\b(?:sk|pk|rk|ghp|gho|ghu|ghs|ghr|github_pat|glpat|xox[abprs]|AKIA|ASIA|AIza)[-_A-Za-z0-9]{8,}/g,
|
|
2976
|
+
"<redacted>"
|
|
2977
|
+
).replace(/\b[A-Za-z0-9_\-+=]{32,}\b/g, "<redacted>").replace(/(["'`])([^"'`\n]{41,})\1/g, "$1\u2026$1");
|
|
2978
|
+
return result;
|
|
2979
|
+
}
|
|
2980
|
+
__name(sanitizeErrorText, "sanitizeErrorText");
|
|
2981
|
+
function shortenPath2(match) {
|
|
2982
|
+
const normalized = match.replace(/\\/g, "/");
|
|
2983
|
+
const dependency = normalized.lastIndexOf("node_modules/");
|
|
2984
|
+
if (dependency !== -1) return normalized.slice(dependency);
|
|
2985
|
+
const segments = normalized.split("/").filter(Boolean);
|
|
2986
|
+
return segments.length > 1 ? `\u2026/${segments.at(-1)}` : normalized;
|
|
2987
|
+
}
|
|
2988
|
+
__name(shortenPath2, "shortenPath");
|
|
2989
|
+
function frames(stack) {
|
|
2990
|
+
return stack.split("\n").map((line) => line.trim()).filter((line) => line.startsWith("at ")).slice(0, FINGERPRINT_FRAMES).map((line) => line.replace(/:\d+(?::\d+)?\)?$/u, ""));
|
|
2991
|
+
}
|
|
2992
|
+
__name(frames, "frames");
|
|
2993
|
+
function buildErrorReport(error, kind, version, now = /* @__PURE__ */ new Date(), homeDir) {
|
|
2994
|
+
const value = error instanceof Error ? error : new Error(typeof error === "string" ? error : "Non-error value thrown");
|
|
2995
|
+
const name = (value.name || "Error").slice(0, 64);
|
|
2996
|
+
const message = sanitizeErrorText(value.message ?? "", homeDir).slice(
|
|
2997
|
+
0,
|
|
2998
|
+
MAX_MESSAGE_LENGTH
|
|
2999
|
+
);
|
|
3000
|
+
const stack = sanitizeErrorText(value.stack ?? "", homeDir).slice(
|
|
3001
|
+
0,
|
|
3002
|
+
MAX_STACK_LENGTH
|
|
3003
|
+
);
|
|
3004
|
+
const fingerprint = createHash("sha256").update([kind, name, ...frames(stack)].join("\n")).digest("hex").slice(0, 32);
|
|
3005
|
+
const seen = now.toISOString();
|
|
3006
|
+
return {
|
|
3007
|
+
fingerprint,
|
|
3008
|
+
kind,
|
|
3009
|
+
version,
|
|
3010
|
+
name,
|
|
3011
|
+
message,
|
|
3012
|
+
stack,
|
|
3013
|
+
count: 1,
|
|
3014
|
+
firstSeen: seen,
|
|
3015
|
+
lastSeen: seen
|
|
3016
|
+
};
|
|
3017
|
+
}
|
|
3018
|
+
__name(buildErrorReport, "buildErrorReport");
|
|
3019
|
+
function reportFile(directory, report) {
|
|
3020
|
+
const version = report.version.replace(/[^A-Za-z0-9.-]/g, "_");
|
|
3021
|
+
return path5.join(directory, `${report.fingerprint}.${version}.json`);
|
|
3022
|
+
}
|
|
3023
|
+
__name(reportFile, "reportFile");
|
|
3024
|
+
function storeErrorReport(directory, report) {
|
|
3025
|
+
try {
|
|
3026
|
+
fs4.mkdirSync(directory, { recursive: true });
|
|
3027
|
+
const file = reportFile(directory, report);
|
|
3028
|
+
let stored;
|
|
3029
|
+
if (fs4.existsSync(file)) {
|
|
3030
|
+
stored = JSON.parse(fs4.readFileSync(file, "utf8"));
|
|
3031
|
+
} else if (fs4.readdirSync(directory).length >= MAX_STORED_REPORTS) {
|
|
3032
|
+
return;
|
|
3033
|
+
}
|
|
3034
|
+
const next = stored ? {
|
|
3035
|
+
...stored,
|
|
3036
|
+
count: Math.min(1e9, (stored.count || 0) + report.count),
|
|
3037
|
+
lastSeen: report.lastSeen
|
|
3038
|
+
} : report;
|
|
3039
|
+
fs4.writeFileSync(file, JSON.stringify(next));
|
|
3040
|
+
} catch {
|
|
3041
|
+
}
|
|
3042
|
+
}
|
|
3043
|
+
__name(storeErrorReport, "storeErrorReport");
|
|
3044
|
+
var REPORT_KEYS = [
|
|
3045
|
+
"fingerprint",
|
|
3046
|
+
"kind",
|
|
3047
|
+
"version",
|
|
3048
|
+
"name",
|
|
3049
|
+
"message",
|
|
3050
|
+
"stack",
|
|
3051
|
+
"count",
|
|
3052
|
+
"firstSeen",
|
|
3053
|
+
"lastSeen"
|
|
3054
|
+
].sort();
|
|
3055
|
+
function isValidReport(value) {
|
|
3056
|
+
if (!value || typeof value !== "object") return false;
|
|
3057
|
+
const report = value;
|
|
3058
|
+
const keys = Object.keys(report).sort();
|
|
3059
|
+
const firstSeen = Date.parse(String(report["firstSeen"]));
|
|
3060
|
+
const lastSeen = Date.parse(String(report["lastSeen"]));
|
|
3061
|
+
return keys.length === REPORT_KEYS.length && keys.every((key, index) => key === REPORT_KEYS[index]) && /^[0-9a-f]{32}$/.test(String(report["fingerprint"])) && (report["kind"] === "uncaughtException" || report["kind"] === "unhandledRejection") && typeof report["version"] === "string" && /^(?:[0-9A-Za-z.+-]{1,32})$/.test(report["version"]) && typeof report["name"] === "string" && report["name"].length >= 1 && report["name"].length <= 64 && typeof report["message"] === "string" && report["message"].length <= MAX_MESSAGE_LENGTH && typeof report["stack"] === "string" && report["stack"].length <= MAX_STACK_LENGTH && Number.isInteger(report["count"]) && report["count"] >= 1 && report["count"] <= 1e9 && Number.isFinite(firstSeen) && Number.isFinite(lastSeen) && firstSeen <= lastSeen;
|
|
3062
|
+
}
|
|
3063
|
+
__name(isValidReport, "isValidReport");
|
|
3064
|
+
function collectErrorReports(directory) {
|
|
3065
|
+
const reports = [];
|
|
3066
|
+
const files = [];
|
|
3067
|
+
let names;
|
|
3068
|
+
try {
|
|
3069
|
+
names = fs4.readdirSync(directory).filter((name) => name.endsWith(".json"));
|
|
3070
|
+
} catch {
|
|
3071
|
+
return { reports, files };
|
|
3072
|
+
}
|
|
3073
|
+
for (const name of names.slice(0, MAX_REPORTS_PER_SEND)) {
|
|
3074
|
+
const file = path5.join(directory, name);
|
|
3075
|
+
try {
|
|
3076
|
+
const report = JSON.parse(fs4.readFileSync(file, "utf8"));
|
|
3077
|
+
if (!isValidReport(report)) throw new Error("Invalid report");
|
|
3078
|
+
reports.push(report);
|
|
3079
|
+
files.push(file);
|
|
3080
|
+
} catch {
|
|
3081
|
+
fs4.rmSync(file, { force: true });
|
|
3082
|
+
}
|
|
3083
|
+
}
|
|
3084
|
+
return { reports, files };
|
|
3085
|
+
}
|
|
3086
|
+
__name(collectErrorReports, "collectErrorReports");
|
|
3087
|
+
|
|
3088
|
+
// packages/core/src/telemetry/product/product-telemetry.ts
|
|
3089
|
+
var debugLogger2 = createDebugLogger("PRODUCT_TELEMETRY");
|
|
3090
|
+
var DEFAULT_PRODUCT_TELEMETRY_URL = "https://api.organizaone.com/telemetry/v1";
|
|
3091
|
+
var PRODUCT_TELEMETRY_SCHEMA = 1;
|
|
3092
|
+
var USAGE_SEND_INTERVAL_MS = 60 * 60 * 1e3;
|
|
3093
|
+
var TICK_INTERVAL_MS = 15 * 60 * 1e3;
|
|
3094
|
+
var FIRST_SEND_DELAY_MS = 10 * 1e3;
|
|
3095
|
+
var REQUEST_TIMEOUT_MS = 5e3;
|
|
3096
|
+
var MAX_USAGE_BODY_BYTES = 25e4;
|
|
3097
|
+
var MAX_ERROR_BODY_BYTES = 6e4;
|
|
3098
|
+
var SAFE_NAME = /^[a-z][a-z0-9_.:-]{0,63}$/;
|
|
3099
|
+
var KNOWN_AUTH_TYPES = new Set(Object.values(AuthType));
|
|
3100
|
+
function isDoNotTrack() {
|
|
3101
|
+
const value = process.env["DO_NOT_TRACK"];
|
|
3102
|
+
return value !== void 0 && value !== "" && value !== "0";
|
|
3103
|
+
}
|
|
3104
|
+
__name(isDoNotTrack, "isDoNotTrack");
|
|
3105
|
+
function isUsageReportingEnabled(config) {
|
|
3106
|
+
return config.getUsageStatisticsEnabled() && !isDoNotTrack();
|
|
3107
|
+
}
|
|
3108
|
+
__name(isUsageReportingEnabled, "isUsageReportingEnabled");
|
|
3109
|
+
function isErrorReportingEnabled(config) {
|
|
3110
|
+
return config.getErrorReportsEnabled() && !isDoNotTrack();
|
|
3111
|
+
}
|
|
3112
|
+
__name(isErrorReportingEnabled, "isErrorReportingEnabled");
|
|
3113
|
+
function telemetryUrl() {
|
|
3114
|
+
return (process.env["O1CODE_TELEMETRY_URL"] || DEFAULT_PRODUCT_TELEMETRY_URL).replace(/\/+$/, "");
|
|
3115
|
+
}
|
|
3116
|
+
__name(telemetryUrl, "telemetryUrl");
|
|
3117
|
+
function telemetryDir() {
|
|
3118
|
+
return path6.join(Storage.getGlobalO1CodeDir(), "telemetry");
|
|
3119
|
+
}
|
|
3120
|
+
__name(telemetryDir, "telemetryDir");
|
|
3121
|
+
function osName() {
|
|
3122
|
+
return ["win32", "darwin", "linux"].includes(process.platform) ? process.platform : "other";
|
|
3123
|
+
}
|
|
3124
|
+
__name(osName, "osName");
|
|
3125
|
+
function archName() {
|
|
3126
|
+
return ["x64", "arm64"].includes(process.arch) ? process.arch : "other";
|
|
3127
|
+
}
|
|
3128
|
+
__name(archName, "archName");
|
|
3129
|
+
function localeName() {
|
|
3130
|
+
try {
|
|
3131
|
+
const locale = Intl.DateTimeFormat().resolvedOptions().locale;
|
|
3132
|
+
return /^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{2,8})?$/.test(locale) ? locale : "other";
|
|
3133
|
+
} catch {
|
|
3134
|
+
return "other";
|
|
3135
|
+
}
|
|
3136
|
+
}
|
|
3137
|
+
__name(localeName, "localeName");
|
|
3138
|
+
function resolveInstall(current) {
|
|
3139
|
+
if (current.install === void 0) return;
|
|
3140
|
+
let install;
|
|
3141
|
+
try {
|
|
3142
|
+
install = typeof current.install === "function" ? current.install() : current.install;
|
|
3143
|
+
} catch {
|
|
3144
|
+
install = "unknown";
|
|
3145
|
+
}
|
|
3146
|
+
current.client.install = SAFE_NAME.test(install) ? install : "unknown";
|
|
3147
|
+
current.install = void 0;
|
|
3148
|
+
}
|
|
3149
|
+
__name(resolveInstall, "resolveInstall");
|
|
3150
|
+
var state;
|
|
3151
|
+
var exitHookInstalled = false;
|
|
3152
|
+
var errorReporting;
|
|
3153
|
+
function startProductTelemetry(config, options = {}) {
|
|
3154
|
+
try {
|
|
3155
|
+
start(config, options);
|
|
3156
|
+
} catch (error) {
|
|
3157
|
+
debugLogger2.debug("Product telemetry did not start:", error);
|
|
3158
|
+
state = void 0;
|
|
3159
|
+
}
|
|
3160
|
+
}
|
|
3161
|
+
__name(startProductTelemetry, "startProductTelemetry");
|
|
3162
|
+
function start(config, options) {
|
|
3163
|
+
const client = {
|
|
3164
|
+
version: config.getCliVersion() ?? "unknown",
|
|
3165
|
+
os: osName(),
|
|
3166
|
+
arch: archName(),
|
|
3167
|
+
node: process.versions.node.split(".")[0] ?? "unknown",
|
|
3168
|
+
install: "unknown",
|
|
3169
|
+
locale: localeName()
|
|
3170
|
+
};
|
|
3171
|
+
const install = options.install;
|
|
3172
|
+
errorReporting = {
|
|
3173
|
+
enabled: isErrorReportingEnabled(config),
|
|
3174
|
+
version: client.version,
|
|
3175
|
+
directory: path6.join(telemetryDir(), "errors")
|
|
3176
|
+
};
|
|
3177
|
+
if (!isUsageReportingEnabled(config) && !errorReporting.enabled) {
|
|
3178
|
+
state = void 0;
|
|
3179
|
+
return;
|
|
3180
|
+
}
|
|
3181
|
+
if (state?.timer) clearInterval(state.timer);
|
|
3182
|
+
state = {
|
|
3183
|
+
config,
|
|
3184
|
+
ledger: new UsageLedger(path6.join(telemetryDir(), "usage")),
|
|
3185
|
+
client,
|
|
3186
|
+
install
|
|
3187
|
+
};
|
|
3188
|
+
if (!exitHookInstalled) {
|
|
3189
|
+
exitHookInstalled = true;
|
|
3190
|
+
process.once("exit", () => state?.ledger.persist());
|
|
3191
|
+
}
|
|
3192
|
+
if (options.manual) return;
|
|
3193
|
+
setTimeout(() => void sendProductTelemetry(), FIRST_SEND_DELAY_MS).unref();
|
|
3194
|
+
state.timer = setInterval(() => {
|
|
3195
|
+
state?.ledger.persist();
|
|
3196
|
+
void sendProductTelemetry();
|
|
3197
|
+
}, TICK_INTERVAL_MS);
|
|
3198
|
+
state.timer.unref();
|
|
3199
|
+
}
|
|
3200
|
+
__name(start, "start");
|
|
3201
|
+
function productUsage(config) {
|
|
3202
|
+
if (!state || !isUsageReportingEnabled(config)) return void 0;
|
|
3203
|
+
return recorder;
|
|
3204
|
+
}
|
|
3205
|
+
__name(productUsage, "productUsage");
|
|
3206
|
+
var ProductUsageRecorder = class {
|
|
3207
|
+
static {
|
|
3208
|
+
__name(this, "ProductUsageRecorder");
|
|
3209
|
+
}
|
|
3210
|
+
session(config) {
|
|
3211
|
+
const mode = config.isInteractive() ? "interactive" : config.getInputFormat() === "stream-json" || config.getExperimentalZedIntegration() ? "sdk" : "headless";
|
|
3212
|
+
state?.ledger.session(mode);
|
|
3213
|
+
}
|
|
3214
|
+
prompt() {
|
|
3215
|
+
state?.ledger.prompt();
|
|
3216
|
+
}
|
|
3217
|
+
toolCall(name, type) {
|
|
3218
|
+
state?.ledger.toolCall(
|
|
3219
|
+
type === "mcp" ? "mcp" : SAFE_NAME.test(name) ? name : "other"
|
|
3220
|
+
);
|
|
3221
|
+
}
|
|
3222
|
+
slashCommand(name, builtIn) {
|
|
3223
|
+
state?.ledger.slashCommand(
|
|
3224
|
+
builtIn && SAFE_NAME.test(name) ? name : "custom"
|
|
3225
|
+
);
|
|
3226
|
+
}
|
|
3227
|
+
apiResponse(config, authType, input, output) {
|
|
3228
|
+
state?.ledger.apiResponse(providerKind(config, authType), input, output);
|
|
3229
|
+
}
|
|
3230
|
+
apiError(statusCode, errorType) {
|
|
3231
|
+
const status = Number(statusCode);
|
|
3232
|
+
state?.ledger.apiError(
|
|
3233
|
+
Number.isInteger(status) && status >= 100 && status < 600 ? `http_${status}` : errorType && /^[A-Za-z][A-Za-z0-9_]{0,47}$/.test(errorType) ? errorType : "other"
|
|
3234
|
+
);
|
|
3235
|
+
}
|
|
3236
|
+
subagent() {
|
|
3237
|
+
state?.ledger.subagent();
|
|
3238
|
+
}
|
|
3239
|
+
};
|
|
3240
|
+
var recorder = new ProductUsageRecorder();
|
|
3241
|
+
function providerKind(config, authType) {
|
|
3242
|
+
if (reachesOrganizaOne(config.getContentGeneratorConfig?.())) {
|
|
3243
|
+
return "organizaone";
|
|
3244
|
+
}
|
|
3245
|
+
return authType && KNOWN_AUTH_TYPES.has(authType) ? authType : "other";
|
|
3246
|
+
}
|
|
3247
|
+
__name(providerKind, "providerKind");
|
|
3248
|
+
function recordErrorReport(error, kind) {
|
|
3249
|
+
if (!errorReporting?.enabled) return;
|
|
3250
|
+
storeErrorReport(
|
|
3251
|
+
errorReporting.directory,
|
|
3252
|
+
buildErrorReport(error, kind, errorReporting.version)
|
|
3253
|
+
);
|
|
3254
|
+
}
|
|
3255
|
+
__name(recordErrorReport, "recordErrorReport");
|
|
3256
|
+
async function post(endpoint, body) {
|
|
3257
|
+
try {
|
|
3258
|
+
const response = await fetch(`${telemetryUrl()}/${endpoint}`, {
|
|
3259
|
+
method: "POST",
|
|
3260
|
+
headers: { "content-type": "application/json" },
|
|
3261
|
+
body: JSON.stringify(body),
|
|
3262
|
+
signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS)
|
|
3263
|
+
});
|
|
3264
|
+
return response.ok;
|
|
3265
|
+
} catch (error) {
|
|
3266
|
+
debugLogger2.debug(`Sending ${endpoint} failed:`, error);
|
|
3267
|
+
return false;
|
|
3268
|
+
}
|
|
3269
|
+
}
|
|
3270
|
+
__name(post, "post");
|
|
3271
|
+
function readSendState(file) {
|
|
3272
|
+
try {
|
|
3273
|
+
return JSON.parse(fs5.readFileSync(file, "utf8"));
|
|
3274
|
+
} catch {
|
|
3275
|
+
return {};
|
|
3276
|
+
}
|
|
3277
|
+
}
|
|
3278
|
+
__name(readSendState, "readSendState");
|
|
3279
|
+
async function sendProductTelemetry(now = /* @__PURE__ */ new Date()) {
|
|
3280
|
+
const current = state;
|
|
3281
|
+
if (!current) return;
|
|
3282
|
+
resolveInstall(current);
|
|
3283
|
+
const directory = telemetryDir();
|
|
3284
|
+
if (isUsageReportingEnabled(current.config)) {
|
|
3285
|
+
const stateFile = path6.join(directory, "state.json");
|
|
3286
|
+
const sendState = readSendState(stateFile);
|
|
3287
|
+
if (!sendState.lastUsageSentAt || now.getTime() - sendState.lastUsageSentAt >= USAGE_SEND_INTERVAL_MS) {
|
|
3288
|
+
current.ledger.persist();
|
|
3289
|
+
const usage = collectUsage(path6.join(directory, "usage"), now);
|
|
3290
|
+
const payload = {
|
|
3291
|
+
schema: PRODUCT_TELEMETRY_SCHEMA,
|
|
3292
|
+
// Read only for usage metrics, so error reports alone never create
|
|
3293
|
+
// or read the installation ID.
|
|
3294
|
+
installationId: new InstallationManager().getInstallationId(),
|
|
3295
|
+
client: current.client,
|
|
3296
|
+
days: usage.days
|
|
3297
|
+
};
|
|
3298
|
+
while (payload.days.length > 1 && JSON.stringify(payload).length > MAX_USAGE_BODY_BYTES) {
|
|
3299
|
+
payload.days.shift();
|
|
3300
|
+
}
|
|
3301
|
+
if (await post("usage", payload)) {
|
|
3302
|
+
for (const file of usage.completedFiles) {
|
|
3303
|
+
fs5.rmSync(file, { force: true });
|
|
3304
|
+
}
|
|
3305
|
+
try {
|
|
3306
|
+
fs5.mkdirSync(directory, { recursive: true });
|
|
3307
|
+
fs5.writeFileSync(
|
|
3308
|
+
stateFile,
|
|
3309
|
+
JSON.stringify({ ...sendState, lastUsageSentAt: now.getTime() })
|
|
3310
|
+
);
|
|
3311
|
+
} catch {
|
|
3312
|
+
}
|
|
3313
|
+
}
|
|
3314
|
+
}
|
|
3315
|
+
} else {
|
|
3316
|
+
fs5.rmSync(path6.join(directory, "usage"), { recursive: true, force: true });
|
|
3317
|
+
}
|
|
3318
|
+
if (errorReporting?.enabled) {
|
|
3319
|
+
const collected = collectErrorReports(errorReporting.directory);
|
|
3320
|
+
const payload = {
|
|
3321
|
+
schema: PRODUCT_TELEMETRY_SCHEMA,
|
|
3322
|
+
client: current.client,
|
|
3323
|
+
errors: []
|
|
3324
|
+
};
|
|
3325
|
+
const sent = [];
|
|
3326
|
+
collected.reports.forEach((report, index) => {
|
|
3327
|
+
payload.errors.push(report);
|
|
3328
|
+
if (payload.errors.length > 1 && JSON.stringify(payload).length > MAX_ERROR_BODY_BYTES) {
|
|
3329
|
+
payload.errors.pop();
|
|
3330
|
+
} else {
|
|
3331
|
+
sent.push(collected.files[index]);
|
|
3332
|
+
}
|
|
3333
|
+
});
|
|
3334
|
+
if (payload.errors.length > 0 && await post("errors", payload)) {
|
|
3335
|
+
for (const file of sent) fs5.rmSync(file, { force: true });
|
|
3336
|
+
}
|
|
3337
|
+
} else if (errorReporting) {
|
|
3338
|
+
fs5.rmSync(errorReporting.directory, { recursive: true, force: true });
|
|
3339
|
+
}
|
|
3340
|
+
}
|
|
3341
|
+
__name(sendProductTelemetry, "sendProductTelemetry");
|
|
3342
|
+
|
|
2706
3343
|
// packages/core/src/telemetry/uiTelemetry.ts
|
|
2707
3344
|
init_esbuild_shims();
|
|
2708
3345
|
import { EventEmitter } from "node:events";
|
|
@@ -3256,16 +3893,16 @@ var apiActivityTracker = new ApiActivityTracker();
|
|
|
3256
3893
|
|
|
3257
3894
|
// packages/core/src/services/tokenUsageService.ts
|
|
3258
3895
|
init_esbuild_shims();
|
|
3259
|
-
import
|
|
3260
|
-
import { randomUUID } from "node:crypto";
|
|
3896
|
+
import path8 from "node:path";
|
|
3897
|
+
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
3261
3898
|
|
|
3262
3899
|
// packages/core/src/utils/jsonl-utils.ts
|
|
3263
3900
|
init_esbuild_shims();
|
|
3264
|
-
import
|
|
3265
|
-
import
|
|
3901
|
+
import fs6 from "node:fs";
|
|
3902
|
+
import path7 from "node:path";
|
|
3266
3903
|
import readline from "node:readline";
|
|
3267
3904
|
import { finished } from "node:stream/promises";
|
|
3268
|
-
var
|
|
3905
|
+
var debugLogger3 = createDebugLogger("JSONL");
|
|
3269
3906
|
var fileLocks = /* @__PURE__ */ new Map();
|
|
3270
3907
|
function getFileLock(filePath) {
|
|
3271
3908
|
if (!fileLocks.has(filePath)) {
|
|
@@ -3279,7 +3916,7 @@ function recoverObjectsFromLine(line) {
|
|
|
3279
3916
|
let depth = 0;
|
|
3280
3917
|
let inString = false;
|
|
3281
3918
|
let escape = false;
|
|
3282
|
-
let
|
|
3919
|
+
let start2 = -1;
|
|
3283
3920
|
let complete = true;
|
|
3284
3921
|
for (let i = 0; i < line.length; i++) {
|
|
3285
3922
|
const c = line[i];
|
|
@@ -3298,22 +3935,22 @@ function recoverObjectsFromLine(line) {
|
|
|
3298
3935
|
continue;
|
|
3299
3936
|
}
|
|
3300
3937
|
if (c === "{") {
|
|
3301
|
-
if (depth === 0)
|
|
3938
|
+
if (depth === 0) start2 = i;
|
|
3302
3939
|
depth++;
|
|
3303
3940
|
} else if (c === "}") {
|
|
3304
3941
|
depth--;
|
|
3305
|
-
if (depth === 0 &&
|
|
3306
|
-
const fragment = line.slice(
|
|
3942
|
+
if (depth === 0 && start2 >= 0) {
|
|
3943
|
+
const fragment = line.slice(start2, i + 1);
|
|
3307
3944
|
try {
|
|
3308
3945
|
out.push(JSON.parse(fragment));
|
|
3309
3946
|
} catch {
|
|
3310
3947
|
complete = false;
|
|
3311
3948
|
}
|
|
3312
|
-
|
|
3949
|
+
start2 = -1;
|
|
3313
3950
|
} else if (depth < 0) {
|
|
3314
3951
|
complete = false;
|
|
3315
3952
|
depth = 0;
|
|
3316
|
-
|
|
3953
|
+
start2 = -1;
|
|
3317
3954
|
}
|
|
3318
3955
|
} else if (depth === 0 && !/\s/.test(c)) {
|
|
3319
3956
|
complete = false;
|
|
@@ -3321,7 +3958,7 @@ function recoverObjectsFromLine(line) {
|
|
|
3321
3958
|
}
|
|
3322
3959
|
return {
|
|
3323
3960
|
records: out,
|
|
3324
|
-
complete: complete && out.length > 0 && depth === 0 && !inString &&
|
|
3961
|
+
complete: complete && out.length > 0 && depth === 0 && !inString && start2 === -1
|
|
3325
3962
|
};
|
|
3326
3963
|
}
|
|
3327
3964
|
__name(recoverObjectsFromLine, "recoverObjectsFromLine");
|
|
@@ -3335,14 +3972,14 @@ function parseLineTolerantWithIntegrity(line, filePath) {
|
|
|
3335
3972
|
if (parsed !== null && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
3336
3973
|
return { records: [parsed], complete: true };
|
|
3337
3974
|
}
|
|
3338
|
-
|
|
3975
|
+
debugLogger3.warn(`Skipping non-object JSONL value in ${filePath}`);
|
|
3339
3976
|
return { records: [], complete: false };
|
|
3340
3977
|
} catch {
|
|
3341
3978
|
const recovered = recoverObjectsFromLine(line);
|
|
3342
3979
|
if (recovered.records.length === 0) {
|
|
3343
|
-
|
|
3980
|
+
debugLogger3.warn(`Failed to parse line in ${filePath}`);
|
|
3344
3981
|
} else {
|
|
3345
|
-
|
|
3982
|
+
debugLogger3.warn(
|
|
3346
3983
|
`Recovered ${recovered.records.length} record(s) from malformed line in ${filePath}`
|
|
3347
3984
|
);
|
|
3348
3985
|
}
|
|
@@ -3371,7 +4008,7 @@ async function readLinesWithIntegrityInternal(filePath, count, options = {}, bud
|
|
|
3371
4008
|
let rl;
|
|
3372
4009
|
try {
|
|
3373
4010
|
options.signal?.throwIfAborted();
|
|
3374
|
-
fileStream = options.signal ?
|
|
4011
|
+
fileStream = options.signal ? fs6.createReadStream(filePath, { signal: options.signal }) : fs6.createReadStream(filePath);
|
|
3375
4012
|
rl = readline.createInterface({
|
|
3376
4013
|
input: fileStream,
|
|
3377
4014
|
crlfDelay: Infinity
|
|
@@ -3398,7 +4035,7 @@ async function readLinesWithIntegrityInternal(filePath, count, options = {}, bud
|
|
|
3398
4035
|
} catch (error) {
|
|
3399
4036
|
options.signal?.throwIfAborted();
|
|
3400
4037
|
if (error.code !== "ENOENT") {
|
|
3401
|
-
|
|
4038
|
+
debugLogger3.error(
|
|
3402
4039
|
`Error reading up to ${count} ${budget} from ${filePath}:`,
|
|
3403
4040
|
error
|
|
3404
4041
|
);
|
|
@@ -3422,7 +4059,7 @@ async function read(filePath, options = {}) {
|
|
|
3422
4059
|
let fileStream;
|
|
3423
4060
|
let rl;
|
|
3424
4061
|
try {
|
|
3425
|
-
fileStream =
|
|
4062
|
+
fileStream = fs6.createReadStream(filePath);
|
|
3426
4063
|
rl = readline.createInterface({
|
|
3427
4064
|
input: fileStream,
|
|
3428
4065
|
crlfDelay: Infinity
|
|
@@ -3439,7 +4076,7 @@ async function read(filePath, options = {}) {
|
|
|
3439
4076
|
} catch (error) {
|
|
3440
4077
|
if (error.code !== "ENOENT") {
|
|
3441
4078
|
options.onIncompleteRead?.();
|
|
3442
|
-
|
|
4079
|
+
debugLogger3.error(`Error reading ${filePath}:`, error);
|
|
3443
4080
|
if (options.throwOnNonEnoentError) {
|
|
3444
4081
|
throw error;
|
|
3445
4082
|
}
|
|
@@ -3456,12 +4093,12 @@ async function writeLine(filePath, data) {
|
|
|
3456
4093
|
await lock.runExclusive(async () => {
|
|
3457
4094
|
const line = `${JSON.stringify(data)}
|
|
3458
4095
|
`;
|
|
3459
|
-
const dir =
|
|
4096
|
+
const dir = path7.dirname(filePath);
|
|
3460
4097
|
if (!ensuredDirs.has(dir)) {
|
|
3461
|
-
await
|
|
4098
|
+
await fs6.promises.mkdir(dir, { recursive: true });
|
|
3462
4099
|
ensuredDirs.add(dir);
|
|
3463
4100
|
}
|
|
3464
|
-
await
|
|
4101
|
+
await fs6.promises.appendFile(filePath, Buffer.from(line, "utf8"), {
|
|
3465
4102
|
flush: true
|
|
3466
4103
|
});
|
|
3467
4104
|
});
|
|
@@ -3470,16 +4107,16 @@ __name(writeLine, "writeLine");
|
|
|
3470
4107
|
function writeLineSync(filePath, data) {
|
|
3471
4108
|
const line = `${JSON.stringify(data)}
|
|
3472
4109
|
`;
|
|
3473
|
-
const dir =
|
|
3474
|
-
if (!
|
|
3475
|
-
|
|
4110
|
+
const dir = path7.dirname(filePath);
|
|
4111
|
+
if (!fs6.existsSync(dir)) {
|
|
4112
|
+
fs6.mkdirSync(dir, { recursive: true });
|
|
3476
4113
|
}
|
|
3477
|
-
|
|
4114
|
+
fs6.appendFileSync(filePath, Buffer.from(line, "utf8"), { flush: true });
|
|
3478
4115
|
}
|
|
3479
4116
|
__name(writeLineSync, "writeLineSync");
|
|
3480
4117
|
function exists(filePath) {
|
|
3481
4118
|
try {
|
|
3482
|
-
const stats =
|
|
4119
|
+
const stats = fs6.statSync(filePath);
|
|
3483
4120
|
return stats.isFile() && stats.size > 0;
|
|
3484
4121
|
} catch {
|
|
3485
4122
|
return false;
|
|
@@ -3488,7 +4125,7 @@ function exists(filePath) {
|
|
|
3488
4125
|
__name(exists, "exists");
|
|
3489
4126
|
|
|
3490
4127
|
// packages/core/src/services/tokenUsageService.ts
|
|
3491
|
-
var
|
|
4128
|
+
var debugLogger4 = createDebugLogger("TOKEN_USAGE");
|
|
3492
4129
|
var USAGE_DIR_NAME = "usage";
|
|
3493
4130
|
var FILE_PREFIX = "token-usage-";
|
|
3494
4131
|
var FILE_EXTENSION = ".jsonl";
|
|
@@ -3584,14 +4221,14 @@ function normalizePeriodValue(period, value) {
|
|
|
3584
4221
|
}
|
|
3585
4222
|
__name(normalizePeriodValue, "normalizePeriodValue");
|
|
3586
4223
|
function usageDir() {
|
|
3587
|
-
return
|
|
4224
|
+
return path8.join(Storage.getRuntimeBaseDir(), USAGE_DIR_NAME);
|
|
3588
4225
|
}
|
|
3589
4226
|
__name(usageDir, "usageDir");
|
|
3590
4227
|
function getTokenUsageFilePath(month) {
|
|
3591
4228
|
if (!isValidMonth(month)) {
|
|
3592
4229
|
throw new Error(`Invalid month value "${month}". Expected YYYY-MM.`);
|
|
3593
4230
|
}
|
|
3594
|
-
return
|
|
4231
|
+
return path8.join(usageDir(), `${FILE_PREFIX}${month}${FILE_EXTENSION}`);
|
|
3595
4232
|
}
|
|
3596
4233
|
__name(getTokenUsageFilePath, "getTokenUsageFilePath");
|
|
3597
4234
|
function toNonNegativeInteger(value) {
|
|
@@ -3625,7 +4262,7 @@ function apiResponseEventToTokenUsageRecord(config, event) {
|
|
|
3625
4262
|
);
|
|
3626
4263
|
return {
|
|
3627
4264
|
schemaVersion: SCHEMA_VERSION,
|
|
3628
|
-
id:
|
|
4265
|
+
id: randomUUID3(),
|
|
3629
4266
|
timestamp,
|
|
3630
4267
|
localDate: localParts.date,
|
|
3631
4268
|
localMonth: localParts.month,
|
|
@@ -3665,7 +4302,7 @@ async function readRecordsForMonth(month) {
|
|
|
3665
4302
|
}
|
|
3666
4303
|
}
|
|
3667
4304
|
if (dropped > 0) {
|
|
3668
|
-
|
|
4305
|
+
debugLogger4.warn(
|
|
3669
4306
|
`Dropped ${dropped}/${records.length} invalid record(s) from ${filePath}`
|
|
3670
4307
|
);
|
|
3671
4308
|
}
|
|
@@ -3735,7 +4372,7 @@ var suppressedCountByCode = /* @__PURE__ */ new Map();
|
|
|
3735
4372
|
var TOKEN_USAGE_FAILURE_LOG_COOLDOWN_MS = 6e4;
|
|
3736
4373
|
var _now = /* @__PURE__ */ __name(() => Date.now(), "_now");
|
|
3737
4374
|
function logTokenUsageWriteFailure(error) {
|
|
3738
|
-
|
|
4375
|
+
debugLogger4.warn("Failed to record token usage:", error);
|
|
3739
4376
|
const code = error.code;
|
|
3740
4377
|
if (code && code !== "ENOENT") {
|
|
3741
4378
|
const now = _now();
|
|
@@ -3909,17 +4546,18 @@ function normalizeToolCallEvent(event) {
|
|
|
3909
4546
|
return normalized;
|
|
3910
4547
|
}
|
|
3911
4548
|
__name(normalizeToolCallEvent, "normalizeToolCallEvent");
|
|
3912
|
-
var
|
|
4549
|
+
var debugLogger5 = createDebugLogger("TELEMETRY_SINK");
|
|
3913
4550
|
function runToolTelemetrySink(sink) {
|
|
3914
4551
|
try {
|
|
3915
4552
|
sink();
|
|
3916
4553
|
} catch (e) {
|
|
3917
|
-
|
|
4554
|
+
debugLogger5.debug("Telemetry sink failed (best-effort):", e);
|
|
3918
4555
|
}
|
|
3919
4556
|
}
|
|
3920
4557
|
__name(runToolTelemetrySink, "runToolTelemetrySink");
|
|
3921
4558
|
function logStartSession(config, event, previousSessionId) {
|
|
3922
4559
|
O1CodeLogger.getInstance(config)?.logStartSessionEvent(event);
|
|
4560
|
+
productUsage(config)?.session(config);
|
|
3923
4561
|
if (!isTelemetrySdkInitialized()) return;
|
|
3924
4562
|
const attributes = {
|
|
3925
4563
|
...getCommonAttributes(config),
|
|
@@ -3960,6 +4598,7 @@ function logSessionEnd(config) {
|
|
|
3960
4598
|
__name(logSessionEnd, "logSessionEnd");
|
|
3961
4599
|
function logUserPrompt(config, event) {
|
|
3962
4600
|
O1CodeLogger.getInstance(config)?.logNewPromptEvent(event);
|
|
4601
|
+
productUsage(config)?.prompt();
|
|
3963
4602
|
if (!isTelemetrySdkInitialized()) return;
|
|
3964
4603
|
const attributes = {
|
|
3965
4604
|
...getCommonAttributes(config),
|
|
@@ -4019,6 +4658,10 @@ function logToolCall(config, event) {
|
|
|
4019
4658
|
});
|
|
4020
4659
|
runToolTelemetrySink(() => {
|
|
4021
4660
|
O1CodeLogger.getInstance(config)?.logToolCallEvent(normalizedEvent);
|
|
4661
|
+
productUsage(config)?.toolCall(
|
|
4662
|
+
normalizedEvent.function_name,
|
|
4663
|
+
normalizedEvent.tool_type
|
|
4664
|
+
);
|
|
4022
4665
|
});
|
|
4023
4666
|
if (!isTelemetrySdkInitialized()) return;
|
|
4024
4667
|
runToolTelemetrySink(() => {
|
|
@@ -4183,6 +4826,7 @@ function logApiError(config, event, sessionId, uiSubagentIdentity) {
|
|
|
4183
4826
|
recordUiTelemetryEventToChat(config, uiEvent);
|
|
4184
4827
|
}
|
|
4185
4828
|
O1CodeLogger.getInstance(config)?.logApiErrorEvent(event);
|
|
4829
|
+
productUsage(config)?.apiError(event.status_code, event.error_type);
|
|
4186
4830
|
if (!isTelemetrySdkInitialized()) return;
|
|
4187
4831
|
const attributes = {
|
|
4188
4832
|
...getCommonAttributes(config),
|
|
@@ -4256,6 +4900,12 @@ function logApiResponse(config, event, sessionId, uiSubagentIdentity) {
|
|
|
4256
4900
|
recordUiTelemetryEventToChat(config, uiEvent);
|
|
4257
4901
|
}
|
|
4258
4902
|
O1CodeLogger.getInstance(config)?.logApiResponseEvent(event);
|
|
4903
|
+
productUsage(config)?.apiResponse(
|
|
4904
|
+
config,
|
|
4905
|
+
event.auth_type,
|
|
4906
|
+
event.input_token_count,
|
|
4907
|
+
event.output_token_count
|
|
4908
|
+
);
|
|
4259
4909
|
if (!isTelemetrySdkInitialized()) return;
|
|
4260
4910
|
const attributes = {
|
|
4261
4911
|
...getCommonAttributes(config),
|
|
@@ -4369,6 +5019,7 @@ function logNextSpeakerCheck(config, event) {
|
|
|
4369
5019
|
__name(logNextSpeakerCheck, "logNextSpeakerCheck");
|
|
4370
5020
|
function logSlashCommand(config, event) {
|
|
4371
5021
|
O1CodeLogger.getInstance(config)?.logSlashCommandEvent(event);
|
|
5022
|
+
productUsage(config)?.slashCommand(event.command, event.built_in);
|
|
4372
5023
|
if (!isTelemetrySdkInitialized()) return;
|
|
4373
5024
|
const attributes = {
|
|
4374
5025
|
...getCommonAttributes(config),
|
|
@@ -4517,6 +5168,7 @@ function logApiRetry(config, event) {
|
|
|
4517
5168
|
__name(logApiRetry, "logApiRetry");
|
|
4518
5169
|
function logSubagentExecution(config, event) {
|
|
4519
5170
|
O1CodeLogger.getInstance(config)?.logSubagentExecutionEvent(event);
|
|
5171
|
+
productUsage(config)?.subagent();
|
|
4520
5172
|
if (!isTelemetrySdkInitialized()) return;
|
|
4521
5173
|
const attributes = {
|
|
4522
5174
|
...getCommonAttributes(config),
|
|
@@ -5044,10 +5696,10 @@ init_esbuild_shims();
|
|
|
5044
5696
|
|
|
5045
5697
|
// packages/core/src/tools/truncation.ts
|
|
5046
5698
|
init_esbuild_shims();
|
|
5047
|
-
import * as
|
|
5048
|
-
import * as
|
|
5699
|
+
import * as fs7 from "node:fs/promises";
|
|
5700
|
+
import * as path9 from "node:path";
|
|
5049
5701
|
import * as crypto from "node:crypto";
|
|
5050
|
-
var
|
|
5702
|
+
var debugLogger6 = createDebugLogger("TRUNCATION");
|
|
5051
5703
|
var PREVIEW_SIZE_CHARS = 2e3;
|
|
5052
5704
|
var MAX_FILE_SIZE_BYTES = 50 * 1024 * 1024;
|
|
5053
5705
|
var MAX_SESSION_BYTES = 500 * 1024 * 1024;
|
|
@@ -5117,8 +5769,8 @@ async function truncateAndSaveToFile(content, fileName, projectTempDir, threshol
|
|
|
5117
5769
|
tailChars += lines[i].length + 1;
|
|
5118
5770
|
}
|
|
5119
5771
|
const truncatedContent = keep === "head" ? beginning.join("\n") + sep : keep === "tail" ? sep + end.join("\n") : beginning.join("\n") + sep + end.join("\n");
|
|
5120
|
-
const safeFileName = `${
|
|
5121
|
-
const outputFile =
|
|
5772
|
+
const safeFileName = `${path9.basename(fileName)}.output`;
|
|
5773
|
+
const outputFile = path9.join(projectTempDir, safeFileName);
|
|
5122
5774
|
const wrappedMessage = `${TOOL_OUTPUT_TRUNCATED_PREFIX}.
|
|
5123
5775
|
The full output has been saved to: ${outputFile}
|
|
5124
5776
|
To read the complete output, use the ${ReadFileTool.Name} tool with the absolute file path above.
|
|
@@ -5130,8 +5782,8 @@ ${truncatedContent}`;
|
|
|
5130
5782
|
return { content };
|
|
5131
5783
|
}
|
|
5132
5784
|
try {
|
|
5133
|
-
await
|
|
5134
|
-
await
|
|
5785
|
+
await fs7.mkdir(projectTempDir, { recursive: true });
|
|
5786
|
+
await fs7.writeFile(outputFile, content, {
|
|
5135
5787
|
mode: 384,
|
|
5136
5788
|
...exclusive ? { flag: "wx" } : {}
|
|
5137
5789
|
});
|
|
@@ -5140,7 +5792,7 @@ ${truncatedContent}`;
|
|
|
5140
5792
|
outputFile
|
|
5141
5793
|
};
|
|
5142
5794
|
} catch (error) {
|
|
5143
|
-
|
|
5795
|
+
debugLogger6.warn(
|
|
5144
5796
|
`Failed to save truncated output to ${outputFile}:`,
|
|
5145
5797
|
error
|
|
5146
5798
|
);
|
|
@@ -5246,14 +5898,14 @@ function generatePreview(content) {
|
|
|
5246
5898
|
}
|
|
5247
5899
|
__name(generatePreview, "generatePreview");
|
|
5248
5900
|
function normalizeToolResultCallId(callId) {
|
|
5249
|
-
const safeCallId =
|
|
5901
|
+
const safeCallId = path9.basename(callId).replace(/\x00/g, "_");
|
|
5250
5902
|
return !safeCallId || safeCallId === "." || safeCallId === ".." ? void 0 : safeCallId;
|
|
5251
5903
|
}
|
|
5252
5904
|
__name(normalizeToolResultCallId, "normalizeToolResultCallId");
|
|
5253
5905
|
async function persistAndTruncateToolResult(callId, toolName, content, config) {
|
|
5254
5906
|
const byteSize = Buffer.byteLength(content, "utf-8");
|
|
5255
5907
|
if (byteSize > MAX_FILE_SIZE_BYTES) {
|
|
5256
|
-
|
|
5908
|
+
debugLogger6.warn(
|
|
5257
5909
|
`Tool result for ${toolName} exceeds ${MAX_FILE_SIZE_BYTES} bytes (${byteSize}), skipping disk persistence`
|
|
5258
5910
|
);
|
|
5259
5911
|
return {
|
|
@@ -5263,7 +5915,7 @@ async function persistAndTruncateToolResult(callId, toolName, content, config) {
|
|
|
5263
5915
|
}
|
|
5264
5916
|
const budgetUsed = config.getToolResultBytesWritten();
|
|
5265
5917
|
if (budgetUsed + byteSize > MAX_SESSION_BYTES) {
|
|
5266
|
-
|
|
5918
|
+
debugLogger6.warn(
|
|
5267
5919
|
`Session tool result budget exhausted (${budgetUsed} + ${byteSize} > ${MAX_SESSION_BYTES}), skipping disk persistence`
|
|
5268
5920
|
);
|
|
5269
5921
|
return {
|
|
@@ -5274,7 +5926,7 @@ async function persistAndTruncateToolResult(callId, toolName, content, config) {
|
|
|
5274
5926
|
config.trackToolResultBytes(byteSize);
|
|
5275
5927
|
const safeCallId = normalizeToolResultCallId(callId);
|
|
5276
5928
|
if (!safeCallId) {
|
|
5277
|
-
|
|
5929
|
+
debugLogger6.warn(
|
|
5278
5930
|
`Invalid callId for disk persistence: ${JSON.stringify(callId)}`
|
|
5279
5931
|
);
|
|
5280
5932
|
config.trackToolResultBytes(-byteSize);
|
|
@@ -5286,10 +5938,10 @@ async function persistAndTruncateToolResult(callId, toolName, content, config) {
|
|
|
5286
5938
|
const outputDirectory = config.getExecutionEnvironment?.()?.outputDirectory;
|
|
5287
5939
|
try {
|
|
5288
5940
|
const toolResultsDir = outputDirectory ?? config.storage.getToolResultsDir();
|
|
5289
|
-
const outputFile =
|
|
5290
|
-
await
|
|
5941
|
+
const outputFile = path9.join(toolResultsDir, `${safeCallId}.txt`);
|
|
5942
|
+
await fs7.mkdir(toolResultsDir, { recursive: true });
|
|
5291
5943
|
if (outputDirectory !== void 0) {
|
|
5292
|
-
await
|
|
5944
|
+
await fs7.writeFile(outputFile, content, { mode: 384, flag: "wx" });
|
|
5293
5945
|
} else {
|
|
5294
5946
|
await atomicWriteFile(outputFile, content, {
|
|
5295
5947
|
mode: 384,
|
|
@@ -5304,7 +5956,7 @@ async function persistAndTruncateToolResult(callId, toolName, content, config) {
|
|
|
5304
5956
|
bytesWritten: byteSize
|
|
5305
5957
|
};
|
|
5306
5958
|
} catch (error) {
|
|
5307
|
-
|
|
5959
|
+
debugLogger6.warn("Failed to persist tool result:", error);
|
|
5308
5960
|
try {
|
|
5309
5961
|
const fallback = await truncateAndSaveToFile(
|
|
5310
5962
|
content,
|
|
@@ -5327,7 +5979,7 @@ async function persistAndTruncateToolResult(callId, toolName, content, config) {
|
|
|
5327
5979
|
return { content: fallback.content, bytesWritten: 0 };
|
|
5328
5980
|
} catch (fallbackError) {
|
|
5329
5981
|
config.trackToolResultBytes(-byteSize);
|
|
5330
|
-
|
|
5982
|
+
debugLogger6.warn("Fallback truncation also failed:", fallbackError);
|
|
5331
5983
|
return {
|
|
5332
5984
|
content: buildStub(content, byteSize, "(disk persistence unavailable)"),
|
|
5333
5985
|
bytesWritten: 0
|
|
@@ -5339,7 +5991,7 @@ __name(persistAndTruncateToolResult, "persistAndTruncateToolResult");
|
|
|
5339
5991
|
function buildStub(content, byteSize, filePathOrNote) {
|
|
5340
5992
|
const preview = generatePreview(content);
|
|
5341
5993
|
const sizeKb = Math.round(byteSize / 1024);
|
|
5342
|
-
const isFilePath =
|
|
5994
|
+
const isFilePath = path9.isAbsolute(filePathOrNote);
|
|
5343
5995
|
const fullDigest = crypto.createHash("sha256").update(content).digest("hex");
|
|
5344
5996
|
if (isFilePath) {
|
|
5345
5997
|
return `<persisted-output>
|
|
@@ -5667,7 +6319,7 @@ function buildMcpClassifierInput(options) {
|
|
|
5667
6319
|
__name(buildMcpClassifierInput, "buildMcpClassifierInput");
|
|
5668
6320
|
|
|
5669
6321
|
// packages/core/src/tools/mcp-tool.ts
|
|
5670
|
-
var
|
|
6322
|
+
var debugLogger7 = createDebugLogger("MCP_TOOL");
|
|
5671
6323
|
var MCP_DEAD_SESSION_ERROR_PATTERN = /session (not found|terminated|expired)/i;
|
|
5672
6324
|
var MCP_CONNECTION_ERROR_PATTERNS = [
|
|
5673
6325
|
/ECONNREFUSED/i,
|
|
@@ -5816,28 +6468,28 @@ var DiscoveredMCPToolInvocation = class _DiscoveredMCPToolInvocation extends Bas
|
|
|
5816
6468
|
return null;
|
|
5817
6469
|
}
|
|
5818
6470
|
try {
|
|
5819
|
-
|
|
6471
|
+
debugLogger7.info(
|
|
5820
6472
|
`Attempting to reconnect MCP server '${this.serverName}'...`
|
|
5821
6473
|
);
|
|
5822
6474
|
const toolRegistry = this.cliConfig.getToolRegistry();
|
|
5823
6475
|
await toolRegistry.discoverToolsForServer(this.serverName);
|
|
5824
6476
|
const newTool = await toolRegistry.ensureTool(this.registeredToolName);
|
|
5825
6477
|
if (newTool instanceof DiscoveredMCPTool) {
|
|
5826
|
-
|
|
6478
|
+
debugLogger7.info(
|
|
5827
6479
|
`Successfully reconnected to MCP server '${this.serverName}'`
|
|
5828
6480
|
);
|
|
5829
6481
|
return newTool;
|
|
5830
6482
|
}
|
|
5831
6483
|
return null;
|
|
5832
6484
|
} catch (error) {
|
|
5833
|
-
|
|
6485
|
+
debugLogger7.error(
|
|
5834
6486
|
`Failed to reconnect MCP server '${this.serverName}': ${error}`
|
|
5835
6487
|
);
|
|
5836
6488
|
return null;
|
|
5837
6489
|
}
|
|
5838
6490
|
}
|
|
5839
6491
|
async handleReconnectOnError(error, signal, updateOutput) {
|
|
5840
|
-
|
|
6492
|
+
debugLogger7.error(`MCP server error '${this.serverName}': ${error}`);
|
|
5841
6493
|
if (signal.aborted) {
|
|
5842
6494
|
throw error;
|
|
5843
6495
|
}
|
|
@@ -5852,7 +6504,7 @@ var DiscoveredMCPToolInvocation = class _DiscoveredMCPToolInvocation extends Bas
|
|
|
5852
6504
|
throw new Error(_DiscoveredMCPToolInvocation.UNSAFE_REPLAY_ERROR_MESSAGE);
|
|
5853
6505
|
}
|
|
5854
6506
|
if (this.retryCount < _DiscoveredMCPToolInvocation.MAX_RECONNECT_RETRIES) {
|
|
5855
|
-
|
|
6507
|
+
debugLogger7.info(
|
|
5856
6508
|
`Reconnection attempt ${this.retryCount + 1}/${_DiscoveredMCPToolInvocation.MAX_RECONNECT_RETRIES} for MCP server '${this.serverName}'`
|
|
5857
6509
|
);
|
|
5858
6510
|
const newTool = await this.attemptReconnect();
|
|
@@ -5884,7 +6536,7 @@ var DiscoveredMCPToolInvocation = class _DiscoveredMCPToolInvocation extends Bas
|
|
|
5884
6536
|
return newInvocation.execute(signal, updateOutput);
|
|
5885
6537
|
}
|
|
5886
6538
|
} else if (this.retryCount >= _DiscoveredMCPToolInvocation.MAX_RECONNECT_RETRIES) {
|
|
5887
|
-
|
|
6539
|
+
debugLogger7.error(
|
|
5888
6540
|
`Max reconnection attempts (${_DiscoveredMCPToolInvocation.MAX_RECONNECT_RETRIES}) reached for MCP server '${this.serverName}'`
|
|
5889
6541
|
);
|
|
5890
6542
|
}
|
|
@@ -6104,7 +6756,7 @@ var DiscoveredMCPToolInvocation = class _DiscoveredMCPToolInvocation extends Bas
|
|
|
6104
6756
|
const cause = getErrorMessage(error);
|
|
6105
6757
|
const reason = timeoutSignal.aborted || error instanceof Error && error.name === "TimeoutError" || isMcpSdkRequestTimeout(error) ? `resource read timed out (limit: ${timeoutMs} ms)` : cause;
|
|
6106
6758
|
const warning = `Warning: MCP App '${this.appResourceUri}' from '${this.serverName}' could not be displayed: ${reason}`;
|
|
6107
|
-
|
|
6759
|
+
debugLogger7.warn(
|
|
6108
6760
|
reason === cause ? warning : `${warning} (cause: ${cause})`
|
|
6109
6761
|
);
|
|
6110
6762
|
return {
|
|
@@ -6543,9 +7195,9 @@ async function boundMcpImageBlocks(rawResponseParts, signal, subject) {
|
|
|
6543
7195
|
}
|
|
6544
7196
|
const message = `Unable to bound MCP image from ${subject} (${media.mimeType}): ${getErrorMessage(error)}`;
|
|
6545
7197
|
if (error.code === "renderer_unavailable") {
|
|
6546
|
-
|
|
7198
|
+
debugLogger7.warn(message);
|
|
6547
7199
|
} else {
|
|
6548
|
-
|
|
7200
|
+
debugLogger7.debug(message);
|
|
6549
7201
|
}
|
|
6550
7202
|
}
|
|
6551
7203
|
if (!bounded || bounded.data === media.data && bounded.mimeType === media.mimeType) {
|
|
@@ -7118,14 +7770,16 @@ var NextSpeakerCheckEvent = class {
|
|
|
7118
7770
|
function makeSlashCommandEvent({
|
|
7119
7771
|
command,
|
|
7120
7772
|
subcommand,
|
|
7121
|
-
status
|
|
7773
|
+
status,
|
|
7774
|
+
built_in
|
|
7122
7775
|
}) {
|
|
7123
7776
|
return {
|
|
7124
7777
|
"event.name": "slash_command",
|
|
7125
7778
|
"event.timestamp": (/* @__PURE__ */ new Date()).toISOString(),
|
|
7126
7779
|
command,
|
|
7127
7780
|
subcommand,
|
|
7128
|
-
status
|
|
7781
|
+
status,
|
|
7782
|
+
...built_in !== void 0 ? { built_in } : {}
|
|
7129
7783
|
};
|
|
7130
7784
|
}
|
|
7131
7785
|
__name(makeSlashCommandEvent, "makeSlashCommandEvent");
|
|
@@ -7905,15 +8559,15 @@ __name(memoryFreshnessNote, "memoryFreshnessNote");
|
|
|
7905
8559
|
|
|
7906
8560
|
// packages/core/src/tools/file-read-permission.ts
|
|
7907
8561
|
init_esbuild_shims();
|
|
7908
|
-
import
|
|
8562
|
+
import path10 from "node:path";
|
|
7909
8563
|
function getFileReadDefaultPermission(config, requestedPath) {
|
|
7910
|
-
const filePath = realpathNearestExisting(
|
|
8564
|
+
const filePath = realpathNearestExisting(path10.resolve(requestedPath));
|
|
7911
8565
|
const workspaceContext = config.getWorkspaceContext();
|
|
7912
8566
|
const allowedRoots = [
|
|
7913
8567
|
config.storage.getProjectTempDir(),
|
|
7914
8568
|
// Background subagent transcripts live under <projectDir>/subagents/ and
|
|
7915
8569
|
// are advertised to the model as polling targets via read_file.
|
|
7916
|
-
|
|
8570
|
+
path10.join(config.storage.getProjectDir(), "subagents"),
|
|
7917
8571
|
Storage.getGlobalTempDir(),
|
|
7918
8572
|
...config.storage.getUserSkillsDirs(),
|
|
7919
8573
|
Storage.getUserExtensionsDir(),
|
|
@@ -7951,7 +8605,7 @@ __name(getFileReadDefaultPermission, "getFileReadDefaultPermission");
|
|
|
7951
8605
|
|
|
7952
8606
|
// packages/core/src/services/visionBridge/vision-bridge-service.ts
|
|
7953
8607
|
init_esbuild_shims();
|
|
7954
|
-
var
|
|
8608
|
+
var debugLogger8 = createDebugLogger("VISION_BRIDGE");
|
|
7955
8609
|
var turnImageCounts = /* @__PURE__ */ new WeakMap();
|
|
7956
8610
|
var BRIDGE_MAX_OUTPUT_TOKENS = 2048;
|
|
7957
8611
|
var VISION_BRIDGE_TIMEOUT_MS = 3e4;
|
|
@@ -8221,7 +8875,7 @@ async function runVisionBridge(params) {
|
|
|
8221
8875
|
try {
|
|
8222
8876
|
timeoutSignal = AbortSignal.timeout(timeoutMs);
|
|
8223
8877
|
combinedSignal = AbortSignal.any([signal, timeoutSignal]);
|
|
8224
|
-
|
|
8878
|
+
debugLogger8.debug(`calling ${modelId} for ${toConvert.length} image(s)`);
|
|
8225
8879
|
const { text } = await runSideQuery(config, {
|
|
8226
8880
|
contents: requestContents,
|
|
8227
8881
|
abortSignal: combinedSignal,
|
|
@@ -8240,7 +8894,7 @@ async function runVisionBridge(params) {
|
|
|
8240
8894
|
});
|
|
8241
8895
|
const description = stripThinkTags(text ?? "");
|
|
8242
8896
|
if (description.length === 0) {
|
|
8243
|
-
|
|
8897
|
+
debugLogger8.warn(`${modelId} returned an empty description`);
|
|
8244
8898
|
return failure(
|
|
8245
8899
|
"the vision model returned no description",
|
|
8246
8900
|
parts,
|
|
@@ -8248,7 +8902,7 @@ async function runVisionBridge(params) {
|
|
|
8248
8902
|
{ modelId, ...egress }
|
|
8249
8903
|
);
|
|
8250
8904
|
}
|
|
8251
|
-
|
|
8905
|
+
debugLogger8.debug(
|
|
8252
8906
|
`vision bridge transcription via ${modelId} (${description.length} chars)`
|
|
8253
8907
|
);
|
|
8254
8908
|
return {
|
|
@@ -8274,7 +8928,7 @@ async function runVisionBridge(params) {
|
|
|
8274
8928
|
};
|
|
8275
8929
|
} catch (error) {
|
|
8276
8930
|
if (signal.aborted) {
|
|
8277
|
-
|
|
8931
|
+
debugLogger8.debug(`conversion cancelled via ${modelId}`);
|
|
8278
8932
|
return {
|
|
8279
8933
|
applied: false,
|
|
8280
8934
|
status: "skipped",
|
|
@@ -8286,13 +8940,13 @@ async function runVisionBridge(params) {
|
|
|
8286
8940
|
}
|
|
8287
8941
|
const timedOut = !!combinedSignal?.aborted && !!timeoutSignal?.aborted;
|
|
8288
8942
|
if (timedOut && attempt < VISION_BRIDGE_MAX_ATTEMPTS) {
|
|
8289
|
-
|
|
8943
|
+
debugLogger8.warn(
|
|
8290
8944
|
`conversion attempt ${attempt} via ${modelId} timed out after ${timeoutMs}ms; retrying`
|
|
8291
8945
|
);
|
|
8292
8946
|
continue;
|
|
8293
8947
|
}
|
|
8294
8948
|
const reason = timedOut ? `timed out after ${timeoutMs}ms (${VISION_BRIDGE_MAX_ATTEMPTS} attempts)` : error instanceof Error ? error.message : String(error);
|
|
8295
|
-
|
|
8949
|
+
debugLogger8.warn(`conversion failed via ${modelId}: ${reason}`);
|
|
8296
8950
|
return failure(reason, parts, omittedCount, {
|
|
8297
8951
|
modelId,
|
|
8298
8952
|
// The timeout message is safe to show; an arbitrary provider error is not
|
|
@@ -8307,7 +8961,7 @@ async function runVisionBridge(params) {
|
|
|
8307
8961
|
__name(runVisionBridge, "runVisionBridge");
|
|
8308
8962
|
|
|
8309
8963
|
// packages/core/src/tools/read-file.ts
|
|
8310
|
-
var
|
|
8964
|
+
var debugLogger9 = createDebugLogger("READ_FILE_CACHE");
|
|
8311
8965
|
var ReadFileToolInvocation = class extends BaseToolInvocation {
|
|
8312
8966
|
constructor(config, params) {
|
|
8313
8967
|
super(params);
|
|
@@ -8351,7 +9005,7 @@ var ReadFileToolInvocation = class extends BaseToolInvocation {
|
|
|
8351
9005
|
);
|
|
8352
9006
|
}
|
|
8353
9007
|
async execute(signal) {
|
|
8354
|
-
const absPath =
|
|
9008
|
+
const absPath = path11.resolve(this.params.file_path);
|
|
8355
9009
|
const projectRoot = this.config.getTargetDir();
|
|
8356
9010
|
const isAutoMem = isAnyAutoMemPath(absPath, projectRoot);
|
|
8357
9011
|
const cacheEnabled = !this.config.getFileReadCacheDisabled();
|
|
@@ -8361,9 +9015,9 @@ var ReadFileToolInvocation = class extends BaseToolInvocation {
|
|
|
8361
9015
|
const isFullRead = this.params.offset === void 0 && this.params.limit === void 0 && this.params.pages === void 0;
|
|
8362
9016
|
let stats;
|
|
8363
9017
|
try {
|
|
8364
|
-
stats = await
|
|
9018
|
+
stats = await fs8.stat(absPath);
|
|
8365
9019
|
} catch (err) {
|
|
8366
|
-
|
|
9020
|
+
debugLogger9.debug("stat-failed", {
|
|
8367
9021
|
path: absPath,
|
|
8368
9022
|
code: err.code
|
|
8369
9023
|
});
|
|
@@ -8373,10 +9027,10 @@ var ReadFileToolInvocation = class extends BaseToolInvocation {
|
|
|
8373
9027
|
if (status.state === "fresh" && status.entry.lastReadAt !== void 0 && status.entry.lastReadWasFull && status.entry.lastReadCacheable && // Only quote-back if that read is still in history (idle
|
|
8374
9028
|
// microcompaction flips this off when it blanks it).
|
|
8375
9029
|
status.entry.readResidentInHistory && (status.entry.lastWriteAt === void 0 || status.entry.lastReadAt > status.entry.lastWriteAt)) {
|
|
8376
|
-
|
|
9030
|
+
debugLogger9.debug("hit", { path: absPath });
|
|
8377
9031
|
return this.unchangedResult(absPath);
|
|
8378
9032
|
}
|
|
8379
|
-
|
|
9033
|
+
debugLogger9.debug("miss", { path: absPath, state: status.state });
|
|
8380
9034
|
}
|
|
8381
9035
|
const prepareForVisionBridge = shouldRunVisionBridge(this.config);
|
|
8382
9036
|
let result = await processSingleFileContent(
|
|
@@ -8415,10 +9069,10 @@ var ReadFileToolInvocation = class extends BaseToolInvocation {
|
|
|
8415
9069
|
}
|
|
8416
9070
|
let llmContent;
|
|
8417
9071
|
if (result.isTruncated && result.linesShown && result.originalLineCount !== void 0) {
|
|
8418
|
-
const [
|
|
9072
|
+
const [start2, end] = result.linesShown;
|
|
8419
9073
|
const total = result.originalLineCount;
|
|
8420
9074
|
const totalLabel = result.originalLineCountExact === false ? `at least ${total}` : total;
|
|
8421
|
-
llmContent = `Showing lines ${
|
|
9075
|
+
llmContent = `Showing lines ${start2}-${end} of ${totalLabel} total lines.
|
|
8422
9076
|
|
|
8423
9077
|
---
|
|
8424
9078
|
|
|
@@ -8428,7 +9082,7 @@ ${result.llmContent}`;
|
|
|
8428
9082
|
}
|
|
8429
9083
|
if (typeof llmContent === "string" && isAutoMem) {
|
|
8430
9084
|
try {
|
|
8431
|
-
const memStat = stats ?? await
|
|
9085
|
+
const memStat = stats ?? await fs8.stat(absPath);
|
|
8432
9086
|
const note = memoryFreshnessNote(memStat.mtimeMs);
|
|
8433
9087
|
if (note) {
|
|
8434
9088
|
llmContent = note + llmContent;
|
|
@@ -8448,7 +9102,7 @@ ${result.llmContent}`;
|
|
|
8448
9102
|
"read" /* READ */,
|
|
8449
9103
|
lines,
|
|
8450
9104
|
mimetype,
|
|
8451
|
-
|
|
9105
|
+
path11.extname(this.params.file_path),
|
|
8452
9106
|
programming_language
|
|
8453
9107
|
)
|
|
8454
9108
|
);
|
|
@@ -8462,7 +9116,7 @@ ${result.llmContent}`;
|
|
|
8462
9116
|
if (!candidate) return result;
|
|
8463
9117
|
const { imageParts } = splitImageParts(result.llmContent);
|
|
8464
9118
|
if (imageParts.length === 0 || !hasImageParts(imageParts)) {
|
|
8465
|
-
|
|
9119
|
+
debugLogger9.debug("pdf vision bridge candidate contained no images");
|
|
8466
9120
|
return this.restorePdfFallback(result, "Vision bridge could not run.");
|
|
8467
9121
|
}
|
|
8468
9122
|
const sourceContext = {
|
|
@@ -8483,7 +9137,7 @@ ${result.llmContent}`;
|
|
|
8483
9137
|
const notice = formatVisionBridgeNotice(bridgeResult);
|
|
8484
9138
|
if (bridgeResult.status === "ok" && bridgeResult.applied && bridgeResult.parts != null) {
|
|
8485
9139
|
if (bridgeResult.convertedCount !== imageParts.length || bridgeResult.omittedCount !== 0) {
|
|
8486
|
-
|
|
9140
|
+
debugLogger9.debug("pdf vision bridge omitted candidate pages");
|
|
8487
9141
|
return this.restorePdfFallback(
|
|
8488
9142
|
result,
|
|
8489
9143
|
`${notice} The transcription was discarded because the bridge did not transcribe every rendered PDF page.`
|
|
@@ -8493,7 +9147,7 @@ ${result.llmContent}`;
|
|
|
8493
9147
|
if (bridgedParts.some(
|
|
8494
9148
|
(part) => part.inlineData != null || part.fileData != null
|
|
8495
9149
|
)) {
|
|
8496
|
-
|
|
9150
|
+
debugLogger9.debug("pdf vision bridge returned media data");
|
|
8497
9151
|
return this.restorePdfFallback(
|
|
8498
9152
|
result,
|
|
8499
9153
|
`${notice} The transcription was discarded because the bridge returned an unsafe media payload.`
|
|
@@ -8527,7 +9181,7 @@ ${result.llmContent}`;
|
|
|
8527
9181
|
);
|
|
8528
9182
|
} catch (error) {
|
|
8529
9183
|
signal.throwIfAborted();
|
|
8530
|
-
|
|
9184
|
+
debugLogger9.debug(
|
|
8531
9185
|
`pdf vision bridge failed before replacement: ${String(error instanceof Error ? error.message : error)}`
|
|
8532
9186
|
);
|
|
8533
9187
|
return this.restorePdfFallback(
|
|
@@ -8686,7 +9340,7 @@ var ReadFileTool = class _ReadFileTool extends BaseDeclarativeTool {
|
|
|
8686
9340
|
if (!filePath) {
|
|
8687
9341
|
return "The 'file_path' parameter must be non-empty.";
|
|
8688
9342
|
}
|
|
8689
|
-
if (!
|
|
9343
|
+
if (!path11.isAbsolute(filePath)) {
|
|
8690
9344
|
return `File path must be absolute, but was relative: ${filePath}. You must provide an absolute path.`;
|
|
8691
9345
|
}
|
|
8692
9346
|
params.offset ??= void 0;
|
|
@@ -8696,7 +9350,7 @@ var ReadFileTool = class _ReadFileTool extends BaseDeclarativeTool {
|
|
|
8696
9350
|
const pages = params.pages.trim();
|
|
8697
9351
|
params.pages = pages.length > 0 ? pages : void 0;
|
|
8698
9352
|
}
|
|
8699
|
-
if (
|
|
9353
|
+
if (path11.extname(filePath).toLowerCase() === ".ipynb" && (params.offset !== void 0 || params.limit !== void 0 || params.pages !== void 0)) {
|
|
8700
9354
|
return `For Jupyter notebooks (.ipynb), omit 'offset', 'limit', and 'pages' or set them to null. Retry with: ${JSON.stringify({ file_path: filePath, offset: null, limit: null, pages: null })}`;
|
|
8701
9355
|
}
|
|
8702
9356
|
if (params.offset !== void 0 && (!Number.isInteger(params.offset) || params.offset < 0)) {
|
|
@@ -8732,6 +9386,8 @@ var ReadFileTool = class _ReadFileTool extends BaseDeclarativeTool {
|
|
|
8732
9386
|
export {
|
|
8733
9387
|
isInternalPromptId,
|
|
8734
9388
|
import_lru_cache,
|
|
9389
|
+
startProductTelemetry,
|
|
9390
|
+
recordErrorReport,
|
|
8735
9391
|
MAIN_SOURCE,
|
|
8736
9392
|
subagentNameContext,
|
|
8737
9393
|
subagentIdentityContext,
|
|
@@ -8920,6 +9576,11 @@ export {
|
|
|
8920
9576
|
* Modified by the o1-code project; see NOTICE.
|
|
8921
9577
|
* SPDX-License-Identifier: Apache-2.0
|
|
8922
9578
|
*/
|
|
9579
|
+
/**
|
|
9580
|
+
* @license
|
|
9581
|
+
* Copyright 2026 o1-code contributors
|
|
9582
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
9583
|
+
*/
|
|
8923
9584
|
/**
|
|
8924
9585
|
* @license
|
|
8925
9586
|
* Copyright 2025 Qwen
|