@organizaone/o1-code 0.14.1 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (275) hide show
  1. package/bundled/qc-helper/docs/configuration/settings.md +9 -4
  2. package/bundled/qc-helper/docs/features/commands.md +45 -44
  3. package/bundled/qc-helper/docs/features/remote-sessions.md +102 -0
  4. package/chunks/{MaxSizedBox-K6LS4AHI.js → MaxSizedBox-O7G2ZRYR.js} +20 -20
  5. package/chunks/{StandaloneSessionPicker-VAKM7ZGE.js → StandaloneSessionPicker-BIGZLIRY.js} +37 -37
  6. package/chunks/{acp-subagent-executor-VUIOR2ET.js → acp-subagent-executor-A7RO7LHH.js} +22 -22
  7. package/chunks/{acpAgent-NJVBZXCP.js → acpAgent-AFGYYTUH.js} +63 -63
  8. package/chunks/{agent-VHLE7AET.js → agent-PV23LGME.js} +11 -11
  9. package/chunks/{agent-headless-BJF6NKGR.js → agent-headless-PEA6NNMN.js} +11 -11
  10. package/chunks/{all-providers-3TZIHJW7.js → all-providers-FZ4ESP4Z.js} +2 -2
  11. package/chunks/{anthropicContentGenerator-VB7JA4B3.js → anthropicContentGenerator-XWCHKKOI.js} +5 -5
  12. package/chunks/{bridge-3FUGH7LN.js → bridge-7L53A4AM.js} +22 -22
  13. package/chunks/{chunk-XUJZPD2H.js → chunk-2DQNWI5T.js} +3 -3
  14. package/chunks/{chunk-T7FPP3WA.js → chunk-2RSWDZVO.js} +96 -52
  15. package/chunks/{chunk-NWQNQ2JQ.js → chunk-35KQ7CDI.js} +5 -5
  16. package/chunks/{chunk-74D4F6ZR.js → chunk-3ERDAKD7.js} +1 -1
  17. package/chunks/{chunk-Z277EETV.js → chunk-3FJHPBCE.js} +1 -1
  18. package/chunks/{chunk-JNEJLREI.js → chunk-3ZMBFNPV.js} +1 -1
  19. package/chunks/{chunk-I4J3GC2D.js → chunk-46H5ZP7X.js} +1 -1
  20. package/chunks/{chunk-VVJHO662.js → chunk-4DRJFWXS.js} +3 -3
  21. package/chunks/{chunk-5A5PF6UU.js → chunk-4EVSBPVF.js} +1 -1
  22. package/chunks/{chunk-VJCVMHU2.js → chunk-4JSCCVOO.js} +7 -7
  23. package/chunks/{chunk-6VO6YKJ3.js → chunk-4LXE6MLF.js} +1 -1
  24. package/chunks/{chunk-SHIS7KCU.js → chunk-4XNNJAVK.js} +2 -2
  25. package/chunks/{chunk-MPL3BISR.js → chunk-52L6JTMO.js} +3 -3
  26. package/chunks/{chunk-CSPWXNJC.js → chunk-5G7PI5O3.js} +2 -2
  27. package/chunks/{chunk-JDJVJMXU.js → chunk-5GR3V3II.js} +2 -2
  28. package/chunks/{chunk-R2Q36SDT.js → chunk-5OYTF5XP.js} +1 -1
  29. package/chunks/{chunk-A643DATS.js → chunk-6R2MXKWJ.js} +9 -6
  30. package/chunks/{chunk-EJWEWKFL.js → chunk-7DKVPPL3.js} +2 -2
  31. package/chunks/{chunk-DBH5ZQ3X.js → chunk-7EF7MDGB.js} +3 -3
  32. package/chunks/{chunk-SMZJAMZI.js → chunk-7NVHSJXM.js} +7 -7
  33. package/chunks/{chunk-YPFJPIKO.js → chunk-7UZZDG7L.js} +202 -31
  34. package/chunks/{chunk-TIYFDYIF.js → chunk-AEGEUWVC.js} +1 -1
  35. package/chunks/{chunk-XFQMTQBE.js → chunk-AVLRJ5GO.js} +10 -10
  36. package/chunks/{chunk-JFWM2L2S.js → chunk-AX74MBBW.js} +2 -2
  37. package/chunks/{chunk-WORDJV7E.js → chunk-AYCEQ2OH.js} +2 -2
  38. package/chunks/{chunk-P2AKC25G.js → chunk-B2EKPHXQ.js} +1 -1
  39. package/chunks/{chunk-QXTSKDFW.js → chunk-BYF5YB4S.js} +2 -2
  40. package/chunks/{chunk-X7TMJR6A.js → chunk-CCW5CSV7.js} +4 -4
  41. package/chunks/{chunk-32O4NVPN.js → chunk-CMW56OJG.js} +13 -13
  42. package/chunks/{chunk-N6MH3XSG.js → chunk-CRGQG4ZJ.js} +2 -2
  43. package/chunks/{chunk-5VNWNZZ4.js → chunk-DAB7MOET.js} +1 -1
  44. package/chunks/{chunk-5WA2C3YU.js → chunk-DTA6JUKZ.js} +1 -1
  45. package/chunks/{chunk-R2EIRELD.js → chunk-DWT44BB5.js} +2 -2
  46. package/chunks/{chunk-KXUAXTBE.js → chunk-DWX6K4EP.js} +1 -1
  47. package/chunks/{chunk-GAEZNPGF.js → chunk-DXXRKDEZ.js} +3 -3
  48. package/chunks/{chunk-MZ3XMTPL.js → chunk-FADOMWAI.js} +1 -1
  49. package/chunks/{chunk-ACVOTRTG.js → chunk-FF4G3BYI.js} +73 -33
  50. package/chunks/{chunk-GVGCZY46.js → chunk-FFWWJHI7.js} +4 -4
  51. package/chunks/{chunk-ND36AMUP.js → chunk-FI36HOVR.js} +1 -1
  52. package/chunks/{chunk-SRDLL4JM.js → chunk-FSDDJVL4.js} +3 -3
  53. package/chunks/{chunk-BFCJISSV.js → chunk-FXYJP742.js} +2 -2
  54. package/chunks/{chunk-4ENDHWP4.js → chunk-GEO7X3EN.js} +55 -2
  55. package/chunks/{chunk-5RGWMVLI.js → chunk-HODHQG2A.js} +2 -2
  56. package/chunks/{chunk-ACL45DSG.js → chunk-HRQT6PTP.js} +5 -5
  57. package/chunks/{chunk-XX4IZ2SW.js → chunk-HSJMAQII.js} +5 -5
  58. package/chunks/{chunk-JSAYXOQE.js → chunk-HYZ7GRES.js} +2 -2
  59. package/chunks/{chunk-URNH2X7M.js → chunk-I32MCMVV.js} +4 -4
  60. package/chunks/{chunk-YSK3J7RQ.js → chunk-JEDXP6FR.js} +1 -1
  61. package/chunks/{chunk-WB2AB6LU.js → chunk-JFCIZ63D.js} +2 -2
  62. package/chunks/{chunk-WBPIFM2X.js → chunk-JKXGHDQ2.js} +551 -5
  63. package/chunks/{chunk-ZZVIBILR.js → chunk-KEPNWFUD.js} +9 -1
  64. package/chunks/{chunk-2EGCBKYN.js → chunk-LB4ZZJJM.js} +1 -1
  65. package/chunks/{chunk-M6VRFWLT.js → chunk-LE5TRASB.js} +2 -2
  66. package/chunks/{chunk-URRLGWTK.js → chunk-LFUSSHHB.js} +1 -1
  67. package/chunks/{chunk-NQH5WCUX.js → chunk-LPF2XDE2.js} +7 -7
  68. package/chunks/{chunk-7N5GDAXK.js → chunk-MLAF3GLB.js} +3 -0
  69. package/chunks/{chunk-N5LF4EE4.js → chunk-MMXQXZWA.js} +4 -4
  70. package/chunks/{chunk-HHMGHAVL.js → chunk-NAURON7F.js} +1 -1
  71. package/chunks/{chunk-HBB3LYMT.js → chunk-NUSAKUTH.js} +1 -1
  72. package/chunks/{chunk-LPFK3TO2.js → chunk-O6GD6SFV.js} +4 -0
  73. package/chunks/{chunk-4OYDPQIT.js → chunk-OF73JBMF.js} +3 -3
  74. package/chunks/{chunk-TM5ELIJT.js → chunk-P7FKRAJ6.js} +3 -3
  75. package/chunks/{chunk-3UNHYRK5.js → chunk-PDZGLV3P.js} +8 -8
  76. package/chunks/{chunk-KCHIGNQ3.js → chunk-QMJ6GWQX.js} +1 -1
  77. package/chunks/{chunk-DKDXWZAA.js → chunk-QO72AGKU.js} +2 -2
  78. package/chunks/{chunk-5YPMVUV3.js → chunk-QPVENQJH.js} +5 -5
  79. package/chunks/{chunk-SGMEBT6K.js → chunk-QWO3KT35.js} +2 -2
  80. package/chunks/{chunk-3C53Y3EH.js → chunk-R27K7DNS.js} +5 -5
  81. package/chunks/{chunk-3HS7IEMU.js → chunk-R3ZENPTG.js} +1 -1
  82. package/chunks/{chunk-DXNQVFM7.js → chunk-RBG3RNDF.js} +1 -1
  83. package/chunks/{chunk-Q27JDWE5.js → chunk-RDQZ4Z3T.js} +2 -2
  84. package/chunks/{chunk-XS3WCMRG.js → chunk-RJ56P2F7.js} +1 -1
  85. package/chunks/{chunk-YSHODLWP.js → chunk-RONJ4ZC5.js} +3 -3
  86. package/chunks/{chunk-RBN3RLF6.js → chunk-T74COXKF.js} +13 -13
  87. package/chunks/{chunk-NSHGO4SD.js → chunk-TIJEMBWQ.js} +1 -1
  88. package/chunks/{chunk-GHM4HUC7.js → chunk-UVGSFQ4I.js} +3 -3
  89. package/chunks/{chunk-HVXQBQY4.js → chunk-VH24XB23.js} +1 -1
  90. package/chunks/{chunk-5LMV3DCZ.js → chunk-WE52DYQN.js} +2 -2
  91. package/chunks/{chunk-XS3QHNTA.js → chunk-WOGFLOFT.js} +4 -4
  92. package/chunks/{chunk-5EQBVEDH.js → chunk-XJLSYFTS.js} +3 -3
  93. package/chunks/{chunk-AWE7GF4J.js → chunk-XMF6AIIL.js} +3 -3
  94. package/chunks/{chunk-JIF2TEKH.js → chunk-XPSDYGLU.js} +1 -1
  95. package/chunks/{chunk-ZHJX6KFO.js → chunk-XXM44WQ5.js} +8 -2
  96. package/chunks/{chunk-JJPU5RIJ.js → chunk-Y3JWAVRJ.js} +1 -1
  97. package/chunks/{chunk-2V7HIDQH.js → chunk-Y5JTX5BE.js} +2 -2
  98. package/chunks/{chunk-62X5BQMO.js → chunk-YBQLV5NQ.js} +5 -5
  99. package/chunks/{chunk-FUA6Z2U4.js → chunk-YHCW34AJ.js} +1 -1
  100. package/chunks/{chunk-MFPRAXI5.js → chunk-YT5BWAWH.js} +1 -1
  101. package/chunks/{chunk-BWSTJ4LI.js → chunk-ZG3ZB6LH.js} +3 -3
  102. package/chunks/{chunk-7OFHGQYG.js → chunk-ZHRNMGGR.js} +2 -2
  103. package/chunks/{codex-subagent-executor-NGTRWYIK.js → codex-subagent-executor-JBCVWY67.js} +22 -22
  104. package/chunks/{contextCommand-7GVOH5VF.js → contextCommand-PLGPX4BU.js} +22 -22
  105. package/chunks/{core-runtime-POJAS25N.js → core-runtime-AOXGKBMN.js} +20 -20
  106. package/chunks/{create-sub-session-QCYXUHFL.js → create-sub-session-OGKW35EJ.js} +21 -21
  107. package/chunks/{daemon-git-worktree-guard-D3RHUHVC.js → daemon-git-worktree-guard-MHUJPQU4.js} +20 -20
  108. package/chunks/{daemon-status-provider-R3KRR4AS.js → daemon-status-provider-VR3TJW6Y.js} +26 -26
  109. package/chunks/{daemon-trust-policy-5NYWDYOB.js → daemon-trust-policy-HIIJ3AW2.js} +27 -27
  110. package/chunks/{daemon-trust-policy-monitor-I73M3BZX.js → daemon-trust-policy-monitor-CP2PTB7Z.js} +27 -27
  111. package/chunks/{deferred-core-runtime-S2JMS2IS.js → deferred-core-runtime-YN2YQOS3.js} +20 -20
  112. package/chunks/{edit-FAI2CHTP.js → edit-MKZIJJFV.js} +13 -13
  113. package/chunks/{en-SHMOSKM6.js → en-IMODPCQQ.js} +49 -1
  114. package/chunks/{enterPlanMode-KX7IPPYT.js → enterPlanMode-2JDPJDOI.js} +11 -11
  115. package/chunks/{environment-MVOVD7JZ.js → environment-PJB6G3DC.js} +23 -23
  116. package/chunks/{errors-DSEHKEKP.js → errors-RCPKPF4D.js} +22 -22
  117. package/chunks/{execution-tool-XRAFGCPA.js → execution-tool-QXSN5SIB.js} +13 -13
  118. package/chunks/{execution-worker-VKPVJNIG.js → execution-worker-JZMBO7AU.js} +16 -16
  119. package/chunks/{exitPlanMode-3TY5ONOY.js → exitPlanMode-B6VQ7WU4.js} +11 -11
  120. package/chunks/{fast-path-NAKYI5AD.js → fast-path-WTTSHBHO.js} +3 -3
  121. package/chunks/{fast-path-settings-YKLDHHCG.js → fast-path-settings-FIMIXD3V.js} +2 -2
  122. package/chunks/{glob-7WS7EQ5K.js → glob-GYFLWO23.js} +11 -11
  123. package/chunks/{goal-tools-5WVEBKPG.js → goal-tools-NQKMSURK.js} +11 -11
  124. package/chunks/{handleAutoUpdate-PDYNM2OD.js → handleAutoUpdate-SMCAKDKC.js} +23 -23
  125. package/chunks/{i18n-C475G3CR.js → i18n-M37YB75J.js} +21 -21
  126. package/chunks/{initializer-U77RJ3RD.js → initializer-7QNGXIFH.js} +27 -27
  127. package/chunks/{installationInfo-KJT5UHT6.js → installationInfo-WYK5GZ76.js} +20 -20
  128. package/chunks/{list-B5DL4CMZ.js → list-Q5BU32SE.js} +29 -29
  129. package/chunks/{list-agents-NYXZC74C.js → list-agents-A7UJ6VXZ.js} +2 -2
  130. package/chunks/{llm-V3GR2JCY.js → llm-FIJJDU6O.js} +53 -53
  131. package/chunks/{llm-content-generator-WSOLYSIS.js → llm-content-generator-TL62ECGM.js} +4 -4
  132. package/chunks/{loadedSettingsAdapter-RUVHFDOM.js → loadedSettingsAdapter-NQPUHSAO.js} +27 -27
  133. package/chunks/{local-execution-environment-ODOGTJ6F.js → local-execution-environment-T2TD4DV6.js} +16 -16
  134. package/chunks/{loggingContentGenerator-DLRB334C.js → loggingContentGenerator-3FNNMRBZ.js} +11 -11
  135. package/chunks/{managed-npm-update-NQTZYPEF.js → managed-npm-update-LGPY3TA6.js} +20 -20
  136. package/chunks/{mcp-WCOE7Y3F.js → mcp-J3A5XLOV.js} +27 -27
  137. package/chunks/{model-call-collection-X2EWPR6V.js → model-call-collection-5U5N23HQ.js} +1 -1
  138. package/chunks/{model-configuration-BUJWNHTG.js → model-configuration-MZ6CUBPJ.js} +28 -28
  139. package/chunks/{modelConfigUtils-HLTTOLV5.js → modelConfigUtils-5SJN5MCH.js} +22 -22
  140. package/chunks/{monitor-R5SGEUKX.js → monitor-3B7HPA37.js} +11 -11
  141. package/chunks/{nonInteractiveCli-TKBS5ML2.js → nonInteractiveCli-ENHKPCSB.js} +55 -55
  142. package/chunks/{nonInteractiveToolExecutor-JJFTNXHA.js → nonInteractiveToolExecutor-I6XHNZQV.js} +12 -12
  143. package/chunks/{notebook-edit-33OGSCHE.js → notebook-edit-BOPJ7HJ5.js} +12 -12
  144. package/chunks/{omni-CMDCQ3UQ.js → omni-NDS6RRPE.js} +9 -9
  145. package/chunks/{openaiContentGenerator-M5UV2BQJ.js → openaiContentGenerator-FD6PKK7U.js} +6 -6
  146. package/chunks/{openaiResponsesContentGenerator-S5ECTVDG.js → openaiResponsesContentGenerator-CX5BJT3H.js} +4 -4
  147. package/chunks/{processUtils-GDZ7TOHZ.js → processUtils-DYLWKVGY.js} +2 -2
  148. package/chunks/{prompt-terminal-ledger-PGEHFQ7H.js → prompt-terminal-ledger-GVYJCNHN.js} +21 -21
  149. package/chunks/{pt-IU7FRCNS.js → pt-JCXCCW4Y.js} +49 -1
  150. package/chunks/{reactive-degrade-ASMEPJ5Z.js → reactive-degrade-PWOKK52Z.js} +8 -8
  151. package/chunks/{read-file-2EDHAVNT.js → read-file-QNL7JRBN.js} +1 -1
  152. package/chunks/{resumeHistoryUtils-QW3OYHXI.js → resumeHistoryUtils-FBULSJIP.js} +24 -24
  153. package/chunks/{ripGrep-76TJJQGO.js → ripGrep-4XTRKASX.js} +1 -1
  154. package/chunks/{run-o1-code-serve-WIDKXLJF.js → run-o1-code-serve-FXAMAHOO.js} +34 -34
  155. package/chunks/{sandboxConfig-R3UG3IOZ.js → sandboxConfig-QCO5DWYQ.js} +20 -20
  156. package/chunks/{scheduled-tasks-4UBCLNXS.js → scheduled-tasks-NSSH5VOP.js} +25 -25
  157. package/chunks/{scheduler-AH4TSEXQ.js → scheduler-56522BVY.js} +22 -22
  158. package/chunks/{send-message-OSS7K7GE.js → send-message-H6B5EST3.js} +2 -2
  159. package/chunks/{serve-A4BJAAZE.js → serve-XPMWF6P2.js} +27 -27
  160. package/chunks/{server-ZDI6GJOC.js → server-3HJUOXO6.js} +52 -52
  161. package/chunks/{session-DK3CRCPB.js → session-2ZGNP3JN.js} +56 -56
  162. package/chunks/{session-J5MWNWYV.js → session-USLQVMHK.js} +2 -2
  163. package/chunks/{session-attachments-root-44FEUUR2.js → session-attachments-root-CSR65ITD.js} +20 -20
  164. package/chunks/{session-pr-refresh-ZGKQBFME.js → session-pr-refresh-7VHDYKI5.js} +24 -24
  165. package/chunks/{settings-FAWXGNOI.js → settings-7D3KTPDJ.js} +26 -26
  166. package/chunks/{shell-2TAJP2XL.js → shell-3MMVXNLH.js} +11 -11
  167. package/chunks/{skill-DNIK7OZQ.js → skill-VD4DNOVA.js} +1 -1
  168. package/chunks/{skill-settings-AK7CSZAS.js → skill-settings-6G6KNY75.js} +26 -26
  169. package/chunks/{spawnChannel-IOCLK2X3.js → spawnChannel-3G2ZEX6N.js} +21 -21
  170. package/chunks/{standalone-update-DVOARXLA.js → standalone-update-6WHFCPQK.js} +22 -22
  171. package/chunks/{startInteractiveUI-NTVZYIDU.js → startInteractiveUI-IE3JBVIA.js} +3881 -2676
  172. package/chunks/{team-create-XP7DRQAK.js → team-create-INVD7CZA.js} +11 -11
  173. package/chunks/{team-plan-approval-GOAS57I3.js → team-plan-approval-X3RPLEM5.js} +11 -11
  174. package/chunks/{terminal-image-renderer-YCLREPL4.js → terminal-image-renderer-QKR7JHLJ.js} +20 -20
  175. package/chunks/{theme-manager-XVYTKW34.js → theme-manager-JZIWFQFR.js} +20 -20
  176. package/chunks/{tool-result-media-RGRXVT5T.js → tool-result-media-UR3332TH.js} +9 -9
  177. package/chunks/{tool-search-ZMAKKG5I.js → tool-search-VFXZN2VC.js} +1 -1
  178. package/chunks/{total-session-admission-I5UDK7FQ.js → total-session-admission-GBM7FPBI.js} +22 -22
  179. package/chunks/{trustedFolders-QTPG7HMS.js → trustedFolders-GBAOKT4A.js} +21 -21
  180. package/chunks/{update-relaunch-SGPQQMNN.js → update-relaunch-FQYXBQMI.js} +5 -5
  181. package/chunks/{updateCheck-T5ZZGRHM.js → updateCheck-HDD2DZ6Y.js} +22 -22
  182. package/chunks/{upload-config-EZ62EOKL.js → upload-config-NJJI7MOI.js} +6 -6
  183. package/chunks/{useAutoAcceptIndicator-JF6JC7LL.js → useAutoAcceptIndicator-GITM657T.js} +29 -29
  184. package/chunks/{validateNonInterActiveAuth-S6X4XLNK.js → validateNonInterActiveAuth-O7MD6UW4.js} +52 -52
  185. package/chunks/{version-7F4SOHPI.js → version-TX6H2U3L.js} +1 -1
  186. package/chunks/{web-fetch-OO7L367T.js → web-fetch-RVYBM4NU.js} +1 -1
  187. package/chunks/{web-search-VN7PBUQ6.js → web-search-B6W4C5JM.js} +7 -7
  188. package/chunks/{workflow-IWSW5MOB.js → workflow-KR7EAPUM.js} +12 -12
  189. package/chunks/{workspace-providers-status-ZVH5MCVN.js → workspace-providers-status-2G6MBEVA.js} +31 -31
  190. package/chunks/{workspace-registration-store-ROZOUOYK.js → workspace-registration-store-OH6P3EPH.js} +1 -1
  191. package/chunks/{workspace-registry-CROM24XQ.js → workspace-registry-Y35XQZCS.js} +22 -22
  192. package/chunks/{workspace-runtime-coordinator-NAE37OW5.js → workspace-runtime-coordinator-U3URIEFA.js} +22 -22
  193. package/chunks/{workspace-service-VUQF5IQG.js → workspace-service-WC5WYXT6.js} +30 -30
  194. package/chunks/{workspace-skills-status-DLRICTEZ.js → workspace-skills-status-HKPF4YQD.js} +27 -27
  195. package/chunks/{workspace-trust-reconciler-ZUL5PMCB.js → workspace-trust-reconciler-3UQXQCWY.js} +29 -29
  196. package/chunks/{write-file-5SDNS6TZ.js → write-file-GTT4MO5C.js} +13 -13
  197. package/chunks/{zoom-image-PCKYJ2PJ.js → zoom-image-2KVDIK5E.js} +1 -1
  198. package/cli.js +13 -13
  199. package/execution-worker.js +1 -1
  200. package/export-transcript-document.js +1 -1
  201. package/locales/en.js +75 -0
  202. package/locales/pt.js +77 -0
  203. package/package.json +2 -2
  204. package/release-notes.json +6 -0
  205. package/vendor/o1-connect/.lintstagedrc.mjs +7 -0
  206. package/vendor/o1-connect/README.md +9 -8
  207. package/vendor/o1-connect/VENDOR.json +4 -4
  208. package/vendor/o1-connect/lib.d.mts +124 -2
  209. package/vendor/o1-connect/lib.mjs +532 -7
  210. package/vendor/tree-sitter/tree-sitter-bash.wasm +0 -0
  211. package/vendor/tree-sitter/tree-sitter.wasm +0 -0
  212. package/web-shell/assets/{abnfDiagram-VCTEODGH-BbovwPw2.js → abnfDiagram-VCTEODGH-Dh4ud-bV.js} +1 -1
  213. package/web-shell/assets/{arc-Wui7aPtG.js → arc-CzedV-8_.js} +1 -1
  214. package/web-shell/assets/{architectureDiagram-5GKGNRK7-3WH5ESB7.js → architectureDiagram-5GKGNRK7-DcdBEH6f.js} +1 -1
  215. package/web-shell/assets/{blockDiagram-NRAW4CY4-C36UiMl-.js → blockDiagram-NRAW4CY4-uDeURqM8.js} +1 -1
  216. package/web-shell/assets/{c4Diagram-UCG6FXSJ-DdnwgcM1.js → c4Diagram-UCG6FXSJ-810hyXoQ.js} +1 -1
  217. package/web-shell/assets/channel-v3XEMgos.js +1 -0
  218. package/web-shell/assets/{chunk-2Q5K7J3B-khFNk3ao.js → chunk-2Q5K7J3B-Mk0ldZt-.js} +1 -1
  219. package/web-shell/assets/{chunk-5VM5RSS4-DDLDZsfl.js → chunk-5VM5RSS4-Bz2kOVPI.js} +1 -1
  220. package/web-shell/assets/{chunk-F27PBJKO-aLJmSbub.js → chunk-F27PBJKO-CAjzX5Mt.js} +1 -1
  221. package/web-shell/assets/{chunk-G27WJ6UU-B_GSvc5F.js → chunk-G27WJ6UU-DqvudZ0O.js} +1 -1
  222. package/web-shell/assets/{chunk-JWPE2WC7-d8m9ubln.js → chunk-JWPE2WC7-Dw-KeS8S.js} +1 -1
  223. package/web-shell/assets/{chunk-LCL6LL3I-Bf5h6VmG.js → chunk-LCL6LL3I-DNF6ysro.js} +1 -1
  224. package/web-shell/assets/{chunk-POPQ4Y6H-Czd6y3Dp.js → chunk-POPQ4Y6H-DWU0wpHI.js} +1 -1
  225. package/web-shell/assets/{chunk-SVP7TREG-B03axGPa.js → chunk-SVP7TREG-BQOJiqUJ.js} +1 -1
  226. package/web-shell/assets/{chunk-XXDRQBXY-N33vsGyF.js → chunk-XXDRQBXY-icpdUXXf.js} +1 -1
  227. package/web-shell/assets/classDiagram-DTDB5LWJ-B9FB6o4A.js +1 -0
  228. package/web-shell/assets/classDiagram-v2-JRS7N3AN-B9FB6o4A.js +1 -0
  229. package/web-shell/assets/{cose-bilkent-JH36ORCC-CH_b8j1f.js → cose-bilkent-JH36ORCC-BS-UzOw7.js} +1 -1
  230. package/web-shell/assets/{cynefin-OW5HDTMX-CpdeeUn4.js → cynefin-OW5HDTMX-BWgRJWKh.js} +1 -1
  231. package/web-shell/assets/{cynefinDiagram-5FMLGOSQ-CpTzaCzt.js → cynefinDiagram-5FMLGOSQ-C6kE3QdM.js} +1 -1
  232. package/web-shell/assets/{dagre-3AP2YEHR-BTtggthC.js → dagre-3AP2YEHR-DHbMoz2D.js} +1 -1
  233. package/web-shell/assets/{diagram-S7CK7UJ4-BKgOiJsS.js → diagram-S7CK7UJ4-8S4HP9wv.js} +1 -1
  234. package/web-shell/assets/{diagram-UQ7AKVKN-I12M4b-_.js → diagram-UQ7AKVKN-CDM_fDvK.js} +1 -1
  235. package/web-shell/assets/{diagram-VSXAHHWV-C5EuyQ1H.js → diagram-VSXAHHWV-Jt_YgGmQ.js} +1 -1
  236. package/web-shell/assets/{diagram-VX7I27RA-CcsSRsvO.js → diagram-VX7I27RA-jgA2EN0U.js} +1 -1
  237. package/web-shell/assets/{diagram-Z3DM3KII-tNMV05Fn.js → diagram-Z3DM3KII-34lWgOek.js} +1 -1
  238. package/web-shell/assets/{ebnfDiagram-PWID7BFC-liAtArsc.js → ebnfDiagram-PWID7BFC-DkXkay_a.js} +1 -1
  239. package/web-shell/assets/{erDiagram-SSCWMZ5O-I4lmr_zI.js → erDiagram-SSCWMZ5O-2F7Ae8PJ.js} +1 -1
  240. package/web-shell/assets/{flowDiagram-A5DVABFB-nEXpsOvo.js → flowDiagram-A5DVABFB-DEp8HZ1Z.js} +1 -1
  241. package/web-shell/assets/{ganttDiagram-EL5Y4UJY-Dw75s1-O.js → ganttDiagram-EL5Y4UJY-DB9PwX6e.js} +1 -1
  242. package/web-shell/assets/{gitGraphDiagram-WWUBYQGX-DiLeptZ9.js → gitGraphDiagram-WWUBYQGX-CIudOlp-.js} +1 -1
  243. package/web-shell/assets/{index-BrTCjwfu.js → index-BLTYMaXa.js} +3 -3
  244. package/web-shell/assets/{index-BH44b2De.js → index-DsGnZKQl.js} +1 -1
  245. package/web-shell/assets/{infoDiagram-RXCK75RN-DCcJ_WXa.js → infoDiagram-RXCK75RN-Csm0vHSo.js} +1 -1
  246. package/web-shell/assets/{ishikawaDiagram-5VMMS53U-Cj6CqTSd.js → ishikawaDiagram-5VMMS53U-CLJXnHlY.js} +1 -1
  247. package/web-shell/assets/{journeyDiagram-EYS64GPL-CJXzA_hz.js → journeyDiagram-EYS64GPL-Cf92U7ZB.js} +1 -1
  248. package/web-shell/assets/{kanban-definition-3QL26DDD-DdNe_a61.js → kanban-definition-3QL26DDD-Dh7Te4fu.js} +1 -1
  249. package/web-shell/assets/{layout-DaXP6yO1.js → layout-B5ALjnq4.js} +1 -1
  250. package/web-shell/assets/{linear-B-jZU9Hq.js → linear-CGxKsCj8.js} +1 -1
  251. package/web-shell/assets/{mermaid.core-CIdivnr2.js → mermaid.core-B_e-IZNF.js} +6 -6
  252. package/web-shell/assets/{mindmap-definition-FBJOCRG2-D0W4HbAm.js → mindmap-definition-FBJOCRG2-BftMDT3T.js} +1 -1
  253. package/web-shell/assets/{pegDiagram-XKGWAZYB-BXa0Luv-.js → pegDiagram-XKGWAZYB-CruSZoUh.js} +1 -1
  254. package/web-shell/assets/{pieDiagram-E7YTZNPT-CWQYQAXk.js → pieDiagram-E7YTZNPT-Bi9haYEh.js} +1 -1
  255. package/web-shell/assets/{quadrantDiagram-AXDQQJYC-C2rr5v8g.js → quadrantDiagram-AXDQQJYC-BY4w8seK.js} +1 -1
  256. package/web-shell/assets/{railroadDiagram-O6MQD6OU-Ixq2-sNq.js → railroadDiagram-O6MQD6OU-moN3YnCi.js} +1 -1
  257. package/web-shell/assets/{requirementDiagram-EFPCY7ZU-Bkiw-rJU.js → requirementDiagram-EFPCY7ZU-B--U5ed4.js} +1 -1
  258. package/web-shell/assets/{sankeyDiagram-P5KCCOFB-fdyaOOD3.js → sankeyDiagram-P5KCCOFB-DD3-WWOa.js} +1 -1
  259. package/web-shell/assets/{sequenceDiagram-WJ2MYXX4-DwyYk-Nn.js → sequenceDiagram-WJ2MYXX4-7AYhwUmK.js} +1 -1
  260. package/web-shell/assets/{sizeCapture-X5ZJPWSS-73pmJ9p5.js → sizeCapture-X5ZJPWSS-DM0iKsnv.js} +1 -1
  261. package/web-shell/assets/{stateDiagram-HBIQ2CUA-BuVhfbnT.js → stateDiagram-HBIQ2CUA-DpTV0LVR.js} +1 -1
  262. package/web-shell/assets/stateDiagram-v2-4QOOHH4V-BePrySOz.js +1 -0
  263. package/web-shell/assets/{swimlanes-XN3QIQJK-CzJEsLmd.js → swimlanes-XN3QIQJK-CsGNhmi3.js} +1 -1
  264. package/web-shell/assets/swimlanesDiagram-VK2B7HYN-PnJ6YOB7.js +8 -0
  265. package/web-shell/assets/{timeline-definition-24CTP7MA-DY2tlsbK.js → timeline-definition-24CTP7MA-C4M08jyd.js} +1 -1
  266. package/web-shell/assets/{vennDiagram-4TSXK5OY-jOnpk6UN.js → vennDiagram-4TSXK5OY-B3fw4hM4.js} +1 -1
  267. package/web-shell/assets/{wardleyDiagram-VM6X3IG4-ns8qvGAq.js → wardleyDiagram-VM6X3IG4-DC9yoqPT.js} +1 -1
  268. package/web-shell/assets/{xychartDiagram-S5SC5T6Z-BVvufFM8.js → xychartDiagram-S5SC5T6Z-BgQUydcN.js} +1 -1
  269. package/web-shell/index.html +1 -1
  270. package/web-shell/sw.js +1 -1
  271. package/web-shell/assets/channel-laaanioB.js +0 -1
  272. package/web-shell/assets/classDiagram-DTDB5LWJ-vy7HfQpt.js +0 -1
  273. package/web-shell/assets/classDiagram-v2-JRS7N3AN-vy7HfQpt.js +0 -1
  274. package/web-shell/assets/stateDiagram-v2-4QOOHH4V-Behbwxmi.js +0 -1
  275. package/web-shell/assets/swimlanesDiagram-VK2B7HYN-xalmucUq.js +0 -8
