openpond 0.2.0 → 0.2.2

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 (220) hide show
  1. package/dist/chunks/actions-command-F55CBR2K.js +2 -0
  2. package/dist/chunks/app-layer-GNYLOBCX.js +3 -0
  3. package/dist/chunks/app-server-runtime-VAGY4LQS.js +2 -0
  4. package/dist/chunks/apps-HZ5JGBDR.js +2 -0
  5. package/dist/chunks/chunk-22UARBPW.js +3 -0
  6. package/dist/chunks/chunk-3A7HZJNE.js +1 -0
  7. package/dist/chunks/chunk-3M53YXEI.js +2 -0
  8. package/dist/chunks/chunk-3NDRIQTI.js +2 -0
  9. package/dist/chunks/chunk-6FA3GG5B.js +33 -0
  10. package/dist/chunks/chunk-6MI4KKWF.js +2 -0
  11. package/dist/chunks/chunk-7D2LMRP7.js +2 -0
  12. package/dist/chunks/chunk-A42DFLOR.js +16 -0
  13. package/dist/chunks/chunk-AF57BF75.js +24 -0
  14. package/dist/chunks/chunk-BX4J2VDU.js +2 -0
  15. package/dist/chunks/chunk-BZMVB3GS.js +2 -0
  16. package/dist/chunks/chunk-CCJG7GLE.js +5 -0
  17. package/dist/chunks/chunk-CWQWV2T3.js +2 -0
  18. package/dist/chunks/chunk-DUA3QP6Y.js +19 -0
  19. package/dist/chunks/chunk-EAPFMACH.js +10 -0
  20. package/dist/chunks/chunk-EG3XB6M6.js +5 -0
  21. package/dist/chunks/chunk-ES2ISFJC.js +66 -0
  22. package/dist/chunks/chunk-FTQLQJQV.js +2 -0
  23. package/dist/chunks/chunk-FYCJSUFV.js +53 -0
  24. package/dist/chunks/chunk-GEANXBLX.js +2 -0
  25. package/dist/chunks/chunk-GLUWATL5.js +2 -0
  26. package/dist/chunks/chunk-GPZYIVFV.js +2199 -0
  27. package/dist/chunks/chunk-H7IWJN7L.js +17 -0
  28. package/dist/chunks/chunk-HZP5U2AA.js +3 -0
  29. package/dist/chunks/chunk-I5K74TOH.js +3 -0
  30. package/dist/chunks/chunk-I7G35U7K.js +2 -0
  31. package/dist/chunks/chunk-IR3YJWPW.js +7 -0
  32. package/dist/chunks/chunk-J7WZSLHS.js +18 -0
  33. package/dist/chunks/chunk-K35OOAW2.js +6 -0
  34. package/dist/chunks/chunk-KDXLNQNF.js +12 -0
  35. package/dist/chunks/chunk-KJYNLFWD.js +2872 -0
  36. package/dist/chunks/chunk-KV2IXO2T.js +6 -0
  37. package/dist/chunks/chunk-NVGMZ2IN.js +2 -0
  38. package/dist/chunks/chunk-OGPHXXCD.js +1 -0
  39. package/dist/chunks/chunk-RAKJWIYO.js +36 -0
  40. package/dist/chunks/chunk-RWSAGQTP.js +2 -0
  41. package/dist/chunks/chunk-SDO4FC4Q.js +2 -0
  42. package/dist/chunks/chunk-T5XCPX4P.js +3 -0
  43. package/dist/chunks/chunk-VYUMTRB3.js +5 -0
  44. package/dist/chunks/chunk-X37KMV27.js +1 -0
  45. package/dist/chunks/chunk-XAYIETBO.js +28 -0
  46. package/dist/chunks/chunk-XEOEKFG6.js +71 -0
  47. package/dist/chunks/chunk-ZVOO7FKM.js +2 -0
  48. package/dist/chunks/cli-UYTSZB4Y.js +2 -0
  49. package/dist/chunks/configuration-command-HAPIYG25.js +2 -0
  50. package/dist/chunks/continual-D75WA7E7.js +7 -0
  51. package/dist/chunks/core-commands-N37UZEVE.js +2 -0
  52. package/dist/chunks/database-X2CUV732.js +2 -0
  53. package/dist/chunks/desktop-test-V7FBEG7U.js +3 -0
  54. package/dist/chunks/dist-NKLXFA37.js +2 -0
  55. package/dist/chunks/extension-NEPOQ44P.js +5 -0
  56. package/dist/chunks/help-HC4N5ZQC.js +8 -0
  57. package/dist/chunks/module-ES6BEMUI-ZVL3F6NW.js +2 -0
  58. package/dist/chunks/module-asyncify-2EFITU5U-R7TVXNAE.js +2 -0
  59. package/dist/chunks/opchat-C7XRN4ZW.js +3 -0
  60. package/dist/chunks/organizations-LQGRZJ2V.js +2 -0
  61. package/dist/chunks/profile-UWM24A7R.js +3 -0
  62. package/dist/chunks/project-agent-2ME52ZJW.js +2 -0
  63. package/dist/chunks/sandbox-command-53L3ZICT.js +2 -0
  64. package/dist/chunks/sandbox-template-55HUM5H7.js +10 -0
  65. package/dist/chunks/src-EYJF2LWV.js +319 -0
  66. package/dist/chunks/src-VGW2UEMV.js +82 -0
  67. package/dist/chunks/taskset-PISBOILQ.js +2 -0
  68. package/dist/chunks/teams-bot-FHD2HCHN.js +3 -0
  69. package/dist/chunks/training-2NDOWH5S.js +2 -0
  70. package/dist/chunks/workspaces-CQFVCR7T.js +2 -0
  71. package/dist/cli.js +3 -109
  72. package/dist/index.js +1 -31230
  73. package/dist/sandbox-template/manifest.js +1 -18380
  74. package/dist/web/assets/App-BoJQRfeu.js +176 -0
  75. package/dist/web/assets/AppDialog-rdfmJsGF.js +1 -0
  76. package/dist/web/assets/AppTerminalPanel-CLW0kxtg.js +2 -0
  77. package/dist/web/assets/{AppsView-B1NUuAIf.js → AppsView-DxMXadnp.js} +1 -1
  78. package/dist/web/assets/{BrowserSidebar-DOvYxXeP.js → BrowserSidebar-BH_jl0JS.js} +1 -1
  79. package/dist/web/assets/{CartesianChart-pOrYpzBr.js → CartesianChart-oT_rMYpf.js} +1 -1
  80. package/dist/web/assets/{CollaborationTabs-CgbR-MBJ.js → CollaborationTabs-CukgFGE0.js} +1 -1
  81. package/dist/web/assets/{CommandMenu-CrIr4qUX.js → CommandMenu-2btBTgOF.js} +1 -1
  82. package/dist/web/assets/{CommunityView-CvAVQ_HZ.js → CommunityView-DMTREmN5.js} +1 -1
  83. package/dist/web/assets/{ComposerCreateImproveStrip-DybcKwwd.js → ComposerCreateImproveStrip-3tN55cg9.js} +1 -1
  84. package/dist/web/assets/GetStartedView-CMHL24_w.js +1 -0
  85. package/dist/web/assets/HostedModelLearningReview-CqkSelkC.js +1 -0
  86. package/dist/web/assets/HostedModelLearningSettings-xqd2lSW3.js +1 -0
  87. package/dist/web/assets/LabModelVersionDetailPage-Bpnya5DM.js +1 -0
  88. package/dist/web/assets/{LabSkillSidebar-CuaYrtiu.js → LabSkillSidebar-BKZjScr8.js} +1 -1
  89. package/dist/web/assets/LabsRoute-BhPFmA_Z.js +32 -0
  90. package/dist/web/assets/LabsRoute-C1FWCoYb.css +1 -0
  91. package/dist/web/assets/MainChatThread-Bosxokt-.js +2 -0
  92. package/dist/web/assets/MainPane-Di-Rwe7x.js +8 -0
  93. package/dist/web/assets/{MarkdownText-DOlVQR8a.js → MarkdownText-dK4SBPp_.js} +1 -1
  94. package/dist/web/assets/{Messages-DMubppta.js → Messages-ftYRMKYa.js} +6 -6
  95. package/dist/web/assets/{NativeSkillSidebar-DSFwZ-od.js → NativeSkillSidebar-Cwo7JdB2.js} +1 -1
  96. package/dist/web/assets/{NewExperienceSwitcher-Dj0ePIJ-.js → NewExperienceSwitcher-C1_JzTq2.js} +1 -1
  97. package/dist/web/assets/{NewProjectDialog-B8NQV-Ji.js → NewProjectDialog-CxP6v6YW.js} +1 -1
  98. package/dist/web/assets/{OutputsPage-D_LDYTgV.js → OutputsPage-DL21_Alp.js} +1 -1
  99. package/dist/web/assets/{ProjectsPage-xjDYPc_W.js → ProjectsPage-BO9VyvMA.js} +1 -1
  100. package/dist/web/assets/RightChatPanelStack-DaqAnzdR.js +1 -0
  101. package/dist/web/assets/{RightSidebarHomePanel-j0VckZUu.js → RightSidebarHomePanel-PbUG12AO.js} +1 -1
  102. package/dist/web/assets/{ScheduledWorkPage-1aT4bBY-.js → ScheduledWorkPage-BhL-cXML.js} +1 -1
  103. package/dist/web/assets/{SettingsView-BSpuMDpv.js → SettingsView-D6-s7G88.js} +7 -7
  104. package/dist/web/assets/TeamChatView-DbS1N-fo.js +3 -0
  105. package/dist/web/assets/{TerminalOverlay-CrSwUk2d.js → TerminalOverlay-CphyBXJR.js} +3 -3
  106. package/dist/web/assets/{TrainingCreationPanel-B4HMRwUg.js → TrainingCreationPanel-Czsdraix.js} +1 -1
  107. package/dist/web/assets/{TrainingDraftPanel-D4r1tN3I.js → TrainingDraftPanel-Bq3B5pUk.js} +1 -1
  108. package/dist/web/assets/{UsageSettingsSection-2aymqwIM.js → UsageSettingsSection-B74FNwaP.js} +5 -5
  109. package/dist/web/assets/{WorkSidebarPanel-B0X0OiR6.js → WorkSidebarPanel-BgaK4XSg.js} +1 -1
  110. package/dist/web/assets/WorkspaceDiffPanel-C3seHnVY.js +14 -0
  111. package/dist/web/assets/{WorkspaceEnvironmentMenu-OAfMEt7L.js → WorkspaceEnvironmentMenu-DPghQUdv.js} +3 -3
  112. package/dist/web/assets/{WorkspaceGitDialogs-YxcPH2Rq.js → WorkspaceGitDialogs-D8c6Okb_.js} +1 -1
  113. package/dist/web/assets/{WorkspaceMonacoEditor-COKTiQZl.js → WorkspaceMonacoEditor-2kjRFf4l.js} +36 -36
  114. package/dist/web/assets/{arrow-up-right-_TX-awvK.js → arrow-up-right-C5X-29oa.js} +1 -1
  115. package/dist/web/assets/chat-file-links-Bmz9kVct.js +1 -0
  116. package/dist/web/assets/chevron-up-NbP9vY4E.js +1 -0
  117. package/dist/web/assets/{clipboard-CyRSS8Sy.js → clipboard-fvHMXPWa.js} +1 -1
  118. package/dist/web/assets/{cloud-upload-uBJBUYTy.js → cloud-upload-BAycsdHL.js} +1 -1
  119. package/dist/web/assets/{cssMode-BrXSsZYs.js → cssMode-Yis679a5.js} +1 -1
  120. package/dist/web/assets/{folder-open-DktdZNW7.js → folder-open-bii4KUCv.js} +1 -1
  121. package/dist/web/assets/{folder-plus-DO06i9Vo.js → folder-plus-B0B7mUCx.js} +1 -1
  122. package/dist/web/assets/{git-commit-horizontal-zFSIkPs7.js → git-commit-horizontal-B6yTdtnB.js} +1 -1
  123. package/dist/web/assets/{htmlMode-X9UMFkjt.js → htmlMode-DHeBSKVF.js} +1 -1
  124. package/dist/web/assets/{index-UOGdfLzi.js → index-667pXXsu.js} +1 -1
  125. package/dist/web/assets/{index-ByQIHpc9.css → index-BGMzUaup.css} +1 -1
  126. package/dist/web/assets/{info-BEJXUqCD.js → info-NCOESX3I.js} +1 -1
  127. package/dist/web/assets/{jsonMode-DIsB-j2E.js → jsonMode-C4oxy1cU.js} +1 -1
  128. package/dist/web/assets/{lspLanguageFeatures-CmZ17KpA.js → lspLanguageFeatures-CLj3WGZW.js} +1 -1
  129. package/dist/web/assets/{minimize-2-DumTpFtE.js → minimize-2-DtI1vgd7.js} +1 -1
  130. package/dist/web/assets/{monaco.contribution-D6w5PJji.js → monaco.contribution-DZPgekIQ.js} +2 -2
  131. package/dist/web/assets/{monaco.contribution-DJ_NmcHu.js → monaco.contribution-Ddw-TznO.js} +2 -2
  132. package/dist/web/assets/{monaco.contribution-YVDfJcG4.js → monaco.contribution-DhVPJ-oY.js} +2 -2
  133. package/dist/web/assets/{monaco.contribution-LZEujgny.js → monaco.contribution-DrW6DjWP.js} +2 -2
  134. package/dist/web/assets/{play-CLFeH7CU.js → play-DB3XFAnG.js} +1 -1
  135. package/dist/web/assets/{python-Djbda_qZ.js → python-DLyUeEeL.js} +1 -1
  136. package/dist/web/assets/{refresh-cw-B4IpQ_7Q.js → refresh-cw-0zSLZtfp.js} +1 -1
  137. package/dist/web/assets/{save-BbTHztnA.js → save-BCZlshOA.js} +1 -1
  138. package/dist/web/assets/{square-BJrVbmz6.js → square-CRytZWR_.js} +1 -1
  139. package/dist/web/assets/{toggleHighContrast-BopU5W9S.js → toggleHighContrast-TXg0rI_R.js} +1 -1
  140. package/dist/web/assets/{tsMode-CH_0_YDX.js → tsMode-Bj1019AY.js} +1 -1
  141. package/dist/web/assets/{upload-UumVeufu.js → upload-CnE9u7GB.js} +1 -1
  142. package/dist/web/assets/{useLocalAgentSchedules-BRa23U7O.js → useLocalAgentSchedules-qI87RHVI.js} +1 -1
  143. package/dist/web/assets/{wifi-off-BWJWivn6.js → wifi-off-CfuwRBx7.js} +1 -1
  144. package/dist/web/assets/{workers-pTe8RvSI.js → workers-CXdUI7wU.js} +1 -1
  145. package/dist/web/assets/{yaml-DNLASORn.js → yaml-AP8aiwLm.js} +1 -1
  146. package/dist/web/index.html +2 -2
  147. package/package.json +4 -3
  148. package/dist/chunks/actions-command-6N5XWMR6.js +0 -185
  149. package/dist/chunks/app-layer-F3CGXB33.js +0 -216
  150. package/dist/chunks/app-server-runtime-RHO5TFUC.js +0 -23
  151. package/dist/chunks/apps-L5XCL7QY.js +0 -429
  152. package/dist/chunks/chunk-26AMV5ZI.js +0 -634
  153. package/dist/chunks/chunk-3EB7I67T.js +0 -630
  154. package/dist/chunks/chunk-3ELF4FXY.js +0 -96
  155. package/dist/chunks/chunk-3VEYNDHN.js +0 -669
  156. package/dist/chunks/chunk-4KA25HUP.js +0 -5648
  157. package/dist/chunks/chunk-4L3ZJS2T.js +0 -1207
  158. package/dist/chunks/chunk-6SMNG6YA.js +0 -1303
  159. package/dist/chunks/chunk-7RIGZB7N.js +0 -1148
  160. package/dist/chunks/chunk-A6G3PFA5.js +0 -2164
  161. package/dist/chunks/chunk-BVY5JYM6.js +0 -512
  162. package/dist/chunks/chunk-DLQQIWN2.js +0 -648
  163. package/dist/chunks/chunk-FJ2JGB2N.js +0 -1373
  164. package/dist/chunks/chunk-FQS2QL5F.js +0 -14522
  165. package/dist/chunks/chunk-G65WAOJV.js +0 -1643
  166. package/dist/chunks/chunk-JTHL5XJ2.js +0 -1838
  167. package/dist/chunks/chunk-K4TZEHAW.js +0 -602
  168. package/dist/chunks/chunk-KCRCIQPD.js +0 -66
  169. package/dist/chunks/chunk-KSRWKXRB.js +0 -12
  170. package/dist/chunks/chunk-MUMPWI4O.js +0 -92
  171. package/dist/chunks/chunk-NTK22KJD.js +0 -10707
  172. package/dist/chunks/chunk-OCBRPU2K.js +0 -629
  173. package/dist/chunks/chunk-PS37DB5F.js +0 -183
  174. package/dist/chunks/chunk-R3C3MNSI.js +0 -140
  175. package/dist/chunks/chunk-SMNFI2FU.js +0 -113
  176. package/dist/chunks/chunk-UACZUFIA.js +0 -47
  177. package/dist/chunks/chunk-UZMVNKXM.js +0 -1275
  178. package/dist/chunks/chunk-VT6BLHMB.js +0 -67198
  179. package/dist/chunks/chunk-W5GKHH77.js +0 -168
  180. package/dist/chunks/chunk-X6F4LBTQ.js +0 -832
  181. package/dist/chunks/chunk-X7ZG4TSW.js +0 -3063
  182. package/dist/chunks/chunk-XA4KBDMY.js +0 -13723
  183. package/dist/chunks/chunk-YVCYVDNP.js +0 -746
  184. package/dist/chunks/chunk-ZNQEROWP.js +0 -254
  185. package/dist/chunks/cli-D2MUUBEX.js +0 -23
  186. package/dist/chunks/configuration-command-NR6JYIUD.js +0 -187
  187. package/dist/chunks/continual-37CE4LLJ.js +0 -803
  188. package/dist/chunks/core-commands-SWGIOZLW.js +0 -50
  189. package/dist/chunks/database-DEYUZDIM.js +0 -20
  190. package/dist/chunks/desktop-test-QOS7G5NE.js +0 -148
  191. package/dist/chunks/dist-AKYCQNNF.js +0 -187
  192. package/dist/chunks/extension-HJUJBQAD.js +0 -9378
  193. package/dist/chunks/help-J6PZ23IC.js +0 -67
  194. package/dist/chunks/opchat-ABX5YBAT.js +0 -169
  195. package/dist/chunks/organizations-CPNC47DO.js +0 -806
  196. package/dist/chunks/profile-Q3HB5MIO.js +0 -1136
  197. package/dist/chunks/project-agent-YHUBX4OR.js +0 -516
  198. package/dist/chunks/sandbox-command-YFL5QTWX.js +0 -1661
  199. package/dist/chunks/sandbox-template-Z6P7NTNF.js +0 -1655
  200. package/dist/chunks/src-7XEENEBI.js +0 -3628
  201. package/dist/chunks/src-KBBIV4NT.js +0 -56125
  202. package/dist/chunks/taskset-2TRZBRRT.js +0 -66
  203. package/dist/chunks/teams-bot-WD33NLH5.js +0 -146
  204. package/dist/chunks/training-4XH37UZB.js +0 -17
  205. package/dist/chunks/workspaces-WG2MH2WE.js +0 -99
  206. package/dist/web/assets/App-C9aGkxVg.js +0 -173
  207. package/dist/web/assets/AppDialog-CK6_lg8c.js +0 -1
  208. package/dist/web/assets/AppTerminalPanel-BKqgX4sd.js +0 -2
  209. package/dist/web/assets/GetStartedView-DVInkexN.js +0 -1
  210. package/dist/web/assets/LabModelVersionDetailPage-NaaPElmM.js +0 -1
  211. package/dist/web/assets/LabsRoute-BRR6x3SX.js +0 -2
  212. package/dist/web/assets/LabsRoute-CGFgymTX.css +0 -1
  213. package/dist/web/assets/MainChatThread-BfkjCZB9.js +0 -2
  214. package/dist/web/assets/MainPane-Gw-YK38n.js +0 -8
  215. package/dist/web/assets/RightChatPanelStack-BktRQ9wg.js +0 -1
  216. package/dist/web/assets/TeamChatView-BPWJbDf1.js +0 -3
  217. package/dist/web/assets/WorkspaceDiffPanel-Pg7GL0br.js +0 -14
  218. package/dist/web/assets/chat-file-links-CWLsRYvW.js +0 -1
  219. package/dist/web/assets/chevron-up--mNnEqha.js +0 -1
  220. package/dist/web/assets/index-BEPmTPIA.js +0 -1
