@organizaone/o1-code 0.14.0 → 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-HPPWSALS.js → MaxSizedBox-O7G2ZRYR.js} +20 -20
  5. package/chunks/{StandaloneSessionPicker-33VP7SUH.js → StandaloneSessionPicker-BIGZLIRY.js} +37 -37
  6. package/chunks/{acp-subagent-executor-DWJQWKOH.js → acp-subagent-executor-A7RO7LHH.js} +22 -22
  7. package/chunks/{acpAgent-YVWS7ETF.js → acpAgent-AFGYYTUH.js} +63 -63
  8. package/chunks/{agent-R7RT5UKG.js → agent-PV23LGME.js} +11 -11
  9. package/chunks/{agent-headless-6KYIBMOU.js → agent-headless-PEA6NNMN.js} +11 -11
  10. package/chunks/{all-providers-Q4R43ZUP.js → all-providers-FZ4ESP4Z.js} +2 -2
  11. package/chunks/{anthropicContentGenerator-ATM4NPH4.js → anthropicContentGenerator-XWCHKKOI.js} +5 -5
  12. package/chunks/{bridge-754JL6VX.js → bridge-7L53A4AM.js} +22 -22
  13. package/chunks/{chunk-UGHMKYXI.js → chunk-2DQNWI5T.js} +3 -3
  14. package/chunks/{chunk-DXPNJTYS.js → chunk-2RSWDZVO.js} +96 -52
  15. package/chunks/{chunk-PXDPYPPB.js → chunk-35KQ7CDI.js} +5 -5
  16. package/chunks/{chunk-UWNXU2ZC.js → chunk-3ERDAKD7.js} +1 -1
  17. package/chunks/{chunk-DQ46XHGI.js → chunk-3FJHPBCE.js} +1 -1
  18. package/chunks/{chunk-DXCM7CG5.js → chunk-3ZMBFNPV.js} +1 -1
  19. package/chunks/{chunk-4HAVHY6L.js → chunk-46H5ZP7X.js} +1 -1
  20. package/chunks/{chunk-WVGI64GW.js → chunk-4DRJFWXS.js} +3 -3
  21. package/chunks/{chunk-4IAY6AKA.js → chunk-4EVSBPVF.js} +1 -1
  22. package/chunks/{chunk-PMSRS5OT.js → chunk-4JSCCVOO.js} +7 -7
  23. package/chunks/{chunk-GCZ65CZG.js → chunk-4LXE6MLF.js} +1 -1
  24. package/chunks/{chunk-4VAEWU5T.js → chunk-4XNNJAVK.js} +2 -2
  25. package/chunks/{chunk-OUOMRLIZ.js → chunk-52L6JTMO.js} +3 -3
  26. package/chunks/{chunk-CYONP54X.js → chunk-5G7PI5O3.js} +2 -2
  27. package/chunks/{chunk-WZXNR67L.js → chunk-5GR3V3II.js} +2 -2
  28. package/chunks/{chunk-BYTLRYDP.js → chunk-5OYTF5XP.js} +1 -1
  29. package/chunks/{chunk-ELLHBURF.js → chunk-6R2MXKWJ.js} +9 -6
  30. package/chunks/{chunk-RLJV6OEI.js → chunk-7DKVPPL3.js} +2 -2
  31. package/chunks/{chunk-OP75KA2T.js → chunk-7EF7MDGB.js} +3 -3
  32. package/chunks/{chunk-FLMMLEYY.js → chunk-7NVHSJXM.js} +7 -7
  33. package/chunks/{chunk-F4OP3SP7.js → chunk-7UZZDG7L.js} +202 -31
  34. package/chunks/{chunk-TIYFDYIF.js → chunk-AEGEUWVC.js} +1 -1
  35. package/chunks/{chunk-IDW3XUXZ.js → chunk-AVLRJ5GO.js} +10 -10
  36. package/chunks/{chunk-DRUNYBAY.js → chunk-AX74MBBW.js} +2 -2
  37. package/chunks/{chunk-BZBEG24K.js → chunk-AYCEQ2OH.js} +2 -2
  38. package/chunks/{chunk-VGCLAAX6.js → chunk-B2EKPHXQ.js} +1 -1
  39. package/chunks/{chunk-QUGCROVF.js → chunk-BYF5YB4S.js} +2 -2
  40. package/chunks/{chunk-WCJ4DG5W.js → chunk-CCW5CSV7.js} +4 -4
  41. package/chunks/{chunk-MFE4NZ6F.js → chunk-CMW56OJG.js} +13 -13
  42. package/chunks/{chunk-2TP7SPZ5.js → chunk-CRGQG4ZJ.js} +2 -2
  43. package/chunks/{chunk-ECRJLXHE.js → chunk-DAB7MOET.js} +1 -1
  44. package/chunks/{chunk-XZQEP7XI.js → chunk-DTA6JUKZ.js} +1 -1
  45. package/chunks/{chunk-MTOIU4KQ.js → chunk-DWT44BB5.js} +2 -2
  46. package/chunks/{chunk-4YN5RZ7J.js → chunk-DWX6K4EP.js} +1 -1
  47. package/chunks/{chunk-R46RQJ5D.js → chunk-DXXRKDEZ.js} +3 -3
  48. package/chunks/{chunk-PBIPDGC3.js → chunk-FADOMWAI.js} +1 -1
  49. package/chunks/{chunk-KSD7JWG6.js → chunk-FF4G3BYI.js} +73 -33
  50. package/chunks/{chunk-BRM6NMBJ.js → chunk-FFWWJHI7.js} +4 -4
  51. package/chunks/{chunk-ZGTQ7AA2.js → chunk-FI36HOVR.js} +1 -1
  52. package/chunks/{chunk-IAYR7OUO.js → chunk-FSDDJVL4.js} +3 -3
  53. package/chunks/{chunk-E32KIRHX.js → chunk-FXYJP742.js} +2 -2
  54. package/chunks/{chunk-WOJHED4L.js → chunk-GEO7X3EN.js} +55 -2
  55. package/chunks/{chunk-Q3UR4EZL.js → chunk-HODHQG2A.js} +2 -2
  56. package/chunks/{chunk-RPAOR6D2.js → chunk-HRQT6PTP.js} +5 -5
  57. package/chunks/{chunk-IWBRKO4O.js → chunk-HSJMAQII.js} +5 -5
  58. package/chunks/{chunk-GPDVWG7V.js → chunk-HYZ7GRES.js} +2 -2
  59. package/chunks/{chunk-EKMUIIFT.js → chunk-I32MCMVV.js} +4 -4
  60. package/chunks/{chunk-3SLVY5NF.js → chunk-JEDXP6FR.js} +1 -1
  61. package/chunks/{chunk-6LEKNGEN.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-WDL4SFGD.js → chunk-LB4ZZJJM.js} +1 -1
  65. package/chunks/{chunk-UYI5ZAB4.js → chunk-LE5TRASB.js} +2 -2
  66. package/chunks/{chunk-LO6MBHLQ.js → chunk-LFUSSHHB.js} +1 -1
  67. package/chunks/{chunk-2XWMXXV2.js → chunk-LPF2XDE2.js} +7 -7
  68. package/chunks/{chunk-7N5GDAXK.js → chunk-MLAF3GLB.js} +3 -0
  69. package/chunks/{chunk-QTOIRHE2.js → chunk-MMXQXZWA.js} +4 -4
  70. package/chunks/{chunk-JTKTS6DH.js → chunk-NAURON7F.js} +1 -1
  71. package/chunks/{chunk-OCOAAGSK.js → chunk-NUSAKUTH.js} +1 -1
  72. package/chunks/{chunk-LPFK3TO2.js → chunk-O6GD6SFV.js} +4 -0
  73. package/chunks/{chunk-D5UXCFMS.js → chunk-OF73JBMF.js} +3 -3
  74. package/chunks/{chunk-IS4C5OYM.js → chunk-P7FKRAJ6.js} +3 -3
  75. package/chunks/{chunk-6M7XO2TT.js → chunk-PDZGLV3P.js} +8 -8
  76. package/chunks/{chunk-T6RI6SIO.js → chunk-QMJ6GWQX.js} +1 -1
  77. package/chunks/{chunk-GKZFBYIA.js → chunk-QO72AGKU.js} +2 -2
  78. package/chunks/{chunk-CZX74S5Z.js → chunk-QPVENQJH.js} +5 -5
  79. package/chunks/{chunk-LXCIUMF7.js → chunk-QWO3KT35.js} +2 -2
  80. package/chunks/{chunk-O2ADBCMQ.js → chunk-R27K7DNS.js} +5 -5
  81. package/chunks/{chunk-6MSHF37M.js → chunk-R3ZENPTG.js} +1 -1
  82. package/chunks/{chunk-73EX4AYP.js → chunk-RBG3RNDF.js} +1 -1
  83. package/chunks/{chunk-JFA2TWOW.js → chunk-RDQZ4Z3T.js} +2 -2
  84. package/chunks/{chunk-PPEYZGXY.js → chunk-RJ56P2F7.js} +1 -1
  85. package/chunks/{chunk-774724N2.js → chunk-RONJ4ZC5.js} +3 -3
  86. package/chunks/{chunk-HLDYW6C3.js → chunk-T74COXKF.js} +24 -15
  87. package/chunks/{chunk-QCYLPRBN.js → chunk-TIJEMBWQ.js} +1 -1
  88. package/chunks/{chunk-JKRLVXTQ.js → chunk-UVGSFQ4I.js} +3 -3
  89. package/chunks/{chunk-JXXIXVNJ.js → chunk-VH24XB23.js} +1 -1
  90. package/chunks/{chunk-LR425RXN.js → chunk-WE52DYQN.js} +2 -2
  91. package/chunks/{chunk-UCCMBZXE.js → chunk-WOGFLOFT.js} +4 -4
  92. package/chunks/{chunk-QKKNMGEZ.js → chunk-XJLSYFTS.js} +3 -3
  93. package/chunks/{chunk-U24LMPJ6.js → chunk-XMF6AIIL.js} +3 -3
  94. package/chunks/{chunk-LGLWBQDF.js → chunk-XPSDYGLU.js} +1 -1
  95. package/chunks/{chunk-B663GNSJ.js → chunk-XXM44WQ5.js} +8 -2
  96. package/chunks/{chunk-JJPU5RIJ.js → chunk-Y3JWAVRJ.js} +1 -1
  97. package/chunks/{chunk-SKYCFRRC.js → chunk-Y5JTX5BE.js} +2 -2
  98. package/chunks/{chunk-J4DPTFNG.js → chunk-YBQLV5NQ.js} +5 -5
  99. package/chunks/{chunk-BGFY36KV.js → chunk-YHCW34AJ.js} +1 -1
  100. package/chunks/{chunk-5ROTY2LR.js → chunk-YT5BWAWH.js} +1 -1
  101. package/chunks/{chunk-ONBWCJYT.js → chunk-ZG3ZB6LH.js} +3 -3
  102. package/chunks/{chunk-TK22VUES.js → chunk-ZHRNMGGR.js} +2 -2
  103. package/chunks/{codex-subagent-executor-G3ZX2HJX.js → codex-subagent-executor-JBCVWY67.js} +22 -22
  104. package/chunks/{contextCommand-IF774I4W.js → contextCommand-PLGPX4BU.js} +22 -22
  105. package/chunks/{core-runtime-ELY6VKUI.js → core-runtime-AOXGKBMN.js} +20 -20
  106. package/chunks/{create-sub-session-RZHUEHSA.js → create-sub-session-OGKW35EJ.js} +21 -21
  107. package/chunks/{daemon-git-worktree-guard-HOJUEK65.js → daemon-git-worktree-guard-MHUJPQU4.js} +20 -20
  108. package/chunks/{daemon-status-provider-KQJ6IUKL.js → daemon-status-provider-VR3TJW6Y.js} +26 -26
  109. package/chunks/{daemon-trust-policy-RVSOP4YB.js → daemon-trust-policy-HIIJ3AW2.js} +27 -27
  110. package/chunks/{daemon-trust-policy-monitor-TJXSCF2M.js → daemon-trust-policy-monitor-CP2PTB7Z.js} +27 -27
  111. package/chunks/{deferred-core-runtime-CQTNUYWA.js → deferred-core-runtime-YN2YQOS3.js} +20 -20
  112. package/chunks/{edit-TPM2DNPS.js → edit-MKZIJJFV.js} +13 -13
  113. package/chunks/{en-XS2TOI7O.js → en-IMODPCQQ.js} +50 -1
  114. package/chunks/{enterPlanMode-JMUYL54M.js → enterPlanMode-2JDPJDOI.js} +11 -11
  115. package/chunks/{environment-DVQ7HBSV.js → environment-PJB6G3DC.js} +23 -23
  116. package/chunks/{errors-HTQC3EOA.js → errors-RCPKPF4D.js} +22 -22
  117. package/chunks/{execution-tool-HPTFRT7Y.js → execution-tool-QXSN5SIB.js} +13 -13
  118. package/chunks/{execution-worker-OHAPJ65Q.js → execution-worker-JZMBO7AU.js} +16 -16
  119. package/chunks/{exitPlanMode-7NS6HU7Q.js → exitPlanMode-B6VQ7WU4.js} +11 -11
  120. package/chunks/{fast-path-3QZF72UJ.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-XODT6XBV.js → glob-GYFLWO23.js} +11 -11
  123. package/chunks/{goal-tools-M5YYKW4D.js → goal-tools-NQKMSURK.js} +11 -11
  124. package/chunks/{handleAutoUpdate-JJY2TBI5.js → handleAutoUpdate-SMCAKDKC.js} +23 -23
  125. package/chunks/{i18n-S5SNCG5V.js → i18n-M37YB75J.js} +21 -21
  126. package/chunks/{initializer-Q3IEACFR.js → initializer-7QNGXIFH.js} +27 -27
  127. package/chunks/{installationInfo-MNHJANSD.js → installationInfo-WYK5GZ76.js} +20 -20
  128. package/chunks/{list-CKFXLSNZ.js → list-Q5BU32SE.js} +29 -29
  129. package/chunks/{list-agents-NYXZC74C.js → list-agents-A7UJ6VXZ.js} +2 -2
  130. package/chunks/{llm-4IO6RQBA.js → llm-FIJJDU6O.js} +53 -53
  131. package/chunks/{llm-content-generator-KQJMYPVA.js → llm-content-generator-TL62ECGM.js} +4 -4
  132. package/chunks/{loadedSettingsAdapter-FNZN7KZO.js → loadedSettingsAdapter-NQPUHSAO.js} +27 -27
  133. package/chunks/{local-execution-environment-5PDMJSCV.js → local-execution-environment-T2TD4DV6.js} +16 -16
  134. package/chunks/{loggingContentGenerator-L6P4X3RK.js → loggingContentGenerator-3FNNMRBZ.js} +11 -11
  135. package/chunks/{managed-npm-update-LI3C5IPC.js → managed-npm-update-LGPY3TA6.js} +20 -20
  136. package/chunks/{mcp-L2RYM2CA.js → mcp-J3A5XLOV.js} +27 -27
  137. package/chunks/{model-call-collection-FIVB7DN6.js → model-call-collection-5U5N23HQ.js} +1 -1
  138. package/chunks/{model-configuration-G27AQMCG.js → model-configuration-MZ6CUBPJ.js} +28 -28
  139. package/chunks/{modelConfigUtils-SQ5FKIFA.js → modelConfigUtils-5SJN5MCH.js} +22 -22
  140. package/chunks/{monitor-TBDV3JHN.js → monitor-3B7HPA37.js} +11 -11
  141. package/chunks/{nonInteractiveCli-S5FBABLA.js → nonInteractiveCli-ENHKPCSB.js} +55 -55
  142. package/chunks/{nonInteractiveToolExecutor-7YKRDZC3.js → nonInteractiveToolExecutor-I6XHNZQV.js} +12 -12
  143. package/chunks/{notebook-edit-25VUZF32.js → notebook-edit-BOPJ7HJ5.js} +12 -12
  144. package/chunks/{omni-ZTQ7WBZT.js → omni-NDS6RRPE.js} +9 -9
  145. package/chunks/{openaiContentGenerator-WUMDHZR4.js → openaiContentGenerator-FD6PKK7U.js} +6 -6
  146. package/chunks/{openaiResponsesContentGenerator-IWH7NHIG.js → openaiResponsesContentGenerator-CX5BJT3H.js} +4 -4
  147. package/chunks/{processUtils-AYCRVQF6.js → processUtils-DYLWKVGY.js} +2 -2
  148. package/chunks/{prompt-terminal-ledger-N7VXMA33.js → prompt-terminal-ledger-GVYJCNHN.js} +21 -21
  149. package/chunks/{pt-4SWM347K.js → pt-JCXCCW4Y.js} +50 -1
  150. package/chunks/{reactive-degrade-JLQAAJJ7.js → reactive-degrade-PWOKK52Z.js} +8 -8
  151. package/chunks/{read-file-PDJSTFUG.js → read-file-QNL7JRBN.js} +1 -1
  152. package/chunks/{resumeHistoryUtils-ENV2CQLJ.js → resumeHistoryUtils-FBULSJIP.js} +24 -24
  153. package/chunks/{ripGrep-QUKHPQRH.js → ripGrep-4XTRKASX.js} +1 -1
  154. package/chunks/{run-o1-code-serve-LT3JFXRB.js → run-o1-code-serve-FXAMAHOO.js} +34 -34
  155. package/chunks/{sandboxConfig-2P65I4ZT.js → sandboxConfig-QCO5DWYQ.js} +20 -20
  156. package/chunks/{scheduled-tasks-UIGCTWZ6.js → scheduled-tasks-NSSH5VOP.js} +25 -25
  157. package/chunks/{scheduler-DWYVZLXI.js → scheduler-56522BVY.js} +22 -22
  158. package/chunks/{send-message-OSS7K7GE.js → send-message-H6B5EST3.js} +2 -2
  159. package/chunks/{serve-E4C7STH3.js → serve-XPMWF6P2.js} +27 -27
  160. package/chunks/{server-IVTY3PQN.js → server-3HJUOXO6.js} +52 -52
  161. package/chunks/{session-FMYER3GE.js → session-2ZGNP3JN.js} +56 -56
  162. package/chunks/{session-U3S5AELN.js → session-USLQVMHK.js} +2 -2
  163. package/chunks/{session-attachments-root-SFC6R6WM.js → session-attachments-root-CSR65ITD.js} +20 -20
  164. package/chunks/{session-pr-refresh-Z7UIHDX2.js → session-pr-refresh-7VHDYKI5.js} +24 -24
  165. package/chunks/{settings-PS4JTTUS.js → settings-7D3KTPDJ.js} +26 -26
  166. package/chunks/{shell-5EOQZ25U.js → shell-3MMVXNLH.js} +11 -11
  167. package/chunks/{skill-LISN34OU.js → skill-VD4DNOVA.js} +1 -1
  168. package/chunks/{skill-settings-WEIH65DR.js → skill-settings-6G6KNY75.js} +26 -26
  169. package/chunks/{spawnChannel-RSB2EFPQ.js → spawnChannel-3G2ZEX6N.js} +21 -21
  170. package/chunks/{standalone-update-WGFZ43IP.js → standalone-update-6WHFCPQK.js} +22 -22
  171. package/chunks/{startInteractiveUI-TCJZBQSO.js → startInteractiveUI-IE3JBVIA.js} +3882 -2676
  172. package/chunks/{team-create-4JYFYILF.js → team-create-INVD7CZA.js} +11 -11
  173. package/chunks/{team-plan-approval-I2UXUHUG.js → team-plan-approval-X3RPLEM5.js} +11 -11
  174. package/chunks/{terminal-image-renderer-SSQNWUQY.js → terminal-image-renderer-QKR7JHLJ.js} +20 -20
  175. package/chunks/{theme-manager-62Z5GHKW.js → theme-manager-JZIWFQFR.js} +20 -20
  176. package/chunks/{tool-result-media-T3D6RRMU.js → tool-result-media-UR3332TH.js} +9 -9
  177. package/chunks/{tool-search-UD5NKCJI.js → tool-search-VFXZN2VC.js} +1 -1
  178. package/chunks/{total-session-admission-27IQBVTA.js → total-session-admission-GBM7FPBI.js} +22 -22
  179. package/chunks/{trustedFolders-WSRG5WYH.js → trustedFolders-GBAOKT4A.js} +21 -21
  180. package/chunks/{update-relaunch-XGQEX3UU.js → update-relaunch-FQYXBQMI.js} +5 -5
  181. package/chunks/{updateCheck-PEWI2AQ4.js → updateCheck-HDD2DZ6Y.js} +22 -22
  182. package/chunks/{upload-config-3ENIOUBY.js → upload-config-NJJI7MOI.js} +6 -6
  183. package/chunks/{useAutoAcceptIndicator-WAOXFW3E.js → useAutoAcceptIndicator-GITM657T.js} +29 -29
  184. package/chunks/{validateNonInterActiveAuth-CRWSANTK.js → validateNonInterActiveAuth-O7MD6UW4.js} +52 -52
  185. package/chunks/{version-RWSDXSK4.js → version-TX6H2U3L.js} +1 -1
  186. package/chunks/{web-fetch-HY4WIAVD.js → web-fetch-RVYBM4NU.js} +1 -1
  187. package/chunks/{web-search-TBZMZXOW.js → web-search-B6W4C5JM.js} +7 -7
  188. package/chunks/{workflow-VBGHRXQV.js → workflow-KR7EAPUM.js} +12 -12
  189. package/chunks/{workspace-providers-status-QWOGUT54.js → workspace-providers-status-2G6MBEVA.js} +31 -31
  190. package/chunks/{workspace-registration-store-RTAOYQSI.js → workspace-registration-store-OH6P3EPH.js} +1 -1
  191. package/chunks/{workspace-registry-CXPHVXHF.js → workspace-registry-Y35XQZCS.js} +22 -22
  192. package/chunks/{workspace-runtime-coordinator-XEOAYC7B.js → workspace-runtime-coordinator-U3URIEFA.js} +22 -22
  193. package/chunks/{workspace-service-SZ3XN3MT.js → workspace-service-WC5WYXT6.js} +30 -30
  194. package/chunks/{workspace-skills-status-4Y5LGLKM.js → workspace-skills-status-HKPF4YQD.js} +27 -27
  195. package/chunks/{workspace-trust-reconciler-VCKHWIWH.js → workspace-trust-reconciler-3UQXQCWY.js} +29 -29
  196. package/chunks/{write-file-XVKZXDAR.js → write-file-GTT4MO5C.js} +13 -13
  197. package/chunks/{zoom-image-SOVYXYCA.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 +76 -0
  202. package/locales/pt.js +78 -0
  203. package/package.json +2 -2
  204. package/release-notes.json +11 -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-_1PaLNyW.js → abnfDiagram-VCTEODGH-Dh4ud-bV.js} +1 -1
  213. package/web-shell/assets/{arc-CPkejPEG.js → arc-CzedV-8_.js} +1 -1
  214. package/web-shell/assets/{architectureDiagram-5GKGNRK7-CsiGl4b4.js → architectureDiagram-5GKGNRK7-DcdBEH6f.js} +1 -1
  215. package/web-shell/assets/{blockDiagram-NRAW4CY4-BiRTegun.js → blockDiagram-NRAW4CY4-uDeURqM8.js} +1 -1
  216. package/web-shell/assets/{c4Diagram-UCG6FXSJ-DrP6Vy9g.js → c4Diagram-UCG6FXSJ-810hyXoQ.js} +1 -1
  217. package/web-shell/assets/channel-v3XEMgos.js +1 -0
  218. package/web-shell/assets/{chunk-2Q5K7J3B-CgKjKjCH.js → chunk-2Q5K7J3B-Mk0ldZt-.js} +1 -1
  219. package/web-shell/assets/{chunk-5VM5RSS4-C984fQRt.js → chunk-5VM5RSS4-Bz2kOVPI.js} +1 -1
  220. package/web-shell/assets/{chunk-F27PBJKO-DYeVnJIc.js → chunk-F27PBJKO-CAjzX5Mt.js} +1 -1
  221. package/web-shell/assets/{chunk-G27WJ6UU-CqqixPgF.js → chunk-G27WJ6UU-DqvudZ0O.js} +1 -1
  222. package/web-shell/assets/{chunk-JWPE2WC7-OO2bQ5mp.js → chunk-JWPE2WC7-Dw-KeS8S.js} +1 -1
  223. package/web-shell/assets/{chunk-LCL6LL3I-NBZtrNjq.js → chunk-LCL6LL3I-DNF6ysro.js} +1 -1
  224. package/web-shell/assets/{chunk-POPQ4Y6H-Dir1r5d9.js → chunk-POPQ4Y6H-DWU0wpHI.js} +1 -1
  225. package/web-shell/assets/{chunk-SVP7TREG-nRWoivJZ.js → chunk-SVP7TREG-BQOJiqUJ.js} +1 -1
  226. package/web-shell/assets/{chunk-XXDRQBXY-DcfQpxhf.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-BW8OvoZs.js → cose-bilkent-JH36ORCC-BS-UzOw7.js} +1 -1
  230. package/web-shell/assets/{cynefin-OW5HDTMX-CuWc3FEO.js → cynefin-OW5HDTMX-BWgRJWKh.js} +1 -1
  231. package/web-shell/assets/{cynefinDiagram-5FMLGOSQ-DUojBfO3.js → cynefinDiagram-5FMLGOSQ-C6kE3QdM.js} +1 -1
  232. package/web-shell/assets/{dagre-3AP2YEHR-etpIqEWH.js → dagre-3AP2YEHR-DHbMoz2D.js} +1 -1
  233. package/web-shell/assets/{diagram-S7CK7UJ4-DvOipZZm.js → diagram-S7CK7UJ4-8S4HP9wv.js} +1 -1
  234. package/web-shell/assets/{diagram-UQ7AKVKN-DBf5VBRe.js → diagram-UQ7AKVKN-CDM_fDvK.js} +1 -1
  235. package/web-shell/assets/{diagram-VSXAHHWV-DNrqqA39.js → diagram-VSXAHHWV-Jt_YgGmQ.js} +1 -1
  236. package/web-shell/assets/{diagram-VX7I27RA-DSFo22TI.js → diagram-VX7I27RA-jgA2EN0U.js} +1 -1
  237. package/web-shell/assets/{diagram-Z3DM3KII-lQHchU4A.js → diagram-Z3DM3KII-34lWgOek.js} +1 -1
  238. package/web-shell/assets/{ebnfDiagram-PWID7BFC-BgO5kTH3.js → ebnfDiagram-PWID7BFC-DkXkay_a.js} +1 -1
  239. package/web-shell/assets/{erDiagram-SSCWMZ5O-CB-mXQV2.js → erDiagram-SSCWMZ5O-2F7Ae8PJ.js} +1 -1
  240. package/web-shell/assets/{flowDiagram-A5DVABFB-dxGvJ8LF.js → flowDiagram-A5DVABFB-DEp8HZ1Z.js} +1 -1
  241. package/web-shell/assets/{ganttDiagram-EL5Y4UJY-CzO3YmrE.js → ganttDiagram-EL5Y4UJY-DB9PwX6e.js} +1 -1
  242. package/web-shell/assets/{gitGraphDiagram-WWUBYQGX-CgBba2-c.js → gitGraphDiagram-WWUBYQGX-CIudOlp-.js} +1 -1
  243. package/web-shell/assets/{index-CXA_v-2M.js → index-BLTYMaXa.js} +3 -3
  244. package/web-shell/assets/{index-B9d0eNtE.js → index-DsGnZKQl.js} +1 -1
  245. package/web-shell/assets/{infoDiagram-RXCK75RN-ggYgULBt.js → infoDiagram-RXCK75RN-Csm0vHSo.js} +1 -1
  246. package/web-shell/assets/{ishikawaDiagram-5VMMS53U-C6n29QXz.js → ishikawaDiagram-5VMMS53U-CLJXnHlY.js} +1 -1
  247. package/web-shell/assets/{journeyDiagram-EYS64GPL-BGE9468L.js → journeyDiagram-EYS64GPL-Cf92U7ZB.js} +1 -1
  248. package/web-shell/assets/{kanban-definition-3QL26DDD-DN_3SUvn.js → kanban-definition-3QL26DDD-Dh7Te4fu.js} +1 -1
  249. package/web-shell/assets/{layout-C5D8pKes.js → layout-B5ALjnq4.js} +1 -1
  250. package/web-shell/assets/{linear-CsYwdym2.js → linear-CGxKsCj8.js} +1 -1
  251. package/web-shell/assets/{mermaid.core-BLAuCuqp.js → mermaid.core-B_e-IZNF.js} +6 -6
  252. package/web-shell/assets/{mindmap-definition-FBJOCRG2-VdQwqXI-.js → mindmap-definition-FBJOCRG2-BftMDT3T.js} +1 -1
  253. package/web-shell/assets/{pegDiagram-XKGWAZYB-J8UMePD1.js → pegDiagram-XKGWAZYB-CruSZoUh.js} +1 -1
  254. package/web-shell/assets/{pieDiagram-E7YTZNPT-079A70pk.js → pieDiagram-E7YTZNPT-Bi9haYEh.js} +1 -1
  255. package/web-shell/assets/{quadrantDiagram-AXDQQJYC-Bvi_nl_C.js → quadrantDiagram-AXDQQJYC-BY4w8seK.js} +1 -1
  256. package/web-shell/assets/{railroadDiagram-O6MQD6OU-G7y_bq2l.js → railroadDiagram-O6MQD6OU-moN3YnCi.js} +1 -1
  257. package/web-shell/assets/{requirementDiagram-EFPCY7ZU-nh2aPH4-.js → requirementDiagram-EFPCY7ZU-B--U5ed4.js} +1 -1
  258. package/web-shell/assets/{sankeyDiagram-P5KCCOFB-BP6_ubLy.js → sankeyDiagram-P5KCCOFB-DD3-WWOa.js} +1 -1
  259. package/web-shell/assets/{sequenceDiagram-WJ2MYXX4-iSdOg8Cr.js → sequenceDiagram-WJ2MYXX4-7AYhwUmK.js} +1 -1
  260. package/web-shell/assets/{sizeCapture-X5ZJPWSS-CA85mOIz.js → sizeCapture-X5ZJPWSS-DM0iKsnv.js} +1 -1
  261. package/web-shell/assets/{stateDiagram-HBIQ2CUA-5yP_0wzp.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-thCkvcqC.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-DzeyctFc.js → timeline-definition-24CTP7MA-C4M08jyd.js} +1 -1
  266. package/web-shell/assets/{vennDiagram-4TSXK5OY-Cw7c3EPi.js → vennDiagram-4TSXK5OY-B3fw4hM4.js} +1 -1
  267. package/web-shell/assets/{wardleyDiagram-VM6X3IG4-CePJRR6T.js → wardleyDiagram-VM6X3IG4-DC9yoqPT.js} +1 -1
  268. package/web-shell/assets/{xychartDiagram-S5SC5T6Z-BpDPAFgm.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-BM7XNUy3.js +0 -1
  272. package/web-shell/assets/classDiagram-DTDB5LWJ-D8pyODnR.js +0 -1
  273. package/web-shell/assets/classDiagram-v2-JRS7N3AN-D8pyODnR.js +0 -1
  274. package/web-shell/assets/stateDiagram-v2-4QOOHH4V-D0-l_XKw.js +0 -1
  275. package/web-shell/assets/swimlanesDiagram-VK2B7HYN-Mv6oS23o.js +0 -8
@@ -1,4 +1,4 @@
1
- // o1-connect-lib 9.4.0 - https://github.com/organizaone/o1-gateway (MIT)
1
+ // o1-connect-lib 9.9.0 - https://github.com/organizaone/o1-gateway (MIT)
2
2
 
3
3
  // src/shared/tunnel-protocol.ts
4
4
  import { createHash } from "node:crypto";
@@ -910,14 +910,14 @@ var TunnelAgent = class extends http4.Agent {
910
910
  return void 0;
911
911
  }
912
912
  this.opening += 1;
913
- const dial = (host, transport) => this.connect(this.targets[host], this.pins, { ca: this.target.ca, userAgent: this.target.userAgent, env: this.target.env, transport, onOuter: (i) => this.events.onOuter?.(i) });
913
+ const dial2 = (host, transport) => this.connect(this.targets[host], this.pins, { ca: this.target.ca, userAgent: this.target.userAgent, env: this.target.env, transport, onOuter: (i) => this.events.onOuter?.(i) });
914
914
  const hosts = this.targets.map((_, i) => (this.preferred + i) % this.targets.length);
915
915
  const transports = this.mode === "auto" ? this.using === "ws" ? ["ws", "post"] : ["post"] : [this.using === "post" ? "post" : "ws"];
916
916
  const chain = transports.flatMap((transport) => hosts.map((host) => ({ host, transport })));
917
917
  let firstErr = null;
918
918
  const run = (i) => {
919
919
  const at = chain[i];
920
- return dial(at.host, at.transport).then(
920
+ return dial2(at.host, at.transport).then(
921
921
  (socket) => {
922
922
  if (this.preferred !== at.host) this.preferred = at.host;
923
923
  if (this.mode === "auto" && this.using !== "post" && at.transport === "post") {
@@ -1067,6 +1067,525 @@ function startLocalServer(o) {
1067
1067
  });
1068
1068
  }
1069
1069
 
1070
+ // src/client/remote.ts
1071
+ import { createHash as createHash4, randomBytes as randomBytes4 } from "node:crypto";
1072
+ import http6 from "node:http";
1073
+ import https3 from "node:https";
1074
+ import { isIP as isIP3 } from "node:net";
1075
+
1076
+ // src/shared/remote-protocol.ts
1077
+ var REMOTE_PROTOCOL = "o1gw-remote.v1";
1078
+ var REMOTE_AGENT_PATH = "/remote/agent";
1079
+ var LIMITS = {
1080
+ /** Any frame but a hello, as text. */
1081
+ frameBytes: 256 * 1024,
1082
+ /** A hello's `history`, as text; the hello itself may be frameBytes + historyBytes. */
1083
+ historyBytes: 512 * 1024,
1084
+ /** An `input.text`. */
1085
+ inputBytes: 64 * 1024,
1086
+ /** Outbound bytes queued for one viewer before it is closed with `bye busy`. */
1087
+ viewerQueueBytes: 512 * 1024,
1088
+ /** A peer-chosen name, id, model, version, mode or outcome (they reach the store, the audit log, an alert): characters. */
1089
+ nameChars: 128,
1090
+ /** A hello's `cwd_hint`: characters. */
1091
+ pathChars: 512,
1092
+ /** Decision requests open at once on one session; one more ends the session (`protocol`). */
1093
+ pendingMax: 64,
1094
+ /** The longest a decision request stays open, whatever `expires_at` says. */
1095
+ decisionMs: 36e5,
1096
+ /** Each side pings this often. */
1097
+ pingMs: 3e4,
1098
+ /** A peer silent this long is gone. */
1099
+ deadMs: 9e4,
1100
+ /** An agent gone this long ends the session (`idle`). */
1101
+ reconnectMs: 12e4,
1102
+ /** An ended session stays listed, and its `remote_id` re-opens for the same `session_id`, this long. */
1103
+ listedMs: 4 * 36e5
1104
+ };
1105
+
1106
+ // src/client/remote.ts
1107
+ var GUID2 = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
1108
+ var DIAL_MS = 15e3;
1109
+ var HELLO_MS = 1e4;
1110
+ var UNACKED_MAX_BYTES = 4 * 1024 * 1024;
1111
+ var BACKOFF_MIN_MS = 1e3;
1112
+ var BACKOFF_MAX_MS = 3e4;
1113
+ var FATAL = /* @__PURE__ */ new Set(["taken_over", "revoked", "plan", "limit", "protocol", "unauthenticated"]);
1114
+ var tunnels = /* @__PURE__ */ new WeakMap();
1115
+ function bindTunnel(connection, tunnel) {
1116
+ tunnels.set(connection, tunnel);
1117
+ }
1118
+ function dial(via, apiKey) {
1119
+ const key = randomBytes4(16).toString("base64");
1120
+ const hostname = via.url.hostname.replace(/^\[|\]$/g, "");
1121
+ const secure = via.url.protocol === "https:";
1122
+ const port = Number(via.url.port || (secure ? 443 : 80));
1123
+ const headers = {
1124
+ Host: via.url.host,
1125
+ Connection: "Upgrade",
1126
+ Upgrade: "websocket",
1127
+ "Sec-WebSocket-Version": "13",
1128
+ "Sec-WebSocket-Key": key,
1129
+ "Sec-WebSocket-Protocol": REMOTE_PROTOCOL,
1130
+ Authorization: `Bearer ${apiKey}`
1131
+ };
1132
+ return new Promise((resolve, reject) => {
1133
+ let done = false;
1134
+ const settle = (err, value) => {
1135
+ if (done) return;
1136
+ done = true;
1137
+ clearTimeout(timer);
1138
+ if (err) reject(err);
1139
+ else resolve(value);
1140
+ };
1141
+ const req = via.agent ? http6.request({ agent: via.agent, method: "GET", path: REMOTE_AGENT_PATH, headers, setHost: false }) : secure ? https3.request({ host: hostname, port, method: "GET", path: REMOTE_AGENT_PATH, headers, agent: false, ...isIP3(hostname) ? {} : { servername: hostname } }) : http6.request({ host: hostname, port, method: "GET", path: REMOTE_AGENT_PATH, headers, agent: false });
1142
+ const timer = setTimeout(() => {
1143
+ req.destroy();
1144
+ settle(new O1ConnectError("tunnel_unavailable", "the remote session's connection timed out"));
1145
+ }, DIAL_MS);
1146
+ timer.unref();
1147
+ req.on("response", (res) => {
1148
+ let body = "";
1149
+ res.setEncoding("utf8");
1150
+ res.on("data", (c) => {
1151
+ if (body.length < 64e3) body += c;
1152
+ });
1153
+ res.on("end", () => {
1154
+ const status = res.statusCode ?? 0;
1155
+ let code = "refused";
1156
+ let message = `HTTP ${status}`;
1157
+ try {
1158
+ const j = JSON.parse(body);
1159
+ code = j.error?.code ?? code;
1160
+ message = j.error?.message ?? message;
1161
+ } catch {
1162
+ }
1163
+ settle(new O1ConnectError("remote_refused", `the remote session was refused (HTTP ${status} ${code}): ${message}`, { cause: { status, code } }));
1164
+ });
1165
+ });
1166
+ req.on("error", (err) => settle(new O1ConnectError("tunnel_unavailable", `the remote session's connection failed: ${err.message}`, { cause: err })));
1167
+ req.on("upgrade", (res, sock, head) => {
1168
+ const accept = createHash4("sha1").update(key + GUID2).digest("base64");
1169
+ if (res.headers["sec-websocket-accept"] !== accept || res.headers["sec-websocket-protocol"] !== REMOTE_PROTOCOL) {
1170
+ sock.destroy();
1171
+ settle(new O1ConnectError("remote_protocol", "the upgrade was answered by something that is not a remote session's gateway"));
1172
+ return;
1173
+ }
1174
+ settle(null, { sock, head });
1175
+ });
1176
+ req.end();
1177
+ });
1178
+ }
1179
+ var Wire = class {
1180
+ constructor(sock, head, on) {
1181
+ this.sock = sock;
1182
+ this.on = on;
1183
+ sock.on("data", (c) => this.onData(c));
1184
+ sock.on("error", () => {
1185
+ });
1186
+ sock.on("close", () => {
1187
+ if (this.gone) return;
1188
+ this.gone = true;
1189
+ on.close(this.closeCode ?? 1006);
1190
+ });
1191
+ if (head.length) this.onData(head);
1192
+ }
1193
+ sock;
1194
+ on;
1195
+ parser = new FrameParser(LIMITS.frameBytes + LIMITS.historyBytes);
1196
+ partial = null;
1197
+ closeSent = false;
1198
+ closeCode = null;
1199
+ gone = false;
1200
+ send(text) {
1201
+ if (this.gone || this.sock.destroyed) return false;
1202
+ this.sock.write(encodeFrame(OP.text, Buffer.from(text, "utf8"), randomBytes4(4)));
1203
+ return true;
1204
+ }
1205
+ /** A close handshake (code 1000 by default); the socket is cut 2 s later whatever the other side does. */
1206
+ close(code = 1e3, reason = "") {
1207
+ if (!this.closeSent && !this.sock.destroyed) {
1208
+ this.closeSent = true;
1209
+ this.closeCode ??= code;
1210
+ const r = Buffer.from(reason, "utf8").subarray(0, 100);
1211
+ this.sock.write(encodeFrame(OP.close, Buffer.concat([Buffer.from([code >> 8, code & 255]), r]), randomBytes4(4)));
1212
+ this.sock.end();
1213
+ }
1214
+ setTimeout(() => this.sock.destroy(), 2e3).unref();
1215
+ }
1216
+ destroy() {
1217
+ this.sock.destroy();
1218
+ }
1219
+ onData(chunk) {
1220
+ let frames;
1221
+ try {
1222
+ frames = this.parser.push(chunk);
1223
+ } catch (err) {
1224
+ void (err instanceof WsProtocolError);
1225
+ this.sock.destroy();
1226
+ return;
1227
+ }
1228
+ for (const f of frames) {
1229
+ if (f.opcode === OP.text || f.opcode === OP.cont && this.partial) {
1230
+ (this.partial ??= []).push(Buffer.from(f.payload));
1231
+ if (!f.fin) continue;
1232
+ const text = Buffer.concat(this.partial).toString("utf8");
1233
+ this.partial = null;
1234
+ this.on.message(text);
1235
+ } else if (f.opcode === OP.ping) {
1236
+ if (!this.sock.destroyed) this.sock.write(encodeFrame(OP.pong, Buffer.from(f.payload), randomBytes4(4)));
1237
+ } else if (f.opcode === OP.close) {
1238
+ this.closeCode ??= f.payload.length >= 2 ? f.payload.readUInt16BE(0) : 1005;
1239
+ if (!this.closeSent) {
1240
+ this.closeSent = true;
1241
+ if (!this.sock.destroyed) this.sock.write(encodeFrame(OP.close, Buffer.from(f.payload.subarray(0, 2)), randomBytes4(4)));
1242
+ }
1243
+ this.sock.end();
1244
+ } else if (f.opcode === OP.binary) {
1245
+ this.sock.destroy();
1246
+ }
1247
+ }
1248
+ }
1249
+ };
1250
+ function trimHistory(items) {
1251
+ let out = items;
1252
+ while (out.length > 0 && Buffer.byteLength(JSON.stringify(out), "utf8") > LIMITS.historyBytes) out = out.slice(Math.max(1, Math.floor(out.length / 4)));
1253
+ return out;
1254
+ }
1255
+ var Agent = class {
1256
+ constructor(o) {
1257
+ this.o = o;
1258
+ this.model = o.session.model;
1259
+ this.approvalMode = o.session.approvalMode;
1260
+ }
1261
+ o;
1262
+ remoteId = "";
1263
+ url = "";
1264
+ state = "online";
1265
+ seq = 0;
1266
+ unacked = [];
1267
+ unackedBytes = 0;
1268
+ lastGatewaySeq = 0;
1269
+ wire = null;
1270
+ closed = false;
1271
+ attempt = 0;
1272
+ reconnectTimer = null;
1273
+ pinger = null;
1274
+ lastSeen = Date.now();
1275
+ model;
1276
+ approvalMode;
1277
+ listeners = /* @__PURE__ */ new Map();
1278
+ pending = /* @__PURE__ */ new Map();
1279
+ closedWire = null;
1280
+ log(line) {
1281
+ try {
1282
+ this.o.log?.(`remote: ${line}`);
1283
+ } catch {
1284
+ }
1285
+ }
1286
+ emit(event, e) {
1287
+ for (const fn of this.listeners.get(event) ?? []) {
1288
+ try {
1289
+ fn(e);
1290
+ } catch {
1291
+ }
1292
+ }
1293
+ }
1294
+ on(event, fn) {
1295
+ let set = this.listeners.get(event);
1296
+ if (!set) {
1297
+ set = /* @__PURE__ */ new Set();
1298
+ this.listeners.set(event, set);
1299
+ }
1300
+ set.add(fn);
1301
+ return () => {
1302
+ set.delete(fn);
1303
+ };
1304
+ }
1305
+ hello(resumeSeq) {
1306
+ const s = this.o.session;
1307
+ return {
1308
+ v: 1,
1309
+ type: "hello",
1310
+ session_id: s.id,
1311
+ name: s.name,
1312
+ cwd_hint: s.cwd ?? "",
1313
+ o1code_version: s.version,
1314
+ approval_mode: this.approvalMode,
1315
+ model: this.model,
1316
+ history: trimHistory(this.o.history()),
1317
+ ...resumeSeq !== void 0 ? { resume_seq: resumeSeq } : {}
1318
+ };
1319
+ }
1320
+ /** Dials, says hello, waits for the ready (or a bye): the first time from openRemote, then at every reconnection. */
1321
+ connect(first) {
1322
+ return dial(this.o.via, this.o.apiKey).then((d) => new Promise((resolve, reject) => {
1323
+ let ready = false;
1324
+ const timer = setTimeout(() => {
1325
+ if (!ready) wire.destroy();
1326
+ }, HELLO_MS);
1327
+ timer.unref();
1328
+ const wire = new Wire(d.sock, d.head, {
1329
+ message: (text) => {
1330
+ let frame;
1331
+ try {
1332
+ frame = JSON.parse(text);
1333
+ } catch {
1334
+ wire.destroy();
1335
+ return;
1336
+ }
1337
+ this.lastSeen = Date.now();
1338
+ if (ready) {
1339
+ this.onFrame(wire, frame);
1340
+ return;
1341
+ }
1342
+ if (frame.type === "ready") {
1343
+ ready = true;
1344
+ clearTimeout(timer);
1345
+ this.onReady(wire, frame);
1346
+ resolve();
1347
+ } else if (frame.type === "bye") {
1348
+ reject(new O1ConnectError("remote_refused", `the remote session was refused (${frame.reason})`, { cause: { status: 0, code: frame.reason, ...frame.sessions ? { sessions: frame.sessions } : {} } }));
1349
+ }
1350
+ },
1351
+ close: (code) => {
1352
+ if (!ready) {
1353
+ clearTimeout(timer);
1354
+ reject(new O1ConnectError("tunnel_unavailable", `the remote session's connection closed before it was ready (${code})`));
1355
+ return;
1356
+ }
1357
+ if (this.wire === wire) this.onClose(code);
1358
+ }
1359
+ });
1360
+ this.wire = wire;
1361
+ wire.send(JSON.stringify(this.hello(first ? void 0 : this.lastGatewaySeq)));
1362
+ }));
1363
+ }
1364
+ onReady(wire, frame) {
1365
+ this.remoteId = frame.remote_id;
1366
+ this.url = frame.url;
1367
+ this.attempt = 0;
1368
+ for (const k of this.unacked) if (k.seq > frame.ack_seq) wire.send(k.text);
1369
+ if (this.state !== "online") {
1370
+ this.state = "online";
1371
+ this.emit("state", { state: "online" });
1372
+ }
1373
+ this.lastSeen = Date.now();
1374
+ if (!this.pinger) {
1375
+ this.pinger = setInterval(() => {
1376
+ if (!this.wire) return;
1377
+ if (Date.now() - this.lastSeen > LIMITS.deadMs) {
1378
+ this.log("the gateway went silent");
1379
+ this.wire.destroy();
1380
+ return;
1381
+ }
1382
+ this.wire.send(JSON.stringify({ v: 1, type: "ping" }));
1383
+ }, LIMITS.pingMs);
1384
+ this.pinger.unref();
1385
+ }
1386
+ this.log(`${frame.resumed ? "back on" : "open:"} ${this.remoteId} (${frame.viewers} viewer${frame.viewers === 1 ? "" : "s"})`);
1387
+ }
1388
+ onFrame(wire, frame) {
1389
+ switch (frame.type) {
1390
+ case "ack": {
1391
+ let i = 0;
1392
+ while (i < this.unacked.length && this.unacked[i].seq <= frame.seq) i++;
1393
+ for (const k of this.unacked.splice(0, i)) this.unackedBytes -= k.bytes;
1394
+ return;
1395
+ }
1396
+ case "input":
1397
+ case "command":
1398
+ case "decision": {
1399
+ if (frame.seq !== void 0) {
1400
+ this.lastGatewaySeq = Math.max(this.lastGatewaySeq, frame.seq);
1401
+ wire.send(JSON.stringify({ v: 1, type: "ack", seq: frame.seq }));
1402
+ }
1403
+ if (frame.type === "input") this.emit("input", { id: frame.id, text: frame.text });
1404
+ else if (frame.type === "command") this.emit("command", { id: frame.id, name: frame.name, args: frame.args });
1405
+ else {
1406
+ const p = this.pending.get(frame.id);
1407
+ this.pending.delete(frame.id);
1408
+ p?.resolve({ outcome: frame.outcome, payload: frame.payload, by: "remote" });
1409
+ this.emit("decision", { id: frame.id, outcome: frame.outcome, payload: frame.payload });
1410
+ }
1411
+ return;
1412
+ }
1413
+ case "viewer":
1414
+ this.emit("viewer", { op: frame.op, count: frame.count });
1415
+ return;
1416
+ case "resync":
1417
+ this.log("resync asked: the history goes again");
1418
+ wire.send(JSON.stringify(this.hello(this.lastGatewaySeq)));
1419
+ return;
1420
+ case "bye":
1421
+ if (FATAL.has(frame.reason)) this.end(frame.reason);
1422
+ else {
1423
+ this.log(`bye ${frame.reason}: reconnecting`);
1424
+ wire.destroy();
1425
+ }
1426
+ return;
1427
+ case "error":
1428
+ this.emit("error", { code: frame.code, ...frame.id !== void 0 ? { id: frame.id } : {} });
1429
+ return;
1430
+ case "ready":
1431
+ wire.destroy();
1432
+ return;
1433
+ case "pong":
1434
+ return;
1435
+ }
1436
+ }
1437
+ onClose(code) {
1438
+ this.wire = null;
1439
+ if (this.closed || this.state === "ended") return;
1440
+ if (this.state !== "reconnecting") {
1441
+ this.state = "reconnecting";
1442
+ this.emit("state", { state: "reconnecting" });
1443
+ this.log(`connection closed (${code}): reconnecting`);
1444
+ }
1445
+ this.scheduleReconnect();
1446
+ }
1447
+ scheduleReconnect() {
1448
+ if (this.closed || this.reconnectTimer) return;
1449
+ const delay2 = Math.min(BACKOFF_MIN_MS * 2 ** this.attempt, BACKOFF_MAX_MS);
1450
+ this.attempt += 1;
1451
+ this.reconnectTimer = setTimeout(() => {
1452
+ this.reconnectTimer = null;
1453
+ if (this.closed || this.state === "ended") return;
1454
+ this.connect(false).catch((err) => {
1455
+ if (this.closed || this.state === "ended") return;
1456
+ const cause = err instanceof O1ConnectError && err.code === "remote_refused" ? err.cause : null;
1457
+ if (cause && cause.status !== 429 && cause.status !== 503) {
1458
+ this.end(cause.status === 401 ? "revoked" : cause.status === 402 || cause.status === 403 ? "plan" : cause.status === 0 ? cause.code : "protocol");
1459
+ return;
1460
+ }
1461
+ this.log(`reconnection failed: ${err instanceof Error ? err.message : String(err)}`);
1462
+ this.scheduleReconnect();
1463
+ });
1464
+ }, delay2);
1465
+ this.reconnectTimer.unref();
1466
+ }
1467
+ stopTimers() {
1468
+ if (this.pinger) clearInterval(this.pinger);
1469
+ this.pinger = null;
1470
+ if (this.reconnectTimer) clearTimeout(this.reconnectTimer);
1471
+ this.reconnectTimer = null;
1472
+ }
1473
+ failPending() {
1474
+ for (const [id, p] of [...this.pending]) {
1475
+ this.pending.delete(id);
1476
+ p.reject(new O1ConnectError("decision_closed", `the decision ${id} was not answered: the remote session ended`));
1477
+ }
1478
+ }
1479
+ end(reason) {
1480
+ if (this.state === "ended") return;
1481
+ this.state = "ended";
1482
+ this.stopTimers();
1483
+ this.failPending();
1484
+ const w = this.wire;
1485
+ this.wire = null;
1486
+ w?.destroy();
1487
+ this.log(`ended: ${reason}`);
1488
+ this.emit("state", { state: "ended", reason });
1489
+ }
1490
+ keep(frame) {
1491
+ const text = JSON.stringify(frame);
1492
+ const bytes = Buffer.byteLength(text, "utf8");
1493
+ this.unacked.push({ seq: frame.seq, text, bytes });
1494
+ this.unackedBytes += bytes;
1495
+ while (this.unackedBytes > UNACKED_MAX_BYTES && this.unacked.length > 1) this.unackedBytes -= this.unacked.shift().bytes;
1496
+ this.wire?.send(text);
1497
+ }
1498
+ send(ev) {
1499
+ if (this.state === "ended") return;
1500
+ this.keep({ v: 1, type: "event", seq: ++this.seq, at: (/* @__PURE__ */ new Date()).toISOString(), ev });
1501
+ }
1502
+ status(s) {
1503
+ if (s.model !== void 0) this.model = s.model;
1504
+ if (s.approvalMode !== void 0) this.approvalMode = s.approvalMode;
1505
+ if (this.state === "ended") return;
1506
+ this.wire?.send(JSON.stringify({ v: 1, type: "status", state: s.state, model: this.model, approval_mode: this.approvalMode }));
1507
+ }
1508
+ requestDecision(req) {
1509
+ if (this.state === "ended") return Promise.reject(new O1ConnectError("decision_closed", "the remote session has ended"));
1510
+ return new Promise((resolve, reject) => {
1511
+ this.pending.set(req.id, { resolve, reject });
1512
+ 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 });
1513
+ });
1514
+ }
1515
+ closeDecision(id, by, outcome) {
1516
+ const p = this.pending.get(id);
1517
+ this.pending.delete(id);
1518
+ 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"}`));
1519
+ if (this.state === "ended") return;
1520
+ this.wire?.send(JSON.stringify({ v: 1, type: "decision_closed", id, outcome: outcome ?? null, by }));
1521
+ }
1522
+ close() {
1523
+ if (this.closedWire) return this.closedWire;
1524
+ this.closed = true;
1525
+ this.stopTimers();
1526
+ this.failPending();
1527
+ const w = this.wire;
1528
+ this.wire = null;
1529
+ const was = this.state;
1530
+ this.state = "ended";
1531
+ this.closedWire = new Promise((resolve) => {
1532
+ if (!w) {
1533
+ resolve();
1534
+ return;
1535
+ }
1536
+ const done = setTimeout(resolve, 2500);
1537
+ done.unref();
1538
+ w.close(1e3, "closed");
1539
+ setTimeout(() => {
1540
+ clearTimeout(done);
1541
+ resolve();
1542
+ }, 300).unref();
1543
+ });
1544
+ if (was !== "ended") this.emit("state", { state: "ended", reason: "closed" });
1545
+ this.log("closed");
1546
+ return this.closedWire;
1547
+ }
1548
+ };
1549
+ async function openRemoteImpl(opts) {
1550
+ const s = opts.session;
1551
+ if (!s || typeof s !== "object") throw new TypeError("session is required: { id, name, version, approvalMode, model, cwd? }");
1552
+ for (const k of ["id", "name", "version", "approvalMode", "model"]) {
1553
+ if (typeof s[k] !== "string" || k !== "model" && s[k] === "") throw new TypeError(`session.${k} must be a string`);
1554
+ }
1555
+ if (s.cwd !== void 0 && typeof s.cwd !== "string") throw new TypeError("session.cwd must be a string");
1556
+ const history = typeof opts.history === "function" ? opts.history : Array.isArray(opts.history) ? () => opts.history : () => [];
1557
+ let via;
1558
+ let apiKey;
1559
+ if (opts.connection) {
1560
+ const t = tunnels.get(opts.connection);
1561
+ if (!t) throw new TypeError("connection must be one this library opened (open())");
1562
+ via = { url: t.target, agent: t.agent };
1563
+ apiKey = t.token;
1564
+ } else {
1565
+ if (typeof opts.baseUrl !== "string") throw new TypeError("baseUrl (or connection) is required");
1566
+ let url;
1567
+ try {
1568
+ url = new URL(opts.baseUrl);
1569
+ } catch {
1570
+ throw new TypeError("baseUrl must be a URL");
1571
+ }
1572
+ const loopback = url.hostname === "127.0.0.1" || url.hostname === "localhost" || url.hostname === "[::1]";
1573
+ if (!(url.protocol === "https:" || url.protocol === "http:" && loopback)) throw new TypeError("baseUrl must be https (http only for a loopback host)");
1574
+ if (typeof opts.apiKey !== "string" || opts.apiKey === "") throw new TypeError("apiKey (the device key) is required with baseUrl");
1575
+ via = { url };
1576
+ apiKey = opts.apiKey;
1577
+ }
1578
+ const log = opts.log ? (line) => {
1579
+ try {
1580
+ opts.log(line);
1581
+ } catch {
1582
+ }
1583
+ } : void 0;
1584
+ const agent = new Agent({ via, apiKey, session: { ...s }, history, log });
1585
+ await agent.connect(true);
1586
+ return agent;
1587
+ }
1588
+
1070
1589
  // src/client/backoff.ts
1071
1590
  var IdentityBackoff = class {
1072
1591
  constructor(now = Date.now, baseMs = 6e4, maxMs = 60 * 6e4) {
@@ -1103,7 +1622,7 @@ var IdentityBackoff = class {
1103
1622
  };
1104
1623
 
1105
1624
  // src/client/pin-sync.ts
1106
- import http6 from "node:http";
1625
+ import http7 from "node:http";
1107
1626
  import tls4 from "node:tls";
1108
1627
  function mergePins(own, listed, via) {
1109
1628
  const unchanged = { pins: [...own], added: [], dropped: [] };
@@ -1182,7 +1701,7 @@ var PinSync = class {
1182
1701
  fetch() {
1183
1702
  const { target } = this.o;
1184
1703
  return new Promise((resolve, reject) => {
1185
- const req = http6.request({
1704
+ const req = http7.request({
1186
1705
  host: target.hostname,
1187
1706
  port: target.port,
1188
1707
  method: "GET",
@@ -1263,7 +1782,7 @@ async function startTunnelSession(o) {
1263
1782
  }
1264
1783
 
1265
1784
  // src/client/version.ts
1266
- var VERSION = true ? "9.4.0" : "dev";
1785
+ var VERSION = true ? "9.9.0" : "dev";
1267
1786
 
1268
1787
  // src/client/lib.ts
1269
1788
  var version = VERSION;
@@ -1275,6 +1794,9 @@ var O1ConnectError = class extends Error {
1275
1794
  this.code = code;
1276
1795
  }
1277
1796
  };
1797
+ async function openRemote(opts) {
1798
+ return openRemoteImpl(opts);
1799
+ }
1278
1800
  var DEFAULT_NAME = "aipp-connect";
1279
1801
  var TRANSPORTS = ["auto", "websocket", "post"];
1280
1802
  function entryName(name) {
@@ -1424,7 +1946,9 @@ async function open(opts) {
1424
1946
  }
1425
1947
  const baseUrl = `http://127.0.0.1:${session.port}`;
1426
1948
  log?.(`o1-connect library ${VERSION} for ${cfg.device} listening on ${baseUrl} (transport ${cfg.transport})`);
1427
- return { baseUrl, openaiBaseUrl: `${baseUrl}/v1`, apiKey, port: session.port, device: cfg.device, close: session.close };
1949
+ const connection = { baseUrl, openaiBaseUrl: `${baseUrl}/v1`, apiKey, port: session.port, device: cfg.device, close: session.close };
1950
+ bindTunnel(connection, { agent: session.agent, target: session.target, token: cfg.token });
1951
+ return connection;
1428
1952
  }
1429
1953
  async function forget(opts) {
1430
1954
  const store = checkStore(opts?.store);
@@ -1448,6 +1972,7 @@ export {
1448
1972
  O1ConnectError,
1449
1973
  forget,
1450
1974
  open,
1975
+ openRemote,
1451
1976
  setup,
1452
1977
  version
1453
1978
  };
File without changes
File without changes
@@ -1 +1 @@
1
- import{g as p,r as u,d as a}from"./chunk-SVP7TREG-nRWoivJZ.js";import{p as f}from"./chunk-JWPE2WC7-OO2bQ5mp.js";import{_ as n,l as o}from"./mermaid.core-BLAuCuqp.js";import{M as c,b as d}from"./cynefin-OW5HDTMX-CuWc3FEO.js";import"./index-CXA_v-2M.js";var v=d().RailroadAbnf.parser.LangiumParser,i=n(e=>{const r=e.alternatives.map(g);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformAlternation"),g=n(e=>{const r=e.elements.map(y);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformConcatenation"),b=n(e=>{if(e.includes("*")){const[t,s]=e.split("*"),l=t?parseInt(t,10):0,m=s?parseInt(s,10):1/0;return{min:l,max:m}}const r=parseInt(e,10);return{min:r,max:r}},"parseRepeat"),y=n(e=>{const r=A(e.primary);if(!e.repeat)return r;const{min:t,max:s}=b(e.repeat);return t===0&&s===1?{type:"optional",element:r}:{type:"repetition",element:r,min:t,max:s}},"transformElement"),A=n(e=>{switch(e.$type){case"AbnfStringLiteral":return{type:"terminal",value:e.value};case"AbnfNumVal":return{type:"terminal",value:e.value};case"AbnfRuleName":return{type:"nonterminal",name:e.name};case"AbnfGroup":return i(e.element);case"AbnfOptionalGroup":return{type:"optional",element:i(e.element)};default:throw new Error(`Unsupported ABNF primary node: ${e.$type}`)}},"transformPrimary"),P=n(e=>({name:e.name,definition:i(e.definition)}),"transformRule"),h=n(e=>{f(e,a),e.title&&a.setTitle(e.title),e.rules.map(r=>a.addRule(P(r)))},"populateDb"),R={parse:n(e=>{a.clear(),o.debug("[ABNF Parser] Starting Langium parse");const r=v.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new c(r);const t=r.value;o.debug("[ABNF Parser] Parsed rules:",t.rules.length),h(t),o.debug("[ABNF Parser] Parse complete")},"parse"),parser:{yy:a}},B={parser:R,db:a,renderer:u,styles:p};export{B as diagram};
1
+ import{g as p,r as u,d as a}from"./chunk-SVP7TREG-BQOJiqUJ.js";import{p as f}from"./chunk-JWPE2WC7-Dw-KeS8S.js";import{_ as n,l as o}from"./mermaid.core-B_e-IZNF.js";import{M as c,b as d}from"./cynefin-OW5HDTMX-BWgRJWKh.js";import"./index-BLTYMaXa.js";var v=d().RailroadAbnf.parser.LangiumParser,i=n(e=>{const r=e.alternatives.map(g);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformAlternation"),g=n(e=>{const r=e.elements.map(y);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformConcatenation"),b=n(e=>{if(e.includes("*")){const[t,s]=e.split("*"),l=t?parseInt(t,10):0,m=s?parseInt(s,10):1/0;return{min:l,max:m}}const r=parseInt(e,10);return{min:r,max:r}},"parseRepeat"),y=n(e=>{const r=A(e.primary);if(!e.repeat)return r;const{min:t,max:s}=b(e.repeat);return t===0&&s===1?{type:"optional",element:r}:{type:"repetition",element:r,min:t,max:s}},"transformElement"),A=n(e=>{switch(e.$type){case"AbnfStringLiteral":return{type:"terminal",value:e.value};case"AbnfNumVal":return{type:"terminal",value:e.value};case"AbnfRuleName":return{type:"nonterminal",name:e.name};case"AbnfGroup":return i(e.element);case"AbnfOptionalGroup":return{type:"optional",element:i(e.element)};default:throw new Error(`Unsupported ABNF primary node: ${e.$type}`)}},"transformPrimary"),P=n(e=>({name:e.name,definition:i(e.definition)}),"transformRule"),h=n(e=>{f(e,a),e.title&&a.setTitle(e.title),e.rules.map(r=>a.addRule(P(r)))},"populateDb"),R={parse:n(e=>{a.clear(),o.debug("[ABNF Parser] Starting Langium parse");const r=v.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new c(r);const t=r.value;o.debug("[ABNF Parser] Parsed rules:",t.rules.length),h(t),o.debug("[ABNF Parser] Parse complete")},"parse"),parser:{yy:a}},B={parser:R,db:a,renderer:u,styles:p};export{B as diagram};
@@ -1 +1 @@
1
- import{H as ln,I as un,J as y,K as tn,L as Q,M as I,N as _,O as an,P as rn,Q as j,R as o,S as K,T as sn,V as on,W as fn}from"./mermaid.core-BLAuCuqp.js";function cn(l){return l.innerRadius}function yn(l){return l.outerRadius}function gn(l){return l.startAngle}function dn(l){return l.endAngle}function mn(l){return l&&l.padAngle}function pn(l,h,q,O,v,R,L,u){var D=q-l,i=O-h,n=L-v,d=u-R,a=d*D-n*i;if(!(a*a<y))return a=(n*(h-R)-d*(l-v))/a,[l+a*D,h+a*i]}function U(l,h,q,O,v,R,L){var u=l-q,D=h-O,i=(L?R:-R)/j(u*u+D*D),n=i*D,d=-i*u,a=l+n,s=h+d,f=q+n,c=O+d,M=(a+f)/2,t=(s+c)/2,m=f-a,g=c-s,A=m*m+g*g,T=v-R,P=a*c-f*s,E=(g<0?-1:1)*j(fn(0,T*T*A-P*P)),H=(P*g-m*E)/A,J=(-P*m-g*E)/A,w=(P*g+m*E)/A,p=(-P*m+g*E)/A,x=H-M,e=J-t,r=w-M,N=p-t;return x*x+e*e>r*r+N*N&&(H=w,J=p),{cx:H,cy:J,x01:-n,y01:-d,x11:H*(v/T-1),y11:J*(v/T-1)}}function hn(){var l=cn,h=yn,q=K(0),O=null,v=gn,R=dn,L=mn,u=null,D=ln(i);function i(){var n,d,a=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-un,c=R.apply(this,arguments)-un,M=an(c-f),t=c>f;if(u||(u=n=D()),s<a&&(d=s,s=a,a=d),!(s>y))u.moveTo(0,0);else if(M>tn-y)u.moveTo(s*Q(f),s*I(f)),u.arc(0,0,s,f,c,!t),a>y&&(u.moveTo(a*Q(c),a*I(c)),u.arc(0,0,a,c,f,t));else{var m=f,g=c,A=f,T=c,P=M,E=M,H=L.apply(this,arguments)/2,J=H>y&&(O?+O.apply(this,arguments):j(a*a+s*s)),w=_(an(s-a)/2,+q.apply(this,arguments)),p=w,x=w,e,r;if(J>y){var N=sn(J/a*I(H)),z=sn(J/s*I(H));(P-=N*2)>y?(N*=t?1:-1,A+=N,T-=N):(P=0,A=T=(f+c)/2),(E-=z*2)>y?(z*=t?1:-1,m+=z,g-=z):(E=0,m=g=(f+c)/2)}var V=s*Q(m),W=s*I(m),B=a*Q(T),C=a*I(T);if(w>y){var F=s*Q(g),G=s*I(g),X=a*Q(A),Y=a*I(A),S;if(M<rn)if(S=pn(V,W,X,Y,F,G,B,C)){var Z=V-S[0],$=W-S[1],k=F-S[0],b=G-S[1],nn=1/I(on((Z*k+$*b)/(j(Z*Z+$*$)*j(k*k+b*b)))/2),en=j(S[0]*S[0]+S[1]*S[1]);p=_(w,(a-en)/(nn-1)),x=_(w,(s-en)/(nn+1))}else p=x=0}E>y?x>y?(e=U(X,Y,V,W,s,x,t),r=U(F,G,B,C,s,x,t),u.moveTo(e.cx+e.x01,e.cy+e.y01),x<w?u.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(r.y01,r.x01),!t):(u.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(e.y11,e.x11),!t),u.arc(0,0,s,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),!t),u.arc(r.cx,r.cy,x,o(r.y11,r.x11),o(r.y01,r.x01),!t))):(u.moveTo(V,W),u.arc(0,0,s,m,g,!t)):u.moveTo(V,W),!(a>y)||!(P>y)?u.lineTo(B,C):p>y?(e=U(B,C,F,G,a,-p,t),r=U(V,W,X,Y,a,-p,t),u.lineTo(e.cx+e.x01,e.cy+e.y01),p<w?u.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(r.y01,r.x01),!t):(u.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(e.y11,e.x11),!t),u.arc(0,0,a,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),t),u.arc(r.cx,r.cy,p,o(r.y11,r.x11),o(r.y01,r.x01),!t))):u.arc(0,0,a,T,A,t)}if(u.closePath(),n)return u=null,n+""||null}return i.centroid=function(){var n=(+l.apply(this,arguments)+ +h.apply(this,arguments))/2,d=(+v.apply(this,arguments)+ +R.apply(this,arguments))/2-rn/2;return[Q(d)*n,I(d)*n]},i.innerRadius=function(n){return arguments.length?(l=typeof n=="function"?n:K(+n),i):l},i.outerRadius=function(n){return arguments.length?(h=typeof n=="function"?n:K(+n),i):h},i.cornerRadius=function(n){return arguments.length?(q=typeof n=="function"?n:K(+n),i):q},i.padRadius=function(n){return arguments.length?(O=n==null?null:typeof n=="function"?n:K(+n),i):O},i.startAngle=function(n){return arguments.length?(v=typeof n=="function"?n:K(+n),i):v},i.endAngle=function(n){return arguments.length?(R=typeof n=="function"?n:K(+n),i):R},i.padAngle=function(n){return arguments.length?(L=typeof n=="function"?n:K(+n),i):L},i.context=function(n){return arguments.length?(u=n??null,i):u},i}export{hn as d};
1
+ import{H as ln,I as un,J as y,K as tn,L as Q,M as I,N as _,O as an,P as rn,Q as j,R as o,S as K,T as sn,V as on,W as fn}from"./mermaid.core-B_e-IZNF.js";function cn(l){return l.innerRadius}function yn(l){return l.outerRadius}function gn(l){return l.startAngle}function dn(l){return l.endAngle}function mn(l){return l&&l.padAngle}function pn(l,h,q,O,v,R,L,u){var D=q-l,i=O-h,n=L-v,d=u-R,a=d*D-n*i;if(!(a*a<y))return a=(n*(h-R)-d*(l-v))/a,[l+a*D,h+a*i]}function U(l,h,q,O,v,R,L){var u=l-q,D=h-O,i=(L?R:-R)/j(u*u+D*D),n=i*D,d=-i*u,a=l+n,s=h+d,f=q+n,c=O+d,M=(a+f)/2,t=(s+c)/2,m=f-a,g=c-s,A=m*m+g*g,T=v-R,P=a*c-f*s,E=(g<0?-1:1)*j(fn(0,T*T*A-P*P)),H=(P*g-m*E)/A,J=(-P*m-g*E)/A,w=(P*g+m*E)/A,p=(-P*m+g*E)/A,x=H-M,e=J-t,r=w-M,N=p-t;return x*x+e*e>r*r+N*N&&(H=w,J=p),{cx:H,cy:J,x01:-n,y01:-d,x11:H*(v/T-1),y11:J*(v/T-1)}}function hn(){var l=cn,h=yn,q=K(0),O=null,v=gn,R=dn,L=mn,u=null,D=ln(i);function i(){var n,d,a=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-un,c=R.apply(this,arguments)-un,M=an(c-f),t=c>f;if(u||(u=n=D()),s<a&&(d=s,s=a,a=d),!(s>y))u.moveTo(0,0);else if(M>tn-y)u.moveTo(s*Q(f),s*I(f)),u.arc(0,0,s,f,c,!t),a>y&&(u.moveTo(a*Q(c),a*I(c)),u.arc(0,0,a,c,f,t));else{var m=f,g=c,A=f,T=c,P=M,E=M,H=L.apply(this,arguments)/2,J=H>y&&(O?+O.apply(this,arguments):j(a*a+s*s)),w=_(an(s-a)/2,+q.apply(this,arguments)),p=w,x=w,e,r;if(J>y){var N=sn(J/a*I(H)),z=sn(J/s*I(H));(P-=N*2)>y?(N*=t?1:-1,A+=N,T-=N):(P=0,A=T=(f+c)/2),(E-=z*2)>y?(z*=t?1:-1,m+=z,g-=z):(E=0,m=g=(f+c)/2)}var V=s*Q(m),W=s*I(m),B=a*Q(T),C=a*I(T);if(w>y){var F=s*Q(g),G=s*I(g),X=a*Q(A),Y=a*I(A),S;if(M<rn)if(S=pn(V,W,X,Y,F,G,B,C)){var Z=V-S[0],$=W-S[1],k=F-S[0],b=G-S[1],nn=1/I(on((Z*k+$*b)/(j(Z*Z+$*$)*j(k*k+b*b)))/2),en=j(S[0]*S[0]+S[1]*S[1]);p=_(w,(a-en)/(nn-1)),x=_(w,(s-en)/(nn+1))}else p=x=0}E>y?x>y?(e=U(X,Y,V,W,s,x,t),r=U(F,G,B,C,s,x,t),u.moveTo(e.cx+e.x01,e.cy+e.y01),x<w?u.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(r.y01,r.x01),!t):(u.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(e.y11,e.x11),!t),u.arc(0,0,s,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),!t),u.arc(r.cx,r.cy,x,o(r.y11,r.x11),o(r.y01,r.x01),!t))):(u.moveTo(V,W),u.arc(0,0,s,m,g,!t)):u.moveTo(V,W),!(a>y)||!(P>y)?u.lineTo(B,C):p>y?(e=U(B,C,F,G,a,-p,t),r=U(V,W,X,Y,a,-p,t),u.lineTo(e.cx+e.x01,e.cy+e.y01),p<w?u.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(r.y01,r.x01),!t):(u.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(e.y11,e.x11),!t),u.arc(0,0,a,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),t),u.arc(r.cx,r.cy,p,o(r.y11,r.x11),o(r.y01,r.x01),!t))):u.arc(0,0,a,T,A,t)}if(u.closePath(),n)return u=null,n+""||null}return i.centroid=function(){var n=(+l.apply(this,arguments)+ +h.apply(this,arguments))/2,d=(+v.apply(this,arguments)+ +R.apply(this,arguments))/2-rn/2;return[Q(d)*n,I(d)*n]},i.innerRadius=function(n){return arguments.length?(l=typeof n=="function"?n:K(+n),i):l},i.outerRadius=function(n){return arguments.length?(h=typeof n=="function"?n:K(+n),i):h},i.cornerRadius=function(n){return arguments.length?(q=typeof n=="function"?n:K(+n),i):q},i.padRadius=function(n){return arguments.length?(O=n==null?null:typeof n=="function"?n:K(+n),i):O},i.startAngle=function(n){return arguments.length?(v=typeof n=="function"?n:K(+n),i):v},i.endAngle=function(n){return arguments.length?(R=typeof n=="function"?n:K(+n),i):R},i.padAngle=function(n){return arguments.length?(L=typeof n=="function"?n:K(+n),i):L},i.context=function(n){return arguments.length?(u=n??null,i):u},i}export{hn as d};