@@ -39,7 +39,11 @@ import tls from "node:tls";
39
39
  import { createHash as createHash3, randomBytes as randomBytes3, timingSafeEqual } from "node:crypto";
40
40
  import http5 from "node:http";
41
41
  import http4 from "node:http";
42
+ import { createHash as createHash4, randomBytes as randomBytes4 } from "node:crypto";
42
43
  import http6 from "node:http";
44
+ import https3 from "node:https";
45
+ import { isIP as isIP3 } from "node:net";
46
+ import http7 from "node:http";
43
47
  import tls4 from "node:tls";
44
48
  var TUNNEL_PATH = "/tunnel";
45
49
  var TUNNEL_PINS_PATH = "/tunnel/pins";
@@ -970,14 +974,14 @@ var TunnelAgent = class extends http4.Agent {
970
974
  return void 0;
971
975
  }
972
976
  this.opening += 1;
973
- const dial = /* @__PURE__ */ __name((host, transport) => this.connect(this.targets[host], this.pins, { ca: this.target.ca, userAgent: this.target.userAgent, env: this.target.env, transport, onOuter: /* @__PURE__ */ __name((i) => this.events.onOuter?.(i), "onOuter") }), "dial");
977
+ const dial2 = /* @__PURE__ */ __name((host, transport) => this.connect(this.targets[host], this.pins, { ca: this.target.ca, userAgent: this.target.userAgent, env: this.target.env, transport, onOuter: /* @__PURE__ */ __name((i) => this.events.onOuter?.(i), "onOuter") }), "dial2");
974
978
  const hosts = this.targets.map((_, i) => (this.preferred + i) % this.targets.length);
