@organizaone/o1-code 0.23.7 → 0.24.1
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-BXQ56OHB.js → MaxSizedBox-JUE7AN5O.js} +19 -20
- package/chunks/{StandaloneSessionPicker-LCDWLKAV.js → StandaloneSessionPicker-EGDEYT2U.js} +35 -36
- package/chunks/{acp-subagent-executor-LUPWNWYD.js → acp-subagent-executor-KOETDTUM.js} +22 -23
- package/chunks/{acpAgent-ZSNF2LCM.js → acpAgent-Q7J25YEX.js} +63 -64
- package/chunks/{agent-ZS3ADJ2D.js → agent-SJVWM65X.js} +9 -10
- package/chunks/{agent-headless-IDLMEL6W.js → agent-headless-AQ5GYATY.js} +9 -10
- package/chunks/{all-providers-TF7NQHNH.js → all-providers-HQGDR2UU.js} +2 -2
- package/chunks/{anthropicContentGenerator-3UIWKSPG.js → anthropicContentGenerator-6WL3OPRM.js} +4 -4
- package/chunks/{bridge-LEPPA76I.js → bridge-CKLXFBFO.js} +22 -23
- package/chunks/{ca-RHSADBKV.js → ca-KPICWCC2.js} +1 -0
- package/chunks/{chunk-3FDAQK6P.js → chunk-24JZFOGF.js} +1 -1
- package/chunks/{chunk-ZIWHK3AH.js → chunk-2QTODZDM.js} +1 -1
- package/chunks/{chunk-OXDMRAEV.js → chunk-3UDTZ4QA.js} +2 -2
- package/chunks/{chunk-GKCNGTE2.js → chunk-44NOS72H.js} +9 -9
- package/chunks/{chunk-YNT3YSIS.js → chunk-4FLYZRW3.js} +1 -1
- package/chunks/{chunk-TASQRFKT.js → chunk-4LFT4NVB.js} +1 -1
- package/chunks/{chunk-HJVTYCF2.js → chunk-4N6EIB5X.js} +2 -2
- package/chunks/{chunk-HNPM45HT.js → chunk-5FVOGSY2.js} +2 -2
- package/chunks/{chunk-NIG4VQN5.js → chunk-5HAMXURT.js} +6 -6
- package/chunks/{chunk-43DWX3LS.js → chunk-5WBDANRD.js} +1 -1
- package/chunks/{chunk-5VPNGZME.js → chunk-5ZFGB5G3.js} +3 -3
- package/chunks/{chunk-DLAN74GT.js → chunk-625WQALT.js} +32 -31
- package/chunks/{chunk-OCDWTRWE.js → chunk-64TMTR36.js} +54 -49
- package/chunks/{chunk-Z6NGAKJH.js → chunk-7DOA7QOG.js} +9 -9
- package/chunks/{chunk-WMMHPXPA.js → chunk-7TZUSRNH.js} +1 -1
- package/chunks/{chunk-MSHM2PZY.js → chunk-A4MAK6EY.js} +4 -4
- package/chunks/{chunk-J3XHQO43.js → chunk-A5S4E4AK.js} +2 -2
- package/chunks/{chunk-MKQJ3CNK.js → chunk-ANJNQXM6.js} +1 -1
- package/chunks/{chunk-VHFRYVQX.js → chunk-AT6EKSBQ.js} +3 -3
- package/chunks/{chunk-NMM3L6WG.js → chunk-BXBA2L7B.js} +2 -2
- package/chunks/{chunk-DTDLKYCP.js → chunk-CBWLFKEC.js} +2 -2
- package/chunks/{chunk-EZEMEYB7.js → chunk-CCRYAEPQ.js} +1 -1
- package/chunks/{chunk-73TNKZZ7.js → chunk-CSH5VE3R.js} +5 -5
- package/chunks/{chunk-ETYF6LYZ.js → chunk-D577R5HO.js} +1 -1
- package/chunks/{chunk-E3ZE65KW.js → chunk-DHWWOTCC.js} +2 -2
- package/chunks/{chunk-6URUHYXE.js → chunk-DYSQET5Y.js} +1 -1
- package/chunks/{chunk-DTP3IFRF.js → chunk-EUYI5X7G.js} +2 -2
- package/chunks/{chunk-GBADIYGO.js → chunk-FDFDX4HK.js} +6 -6
- package/chunks/{chunk-2WUJEKZI.js → chunk-GAXMXTCZ.js} +4 -4
- package/chunks/{chunk-W4M3H7ZI.js → chunk-GCYOMQC3.js} +8 -8
- package/chunks/{chunk-FVUSJHN6.js → chunk-GJ6AVZ7R.js} +1 -1
- package/chunks/{chunk-Y4TLV2RS.js → chunk-GR257V6A.js} +1 -1
- package/chunks/{chunk-PZ5JMLBW.js → chunk-H3PTYTMN.js} +1 -1
- package/chunks/{chunk-MPVVI5RG.js → chunk-HAYNWRSX.js} +12 -3
- package/chunks/{chunk-3UQZTJY2.js → chunk-HSNEZI4X.js} +3 -3
- package/chunks/{chunk-TTPJNZQS.js → chunk-I7Q6RNJU.js} +10 -10
- package/chunks/{chunk-NE477YZY.js → chunk-IAKOJTHE.js} +4 -4
- package/chunks/{chunk-QQXXDTSU.js → chunk-ITR62CFE.js} +1 -1
- package/chunks/{chunk-J5GJ6CVK.js → chunk-IU5KVY54.js} +2 -2
- package/chunks/{chunk-YHFQFZTE.js → chunk-JCSXUHSJ.js} +2 -2
- package/chunks/{chunk-BKVFDRVW.js → chunk-JEVFP7CP.js} +2 -2
- package/chunks/{chunk-2AZH43LV.js → chunk-JOVKPGDM.js} +15 -15
- package/chunks/{chunk-3Q5NJK2H.js → chunk-JWPJC4EJ.js} +2 -2
- package/chunks/{chunk-YRHLAX66.js → chunk-KQSXSDFO.js} +5 -5
- package/chunks/{chunk-F44SBW26.js → chunk-LJON63UO.js} +3 -3
- package/chunks/{chunk-YZKJKFMT.js → chunk-M2JDFMHG.js} +4 -4
- package/chunks/{chunk-UQ4P6TIG.js → chunk-M7OC3HMR.js} +4 -4
- package/chunks/{chunk-QJQC3W4S.js → chunk-MFXQ6KYO.js} +7 -7
- package/chunks/{chunk-ABKDBRTP.js → chunk-MFY34ETV.js} +2 -2
- package/chunks/{chunk-S4YN7PFJ.js → chunk-MX5I67EM.js} +1 -1
- package/chunks/{chunk-MOXEZBI7.js → chunk-N5GTQYT2.js} +3 -3
- package/chunks/{chunk-TNGQXT4E.js → chunk-N5XAHYZS.js} +1 -1
- package/chunks/{chunk-WWXQKLXJ.js → chunk-NMI3ER6Z.js} +3 -3
- package/chunks/{chunk-BMOQVERM.js → chunk-NOFVNBDD.js} +8 -8
- package/chunks/{chunk-3GDJLUJE.js → chunk-NUTLWNRS.js} +2 -2
- package/chunks/{chunk-AE4IQ5HU.js → chunk-NWF6SWFE.js} +1 -1
- package/chunks/{chunk-BZYI5TLI.js → chunk-OC2DXKDN.js} +859 -104
- package/chunks/{chunk-VB5IBL4S.js → chunk-ON5CGP6B.js} +1 -1
- package/chunks/{chunk-3ZVLHRJD.js → chunk-OS6PGLH4.js} +8 -8
- package/chunks/{chunk-BLVVCAQN.js → chunk-OZKBIDX2.js} +3 -3
- package/chunks/{chunk-VIKOU7KJ.js → chunk-PFFIQARX.js} +1 -1
- package/chunks/{chunk-NC2JRBIE.js → chunk-PJ5H2OLL.js} +5 -5
- package/chunks/{chunk-AVTSXQWG.js → chunk-PWJEVP33.js} +3 -3
- package/chunks/{chunk-DUCBYXWN.js → chunk-Q4ETZXNU.js} +1 -1
- package/chunks/{chunk-ZNHWOYCK.js → chunk-QGLXLZ4T.js} +3 -3
- package/chunks/{chunk-44ZNNSEB.js → chunk-QJLOQHNR.js} +1 -1
- package/chunks/{chunk-EDQ4IWEX.js → chunk-QONPVMO3.js} +3 -3
- package/chunks/{chunk-ZWHRDEZE.js → chunk-R2YW7IAP.js} +14 -14
- package/chunks/{chunk-BU647CQQ.js → chunk-R47UDQHX.js} +3 -3
- package/chunks/{chunk-G4G7DDKY.js → chunk-RFGNMDMO.js} +4 -4
- package/chunks/{chunk-7FBTF3CT.js → chunk-SAK266DQ.js} +3 -3
- package/chunks/{chunk-JC5HI23Y.js → chunk-SNMOTR7M.js} +1 -1
- package/chunks/{chunk-OT4MAS36.js → chunk-TMTXQEWX.js} +1 -1
- package/chunks/{chunk-QPGYYXO7.js → chunk-TPTY2WGR.js} +1 -1
- package/chunks/{chunk-BG3SPZSP.js → chunk-TQCDV7DK.js} +1 -1
- package/chunks/{chunk-ERSN5QKS.js → chunk-TTWXEGXU.js} +1 -1
- package/chunks/{chunk-TW5NHCUA.js → chunk-TUXWUAX2.js} +1 -1
- package/chunks/{chunk-IVNAIMHU.js → chunk-TZ3QEIHZ.js} +1 -1
- package/chunks/{chunk-X3BWZ7EF.js → chunk-UAEX2532.js} +1 -1
- package/chunks/{chunk-AAG4WBEP.js → chunk-ULLCJNT5.js} +1 -1
- package/chunks/{chunk-42VEHTHT.js → chunk-UV4FX6AT.js} +7 -7
- package/chunks/{chunk-KDZDHXCJ.js → chunk-V3VP7H5X.js} +1 -1
- package/chunks/{chunk-I3WMIOFE.js → chunk-VYHNPLXB.js} +3 -3
- package/chunks/{chunk-CO2JL5AL.js → chunk-WDLPXQ7N.js} +5 -5
- package/chunks/{chunk-HNWFD72U.js → chunk-XDQH64W3.js} +1 -1
- package/chunks/{chunk-EODYFMXZ.js → chunk-XTILHTVF.js} +4 -4
- package/chunks/{chunk-B64VIQFW.js → chunk-Y55PFJ3S.js} +1 -1
- package/chunks/{chunk-BC2FTHHH.js → chunk-Y7C4IFYL.js} +2 -2
- package/chunks/{chunk-AYAMG53P.js → chunk-YAFSZS33.js} +3 -3
- package/chunks/{chunk-L3TJBZEJ.js → chunk-YCVBONIB.js} +3 -3
- package/chunks/{chunk-WFKIJ54M.js → chunk-YHMLFQL2.js} +3 -3
- package/chunks/{chunk-QOSTRR2Z.js → chunk-YZH3YCEL.js} +31 -31
- package/chunks/{codex-subagent-executor-WSLUCLAZ.js → codex-subagent-executor-LIVQVYHU.js} +22 -23
- package/chunks/{contextCommand-IMIFTC7A.js → contextCommand-JHFE7I64.js} +21 -22
- package/chunks/{core-runtime-6YBHTD2J.js → core-runtime-KFRRS5MM.js} +19 -20
- package/chunks/{create-sub-session-XI2UEH5B.js → create-sub-session-RAQ6JFQA.js} +20 -21
- package/chunks/{daemon-git-worktree-guard-OUE2NSLS.js → daemon-git-worktree-guard-4I7JYK7G.js} +19 -20
- package/chunks/{daemon-status-provider-KJCQTFIQ.js → daemon-status-provider-C3ZNFST5.js} +27 -28
- package/chunks/{daemon-trust-policy-7S45P23Q.js → daemon-trust-policy-HNYILCKU.js} +25 -26
- package/chunks/{daemon-trust-policy-monitor-ASXO23Q3.js → daemon-trust-policy-monitor-FN6AYO4H.js} +25 -26
- package/chunks/{de-SJHLEQC4.js → de-XOVGUB4E.js} +1 -0
- package/chunks/{deferred-core-runtime-77HSACAQ.js → deferred-core-runtime-AFHFYL4R.js} +19 -20
- package/chunks/{edit-G3K6XWRW.js → edit-4UMU3AJK.js} +11 -12
- package/chunks/{en-SCNZTNL5.js → en-ZRJL6ZFP.js} +1 -0
- package/chunks/{enterPlanMode-NXD7O7ER.js → enterPlanMode-USYCYARF.js} +9 -10
- package/chunks/{environment-XP4U66E3.js → environment-LZRKLG3V.js} +21 -22
- package/chunks/{errors-F7GGCK64.js → errors-ZFZHMGNS.js} +21 -22
- package/chunks/{execution-tool-4RBSB4JX.js → execution-tool-Q3AEDCVO.js} +11 -12
- package/chunks/{execution-worker-NLHA6ZJ6.js → execution-worker-UTDTOCNA.js} +14 -15
- package/chunks/{exitPlanMode-WBFOVR63.js → exitPlanMode-I4LORC2K.js} +9 -10
- package/chunks/{fast-path-QC3QMYCX.js → fast-path-6ARCKISC.js} +2 -2
- package/chunks/{foreground-runner-O736DXRF.js → foreground-runner-V4IQPE6M.js} +21 -22
- package/chunks/{fr-AKEMVHLD.js → fr-5BYN3TTH.js} +1 -0
- package/chunks/{gateway-models-USCRP4I6.js → gateway-models-3CWUD6HY.js} +3 -3
- package/chunks/{glob-ZGV4M2NQ.js → glob-7OLHI2XC.js} +9 -10
- package/chunks/{goal-tools-MCJXZSE6.js → goal-tools-AXIIGJBI.js} +9 -10
- package/chunks/{handleAutoUpdate-T4YZJ62S.js → handleAutoUpdate-ANNVZXBP.js} +22 -23
- package/chunks/{i18n-UWE3SKQE.js → i18n-LBKQZMLM.js} +20 -21
- package/chunks/{initializer-GC4EBYFN.js → initializer-RWCAZUIL.js} +25 -26
- package/chunks/{installationInfo-HGRFTVA4.js → installationInfo-XTKS5KNV.js} +19 -20
- package/chunks/{ja-P2B6FRH4.js → ja-YPJM4227.js} +1 -0
- package/chunks/{list-UG4P4HPX.js → list-DX2XZHPQ.js} +27 -28
- package/chunks/{llm-EXO6YG3E.js → llm-DGMP4H5J.js} +58 -52
- package/chunks/{llm-content-generator-AXPPZWD5.js → llm-content-generator-TYMGV3GH.js} +5 -18
- package/chunks/{loadedSettingsAdapter-TIDSA266.js → loadedSettingsAdapter-FSRON2NR.js} +25 -26
- package/chunks/{local-execution-environment-P5RKGY27.js → local-execution-environment-Z6F2MDXK.js} +14 -15
- package/chunks/{loggingContentGenerator-KPW6OXQK.js → loggingContentGenerator-TLOQ6EGV.js} +10 -11
- package/chunks/{managed-npm-update-IN5USSZV.js → managed-npm-update-YCUEV2OO.js} +19 -20
- package/chunks/{mcp-7H53UZSK.js → mcp-BH4M2GFR.js} +25 -26
- package/chunks/{model-call-collection-DHJZSHCM.js → model-call-collection-SYUSBSSI.js} +1 -1
- package/chunks/{model-configuration-Z76ZVIYW.js → model-configuration-EN7ZD4D6.js} +26 -27
- package/chunks/{modelConfigUtils-XE45AJR3.js → modelConfigUtils-HTZWCLRS.js} +21 -22
- package/chunks/{monitor-M57OIWJS.js → monitor-PYFV5DRY.js} +9 -10
- package/chunks/{nonInteractiveCli-EEICOQH5.js → nonInteractiveCli-3MBM57AG.js} +54 -55
- package/chunks/{nonInteractiveToolExecutor-PPGCZQTJ.js → nonInteractiveToolExecutor-5ZNIHMTU.js} +10 -11
- package/chunks/{notebook-edit-W2EO5H6U.js → notebook-edit-LLHUKCYZ.js} +10 -11
- package/chunks/{omni-KTIUU6YS.js → omni-NY5I7RGG.js} +8 -8
- package/chunks/{openaiContentGenerator-VUWCRPKT.js → openaiContentGenerator-L246HBFZ.js} +6 -7
- package/chunks/{openaiResponsesContentGenerator-2MTX7EI2.js → openaiResponsesContentGenerator-E7X4A52Q.js} +3 -3
- package/chunks/{processUtils-WGT2G4ED.js → processUtils-QZXMMKTS.js} +2 -2
- package/chunks/{prompt-terminal-ledger-I44I7SB7.js → prompt-terminal-ledger-N44JSCGK.js} +20 -21
- package/chunks/{pt-H7MSZRJN.js → pt-2EWDZAFN.js} +3 -1
- package/chunks/{reactive-degrade-VA5RY766.js → reactive-degrade-SYWXCBPY.js} +7 -7
- package/chunks/{read-file-O4NSTJ5M.js → read-file-H2MLIZKK.js} +2 -3
- package/chunks/{resumeHistoryUtils-G2TQNJKJ.js → resumeHistoryUtils-2V76Z5KB.js} +23 -24
- package/chunks/{ripGrep-R4TY6XBE.js → ripGrep-HDYHSDZ6.js} +3 -4
- package/chunks/{ru-MA3PS5E7.js → ru-5OPL2N6C.js} +1 -0
- package/chunks/{run-o1-code-serve-LRXKSNJN.js → run-o1-code-serve-K2TTED7A.js} +32 -32
- package/chunks/{sandboxConfig-INUH3TRL.js → sandboxConfig-XSG6EELW.js} +19 -20
- package/chunks/{scheduled-tasks-ALTCZVCI.js → scheduled-tasks-OJQCW7QC.js} +25 -26
- package/chunks/{scheduler-UFO55AL3.js → scheduler-X4AQOMTA.js} +21 -22
- package/chunks/{serve-A523B3LA.js → serve-APMPAWVN.js} +25 -26
- package/chunks/{server-DUUDQTUI.js → server-XCCWKHVG.js} +55 -56
- package/chunks/{session-7WM4H7Y5.js → session-Z4LKYHXT.js} +1 -1
- package/chunks/{session-C2ZDGLLM.js → session-ZOWEYMOT.js} +55 -56
- package/chunks/{session-attachments-root-BXYWB3GP.js → session-attachments-root-WED4KGS5.js} +19 -20
- package/chunks/{session-pr-refresh-BLWUEXUJ.js → session-pr-refresh-M7FUCTOR.js} +24 -25
- package/chunks/{settings-CLE2CVBA.js → settings-BBD7K7XJ.js} +24 -25
- package/chunks/{shell-B3HBJRD7.js → shell-VGZEUDDZ.js} +9 -10
- package/chunks/{skill-CQ5CARNB.js → skill-ARHLWQTO.js} +3 -4
- package/chunks/{skill-settings-42OHK6DX.js → skill-settings-ZYQIDX5T.js} +25 -26
- package/chunks/{spawnChannel-DTJ7QSBS.js → spawnChannel-B5VCHMDT.js} +21 -22
- package/chunks/{standalone-update-UDXISXMD.js → standalone-update-53GZRRS7.js} +21 -22
- package/chunks/{startInteractiveUI-CZ64N2WM.js → startInteractiveUI-I3AXSUX4.js} +67 -66
- package/chunks/{supervisor-runner-6RT77XOK.js → supervisor-runner-WMJMMH7B.js} +2 -2
- package/chunks/{team-create-QKUJUUCO.js → team-create-QQMSLTSH.js} +9 -10
- package/chunks/{team-plan-approval-KEN7GOOR.js → team-plan-approval-WXEWB7ZD.js} +9 -10
- package/chunks/{terminal-image-renderer-SFY6W6UP.js → terminal-image-renderer-5S4XNC2E.js} +19 -20
- package/chunks/{theme-manager-BER77QRF.js → theme-manager-T4UEEZQH.js} +19 -20
- package/chunks/{tool-result-media-NOQ4ZGMG.js → tool-result-media-7NJI64FV.js} +8 -8
- package/chunks/{tool-search-7L5TZVTJ.js → tool-search-NW7CI6HU.js} +2 -3
- package/chunks/{total-session-admission-M4YG6VHY.js → total-session-admission-YB7CXZUJ.js} +22 -23
- package/chunks/{trustedFolders-2F7HBDMR.js → trustedFolders-Q7GHIJMR.js} +20 -21
- package/chunks/{update-relaunch-OVW3GK72.js → update-relaunch-FFYBBOH3.js} +5 -5
- package/chunks/{updateCheck-IW4U2JTK.js → updateCheck-3FD3P55H.js} +21 -22
- package/chunks/{upload-config-QS4G6MDZ.js → upload-config-OIQJCEDX.js} +5 -5
- package/chunks/{useAutoAcceptIndicator-WCC5LHMQ.js → useAutoAcceptIndicator-IOOX75OV.js} +27 -28
- package/chunks/{validateNonInterActiveAuth-PPHCNWWG.js → validateNonInterActiveAuth-B6L3CTOH.js} +51 -52
- package/chunks/{version-HGRPDP4L.js → version-G2KH24ZB.js} +1 -1
- package/chunks/{web-fetch-RNGBZVEK.js → web-fetch-33MPG73P.js} +2 -3
- package/chunks/{web-search-DIIGZERV.js → web-search-QD3XZJCI.js} +5 -5
- package/chunks/{workflow-OZAAOJVQ.js → workflow-PMFKUBLU.js} +10 -11
- package/chunks/{workspace-providers-status-N7CLRLEI.js → workspace-providers-status-JTFKILCF.js} +31 -32
- package/chunks/{workspace-registration-store-R5XLHG6Q.js → workspace-registration-store-DK6JRPRN.js} +1 -1
- package/chunks/{workspace-registry-ZLRKQ4CP.js → workspace-registry-RKP3R4QL.js} +22 -23
- package/chunks/{workspace-runtime-coordinator-WJY7XQH3.js → workspace-runtime-coordinator-HCG7GKE7.js} +23 -24
- package/chunks/{workspace-service-M6UTCUYN.js → workspace-service-NIG6V2VB.js} +29 -30
- package/chunks/{workspace-skills-status-NR5VTA2Q.js → workspace-skills-status-MHICX25B.js} +28 -29
- package/chunks/{workspace-trust-reconciler-RKU2Y5PV.js → workspace-trust-reconciler-2WGJMSJC.js} +28 -29
- package/chunks/{write-file-QADVABJ7.js → write-file-NEC4ZQBA.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-2TREG5CM.js → zoom-image-YBBP43UF.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 +1 -0
- package/locales/fr.js +1 -0
- package/locales/ja.js +1 -0
- package/locales/pt.js +5 -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 +10 -0
- package/web-shell/assets/{abnfDiagram-VCTEODGH-jXpRQ1sA.js → abnfDiagram-VCTEODGH-B-CPrsCN.js} +1 -1
- package/web-shell/assets/{arc-CCu1SpHx.js → arc-B0hBX2Kr.js} +1 -1
- package/web-shell/assets/{architectureDiagram-5GKGNRK7-BMhcLS-3.js → architectureDiagram-5GKGNRK7-BkYs9b3a.js} +1 -1
- package/web-shell/assets/{blockDiagram-NRAW4CY4-BLztJuNT.js → blockDiagram-NRAW4CY4-5qNPOqrd.js} +1 -1
- package/web-shell/assets/{c4Diagram-UCG6FXSJ-O1-hcLyv.js → c4Diagram-UCG6FXSJ-BTsLlHJT.js} +1 -1
- package/web-shell/assets/channel-D0RLApsa.js +1 -0
- package/web-shell/assets/{chunk-2Q5K7J3B-DHs-Y-bn.js → chunk-2Q5K7J3B-CsYhWEfU.js} +1 -1
- package/web-shell/assets/{chunk-5VM5RSS4-Ts6Uck0e.js → chunk-5VM5RSS4-CX8b0AIR.js} +1 -1
- package/web-shell/assets/{chunk-F27PBJKO-B0R0rvst.js → chunk-F27PBJKO-F5t7a-0z.js} +1 -1
- package/web-shell/assets/{chunk-G27WJ6UU-BrhjeHGB.js → chunk-G27WJ6UU-Ch_4TR6Z.js} +1 -1
- package/web-shell/assets/{chunk-JWPE2WC7-CljVOENh.js → chunk-JWPE2WC7-DA0n9YR7.js} +1 -1
- package/web-shell/assets/{chunk-LCL6LL3I-B9WlKQFG.js → chunk-LCL6LL3I-BjnJGiHU.js} +1 -1
- package/web-shell/assets/{chunk-POPQ4Y6H-17MaIMC0.js → chunk-POPQ4Y6H-CDqp-di0.js} +1 -1
- package/web-shell/assets/{chunk-SVP7TREG-zmvc3tFq.js → chunk-SVP7TREG-CS4TODUv.js} +1 -1
- package/web-shell/assets/{chunk-XXDRQBXY-BwcjXD9N.js → chunk-XXDRQBXY-CqcFPaH7.js} +1 -1
- package/web-shell/assets/classDiagram-DTDB5LWJ-CIZMEi2v.js +1 -0
- package/web-shell/assets/classDiagram-v2-JRS7N3AN-CIZMEi2v.js +1 -0
- package/web-shell/assets/{cose-bilkent-JH36ORCC--Xvh2ZfH.js → cose-bilkent-JH36ORCC-D3i06ApS.js} +1 -1
- package/web-shell/assets/{cynefin-OW5HDTMX-7_LWRJpB.js → cynefin-OW5HDTMX-DPzQQ5CU.js} +1 -1
- package/web-shell/assets/{cynefinDiagram-5FMLGOSQ-ixzvH2Op.js → cynefinDiagram-5FMLGOSQ-DbCXa2CF.js} +1 -1
- package/web-shell/assets/{dagre-3AP2YEHR-dgEYDbq2.js → dagre-3AP2YEHR-Bo4LMhTz.js} +1 -1
- package/web-shell/assets/{diagram-S7CK7UJ4-mZn9BVw4.js → diagram-S7CK7UJ4-CI6jPH1K.js} +1 -1
- package/web-shell/assets/{diagram-UQ7AKVKN-D8n_8LYD.js → diagram-UQ7AKVKN-C7v9zemW.js} +1 -1
- package/web-shell/assets/{diagram-VSXAHHWV-Crbeo8Ib.js → diagram-VSXAHHWV-CKkbQ1hi.js} +1 -1
- package/web-shell/assets/{diagram-VX7I27RA-pyfHMm-9.js → diagram-VX7I27RA-DHm-ydFa.js} +1 -1
- package/web-shell/assets/{diagram-Z3DM3KII-Bd54CjUM.js → diagram-Z3DM3KII-D2pPInUe.js} +1 -1
- package/web-shell/assets/{ebnfDiagram-PWID7BFC-B7MVthEY.js → ebnfDiagram-PWID7BFC-BjhVZBtA.js} +1 -1
- package/web-shell/assets/{erDiagram-SSCWMZ5O-BCeYn1s9.js → erDiagram-SSCWMZ5O-CdJLCGnE.js} +1 -1
- package/web-shell/assets/{flowDiagram-A5DVABFB-Bs0JDZZ1.js → flowDiagram-A5DVABFB-CmtB4ERm.js} +1 -1
- package/web-shell/assets/{ganttDiagram-EL5Y4UJY-BOIZa6T6.js → ganttDiagram-EL5Y4UJY-D0s34HZQ.js} +1 -1
- package/web-shell/assets/{gitGraphDiagram-WWUBYQGX-CHpXY7T9.js → gitGraphDiagram-WWUBYQGX-Be4dRxy6.js} +1 -1
- package/web-shell/assets/{index-QdEwPXKp.js → index-By7nGWN5.js} +3 -3
- package/web-shell/assets/{index-CkXqSN8y.js → index-YawRMoDg.js} +1 -1
- package/web-shell/assets/{infoDiagram-RXCK75RN-BsCxzDrS.js → infoDiagram-RXCK75RN-BUMZ0WUa.js} +1 -1
- package/web-shell/assets/{ishikawaDiagram-5VMMS53U-fPGgn840.js → ishikawaDiagram-5VMMS53U-uCnAAbrV.js} +1 -1
- package/web-shell/assets/{journeyDiagram-EYS64GPL-mfEF8vIN.js → journeyDiagram-EYS64GPL-CpvbSMYa.js} +1 -1
- package/web-shell/assets/{kanban-definition-3QL26DDD-D8GpjmGR.js → kanban-definition-3QL26DDD-DaRX-7us.js} +1 -1
- package/web-shell/assets/{layout-BAEuUwK2.js → layout-BEbxwX3Y.js} +1 -1
- package/web-shell/assets/{linear-B1tAMCcT.js → linear-BgUCUxct.js} +1 -1
- package/web-shell/assets/{mermaid.core-D72QdhM7.js → mermaid.core-DL7CmhSA.js} +6 -6
- package/web-shell/assets/{mindmap-definition-FBJOCRG2-Cy0Rc9QC.js → mindmap-definition-FBJOCRG2-BqwtdaVk.js} +1 -1
- package/web-shell/assets/{pegDiagram-XKGWAZYB-ZzxMp5Ny.js → pegDiagram-XKGWAZYB-q65qnvxK.js} +1 -1
- package/web-shell/assets/{pieDiagram-E7YTZNPT-ZUCqYc8K.js → pieDiagram-E7YTZNPT-ClU2Sbq2.js} +1 -1
- package/web-shell/assets/{quadrantDiagram-AXDQQJYC-DSTgE7x-.js → quadrantDiagram-AXDQQJYC-DxXCpY5K.js} +1 -1
- package/web-shell/assets/{railroadDiagram-O6MQD6OU-d88uigVX.js → railroadDiagram-O6MQD6OU-BceckhTA.js} +1 -1
- package/web-shell/assets/{requirementDiagram-EFPCY7ZU-C-ZXO-12.js → requirementDiagram-EFPCY7ZU-D31kIQwL.js} +1 -1
- package/web-shell/assets/{sankeyDiagram-P5KCCOFB-CVYJlAbd.js → sankeyDiagram-P5KCCOFB-ZeTViaLc.js} +1 -1
- package/web-shell/assets/{sequenceDiagram-WJ2MYXX4-DsZkFXpg.js → sequenceDiagram-WJ2MYXX4-DaVgUPht.js} +1 -1
- package/web-shell/assets/{sizeCapture-X5ZJPWSS-ZiUpXNO9.js → sizeCapture-X5ZJPWSS-iRc5xk13.js} +1 -1
- package/web-shell/assets/{stateDiagram-HBIQ2CUA-UPSwQ-XW.js → stateDiagram-HBIQ2CUA-BNNpFhuW.js} +1 -1
- package/web-shell/assets/stateDiagram-v2-4QOOHH4V-Cx_ZIIQI.js +1 -0
- package/web-shell/assets/{swimlanes-XN3QIQJK-DyobgEm7.js → swimlanes-XN3QIQJK-DwN3VcoY.js} +1 -1
- package/web-shell/assets/swimlanesDiagram-VK2B7HYN-D0aMXCyh.js +8 -0
- package/web-shell/assets/{timeline-definition-24CTP7MA-DqJ40a1e.js → timeline-definition-24CTP7MA-9DN7np9f.js} +1 -1
- package/web-shell/assets/{vennDiagram-4TSXK5OY-FKcpY4Fq.js → vennDiagram-4TSXK5OY-n6uBiSUo.js} +1 -1
- package/web-shell/assets/{wardleyDiagram-VM6X3IG4-B7Bzug8R.js → wardleyDiagram-VM6X3IG4-BDZULYEc.js} +1 -1
- package/web-shell/assets/{xychartDiagram-S5SC5T6Z-DjDG4_tN.js → xychartDiagram-S5SC5T6Z-B3rVu9BR.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-BtQqhd2M.js +0 -1
- package/web-shell/assets/classDiagram-DTDB5LWJ-D16H83zY.js +0 -1
- package/web-shell/assets/classDiagram-v2-JRS7N3AN-D16H83zY.js +0 -1
- package/web-shell/assets/stateDiagram-v2-4QOOHH4V-3aRdjaQr.js +0 -1
- package/web-shell/assets/swimlanesDiagram-VK2B7HYN-DRVUaqdL.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,16 @@ 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";
|
|
145
|
+
import {
|
|
146
|
+
loadUndici
|
|
147
|
+
} from "./chunk-S6HB6BVJ.js";
|
|
143
148
|
import {
|
|
144
149
|
createDebugLogger
|
|
145
150
|
} from "./chunk-UK2KIU2V.js";
|
|
@@ -1704,8 +1709,8 @@ var require_lru_cache = __commonJS({
|
|
|
1704
1709
|
|
|
1705
1710
|
// packages/core/src/tools/read-file.ts
|
|
1706
1711
|
init_esbuild_shims();
|
|
1707
|
-
import
|
|
1708
|
-
import
|
|
1712
|
+
import path11 from "node:path";
|
|
1713
|
+
import fs8 from "node:fs/promises";
|
|
1709
1714
|
|
|
1710
1715
|
// packages/core/src/telemetry/telemetry-utils.ts
|
|
1711
1716
|
init_esbuild_shims();
|
|
@@ -1841,8 +1846,8 @@ __name(isInternalPromptId, "isInternalPromptId");
|
|
|
1841
1846
|
// packages/core/src/telemetry/o1-code-logger/o1-code-logger.ts
|
|
1842
1847
|
init_esbuild_shims();
|
|
1843
1848
|
import * as os from "node:os";
|
|
1844
|
-
import
|
|
1845
|
-
import
|
|
1849
|
+
import fs2 from "node:fs";
|
|
1850
|
+
import path3 from "node:path";
|
|
1846
1851
|
|
|
1847
1852
|
// packages/core/src/telemetry/sanitize.ts
|
|
1848
1853
|
init_esbuild_shims();
|
|
@@ -1867,6 +1872,58 @@ function sanitizeHookName(hookName) {
|
|
|
1867
1872
|
}
|
|
1868
1873
|
__name(sanitizeHookName, "sanitizeHookName");
|
|
1869
1874
|
|
|
1875
|
+
// packages/core/src/config/installationManager.ts
|
|
1876
|
+
init_esbuild_shims();
|
|
1877
|
+
import * as fs from "node:fs";
|
|
1878
|
+
import { randomUUID } from "node:crypto";
|
|
1879
|
+
import * as path2 from "node:path";
|
|
1880
|
+
var debugLogger = createDebugLogger("INSTALLATION");
|
|
1881
|
+
var InstallationManager = class {
|
|
1882
|
+
static {
|
|
1883
|
+
__name(this, "InstallationManager");
|
|
1884
|
+
}
|
|
1885
|
+
getInstallationIdPath() {
|
|
1886
|
+
return Storage.getInstallationIdPath();
|
|
1887
|
+
}
|
|
1888
|
+
readInstallationIdFromFile() {
|
|
1889
|
+
const installationIdFile = this.getInstallationIdPath();
|
|
1890
|
+
if (fs.existsSync(installationIdFile)) {
|
|
1891
|
+
const installationid = fs.readFileSync(installationIdFile, "utf-8").trim();
|
|
1892
|
+
return installationid || null;
|
|
1893
|
+
}
|
|
1894
|
+
return null;
|
|
1895
|
+
}
|
|
1896
|
+
writeInstallationIdToFile(installationId) {
|
|
1897
|
+
const installationIdFile = this.getInstallationIdPath();
|
|
1898
|
+
const dir = path2.dirname(installationIdFile);
|
|
1899
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
1900
|
+
atomicWriteFileSync(installationIdFile, installationId, {
|
|
1901
|
+
encoding: "utf-8"
|
|
1902
|
+
});
|
|
1903
|
+
}
|
|
1904
|
+
/**
|
|
1905
|
+
* Retrieves the installation ID from a file, creating it if it doesn't exist.
|
|
1906
|
+
* This ID is used for unique user installation tracking.
|
|
1907
|
+
* @returns A UUID string for the user.
|
|
1908
|
+
*/
|
|
1909
|
+
getInstallationId() {
|
|
1910
|
+
try {
|
|
1911
|
+
let installationId = this.readInstallationIdFromFile();
|
|
1912
|
+
if (!installationId) {
|
|
1913
|
+
installationId = randomUUID();
|
|
1914
|
+
this.writeInstallationIdToFile(installationId);
|
|
1915
|
+
}
|
|
1916
|
+
return installationId;
|
|
1917
|
+
} catch (error) {
|
|
1918
|
+
debugLogger.error(
|
|
1919
|
+
"Error accessing installation ID file, generating ephemeral ID:",
|
|
1920
|
+
error
|
|
1921
|
+
);
|
|
1922
|
+
return "123456789";
|
|
1923
|
+
}
|
|
1924
|
+
}
|
|
1925
|
+
};
|
|
1926
|
+
|
|
1870
1927
|
// node_modules/mnemonist/index.mjs
|
|
1871
1928
|
init_esbuild_shims();
|
|
1872
1929
|
var import_fibonacci_heap = __toESM(require_fibonacci_heap(), 1);
|
|
@@ -2055,12 +2112,12 @@ var O1CodeLogger = class _O1CodeLogger {
|
|
|
2055
2112
|
readSourceInfo() {
|
|
2056
2113
|
try {
|
|
2057
2114
|
const globalDir = Storage.getGlobalO1CodeDir();
|
|
2058
|
-
const sourceJsonPath =
|
|
2059
|
-
const legacyPath =
|
|
2060
|
-
const candidates =
|
|
2115
|
+
const sourceJsonPath = path3.join(globalDir, "source.json");
|
|
2116
|
+
const legacyPath = path3.join(os.homedir(), ".o1-code", "source.json");
|
|
2117
|
+
const candidates = path3.normalize(sourceJsonPath) !== path3.normalize(legacyPath) ? [sourceJsonPath, legacyPath] : [sourceJsonPath];
|
|
2061
2118
|
for (const candidate of candidates) {
|
|
2062
|
-
if (
|
|
2063
|
-
const sourceJsonContent =
|
|
2119
|
+
if (fs2.existsSync(candidate)) {
|
|
2120
|
+
const sourceJsonContent = fs2.readFileSync(candidate, "utf8");
|
|
2064
2121
|
const sourceData = JSON.parse(sourceJsonContent);
|
|
2065
2122
|
if (sourceData && typeof sourceData === "object" && sourceData.source && sourceData.source !== "unknown") {
|
|
2066
2123
|
return sourceData.source;
|
|
@@ -2703,6 +2760,680 @@ var O1CodeLogger = class _O1CodeLogger {
|
|
|
2703
2760
|
}
|
|
2704
2761
|
};
|
|
2705
2762
|
|
|
2763
|
+
// packages/core/src/telemetry/product/product-telemetry.ts
|
|
2764
|
+
init_esbuild_shims();
|
|
2765
|
+
import * as fs5 from "node:fs";
|
|
2766
|
+
import * as path6 from "node:path";
|
|
2767
|
+
import * as tls from "node:tls";
|
|
2768
|
+
|
|
2769
|
+
// packages/core/src/telemetry/product/usage-ledger.ts
|
|
2770
|
+
init_esbuild_shims();
|
|
2771
|
+
import * as fs3 from "node:fs";
|
|
2772
|
+
import * as path4 from "node:path";
|
|
2773
|
+
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
2774
|
+
var SESSION_MODES = [
|
|
2775
|
+
"interactive",
|
|
2776
|
+
"headless",
|
|
2777
|
+
"sdk"
|
|
2778
|
+
];
|
|
2779
|
+
var MAX_MAP_KEYS = 100;
|
|
2780
|
+
var MAX_DAYS = 31;
|
|
2781
|
+
var MAX_COUNT = 1e9;
|
|
2782
|
+
var FILE_PATTERN = /^(\d{4}-\d{2}-\d{2})\.[A-Za-z0-9-]+\.json$/;
|
|
2783
|
+
function localDay(date) {
|
|
2784
|
+
const pad = /* @__PURE__ */ __name((value) => String(value).padStart(2, "0"), "pad");
|
|
2785
|
+
return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`;
|
|
2786
|
+
}
|
|
2787
|
+
__name(localDay, "localDay");
|
|
2788
|
+
function emptyDay(day) {
|
|
2789
|
+
return {
|
|
2790
|
+
day,
|
|
2791
|
+
sessions: { interactive: 0, headless: 0, sdk: 0 },
|
|
2792
|
+
prompts: 0,
|
|
2793
|
+
toolCalls: {},
|
|
2794
|
+
slashCommands: {},
|
|
2795
|
+
providers: {},
|
|
2796
|
+
apiErrors: {},
|
|
2797
|
+
tokens: { input: 0, output: 0 },
|
|
2798
|
+
subagents: 0
|
|
2799
|
+
};
|
|
2800
|
+
}
|
|
2801
|
+
__name(emptyDay, "emptyDay");
|
|
2802
|
+
function clamp(value) {
|
|
2803
|
+
return Number.isFinite(value) ? Math.min(MAX_COUNT, Math.max(0, Math.round(value))) : 0;
|
|
2804
|
+
}
|
|
2805
|
+
__name(clamp, "clamp");
|
|
2806
|
+
var MAP_KEY = /^[A-Za-z][A-Za-z0-9_.:-]{0,63}$/;
|
|
2807
|
+
function addTo(map, key, amount = 1) {
|
|
2808
|
+
const name = Object.hasOwn(map, key) || Object.keys(map).length < MAX_MAP_KEYS ? key : "other";
|
|
2809
|
+
map[name] = clamp((Object.hasOwn(map, name) ? map[name] : 0) + amount);
|
|
2810
|
+
}
|
|
2811
|
+
__name(addTo, "addTo");
|
|
2812
|
+
function mergeMap(target, source) {
|
|
2813
|
+
if (source && typeof source === "object") {
|
|
2814
|
+
for (const [key, value] of Object.entries(source)) {
|
|
2815
|
+
if (typeof value === "number" && MAP_KEY.test(key)) {
|
|
2816
|
+
addTo(target, key, value);
|
|
2817
|
+
}
|
|
2818
|
+
}
|
|
2819
|
+
}
|
|
2820
|
+
return target;
|
|
2821
|
+
}
|
|
2822
|
+
__name(mergeMap, "mergeMap");
|
|
2823
|
+
function mergeDay(target, source) {
|
|
2824
|
+
for (const mode of SESSION_MODES) {
|
|
2825
|
+
target.sessions[mode] = clamp(
|
|
2826
|
+
target.sessions[mode] + (Number(source.sessions?.[mode]) || 0)
|
|
2827
|
+
);
|
|
2828
|
+
}
|
|
2829
|
+
target.prompts = clamp(target.prompts + (Number(source.prompts) || 0));
|
|
2830
|
+
mergeMap(target.toolCalls, source.toolCalls);
|
|
2831
|
+
mergeMap(target.slashCommands, source.slashCommands);
|
|
2832
|
+
mergeMap(target.providers, source.providers);
|
|
2833
|
+
mergeMap(target.apiErrors, source.apiErrors);
|
|
2834
|
+
target.tokens.input = clamp(
|
|
2835
|
+
target.tokens.input + (Number(source.tokens?.input) || 0)
|
|
2836
|
+
);
|
|
2837
|
+
target.tokens.output = clamp(
|
|
2838
|
+
target.tokens.output + (Number(source.tokens?.output) || 0)
|
|
2839
|
+
);
|
|
2840
|
+
target.subagents = clamp(target.subagents + (Number(source.subagents) || 0));
|
|
2841
|
+
return target;
|
|
2842
|
+
}
|
|
2843
|
+
__name(mergeDay, "mergeDay");
|
|
2844
|
+
var UsageLedger = class {
|
|
2845
|
+
constructor(directory, now = () => /* @__PURE__ */ new Date(), processKey = `${process.pid}-${randomUUID2().slice(0, 8)}`) {
|
|
2846
|
+
this.directory = directory;
|
|
2847
|
+
this.now = now;
|
|
2848
|
+
this.processKey = processKey;
|
|
2849
|
+
this.usage = emptyDay(localDay(this.now()));
|
|
2850
|
+
}
|
|
2851
|
+
static {
|
|
2852
|
+
__name(this, "UsageLedger");
|
|
2853
|
+
}
|
|
2854
|
+
usage;
|
|
2855
|
+
dirty = false;
|
|
2856
|
+
session(mode) {
|
|
2857
|
+
this.update((day) => day.sessions[mode] = clamp(day.sessions[mode] + 1));
|
|
2858
|
+
}
|
|
2859
|
+
prompt() {
|
|
2860
|
+
this.update((day) => day.prompts = clamp(day.prompts + 1));
|
|
2861
|
+
}
|
|
2862
|
+
toolCall(name) {
|
|
2863
|
+
this.update((day) => addTo(day.toolCalls, name));
|
|
2864
|
+
}
|
|
2865
|
+
slashCommand(name) {
|
|
2866
|
+
this.update((day) => addTo(day.slashCommands, name));
|
|
2867
|
+
}
|
|
2868
|
+
apiResponse(provider, input, output) {
|
|
2869
|
+
this.update((day) => {
|
|
2870
|
+
addTo(day.providers, provider);
|
|
2871
|
+
day.tokens.input = clamp(day.tokens.input + input);
|
|
2872
|
+
day.tokens.output = clamp(day.tokens.output + output);
|
|
2873
|
+
});
|
|
2874
|
+
}
|
|
2875
|
+
apiError(category) {
|
|
2876
|
+
this.update((day) => addTo(day.apiErrors, category));
|
|
2877
|
+
}
|
|
2878
|
+
subagent() {
|
|
2879
|
+
this.update((day) => day.subagents = clamp(day.subagents + 1));
|
|
2880
|
+
}
|
|
2881
|
+
/** Writes this process's totals for the current day, if they changed. */
|
|
2882
|
+
persist() {
|
|
2883
|
+
if (!this.dirty) return;
|
|
2884
|
+
try {
|
|
2885
|
+
fs3.mkdirSync(this.directory, { recursive: true });
|
|
2886
|
+
const file = path4.join(
|
|
2887
|
+
this.directory,
|
|
2888
|
+
`${this.usage.day}.${this.processKey}.json`
|
|
2889
|
+
);
|
|
2890
|
+
const temporary = `${file}.tmp`;
|
|
2891
|
+
fs3.writeFileSync(temporary, JSON.stringify(this.usage));
|
|
2892
|
+
fs3.renameSync(temporary, file);
|
|
2893
|
+
this.dirty = false;
|
|
2894
|
+
} catch {
|
|
2895
|
+
}
|
|
2896
|
+
}
|
|
2897
|
+
update(change) {
|
|
2898
|
+
const today = localDay(this.now());
|
|
2899
|
+
if (today !== this.usage.day) {
|
|
2900
|
+
this.persist();
|
|
2901
|
+
this.usage = emptyDay(today);
|
|
2902
|
+
}
|
|
2903
|
+
change(this.usage);
|
|
2904
|
+
this.dirty = true;
|
|
2905
|
+
}
|
|
2906
|
+
};
|
|
2907
|
+
function collectUsage(directory, now) {
|
|
2908
|
+
const today = localDay(now);
|
|
2909
|
+
const oldest = localDay(new Date(now.getTime() - MAX_DAYS * 864e5));
|
|
2910
|
+
const days = /* @__PURE__ */ new Map();
|
|
2911
|
+
const completedFiles = [];
|
|
2912
|
+
let names;
|
|
2913
|
+
try {
|
|
2914
|
+
names = fs3.readdirSync(directory);
|
|
2915
|
+
} catch {
|
|
2916
|
+
return { days: [], completedFiles };
|
|
2917
|
+
}
|
|
2918
|
+
for (const name of names) {
|
|
2919
|
+
const match = FILE_PATTERN.exec(name);
|
|
2920
|
+
if (!match) continue;
|
|
2921
|
+
const day = match[1];
|
|
2922
|
+
const file = path4.join(directory, name);
|
|
2923
|
+
if (day < oldest || day > today) {
|
|
2924
|
+
fs3.rmSync(file, { force: true });
|
|
2925
|
+
continue;
|
|
2926
|
+
}
|
|
2927
|
+
try {
|
|
2928
|
+
const content = JSON.parse(
|
|
2929
|
+
fs3.readFileSync(file, "utf8")
|
|
2930
|
+
);
|
|
2931
|
+
days.set(day, mergeDay(days.get(day) ?? emptyDay(day), content));
|
|
2932
|
+
} catch {
|
|
2933
|
+
fs3.rmSync(file, { force: true });
|
|
2934
|
+
continue;
|
|
2935
|
+
}
|
|
2936
|
+
if (day < today) completedFiles.push(file);
|
|
2937
|
+
}
|
|
2938
|
+
return {
|
|
2939
|
+
days: [...days.values()].sort((a, b) => a.day.localeCompare(b.day)),
|
|
2940
|
+
completedFiles
|
|
2941
|
+
};
|
|
2942
|
+
}
|
|
2943
|
+
__name(collectUsage, "collectUsage");
|
|
2944
|
+
|
|
2945
|
+
// packages/core/src/telemetry/product/error-reports.ts
|
|
2946
|
+
init_esbuild_shims();
|
|
2947
|
+
import * as fs4 from "node:fs";
|
|
2948
|
+
import * as os2 from "node:os";
|
|
2949
|
+
import * as path5 from "node:path";
|
|
2950
|
+
import { createHash } from "node:crypto";
|
|
2951
|
+
var MAX_MESSAGE_LENGTH = 500;
|
|
2952
|
+
var MAX_STACK_LENGTH = 8e3;
|
|
2953
|
+
var MAX_REPORTS_PER_SEND = 20;
|
|
2954
|
+
var MAX_STORED_REPORTS = 100;
|
|
2955
|
+
var FINGERPRINT_FRAMES = 5;
|
|
2956
|
+
function escapeRegExp(text) {
|
|
2957
|
+
return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
2958
|
+
}
|
|
2959
|
+
__name(escapeRegExp, "escapeRegExp");
|
|
2960
|
+
function sanitizeErrorText(text, homeDir = os2.homedir()) {
|
|
2961
|
+
let result = text;
|
|
2962
|
+
if (homeDir.length > 1) {
|
|
2963
|
+
const variants = /* @__PURE__ */ new Set([
|
|
2964
|
+
homeDir,
|
|
2965
|
+
homeDir.replace(/\\/g, "/"),
|
|
2966
|
+
homeDir.replace(/\//g, "\\")
|
|
2967
|
+
]);
|
|
2968
|
+
for (const variant of variants) {
|
|
2969
|
+
result = result.replace(new RegExp(escapeRegExp(variant), "gi"), "~");
|
|
2970
|
+
}
|
|
2971
|
+
}
|
|
2972
|
+
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(
|
|
2973
|
+
/(?<!node:\w*)(?:~|[A-Za-z]:)?(?:[\\/][^\s\\/:'"`()]+)+[\\/]?([^\s\\/:'"`()]*)/g,
|
|
2974
|
+
(match) => shortenPath2(match)
|
|
2975
|
+
).replace(/\b(Bearer|Basic)\s+[^\s'"`,;)]+/gi, "$1 <redacted>").replace(
|
|
2976
|
+
/\b([\w-]*(?:password|passwd|secret|token|api[_-]?key|auth)[\w-]*)(["']?\s*[:=]\s*["']?)[^\s'"`,;)&]+/gi,
|
|
2977
|
+
"$1$2<redacted>"
|
|
2978
|
+
).replace(
|
|
2979
|
+
/\b(?:sk|pk|rk|ghp|gho|ghu|ghs|ghr|github_pat|glpat|xox[abprs]|AKIA|ASIA|AIza)[-_A-Za-z0-9]{8,}/g,
|
|
2980
|
+
"<redacted>"
|
|
2981
|
+
).replace(/\b[A-Za-z0-9_\-+=]{32,}\b/g, "<redacted>").replace(/(["'`])([^"'`\n]{41,})\1/g, "$1\u2026$1");
|
|
2982
|
+
return result;
|
|
2983
|
+
}
|
|
2984
|
+
__name(sanitizeErrorText, "sanitizeErrorText");
|
|
2985
|
+
function shortenPath2(match) {
|
|
2986
|
+
const normalized = match.replace(/\\/g, "/");
|
|
2987
|
+
const dependency = normalized.lastIndexOf("node_modules/");
|
|
2988
|
+
if (dependency !== -1) return normalized.slice(dependency);
|
|
2989
|
+
const segments = normalized.split("/").filter(Boolean);
|
|
2990
|
+
return segments.length > 1 ? `\u2026/${segments.at(-1)}` : normalized;
|
|
2991
|
+
}
|
|
2992
|
+
__name(shortenPath2, "shortenPath");
|
|
2993
|
+
function frames(stack) {
|
|
2994
|
+
return stack.split("\n").map((line) => line.trim()).filter((line) => line.startsWith("at ")).slice(0, FINGERPRINT_FRAMES).map((line) => line.replace(/:\d+(?::\d+)?\)?$/u, ""));
|
|
2995
|
+
}
|
|
2996
|
+
__name(frames, "frames");
|
|
2997
|
+
function buildErrorReport(error, kind, version, now = /* @__PURE__ */ new Date(), homeDir) {
|
|
2998
|
+
const value = error instanceof Error ? error : new Error(typeof error === "string" ? error : "Non-error value thrown");
|
|
2999
|
+
const name = (value.name || "Error").slice(0, 64);
|
|
3000
|
+
const message = sanitizeErrorText(value.message ?? "", homeDir).slice(
|
|
3001
|
+
0,
|
|
3002
|
+
MAX_MESSAGE_LENGTH
|
|
3003
|
+
);
|
|
3004
|
+
const stack = sanitizeErrorText(value.stack ?? "", homeDir).slice(
|
|
3005
|
+
0,
|
|
3006
|
+
MAX_STACK_LENGTH
|
|
3007
|
+
);
|
|
3008
|
+
const fingerprint = createHash("sha256").update([kind, name, ...frames(stack)].join("\n")).digest("hex").slice(0, 32);
|
|
3009
|
+
const seen = now.toISOString();
|
|
3010
|
+
return {
|
|
3011
|
+
fingerprint,
|
|
3012
|
+
kind,
|
|
3013
|
+
version,
|
|
3014
|
+
name,
|
|
3015
|
+
message,
|
|
3016
|
+
stack,
|
|
3017
|
+
count: 1,
|
|
3018
|
+
firstSeen: seen,
|
|
3019
|
+
lastSeen: seen
|
|
3020
|
+
};
|
|
3021
|
+
}
|
|
3022
|
+
__name(buildErrorReport, "buildErrorReport");
|
|
3023
|
+
function reportFile(directory, report) {
|
|
3024
|
+
const version = report.version.replace(/[^A-Za-z0-9.-]/g, "_");
|
|
3025
|
+
return path5.join(directory, `${report.fingerprint}.${version}.json`);
|
|
3026
|
+
}
|
|
3027
|
+
__name(reportFile, "reportFile");
|
|
3028
|
+
function storeErrorReport(directory, report) {
|
|
3029
|
+
try {
|
|
3030
|
+
fs4.mkdirSync(directory, { recursive: true });
|
|
3031
|
+
const file = reportFile(directory, report);
|
|
3032
|
+
let stored;
|
|
3033
|
+
if (fs4.existsSync(file)) {
|
|
3034
|
+
stored = JSON.parse(fs4.readFileSync(file, "utf8"));
|
|
3035
|
+
} else if (fs4.readdirSync(directory).length >= MAX_STORED_REPORTS) {
|
|
3036
|
+
return;
|
|
3037
|
+
}
|
|
3038
|
+
const next = stored ? {
|
|
3039
|
+
...stored,
|
|
3040
|
+
count: Math.min(1e9, (stored.count || 0) + report.count),
|
|
3041
|
+
lastSeen: report.lastSeen
|
|
3042
|
+
} : report;
|
|
3043
|
+
fs4.writeFileSync(file, JSON.stringify(next));
|
|
3044
|
+
} catch {
|
|
3045
|
+
}
|
|
3046
|
+
}
|
|
3047
|
+
__name(storeErrorReport, "storeErrorReport");
|
|
3048
|
+
var REPORT_KEYS = [
|
|
3049
|
+
"fingerprint",
|
|
3050
|
+
"kind",
|
|
3051
|
+
"version",
|
|
3052
|
+
"name",
|
|
3053
|
+
"message",
|
|
3054
|
+
"stack",
|
|
3055
|
+
"count",
|
|
3056
|
+
"firstSeen",
|
|
3057
|
+
"lastSeen"
|
|
3058
|
+
].sort();
|
|
3059
|
+
function isValidReport(value) {
|
|
3060
|
+
if (!value || typeof value !== "object") return false;
|
|
3061
|
+
const report = value;
|
|
3062
|
+
const keys = Object.keys(report).sort();
|
|
3063
|
+
const firstSeen = Date.parse(String(report["firstSeen"]));
|
|
3064
|
+
const lastSeen = Date.parse(String(report["lastSeen"]));
|
|
3065
|
+
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;
|
|
3066
|
+
}
|
|
3067
|
+
__name(isValidReport, "isValidReport");
|
|
3068
|
+
function collectErrorReports(directory) {
|
|
3069
|
+
const reports = [];
|
|
3070
|
+
const files = [];
|
|
3071
|
+
let names;
|
|
3072
|
+
try {
|
|
3073
|
+
names = fs4.readdirSync(directory).filter((name) => name.endsWith(".json"));
|
|
3074
|
+
} catch {
|
|
3075
|
+
return { reports, files };
|
|
3076
|
+
}
|
|
3077
|
+
for (const name of names.slice(0, MAX_REPORTS_PER_SEND)) {
|
|
3078
|
+
const file = path5.join(directory, name);
|
|
3079
|
+
try {
|
|
3080
|
+
const report = JSON.parse(fs4.readFileSync(file, "utf8"));
|
|
3081
|
+
if (!isValidReport(report)) throw new Error("Invalid report");
|
|
3082
|
+
reports.push(report);
|
|
3083
|
+
files.push(file);
|
|
3084
|
+
} catch {
|
|
3085
|
+
fs4.rmSync(file, { force: true });
|
|
3086
|
+
}
|
|
3087
|
+
}
|
|
3088
|
+
return { reports, files };
|
|
3089
|
+
}
|
|
3090
|
+
__name(collectErrorReports, "collectErrorReports");
|
|
3091
|
+
|
|
3092
|
+
// packages/core/src/telemetry/product/product-telemetry.ts
|
|
3093
|
+
var debugLogger2 = createDebugLogger("PRODUCT_TELEMETRY");
|
|
3094
|
+
var DEFAULT_PRODUCT_TELEMETRY_URL = "https://api.organizaone.com/telemetry/v1";
|
|
3095
|
+
var PRODUCT_TELEMETRY_SCHEMA = 1;
|
|
3096
|
+
var USAGE_SEND_INTERVAL_MS = 60 * 60 * 1e3;
|
|
3097
|
+
var TICK_INTERVAL_MS = 15 * 60 * 1e3;
|
|
3098
|
+
var FIRST_SEND_DELAY_MS = 10 * 1e3;
|
|
3099
|
+
var REQUEST_TIMEOUT_MS = 5e3;
|
|
3100
|
+
var MAX_USAGE_BODY_BYTES = 25e4;
|
|
3101
|
+
var MAX_ERROR_BODY_BYTES = 6e4;
|
|
3102
|
+
var SAFE_NAME = /^[a-z][a-z0-9_.:-]{0,63}$/;
|
|
3103
|
+
var KNOWN_AUTH_TYPES = new Set(Object.values(AuthType));
|
|
3104
|
+
function isDoNotTrack() {
|
|
3105
|
+
const value = process.env["DO_NOT_TRACK"];
|
|
3106
|
+
return value !== void 0 && value !== "" && value !== "0";
|
|
3107
|
+
}
|
|
3108
|
+
__name(isDoNotTrack, "isDoNotTrack");
|
|
3109
|
+
function isUsageReportingEnabled(config) {
|
|
3110
|
+
return config.getUsageStatisticsEnabled() && !isDoNotTrack();
|
|
3111
|
+
}
|
|
3112
|
+
__name(isUsageReportingEnabled, "isUsageReportingEnabled");
|
|
3113
|
+
function isErrorReportingEnabled(config) {
|
|
3114
|
+
return config.getErrorReportsEnabled() && !isDoNotTrack();
|
|
3115
|
+
}
|
|
3116
|
+
__name(isErrorReportingEnabled, "isErrorReportingEnabled");
|
|
3117
|
+
function telemetryUrl() {
|
|
3118
|
+
return (process.env["O1CODE_TELEMETRY_URL"] || DEFAULT_PRODUCT_TELEMETRY_URL).replace(/\/+$/, "");
|
|
3119
|
+
}
|
|
3120
|
+
__name(telemetryUrl, "telemetryUrl");
|
|
3121
|
+
function telemetryDir() {
|
|
3122
|
+
return path6.join(Storage.getGlobalO1CodeDir(), "telemetry");
|
|
3123
|
+
}
|
|
3124
|
+
__name(telemetryDir, "telemetryDir");
|
|
3125
|
+
function osName() {
|
|
3126
|
+
return ["win32", "darwin", "linux"].includes(process.platform) ? process.platform : "other";
|
|
3127
|
+
}
|
|
3128
|
+
__name(osName, "osName");
|
|
3129
|
+
function archName() {
|
|
3130
|
+
return ["x64", "arm64"].includes(process.arch) ? process.arch : "other";
|
|
3131
|
+
}
|
|
3132
|
+
__name(archName, "archName");
|
|
3133
|
+
function localeName() {
|
|
3134
|
+
try {
|
|
3135
|
+
const locale = Intl.DateTimeFormat().resolvedOptions().locale;
|
|
3136
|
+
return /^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{2,8})?$/.test(locale) ? locale : "other";
|
|
3137
|
+
} catch {
|
|
3138
|
+
return "other";
|
|
3139
|
+
}
|
|
3140
|
+
}
|
|
3141
|
+
__name(localeName, "localeName");
|
|
3142
|
+
function resolveInstall(current) {
|
|
3143
|
+
if (current.install === void 0) return;
|
|
3144
|
+
let install;
|
|
3145
|
+
try {
|
|
3146
|
+
install = typeof current.install === "function" ? current.install() : current.install;
|
|
3147
|
+
} catch {
|
|
3148
|
+
install = "unknown";
|
|
3149
|
+
}
|
|
3150
|
+
current.client.install = SAFE_NAME.test(install) ? install : "unknown";
|
|
3151
|
+
current.install = void 0;
|
|
3152
|
+
}
|
|
3153
|
+
__name(resolveInstall, "resolveInstall");
|
|
3154
|
+
var state;
|
|
3155
|
+
var exitHookInstalled = false;
|
|
3156
|
+
var errorReporting;
|
|
3157
|
+
function startProductTelemetry(config, options = {}) {
|
|
3158
|
+
try {
|
|
3159
|
+
start(config, options);
|
|
3160
|
+
} catch (error) {
|
|
3161
|
+
debugLogger2.debug("Product telemetry did not start:", error);
|
|
3162
|
+
state = void 0;
|
|
3163
|
+
}
|
|
3164
|
+
}
|
|
3165
|
+
__name(startProductTelemetry, "startProductTelemetry");
|
|
3166
|
+
function start(config, options) {
|
|
3167
|
+
const client = {
|
|
3168
|
+
version: config.getCliVersion() ?? "unknown",
|
|
3169
|
+
os: osName(),
|
|
3170
|
+
arch: archName(),
|
|
3171
|
+
node: process.versions.node.split(".")[0] ?? "unknown",
|
|
3172
|
+
install: "unknown",
|
|
3173
|
+
locale: localeName()
|
|
3174
|
+
};
|
|
3175
|
+
const install = options.install;
|
|
3176
|
+
errorReporting = {
|
|
3177
|
+
enabled: isErrorReportingEnabled(config),
|
|
3178
|
+
version: client.version,
|
|
3179
|
+
directory: path6.join(telemetryDir(), "errors")
|
|
3180
|
+
};
|
|
3181
|
+
if (!isUsageReportingEnabled(config) && !errorReporting.enabled) {
|
|
3182
|
+
state = void 0;
|
|
3183
|
+
return;
|
|
3184
|
+
}
|
|
3185
|
+
if (state?.timer) clearInterval(state.timer);
|
|
3186
|
+
state = {
|
|
3187
|
+
config,
|
|
3188
|
+
ledger: new UsageLedger(path6.join(telemetryDir(), "usage")),
|
|
3189
|
+
client,
|
|
3190
|
+
install
|
|
3191
|
+
};
|
|
3192
|
+
if (!exitHookInstalled) {
|
|
3193
|
+
exitHookInstalled = true;
|
|
3194
|
+
process.once("exit", () => state?.ledger.persist());
|
|
3195
|
+
}
|
|
3196
|
+
if (options.manual) return;
|
|
3197
|
+
setTimeout(() => void sendProductTelemetry(), FIRST_SEND_DELAY_MS).unref();
|
|
3198
|
+
state.timer = setInterval(() => {
|
|
3199
|
+
state?.ledger.persist();
|
|
3200
|
+
void sendProductTelemetry();
|
|
3201
|
+
}, TICK_INTERVAL_MS);
|
|
3202
|
+
state.timer.unref();
|
|
3203
|
+
}
|
|
3204
|
+
__name(start, "start");
|
|
3205
|
+
function productUsage(config) {
|
|
3206
|
+
if (!state || !isUsageReportingEnabled(config)) return void 0;
|
|
3207
|
+
return recorder;
|
|
3208
|
+
}
|
|
3209
|
+
__name(productUsage, "productUsage");
|
|
3210
|
+
var ProductUsageRecorder = class {
|
|
3211
|
+
static {
|
|
3212
|
+
__name(this, "ProductUsageRecorder");
|
|
3213
|
+
}
|
|
3214
|
+
session(config) {
|
|
3215
|
+
const mode = config.isInteractive() ? "interactive" : config.getInputFormat() === "stream-json" || config.getExperimentalZedIntegration() ? "sdk" : "headless";
|
|
3216
|
+
state?.ledger.session(mode);
|
|
3217
|
+
}
|
|
3218
|
+
prompt() {
|
|
3219
|
+
state?.ledger.prompt();
|
|
3220
|
+
}
|
|
3221
|
+
toolCall(name, type) {
|
|
3222
|
+
state?.ledger.toolCall(
|
|
3223
|
+
type === "mcp" ? "mcp" : SAFE_NAME.test(name) ? name : "other"
|
|
3224
|
+
);
|
|
3225
|
+
}
|
|
3226
|
+
slashCommand(name, builtIn) {
|
|
3227
|
+
state?.ledger.slashCommand(
|
|
3228
|
+
builtIn && SAFE_NAME.test(name) ? name : "custom"
|
|
3229
|
+
);
|
|
3230
|
+
}
|
|
3231
|
+
apiResponse(config, authType, input, output) {
|
|
3232
|
+
state?.ledger.apiResponse(providerKind(config, authType), input, output);
|
|
3233
|
+
}
|
|
3234
|
+
apiError(statusCode, errorType) {
|
|
3235
|
+
const status = Number(statusCode);
|
|
3236
|
+
state?.ledger.apiError(
|
|
3237
|
+
Number.isInteger(status) && status >= 100 && status < 600 ? `http_${status}` : errorType && /^[A-Za-z][A-Za-z0-9_]{0,47}$/.test(errorType) ? errorType : "other"
|
|
3238
|
+
);
|
|
3239
|
+
}
|
|
3240
|
+
subagent() {
|
|
3241
|
+
state?.ledger.subagent();
|
|
3242
|
+
}
|
|
3243
|
+
};
|
|
3244
|
+
var recorder = new ProductUsageRecorder();
|
|
3245
|
+
function providerKind(config, authType) {
|
|
3246
|
+
if (reachesOrganizaOne(config.getContentGeneratorConfig?.())) {
|
|
3247
|
+
return "organizaone";
|
|
3248
|
+
}
|
|
3249
|
+
return authType && KNOWN_AUTH_TYPES.has(authType) ? authType : "other";
|
|
3250
|
+
}
|
|
3251
|
+
__name(providerKind, "providerKind");
|
|
3252
|
+
function recordErrorReport(error, kind) {
|
|
3253
|
+
if (!errorReporting?.enabled) return;
|
|
3254
|
+
storeErrorReport(
|
|
3255
|
+
errorReporting.directory,
|
|
3256
|
+
buildErrorReport(error, kind, errorReporting.version)
|
|
3257
|
+
);
|
|
3258
|
+
}
|
|
3259
|
+
__name(recordErrorReport, "recordErrorReport");
|
|
3260
|
+
var UNTRUSTED_ISSUER_CODES = /* @__PURE__ */ new Set([
|
|
3261
|
+
"UNABLE_TO_GET_ISSUER_CERT_LOCALLY",
|
|
3262
|
+
"UNABLE_TO_GET_ISSUER_CERT",
|
|
3263
|
+
"SELF_SIGNED_CERT_IN_CHAIN",
|
|
3264
|
+
"DEPTH_ZERO_SELF_SIGNED_CERT",
|
|
3265
|
+
"UNABLE_TO_VERIFY_LEAF_SIGNATURE",
|
|
3266
|
+
"CERT_UNTRUSTED"
|
|
3267
|
+
]);
|
|
3268
|
+
function errorCode(error) {
|
|
3269
|
+
const cause = error?.cause;
|
|
3270
|
+
return typeof cause?.code === "string" ? cause.code : void 0;
|
|
3271
|
+
}
|
|
3272
|
+
__name(errorCode, "errorCode");
|
|
3273
|
+
function caWithSystemStore() {
|
|
3274
|
+
const get = tls.getCACertificates;
|
|
3275
|
+
if (!get) return void 0;
|
|
3276
|
+
try {
|
|
3277
|
+
const system = get("system");
|
|
3278
|
+
return system.length > 0 ? [...get("default"), ...system] : void 0;
|
|
3279
|
+
} catch {
|
|
3280
|
+
return void 0;
|
|
3281
|
+
}
|
|
3282
|
+
}
|
|
3283
|
+
__name(caWithSystemStore, "caWithSystemStore");
|
|
3284
|
+
async function send(url, body, ca) {
|
|
3285
|
+
const init = {
|
|
3286
|
+
method: "POST",
|
|
3287
|
+
headers: { "content-type": "application/json" },
|
|
3288
|
+
body,
|
|
3289
|
+
signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS)
|
|
3290
|
+
};
|
|
3291
|
+
if (!ca) return fetch(url, init);
|
|
3292
|
+
const undici = await loadUndici();
|
|
3293
|
+
const proxy = state?.config.getProxy?.();
|
|
3294
|
+
const dispatcher = proxy ? new undici.EnvHttpProxyAgent({
|
|
3295
|
+
httpProxy: proxy,
|
|
3296
|
+
httpsProxy: proxy,
|
|
3297
|
+
connect: { ca },
|
|
3298
|
+
requestTls: { ca }
|
|
3299
|
+
}) : new undici.Agent({ connect: { ca } });
|
|
3300
|
+
try {
|
|
3301
|
+
return await undici.fetch(url, {
|
|
3302
|
+
...init,
|
|
3303
|
+
dispatcher
|
|
3304
|
+
});
|
|
3305
|
+
} finally {
|
|
3306
|
+
void dispatcher.close().catch(() => {
|
|
3307
|
+
});
|
|
3308
|
+
}
|
|
3309
|
+
}
|
|
3310
|
+
__name(send, "send");
|
|
3311
|
+
async function delivery(endpoint, response) {
|
|
3312
|
+
if (response.ok) return "accepted";
|
|
3313
|
+
debugLogger2.debug(
|
|
3314
|
+
`Sending ${endpoint} refused with ${response.status}:`,
|
|
3315
|
+
(await response.text()).slice(0, 300)
|
|
3316
|
+
);
|
|
3317
|
+
return response.status === 400 || response.status === 413 ? "refused" : "unreached";
|
|
3318
|
+
}
|
|
3319
|
+
__name(delivery, "delivery");
|
|
3320
|
+
async function postThroughTunnel(endpoint, json) {
|
|
3321
|
+
const tunnel = state?.config.getO1ConnectSession?.();
|
|
3322
|
+
if (!tunnel || process.env["O1CODE_TELEMETRY_URL"]) return "unreached";
|
|
3323
|
+
const intakePath = new URL(DEFAULT_PRODUCT_TELEMETRY_URL).pathname;
|
|
3324
|
+
try {
|
|
3325
|
+
const response = await fetch(
|
|
3326
|
+
`${tunnel.baseUrl.replace(/\/+$/, "")}${intakePath}/${endpoint}`,
|
|
3327
|
+
{
|
|
3328
|
+
method: "POST",
|
|
3329
|
+
headers: {
|
|
3330
|
+
"content-type": "application/json",
|
|
3331
|
+
"x-api-key": tunnel.apiKey
|
|
3332
|
+
},
|
|
3333
|
+
body: json,
|
|
3334
|
+
signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS)
|
|
3335
|
+
}
|
|
3336
|
+
);
|
|
3337
|
+
return await delivery(endpoint, response);
|
|
3338
|
+
} catch (error) {
|
|
3339
|
+
debugLogger2.debug(`Sending ${endpoint} through the tunnel failed:`, error);
|
|
3340
|
+
return "unreached";
|
|
3341
|
+
}
|
|
3342
|
+
}
|
|
3343
|
+
__name(postThroughTunnel, "postThroughTunnel");
|
|
3344
|
+
async function post(endpoint, body) {
|
|
3345
|
+
const url = `${telemetryUrl()}/${endpoint}`;
|
|
3346
|
+
const json = JSON.stringify(body);
|
|
3347
|
+
const viaTunnel = await postThroughTunnel(endpoint, json);
|
|
3348
|
+
if (viaTunnel !== "unreached") return viaTunnel === "accepted";
|
|
3349
|
+
try {
|
|
3350
|
+
let response;
|
|
3351
|
+
try {
|
|
3352
|
+
response = await send(url, json);
|
|
3353
|
+
} catch (error) {
|
|
3354
|
+
const ca = UNTRUSTED_ISSUER_CODES.has(errorCode(error) ?? "") ? caWithSystemStore() : void 0;
|
|
3355
|
+
if (!ca) throw error;
|
|
3356
|
+
response = await send(url, json, ca);
|
|
3357
|
+
}
|
|
3358
|
+
return await delivery(endpoint, response) === "accepted";
|
|
3359
|
+
} catch (error) {
|
|
3360
|
+
debugLogger2.debug(`Sending ${endpoint} failed:`, error);
|
|
3361
|
+
return false;
|
|
3362
|
+
}
|
|
3363
|
+
}
|
|
3364
|
+
__name(post, "post");
|
|
3365
|
+
function readSendState(file) {
|
|
3366
|
+
try {
|
|
3367
|
+
return JSON.parse(fs5.readFileSync(file, "utf8"));
|
|
3368
|
+
} catch {
|
|
3369
|
+
return {};
|
|
3370
|
+
}
|
|
3371
|
+
}
|
|
3372
|
+
__name(readSendState, "readSendState");
|
|
3373
|
+
async function sendProductTelemetry(now = /* @__PURE__ */ new Date()) {
|
|
3374
|
+
const current = state;
|
|
3375
|
+
if (!current) return;
|
|
3376
|
+
resolveInstall(current);
|
|
3377
|
+
const directory = telemetryDir();
|
|
3378
|
+
if (isUsageReportingEnabled(current.config)) {
|
|
3379
|
+
const stateFile = path6.join(directory, "state.json");
|
|
3380
|
+
const sendState = readSendState(stateFile);
|
|
3381
|
+
if (!sendState.lastUsageSentAt || now.getTime() - sendState.lastUsageSentAt >= USAGE_SEND_INTERVAL_MS) {
|
|
3382
|
+
current.ledger.persist();
|
|
3383
|
+
const usage = collectUsage(path6.join(directory, "usage"), now);
|
|
3384
|
+
const payload = {
|
|
3385
|
+
schema: PRODUCT_TELEMETRY_SCHEMA,
|
|
3386
|
+
// Read only for usage metrics, so error reports alone never create
|
|
3387
|
+
// or read the installation ID.
|
|
3388
|
+
installationId: new InstallationManager().getInstallationId(),
|
|
3389
|
+
client: current.client,
|
|
3390
|
+
days: usage.days
|
|
3391
|
+
};
|
|
3392
|
+
while (payload.days.length > 1 && JSON.stringify(payload).length > MAX_USAGE_BODY_BYTES) {
|
|
3393
|
+
payload.days.shift();
|
|
3394
|
+
}
|
|
3395
|
+
if (await post("usage", payload)) {
|
|
3396
|
+
for (const file of usage.completedFiles) {
|
|
3397
|
+
fs5.rmSync(file, { force: true });
|
|
3398
|
+
}
|
|
3399
|
+
try {
|
|
3400
|
+
fs5.mkdirSync(directory, { recursive: true });
|
|
3401
|
+
fs5.writeFileSync(
|
|
3402
|
+
stateFile,
|
|
3403
|
+
JSON.stringify({ ...sendState, lastUsageSentAt: now.getTime() })
|
|
3404
|
+
);
|
|
3405
|
+
} catch {
|
|
3406
|
+
}
|
|
3407
|
+
}
|
|
3408
|
+
}
|
|
3409
|
+
} else {
|
|
3410
|
+
fs5.rmSync(path6.join(directory, "usage"), { recursive: true, force: true });
|
|
3411
|
+
}
|
|
3412
|
+
if (errorReporting?.enabled) {
|
|
3413
|
+
const collected = collectErrorReports(errorReporting.directory);
|
|
3414
|
+
const payload = {
|
|
3415
|
+
schema: PRODUCT_TELEMETRY_SCHEMA,
|
|
3416
|
+
client: current.client,
|
|
3417
|
+
errors: []
|
|
3418
|
+
};
|
|
3419
|
+
const sent = [];
|
|
3420
|
+
collected.reports.forEach((report, index) => {
|
|
3421
|
+
payload.errors.push(report);
|
|
3422
|
+
if (payload.errors.length > 1 && JSON.stringify(payload).length > MAX_ERROR_BODY_BYTES) {
|
|
3423
|
+
payload.errors.pop();
|
|
3424
|
+
} else {
|
|
3425
|
+
sent.push(collected.files[index]);
|
|
3426
|
+
}
|
|
3427
|
+
});
|
|
3428
|
+
if (payload.errors.length > 0 && await post("errors", payload)) {
|
|
3429
|
+
for (const file of sent) fs5.rmSync(file, { force: true });
|
|
3430
|
+
}
|
|
3431
|
+
} else if (errorReporting) {
|
|
3432
|
+
fs5.rmSync(errorReporting.directory, { recursive: true, force: true });
|
|
3433
|
+
}
|
|
3434
|
+
}
|
|
3435
|
+
__name(sendProductTelemetry, "sendProductTelemetry");
|
|
3436
|
+
|
|
2706
3437
|
// packages/core/src/telemetry/uiTelemetry.ts
|
|
2707
3438
|
init_esbuild_shims();
|
|
2708
3439
|
import { EventEmitter } from "node:events";
|
|
@@ -3256,16 +3987,16 @@ var apiActivityTracker = new ApiActivityTracker();
|
|
|
3256
3987
|
|
|
3257
3988
|
// packages/core/src/services/tokenUsageService.ts
|
|
3258
3989
|
init_esbuild_shims();
|
|
3259
|
-
import
|
|
3260
|
-
import { randomUUID } from "node:crypto";
|
|
3990
|
+
import path8 from "node:path";
|
|
3991
|
+
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
3261
3992
|
|
|
3262
3993
|
// packages/core/src/utils/jsonl-utils.ts
|
|
3263
3994
|
init_esbuild_shims();
|
|
3264
|
-
import
|
|
3265
|
-
import
|
|
3995
|
+
import fs6 from "node:fs";
|
|
3996
|
+
import path7 from "node:path";
|
|
3266
3997
|
import readline from "node:readline";
|
|
3267
3998
|
import { finished } from "node:stream/promises";
|
|
3268
|
-
var
|
|
3999
|
+
var debugLogger3 = createDebugLogger("JSONL");
|
|
3269
4000
|
var fileLocks = /* @__PURE__ */ new Map();
|
|
3270
4001
|
function getFileLock(filePath) {
|
|
3271
4002
|
if (!fileLocks.has(filePath)) {
|
|
@@ -3279,7 +4010,7 @@ function recoverObjectsFromLine(line) {
|
|
|
3279
4010
|
let depth = 0;
|
|
3280
4011
|
let inString = false;
|
|
3281
4012
|
let escape = false;
|
|
3282
|
-
let
|
|
4013
|
+
let start2 = -1;
|
|
3283
4014
|
let complete = true;
|
|
3284
4015
|
for (let i = 0; i < line.length; i++) {
|
|
3285
4016
|
const c = line[i];
|
|
@@ -3298,22 +4029,22 @@ function recoverObjectsFromLine(line) {
|
|
|
3298
4029
|
continue;
|
|
3299
4030
|
}
|
|
3300
4031
|
if (c === "{") {
|
|
3301
|
-
if (depth === 0)
|
|
4032
|
+
if (depth === 0) start2 = i;
|
|
3302
4033
|
depth++;
|
|
3303
4034
|
} else if (c === "}") {
|
|
3304
4035
|
depth--;
|
|
3305
|
-
if (depth === 0 &&
|
|
3306
|
-
const fragment = line.slice(
|
|
4036
|
+
if (depth === 0 && start2 >= 0) {
|
|
4037
|
+
const fragment = line.slice(start2, i + 1);
|
|
3307
4038
|
try {
|
|
3308
4039
|
out.push(JSON.parse(fragment));
|
|
3309
4040
|
} catch {
|
|
3310
4041
|
complete = false;
|
|
3311
4042
|
}
|
|
3312
|
-
|
|
4043
|
+
start2 = -1;
|
|
3313
4044
|
} else if (depth < 0) {
|
|
3314
4045
|
complete = false;
|
|
3315
4046
|
depth = 0;
|
|
3316
|
-
|
|
4047
|
+
start2 = -1;
|
|
3317
4048
|
}
|
|
3318
4049
|
} else if (depth === 0 && !/\s/.test(c)) {
|
|
3319
4050
|
complete = false;
|
|
@@ -3321,7 +4052,7 @@ function recoverObjectsFromLine(line) {
|
|
|
3321
4052
|
}
|
|
3322
4053
|
return {
|
|
3323
4054
|
records: out,
|
|
3324
|
-
complete: complete && out.length > 0 && depth === 0 && !inString &&
|
|
4055
|
+
complete: complete && out.length > 0 && depth === 0 && !inString && start2 === -1
|
|
3325
4056
|
};
|
|
3326
4057
|
}
|
|
3327
4058
|
__name(recoverObjectsFromLine, "recoverObjectsFromLine");
|
|
@@ -3335,14 +4066,14 @@ function parseLineTolerantWithIntegrity(line, filePath) {
|
|
|
3335
4066
|
if (parsed !== null && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
3336
4067
|
return { records: [parsed], complete: true };
|
|
3337
4068
|
}
|
|
3338
|
-
|
|
4069
|
+
debugLogger3.warn(`Skipping non-object JSONL value in ${filePath}`);
|
|
3339
4070
|
return { records: [], complete: false };
|
|
3340
4071
|
} catch {
|
|
3341
4072
|
const recovered = recoverObjectsFromLine(line);
|
|
3342
4073
|
if (recovered.records.length === 0) {
|
|
3343
|
-
|
|
4074
|
+
debugLogger3.warn(`Failed to parse line in ${filePath}`);
|
|
3344
4075
|
} else {
|
|
3345
|
-
|
|
4076
|
+
debugLogger3.warn(
|
|
3346
4077
|
`Recovered ${recovered.records.length} record(s) from malformed line in ${filePath}`
|
|
3347
4078
|
);
|
|
3348
4079
|
}
|
|
@@ -3371,7 +4102,7 @@ async function readLinesWithIntegrityInternal(filePath, count, options = {}, bud
|
|
|
3371
4102
|
let rl;
|
|
3372
4103
|
try {
|
|
3373
4104
|
options.signal?.throwIfAborted();
|
|
3374
|
-
fileStream = options.signal ?
|
|
4105
|
+
fileStream = options.signal ? fs6.createReadStream(filePath, { signal: options.signal }) : fs6.createReadStream(filePath);
|
|
3375
4106
|
rl = readline.createInterface({
|
|
3376
4107
|
input: fileStream,
|
|
3377
4108
|
crlfDelay: Infinity
|
|
@@ -3398,7 +4129,7 @@ async function readLinesWithIntegrityInternal(filePath, count, options = {}, bud
|
|
|
3398
4129
|
} catch (error) {
|
|
3399
4130
|
options.signal?.throwIfAborted();
|
|
3400
4131
|
if (error.code !== "ENOENT") {
|
|
3401
|
-
|
|
4132
|
+
debugLogger3.error(
|
|
3402
4133
|
`Error reading up to ${count} ${budget} from ${filePath}:`,
|
|
3403
4134
|
error
|
|
3404
4135
|
);
|
|
@@ -3422,7 +4153,7 @@ async function read(filePath, options = {}) {
|
|
|
3422
4153
|
let fileStream;
|
|
3423
4154
|
let rl;
|
|
3424
4155
|
try {
|
|
3425
|
-
fileStream =
|
|
4156
|
+
fileStream = fs6.createReadStream(filePath);
|
|
3426
4157
|
rl = readline.createInterface({
|
|
3427
4158
|
input: fileStream,
|
|
3428
4159
|
crlfDelay: Infinity
|
|
@@ -3439,7 +4170,7 @@ async function read(filePath, options = {}) {
|
|
|
3439
4170
|
} catch (error) {
|
|
3440
4171
|
if (error.code !== "ENOENT") {
|
|
3441
4172
|
options.onIncompleteRead?.();
|
|
3442
|
-
|
|
4173
|
+
debugLogger3.error(`Error reading ${filePath}:`, error);
|
|
3443
4174
|
if (options.throwOnNonEnoentError) {
|
|
3444
4175
|
throw error;
|
|
3445
4176
|
}
|
|
@@ -3456,12 +4187,12 @@ async function writeLine(filePath, data) {
|
|
|
3456
4187
|
await lock.runExclusive(async () => {
|
|
3457
4188
|
const line = `${JSON.stringify(data)}
|
|
3458
4189
|
`;
|
|
3459
|
-
const dir =
|
|
4190
|
+
const dir = path7.dirname(filePath);
|
|
3460
4191
|
if (!ensuredDirs.has(dir)) {
|
|
3461
|
-
await
|
|
4192
|
+
await fs6.promises.mkdir(dir, { recursive: true });
|
|
3462
4193
|
ensuredDirs.add(dir);
|
|
3463
4194
|
}
|
|
3464
|
-
await
|
|
4195
|
+
await fs6.promises.appendFile(filePath, Buffer.from(line, "utf8"), {
|
|
3465
4196
|
flush: true
|
|
3466
4197
|
});
|
|
3467
4198
|
});
|
|
@@ -3470,16 +4201,16 @@ __name(writeLine, "writeLine");
|
|
|
3470
4201
|
function writeLineSync(filePath, data) {
|
|
3471
4202
|
const line = `${JSON.stringify(data)}
|
|
3472
4203
|
`;
|
|
3473
|
-
const dir =
|
|
3474
|
-
if (!
|
|
3475
|
-
|
|
4204
|
+
const dir = path7.dirname(filePath);
|
|
4205
|
+
if (!fs6.existsSync(dir)) {
|
|
4206
|
+
fs6.mkdirSync(dir, { recursive: true });
|
|
3476
4207
|
}
|
|
3477
|
-
|
|
4208
|
+
fs6.appendFileSync(filePath, Buffer.from(line, "utf8"), { flush: true });
|
|
3478
4209
|
}
|
|
3479
4210
|
__name(writeLineSync, "writeLineSync");
|
|
3480
4211
|
function exists(filePath) {
|
|
3481
4212
|
try {
|
|
3482
|
-
const stats =
|
|
4213
|
+
const stats = fs6.statSync(filePath);
|
|
3483
4214
|
return stats.isFile() && stats.size > 0;
|
|
3484
4215
|
} catch {
|
|
3485
4216
|
return false;
|
|
@@ -3488,7 +4219,7 @@ function exists(filePath) {
|
|
|
3488
4219
|
__name(exists, "exists");
|
|
3489
4220
|
|
|
3490
4221
|
// packages/core/src/services/tokenUsageService.ts
|
|
3491
|
-
var
|
|
4222
|
+
var debugLogger4 = createDebugLogger("TOKEN_USAGE");
|
|
3492
4223
|
var USAGE_DIR_NAME = "usage";
|
|
3493
4224
|
var FILE_PREFIX = "token-usage-";
|
|
3494
4225
|
var FILE_EXTENSION = ".jsonl";
|
|
@@ -3584,14 +4315,14 @@ function normalizePeriodValue(period, value) {
|
|
|
3584
4315
|
}
|
|
3585
4316
|
__name(normalizePeriodValue, "normalizePeriodValue");
|
|
3586
4317
|
function usageDir() {
|
|
3587
|
-
return
|
|
4318
|
+
return path8.join(Storage.getRuntimeBaseDir(), USAGE_DIR_NAME);
|
|
3588
4319
|
}
|
|
3589
4320
|
__name(usageDir, "usageDir");
|
|
3590
4321
|
function getTokenUsageFilePath(month) {
|
|
3591
4322
|
if (!isValidMonth(month)) {
|
|
3592
4323
|
throw new Error(`Invalid month value "${month}". Expected YYYY-MM.`);
|
|
3593
4324
|
}
|
|
3594
|
-
return
|
|
4325
|
+
return path8.join(usageDir(), `${FILE_PREFIX}${month}${FILE_EXTENSION}`);
|
|
3595
4326
|
}
|
|
3596
4327
|
__name(getTokenUsageFilePath, "getTokenUsageFilePath");
|
|
3597
4328
|
function toNonNegativeInteger(value) {
|
|
@@ -3625,7 +4356,7 @@ function apiResponseEventToTokenUsageRecord(config, event) {
|
|
|
3625
4356
|
);
|
|
3626
4357
|
return {
|
|
3627
4358
|
schemaVersion: SCHEMA_VERSION,
|
|
3628
|
-
id:
|
|
4359
|
+
id: randomUUID3(),
|
|
3629
4360
|
timestamp,
|
|
3630
4361
|
localDate: localParts.date,
|
|
3631
4362
|
localMonth: localParts.month,
|
|
@@ -3665,7 +4396,7 @@ async function readRecordsForMonth(month) {
|
|
|
3665
4396
|
}
|
|
3666
4397
|
}
|
|
3667
4398
|
if (dropped > 0) {
|
|
3668
|
-
|
|
4399
|
+
debugLogger4.warn(
|
|
3669
4400
|
`Dropped ${dropped}/${records.length} invalid record(s) from ${filePath}`
|
|
3670
4401
|
);
|
|
3671
4402
|
}
|
|
@@ -3735,7 +4466,7 @@ var suppressedCountByCode = /* @__PURE__ */ new Map();
|
|
|
3735
4466
|
var TOKEN_USAGE_FAILURE_LOG_COOLDOWN_MS = 6e4;
|
|
3736
4467
|
var _now = /* @__PURE__ */ __name(() => Date.now(), "_now");
|
|
3737
4468
|
function logTokenUsageWriteFailure(error) {
|
|
3738
|
-
|
|
4469
|
+
debugLogger4.warn("Failed to record token usage:", error);
|
|
3739
4470
|
const code = error.code;
|
|
3740
4471
|
if (code && code !== "ENOENT") {
|
|
3741
4472
|
const now = _now();
|
|
@@ -3909,17 +4640,18 @@ function normalizeToolCallEvent(event) {
|
|
|
3909
4640
|
return normalized;
|
|
3910
4641
|
}
|
|
3911
4642
|
__name(normalizeToolCallEvent, "normalizeToolCallEvent");
|
|
3912
|
-
var
|
|
4643
|
+
var debugLogger5 = createDebugLogger("TELEMETRY_SINK");
|
|
3913
4644
|
function runToolTelemetrySink(sink) {
|
|
3914
4645
|
try {
|
|
3915
4646
|
sink();
|
|
3916
4647
|
} catch (e) {
|
|
3917
|
-
|
|
4648
|
+
debugLogger5.debug("Telemetry sink failed (best-effort):", e);
|
|
3918
4649
|
}
|
|
3919
4650
|
}
|
|
3920
4651
|
__name(runToolTelemetrySink, "runToolTelemetrySink");
|
|
3921
4652
|
function logStartSession(config, event, previousSessionId) {
|
|
3922
4653
|
O1CodeLogger.getInstance(config)?.logStartSessionEvent(event);
|
|
4654
|
+
productUsage(config)?.session(config);
|
|
3923
4655
|
if (!isTelemetrySdkInitialized()) return;
|
|
3924
4656
|
const attributes = {
|
|
3925
4657
|
...getCommonAttributes(config),
|
|
@@ -3960,6 +4692,7 @@ function logSessionEnd(config) {
|
|
|
3960
4692
|
__name(logSessionEnd, "logSessionEnd");
|
|
3961
4693
|
function logUserPrompt(config, event) {
|
|
3962
4694
|
O1CodeLogger.getInstance(config)?.logNewPromptEvent(event);
|
|
4695
|
+
productUsage(config)?.prompt();
|
|
3963
4696
|
if (!isTelemetrySdkInitialized()) return;
|
|
3964
4697
|
const attributes = {
|
|
3965
4698
|
...getCommonAttributes(config),
|
|
@@ -4019,6 +4752,10 @@ function logToolCall(config, event) {
|
|
|
4019
4752
|
});
|
|
4020
4753
|
runToolTelemetrySink(() => {
|
|
4021
4754
|
O1CodeLogger.getInstance(config)?.logToolCallEvent(normalizedEvent);
|
|
4755
|
+
productUsage(config)?.toolCall(
|
|
4756
|
+
normalizedEvent.function_name,
|
|
4757
|
+
normalizedEvent.tool_type
|
|
4758
|
+
);
|
|
4022
4759
|
});
|
|
4023
4760
|
if (!isTelemetrySdkInitialized()) return;
|
|
4024
4761
|
runToolTelemetrySink(() => {
|
|
@@ -4183,6 +4920,7 @@ function logApiError(config, event, sessionId, uiSubagentIdentity) {
|
|
|
4183
4920
|
recordUiTelemetryEventToChat(config, uiEvent);
|
|
4184
4921
|
}
|
|
4185
4922
|
O1CodeLogger.getInstance(config)?.logApiErrorEvent(event);
|
|
4923
|
+
productUsage(config)?.apiError(event.status_code, event.error_type);
|
|
4186
4924
|
if (!isTelemetrySdkInitialized()) return;
|
|
4187
4925
|
const attributes = {
|
|
4188
4926
|
...getCommonAttributes(config),
|
|
@@ -4256,6 +4994,12 @@ function logApiResponse(config, event, sessionId, uiSubagentIdentity) {
|
|
|
4256
4994
|
recordUiTelemetryEventToChat(config, uiEvent);
|
|
4257
4995
|
}
|
|
4258
4996
|
O1CodeLogger.getInstance(config)?.logApiResponseEvent(event);
|
|
4997
|
+
productUsage(config)?.apiResponse(
|
|
4998
|
+
config,
|
|
4999
|
+
event.auth_type,
|
|
5000
|
+
event.input_token_count,
|
|
5001
|
+
event.output_token_count
|
|
5002
|
+
);
|
|
4259
5003
|
if (!isTelemetrySdkInitialized()) return;
|
|
4260
5004
|
const attributes = {
|
|
4261
5005
|
...getCommonAttributes(config),
|
|
@@ -4369,6 +5113,7 @@ function logNextSpeakerCheck(config, event) {
|
|
|
4369
5113
|
__name(logNextSpeakerCheck, "logNextSpeakerCheck");
|
|
4370
5114
|
function logSlashCommand(config, event) {
|
|
4371
5115
|
O1CodeLogger.getInstance(config)?.logSlashCommandEvent(event);
|
|
5116
|
+
productUsage(config)?.slashCommand(event.command, event.built_in);
|
|
4372
5117
|
if (!isTelemetrySdkInitialized()) return;
|
|
4373
5118
|
const attributes = {
|
|
4374
5119
|
...getCommonAttributes(config),
|
|
@@ -4517,6 +5262,7 @@ function logApiRetry(config, event) {
|
|
|
4517
5262
|
__name(logApiRetry, "logApiRetry");
|
|
4518
5263
|
function logSubagentExecution(config, event) {
|
|
4519
5264
|
O1CodeLogger.getInstance(config)?.logSubagentExecutionEvent(event);
|
|
5265
|
+
productUsage(config)?.subagent();
|
|
4520
5266
|
if (!isTelemetrySdkInitialized()) return;
|
|
4521
5267
|
const attributes = {
|
|
4522
5268
|
...getCommonAttributes(config),
|
|
@@ -5044,10 +5790,10 @@ init_esbuild_shims();
|
|
|
5044
5790
|
|
|
5045
5791
|
// packages/core/src/tools/truncation.ts
|
|
5046
5792
|
init_esbuild_shims();
|
|
5047
|
-
import * as
|
|
5048
|
-
import * as
|
|
5793
|
+
import * as fs7 from "node:fs/promises";
|
|
5794
|
+
import * as path9 from "node:path";
|
|
5049
5795
|
import * as crypto from "node:crypto";
|
|
5050
|
-
var
|
|
5796
|
+
var debugLogger6 = createDebugLogger("TRUNCATION");
|
|
5051
5797
|
var PREVIEW_SIZE_CHARS = 2e3;
|
|
5052
5798
|
var MAX_FILE_SIZE_BYTES = 50 * 1024 * 1024;
|
|
5053
5799
|
var MAX_SESSION_BYTES = 500 * 1024 * 1024;
|
|
@@ -5117,8 +5863,8 @@ async function truncateAndSaveToFile(content, fileName, projectTempDir, threshol
|
|
|
5117
5863
|
tailChars += lines[i].length + 1;
|
|
5118
5864
|
}
|
|
5119
5865
|
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 =
|
|
5866
|
+
const safeFileName = `${path9.basename(fileName)}.output`;
|
|
5867
|
+
const outputFile = path9.join(projectTempDir, safeFileName);
|
|
5122
5868
|
const wrappedMessage = `${TOOL_OUTPUT_TRUNCATED_PREFIX}.
|
|
5123
5869
|
The full output has been saved to: ${outputFile}
|
|
5124
5870
|
To read the complete output, use the ${ReadFileTool.Name} tool with the absolute file path above.
|
|
@@ -5130,8 +5876,8 @@ ${truncatedContent}`;
|
|
|
5130
5876
|
return { content };
|
|
5131
5877
|
}
|
|
5132
5878
|
try {
|
|
5133
|
-
await
|
|
5134
|
-
await
|
|
5879
|
+
await fs7.mkdir(projectTempDir, { recursive: true });
|
|
5880
|
+
await fs7.writeFile(outputFile, content, {
|
|
5135
5881
|
mode: 384,
|
|
5136
5882
|
...exclusive ? { flag: "wx" } : {}
|
|
5137
5883
|
});
|
|
@@ -5140,7 +5886,7 @@ ${truncatedContent}`;
|
|
|
5140
5886
|
outputFile
|
|
5141
5887
|
};
|
|
5142
5888
|
} catch (error) {
|
|
5143
|
-
|
|
5889
|
+
debugLogger6.warn(
|
|
5144
5890
|
`Failed to save truncated output to ${outputFile}:`,
|
|
5145
5891
|
error
|
|
5146
5892
|
);
|
|
@@ -5246,14 +5992,14 @@ function generatePreview(content) {
|
|
|
5246
5992
|
}
|
|
5247
5993
|
__name(generatePreview, "generatePreview");
|
|
5248
5994
|
function normalizeToolResultCallId(callId) {
|
|
5249
|
-
const safeCallId =
|
|
5995
|
+
const safeCallId = path9.basename(callId).replace(/\x00/g, "_");
|
|
5250
5996
|
return !safeCallId || safeCallId === "." || safeCallId === ".." ? void 0 : safeCallId;
|
|
5251
5997
|
}
|
|
5252
5998
|
__name(normalizeToolResultCallId, "normalizeToolResultCallId");
|
|
5253
5999
|
async function persistAndTruncateToolResult(callId, toolName, content, config) {
|
|
5254
6000
|
const byteSize = Buffer.byteLength(content, "utf-8");
|
|
5255
6001
|
if (byteSize > MAX_FILE_SIZE_BYTES) {
|
|
5256
|
-
|
|
6002
|
+
debugLogger6.warn(
|
|
5257
6003
|
`Tool result for ${toolName} exceeds ${MAX_FILE_SIZE_BYTES} bytes (${byteSize}), skipping disk persistence`
|
|
5258
6004
|
);
|
|
5259
6005
|
return {
|
|
@@ -5263,7 +6009,7 @@ async function persistAndTruncateToolResult(callId, toolName, content, config) {
|
|
|
5263
6009
|
}
|
|
5264
6010
|
const budgetUsed = config.getToolResultBytesWritten();
|
|
5265
6011
|
if (budgetUsed + byteSize > MAX_SESSION_BYTES) {
|
|
5266
|
-
|
|
6012
|
+
debugLogger6.warn(
|
|
5267
6013
|
`Session tool result budget exhausted (${budgetUsed} + ${byteSize} > ${MAX_SESSION_BYTES}), skipping disk persistence`
|
|
5268
6014
|
);
|
|
5269
6015
|
return {
|
|
@@ -5274,7 +6020,7 @@ async function persistAndTruncateToolResult(callId, toolName, content, config) {
|
|
|
5274
6020
|
config.trackToolResultBytes(byteSize);
|
|
5275
6021
|
const safeCallId = normalizeToolResultCallId(callId);
|
|
5276
6022
|
if (!safeCallId) {
|
|
5277
|
-
|
|
6023
|
+
debugLogger6.warn(
|
|
5278
6024
|
`Invalid callId for disk persistence: ${JSON.stringify(callId)}`
|
|
5279
6025
|
);
|
|
5280
6026
|
config.trackToolResultBytes(-byteSize);
|
|
@@ -5286,10 +6032,10 @@ async function persistAndTruncateToolResult(callId, toolName, content, config) {
|
|
|
5286
6032
|
const outputDirectory = config.getExecutionEnvironment?.()?.outputDirectory;
|
|
5287
6033
|
try {
|
|
5288
6034
|
const toolResultsDir = outputDirectory ?? config.storage.getToolResultsDir();
|
|
5289
|
-
const outputFile =
|
|
5290
|
-
await
|
|
6035
|
+
const outputFile = path9.join(toolResultsDir, `${safeCallId}.txt`);
|
|
6036
|
+
await fs7.mkdir(toolResultsDir, { recursive: true });
|
|
5291
6037
|
if (outputDirectory !== void 0) {
|
|
5292
|
-
await
|
|
6038
|
+
await fs7.writeFile(outputFile, content, { mode: 384, flag: "wx" });
|
|
5293
6039
|
} else {
|
|
5294
6040
|
await atomicWriteFile(outputFile, content, {
|
|
5295
6041
|
mode: 384,
|
|
@@ -5304,7 +6050,7 @@ async function persistAndTruncateToolResult(callId, toolName, content, config) {
|
|
|
5304
6050
|
bytesWritten: byteSize
|
|
5305
6051
|
};
|
|
5306
6052
|
} catch (error) {
|
|
5307
|
-
|
|
6053
|
+
debugLogger6.warn("Failed to persist tool result:", error);
|
|
5308
6054
|
try {
|
|
5309
6055
|
const fallback = await truncateAndSaveToFile(
|
|
5310
6056
|
content,
|
|
@@ -5327,7 +6073,7 @@ async function persistAndTruncateToolResult(callId, toolName, content, config) {
|
|
|
5327
6073
|
return { content: fallback.content, bytesWritten: 0 };
|
|
5328
6074
|
} catch (fallbackError) {
|
|
5329
6075
|
config.trackToolResultBytes(-byteSize);
|
|
5330
|
-
|
|
6076
|
+
debugLogger6.warn("Fallback truncation also failed:", fallbackError);
|
|
5331
6077
|
return {
|
|
5332
6078
|
content: buildStub(content, byteSize, "(disk persistence unavailable)"),
|
|
5333
6079
|
bytesWritten: 0
|
|
@@ -5339,7 +6085,7 @@ __name(persistAndTruncateToolResult, "persistAndTruncateToolResult");
|
|
|
5339
6085
|
function buildStub(content, byteSize, filePathOrNote) {
|
|
5340
6086
|
const preview = generatePreview(content);
|
|
5341
6087
|
const sizeKb = Math.round(byteSize / 1024);
|
|
5342
|
-
const isFilePath =
|
|
6088
|
+
const isFilePath = path9.isAbsolute(filePathOrNote);
|
|
5343
6089
|
const fullDigest = crypto.createHash("sha256").update(content).digest("hex");
|
|
5344
6090
|
if (isFilePath) {
|
|
5345
6091
|
return `<persisted-output>
|
|
@@ -5667,7 +6413,7 @@ function buildMcpClassifierInput(options) {
|
|
|
5667
6413
|
__name(buildMcpClassifierInput, "buildMcpClassifierInput");
|
|
5668
6414
|
|
|
5669
6415
|
// packages/core/src/tools/mcp-tool.ts
|
|
5670
|
-
var
|
|
6416
|
+
var debugLogger7 = createDebugLogger("MCP_TOOL");
|
|
5671
6417
|
var MCP_DEAD_SESSION_ERROR_PATTERN = /session (not found|terminated|expired)/i;
|
|
5672
6418
|
var MCP_CONNECTION_ERROR_PATTERNS = [
|
|
5673
6419
|
/ECONNREFUSED/i,
|
|
@@ -5816,28 +6562,28 @@ var DiscoveredMCPToolInvocation = class _DiscoveredMCPToolInvocation extends Bas
|
|
|
5816
6562
|
return null;
|
|
5817
6563
|
}
|
|
5818
6564
|
try {
|
|
5819
|
-
|
|
6565
|
+
debugLogger7.info(
|
|
5820
6566
|
`Attempting to reconnect MCP server '${this.serverName}'...`
|
|
5821
6567
|
);
|
|
5822
6568
|
const toolRegistry = this.cliConfig.getToolRegistry();
|
|
5823
6569
|
await toolRegistry.discoverToolsForServer(this.serverName);
|
|
5824
6570
|
const newTool = await toolRegistry.ensureTool(this.registeredToolName);
|
|
5825
6571
|
if (newTool instanceof DiscoveredMCPTool) {
|
|
5826
|
-
|
|
6572
|
+
debugLogger7.info(
|
|
5827
6573
|
`Successfully reconnected to MCP server '${this.serverName}'`
|
|
5828
6574
|
);
|
|
5829
6575
|
return newTool;
|
|
5830
6576
|
}
|
|
5831
6577
|
return null;
|
|
5832
6578
|
} catch (error) {
|
|
5833
|
-
|
|
6579
|
+
debugLogger7.error(
|
|
5834
6580
|
`Failed to reconnect MCP server '${this.serverName}': ${error}`
|
|
5835
6581
|
);
|
|
5836
6582
|
return null;
|
|
5837
6583
|
}
|
|
5838
6584
|
}
|
|
5839
6585
|
async handleReconnectOnError(error, signal, updateOutput) {
|
|
5840
|
-
|
|
6586
|
+
debugLogger7.error(`MCP server error '${this.serverName}': ${error}`);
|
|
5841
6587
|
if (signal.aborted) {
|
|
5842
6588
|
throw error;
|
|
5843
6589
|
}
|
|
@@ -5852,7 +6598,7 @@ var DiscoveredMCPToolInvocation = class _DiscoveredMCPToolInvocation extends Bas
|
|
|
5852
6598
|
throw new Error(_DiscoveredMCPToolInvocation.UNSAFE_REPLAY_ERROR_MESSAGE);
|
|
5853
6599
|
}
|
|
5854
6600
|
if (this.retryCount < _DiscoveredMCPToolInvocation.MAX_RECONNECT_RETRIES) {
|
|
5855
|
-
|
|
6601
|
+
debugLogger7.info(
|
|
5856
6602
|
`Reconnection attempt ${this.retryCount + 1}/${_DiscoveredMCPToolInvocation.MAX_RECONNECT_RETRIES} for MCP server '${this.serverName}'`
|
|
5857
6603
|
);
|
|
5858
6604
|
const newTool = await this.attemptReconnect();
|
|
@@ -5884,7 +6630,7 @@ var DiscoveredMCPToolInvocation = class _DiscoveredMCPToolInvocation extends Bas
|
|
|
5884
6630
|
return newInvocation.execute(signal, updateOutput);
|
|
5885
6631
|
}
|
|
5886
6632
|
} else if (this.retryCount >= _DiscoveredMCPToolInvocation.MAX_RECONNECT_RETRIES) {
|
|
5887
|
-
|
|
6633
|
+
debugLogger7.error(
|
|
5888
6634
|
`Max reconnection attempts (${_DiscoveredMCPToolInvocation.MAX_RECONNECT_RETRIES}) reached for MCP server '${this.serverName}'`
|
|
5889
6635
|
);
|
|
5890
6636
|
}
|
|
@@ -6104,7 +6850,7 @@ var DiscoveredMCPToolInvocation = class _DiscoveredMCPToolInvocation extends Bas
|
|
|
6104
6850
|
const cause = getErrorMessage(error);
|
|
6105
6851
|
const reason = timeoutSignal.aborted || error instanceof Error && error.name === "TimeoutError" || isMcpSdkRequestTimeout(error) ? `resource read timed out (limit: ${timeoutMs} ms)` : cause;
|
|
6106
6852
|
const warning = `Warning: MCP App '${this.appResourceUri}' from '${this.serverName}' could not be displayed: ${reason}`;
|
|
6107
|
-
|
|
6853
|
+
debugLogger7.warn(
|
|
6108
6854
|
reason === cause ? warning : `${warning} (cause: ${cause})`
|
|
6109
6855
|
);
|
|
6110
6856
|
return {
|
|
@@ -6543,9 +7289,9 @@ async function boundMcpImageBlocks(rawResponseParts, signal, subject) {
|
|
|
6543
7289
|
}
|
|
6544
7290
|
const message = `Unable to bound MCP image from ${subject} (${media.mimeType}): ${getErrorMessage(error)}`;
|
|
6545
7291
|
if (error.code === "renderer_unavailable") {
|
|
6546
|
-
|
|
7292
|
+
debugLogger7.warn(message);
|
|
6547
7293
|
} else {
|
|
6548
|
-
|
|
7294
|
+
debugLogger7.debug(message);
|
|
6549
7295
|
}
|
|
6550
7296
|
}
|
|
6551
7297
|
if (!bounded || bounded.data === media.data && bounded.mimeType === media.mimeType) {
|
|
@@ -7118,14 +7864,16 @@ var NextSpeakerCheckEvent = class {
|
|
|
7118
7864
|
function makeSlashCommandEvent({
|
|
7119
7865
|
command,
|
|
7120
7866
|
subcommand,
|
|
7121
|
-
status
|
|
7867
|
+
status,
|
|
7868
|
+
built_in
|
|
7122
7869
|
}) {
|
|
7123
7870
|
return {
|
|
7124
7871
|
"event.name": "slash_command",
|
|
7125
7872
|
"event.timestamp": (/* @__PURE__ */ new Date()).toISOString(),
|
|
7126
7873
|
command,
|
|
7127
7874
|
subcommand,
|
|
7128
|
-
status
|
|
7875
|
+
status,
|
|
7876
|
+
...built_in !== void 0 ? { built_in } : {}
|
|
7129
7877
|
};
|
|
7130
7878
|
}
|
|
7131
7879
|
__name(makeSlashCommandEvent, "makeSlashCommandEvent");
|
|
@@ -7905,15 +8653,15 @@ __name(memoryFreshnessNote, "memoryFreshnessNote");
|
|
|
7905
8653
|
|
|
7906
8654
|
// packages/core/src/tools/file-read-permission.ts
|
|
7907
8655
|
init_esbuild_shims();
|
|
7908
|
-
import
|
|
8656
|
+
import path10 from "node:path";
|
|
7909
8657
|
function getFileReadDefaultPermission(config, requestedPath) {
|
|
7910
|
-
const filePath = realpathNearestExisting(
|
|
8658
|
+
const filePath = realpathNearestExisting(path10.resolve(requestedPath));
|
|
7911
8659
|
const workspaceContext = config.getWorkspaceContext();
|
|
7912
8660
|
const allowedRoots = [
|
|
7913
8661
|
config.storage.getProjectTempDir(),
|
|
7914
8662
|
// Background subagent transcripts live under <projectDir>/subagents/ and
|
|
7915
8663
|
// are advertised to the model as polling targets via read_file.
|
|
7916
|
-
|
|
8664
|
+
path10.join(config.storage.getProjectDir(), "subagents"),
|
|
7917
8665
|
Storage.getGlobalTempDir(),
|
|
7918
8666
|
...config.storage.getUserSkillsDirs(),
|
|
7919
8667
|
Storage.getUserExtensionsDir(),
|
|
@@ -7951,7 +8699,7 @@ __name(getFileReadDefaultPermission, "getFileReadDefaultPermission");
|
|
|
7951
8699
|
|
|
7952
8700
|
// packages/core/src/services/visionBridge/vision-bridge-service.ts
|
|
7953
8701
|
init_esbuild_shims();
|
|
7954
|
-
var
|
|
8702
|
+
var debugLogger8 = createDebugLogger("VISION_BRIDGE");
|
|
7955
8703
|
var turnImageCounts = /* @__PURE__ */ new WeakMap();
|
|
7956
8704
|
var BRIDGE_MAX_OUTPUT_TOKENS = 2048;
|
|
7957
8705
|
var VISION_BRIDGE_TIMEOUT_MS = 3e4;
|
|
@@ -8221,7 +8969,7 @@ async function runVisionBridge(params) {
|
|
|
8221
8969
|
try {
|
|
8222
8970
|
timeoutSignal = AbortSignal.timeout(timeoutMs);
|
|
8223
8971
|
combinedSignal = AbortSignal.any([signal, timeoutSignal]);
|
|
8224
|
-
|
|
8972
|
+
debugLogger8.debug(`calling ${modelId} for ${toConvert.length} image(s)`);
|
|
8225
8973
|
const { text } = await runSideQuery(config, {
|
|
8226
8974
|
contents: requestContents,
|
|
8227
8975
|
abortSignal: combinedSignal,
|
|
@@ -8240,7 +8988,7 @@ async function runVisionBridge(params) {
|
|
|
8240
8988
|
});
|
|
8241
8989
|
const description = stripThinkTags(text ?? "");
|
|
8242
8990
|
if (description.length === 0) {
|
|
8243
|
-
|
|
8991
|
+
debugLogger8.warn(`${modelId} returned an empty description`);
|
|
8244
8992
|
return failure(
|
|
8245
8993
|
"the vision model returned no description",
|
|
8246
8994
|
parts,
|
|
@@ -8248,7 +8996,7 @@ async function runVisionBridge(params) {
|
|
|
8248
8996
|
{ modelId, ...egress }
|
|
8249
8997
|
);
|
|
8250
8998
|
}
|
|
8251
|
-
|
|
8999
|
+
debugLogger8.debug(
|
|
8252
9000
|
`vision bridge transcription via ${modelId} (${description.length} chars)`
|
|
8253
9001
|
);
|
|
8254
9002
|
return {
|
|
@@ -8274,7 +9022,7 @@ async function runVisionBridge(params) {
|
|
|
8274
9022
|
};
|
|
8275
9023
|
} catch (error) {
|
|
8276
9024
|
if (signal.aborted) {
|
|
8277
|
-
|
|
9025
|
+
debugLogger8.debug(`conversion cancelled via ${modelId}`);
|
|
8278
9026
|
return {
|
|
8279
9027
|
applied: false,
|
|
8280
9028
|
status: "skipped",
|
|
@@ -8286,13 +9034,13 @@ async function runVisionBridge(params) {
|
|
|
8286
9034
|
}
|
|
8287
9035
|
const timedOut = !!combinedSignal?.aborted && !!timeoutSignal?.aborted;
|
|
8288
9036
|
if (timedOut && attempt < VISION_BRIDGE_MAX_ATTEMPTS) {
|
|
8289
|
-
|
|
9037
|
+
debugLogger8.warn(
|
|
8290
9038
|
`conversion attempt ${attempt} via ${modelId} timed out after ${timeoutMs}ms; retrying`
|
|
8291
9039
|
);
|
|
8292
9040
|
continue;
|
|
8293
9041
|
}
|
|
8294
9042
|
const reason = timedOut ? `timed out after ${timeoutMs}ms (${VISION_BRIDGE_MAX_ATTEMPTS} attempts)` : error instanceof Error ? error.message : String(error);
|
|
8295
|
-
|
|
9043
|
+
debugLogger8.warn(`conversion failed via ${modelId}: ${reason}`);
|
|
8296
9044
|
return failure(reason, parts, omittedCount, {
|
|
8297
9045
|
modelId,
|
|
8298
9046
|
// The timeout message is safe to show; an arbitrary provider error is not
|
|
@@ -8307,7 +9055,7 @@ async function runVisionBridge(params) {
|
|
|
8307
9055
|
__name(runVisionBridge, "runVisionBridge");
|
|
8308
9056
|
|
|
8309
9057
|
// packages/core/src/tools/read-file.ts
|
|
8310
|
-
var
|
|
9058
|
+
var debugLogger9 = createDebugLogger("READ_FILE_CACHE");
|
|
8311
9059
|
var ReadFileToolInvocation = class extends BaseToolInvocation {
|
|
8312
9060
|
constructor(config, params) {
|
|
8313
9061
|
super(params);
|
|
@@ -8351,7 +9099,7 @@ var ReadFileToolInvocation = class extends BaseToolInvocation {
|
|
|
8351
9099
|
);
|
|
8352
9100
|
}
|
|
8353
9101
|
async execute(signal) {
|
|
8354
|
-
const absPath =
|
|
9102
|
+
const absPath = path11.resolve(this.params.file_path);
|
|
8355
9103
|
const projectRoot = this.config.getTargetDir();
|
|
8356
9104
|
const isAutoMem = isAnyAutoMemPath(absPath, projectRoot);
|
|
8357
9105
|
const cacheEnabled = !this.config.getFileReadCacheDisabled();
|
|
@@ -8361,9 +9109,9 @@ var ReadFileToolInvocation = class extends BaseToolInvocation {
|
|
|
8361
9109
|
const isFullRead = this.params.offset === void 0 && this.params.limit === void 0 && this.params.pages === void 0;
|
|
8362
9110
|
let stats;
|
|
8363
9111
|
try {
|
|
8364
|
-
stats = await
|
|
9112
|
+
stats = await fs8.stat(absPath);
|
|
8365
9113
|
} catch (err) {
|
|
8366
|
-
|
|
9114
|
+
debugLogger9.debug("stat-failed", {
|
|
8367
9115
|
path: absPath,
|
|
8368
9116
|
code: err.code
|
|
8369
9117
|
});
|
|
@@ -8373,10 +9121,10 @@ var ReadFileToolInvocation = class extends BaseToolInvocation {
|
|
|
8373
9121
|
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
9122
|
// microcompaction flips this off when it blanks it).
|
|
8375
9123
|
status.entry.readResidentInHistory && (status.entry.lastWriteAt === void 0 || status.entry.lastReadAt > status.entry.lastWriteAt)) {
|
|
8376
|
-
|
|
9124
|
+
debugLogger9.debug("hit", { path: absPath });
|
|
8377
9125
|
return this.unchangedResult(absPath);
|
|
8378
9126
|
}
|
|
8379
|
-
|
|
9127
|
+
debugLogger9.debug("miss", { path: absPath, state: status.state });
|
|
8380
9128
|
}
|
|
8381
9129
|
const prepareForVisionBridge = shouldRunVisionBridge(this.config);
|
|
8382
9130
|
let result = await processSingleFileContent(
|
|
@@ -8415,10 +9163,10 @@ var ReadFileToolInvocation = class extends BaseToolInvocation {
|
|
|
8415
9163
|
}
|
|
8416
9164
|
let llmContent;
|
|
8417
9165
|
if (result.isTruncated && result.linesShown && result.originalLineCount !== void 0) {
|
|
8418
|
-
const [
|
|
9166
|
+
const [start2, end] = result.linesShown;
|
|
8419
9167
|
const total = result.originalLineCount;
|
|
8420
9168
|
const totalLabel = result.originalLineCountExact === false ? `at least ${total}` : total;
|
|
8421
|
-
llmContent = `Showing lines ${
|
|
9169
|
+
llmContent = `Showing lines ${start2}-${end} of ${totalLabel} total lines.
|
|
8422
9170
|
|
|
8423
9171
|
---
|
|
8424
9172
|
|
|
@@ -8428,7 +9176,7 @@ ${result.llmContent}`;
|
|
|
8428
9176
|
}
|
|
8429
9177
|
if (typeof llmContent === "string" && isAutoMem) {
|
|
8430
9178
|
try {
|
|
8431
|
-
const memStat = stats ?? await
|
|
9179
|
+
const memStat = stats ?? await fs8.stat(absPath);
|
|
8432
9180
|
const note = memoryFreshnessNote(memStat.mtimeMs);
|
|
8433
9181
|
if (note) {
|
|
8434
9182
|
llmContent = note + llmContent;
|
|
@@ -8448,7 +9196,7 @@ ${result.llmContent}`;
|
|
|
8448
9196
|
"read" /* READ */,
|
|
8449
9197
|
lines,
|
|
8450
9198
|
mimetype,
|
|
8451
|
-
|
|
9199
|
+
path11.extname(this.params.file_path),
|
|
8452
9200
|
programming_language
|
|
8453
9201
|
)
|
|
8454
9202
|
);
|
|
@@ -8462,7 +9210,7 @@ ${result.llmContent}`;
|
|
|
8462
9210
|
if (!candidate) return result;
|
|
8463
9211
|
const { imageParts } = splitImageParts(result.llmContent);
|
|
8464
9212
|
if (imageParts.length === 0 || !hasImageParts(imageParts)) {
|
|
8465
|
-
|
|
9213
|
+
debugLogger9.debug("pdf vision bridge candidate contained no images");
|
|
8466
9214
|
return this.restorePdfFallback(result, "Vision bridge could not run.");
|
|
8467
9215
|
}
|
|
8468
9216
|
const sourceContext = {
|
|
@@ -8483,7 +9231,7 @@ ${result.llmContent}`;
|
|
|
8483
9231
|
const notice = formatVisionBridgeNotice(bridgeResult);
|
|
8484
9232
|
if (bridgeResult.status === "ok" && bridgeResult.applied && bridgeResult.parts != null) {
|
|
8485
9233
|
if (bridgeResult.convertedCount !== imageParts.length || bridgeResult.omittedCount !== 0) {
|
|
8486
|
-
|
|
9234
|
+
debugLogger9.debug("pdf vision bridge omitted candidate pages");
|
|
8487
9235
|
return this.restorePdfFallback(
|
|
8488
9236
|
result,
|
|
8489
9237
|
`${notice} The transcription was discarded because the bridge did not transcribe every rendered PDF page.`
|
|
@@ -8493,7 +9241,7 @@ ${result.llmContent}`;
|
|
|
8493
9241
|
if (bridgedParts.some(
|
|
8494
9242
|
(part) => part.inlineData != null || part.fileData != null
|
|
8495
9243
|
)) {
|
|
8496
|
-
|
|
9244
|
+
debugLogger9.debug("pdf vision bridge returned media data");
|
|
8497
9245
|
return this.restorePdfFallback(
|
|
8498
9246
|
result,
|
|
8499
9247
|
`${notice} The transcription was discarded because the bridge returned an unsafe media payload.`
|
|
@@ -8527,7 +9275,7 @@ ${result.llmContent}`;
|
|
|
8527
9275
|
);
|
|
8528
9276
|
} catch (error) {
|
|
8529
9277
|
signal.throwIfAborted();
|
|
8530
|
-
|
|
9278
|
+
debugLogger9.debug(
|
|
8531
9279
|
`pdf vision bridge failed before replacement: ${String(error instanceof Error ? error.message : error)}`
|
|
8532
9280
|
);
|
|
8533
9281
|
return this.restorePdfFallback(
|
|
@@ -8686,7 +9434,7 @@ var ReadFileTool = class _ReadFileTool extends BaseDeclarativeTool {
|
|
|
8686
9434
|
if (!filePath) {
|
|
8687
9435
|
return "The 'file_path' parameter must be non-empty.";
|
|
8688
9436
|
}
|
|
8689
|
-
if (!
|
|
9437
|
+
if (!path11.isAbsolute(filePath)) {
|
|
8690
9438
|
return `File path must be absolute, but was relative: ${filePath}. You must provide an absolute path.`;
|
|
8691
9439
|
}
|
|
8692
9440
|
params.offset ??= void 0;
|
|
@@ -8696,7 +9444,7 @@ var ReadFileTool = class _ReadFileTool extends BaseDeclarativeTool {
|
|
|
8696
9444
|
const pages = params.pages.trim();
|
|
8697
9445
|
params.pages = pages.length > 0 ? pages : void 0;
|
|
8698
9446
|
}
|
|
8699
|
-
if (
|
|
9447
|
+
if (path11.extname(filePath).toLowerCase() === ".ipynb" && (params.offset !== void 0 || params.limit !== void 0 || params.pages !== void 0)) {
|
|
8700
9448
|
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
9449
|
}
|
|
8702
9450
|
if (params.offset !== void 0 && (!Number.isInteger(params.offset) || params.offset < 0)) {
|
|
@@ -8732,6 +9480,8 @@ var ReadFileTool = class _ReadFileTool extends BaseDeclarativeTool {
|
|
|
8732
9480
|
export {
|
|
8733
9481
|
isInternalPromptId,
|
|
8734
9482
|
import_lru_cache,
|
|
9483
|
+
startProductTelemetry,
|
|
9484
|
+
recordErrorReport,
|
|
8735
9485
|
MAIN_SOURCE,
|
|
8736
9486
|
subagentNameContext,
|
|
8737
9487
|
subagentIdentityContext,
|
|
@@ -8920,6 +9670,11 @@ export {
|
|
|
8920
9670
|
* Modified by the o1-code project; see NOTICE.
|
|
8921
9671
|
* SPDX-License-Identifier: Apache-2.0
|
|
8922
9672
|
*/
|
|
9673
|
+
/**
|
|
9674
|
+
* @license
|
|
9675
|
+
* Copyright 2026 o1-code contributors
|
|
9676
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
9677
|
+
*/
|
|
8923
9678
|
/**
|
|
8924
9679
|
* @license
|
|
8925
9680
|
* Copyright 2025 Qwen
|