@organizaone/o1-code 0.14.1 → 0.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundled/qc-helper/docs/configuration/settings.md +9 -4
- package/bundled/qc-helper/docs/features/commands.md +45 -44
- package/bundled/qc-helper/docs/features/remote-sessions.md +102 -0
- package/bundled/qc-helper/docs/support/troubleshooting.md +4 -0
- package/chunks/{MaxSizedBox-K6LS4AHI.js → MaxSizedBox-WCIHTA5J.js} +20 -20
- package/chunks/{StandaloneSessionPicker-VAKM7ZGE.js → StandaloneSessionPicker-FPZOMXZZ.js} +37 -37
- package/chunks/{acp-subagent-executor-VUIOR2ET.js → acp-subagent-executor-NZEXVO6C.js} +22 -22
- package/chunks/{acpAgent-NJVBZXCP.js → acpAgent-5C3S3EXK.js} +63 -63
- package/chunks/{agent-VHLE7AET.js → agent-OUKS3KJA.js} +11 -11
- package/chunks/{agent-headless-BJF6NKGR.js → agent-headless-MXWPFKRF.js} +11 -11
- package/chunks/{all-providers-3TZIHJW7.js → all-providers-U3R3R6E7.js} +2 -2
- package/chunks/{anthropicContentGenerator-VB7JA4B3.js → anthropicContentGenerator-HSU2Y3YE.js} +5 -5
- package/chunks/{bridge-3FUGH7LN.js → bridge-JHBIMGIY.js} +22 -22
- package/chunks/{chunk-M6VRFWLT.js → chunk-25JT53JK.js} +2 -2
- package/chunks/{chunk-N5LF4EE4.js → chunk-2EAL2FHY.js} +4 -4
- package/chunks/{chunk-HBB3LYMT.js → chunk-2IMNI647.js} +1 -1
- package/chunks/{chunk-MFPRAXI5.js → chunk-2SSQSUD7.js} +1 -1
- package/chunks/{chunk-KCHIGNQ3.js → chunk-3AF7X2MG.js} +1 -1
- package/chunks/{chunk-YPFJPIKO.js → chunk-3HY7YVUK.js} +202 -31
- package/chunks/{chunk-RBN3RLF6.js → chunk-3XGM4GXG.js} +13 -13
- package/chunks/{chunk-JNEJLREI.js → chunk-3ZMBFNPV.js} +1 -1
- package/chunks/{chunk-A643DATS.js → chunk-4WWJCEWY.js} +9 -6
- package/chunks/{chunk-AWE7GF4J.js → chunk-54M5TQ2R.js} +3 -3
- package/chunks/{chunk-SMZJAMZI.js → chunk-56HAFFVR.js} +7 -7
- package/chunks/{chunk-6VO6YKJ3.js → chunk-5KPMPTTM.js} +1 -1
- package/chunks/{chunk-YSK3J7RQ.js → chunk-6JA47LCQ.js} +1 -1
- package/chunks/{chunk-2EGCBKYN.js → chunk-6JTVWRDH.js} +1 -1
- package/chunks/{chunk-5WA2C3YU.js → chunk-75RB6EGS.js} +1 -1
- package/chunks/{chunk-I4J3GC2D.js → chunk-7TWCFU7L.js} +1 -1
- package/chunks/{chunk-XS3QHNTA.js → chunk-7XOIEIK2.js} +4 -4
- package/chunks/{chunk-TIYFDYIF.js → chunk-AEGEUWVC.js} +1 -1
- package/chunks/{chunk-WORDJV7E.js → chunk-AYCEQ2OH.js} +2 -2
- package/chunks/{chunk-3C53Y3EH.js → chunk-BAY2S4AG.js} +5 -5
- package/chunks/{chunk-3HS7IEMU.js → chunk-BIINRKJD.js} +1 -1
- package/chunks/{chunk-5EQBVEDH.js → chunk-BL4MZ3ZG.js} +3 -3
- package/chunks/{chunk-HVXQBQY4.js → chunk-C4SR35GB.js} +1 -1
- package/chunks/{chunk-TM5ELIJT.js → chunk-CO3SD65V.js} +3 -3
- package/chunks/{chunk-5RGWMVLI.js → chunk-CPQMNYBE.js} +2 -2
- package/chunks/{chunk-VJCVMHU2.js → chunk-CYDSNNR5.js} +7 -7
- package/chunks/{chunk-Q3275KQT.js → chunk-DA4GEY74.js} +12 -2
- package/chunks/{chunk-4OYDPQIT.js → chunk-DPVWZLJW.js} +3 -3
- package/chunks/{chunk-DKDXWZAA.js → chunk-DTJHPTCP.js} +2 -2
- package/chunks/{chunk-KXUAXTBE.js → chunk-DWX6K4EP.js} +1 -1
- package/chunks/{chunk-5LMV3DCZ.js → chunk-ECBJ5FS3.js} +2 -2
- package/chunks/{chunk-2V7HIDQH.js → chunk-F3TYA6UD.js} +2 -2
- package/chunks/{chunk-JIF2TEKH.js → chunk-FBXM55GQ.js} +1 -1
- package/chunks/{chunk-32O4NVPN.js → chunk-FO2XIE6X.js} +13 -13
- package/chunks/{chunk-ND36AMUP.js → chunk-FQSMZJTY.js} +1 -1
- package/chunks/{chunk-5VNWNZZ4.js → chunk-G3GZR2GB.js} +1 -1
- package/chunks/{chunk-MZ3XMTPL.js → chunk-G3TMBRML.js} +1 -1
- package/chunks/{chunk-4ENDHWP4.js → chunk-G7JLEAIF.js} +55 -2
- package/chunks/{chunk-JSAYXOQE.js → chunk-GBEDSUAL.js} +2 -2
- package/chunks/{chunk-3UNHYRK5.js → chunk-H656RRY6.js} +8 -8
- package/chunks/{chunk-GVGCZY46.js → chunk-HGUMEOGA.js} +4 -4
- package/chunks/{chunk-CSPWXNJC.js → chunk-HWUZG6HM.js} +2 -2
- package/chunks/{chunk-GHM4HUC7.js → chunk-IKQ3LPTK.js} +3 -3
- package/chunks/{chunk-SGMEBT6K.js → chunk-IN4QTEKF.js} +2 -2
- package/chunks/{chunk-DBH5ZQ3X.js → chunk-JAPK5MIN.js} +3 -3
- package/chunks/{chunk-WBPIFM2X.js → chunk-JKXGHDQ2.js} +551 -5
- package/chunks/{chunk-ZZVIBILR.js → chunk-KEPNWFUD.js} +9 -1
- package/chunks/{chunk-URRLGWTK.js → chunk-LFUSSHHB.js} +1 -1
- package/chunks/{chunk-ZHJX6KFO.js → chunk-M2W6Q7ZY.js} +8 -2
- package/chunks/{chunk-74D4F6ZR.js → chunk-M5PBINBK.js} +1 -1
- package/chunks/{chunk-YSHODLWP.js → chunk-MDXRSVFU.js} +3 -3
- package/chunks/{chunk-7N5GDAXK.js → chunk-MLAF3GLB.js} +3 -0
- package/chunks/{chunk-JFWM2L2S.js → chunk-MMM4JHDL.js} +2 -2
- package/chunks/{chunk-VVJHO662.js → chunk-MXUFKTRV.js} +3 -3
- package/chunks/{chunk-HHMGHAVL.js → chunk-NAURON7F.js} +1 -1
- package/chunks/{chunk-WB2AB6LU.js → chunk-NC333V4Q.js} +2 -2
- package/chunks/{chunk-SHIS7KCU.js → chunk-NQHJ4XI4.js} +2 -2
- package/chunks/{chunk-XX4IZ2SW.js → chunk-NTATN4NC.js} +5 -5
- package/chunks/{chunk-LPFK3TO2.js → chunk-O6GD6SFV.js} +4 -0
- package/chunks/{chunk-P2AKC25G.js → chunk-OQ5UCQEU.js} +1 -1
- package/chunks/{chunk-ACVOTRTG.js → chunk-PB4JDMEU.js} +73 -33
- package/chunks/{chunk-EJWEWKFL.js → chunk-PZA6OK5U.js} +2 -2
- package/chunks/{chunk-T7FPP3WA.js → chunk-QCKD7NUE.js} +293 -62
- package/chunks/{chunk-62X5BQMO.js → chunk-QHZJAK26.js} +5 -5
- package/chunks/{chunk-MPL3BISR.js → chunk-QINR3BPI.js} +3 -3
- package/chunks/{chunk-R2EIRELD.js → chunk-QJOAE3MY.js} +2 -2
- package/chunks/{chunk-XFQMTQBE.js → chunk-QPATMMH6.js} +10 -10
- package/chunks/{chunk-N6MH3XSG.js → chunk-THF6QN43.js} +2 -2
- package/chunks/{chunk-NSHGO4SD.js → chunk-TIJEMBWQ.js} +1 -1
- package/chunks/{chunk-Q27JDWE5.js → chunk-TPTKSRDS.js} +2 -2
- package/chunks/{chunk-7OFHGQYG.js → chunk-TSWAMCTA.js} +2 -2
- package/chunks/{chunk-BFCJISSV.js → chunk-U3TAPXNY.js} +2 -2
- package/chunks/{chunk-DXNQVFM7.js → chunk-UBBF6OHF.js} +1 -1
- package/chunks/{chunk-QXTSKDFW.js → chunk-UUYHAE7L.js} +2 -2
- package/chunks/{chunk-5A5PF6UU.js → chunk-UZO5EWDY.js} +1 -1
- package/chunks/{chunk-BWSTJ4LI.js → chunk-V5FMJGT3.js} +3 -3
- package/chunks/{chunk-XUJZPD2H.js → chunk-VCR2ZMBJ.js} +3 -3
- package/chunks/{chunk-XS3WCMRG.js → chunk-VOC5JURN.js} +1 -1
- package/chunks/{chunk-ACL45DSG.js → chunk-VOHQDSSM.js} +5 -5
- package/chunks/{chunk-URNH2X7M.js → chunk-VT4QNRKU.js} +4 -4
- package/chunks/{chunk-X7TMJR6A.js → chunk-VWNJNOMV.js} +4 -4
- package/chunks/{chunk-SRDLL4JM.js → chunk-W5MVK3CY.js} +3 -3
- package/chunks/{chunk-5YPMVUV3.js → chunk-WN5SRYTJ.js} +5 -5
- package/chunks/{chunk-NQH5WCUX.js → chunk-WSJ2ZA4C.js} +7 -7
- package/chunks/{chunk-JJPU5RIJ.js → chunk-Y3JWAVRJ.js} +1 -1
- package/chunks/{chunk-JDJVJMXU.js → chunk-YOQXJIDM.js} +2 -2
- package/chunks/{chunk-GAEZNPGF.js → chunk-YSXZMF2B.js} +3 -3
- package/chunks/{chunk-R2Q36SDT.js → chunk-ZHEOV5HE.js} +1 -1
- package/chunks/{chunk-Z277EETV.js → chunk-ZIULS3Z4.js} +1 -1
- package/chunks/{chunk-NWQNQ2JQ.js → chunk-ZLILADLQ.js} +5 -5
- package/chunks/{chunk-FUA6Z2U4.js → chunk-ZZTHZM2I.js} +1 -1
- package/chunks/{codex-subagent-executor-NGTRWYIK.js → codex-subagent-executor-AHUDSG4Y.js} +22 -22
- package/chunks/{contextCommand-7GVOH5VF.js → contextCommand-XGDON2S3.js} +22 -22
- package/chunks/{core-runtime-POJAS25N.js → core-runtime-TBFHSDHQ.js} +20 -20
- package/chunks/{create-sub-session-QCYXUHFL.js → create-sub-session-I5GYJEYY.js} +21 -21
- package/chunks/{daemon-git-worktree-guard-D3RHUHVC.js → daemon-git-worktree-guard-ZOB5RPFK.js} +20 -20
- package/chunks/{daemon-status-provider-R3KRR4AS.js → daemon-status-provider-FGZH6W4M.js} +26 -26
- package/chunks/{daemon-trust-policy-5NYWDYOB.js → daemon-trust-policy-QFXVDRS7.js} +27 -27
- package/chunks/{daemon-trust-policy-monitor-I73M3BZX.js → daemon-trust-policy-monitor-XEGSMSQ2.js} +27 -27
- package/chunks/{deferred-core-runtime-S2JMS2IS.js → deferred-core-runtime-NRNCEWYK.js} +20 -20
- package/chunks/{edit-FAI2CHTP.js → edit-RTNEVAS4.js} +13 -13
- package/chunks/{en-SHMOSKM6.js → en-IMODPCQQ.js} +49 -1
- package/chunks/{enterPlanMode-KX7IPPYT.js → enterPlanMode-CDLYJQDN.js} +11 -11
- package/chunks/{environment-MVOVD7JZ.js → environment-NXOZD6YO.js} +23 -23
- package/chunks/{errors-DSEHKEKP.js → errors-Z5K742KC.js} +22 -22
- package/chunks/{execution-tool-XRAFGCPA.js → execution-tool-AEINPRPE.js} +13 -13
- package/chunks/{execution-worker-VKPVJNIG.js → execution-worker-5KA2DSDN.js} +16 -16
- package/chunks/{exitPlanMode-3TY5ONOY.js → exitPlanMode-PQ57IF6L.js} +11 -11
- package/chunks/{fast-path-NAKYI5AD.js → fast-path-YBLVVROI.js} +3 -3
- package/chunks/{fast-path-settings-YKLDHHCG.js → fast-path-settings-FIMIXD3V.js} +2 -2
- package/chunks/{glob-7WS7EQ5K.js → glob-CTWTSEIV.js} +11 -11
- package/chunks/{goal-tools-5WVEBKPG.js → goal-tools-54BPLUQN.js} +11 -11
- package/chunks/{handleAutoUpdate-PDYNM2OD.js → handleAutoUpdate-Z4SSSZ2E.js} +23 -23
- package/chunks/{i18n-C475G3CR.js → i18n-YZNEGDIL.js} +21 -21
- package/chunks/{initializer-U77RJ3RD.js → initializer-3OVUOMDI.js} +27 -27
- package/chunks/{installationInfo-KJT5UHT6.js → installationInfo-ELJ2EVAQ.js} +20 -20
- package/chunks/{list-B5DL4CMZ.js → list-HOPL7DZF.js} +29 -29
- package/chunks/{list-agents-NYXZC74C.js → list-agents-A7UJ6VXZ.js} +2 -2
- package/chunks/{llm-V3GR2JCY.js → llm-V2XIIRDV.js} +53 -53
- package/chunks/{llm-content-generator-WSOLYSIS.js → llm-content-generator-5YWGTM5P.js} +4 -4
- package/chunks/{loadedSettingsAdapter-RUVHFDOM.js → loadedSettingsAdapter-CJLTFJ4N.js} +27 -27
- package/chunks/{local-execution-environment-ODOGTJ6F.js → local-execution-environment-EIWDLRAH.js} +16 -16
- package/chunks/{loggingContentGenerator-DLRB334C.js → loggingContentGenerator-7BF4GJCS.js} +12 -12
- package/chunks/{managed-npm-update-NQTZYPEF.js → managed-npm-update-WITECQFC.js} +20 -20
- package/chunks/{mcp-WCOE7Y3F.js → mcp-T4PROT4K.js} +27 -27
- package/chunks/{model-call-collection-X2EWPR6V.js → model-call-collection-XR3R3VVM.js} +1 -1
- package/chunks/{model-configuration-BUJWNHTG.js → model-configuration-HMBGB7SA.js} +28 -28
- package/chunks/{modelConfigUtils-HLTTOLV5.js → modelConfigUtils-3CK424YK.js} +22 -22
- package/chunks/{monitor-R5SGEUKX.js → monitor-6OK5CF7B.js} +11 -11
- package/chunks/{nonInteractiveCli-TKBS5ML2.js → nonInteractiveCli-RIK2HQON.js} +55 -55
- package/chunks/{nonInteractiveToolExecutor-JJFTNXHA.js → nonInteractiveToolExecutor-MC2XGWHT.js} +12 -12
- package/chunks/{notebook-edit-33OGSCHE.js → notebook-edit-IIZUM2QQ.js} +12 -12
- package/chunks/{omni-CMDCQ3UQ.js → omni-ZNA6SYTJ.js} +9 -9
- package/chunks/{openaiContentGenerator-M5UV2BQJ.js → openaiContentGenerator-UU7GV5FP.js} +7 -7
- package/chunks/{openaiResponsesContentGenerator-S5ECTVDG.js → openaiResponsesContentGenerator-BCC47KF7.js} +4 -4
- package/chunks/{processUtils-GDZ7TOHZ.js → processUtils-PHZAU2FF.js} +2 -2
- package/chunks/{prompt-terminal-ledger-PGEHFQ7H.js → prompt-terminal-ledger-DTT42BN5.js} +21 -21
- package/chunks/{pt-IU7FRCNS.js → pt-JCXCCW4Y.js} +49 -1
- package/chunks/{reactive-degrade-ASMEPJ5Z.js → reactive-degrade-IO4MRXRH.js} +8 -8
- package/chunks/{read-file-2EDHAVNT.js → read-file-5ACDU2YQ.js} +1 -1
- package/chunks/{resumeHistoryUtils-QW3OYHXI.js → resumeHistoryUtils-K4TUEBRE.js} +24 -24
- package/chunks/{ripGrep-76TJJQGO.js → ripGrep-WLW256L7.js} +1 -1
- package/chunks/{run-o1-code-serve-WIDKXLJF.js → run-o1-code-serve-XNXL6BGH.js} +34 -34
- package/chunks/{sandboxConfig-R3UG3IOZ.js → sandboxConfig-6ERJ2VSP.js} +20 -20
- package/chunks/{scheduled-tasks-4UBCLNXS.js → scheduled-tasks-IQLWO7QP.js} +25 -25
- package/chunks/{scheduler-AH4TSEXQ.js → scheduler-YM3RUYQT.js} +22 -22
- package/chunks/{send-message-OSS7K7GE.js → send-message-H6B5EST3.js} +2 -2
- package/chunks/{serve-A4BJAAZE.js → serve-Q5A4XGNN.js} +27 -27
- package/chunks/{server-ZDI6GJOC.js → server-DUQGQKW7.js} +52 -52
- package/chunks/{session-DK3CRCPB.js → session-L7J2BJ4B.js} +56 -56
- package/chunks/{session-J5MWNWYV.js → session-MECHV24O.js} +2 -2
- package/chunks/{session-attachments-root-44FEUUR2.js → session-attachments-root-T6YBSJ3U.js} +20 -20
- package/chunks/{session-pr-refresh-ZGKQBFME.js → session-pr-refresh-HHPFHEXI.js} +24 -24
- package/chunks/{settings-FAWXGNOI.js → settings-PQ7U5ALA.js} +26 -26
- package/chunks/{shell-2TAJP2XL.js → shell-CVULXL34.js} +11 -11
- package/chunks/{skill-DNIK7OZQ.js → skill-TA4CALBL.js} +1 -1
- package/chunks/{skill-settings-AK7CSZAS.js → skill-settings-5CMBXYNQ.js} +26 -26
- package/chunks/{spawnChannel-IOCLK2X3.js → spawnChannel-LT5O6P3J.js} +21 -21
- package/chunks/{standalone-update-DVOARXLA.js → standalone-update-ITMWGCH5.js} +22 -22
- package/chunks/{startInteractiveUI-NTVZYIDU.js → startInteractiveUI-JB2KE65F.js} +3881 -2676
- package/chunks/{team-create-XP7DRQAK.js → team-create-FAWOEYNL.js} +11 -11
- package/chunks/{team-plan-approval-GOAS57I3.js → team-plan-approval-3T7EVWTL.js} +11 -11
- package/chunks/{terminal-image-renderer-YCLREPL4.js → terminal-image-renderer-VHUUIAKF.js} +20 -20
- package/chunks/{theme-manager-XVYTKW34.js → theme-manager-ZFTUPCOT.js} +20 -20
- package/chunks/{tool-result-media-RGRXVT5T.js → tool-result-media-77JB2L2U.js} +9 -9
- package/chunks/{tool-search-ZMAKKG5I.js → tool-search-QHLD7GJT.js} +1 -1
- package/chunks/{total-session-admission-I5UDK7FQ.js → total-session-admission-6XKHQLLL.js} +22 -22
- package/chunks/{trustedFolders-QTPG7HMS.js → trustedFolders-XTVMYO3M.js} +21 -21
- package/chunks/{update-relaunch-SGPQQMNN.js → update-relaunch-2DU52FES.js} +5 -5
- package/chunks/{updateCheck-T5ZZGRHM.js → updateCheck-7KC26GUX.js} +22 -22
- package/chunks/{upload-config-EZ62EOKL.js → upload-config-HMSU4CZP.js} +6 -6
- package/chunks/{useAutoAcceptIndicator-JF6JC7LL.js → useAutoAcceptIndicator-NRR52JRP.js} +29 -29
- package/chunks/{validateNonInterActiveAuth-S6X4XLNK.js → validateNonInterActiveAuth-VVX3IIDW.js} +52 -52
- package/chunks/{version-7F4SOHPI.js → version-EBHPPTUN.js} +1 -1
- package/chunks/{web-fetch-OO7L367T.js → web-fetch-DB6YX73X.js} +1 -1
- package/chunks/{web-search-VN7PBUQ6.js → web-search-5N6YFNQL.js} +7 -7
- package/chunks/{workflow-IWSW5MOB.js → workflow-2U3MBIGP.js} +12 -12
- package/chunks/{workspace-providers-status-ZVH5MCVN.js → workspace-providers-status-P34L7WWU.js} +31 -31
- package/chunks/{workspace-registration-store-ROZOUOYK.js → workspace-registration-store-DRQK7E65.js} +1 -1
- package/chunks/{workspace-registry-CROM24XQ.js → workspace-registry-6IQR6KH7.js} +22 -22
- package/chunks/{workspace-runtime-coordinator-NAE37OW5.js → workspace-runtime-coordinator-UY5H2H6F.js} +22 -22
- package/chunks/{workspace-service-VUQF5IQG.js → workspace-service-T4U4M57B.js} +30 -30
- package/chunks/{workspace-skills-status-DLRICTEZ.js → workspace-skills-status-EZB7FZDA.js} +27 -27
- package/chunks/{workspace-trust-reconciler-ZUL5PMCB.js → workspace-trust-reconciler-FW7PNFE7.js} +29 -29
- package/chunks/{write-file-5SDNS6TZ.js → write-file-4IU4MIDG.js} +13 -13
- package/chunks/{zoom-image-PCKYJ2PJ.js → zoom-image-AIPZJAB4.js} +1 -1
- package/cli.js +13 -13
- package/execution-worker.js +1 -1
- package/export-transcript-document.js +1 -1
- package/locales/en.js +75 -0
- package/locales/pt.js +77 -0
- package/package.json +2 -2
- package/release-notes.json +11 -0
- package/vendor/o1-connect/.lintstagedrc.mjs +7 -0
- package/vendor/o1-connect/README.md +9 -8
- package/vendor/o1-connect/VENDOR.json +4 -4
- package/vendor/o1-connect/lib.d.mts +124 -2
- package/vendor/o1-connect/lib.mjs +532 -7
- package/vendor/tree-sitter/tree-sitter-bash.wasm +0 -0
- package/vendor/tree-sitter/tree-sitter.wasm +0 -0
- package/web-shell/assets/{abnfDiagram-VCTEODGH-BbovwPw2.js → abnfDiagram-VCTEODGH-8zBYfkj0.js} +1 -1
- package/web-shell/assets/{arc-Wui7aPtG.js → arc-Dr7frfgI.js} +1 -1
- package/web-shell/assets/{architectureDiagram-5GKGNRK7-3WH5ESB7.js → architectureDiagram-5GKGNRK7-Dw0TobFx.js} +1 -1
- package/web-shell/assets/{blockDiagram-NRAW4CY4-C36UiMl-.js → blockDiagram-NRAW4CY4-vKHZF19g.js} +1 -1
- package/web-shell/assets/{c4Diagram-UCG6FXSJ-DdnwgcM1.js → c4Diagram-UCG6FXSJ-BTDDLR0b.js} +1 -1
- package/web-shell/assets/channel-BDp9YKm9.js +1 -0
- package/web-shell/assets/{chunk-2Q5K7J3B-khFNk3ao.js → chunk-2Q5K7J3B-Boqx2Q3v.js} +1 -1
- package/web-shell/assets/{chunk-5VM5RSS4-DDLDZsfl.js → chunk-5VM5RSS4-tKCWS0Nx.js} +1 -1
- package/web-shell/assets/{chunk-F27PBJKO-aLJmSbub.js → chunk-F27PBJKO-C6NkGIMe.js} +1 -1
- package/web-shell/assets/{chunk-G27WJ6UU-B_GSvc5F.js → chunk-G27WJ6UU-ChQxnaEI.js} +1 -1
- package/web-shell/assets/{chunk-JWPE2WC7-d8m9ubln.js → chunk-JWPE2WC7-DAhrR7V5.js} +1 -1
- package/web-shell/assets/{chunk-LCL6LL3I-Bf5h6VmG.js → chunk-LCL6LL3I-DQgb43EV.js} +1 -1
- package/web-shell/assets/{chunk-POPQ4Y6H-Czd6y3Dp.js → chunk-POPQ4Y6H-DdSgsFCr.js} +1 -1
- package/web-shell/assets/{chunk-SVP7TREG-B03axGPa.js → chunk-SVP7TREG-CsyENxwm.js} +1 -1
- package/web-shell/assets/{chunk-XXDRQBXY-N33vsGyF.js → chunk-XXDRQBXY-h3qkgMY3.js} +1 -1
- package/web-shell/assets/classDiagram-DTDB5LWJ-DOReB-DE.js +1 -0
- package/web-shell/assets/classDiagram-v2-JRS7N3AN-DOReB-DE.js +1 -0
- package/web-shell/assets/{cose-bilkent-JH36ORCC-CH_b8j1f.js → cose-bilkent-JH36ORCC-Bzh-NzMt.js} +1 -1
- package/web-shell/assets/{cynefin-OW5HDTMX-CpdeeUn4.js → cynefin-OW5HDTMX-C4_P_Yoc.js} +1 -1
- package/web-shell/assets/{cynefinDiagram-5FMLGOSQ-CpTzaCzt.js → cynefinDiagram-5FMLGOSQ-BuW621YL.js} +1 -1
- package/web-shell/assets/{dagre-3AP2YEHR-BTtggthC.js → dagre-3AP2YEHR-DEYS83zL.js} +1 -1
- package/web-shell/assets/{diagram-S7CK7UJ4-BKgOiJsS.js → diagram-S7CK7UJ4-BMtjGmDg.js} +1 -1
- package/web-shell/assets/{diagram-UQ7AKVKN-I12M4b-_.js → diagram-UQ7AKVKN-BzxkP09r.js} +1 -1
- package/web-shell/assets/{diagram-VSXAHHWV-C5EuyQ1H.js → diagram-VSXAHHWV-EMYvU-cZ.js} +1 -1
- package/web-shell/assets/{diagram-VX7I27RA-CcsSRsvO.js → diagram-VX7I27RA-CnspBccH.js} +1 -1
- package/web-shell/assets/{diagram-Z3DM3KII-tNMV05Fn.js → diagram-Z3DM3KII-0NFTLr1f.js} +1 -1
- package/web-shell/assets/{ebnfDiagram-PWID7BFC-liAtArsc.js → ebnfDiagram-PWID7BFC-Cn16enHu.js} +1 -1
- package/web-shell/assets/{erDiagram-SSCWMZ5O-I4lmr_zI.js → erDiagram-SSCWMZ5O-Cti58N5W.js} +1 -1
- package/web-shell/assets/{flowDiagram-A5DVABFB-nEXpsOvo.js → flowDiagram-A5DVABFB-CigLfgUP.js} +1 -1
- package/web-shell/assets/{ganttDiagram-EL5Y4UJY-Dw75s1-O.js → ganttDiagram-EL5Y4UJY-CjuMs_pK.js} +1 -1
- package/web-shell/assets/{gitGraphDiagram-WWUBYQGX-DiLeptZ9.js → gitGraphDiagram-WWUBYQGX-DOxl_2_x.js} +1 -1
- package/web-shell/assets/{index-BrTCjwfu.js → index-By0dekuz.js} +3 -3
- package/web-shell/assets/{index-BH44b2De.js → index-H7LsVN_M.js} +1 -1
- package/web-shell/assets/{infoDiagram-RXCK75RN-DCcJ_WXa.js → infoDiagram-RXCK75RN-D0XQbjRi.js} +1 -1
- package/web-shell/assets/{ishikawaDiagram-5VMMS53U-Cj6CqTSd.js → ishikawaDiagram-5VMMS53U-DOliT3Hm.js} +1 -1
- package/web-shell/assets/{journeyDiagram-EYS64GPL-CJXzA_hz.js → journeyDiagram-EYS64GPL-DF6vvHQf.js} +1 -1
- package/web-shell/assets/{kanban-definition-3QL26DDD-DdNe_a61.js → kanban-definition-3QL26DDD-BY_17qoo.js} +1 -1
- package/web-shell/assets/{layout-DaXP6yO1.js → layout-B91ME8fF.js} +1 -1
- package/web-shell/assets/{linear-B-jZU9Hq.js → linear-BEgEyRkI.js} +1 -1
- package/web-shell/assets/{mermaid.core-CIdivnr2.js → mermaid.core-BBo02LMd.js} +6 -6
- package/web-shell/assets/{mindmap-definition-FBJOCRG2-D0W4HbAm.js → mindmap-definition-FBJOCRG2-C1Jh0DIu.js} +1 -1
- package/web-shell/assets/{pegDiagram-XKGWAZYB-BXa0Luv-.js → pegDiagram-XKGWAZYB-DOt-0tX-.js} +1 -1
- package/web-shell/assets/{pieDiagram-E7YTZNPT-CWQYQAXk.js → pieDiagram-E7YTZNPT-D_Pnb6KK.js} +1 -1
- package/web-shell/assets/{quadrantDiagram-AXDQQJYC-C2rr5v8g.js → quadrantDiagram-AXDQQJYC-0tTq4TDV.js} +1 -1
- package/web-shell/assets/{railroadDiagram-O6MQD6OU-Ixq2-sNq.js → railroadDiagram-O6MQD6OU-D8sT8HBX.js} +1 -1
- package/web-shell/assets/{requirementDiagram-EFPCY7ZU-Bkiw-rJU.js → requirementDiagram-EFPCY7ZU-zmn8P5S5.js} +1 -1
- package/web-shell/assets/{sankeyDiagram-P5KCCOFB-fdyaOOD3.js → sankeyDiagram-P5KCCOFB-DIdIBb9D.js} +1 -1
- package/web-shell/assets/{sequenceDiagram-WJ2MYXX4-DwyYk-Nn.js → sequenceDiagram-WJ2MYXX4-DR0z10JW.js} +1 -1
- package/web-shell/assets/{sizeCapture-X5ZJPWSS-73pmJ9p5.js → sizeCapture-X5ZJPWSS-BAoZUB5z.js} +1 -1
- package/web-shell/assets/{stateDiagram-HBIQ2CUA-BuVhfbnT.js → stateDiagram-HBIQ2CUA-A_BJS30R.js} +1 -1
- package/web-shell/assets/stateDiagram-v2-4QOOHH4V-DsZg5hvr.js +1 -0
- package/web-shell/assets/{swimlanes-XN3QIQJK-CzJEsLmd.js → swimlanes-XN3QIQJK-DoHKDejp.js} +1 -1
- package/web-shell/assets/swimlanesDiagram-VK2B7HYN-xB_iuHcQ.js +8 -0
- package/web-shell/assets/{timeline-definition-24CTP7MA-DY2tlsbK.js → timeline-definition-24CTP7MA-DIgaU8qe.js} +1 -1
- package/web-shell/assets/{vennDiagram-4TSXK5OY-jOnpk6UN.js → vennDiagram-4TSXK5OY-DinP1LiH.js} +1 -1
- package/web-shell/assets/{wardleyDiagram-VM6X3IG4-ns8qvGAq.js → wardleyDiagram-VM6X3IG4-Bl_eYQSI.js} +1 -1
- package/web-shell/assets/{xychartDiagram-S5SC5T6Z-BVvufFM8.js → xychartDiagram-S5SC5T6Z-CeovOG8L.js} +1 -1
- package/web-shell/index.html +1 -1
- package/web-shell/sw.js +1 -1
- package/web-shell/assets/channel-laaanioB.js +0 -1
- package/web-shell/assets/classDiagram-DTDB5LWJ-vy7HfQpt.js +0 -1
- package/web-shell/assets/classDiagram-v2-JRS7N3AN-vy7HfQpt.js +0 -1
- package/web-shell/assets/stateDiagram-v2-4QOOHH4V-Behbwxmi.js +0 -1
- package/web-shell/assets/swimlanesDiagram-VK2B7HYN-xalmucUq.js +0 -8
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// o1-connect-lib 9.
|
|
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
|
|
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
|
|
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
|
|
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 =
|
|
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.
|
|
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
|
-
|
|
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
|
package/web-shell/assets/{abnfDiagram-VCTEODGH-BbovwPw2.js → abnfDiagram-VCTEODGH-8zBYfkj0.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as p,r as u,d as a}from"./chunk-SVP7TREG-
|
|
1
|
+
import{g as p,r as u,d as a}from"./chunk-SVP7TREG-CsyENxwm.js";import{p as f}from"./chunk-JWPE2WC7-DAhrR7V5.js";import{_ as n,l as o}from"./mermaid.core-BBo02LMd.js";import{M as c,b as d}from"./cynefin-OW5HDTMX-C4_P_Yoc.js";import"./index-By0dekuz.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-
|
|
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-BBo02LMd.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};
|