975
979
  const transports = this.mode === "auto" ? this.using === "ws" ? ["ws", "post"] : ["post"] : [this.using === "post" ? "post" : "ws"];
976
980
  const chain = transports.flatMap((transport) => hosts.map((host) => ({ host, transport })));
977
981
  let firstErr = null;
978
982
  const run = /* @__PURE__ */ __name((i) => {
979
983
  const at = chain[i];
980
- return dial(at.host, at.transport).then(
984
+ return dial2(at.host, at.transport).then(
981
985
  (socket) => {
982
986
  if (this.preferred !== at.host) this.preferred = at.host;
983
987
  if (this.mode === "auto" && this.using !== "post" && at.transport === "post") {
@@ -1132,6 +1136,525 @@ function startLocalServer(o) {
1132
1136
  });
1133
1137
  }
1134
1138
  __name(startLocalServer, "startLocalServer");
1139
+ var REMOTE_PROTOCOL = "o1gw-remote.v1";
1140
+ var REMOTE_AGENT_PATH = "/remote/agent";
1141
+ var LIMITS = {
1142
+ /** Any frame but a hello, as text. */
1143
+ frameBytes: 256 * 1024,
1144
+ /** A hello's `history`, as text; the hello itself may be frameBytes + historyBytes. */
1145
+ historyBytes: 512 * 1024,
1146
+ /** An `input.text`. */
1147
+ inputBytes: 64 * 1024,
1148
+ /** Outbound bytes queued for one viewer before it is closed with `bye busy`. */
1149
+ viewerQueueBytes: 512 * 1024,
1150
+ /** A peer-chosen name, id, model, version, mode or outcome (they reach the store, the audit log, an alert): characters. */
1151
+ nameChars: 128,
1152
+ /** A hello's `cwd_hint`: characters. */
1153
+ pathChars: 512,
1154
+ /** Decision requests open at once on one session; one more ends the session (`protocol`). */
1155
+ pendingMax: 64,
1156
+ /** The longest a decision request stays open, whatever `expires_at` says. */
1157
+ decisionMs: 36e5,
1158
+ /** Each side pings this often. */
1159
+ pingMs: 3e4,
1160
+ /** A peer silent this long is gone. */
1161
+ deadMs: 9e4,
1162
+ /** An agent gone this long ends the session (`idle`). */
1163
+ reconnectMs: 12e4,
1164
+ /** An ended session stays listed, and its `remote_id` re-opens for the same `session_id`, this long. */
1165
+ listedMs: 4 * 36e5
1166
+ };
1167
+ var GUID2 = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
1168
+ var DIAL_MS = 15e3;
1169
+ var HELLO_MS = 1e4;
1170
+ var UNACKED_MAX_BYTES = 4 * 1024 * 1024;
1171
+ var BACKOFF_MIN_MS = 1e3;
1172
+ var BACKOFF_MAX_MS = 3e4;
1173
+ var FATAL = /* @__PURE__ */ new Set(["taken_over", "revoked", "plan", "limit", "protocol", "unauthenticated"]);
1174
+ var tunnels = /* @__PURE__ */ new WeakMap();
1175
+ function bindTunnel(connection, tunnel) {
1176
+ tunnels.set(connection, tunnel);
1177
+ }
1178
+ __name(bindTunnel, "bindTunnel");
1179
+ function dial(via, apiKey) {
1180
+ const key = randomBytes4(16).toString("base64");
1181
+ const hostname2 = via.url.hostname.replace(/^\[|\]$/g, "");
1182
+ const secure = via.url.protocol === "https:";
1183
+ const port = Number(via.url.port || (secure ? 443 : 80));
1184
+ const headers = {
1185
+ Host: via.url.host,
1186
+ Connection: "Upgrade",
1187
+ Upgrade: "websocket",
1188
+ "Sec-WebSocket-Version": "13",
1189
+ "Sec-WebSocket-Key": key,
1190
+ "Sec-WebSocket-Protocol": REMOTE_PROTOCOL,
1191
+ Authorization: `Bearer ${apiKey}`
1192
+ };
1193
+ return new Promise((resolve, reject) => {
1194
+ let done = false;
1195
+ const settle = /* @__PURE__ */ __name((err, value) => {
1196
+ if (done) return;
1197
+ done = true;
1198
+ clearTimeout(timer);
1199
+ if (err) reject(err);
1200
+ else resolve(value);
1201
+ }, "settle");
1202
+ const req = via.agent ? http6.request({ agent: via.agent, method: "GET", path: REMOTE_AGENT_PATH, headers, setHost: false }) : secure ? https3.request({ host: hostname2, port, method: "GET", path: REMOTE_AGENT_PATH, headers, agent: false, ...isIP3(hostname2) ? {} : { servername: hostname2 } }) : http6.request({ host: hostname2, port, method: "GET", path: REMOTE_AGENT_PATH, headers, agent: false });
1203
+ const timer = setTimeout(() => {
1204
+ req.destroy();
1205
+ settle(new O1ConnectError("tunnel_unavailable", "the remote session's connection timed out"));
1206
+ }, DIAL_MS);
1207
+ timer.unref();
1208
+ req.on("response", (res) => {
1209
+ let body = "";
1210
+ res.setEncoding("utf8");
1211
+ res.on("data", (c) => {
1212
+ if (body.length < 64e3) body += c;
1213
+ });
1214
+ res.on("end", () => {
1215
+ const status = res.statusCode ?? 0;
1216
+ let code = "refused";
1217
+ let message = `HTTP ${status}`;
1218
+ try {
1219
+ const j = JSON.parse(body);
1220
+ code = j.error?.code ?? code;
1221
+ message = j.error?.message ?? message;
1222
+ } catch {
1223
+ }
1224
+ settle(new O1ConnectError("remote_refused", `the remote session was refused (HTTP ${status} ${code}): ${message}`, { cause: { status, code } }));
1225
+ });
1226
+ });
1227
+ req.on("error", (err) => settle(new O1ConnectError("tunnel_unavailable", `the remote session's connection failed: ${err.message}`, { cause: err })));
1228
+ req.on("upgrade", (res, sock, head) => {
1229
+ const accept = createHash4("sha1").update(key + GUID2).digest("base64");
1230
+ if (res.headers["sec-websocket-accept"] !== accept || res.headers["sec-websocket-protocol"] !== REMOTE_PROTOCOL) {
1231
+ sock.destroy();
1232
+ settle(new O1ConnectError("remote_protocol", "the upgrade was answered by something that is not a remote session's gateway"));
1233
+ return;
1234
+ }
1235
+ settle(null, { sock, head });
1236
+ });
1237
+ req.end();
1238
+ });
1239
+ }
1240
+ __name(dial, "dial");
1241
+ var Wire = class {
1242
+ static {
1243
+ __name(this, "Wire");
1244
+ }
1245
+ constructor(sock, head, on) {
1246
+ this.sock = sock;
1247
+ this.on = on;
1248
+ sock.on("data", (c) => this.onData(c));
1249
+ sock.on("error", () => {
1250
+ });
1251
+ sock.on("close", () => {
1252
+ if (this.gone) return;
1253
+ this.gone = true;
1254
+ on.close(this.closeCode ?? 1006);
1255
+ });
1256
+ if (head.length) this.onData(head);
1257
+ }
1258
+ sock;
1259
+ on;
1260
+ parser = new FrameParser(LIMITS.frameBytes + LIMITS.historyBytes);
1261
+ partial = null;
1262
+ closeSent = false;
1263
+ closeCode = null;
1264
+ gone = false;
1265
+ send(text) {
1266
+ if (this.gone || this.sock.destroyed) return false;
1267
+ this.sock.write(encodeFrame(OP.text, Buffer.from(text, "utf8"), randomBytes4(4)));
1268
+ return true;
1269
+ }
1270
+ /** A close handshake (code 1000 by default); the socket is cut 2 s later whatever the other side does. */
1271
+ close(code = 1e3, reason = "") {
1272
+ if (!this.closeSent && !this.sock.destroyed) {
1273
+ this.closeSent = true;
1274
+ this.closeCode ??= code;
1275
+ const r = Buffer.from(reason, "utf8").subarray(0, 100);
1276
+ this.sock.write(encodeFrame(OP.close, Buffer.concat([Buffer.from([code >> 8, code & 255]), r]), randomBytes4(4)));
1277
+ this.sock.end();
1278
+ }
1279
+ setTimeout(() => this.sock.destroy(), 2e3).unref();
1280
+ }
1281
+ destroy() {
1282
+ this.sock.destroy();
1283
+ }
1284
+ onData(chunk) {
1285
+ let frames;
1286
+ try {
1287
+ frames = this.parser.push(chunk);
1288
+ } catch (err) {
1289
+ void (err instanceof WsProtocolError);
1290
+ this.sock.destroy();
1291
+ return;
1292
+ }
1293
+ for (const f of frames) {
1294
+ if (f.opcode === OP.text || f.opcode === OP.cont && this.partial) {
1295
+ (this.partial ??= []).push(Buffer.from(f.payload));
1296
+ if (!f.fin) continue;
1297
+ const text = Buffer.concat(this.partial).toString("utf8");
1298
+ this.partial = null;
1299
+ this.on.message(text);
1300
+ } else if (f.opcode === OP.ping) {
1301
+ if (!this.sock.destroyed) this.sock.write(encodeFrame(OP.pong, Buffer.from(f.payload), randomBytes4(4)));
1302
+ } else if (f.opcode === OP.close) {
1303
+ this.closeCode ??= f.payload.length >= 2 ? f.payload.readUInt16BE(0) : 1005;
1304
+ if (!this.closeSent) {
1305
+ this.closeSent = true;
1306
+ if (!this.sock.destroyed) this.sock.write(encodeFrame(OP.close, Buffer.from(f.payload.subarray(0, 2)), randomBytes4(4)));
1307
+ }
1308
+ this.sock.end();
1309
+ } else if (f.opcode === OP.binary) {
1310
+ this.sock.destroy();
1311
+ }
1312
+ }
1313
+ }
1314
+ };
1315
+ function trimHistory(items) {
1316
+ let out = items;
1317
+ while (out.length > 0 && Buffer.byteLength(JSON.stringify(out), "utf8") > LIMITS.historyBytes) out = out.slice(Math.max(1, Math.floor(out.length / 4)));
1318
+ return out;
1319
+ }
1320
+ __name(trimHistory, "trimHistory");
1321
+ var Agent = class {
1322
+ static {
1323
+ __name(this, "Agent");
1324
+ }
1325
+ constructor(o) {
1326
+ this.o = o;
1327
+ this.model = o.session.model;
1328
+ this.approvalMode = o.session.approvalMode;
1329
+ }
1330
+ o;
1331
+ remoteId = "";
1332
+ url = "";
1333
+ state = "online";
1334
+ seq = 0;
1335
+ unacked = [];
1336
+ unackedBytes = 0;
1337
+ lastGatewaySeq = 0;
1338
+ wire = null;
1339
+ closed = false;
1340
+ attempt = 0;
1341
+ reconnectTimer = null;
1342
+ pinger = null;
1343
+ lastSeen = Date.now();
1344
+ model;
1345
+ approvalMode;
1346
+ listeners = /* @__PURE__ */ new Map();
1347
+ pending = /* @__PURE__ */ new Map();
1348
+ closedWire = null;
1349
+ log(line) {
1350
+ try {
1351
+ this.o.log?.(`remote: ${line}`);
1352
+ } catch {
1353
+ }
1354
+ }
1355
+ emit(event, e) {
1356
+ for (const fn of this.listeners.get(event) ?? []) {
1357
+ try {
1358
+ fn(e);
1359
+ } catch {
1360
+ }
1361
+ }
1362
+ }
1363
+ on(event, fn) {
1364
+ let set = this.listeners.get(event);
1365
+ if (!set) {
1366
+ set = /* @__PURE__ */ new Set();
1367
+ this.listeners.set(event, set);
1368
+ }
1369
+ set.add(fn);
1370
+ return () => {
1371
+ set.delete(fn);
1372
+ };
1373
+ }
1374
+ hello(resumeSeq) {
1375
+ const s = this.o.session;
1376
+ return {
1377
+ v: 1,
1378
+ type: "hello",
1379
+ session_id: s.id,
1380
+ name: s.name,
1381
+ cwd_hint: s.cwd ?? "",
1382
+ o1code_version: s.version,
1383
+ approval_mode: this.approvalMode,
1384
+ model: this.model,
1385
+ history: trimHistory(this.o.history()),
1386
+ ...resumeSeq !== void 0 ? { resume_seq: resumeSeq } : {}
1387
+ };
1388
+ }
1389
+ /** Dials, says hello, waits for the ready (or a bye): the first time from openRemote, then at every reconnection. */
1390
+ connect(first) {
1391
+ return dial(this.o.via, this.o.apiKey).then((d) => new Promise((resolve, reject) => {
1392
+ let ready = false;
1393
+ const timer = setTimeout(() => {
1394
+ if (!ready) wire.destroy();
1395
+ }, HELLO_MS);
1396
+ timer.unref();
1397
+ const wire = new Wire(d.sock, d.head, {
1398
+ message: /* @__PURE__ */ __name((text) => {
1399
+ let frame;
1400
+ try {
1401
+ frame = JSON.parse(text);
1402
+ } catch {
1403
+ wire.destroy();
1404
+ return;
1405
+ }
1406
+ this.lastSeen = Date.now();
1407
+ if (ready) {
1408
+ this.onFrame(wire, frame);
1409
+ return;
1410
+ }
1411
+ if (frame.type === "ready") {
1412
+ ready = true;
1413
+ clearTimeout(timer);
1414
+ this.onReady(wire, frame);
1415
+ resolve();
1416
+ } else if (frame.type === "bye") {
1417
+ reject(new O1ConnectError("remote_refused", `the remote session was refused (${frame.reason})`, { cause: { status: 0, code: frame.reason, ...frame.sessions ? { sessions: frame.sessions } : {} } }));
1418
+ }
1419
+ }, "message"),
1420
+ close: /* @__PURE__ */ __name((code) => {
1421
+ if (!ready) {
1422
+ clearTimeout(timer);
1423
+ reject(new O1ConnectError("tunnel_unavailable", `the remote session's connection closed before it was ready (${code})`));
1424
+ return;
1425
+ }
1426
+ if (this.wire === wire) this.onClose(code);
1427
+ }, "close")
1428
+ });
1429
+ this.wire = wire;
1430
+ wire.send(JSON.stringify(this.hello(first ? void 0 : this.lastGatewaySeq)));
1431
+ }));
1432
+ }
1433
+ onReady(wire, frame) {
1434
+ this.remoteId = frame.remote_id;
1435
+ this.url = frame.url;
1436
+ this.attempt = 0;
1437
+ for (const k of this.unacked) if (k.seq > frame.ack_seq) wire.send(k.text);
1438
+ if (this.state !== "online") {
1439
+ this.state = "online";
1440
+ this.emit("state", { state: "online" });
1441
+ }
1442
+ this.lastSeen = Date.now();
1443
+ if (!this.pinger) {
1444
+ this.pinger = setInterval(() => {
1445
+ if (!this.wire) return;
1446
+ if (Date.now() - this.lastSeen > LIMITS.deadMs) {
1447
+ this.log("the gateway went silent");
1448
+ this.wire.destroy();
1449
+ return;
1450
+ }
1451
+ this.wire.send(JSON.stringify({ v: 1, type: "ping" }));
1452
+ }, LIMITS.pingMs);
1453
+ this.pinger.unref();
1454
+ }
1455
+ this.log(`${frame.resumed ? "back on" : "open:"} ${this.remoteId} (${frame.viewers} viewer${frame.viewers === 1 ? "" : "s"})`);
1456
+ }
1457
+ onFrame(wire, frame) {
1458
+ switch (frame.type) {
1459
+ case "ack": {
1460
+ let i = 0;
1461
+ while (i < this.unacked.length && this.unacked[i].seq <= frame.seq) i++;
1462
+ for (const k of this.unacked.splice(0, i)) this.unackedBytes -= k.bytes;
1463
+ return;
1464
+ }
1465
+ case "input":
1466
+ case "command":
1467
+ case "decision": {
1468
+ if (frame.seq !== void 0) {
1469
+ this.lastGatewaySeq = Math.max(this.lastGatewaySeq, frame.seq);
1470
+ wire.send(JSON.stringify({ v: 1, type: "ack", seq: frame.seq }));
1471
+ }
1472
+ if (frame.type === "input") this.emit("input", { id: frame.id, text: frame.text });
1473
+ else if (frame.type === "command") this.emit("command", { id: frame.id, name: frame.name, args: frame.args });
1474
+ else {
1475
+ const p = this.pending.get(frame.id);
1476
+ this.pending.delete(frame.id);
1477
+ p?.resolve({ outcome: frame.outcome, payload: frame.payload, by: "remote" });
1478
+ this.emit("decision", { id: frame.id, outcome: frame.outcome, payload: frame.payload });
1479
+ }
1480
+ return;
1481
+ }
1482
+ case "viewer":
1483
+ this.emit("viewer", { op: frame.op, count: frame.count });
1484
+ return;
1485
+ case "resync":
1486
+ this.log("resync asked: the history goes again");
1487
+ wire.send(JSON.stringify(this.hello(this.lastGatewaySeq)));
1488
+ return;
1489
+ case "bye":
1490
+ if (FATAL.has(frame.reason)) this.end(frame.reason);
1491
+ else {
1492
+ this.log(`bye ${frame.reason}: reconnecting`);
1493
+ wire.destroy();
1494
+ }
1495
+ return;
1496
+ case "error":
1497
+ this.emit("error", { code: frame.code, ...frame.id !== void 0 ? { id: frame.id } : {} });
1498
+ return;
1499
+ case "ready":
1500
+ wire.destroy();
1501
+ return;
1502
+ case "pong":
1503
+ return;
1504
+ }
1505
+ }
1506
+ onClose(code) {
1507
+ this.wire = null;
1508
+ if (this.closed || this.state === "ended") return;
1509
+ if (this.state !== "reconnecting") {
1510
+ this.state = "reconnecting";
1511
+ this.emit("state", { state: "reconnecting" });
1512
+ this.log(`connection closed (${code}): reconnecting`);
1513
+ }
1514
+ this.scheduleReconnect();
1515
+ }
1516
+ scheduleReconnect() {
1517
+ if (this.closed || this.reconnectTimer) return;
1518
+ const delay2 = Math.min(BACKOFF_MIN_MS * 2 ** this.attempt, BACKOFF_MAX_MS);
1519
+ this.attempt += 1;
1520
+ this.reconnectTimer = setTimeout(() => {
1521
+ this.reconnectTimer = null;
1522
+ if (this.closed || this.state === "ended") return;
1523
+ this.connect(false).catch((err) => {
1524
+ if (this.closed || this.state === "ended") return;
1525
+ const cause = err instanceof O1ConnectError && err.code === "remote_refused" ? err.cause : null;
1526
+ if (cause && cause.status !== 429 && cause.status !== 503) {
1527
+ this.end(cause.status === 401 ? "revoked" : cause.status === 402 || cause.status === 403 ? "plan" : cause.status === 0 ? cause.code : "protocol");
1528
+ return;
1529
+ }
1530
+ this.log(`reconnection failed: ${err instanceof Error ? err.message : String(err)}`);
1531
+ this.scheduleReconnect();
1532
+ });
1533
+ }, delay2);
1534
+ this.reconnectTimer.unref();
1535
+ }
1536
+ stopTimers() {
1537
+ if (this.pinger) clearInterval(this.pinger);
1538
+ this.pinger = null;
1539
+ if (this.reconnectTimer) clearTimeout(this.reconnectTimer);
1540
+ this.reconnectTimer = null;
1541
+ }
1542
+ failPending() {
1543
+ for (const [id, p] of [...this.pending]) {
1544
+ this.pending.delete(id);
1545
+ p.reject(new O1ConnectError("decision_closed", `the decision ${id} was not answered: the remote session ended`));
1546
+ }
1547
+ }
1548
+ end(reason) {
1549
+ if (this.state === "ended") return;
1550
+ this.state = "ended";
1551
+ this.stopTimers();
1552
+ this.failPending();
1553
+ const w = this.wire;
1554
+ this.wire = null;
1555
+ w?.destroy();
1556
+ this.log(`ended: ${reason}`);
1557
+ this.emit("state", { state: "ended", reason });
1558
+ }
1559
+ keep(frame) {
1560
+ const text = JSON.stringify(frame);
1561
+ const bytes = Buffer.byteLength(text, "utf8");
1562
+ this.unacked.push({ seq: frame.seq, text, bytes });
1563
+ this.unackedBytes += bytes;
1564
+ while (this.unackedBytes > UNACKED_MAX_BYTES && this.unacked.length > 1) this.unackedBytes -= this.unacked.shift().bytes;
1565
+ this.wire?.send(text);
1566
+ }
1567
+ send(ev) {
1568
+ if (this.state === "ended") return;
1569
+ this.keep({ v: 1, type: "event", seq: ++this.seq, at: (/* @__PURE__ */ new Date()).toISOString(), ev });
1570
+ }
1571
+ status(s) {
1572
+ if (s.model !== void 0) this.model = s.model;
1573
+ if (s.approvalMode !== void 0) this.approvalMode = s.approvalMode;
1574
+ if (this.state === "ended") return;
1575
+ this.wire?.send(JSON.stringify({ v: 1, type: "status", state: s.state, model: this.model, approval_mode: this.approvalMode }));
1576
+ }
1577
+ requestDecision(req) {
1578
+ if (this.state === "ended") return Promise.reject(new O1ConnectError("decision_closed", "the remote session has ended"));
1579
+ return new Promise((resolve, reject) => {
1580
+ this.pending.set(req.id, { resolve, reject });
1581
+ this.keep({ v: 1, type: "decision_request", seq: ++this.seq, id: req.id, kind: req.kind, expires_at: req.expiresAt, title: req.title, summary: req.summary, options: req.options });
1582
+ });
1583
+ }
1584
+ closeDecision(id, by, outcome) {
1585
+ const p = this.pending.get(id);
1586
+ this.pending.delete(id);
1587
+ p?.reject(new O1ConnectError("decision_closed", `the decision ${id} was closed ${by === "local" ? "in the terminal" : by === "expired" ? "by its expiry" : "by the viewer's answer"}`));
1588
+ if (this.state === "ended") return;
1589
+ this.wire?.send(JSON.stringify({ v: 1, type: "decision_closed", id, outcome: outcome ?? null, by }));
1590
+ }
1591
+ close() {
1592
+ if (this.closedWire) return this.closedWire;
1593
+ this.closed = true;
1594
+ this.stopTimers();
1595
+ this.failPending();
1596
+ const w = this.wire;
1597
+ this.wire = null;
1598
+ const was = this.state;
1599
+ this.state = "ended";
1600
+ this.closedWire = new Promise((resolve) => {
1601
+ if (!w) {
1602
+ resolve();
1603
+ return;
1604
+ }
1605
+ const done = setTimeout(resolve, 2500);
1606
+ done.unref();
1607
+ w.close(1e3, "closed");
1608
+ setTimeout(() => {
1609
+ clearTimeout(done);
1610
+ resolve();
1611
+ }, 300).unref();
1612
+ });
1613
+ if (was !== "ended") this.emit("state", { state: "ended", reason: "closed" });
1614
+ this.log("closed");
1615
+ return this.closedWire;
1616
+ }
1617
+ };
1618
+ async function openRemoteImpl(opts) {
1619
+ const s = opts.session;
1620
+ if (!s || typeof s !== "object") throw new TypeError("session is required: { id, name, version, approvalMode, model, cwd? }");
1621
+ for (const k of ["id", "name", "version", "approvalMode", "model"]) {
1622
+ if (typeof s[k] !== "string" || k !== "model" && s[k] === "") throw new TypeError(`session.${k} must be a string`);
1623
+ }
1624
+ if (s.cwd !== void 0 && typeof s.cwd !== "string") throw new TypeError("session.cwd must be a string");
1625
+ const history = typeof opts.history === "function" ? opts.history : Array.isArray(opts.history) ? () => opts.history : () => [];
1626
+ let via;
1627
+ let apiKey;
1628
+ if (opts.connection) {
1629
+ const t = tunnels.get(opts.connection);
1630
+ if (!t) throw new TypeError("connection must be one this library opened (open())");
1631
+ via = { url: t.target, agent: t.agent };
1632
+ apiKey = t.token;
1633
+ } else {
1634
+ if (typeof opts.baseUrl !== "string") throw new TypeError("baseUrl (or connection) is required");
1635
+ let url;
1636
+ try {
1637
+ url = new URL(opts.baseUrl);
1638
+ } catch {
1639
+ throw new TypeError("baseUrl must be a URL");
1640
+ }
1641
+ const loopback = url.hostname === "127.0.0.1" || url.hostname === "localhost" || url.hostname === "[::1]";
1642
+ if (!(url.protocol === "https:" || url.protocol === "http:" && loopback)) throw new TypeError("baseUrl must be https (http only for a loopback host)");
1643
+ if (typeof opts.apiKey !== "string" || opts.apiKey === "") throw new TypeError("apiKey (the device key) is required with baseUrl");
1644
+ via = { url };
1645
+ apiKey = opts.apiKey;
1646
+ }
1647
+ const log = opts.log ? (line) => {
1648
+ try {
1649
+ opts.log(line);
1650
+ } catch {
1651
+ }
1652
+ } : void 0;
1653
+ const agent = new Agent({ via, apiKey, session: { ...s }, history, log });
1654
+ await agent.connect(true);
1655
+ return agent;
1656
+ }
1657
+ __name(openRemoteImpl, "openRemoteImpl");
1135
1658
  var IdentityBackoff = class {
1136
1659
  static {
1137
1660
  __name(this, "IdentityBackoff");
@@ -1250,7 +1773,7 @@ var PinSync = class {
1250
1773
  fetch() {
1251
1774
  const { target } = this.o;
1252
1775
  return new Promise((resolve, reject) => {
1253
- const req = http6.request({
1776
+ const req = http7.request({
1254
1777
  host: target.hostname,
1255
1778
  port: target.port,
1256
1779
  method: "GET",
@@ -1328,7 +1851,7 @@ async function startTunnelSession(o) {
1328
1851
  return { agent, pinSync, server, target, port: server.address().port, close };
1329
1852
  }
1330
1853
  __name(startTunnelSession, "startTunnelSession");
1331
- var VERSION = true ? "9.4.0" : "dev";
1854
+ var VERSION = true ? "9.9.0" : "dev";
1332
1855
  var O1ConnectError = class extends Error {
1333
1856
  static {
1334
1857
  __name(this, "O1ConnectError");
@@ -1340,6 +1863,10 @@ var O1ConnectError = class extends Error {
1340
1863
  this.code = code;
1341
1864
  }
1342
1865
  };
1866
+ async function openRemote(opts) {
1867
+ return openRemoteImpl(opts);
1868
+ }
1869
+ __name(openRemote, "openRemote");
1343
1870
  var DEFAULT_NAME = "aipp-connect";
1344
1871
  var TRANSPORTS = ["auto", "websocket", "post"];
1345
1872
  function entryName(name) {
@@ -1495,7 +2022,9 @@ async function open(opts) {
1495
2022
  }
1496
2023
  const baseUrl = `http://127.0.0.1:${session.port}`;
1497
2024
  log?.(`o1-connect library ${VERSION} for ${cfg.device} listening on ${baseUrl} (transport ${cfg.transport})`);
1498
- return { baseUrl, openaiBaseUrl: `${baseUrl}/v1`, apiKey, port: session.port, device: cfg.device, close: session.close };
2025
+ const connection = { baseUrl, openaiBaseUrl: `${baseUrl}/v1`, apiKey, port: session.port, device: cfg.device, close: session.close };
2026
+ bindTunnel(connection, { agent: session.agent, target: session.target, token: cfg.token });
2027
+ return connection;
1499
2028
  }
1500
2029
  __name(open, "open");
1501
2030
  async function forget(opts) {
@@ -1901,6 +2430,7 @@ async function openO1Connect(options = {}) {
1901
2430
  openaiBaseUrl: connection.openaiBaseUrl,
1902
2431
  apiKey: connection.apiKey,
1903
2432
  device: connection.device,
2433
+ openRemote: /* @__PURE__ */ __name((remoteOptions) => openRemote({ ...remoteOptions, connection }), "openRemote"),
1904
2434
  close: /* @__PURE__ */ __name(() => connection.close(), "close")
1905
2435
  };
1906
2436
  }
@@ -1977,6 +2507,21 @@ function describeO1ConnectError(error) {
1977
2507
  message: `No loopback port could be opened for the tunnel: ${error.message}`,
1978
2508
  forgetAndSetUpAgain: false
1979
2509
  };
2510
+ case "remote_refused":
2511
+ return {
2512
+ message: `The gateway would not open the remote session: ${error.message}`,
2513
+ forgetAndSetUpAgain: false
2514
+ };
2515
+ case "remote_protocol":
2516
+ return {
2517
+ message: "The address answered, but not as a remote session gateway. Check the connection and try again.",
2518
+ forgetAndSetUpAgain: false
2519
+ };
2520
+ case "decision_closed":
2521
+ return {
2522
+ message: "The question was answered elsewhere before a viewer could.",
2523
+ forgetAndSetUpAgain: false
2524
+ };
1980
2525
  default:
1981
2526
  return { message: error.message, forgetAndSetUpAgain: false };
1982
2527
  }
@@ -1985,6 +2530,7 @@ __name(describeO1ConnectError, "describeO1ConnectError");
1985
2530
 
1986
2531
  export {
1987
2532
  O1ConnectError,
2533
+ openRemote,
1988
2534
  FileTokenStorage,
1989
2535
  TokenStorageType,
1990
2536
  HybridTokenStorage,
@@ -405,6 +405,13 @@ async function readRecord(filePath) {
405
405
  const kind = value["kind"];
406
406
  const ipcPath = value["ipcPath"];
407
407
  const ipcToken = value["ipcToken"];
408
+ const remote = value["remote"];
409
+ const remoteField = typeof remote === "object" && remote !== null && typeof remote["id"] === "string" && typeof remote["since"] === "number" && Number.isFinite(remote["since"]) ? {
410
+ remote: {
411
+ id: remote["id"],
412
+ since: remote["since"]
413
+ }
414
+ } : {};
408
415
  return {
409
416
  status: "ok",
410
417
  record: {
@@ -426,7 +433,8 @@ async function readRecord(filePath) {
426
433
  // messageable", and a record written before this field existed must
427
434
  // read back identically to one written after it.
428
435
  ...typeof ipcPath === "string" && ipcPath.length > 0 ? { ipcPath } : {},
429
- ...typeof ipcToken === "string" && ipcToken.length > 0 ? { ipcToken } : {}
436
+ ...typeof ipcToken === "string" && ipcToken.length > 0 ? { ipcToken } : {},
437
+ ...remoteField
430
438
  }
431
439
  };
432
440
  }
@@ -585,7 +585,7 @@ var WorkspaceRegistrationStore = class {
585
585
  return removed;
586
586
  }
587
587
  async update(mutate) {
588
- const { atomicWriteFile } = await import("./deferred-core-runtime-S2JMS2IS.js");
588
+ const { atomicWriteFile } = await import("./deferred-core-runtime-YN2YQOS3.js");
589
589
  return withInProcessLock(this.filePath, async () => {
590
590
  const lock = await acquireFileLock(this.filePath);
591
591
  let committed = false;
@@ -2,7 +2,7 @@
2
2
  "use strict";
3
3
  import {
4
4
  performStandaloneUpdate
5
- } from "./chunk-DKDXWZAA.js";
5
+ } from "./chunk-QO72AGKU.js";
6
6
  import {
7
7
  updateEventEmitter
8
8
  } from "./chunk-KD7GIK2D.js";
@@ -16,7 +16,7 @@ import {
16
16
  } from "./chunk-PHTNY4JK.js";
17
17
  import {
18
18
  t
19
- } from "./chunk-WORDJV7E.js";
19
+ } from "./chunk-AYCEQ2OH.js";
20
20
  import {
21
21
  createDebugLogger
22
22
  } from "./chunk-UK2KIU2V.js";
@@ -2,7 +2,7 @@
2
2
  "use strict";
3
3
  import {
4
4
  t
5
- } from "./chunk-WORDJV7E.js";
5
+ } from "./chunk-AYCEQ2OH.js";
6
6
  import {
7
7
  init_esbuild_shims
8
8
  } from "./chunk-S2467S6L.js";