@@ -1,806 +0,0 @@
1
- import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import "./chunk-XA4KBDMY.js";
3
- import "./chunk-NTK22KJD.js";
4
- import "./chunk-R3C3MNSI.js";
5
- import "./chunk-X7ZG4TSW.js";
6
- import {
7
- resolveSandboxClient
8
- } from "./chunk-3VEYNDHN.js";
9
- import "./chunk-FJ2JGB2N.js";
10
- import "./chunk-SMNFI2FU.js";
11
- import "./chunk-KSRWKXRB.js";
12
- import "./chunk-PS37DB5F.js";
13
- import "./chunk-4KA25HUP.js";
14
- import "./chunk-ZNQEROWP.js";
15
- import "./chunk-7RIGZB7N.js";
16
- import "./chunk-4L3ZJS2T.js";
17
- import {
18
- DEFAULT_OPENPOND_API_BASE_URL,
19
- DEFAULT_OPENPOND_WEB_BASE_URL
20
- } from "./chunk-JTHL5XJ2.js";
21
- import "./chunk-FQS2QL5F.js";
22
- import {
23
- parseBooleanOption,
24
- parseCsvOption,
25
- parseIntegerOption,
26
- parseJsonOption
27
- } from "./chunk-MUMPWI4O.js";
28
- import "./chunk-UACZUFIA.js";
29
-
30
- // src/cli/organizations.ts
31
- import { createHash, randomBytes } from "node:crypto";
32
- import { createServer } from "node:http";
33
-
34
- // ../../packages/runtime/src/urls.ts
35
- var DEFAULT_OPENPOND_API_HOST = new URL(DEFAULT_OPENPOND_API_BASE_URL).hostname;
36
- var DEFAULT_OPENPOND_WEB_HOST = new URL(DEFAULT_OPENPOND_WEB_BASE_URL).hostname;
37
- var DEFAULT_OPENPOND_OPCHAT_API_BASE_URL = `${DEFAULT_OPENPOND_API_BASE_URL}/opchat/v1`;
38
-
39
- // ../../packages/runtime/src/system-browser.ts
40
- import { spawn } from "node:child_process";
41
- function resolveSystemBrowserCommand(url, platform = process.platform) {
42
- if (platform === "darwin") return { command: "open", args: [url] };
43
- if (platform === "win32") {
44
- return {
45
- command: "rundll32.exe",
46
- args: ["url.dll,FileProtocolHandler", url]
47
- };
48
- }
49
- return { command: "xdg-open", args: [url] };
50
- }
51
- async function openUrlWithSystemBrowser(url, options = {}) {
52
- const browser = options.command ?? resolveSystemBrowserCommand(url);
53
- const handoffTimeoutMs = options.handoffTimeoutMs ?? 1500;
54
- return new Promise((resolve) => {
55
- let settled = false;
56
- let timer = null;
57
- const finish = (result) => {
58
- if (settled) return;
59
- settled = true;
60
- if (timer) clearTimeout(timer);
61
- resolve(result);
62
- };
63
- const child = spawn(browser.command, browser.args, {
64
- detached: false,
65
- shell: false,
66
- stdio: "ignore",
67
- windowsHide: true
68
- });
69
- child.once("error", (error) => {
70
- const code = error.code;
71
- finish({
72
- opened: false,
73
- error: code ? `browser launcher ${browser.command} failed (${code})` : `browser launcher ${browser.command} failed`
74
- });
75
- });
76
- child.once("close", (code, signal) => {
77
- if (code === 0) {
78
- finish({ opened: true });
79
- return;
80
- }
81
- const detail = signal ? `signal ${signal}` : `code ${code ?? "unknown"}`;
82
- finish({ opened: false, error: `browser launcher ${browser.command} exited with ${detail}` });
83
- });
84
- timer = setTimeout(() => {
85
- child.unref();
86
- finish({ opened: true });
87
- }, handoffTimeoutMs);
88
- timer.unref();
89
- });
90
- }
91
-
92
- // src/cli/organizations.ts
93
- function formatOrganizationLine(organization) {
94
- return [
95
- organization.slug,
96
- `team=${organization.teamId}`,
97
- `role=${organization.role}`,
98
- `status=${organization.status}`,
99
- organization.displayName
100
- ].join(" ");
101
- }
102
- function formatOrganizationMemberLine(member) {
103
- return [
104
- member.email ?? member.userId,
105
- `user=${member.userId}`,
106
- `role=${member.role}`,
107
- member.createdAt
108
- ].join(" ");
109
- }
110
- function formatOrganizationMcpServerLine(server) {
111
- if (!server) return "no mcp server configured";
112
- return [
113
- server.slug,
114
- `team=${server.teamId}`,
115
- `status=${server.status}`,
116
- `tools=${server.toolset.join(",") || "-"}`,
117
- server.resourceUrl
118
- ].join(" ");
119
- }
120
- var DEFAULT_MCP_AUTHORIZE_SCOPES = [
121
- "estimate.read",
122
- "estimate.write",
123
- "estimate.execute",
124
- "artifacts.read",
125
- "artifacts.write"
126
- ];
127
- function normalizeMcpResourceUrl(url) {
128
- const trimmed = url.trim().replace(/\/$/, "");
129
- if (!trimmed) {
130
- throw new Error("MCP resource URL must be non-empty");
131
- }
132
- const parsed = new URL(trimmed);
133
- return parsed.toString().replace(/\/$/, "");
134
- }
135
- function resolveMcpProbeResourceUrl(server, options) {
136
- const explicit = typeof options.resourceUrl === "string" && options.resourceUrl.trim() ? options.resourceUrl.trim() : typeof options.url === "string" && options.url.trim() ? options.url.trim() : "";
137
- if (explicit) {
138
- return normalizeMcpResourceUrl(explicit);
139
- }
140
- if (!server?.resourceUrl) {
141
- throw new Error(
142
- "organization does not have an MCP server; run organizations mcp-generate first"
143
- );
144
- }
145
- return normalizeMcpResourceUrl(server.resourceUrl);
146
- }
147
- function resolveMcpProbeOrigin(resourceUrl, options) {
148
- const explicit = typeof options.origin === "string" && options.origin.trim() ? options.origin.trim() : "";
149
- if (explicit) {
150
- return normalizeMcpResourceUrl(explicit);
151
- }
152
- return new URL(resourceUrl).origin;
153
- }
154
- function randomOauthToken(bytes = 32) {
155
- return randomBytes(bytes).toString("base64url");
156
- }
157
- function buildMcpOauthPkceChallenge(verifier) {
158
- return createHash("sha256").update(verifier).digest("base64url");
159
- }
160
- function parseMcpOAuthScopes(options) {
161
- const raw = typeof options.scope === "string" && options.scope.trim() ? options.scope : typeof options.scopes === "string" && options.scopes.trim() ? options.scopes : "";
162
- if (!raw) {
163
- return [...DEFAULT_MCP_AUTHORIZE_SCOPES];
164
- }
165
- const scopes = raw.split(/[,\s]+/g).map((scope) => scope.trim()).filter(Boolean);
166
- if (scopes.length === 0) {
167
- throw new Error("scope must include at least one OAuth scope");
168
- }
169
- return scopes;
170
- }
171
- function resolveMcpOAuthClientId(options) {
172
- const value = typeof options.clientId === "string" && options.clientId.trim() ? options.clientId.trim() : "openpond-code-mcp-proof";
173
- if (value === "true") {
174
- throw new Error("client-id must be a non-empty value");
175
- }
176
- return value;
177
- }
178
- function resolveMcpOAuthTimeoutMs(options) {
179
- const timeoutSeconds = parseIntegerOption(options.timeoutSeconds, "timeout-seconds") ?? parseIntegerOption(options.timeout, "timeout") ?? 180;
180
- if (timeoutSeconds <= 0) {
181
- throw new Error("timeout must be greater than zero");
182
- }
183
- return timeoutSeconds * 1e3;
184
- }
185
- function resolveMcpOAuthCallbackPort(options) {
186
- const port = parseIntegerOption(options.callbackPort, "callback-port") ?? 0;
187
- if (port < 0 || port > 65535) {
188
- throw new Error("callback-port must be between 0 and 65535");
189
- }
190
- return port;
191
- }
192
- function closeServer(server) {
193
- return new Promise((resolve, reject) => {
194
- server.close((error) => {
195
- if (error) reject(error);
196
- else resolve();
197
- });
198
- });
199
- }
200
- async function startMcpOAuthCallbackListener(input) {
201
- let settled = false;
202
- let timeout = null;
203
- let resolveCallback = null;
204
- let rejectCallback = null;
205
- const callbackPromise = new Promise(
206
- (resolve, reject) => {
207
- resolveCallback = resolve;
208
- rejectCallback = reject;
209
- }
210
- );
211
- const settle = (response, status, body, result, error) => {
212
- if (settled) {
213
- response.writeHead(204).end();
214
- return;
215
- }
216
- settled = true;
217
- response.writeHead(status, {
218
- "cache-control": "no-store",
219
- "content-type": "text/html; charset=utf-8"
220
- });
221
- response.end(body);
222
- if (timeout) clearTimeout(timeout);
223
- if (result) {
224
- resolveCallback?.(result);
225
- } else {
226
- rejectCallback?.(error ?? new Error("oauth_callback_failed"));
227
- }
228
- };
229
- const server = createServer((request, response) => {
230
- const host = request.headers.host ?? "127.0.0.1";
231
- const url = new URL(request.url ?? "/", `http://${host}`);
232
- if (url.pathname !== "/callback") {
233
- response.writeHead(404, { "content-type": "text/plain; charset=utf-8" });
234
- response.end("Not found");
235
- return;
236
- }
237
- const state = url.searchParams.get("state") ?? "";
238
- const error = url.searchParams.get("error") ?? "";
239
- const code = url.searchParams.get("code") ?? "";
240
- if (state !== input.expectedState) {
241
- settle(
242
- response,
243
- 400,
244
- "<!doctype html><title>OpenPond OAuth failed</title><p>State mismatch. Return to the terminal and retry.</p>",
245
- void 0,
246
- new Error("oauth_state_mismatch")
247
- );
248
- return;
249
- }
250
- if (error) {
251
- settle(
252
- response,
253
- 400,
254
- "<!doctype html><title>OpenPond OAuth denied</title><p>Authorization was not completed. Return to the terminal.</p>",
255
- void 0,
256
- new Error(`oauth_authorization_failed:${error}`)
257
- );
258
- return;
259
- }
260
- if (!code) {
261
- settle(
262
- response,
263
- 400,
264
- "<!doctype html><title>OpenPond OAuth failed</title><p>Missing authorization code. Return to the terminal and retry.</p>",
265
- void 0,
266
- new Error("oauth_code_missing")
267
- );
268
- return;
269
- }
270
- settle(
271
- response,
272
- 200,
273
- "<!doctype html><title>OpenPond OAuth complete</title><p>Authorization complete. You can return to the terminal.</p>",
274
- { code, state }
275
- );
276
- });
277
- await new Promise((resolve, reject) => {
278
- const onError = (error) => {
279
- server.off("listening", onListening);
280
- reject(error);
281
- };
282
- const onListening = () => {
283
- server.off("error", onError);
284
- resolve();
285
- };
286
- server.once("error", onError);
287
- server.once("listening", onListening);
288
- server.listen(input.port, "127.0.0.1");
289
- });
290
- const address = server.address();
291
- if (!address || typeof address.port !== "number") {
292
- await closeServer(server);
293
- throw new Error("oauth_callback_listener_failed");
294
- }
295
- timeout = setTimeout(() => {
296
- if (!settled) {
297
- settled = true;
298
- rejectCallback?.(new Error("oauth_callback_timeout"));
299
- }
300
- }, input.timeoutMs);
301
- return {
302
- close: async () => {
303
- if (timeout) clearTimeout(timeout);
304
- await closeServer(server).catch(() => {
305
- });
306
- },
307
- redirectUri: `http://127.0.0.1:${address.port}/callback`,
308
- waitForCallback: () => callbackPromise
309
- };
310
- }
311
- function openUrlWithSystemBrowser2(url) {
312
- void openUrlWithSystemBrowser(url);
313
- }
314
- function buildMcpOAuthAuthorizeUrl(input) {
315
- const url = new URL(input.authorizationEndpoint);
316
- url.searchParams.set("response_type", "code");
317
- url.searchParams.set("client_id", input.clientId);
318
- url.searchParams.set("redirect_uri", input.redirectUri);
319
- url.searchParams.set("code_challenge", input.codeChallenge);
320
- url.searchParams.set("code_challenge_method", "S256");
321
- url.searchParams.set("resource", input.resourceUrl);
322
- url.searchParams.set("scope", input.scopes.join(" "));
323
- url.searchParams.set("state", input.state);
324
- return url.toString();
325
- }
326
- async function exchangeMcpOAuthAuthorizationCode(input) {
327
- const params = new URLSearchParams();
328
- params.set("grant_type", "authorization_code");
329
- params.set("client_id", input.clientId);
330
- params.set("redirect_uri", input.redirectUri);
331
- params.set("code", input.code);
332
- params.set("code_verifier", input.codeVerifier);
333
- const response = await fetch(`${input.origin}/oauth/token`, {
334
- method: "POST",
335
- headers: {
336
- "content-type": "application/x-www-form-urlencoded"
337
- },
338
- body: params
339
- });
340
- const body = await readMcpProbeBody(response);
341
- if (!response.ok) {
342
- throw new Error(
343
- `oauth_token_exchange_failed:${response.status}:${JSON.stringify(body)}`
344
- );
345
- }
346
- if (!body || typeof body !== "object" || Array.isArray(body)) {
347
- throw new Error("oauth_token_exchange_invalid_response");
348
- }
349
- const token = body;
350
- if (typeof token.access_token !== "string" || !token.access_token.trim()) {
351
- throw new Error("oauth_token_exchange_missing_access_token");
352
- }
353
- return {
354
- access_token: token.access_token,
355
- ...typeof token.expires_in === "number" ? { expires_in: token.expires_in } : {},
356
- ...typeof token.refresh_token === "string" ? { refresh_token: token.refresh_token } : {},
357
- ...typeof token.scope === "string" ? { scope: token.scope } : {},
358
- ...typeof token.token_type === "string" ? { token_type: token.token_type } : {}
359
- };
360
- }
361
- async function readMcpProbeBody(response) {
362
- const text = await response.text().catch(() => "");
363
- if (!text) {
364
- return null;
365
- }
366
- const trimmed = text.trim();
367
- const contentType = response.headers.get("content-type") ?? "";
368
- if (contentType.toLowerCase().includes("application/json") || trimmed.startsWith("{") || trimmed.startsWith("[")) {
369
- try {
370
- return JSON.parse(trimmed);
371
- } catch {
372
- return text;
373
- }
374
- }
375
- return text;
376
- }
377
- async function fetchMcpProbe(url, init = {}) {
378
- const response = await fetch(url, init);
379
- return {
380
- url,
381
- status: response.status,
382
- ok: response.ok,
383
- headers: {
384
- contentType: response.headers.get("content-type"),
385
- location: response.headers.get("location"),
386
- wwwAuthenticate: response.headers.get("www-authenticate")
387
- },
388
- body: await readMcpProbeBody(response)
389
- };
390
- }
391
- function buildMcpJsonRpcRequest(id, method, params) {
392
- return params ? { jsonrpc: "2.0", id, method, params } : { jsonrpc: "2.0", id, method };
393
- }
394
- function parseMcpToolArguments(options) {
395
- const raw = typeof options.arguments === "string" && options.arguments.trim() ? options.arguments : typeof options.args === "string" && options.args.trim() ? options.args : "";
396
- if (!raw) {
397
- return {};
398
- }
399
- const parsed = parseJsonOption(raw, "arguments");
400
- if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
401
- throw new Error("arguments must be a JSON object");
402
- }
403
- return parsed;
404
- }
405
- async function postMcpJsonRpcProbe(input) {
406
- const headers = {
407
- "content-type": "application/json"
408
- };
409
- if (input.accessToken) {
410
- headers.authorization = `Bearer ${input.accessToken}`;
411
- }
412
- return fetchMcpProbe(input.resourceUrl, {
413
- method: "POST",
414
- headers,
415
- body: JSON.stringify(
416
- buildMcpJsonRpcRequest(input.id, input.method, input.params)
417
- )
418
- });
419
- }
420
- async function probeOrganizationMcp(input) {
421
- const resourceUrl = normalizeMcpResourceUrl(input.resourceUrl);
422
- const origin = normalizeMcpResourceUrl(input.origin);
423
- const protectedResourceUrl = `${resourceUrl}/.well-known/oauth-protected-resource`;
424
- const authorizationServerUrl = `${origin}/.well-known/oauth-authorization-server`;
425
- const [
426
- protectedResource,
427
- authorizationServer,
428
- directGetChallenge,
429
- initialize,
430
- toolsList,
431
- unauthenticatedToolCall,
432
- authenticatedToolCall
433
- ] = await Promise.all([
434
- fetchMcpProbe(protectedResourceUrl),
435
- fetchMcpProbe(authorizationServerUrl),
436
- fetchMcpProbe(resourceUrl),
437
- postMcpJsonRpcProbe({
438
- resourceUrl,
439
- id: 1,
440
- method: "initialize"
441
- }),
442
- postMcpJsonRpcProbe({
443
- resourceUrl,
444
- id: 2,
445
- method: "tools/list"
446
- }),
447
- postMcpJsonRpcProbe({
448
- resourceUrl,
449
- id: 3,
450
- method: "tools/call",
451
- params: {
452
- name: input.toolName,
453
- arguments: input.toolArguments
454
- }
455
- }),
456
- input.accessToken ? postMcpJsonRpcProbe({
457
- resourceUrl,
458
- id: 4,
459
- method: "tools/call",
460
- params: {
461
- name: input.toolName,
462
- arguments: input.toolArguments
463
- },
464
- accessToken: input.accessToken
465
- }) : Promise.resolve(null)
466
- ]);
467
- return {
468
- resourceUrl,
469
- origin,
470
- protectedResource,
471
- authorizationServer,
472
- directGetChallenge,
473
- initialize,
474
- toolsList,
475
- unauthenticatedToolCall,
476
- ...authenticatedToolCall ? { authenticatedToolCall } : {}
477
- };
478
- }
479
- function parseOrganizationRole(value) {
480
- const role = typeof value === "string" ? value.trim() : "";
481
- if (role === "owner" || role === "admin" || role === "member") {
482
- return role;
483
- }
484
- throw new Error("role must be owner, admin, or member");
485
- }
486
- function buildOrganizationCreateInput(options) {
487
- const displayName = typeof options.displayName === "string" && options.displayName.trim() ? options.displayName.trim() : typeof options.name === "string" && options.name.trim() ? options.name.trim() : "";
488
- if (!displayName) {
489
- throw new Error(
490
- "usage: organizations create --name <name> [--slug <slug>]"
491
- );
492
- }
493
- return {
494
- displayName,
495
- ...typeof options.slug === "string" && options.slug.trim() ? { slug: options.slug.trim() } : {},
496
- ...typeof options.primaryContactEmail === "string" && options.primaryContactEmail.trim() ? { primaryContactEmail: options.primaryContactEmail.trim() } : {},
497
- ...typeof options.customDomain === "string" && options.customDomain.trim() ? { customDomain: options.customDomain.trim() } : {}
498
- };
499
- }
500
- function buildOrganizationUpdateInput(options) {
501
- const input = {};
502
- const displayName = typeof options.displayName === "string" && options.displayName.trim() ? options.displayName.trim() : typeof options.name === "string" && options.name.trim() ? options.name.trim() : "";
503
- if (displayName) input.displayName = displayName;
504
- if (typeof options.slug === "string" && options.slug.trim()) {
505
- input.slug = options.slug.trim();
506
- }
507
- if (typeof options.primaryContactEmail === "string") {
508
- input.primaryContactEmail = options.primaryContactEmail.trim() || null;
509
- }
510
- if (typeof options.customDomain === "string") {
511
- input.customDomain = options.customDomain.trim() || null;
512
- }
513
- if (typeof options.status === "string" && options.status.trim()) {
514
- const status = options.status.trim();
515
- if (status !== "active" && status !== "disabled" && status !== "archived") {
516
- throw new Error("status must be active, disabled, or archived");
517
- }
518
- input.status = status;
519
- }
520
- if (Object.keys(input).length === 0) {
521
- throw new Error("organizations update requires at least one changed field");
522
- }
523
- return input;
524
- }
525
- function buildOrganizationMemberInput(options) {
526
- const email = typeof options.email === "string" ? options.email.trim() : "";
527
- if (!email) {
528
- throw new Error(
529
- "usage: organizations member-upsert <slug> --email <email> --role <role>"
530
- );
531
- }
532
- return {
533
- email,
534
- role: parseOrganizationRole(options.role)
535
- };
536
- }
537
- function buildOrganizationMcpGenerateInput(options) {
538
- return {
539
- ...typeof options.origin === "string" && options.origin.trim() ? { origin: options.origin.trim() } : {},
540
- ...typeof options.toolset === "string" && options.toolset.trim() ? { toolset: parseCsvOption(options.toolset) } : {}
541
- };
542
- }
543
- async function runOrganizationsCommand(options, rest) {
544
- const subcommand = rest[0] || "list";
545
- const client = await resolveSandboxClient(options);
546
- const outputJson = parseBooleanOption(options.json);
547
- if (subcommand === "list") {
548
- const organizations = await client.listOrganizations();
549
- if (outputJson) {
550
- console.log(JSON.stringify({ organizations }, null, 2));
551
- return;
552
- }
553
- if (organizations.length === 0) {
554
- console.log("no organizations found");
555
- return;
556
- }
557
- for (const organization of organizations) {
558
- console.log(formatOrganizationLine(organization));
559
- }
560
- return;
561
- }
562
- if (subcommand === "create") {
563
- const organization = await client.createOrganization(
564
- buildOrganizationCreateInput(options)
565
- );
566
- console.log(JSON.stringify({ organization }, null, 2));
567
- return;
568
- }
569
- if (subcommand === "get") {
570
- const slug = rest[1];
571
- if (!slug) {
572
- throw new Error("usage: organizations get <slug>");
573
- }
574
- const organization = await client.getOrganization(slug);
575
- console.log(JSON.stringify({ organization }, null, 2));
576
- return;
577
- }
578
- if (subcommand === "update") {
579
- const slug = rest[1];
580
- if (!slug) {
581
- throw new Error("usage: organizations update <slug> [--name <name>]");
582
- }
583
- const organization = await client.updateOrganization(
584
- slug,
585
- buildOrganizationUpdateInput(options)
586
- );
587
- console.log(JSON.stringify({ organization }, null, 2));
588
- return;
589
- }
590
- if (subcommand === "members" || subcommand === "member-list") {
591
- const slug = rest[1];
592
- if (!slug) {
593
- throw new Error("usage: organizations members <slug>");
594
- }
595
- const members = await client.listOrganizationMembers(slug);
596
- if (outputJson) {
597
- console.log(JSON.stringify({ members }, null, 2));
598
- return;
599
- }
600
- if (members.length === 0) {
601
- console.log("no organization members found");
602
- return;
603
- }
604
- for (const member of members) {
605
- console.log(formatOrganizationMemberLine(member));
606
- }
607
- return;
608
- }
609
- if (subcommand === "member-upsert" || subcommand === "member-add") {
610
- const slug = rest[1];
611
- if (!slug) {
612
- throw new Error(
613
- "usage: organizations member-upsert <slug> --email <email> --role <role>"
614
- );
615
- }
616
- const member = await client.upsertOrganizationMember(
617
- slug,
618
- buildOrganizationMemberInput(options)
619
- );
620
- console.log(JSON.stringify({ member }, null, 2));
621
- return;
622
- }
623
- if (subcommand === "mcp-get" || subcommand === "mcp-server") {
624
- const slug = rest[1];
625
- if (!slug) {
626
- throw new Error("usage: organizations mcp-get <slug>");
627
- }
628
- const mcpServer = await client.getOrganizationMcpServer(slug);
629
- if (outputJson) {
630
- console.log(JSON.stringify({ mcpServer }, null, 2));
631
- return;
632
- }
633
- console.log(formatOrganizationMcpServerLine(mcpServer));
634
- return;
635
- }
636
- if (subcommand === "mcp-generate") {
637
- const slug = rest[1];
638
- if (!slug) {
639
- throw new Error(
640
- "usage: organizations mcp-generate <slug> [--origin <url>]"
641
- );
642
- }
643
- const mcpServer = await client.generateOrganizationMcpServer(
644
- slug,
645
- buildOrganizationMcpGenerateInput(options)
646
- );
647
- console.log(JSON.stringify({ mcpServer }, null, 2));
648
- return;
649
- }
650
- if (subcommand === "mcp-probe" || subcommand === "mcp-inspect") {
651
- const slug = rest[1];
652
- if (!slug) {
653
- throw new Error(
654
- "usage: organizations mcp-probe <slug> [--origin <url>] [--tool <name>] [--arguments <json>] [--access-token <token>]"
655
- );
656
- }
657
- const mcpServer = await client.getOrganizationMcpServer(slug);
658
- const resourceUrl = resolveMcpProbeResourceUrl(mcpServer, options);
659
- const origin = resolveMcpProbeOrigin(resourceUrl, options);
660
- const toolName = typeof options.tool === "string" && options.tool.trim() ? options.tool.trim() : typeof options.toolName === "string" && options.toolName.trim() ? options.toolName.trim() : "estimate_search_history";
661
- const toolArguments = parseMcpToolArguments(options);
662
- const accessToken = typeof options.accessToken === "string" && options.accessToken.trim() ? options.accessToken.trim() : "";
663
- const probe = await probeOrganizationMcp({
664
- resourceUrl,
665
- origin,
666
- toolName,
667
- toolArguments,
668
- ...accessToken ? { accessToken } : {}
669
- });
670
- console.log(JSON.stringify({ mcpServer, probe }, null, 2));
671
- return;
672
- }
673
- if (subcommand === "mcp-authorize" || subcommand === "mcp-oauth") {
674
- const slug = rest[1];
675
- if (!slug) {
676
- throw new Error(
677
- "usage: organizations mcp-authorize <slug> [--origin <url>] [--scope <csv|space>] [--tool <name>] [--arguments <json>] [--open]"
678
- );
679
- }
680
- const mcpServer = await client.getOrganizationMcpServer(slug);
681
- const resourceUrl = resolveMcpProbeResourceUrl(mcpServer, options);
682
- const origin = resolveMcpProbeOrigin(resourceUrl, options);
683
- const clientId = resolveMcpOAuthClientId(options);
684
- const scopes = parseMcpOAuthScopes(options);
685
- const state = randomOauthToken(18);
686
- const codeVerifier = randomOauthToken(48);
687
- const codeChallenge = buildMcpOauthPkceChallenge(codeVerifier);
688
- const callback = await startMcpOAuthCallbackListener({
689
- expectedState: state,
690
- port: resolveMcpOAuthCallbackPort(options),
691
- timeoutMs: resolveMcpOAuthTimeoutMs(options)
692
- });
693
- const authorizationUrl = buildMcpOAuthAuthorizeUrl({
694
- authorizationEndpoint: `${origin}/oauth/authorize`,
695
- clientId,
696
- codeChallenge,
697
- redirectUri: callback.redirectUri,
698
- resourceUrl,
699
- scopes,
700
- state
701
- });
702
- console.error(
703
- "Open this URL to authorize the organization MCP connection:"
704
- );
705
- console.error(authorizationUrl);
706
- console.error(`Waiting for OAuth callback on ${callback.redirectUri}`);
707
- if (parseBooleanOption(options.open)) {
708
- try {
709
- openUrlWithSystemBrowser2(authorizationUrl);
710
- } catch (error) {
711
- console.error(
712
- `Unable to open a browser automatically: ${error instanceof Error ? error.message : String(error)}`
713
- );
714
- }
715
- }
716
- try {
717
- const callbackResult = await callback.waitForCallback();
718
- const token = await exchangeMcpOAuthAuthorizationCode({
719
- clientId,
720
- code: callbackResult.code,
721
- codeVerifier,
722
- origin,
723
- redirectUri: callback.redirectUri
724
- });
725
- const toolName = typeof options.tool === "string" && options.tool.trim() ? options.tool.trim() : typeof options.toolName === "string" && options.toolName.trim() ? options.toolName.trim() : "estimate_search_history";
726
- const toolArguments = parseMcpToolArguments(options);
727
- const probe = await probeOrganizationMcp({
728
- accessToken: token.access_token,
729
- origin,
730
- resourceUrl,
731
- toolArguments,
732
- toolName
733
- });
734
- const printToken = parseBooleanOption(options.printToken);
735
- console.log(
736
- JSON.stringify(
737
- {
738
- mcpServer,
739
- oauth: {
740
- accessTokenReceived: true,
741
- clientId,
742
- expiresIn: token.expires_in ?? null,
743
- refreshTokenReceived: Boolean(token.refresh_token),
744
- scope: token.scope ?? scopes.join(" "),
745
- tokenType: token.token_type ?? "Bearer",
746
- ...printToken ? {
747
- accessToken: token.access_token,
748
- refreshToken: token.refresh_token ?? null
749
- } : {}
750
- },
751
- probe
752
- },
753
- null,
754
- 2
755
- )
756
- );
757
- } finally {
758
- await callback.close();
759
- }
760
- return;
761
- }
762
- if (subcommand === "mcp-rotate" || subcommand === "mcp-disable" || subcommand === "mcp-enable") {
763
- const slug = rest[1];
764
- if (!slug) {
765
- throw new Error(`usage: organizations ${subcommand} <slug>`);
766
- }
767
- const mcpServer = subcommand === "mcp-rotate" ? await client.rotateOrganizationMcpServer(slug) : subcommand === "mcp-disable" ? await client.disableOrganizationMcpServer(slug) : await client.enableOrganizationMcpServer(slug);
768
- console.log(JSON.stringify({ mcpServer }, null, 2));
769
- return;
770
- }
771
- throw new Error(
772
- "usage: organizations <list|create|get|update|members|member-upsert|mcp-get|mcp-generate|mcp-probe|mcp-authorize|mcp-rotate|mcp-disable|mcp-enable> [args]"
773
- );
774
- }
775
- export {
776
- DEFAULT_MCP_AUTHORIZE_SCOPES,
777
- buildMcpJsonRpcRequest,
778
- buildMcpOAuthAuthorizeUrl,
779
- buildMcpOauthPkceChallenge,
780
- buildOrganizationCreateInput,
781
- buildOrganizationMcpGenerateInput,
782
- buildOrganizationMemberInput,
783
- buildOrganizationUpdateInput,
784
- closeServer,
785
- exchangeMcpOAuthAuthorizationCode,
786
- fetchMcpProbe,
787
- formatOrganizationLine,
788
- formatOrganizationMcpServerLine,
789
- formatOrganizationMemberLine,
790
- normalizeMcpResourceUrl,
791
- openUrlWithSystemBrowser2 as openUrlWithSystemBrowser,
792
- parseMcpOAuthScopes,
793
- parseMcpToolArguments,
794
- parseOrganizationRole,
795
- postMcpJsonRpcProbe,
796
- probeOrganizationMcp,
797
- randomOauthToken,
798
- readMcpProbeBody,
799
- resolveMcpOAuthCallbackPort,
800
- resolveMcpOAuthClientId,
801
- resolveMcpOAuthTimeoutMs,
802
- resolveMcpProbeOrigin,
803
- resolveMcpProbeResourceUrl,
804
- runOrganizationsCommand,
805
- startMcpOAuthCallbackListener
806
- };