openpond 0.0.38 → 0.0.39

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 (212) hide show
  1. package/README.md +3 -4
  2. package/dist/api/core.d.ts +6 -0
  3. package/dist/api/vercel-protection.d.ts +1 -0
  4. package/dist/chunks/{app-layer-DPUJRNO2.js → app-layer-LTBWNA2F.js} +32 -10
  5. package/dist/chunks/app-server-runtime-VYYJ2AWX.js +18 -0
  6. package/dist/chunks/{apps-AKBI6AS7.js → apps-CZAJBGE3.js} +6 -4
  7. package/dist/chunks/{chunk-LZZM3IHS.js → chunk-2SF6HLT7.js} +5899 -5939
  8. package/dist/chunks/{chunk-XCATKTK3.js → chunk-3CDPPVLE.js} +108 -66
  9. package/dist/chunks/{chunk-JWF37O5E.js → chunk-3HW6OSHP.js} +1 -3
  10. package/dist/chunks/{chunk-43YI36NA.js → chunk-3KLQ52B2.js} +228 -5
  11. package/dist/chunks/chunk-4HIWFIMN.js +37172 -0
  12. package/dist/chunks/{chunk-AHPQTEIJ.js → chunk-4N6E3OVF.js} +4 -4
  13. package/dist/chunks/{chunk-YTJL6XPU.js → chunk-6V7MJVRO.js} +56 -11
  14. package/dist/chunks/{chunk-QRM7XMAO.js → chunk-BQQZNGI6.js} +152 -161
  15. package/dist/chunks/chunk-DBHSOTYZ.js +1552 -0
  16. package/dist/chunks/{chunk-275WCETC.js → chunk-FCVVOMIP.js} +145 -5
  17. package/dist/chunks/{chunk-GB6VUZUA.js → chunk-JIEUB6OS.js} +1 -1
  18. package/dist/chunks/{chunk-HS2AGRDV.js → chunk-JJPAMKXZ.js} +1 -1
  19. package/dist/chunks/{chunk-GDZYDLEL.js → chunk-JRROTGQT.js} +1 -110
  20. package/dist/chunks/chunk-KHNHUA2H.js +1737 -0
  21. package/dist/chunks/{chunk-AHNFNWUN.js → chunk-L6XH4ZGZ.js} +1 -1
  22. package/dist/chunks/chunk-M2NXTLH2.js +4054 -0
  23. package/dist/chunks/{chunk-SLMP353Q.js → chunk-MIZHCABO.js} +2 -195
  24. package/dist/chunks/chunk-SMNFI2FU.js +113 -0
  25. package/dist/chunks/chunk-VCVQLECH.js +675 -0
  26. package/dist/chunks/{chunk-V35STJF4.js → chunk-ZJBJQCQZ.js} +179 -52
  27. package/dist/chunks/{cli-7BKDWFNU.js → cli-JS76LCW2.js} +9 -5
  28. package/dist/chunks/{core-commands-YN4RMWA3.js → core-commands-4MRJQZJV.js} +7 -5
  29. package/dist/chunks/{harness-BHQRMXJR.js → desktop-test-RNMWLOVU.js} +15 -14
  30. package/dist/chunks/{chunk-XERQHYBO.js → extension-GDRW22N3.js} +5868 -3580
  31. package/dist/chunks/{help-VREQNA4I.js → help-LWNREJ7U.js} +1 -1
  32. package/dist/chunks/{opchat-D63YTNSX.js → opchat-2K2JIGK3.js} +9 -10
  33. package/dist/chunks/{organizations-I46KG7TC.js → organizations-Z5HVD2E7.js} +11 -9
  34. package/dist/chunks/{profile-WKZJHEPG.js → profile-QNECVVGN.js} +12 -38
  35. package/dist/chunks/{project-agent-ZUC3YMCT.js → project-agent-W3V75WBR.js} +9 -411
  36. package/dist/chunks/{sandbox-command-AAOPFTI5.js → sandbox-command-X3FO74NX.js} +7 -5
  37. package/dist/chunks/{sandbox-template-GKNVR4C5.js → sandbox-template-5B4T4BGU.js} +8 -6
  38. package/dist/chunks/{src-RPW5TOPI.js → src-ESAILPUH.js} +32 -30
  39. package/dist/chunks/src-IC5RX4L6.js +63517 -0
  40. package/dist/chunks/{teams-bot-PSL3ZO6Z.js → teams-bot-NTQ6VFFL.js} +6 -4
  41. package/dist/chunks/training-BR5A7SPU.js +320 -0
  42. package/dist/chunks/{workspaces-BPXC2DHT.js → workspaces-XC3QBD2Y.js} +2 -2
  43. package/dist/cli.js +24 -12
  44. package/dist/config.d.ts +9 -3
  45. package/dist/index.js +1300 -1045
  46. package/dist/profile/local-profile-types.d.ts +16 -0
  47. package/dist/profile/local-profile.d.ts +50 -4
  48. package/dist/sandbox/client-handles.d.ts +33 -46
  49. package/dist/sandbox/client.d.ts +4 -26
  50. package/dist/sandbox/sandbox-instance-client.d.ts +5 -5
  51. package/dist/sandbox/types/client.d.ts +1 -2
  52. package/dist/sandbox/types/core.d.ts +0 -1
  53. package/dist/sandbox/types/org-project-agent.d.ts +3 -89
  54. package/dist/sandbox/types/record.d.ts +1 -2
  55. package/dist/sandbox/types/runtime-profiles.d.ts +2 -2
  56. package/dist/sandbox-template/manifest.d.ts +1 -1
  57. package/dist/skills/openpond-agent-authoring/SKILL.md +40 -0
  58. package/dist/skills/openpond-agent-authoring/references/action-and-chat-design.md +13 -0
  59. package/dist/skills/openpond-agent-authoring/references/integrations-and-setup.md +13 -0
  60. package/dist/skills/openpond-agent-authoring/references/profile-layout.md +29 -0
  61. package/dist/skills/openpond-agent-authoring/references/validation-and-repair.md +14 -0
  62. package/dist/skills/openpond-desktop-harness/SKILL.md +1 -1
  63. package/dist/skills/openpond-skill-authoring/SKILL.md +44 -0
  64. package/dist/skills/openpond-skill-authoring/references/copying-and-adaptation.md +16 -0
  65. package/dist/skills/openpond-skill-authoring/references/skill-package-layout.md +38 -0
  66. package/dist/skills/openpond-skill-authoring/references/validation-and-repair.md +24 -0
  67. package/dist/skills/openpond-skill-authoring/scripts/validate-skill.mjs +102 -0
  68. package/dist/skills/openpond-taskset-authoring/SKILL.md +64 -22
  69. package/dist/skills/openpond-taskset-authoring/artifact.json +39 -0
  70. package/dist/skills/openpond-taskset-authoring/references/graders-and-rewards.md +3 -0
  71. package/dist/skills/openpond-taskset-authoring/references/method-selection.md +1 -1
  72. package/dist/skills/openpond-taskset-authoring/references/privacy-and-provenance.md +2 -0
  73. package/dist/skills/openpond-taskset-authoring/references/task-design.md +32 -0
  74. package/dist/web/assets/{AppDialog-DrwJb_wG.js → AppDialog-Bua3f-6v.js} +1 -1
  75. package/dist/web/assets/{AppsView-DPagLMsc.js → AppsView-DrJkHeSO.js} +1 -1
  76. package/dist/web/assets/BrowserSidebar-Bf-4Vozm.js +1 -0
  77. package/dist/web/assets/CommandMenu-DDZlGQiB.js +1 -0
  78. package/dist/web/assets/CommunityView-BtcCrba7.js +1 -0
  79. package/dist/web/assets/ComposerCreateImproveStrip-DOe5Otg6.js +1 -0
  80. package/dist/web/assets/GetStartedView-CG4z0Dtw.js +1 -0
  81. package/dist/web/assets/GetStartedView-yVmnGZPw.css +1 -0
  82. package/dist/web/assets/LabModelVersionDetailPage-BEkmSKuv.js +1 -0
  83. package/dist/web/assets/LabSkillSidebar-BIotN_RB.js +1 -0
  84. package/dist/web/assets/LabsRoute-CfOe0Zt5.js +3 -0
  85. package/dist/web/assets/LabsRoute-CoSPO4HR.css +1 -0
  86. package/dist/web/assets/MainChatThread-C0-l1mHt.js +2 -0
  87. package/dist/web/assets/MainPane-Bky_Rqcx.css +1 -0
  88. package/dist/web/assets/MainPane-aOVlVyRK.js +6 -0
  89. package/dist/web/assets/MarkdownText-D7DT1k1k.js +9 -0
  90. package/dist/web/assets/Messages-CBIXruA9.js +9 -0
  91. package/dist/web/assets/NativeSkillSidebar-C4t69Y7B.js +1 -0
  92. package/dist/web/assets/NewProjectDialog-Bat65tYD.js +1 -0
  93. package/dist/web/assets/OutputsPage-C58n39Db.js +1 -0
  94. package/dist/web/assets/RightChatPanelStack-Bp7nZxQ0.js +1 -0
  95. package/dist/web/assets/ScheduledWorkPage-BXP0j_c_.js +1 -0
  96. package/dist/web/assets/SettingsView-CtWK_aQ0.css +1 -0
  97. package/dist/web/assets/SettingsView-DOOfhO9a.js +6 -0
  98. package/dist/web/assets/TeamChatView-Cgxm-pKA.css +1 -0
  99. package/dist/web/assets/TeamChatView-De2wdqyY.js +3 -0
  100. package/dist/web/assets/{TerminalOverlay-BKl0p8pa.js → TerminalOverlay-BsuCH3NX.js} +1 -1
  101. package/dist/web/assets/TrainingCreationPanel-D2OFWyQ-.js +1 -0
  102. package/dist/web/assets/TrainingDraftPanel-DBpulXTz.js +1 -0
  103. package/dist/web/assets/{UsageSettingsSection-zDAwzTGl.js → UsageSettingsSection-DzMLUXAO.js} +37 -37
  104. package/dist/web/assets/WorkspaceDiffPanel-B7yIhjNF.js +14 -0
  105. package/dist/web/assets/WorkspaceEnvironmentMenu-B6jXM9xG.js +32 -0
  106. package/dist/web/assets/WorkspaceGitDialogs-CQ0fl9Qk.js +1 -0
  107. package/dist/web/assets/{WorkspaceMonacoEditor-DPGcG8fy.js → WorkspaceMonacoEditor-C2ctzITz.js} +3 -3
  108. package/dist/web/assets/arrow-up-right-ecwcx3xt.js +1 -0
  109. package/dist/web/assets/chevron-up-DP8PPfWd.js +1 -0
  110. package/dist/web/assets/circle-alert-envg1D6O.js +1 -0
  111. package/dist/web/assets/cloud-upload-5MGPLnaA.js +1 -0
  112. package/dist/web/assets/{cssMode-CKN9CcfG.js → cssMode-CFifcEfw.js} +1 -1
  113. package/dist/web/assets/folder-open-Dq3ZjeEP.js +1 -0
  114. package/dist/web/assets/folder-plus-EiZ5wbv_.js +1 -0
  115. package/dist/web/assets/git-branch-w29jmQ-X.js +1 -0
  116. package/dist/web/assets/{git-commit-horizontal-Bxi8YPep.js → git-commit-horizontal-CGZM0PZo.js} +1 -1
  117. package/dist/web/assets/{htmlMode-CeUcNhBZ.js → htmlMode-Ct1P-_lf.js} +1 -1
  118. package/dist/web/assets/index-ByIQyiUl.js +178 -0
  119. package/dist/web/assets/index-D4uCeiep.js +1 -0
  120. package/dist/web/assets/index-D9jTe16Q.css +1 -0
  121. package/dist/web/assets/info-Cd2HkIeb.js +1 -0
  122. package/dist/web/assets/{jsonMode-97z0Yz9u.js → jsonMode-BAUNCNAX.js} +1 -1
  123. package/dist/web/assets/{lspLanguageFeatures-D4Tp-JmI.js → lspLanguageFeatures-fucFYI1A.js} +1 -1
  124. package/dist/web/assets/monaco.contribution-Ce4v5kei.js +2 -0
  125. package/dist/web/assets/monaco.contribution-DLLMi4cB.js +2 -0
  126. package/dist/web/assets/monaco.contribution-g9QiIm1d.js +2 -0
  127. package/dist/web/assets/monaco.contribution-nG-5Cyjz.js +2 -0
  128. package/dist/web/assets/monitor-DgHCnCKl.js +1 -0
  129. package/dist/web/assets/{play-C-37dnR1.js → play-Be0XDHBu.js} +1 -1
  130. package/dist/web/assets/{python-CGpDXY7_.js → python-CEhEiPo7.js} +1 -1
  131. package/dist/web/assets/{refresh-cw-BAaaPCXl.js → refresh-cw-DH0KLbdD.js} +1 -1
  132. package/dist/web/assets/reply-D1TK2yV8.js +1 -0
  133. package/dist/web/assets/{save-Cvxs3XyC.js → save-C1MSeBnQ.js} +1 -1
  134. package/dist/web/assets/square-CemI-0g5.js +1 -0
  135. package/dist/web/assets/square-pen-CqfsvR_n.js +1 -0
  136. package/dist/web/assets/{toggleHighContrast-CD42jH4g.js → toggleHighContrast-DrdQN3Rl.js} +1 -1
  137. package/dist/web/assets/training-BQVNUTZA.css +1 -0
  138. package/dist/web/assets/training-model-data-B7-1Bxil.js +1 -0
  139. package/dist/web/assets/{tsMode-ZROIxEjv.js → tsMode-CKB5oOUU.js} +1 -1
  140. package/dist/web/assets/{upload-DvCSGERK.js → upload-t751LLqP.js} +1 -1
  141. package/dist/web/assets/useLocalAgentSchedules-CzC3wfIP.js +1 -0
  142. package/dist/web/assets/{wifi-off-BIb94PkS.js → wifi-off-CxTHH3JU.js} +1 -1
  143. package/dist/web/assets/{workers-oYqbrVYG.js → workers-CqYddzCd.js} +1 -1
  144. package/dist/web/assets/{yaml-WqBjNgOO.js → yaml-e5wBkc-C.js} +1 -1
  145. package/dist/web/index.html +2 -2
  146. package/docs/command-reference.md +75 -40
  147. package/package.json +3 -1
  148. package/dist/chunks/chunk-FWLOFUPU.js +0 -864
  149. package/dist/chunks/chunk-HLCTINEP.js +0 -224
  150. package/dist/chunks/chunk-MPGSHXGF.js +0 -3896
  151. package/dist/chunks/chunk-T4QXKU5Y.js +0 -1
  152. package/dist/chunks/chunk-XEJ7XXUQ.js +0 -1301
  153. package/dist/chunks/chunk-ZI4GDAUB.js +0 -3522
  154. package/dist/chunks/cli-2KBVNDRY.js +0 -23
  155. package/dist/chunks/extend-REGNTBK3.js +0 -89
  156. package/dist/chunks/extension-7K77DAVL.js +0 -121
  157. package/dist/chunks/fileFromPath-DHCRY3BD.js +0 -2151
  158. package/dist/chunks/src-MWDIK56B.js +0 -105881
  159. package/dist/web/assets/BrowserSidebar-DMn2V8RV.js +0 -1
  160. package/dist/web/assets/CloudWorkView-Cl_7mM3c.js +0 -1
  161. package/dist/web/assets/CloudWorkView-DNoPIlMj.css +0 -1
  162. package/dist/web/assets/CommandMenu-CHMQLez_.js +0 -1
  163. package/dist/web/assets/CommunityView-DcHVDUk0.js +0 -1
  164. package/dist/web/assets/ComposerCreateImproveStrip-BZ3Dgzmo.js +0 -1
  165. package/dist/web/assets/GetStartedView-DBLdduwr.css +0 -1
  166. package/dist/web/assets/GetStartedView-DTRotFqz.js +0 -1
  167. package/dist/web/assets/LabSkillSidebar-D-PqFe1T.js +0 -1
  168. package/dist/web/assets/LabsRoute-BrJkBNig.css +0 -1
  169. package/dist/web/assets/LabsRoute-Dew1BwK5.js +0 -3
  170. package/dist/web/assets/MainChatThread-BaPxxzrw.js +0 -2
  171. package/dist/web/assets/MakeAgentTutorialLearningPanel-CBsfnONQ.js +0 -2
  172. package/dist/web/assets/MarkdownText-DGLfAM_Z.js +0 -7
  173. package/dist/web/assets/Messages-CIX9uTjX.js +0 -10
  174. package/dist/web/assets/NativeSkillSidebar-AP_uHn6g.js +0 -1
  175. package/dist/web/assets/NewProjectDialog-C6lHkafU.js +0 -1
  176. package/dist/web/assets/PostTrainingLearningPanel-CZEgPc8O.js +0 -2
  177. package/dist/web/assets/PostTrainingStatusPill-CeEpwUDB.js +0 -1
  178. package/dist/web/assets/ProfileSettingsSection-Cg4tKO-C.css +0 -1
  179. package/dist/web/assets/ProfileSettingsSection-EumMLlEp.js +0 -1
  180. package/dist/web/assets/RightChatPanelStack-MXBcx3zO.js +0 -1
  181. package/dist/web/assets/SettingsView-Caljbns2.css +0 -1
  182. package/dist/web/assets/SettingsView-DyURG_Uh.js +0 -6
  183. package/dist/web/assets/TeamChatView-Bx44q3WV.css +0 -1
  184. package/dist/web/assets/TeamChatView-D3v6aqJ3.js +0 -3
  185. package/dist/web/assets/TrainingCreationPanel-CfZQTuT5.js +0 -1
  186. package/dist/web/assets/TrainingDraftPanel-DslRPSDW.js +0 -1
  187. package/dist/web/assets/WorkspaceDiffPanel-C_MZPPlL.js +0 -14
  188. package/dist/web/assets/WorkspaceEnvironmentMenu-BUAnn80j.js +0 -32
  189. package/dist/web/assets/WorkspaceGitDialogs-Drbf4ujA.js +0 -1
  190. package/dist/web/assets/activity-Dnr3jqb3.js +0 -1
  191. package/dist/web/assets/boxes-BinC8UPn.js +0 -1
  192. package/dist/web/assets/chevron-up-Bjp_-_Cb.js +0 -1
  193. package/dist/web/assets/circle-x-ubnvEYuE.js +0 -1
  194. package/dist/web/assets/copy-B_ZCCUMz.js +0 -1
  195. package/dist/web/assets/create-pipeline-request-D6uLUxe9.js +0 -4
  196. package/dist/web/assets/file-8HAMlTmQ.js +0 -1
  197. package/dist/web/assets/git-branch-l2Zih3Bv.js +0 -1
  198. package/dist/web/assets/index-BMFyOFRU.css +0 -1
  199. package/dist/web/assets/index-BzwcDzbT.js +0 -1
  200. package/dist/web/assets/index-KoQSSt_f.js +0 -177
  201. package/dist/web/assets/info-JTbDQxHx.js +0 -1
  202. package/dist/web/assets/make-agent-tutorial-D6nBCgv-.js +0 -2
  203. package/dist/web/assets/monaco.contribution-B3j6oown.js +0 -2
  204. package/dist/web/assets/monaco.contribution-BXHxPPWL.js +0 -2
  205. package/dist/web/assets/monaco.contribution-C2P5zIzh.js +0 -2
  206. package/dist/web/assets/monaco.contribution-C8c6OtGi.js +0 -2
  207. package/dist/web/assets/monitor-kzHtxHnA.js +0 -1
  208. package/dist/web/assets/reply-9rehU13k.js +0 -1
  209. package/dist/web/assets/rotate-cw-C1Z_Xs23.js +0 -1
  210. package/dist/web/assets/training-BN8CALIc.css +0 -1
  211. package/dist/web/assets/training-model-data-BXUCzS0p.js +0 -1
  212. package/docs/agent-edit-check-status-json.md +0 -132
package/dist/index.js CHANGED
@@ -5,6 +5,24 @@ var __export = (target, all) => {
5
5
  __defProp(target, name, { get: all[name], enumerable: true });
6
6
  };
7
7
 
8
+ // ../../packages/cloud/src/api/vercel-protection.ts
9
+ var VERCEL_PROTECTION_BYPASS_HEADER = "x-vercel-protection-bypass";
10
+ function withVercelProtectionBypass(requestUrl, inputHeaders, env = typeof process === "undefined" ? {} : process.env) {
11
+ const headers = new Headers(inputHeaders);
12
+ const secret = env.VERCEL_AUTOMATION_BYPASS_SECRET?.trim();
13
+ if (!secret || !isOpenPondStagingUrl(requestUrl)) return headers;
14
+ headers.set(VERCEL_PROTECTION_BYPASS_HEADER, secret);
15
+ return headers;
16
+ }
17
+ function isOpenPondStagingUrl(requestUrl) {
18
+ try {
19
+ const hostname3 = new URL(requestUrl).hostname.toLowerCase();
20
+ return hostname3 === "staging.openpond.ai" || hostname3 === "staging-api.openpond.ai" || hostname3.endsWith(".staging-api.openpond.ai");
21
+ } catch {
22
+ return false;
23
+ }
24
+ }
25
+
8
26
  // ../../packages/cloud/src/api/core.ts
9
27
  var DEFAULT_API_TIMEOUT_MS = 3e4;
10
28
  var DEFAULT_API_RESPONSE_BYTES = 8 * 1024 * 1024;
@@ -31,9 +49,23 @@ var ApiResponseTooLargeError = class extends Error {
31
49
  requestUrl;
32
50
  code = "OPENPOND_API_RESPONSE_TOO_LARGE";
33
51
  };
52
+ var OpenPondApiError = class extends Error {
53
+ constructor(status, errorCode, label, apiMessage = null) {
54
+ const detail = apiMessage || errorCode;
55
+ super(`${label} failed: ${status}${detail ? ` ${detail}` : ""}`);
56
+ this.status = status;
57
+ this.apiMessage = apiMessage;
58
+ this.name = "OpenPondApiError";
59
+ this.code = errorCode || "OPENPOND_API_ERROR";
60
+ }
61
+ status;
62
+ apiMessage;
63
+ code;
64
+ };
34
65
  async function apiFetch(baseUrl, token, requestPath, options = {}) {
35
66
  const { timeoutMs = DEFAULT_API_TIMEOUT_MS, maxResponseBytes = DEFAULT_API_RESPONSE_BYTES, ...init } = options;
36
- const headers = new Headers(init.headers || {});
67
+ const requestUrl = `${baseUrl}${requestPath}`;
68
+ const headers = withVercelProtectionBypass(requestUrl, init.headers);
37
69
  headers.set("Content-Type", "application/json");
38
70
  const apiKey = process.env.OPENPOND_API_KEY;
39
71
  const trimmedToken = token?.trim() || "";
@@ -45,7 +77,6 @@ async function apiFetch(baseUrl, token, requestPath, options = {}) {
45
77
  } else if (apiKey && !headers.has("Authorization")) {
46
78
  headers.set("Authorization", `ApiKey ${apiKey}`);
47
79
  }
48
- const requestUrl = `${baseUrl}${requestPath}`;
49
80
  const timeoutController = new AbortController();
50
81
  const timeoutError = new ApiTimeoutError(timeoutMs, requestUrl);
51
82
  const timer = timeoutMs > 0 ? setTimeout(() => timeoutController.abort(timeoutError), timeoutMs) : null;
@@ -79,8 +110,9 @@ async function readApiJson(response, label) {
79
110
  payload = {};
80
111
  }
81
112
  if (!response.ok) {
82
- const message = typeof payload.message === "string" ? payload.message : typeof payload.error === "string" ? payload.error : "";
83
- throw new Error(`${label} failed: ${response.status}${message ? ` ${message}` : ""}`);
113
+ const errorCode = typeof payload.error === "string" ? payload.error : null;
114
+ const apiMessage = typeof payload.message === "string" ? payload.message : null;
115
+ throw new OpenPondApiError(response.status, errorCode, label, apiMessage);
84
116
  }
85
117
  return payload;
86
118
  }
@@ -706,7 +738,7 @@ async function getAppRuntimeSummary(baseUrl, token, appId) {
706
738
  return await response.json();
707
739
  }
708
740
  async function getOpenPondAccount(baseUrl, token) {
709
- const response = await apiFetch(baseUrl, token, "/account", {
741
+ const response = await apiFetch(baseUrl, token, "/v1/account", {
710
742
  method: "GET"
711
743
  });
712
744
  if (!response.ok) {
@@ -720,7 +752,7 @@ async function checkOpenPondApiHealth(baseUrl, token) {
720
752
  const started = Date.now();
721
753
  const normalizedBase = baseUrl.replace(/\/$/, "");
722
754
  try {
723
- const response = await fetch(`${normalizedBase}/health`, {
755
+ const response = await apiFetch(normalizedBase, null, "/health", {
724
756
  method: "GET",
725
757
  headers: { Accept: "application/json" }
726
758
  });
@@ -1238,14 +1270,14 @@ function requireToken(value) {
1238
1270
  if (!trimmed) throw new Error("OpenPond API key is required");
1239
1271
  return trimmed;
1240
1272
  }
1241
- function hostedHeaders(token, accept, requestId) {
1273
+ function hostedHeaders(requestUrl, token, accept, requestId) {
1242
1274
  const headers = new Headers();
1243
1275
  headers.set("Authorization", `Bearer ${requireToken(token)}`);
1244
1276
  headers.set("Content-Type", "application/json");
1245
1277
  headers.set("Accept", accept);
1246
1278
  headers.set("x-openpond-client", "openpond-code");
1247
1279
  headers.set("x-openpond-request-id", requestId || randomUUID2());
1248
- return headers;
1280
+ return withVercelProtectionBypass(requestUrl, headers);
1249
1281
  }
1250
1282
  async function readError(response) {
1251
1283
  const text5 = await response.text().catch(() => "");
@@ -1287,9 +1319,10 @@ function buildHostedChatBody(options, stream) {
1287
1319
  }
1288
1320
  async function listOpChatModels(options) {
1289
1321
  const apiBaseUrl = normalizeApiBaseUrl(options.apiBaseUrl);
1290
- const response = await fetch(`${apiBaseUrl}/models`, {
1322
+ const requestUrl = `${apiBaseUrl}/models`;
1323
+ const response = await fetch(requestUrl, {
1291
1324
  method: "GET",
1292
- headers: hostedHeaders(options.token, "application/json"),
1325
+ headers: hostedHeaders(requestUrl, options.token, "application/json"),
1293
1326
  signal: options.signal
1294
1327
  });
1295
1328
  if (!response.ok) {
@@ -1303,11 +1336,12 @@ async function listOpChatModels(options) {
1303
1336
  }
1304
1337
  async function getOpChatModel(options) {
1305
1338
  const apiBaseUrl = normalizeApiBaseUrl(options.apiBaseUrl);
1339
+ const requestUrl = `${apiBaseUrl}/models/${encodeURIComponent(options.model)}`;
1306
1340
  const response = await fetch(
1307
- `${apiBaseUrl}/models/${encodeURIComponent(options.model)}`,
1341
+ requestUrl,
1308
1342
  {
1309
1343
  method: "GET",
1310
- headers: hostedHeaders(options.token, "application/json"),
1344
+ headers: hostedHeaders(requestUrl, options.token, "application/json"),
1311
1345
  signal: options.signal
1312
1346
  }
1313
1347
  );
@@ -1323,9 +1357,10 @@ async function getOpChatModel(options) {
1323
1357
  var listHostedModels = listOpChatModels;
1324
1358
  async function listOpChatProviders(options) {
1325
1359
  const apiBaseUrl = normalizeApiBaseUrl(options.apiBaseUrl);
1326
- const response = await fetch(`${apiBaseUrl}/providers`, {
1360
+ const requestUrl = `${apiBaseUrl}/providers`;
1361
+ const response = await fetch(requestUrl, {
1327
1362
  method: "GET",
1328
- headers: hostedHeaders(options.token, "application/json"),
1363
+ headers: hostedHeaders(requestUrl, options.token, "application/json"),
1329
1364
  signal: options.signal
1330
1365
  });
1331
1366
  if (!response.ok) {
@@ -1339,11 +1374,12 @@ async function listOpChatProviders(options) {
1339
1374
  }
1340
1375
  async function getOpChatProvider(options) {
1341
1376
  const apiBaseUrl = normalizeApiBaseUrl(options.apiBaseUrl);
1377
+ const requestUrl = `${apiBaseUrl}/providers/${encodeURIComponent(options.provider)}`;
1342
1378
  const response = await fetch(
1343
- `${apiBaseUrl}/providers/${encodeURIComponent(options.provider)}`,
1379
+ requestUrl,
1344
1380
  {
1345
1381
  method: "GET",
1346
- headers: hostedHeaders(options.token, "application/json"),
1382
+ headers: hostedHeaders(requestUrl, options.token, "application/json"),
1347
1383
  signal: options.signal
1348
1384
  }
1349
1385
  );
@@ -1359,9 +1395,11 @@ async function getOpChatProvider(options) {
1359
1395
  var listHostedProviders = listOpChatProviders;
1360
1396
  async function sendHostedChatTurn(options) {
1361
1397
  const apiBaseUrl = normalizeApiBaseUrl(options.apiBaseUrl);
1362
- const response = await fetch(`${apiBaseUrl}/chat/completions`, {
1398
+ const requestUrl = `${apiBaseUrl}/chat/completions`;
1399
+ const response = await fetch(requestUrl, {
1363
1400
  method: "POST",
1364
1401
  headers: hostedHeaders(
1402
+ requestUrl,
1365
1403
  options.token,
1366
1404
  "application/json",
1367
1405
  options.requestId
@@ -1407,9 +1445,11 @@ async function* parseOpenAISSE(stream, signal) {
1407
1445
  }
1408
1446
  async function* streamHostedChatTurn(options) {
1409
1447
  const apiBaseUrl = normalizeApiBaseUrl(options.apiBaseUrl);
1410
- const response = await fetch(`${apiBaseUrl}/chat/completions`, {
1448
+ const requestUrl = `${apiBaseUrl}/chat/completions`;
1449
+ const response = await fetch(requestUrl, {
1411
1450
  method: "POST",
1412
1451
  headers: hostedHeaders(
1452
+ requestUrl,
1413
1453
  options.token,
1414
1454
  "text/event-stream",
1415
1455
  options.requestId
@@ -2033,6 +2073,24 @@ function sanitizeLocalOpenPondProfile(value) {
2033
2073
  };
2034
2074
  }
2035
2075
  }
2076
+ if (Array.isArray(input.profiles)) {
2077
+ const profiles = input.profiles.flatMap((value2) => {
2078
+ const entry = sanitizeLocalOpenPondProfile(value2);
2079
+ if (!entry) return [];
2080
+ const rawEntry = value2;
2081
+ const source = rawEntry.source === "github" || rawEntry.source === "openpond_git" ? rawEntry.source : "local";
2082
+ const repositoryId = typeof rawEntry.repositoryId === "string" && rawEntry.repositoryId.trim() ? rawEntry.repositoryId.trim() : path3.resolve(entry.repoPath);
2083
+ return [{
2084
+ source,
2085
+ repositoryId,
2086
+ repoPath: entry.repoPath,
2087
+ profile: entry.profile,
2088
+ ...entry.lastCheck ? { lastCheck: entry.lastCheck } : {},
2089
+ ...entry.lastPush ? { lastPush: entry.lastPush } : {}
2090
+ }];
2091
+ });
2092
+ if (profiles.length > 0) out.profiles = profiles;
2093
+ }
2036
2094
  return out;
2037
2095
  }
2038
2096
  function sanitizeHostedMaterializationStatus(value) {
@@ -2070,7 +2128,6 @@ function sanitizeHostedSourceCheckStatus(value) {
2070
2128
  return {
2071
2129
  status,
2072
2130
  ...nullableStringProp(input, "agentId"),
2073
- ...nullableStringProp(input, "workItemId"),
2074
2131
  ...nullableStringProp(input, "deployPlanStatus"),
2075
2132
  ...nullableBooleanProp(input, "canRun"),
2076
2133
  ...nullableBooleanProp(input, "canDeploy"),
@@ -2241,9 +2298,6 @@ function extractLegacyAccount(raw, handle) {
2241
2298
  }
2242
2299
  function normalizeGlobalConfig(raw) {
2243
2300
  const normalized = {};
2244
- if (raw.goalStorageLocation === "global" || raw.goalStorageLocation === "workspace") {
2245
- normalized.goalStorageLocation = raw.goalStorageLocation;
2246
- }
2247
2301
  if (typeof raw.lspEnabled === "boolean")
2248
2302
  normalized.lspEnabled = raw.lspEnabled;
2249
2303
  if (raw.executionMode === "local" || raw.executionMode === "hosted") {
@@ -2410,13 +2464,6 @@ function applyAccountPatch(global, source, options) {
2410
2464
  return true;
2411
2465
  }
2412
2466
  function applyTopLevelPatch(global, source) {
2413
- if (hasOwn(source, "goalStorageLocation")) {
2414
- if (source.goalStorageLocation === "global" || source.goalStorageLocation === "workspace") {
2415
- global.goalStorageLocation = source.goalStorageLocation;
2416
- } else if (source.goalStorageLocation === null) {
2417
- delete global.goalStorageLocation;
2418
- }
2419
- }
2420
2467
  if (hasOwn(source, "lspEnabled")) {
2421
2468
  if (typeof source.lspEnabled === "boolean") {
2422
2469
  global.lspEnabled = source.lspEnabled;
@@ -3090,10 +3137,13 @@ function createClient(options) {
3090
3137
 
3091
3138
  // ../../packages/cloud/src/sandbox/types/runtime-profiles.ts
3092
3139
  var SANDBOX_RUNTIME_PROFILE_IDS = [
3093
- "openpond-coding-core-v1"
3140
+ "openpond-generic-v1",
3141
+ "openpond-work-v1",
3142
+ "openpond-coding-core-v1",
3143
+ "openpond-agent-harness-v1"
3094
3144
  ];
3095
3145
 
3096
- // ../../packages/cloud/src/sandbox/client-handles.ts
3146
+ // ../../packages/cloud/dist/sandbox/client-handles.js
3097
3147
  function createSandboxRuntimeNamespace(client) {
3098
3148
  return {
3099
3149
  list: (input = {}) => client.listSandboxRuntimes(input),
@@ -3152,24 +3202,11 @@ function createSandboxAgentNamespace(client) {
3152
3202
  sourceDeployPlan: (agentId, input) => client.getAgentSourceDeployPlan(agentId, input),
3153
3203
  manifestSnapshots: (agentId, input) => client.listAgentManifestSnapshots(agentId, input),
3154
3204
  requestSourceChecks: (agentId, input) => client.requestAgentSourceChecks(agentId, input),
3155
- publishSource: (agentId, input) => client.publishAgentSource(agentId, input),
3156
- openEditWorkItem: (agentId, input) => client.openAgentEditWorkItem(agentId, input)
3157
- };
3158
- }
3159
- function createSandboxWorkItemNamespace(client) {
3160
- return {
3161
- get: (workItemId, input) => client.getCodingWorkItem(workItemId, input),
3162
- chat: (workItemId, input) => client.sendCodingWorkItemChat(workItemId, input),
3163
- activity: (workItemId, input) => client.listCodingWorkItemActivity(workItemId, input),
3164
- status: (workItemId, input) => client.getCodingWorkItemStatus(workItemId, input),
3165
- handleBackground: (workItemId, input) => client.handleCodingWorkItemInBackground(workItemId, input),
3166
- promoteCheckpoint: (workItemId, input) => client.promoteCodingWorkItemResult(workItemId, "checkpoint", input),
3167
- promoteCommit: (workItemId, input) => client.promoteCodingWorkItemResult(workItemId, "commit", input),
3168
- promotePullRequest: (workItemId, input) => client.promoteCodingWorkItemResult(workItemId, "pr", input)
3205
+ publishSource: (agentId, input) => client.publishAgentSource(agentId, input)
3169
3206
  };
3170
3207
  }
3171
3208
 
3172
- // ../../packages/cloud/src/sandbox/runtime-handle.ts
3209
+ // ../../packages/cloud/dist/sandbox/runtime-handle.js
3173
3210
  function createSandboxRuntimeHandle(client, runtimeId, initial = null) {
3174
3211
  const currentSandbox = async (input = {}, options = {}) => {
3175
3212
  const runtime = await client.getSandboxRuntime(runtimeId);
@@ -3222,7 +3259,8 @@ function createSandboxRuntimeHandle(client, runtimeId, initial = null) {
3222
3259
  }
3223
3260
  });
3224
3261
  const current = await client.getSandboxRuntime(runtimeId);
3225
- if (current.status === "waiting_for_user") return current;
3262
+ if (current.status === "waiting_for_user")
3263
+ return current;
3226
3264
  return client.updateSandboxRuntimeStatus(runtimeId, {
3227
3265
  status: "waiting_for_user",
3228
3266
  expectedVersion: current.version,
@@ -3289,16 +3327,10 @@ function createSandboxRuntimeHandle(client, runtimeId, initial = null) {
3289
3327
  move: async (input) => client.moveFile((await resume()).id, input)
3290
3328
  },
3291
3329
  commands: {
3292
- run: async (command) => client.exec(
3293
- (await resume()).id,
3294
- typeof command === "string" ? { command } : command
3295
- )
3330
+ run: async (command) => client.exec((await resume()).id, typeof command === "string" ? { command } : command)
3296
3331
  },
3297
3332
  ports: {
3298
- expose: async (port) => client.openPort(
3299
- (await resume()).id,
3300
- typeof port === "number" ? { port } : port
3301
- )
3333
+ expose: async (port) => client.openPort((await resume()).id, typeof port === "number" ? { port } : port)
3302
3334
  },
3303
3335
  promote: (input, options = {}) => client.promoteSandboxRuntime(runtimeId, input, options),
3304
3336
  preserveSource: (input = {}, options = {}) => client.preserveSandboxRuntimeSource(runtimeId, input, options),
@@ -3322,7 +3354,7 @@ function runtimeKeepaliveUntilIso(input) {
3322
3354
  return new Date(Date.now() + seconds * 1e3).toISOString();
3323
3355
  }
3324
3356
 
3325
- // ../../packages/cloud/src/sandbox/smoke.ts
3357
+ // ../../packages/cloud/dist/sandbox/smoke.js
3326
3358
  async function runSandboxSmoke(client, options = {}) {
3327
3359
  const runId = `openpond-code-smoke-${Date.now()}`;
3328
3360
  const expectedExec = `openpond-code-exec-ok:${runId}`;
@@ -3334,43 +3366,29 @@ async function runSandboxSmoke(client, options = {}) {
3334
3366
  let deleted = false;
3335
3367
  let forkDeleted = false;
3336
3368
  try {
3337
- const sandbox = await waitForCreateReady(
3338
- client,
3339
- await client.create(
3340
- {
3341
- repo: options.repo ?? "https://github.com/octocat/Hello-World",
3342
- resources: {
3343
- cpu: options.cpu ?? 1,
3344
- memoryGb: options.memoryGb ?? 1,
3345
- diskGb: options.diskGb ?? 8
3346
- },
3347
- budget: { maxUsd: options.budgetUsd ?? "0.05" },
3348
- quotas: {
3349
- maxSpendUsd: options.budgetUsd ?? "0.05",
3350
- maxDurationSeconds: 600,
3351
- idleTimeoutSeconds: 600,
3352
- maxOpenPorts: 2
3353
- },
3354
- metadata: {
3355
- runId,
3356
- source: "openpond-code-sandbox-smoke"
3357
- }
3358
- },
3359
- { async: true }
3360
- )
3361
- );
3369
+ const sandbox = await waitForCreateReady(client, await client.create({
3370
+ repo: options.repo ?? "https://github.com/octocat/Hello-World",
3371
+ resources: {
3372
+ cpu: options.cpu ?? 1,
3373
+ memoryGb: options.memoryGb ?? 1,
3374
+ diskGb: options.diskGb ?? 8
3375
+ },
3376
+ budget: { maxUsd: options.budgetUsd ?? "0.05" },
3377
+ quotas: {
3378
+ maxSpendUsd: options.budgetUsd ?? "0.05",
3379
+ maxDurationSeconds: 600,
3380
+ idleTimeoutSeconds: 600,
3381
+ maxOpenPorts: 2
3382
+ },
3383
+ metadata: {
3384
+ runId,
3385
+ source: "openpond-code-sandbox-smoke"
3386
+ }
3387
+ }, { async: true }));
3362
3388
  sandboxId = sandbox.id;
3363
- const expectedRuntimeDriver = options.expectedRuntimeDriver ?? "remote-firecracker";
3364
- if (sandbox.runtimeDriver !== expectedRuntimeDriver) {
3365
- throw new Error(
3366
- `expected ${expectedRuntimeDriver}, got ${sandbox.runtimeDriver}`
3367
- );
3368
- }
3369
3389
  const expectedMppMode = options.expectedMppMode;
3370
3390
  if (expectedMppMode && sandbox.reservation.mpp?.mode !== expectedMppMode) {
3371
- throw new Error(
3372
- `expected ${expectedMppMode} reservation, got ${sandbox.reservation.mpp?.mode ?? "none"}`
3373
- );
3391
+ throw new Error(`expected ${expectedMppMode} reservation, got ${sandbox.reservation.mpp?.mode ?? "none"}`);
3374
3392
  }
3375
3393
  if (!expectedMppMode && !sandbox.reservation.mpp?.mode) {
3376
3394
  throw new Error("expected sandbox reservation MPP metadata");
@@ -3393,15 +3411,8 @@ async function runSandboxSmoke(client, options = {}) {
3393
3411
  if (!exec.command.output.includes(expectedExec)) {
3394
3412
  throw new Error("expected exec marker");
3395
3413
  }
3396
- await client.uploadFile(
3397
- sandbox.id,
3398
- "openpond-code-smoke.txt",
3399
- expectedFile
3400
- );
3401
- const downloaded = await client.downloadFile(
3402
- sandbox.id,
3403
- "openpond-code-smoke.txt"
3404
- );
3414
+ await client.uploadFile(sandbox.id, "openpond-code-smoke.txt", expectedFile);
3415
+ const downloaded = await client.downloadFile(sandbox.id, "openpond-code-smoke.txt");
3405
3416
  if (downloaded !== expectedFile) {
3406
3417
  throw new Error("expected file roundtrip marker");
3407
3418
  }
@@ -3437,11 +3448,7 @@ async function runSandboxSmoke(client, options = {}) {
3437
3448
  }
3438
3449
  }
3439
3450
  });
3440
- const snapshot = snapshotResponse.snapshot ?? (await waitForSnapshotReady(
3441
- client,
3442
- sandbox.id,
3443
- snapshotResponse.snapshotJob?.snapshotId
3444
- )).snapshot;
3451
+ const snapshot = snapshotResponse.snapshot ?? (await waitForSnapshotReady(client, sandbox.id, snapshotResponse.snapshotJob?.snapshotId)).snapshot;
3445
3452
  snapshotId = snapshot.id;
3446
3453
  if (snapshot.state !== "ready") {
3447
3454
  throw new Error(`expected ready snapshot, got ${snapshot.state}`);
@@ -3451,29 +3458,20 @@ async function runSandboxSmoke(client, options = {}) {
3451
3458
  if (!snapshotId) {
3452
3459
  throw new Error("expected snapshot id before fork");
3453
3460
  }
3454
- const forked = await waitForCreateReady(
3455
- client,
3456
- (await client.forkSnapshot(
3457
- snapshotId,
3458
- {
3459
- budget: { maxUsd: options.budgetUsd ?? "0.05" },
3460
- metadata: {
3461
- source: "openpond-code-sandbox-smoke-fork",
3462
- templateSnapshotId: snapshotId
3463
- }
3464
- },
3465
- { async: true }
3466
- )).sandbox
3467
- );
3461
+ const forked = await waitForCreateReady(client, (await client.forkSnapshot(snapshotId, {
3462
+ budget: { maxUsd: options.budgetUsd ?? "0.05" },
3463
+ metadata: {
3464
+ source: "openpond-code-sandbox-smoke-fork",
3465
+ templateSnapshotId: snapshotId
3466
+ }
3467
+ }, { async: true })).sandbox);
3468
3468
  forkSandboxId = forked.id;
3469
3469
  const forkExec = await client.exec(forked.id, {
3470
3470
  command: "cat openpond-code-smoke.txt",
3471
3471
  timeoutSeconds: 120
3472
3472
  });
3473
3473
  if (forkExec.command.status !== "succeeded") {
3474
- throw new Error(
3475
- `expected fork command success, got ${forkExec.command.status}`
3476
- );
3474
+ throw new Error(`expected fork command success, got ${forkExec.command.status}`);
3477
3475
  }
3478
3476
  if (!forkExec.command.output.includes(expectedFile)) {
3479
3477
  throw new Error("expected fork snapshot marker");
@@ -3499,10 +3497,7 @@ async function runSandboxSmoke(client, options = {}) {
3499
3497
  throw new Error("expected preview marker");
3500
3498
  }
3501
3499
  }
3502
- const { sandbox: readback, receipts } = await stopSandboxForSmoke(
3503
- client,
3504
- sandbox.id
3505
- );
3500
+ const { sandbox: readback, receipts } = await stopSandboxForSmoke(client, sandbox.id);
3506
3501
  if (!options.keep) {
3507
3502
  await deleteSandboxForSmoke(client, sandbox.id);
3508
3503
  deleted = true;
@@ -3535,12 +3530,7 @@ async function stopSandboxForSmoke(client, sandboxId) {
3535
3530
  } catch {
3536
3531
  await client.stop(sandboxId, { async: true });
3537
3532
  }
3538
- const sandbox = await waitForSandboxState(
3539
- client,
3540
- sandboxId,
3541
- /* @__PURE__ */ new Set(["stopped", "deleted"]),
3542
- "stop"
3543
- );
3533
+ const sandbox = await waitForSandboxState(client, sandboxId, /* @__PURE__ */ new Set(["stopped", "deleted"]), "stop");
3544
3534
  const receipts = await waitForReceipts(client, sandboxId);
3545
3535
  if (receipts.length === 0) {
3546
3536
  throw new Error("expected receipt readback");
@@ -3557,12 +3547,7 @@ async function deleteSandboxForSmoke(client, sandboxId) {
3557
3547
  } catch {
3558
3548
  await client.delete(sandboxId, { async: true });
3559
3549
  }
3560
- return waitForSandboxState(
3561
- client,
3562
- sandboxId,
3563
- /* @__PURE__ */ new Set(["deleted"]),
3564
- "delete"
3565
- );
3550
+ return waitForSandboxState(client, sandboxId, /* @__PURE__ */ new Set(["deleted"]), "delete");
3566
3551
  }
3567
3552
  async function cleanupSandboxBestEffort(client, sandboxId) {
3568
3553
  try {
@@ -3586,11 +3571,7 @@ async function waitForSandboxState(client, sandboxId, targetStates, operation) {
3586
3571
  await sleep(pollMs);
3587
3572
  latest = await client.get(sandboxId);
3588
3573
  }
3589
- throw new Error(
3590
- `sandbox ${operation} did not reach ${[...targetStates].join(
3591
- "/"
3592
- )} before timeout: ${sandboxId} (${latest.state})`
3593
- );
3574
+ throw new Error(`sandbox ${operation} did not reach ${[...targetStates].join("/")} before timeout: ${sandboxId} (${latest.state})`);
3594
3575
  }
3595
3576
  async function waitForReceipts(client, sandboxId) {
3596
3577
  const timeoutMs = 2 * 6e4;
@@ -3611,10 +3592,8 @@ async function waitForCreateReady(client, sandbox) {
3611
3592
  return sandbox;
3612
3593
  }
3613
3594
  if (sandbox.state === "error") {
3614
- throw new Error(
3615
- `sandbox create failed: ${sandbox.id}
3616
- ${sandbox.logs.join("\n")}`
3617
- );
3595
+ throw new Error(`sandbox create failed: ${sandbox.id}
3596
+ ${sandbox.logs.join("\n")}`);
3618
3597
  }
3619
3598
  const timeoutMs = 12 * 6e4;
3620
3599
  const pollMs = 3e3;
@@ -3627,15 +3606,11 @@ ${sandbox.logs.join("\n")}`
3627
3606
  return latest;
3628
3607
  }
3629
3608
  if (latest.state === "error") {
3630
- throw new Error(
3631
- `sandbox create failed: ${latest.id}
3632
- ${latest.logs.join("\n")}`
3633
- );
3609
+ throw new Error(`sandbox create failed: ${latest.id}
3610
+ ${latest.logs.join("\n")}`);
3634
3611
  }
3635
3612
  }
3636
- throw new Error(
3637
- `sandbox create did not reach running state before timeout: ${latest.id} (${latest.state})`
3638
- );
3613
+ throw new Error(`sandbox create did not reach running state before timeout: ${latest.id} (${latest.state})`);
3639
3614
  }
3640
3615
  async function waitForSnapshotReady(client, sandboxId, snapshotId) {
3641
3616
  if (!snapshotId) {
@@ -3650,36 +3625,199 @@ async function waitForSnapshotReady(client, sandboxId, snapshotId) {
3650
3625
  if (snapshot?.state === "ready") {
3651
3626
  return { sandbox: latest, snapshot };
3652
3627
  }
3653
- const job = latest.snapshotJobs?.find(
3654
- (item) => item.snapshotId === snapshotId
3655
- );
3628
+ const job = latest.snapshotJobs?.find((item) => item.snapshotId === snapshotId);
3656
3629
  if (job?.status === "failed") {
3657
3630
  throw new Error(`snapshot job failed: ${job.error ?? snapshotId}`);
3658
3631
  }
3659
3632
  await sleep(pollMs);
3660
3633
  latest = await client.get(sandboxId);
3661
3634
  }
3662
- throw new Error(
3663
- `snapshot did not reach ready state before timeout: ${snapshotId}`
3664
- );
3635
+ throw new Error(`snapshot did not reach ready state before timeout: ${snapshotId}`);
3665
3636
  }
3666
3637
  function sleep(ms) {
3667
3638
  return new Promise((resolve) => setTimeout(resolve, ms));
3668
3639
  }
3669
3640
 
3670
- // ../../packages/cloud/src/sandbox/async-request-options.ts
3641
+ // ../../packages/cloud/dist/sandbox/async-request-options.js
3671
3642
  function asyncRequestHeaders(options = {}) {
3672
3643
  return options.async || options.respondAsync ? { Prefer: "respond-async" } : void 0;
3673
3644
  }
3674
3645
 
3675
- // ../../packages/cloud/src/sandbox/stream.ts
3646
+ // ../../packages/cloud/dist/api/vercel-protection.js
3647
+ var VERCEL_PROTECTION_BYPASS_HEADER2 = "x-vercel-protection-bypass";
3648
+ function withVercelProtectionBypass2(requestUrl, inputHeaders, env = typeof process === "undefined" ? {} : process.env) {
3649
+ const headers = new Headers(inputHeaders);
3650
+ const secret = env.VERCEL_AUTOMATION_BYPASS_SECRET?.trim();
3651
+ if (!secret || !isOpenPondStagingUrl2(requestUrl))
3652
+ return headers;
3653
+ headers.set(VERCEL_PROTECTION_BYPASS_HEADER2, secret);
3654
+ return headers;
3655
+ }
3656
+ function isOpenPondStagingUrl2(requestUrl) {
3657
+ try {
3658
+ const hostname3 = new URL(requestUrl).hostname.toLowerCase();
3659
+ return hostname3 === "staging.openpond.ai" || hostname3 === "staging-api.openpond.ai" || hostname3.endsWith(".staging-api.openpond.ai");
3660
+ } catch {
3661
+ return false;
3662
+ }
3663
+ }
3664
+
3665
+ // ../../packages/cloud/dist/api/core.js
3666
+ var DEFAULT_API_TIMEOUT_MS2 = 3e4;
3667
+ var DEFAULT_API_RESPONSE_BYTES2 = 8 * 1024 * 1024;
3668
+ var LONG_STREAM_API_OPTIONS2 = { timeoutMs: 15 * 60 * 1e3, maxResponseBytes: 64 * 1024 * 1024 };
3669
+ var ApiTimeoutError2 = class extends Error {
3670
+ timeoutMs;
3671
+ requestUrl;
3672
+ code = "OPENPOND_API_TIMEOUT";
3673
+ constructor(timeoutMs, requestUrl) {
3674
+ super(`API request timed out after ${timeoutMs}ms: ${requestUrl}`);
3675
+ this.timeoutMs = timeoutMs;
3676
+ this.requestUrl = requestUrl;
3677
+ this.name = "ApiTimeoutError";
3678
+ }
3679
+ };
3680
+ var ApiResponseTooLargeError2 = class extends Error {
3681
+ maximumBytes;
3682
+ requestUrl;
3683
+ code = "OPENPOND_API_RESPONSE_TOO_LARGE";
3684
+ constructor(maximumBytes, requestUrl) {
3685
+ super(`API response exceeded ${maximumBytes} bytes: ${requestUrl}`);
3686
+ this.maximumBytes = maximumBytes;
3687
+ this.requestUrl = requestUrl;
3688
+ this.name = "ApiResponseTooLargeError";
3689
+ }
3690
+ };
3691
+ var OpenPondApiError2 = class extends Error {
3692
+ status;
3693
+ apiMessage;
3694
+ code;
3695
+ constructor(status, errorCode, label, apiMessage = null) {
3696
+ const detail = apiMessage || errorCode;
3697
+ super(`${label} failed: ${status}${detail ? ` ${detail}` : ""}`);
3698
+ this.status = status;
3699
+ this.apiMessage = apiMessage;
3700
+ this.name = "OpenPondApiError";
3701
+ this.code = errorCode || "OPENPOND_API_ERROR";
3702
+ }
3703
+ };
3704
+ async function apiFetch2(baseUrl, token, requestPath, options = {}) {
3705
+ const { timeoutMs = DEFAULT_API_TIMEOUT_MS2, maxResponseBytes = DEFAULT_API_RESPONSE_BYTES2, ...init } = options;
3706
+ const requestUrl = `${baseUrl}${requestPath}`;
3707
+ const headers = withVercelProtectionBypass2(requestUrl, init.headers);
3708
+ headers.set("Content-Type", "application/json");
3709
+ const apiKey = process.env.OPENPOND_API_KEY;
3710
+ const trimmedToken = token?.trim() || "";
3711
+ const tokenIsApiKey = trimmedToken.startsWith("opk_");
3712
+ const effectiveApiKey = apiKey || (tokenIsApiKey ? trimmedToken : null);
3713
+ if (effectiveApiKey && !headers.has("openpond-api-key"))
3714
+ headers.set("openpond-api-key", effectiveApiKey);
3715
+ if (token) {
3716
+ headers.set("Authorization", tokenIsApiKey ? `ApiKey ${trimmedToken}` : `Bearer ${token}`);
3717
+ } else if (apiKey && !headers.has("Authorization")) {
3718
+ headers.set("Authorization", `ApiKey ${apiKey}`);
3719
+ }
3720
+ const timeoutController = new AbortController();
3721
+ const timeoutError = new ApiTimeoutError2(timeoutMs, requestUrl);
3722
+ const timer = timeoutMs > 0 ? setTimeout(() => timeoutController.abort(timeoutError), timeoutMs) : null;
3723
+ timer?.unref?.();
3724
+ const signal = composedSignal2(init.signal, timeoutController.signal, timeoutMs);
3725
+ const cleanup = () => {
3726
+ if (timer)
3727
+ clearTimeout(timer);
3728
+ };
3729
+ try {
3730
+ const response = await fetch(requestUrl, { ...init, headers, signal });
3731
+ return boundedResponse2(response, {
3732
+ cleanup,
3733
+ maximumBytes: maxResponseBytes,
3734
+ requestUrl,
3735
+ timeoutController,
3736
+ timeoutError
3737
+ });
3738
+ } catch (error51) {
3739
+ cleanup();
3740
+ if (timeoutController.signal.aborted)
3741
+ throw timeoutError;
3742
+ throw error51;
3743
+ }
3744
+ }
3745
+ async function readApiJson2(response, label) {
3746
+ let payload;
3747
+ try {
3748
+ const text5 = await response.text();
3749
+ payload = text5 ? JSON.parse(text5) : {};
3750
+ } catch (error51) {
3751
+ if (error51 instanceof ApiTimeoutError2 || error51 instanceof ApiResponseTooLargeError2)
3752
+ throw error51;
3753
+ payload = {};
3754
+ }
3755
+ if (!response.ok) {
3756
+ const errorCode = typeof payload.error === "string" ? payload.error : null;
3757
+ const apiMessage = typeof payload.message === "string" ? payload.message : null;
3758
+ throw new OpenPondApiError2(response.status, errorCode, label, apiMessage);
3759
+ }
3760
+ return payload;
3761
+ }
3762
+ function boundedResponse2(response, input) {
3763
+ if (!response.body) {
3764
+ input.cleanup();
3765
+ return response;
3766
+ }
3767
+ const contentLength = Number(response.headers.get("content-length"));
3768
+ if (input.maximumBytes > 0 && Number.isFinite(contentLength) && contentLength > input.maximumBytes) {
3769
+ input.cleanup();
3770
+ void response.body.cancel();
3771
+ throw new ApiResponseTooLargeError2(input.maximumBytes, input.requestUrl);
3772
+ }
3773
+ const reader = response.body.getReader();
3774
+ let receivedBytes = 0;
3775
+ const body = new ReadableStream({
3776
+ async pull(controller) {
3777
+ try {
3778
+ const result = await reader.read();
3779
+ if (result.done) {
3780
+ input.cleanup();
3781
+ controller.close();
3782
+ return;
3783
+ }
3784
+ receivedBytes += result.value.byteLength;
3785
+ if (input.maximumBytes > 0 && receivedBytes > input.maximumBytes) {
3786
+ input.cleanup();
3787
+ await reader.cancel();
3788
+ controller.error(new ApiResponseTooLargeError2(input.maximumBytes, input.requestUrl));
3789
+ return;
3790
+ }
3791
+ controller.enqueue(result.value);
3792
+ } catch (error51) {
3793
+ input.cleanup();
3794
+ controller.error(input.timeoutController.signal.aborted ? input.timeoutError : error51);
3795
+ }
3796
+ },
3797
+ async cancel(reason) {
3798
+ input.cleanup();
3799
+ await reader.cancel(reason);
3800
+ }
3801
+ });
3802
+ return new Response(body, {
3803
+ headers: response.headers,
3804
+ status: response.status,
3805
+ statusText: response.statusText
3806
+ });
3807
+ }
3808
+ function composedSignal2(callerSignal, timeoutSignal, timeoutMs) {
3809
+ if (timeoutMs <= 0)
3810
+ return callerSignal ?? void 0;
3811
+ return callerSignal ? AbortSignal.any([callerSignal, timeoutSignal]) : timeoutSignal;
3812
+ }
3813
+
3814
+ // ../../packages/cloud/dist/urls.js
3815
+ var DEFAULT_OPENPOND_WEB_BASE_URL2 = "https://openpond.ai";
3816
+ var DEFAULT_OPENPOND_API_BASE_URL2 = "https://api.openpond.ai";
3817
+
3818
+ // ../../packages/cloud/dist/sandbox/stream.js
3676
3819
  async function streamSandboxEventOutput(params) {
3677
- const response = await apiFetch(
3678
- params.sandboxApiUrl,
3679
- params.apiKey,
3680
- params.path,
3681
- { timeoutMs: 0, maxResponseBytes: 0 }
3682
- );
3820
+ const response = await apiFetch2(params.sandboxApiUrl, params.apiKey, params.path, { timeoutMs: 0, maxResponseBytes: 0 });
3683
3821
  if (!response.body) {
3684
3822
  return;
3685
3823
  }
@@ -3689,14 +3827,16 @@ async function streamSandboxEventOutput(params) {
3689
3827
  try {
3690
3828
  while (true) {
3691
3829
  const { done, value } = await reader.read();
3692
- if (done) break;
3830
+ if (done)
3831
+ break;
3693
3832
  buffered += decoder.decode(value, { stream: true });
3694
3833
  let separatorIndex = buffered.indexOf("\n\n");
3695
3834
  while (separatorIndex !== -1) {
3696
3835
  const event = buffered.slice(0, separatorIndex);
3697
3836
  buffered = buffered.slice(separatorIndex + 2);
3698
3837
  const output = parseProcessOutputEvent(event);
3699
- if (output) process.stdout.write(output);
3838
+ if (output)
3839
+ process.stdout.write(output);
3700
3840
  separatorIndex = buffered.indexOf("\n\n");
3701
3841
  }
3702
3842
  }
@@ -3729,7 +3869,7 @@ function parseProcessOutputEvent(event) {
3729
3869
  }
3730
3870
  }
3731
3871
 
3732
- // ../../packages/cloud/src/sandbox/url.ts
3872
+ // ../../packages/cloud/dist/sandbox/url.js
3733
3873
  function normalizeSandboxApiUrl(baseUrlOrApiUrl) {
3734
3874
  const trimmed = baseUrlOrApiUrl.trim().replace(/\/$/, "");
3735
3875
  if (!trimmed) {
@@ -3746,8 +3886,8 @@ function normalizeSandboxApiUrl(baseUrlOrApiUrl) {
3746
3886
  if (isOpenPondHostedApiHost(url2.hostname)) {
3747
3887
  return `${url2.origin}${normalizedPath}/v1/sandboxes`;
3748
3888
  }
3749
- if (url2.origin === DEFAULT_OPENPOND_WEB_BASE_URL) {
3750
- return `${DEFAULT_OPENPOND_API_BASE_URL}/v1/sandboxes`;
3889
+ if (url2.origin === DEFAULT_OPENPOND_WEB_BASE_URL2) {
3890
+ return `${DEFAULT_OPENPOND_API_BASE_URL2}/v1/sandboxes`;
3751
3891
  }
3752
3892
  return `${url2.origin}${normalizedPath}/api/sandboxes`;
3753
3893
  }
@@ -3759,19 +3899,17 @@ function apiRootUrlFromSandboxApiUrl(sandboxApiUrl) {
3759
3899
  return sandboxApiUrl.slice(0, -suffix.length);
3760
3900
  }
3761
3901
  function isOpenPondHostedApiHost(hostname3) {
3762
- return hostname3 === "api.openpond.ai" || hostname3.startsWith("api") && hostname3.endsWith(".openpond.ai");
3902
+ return hostname3 === "api.openpond.ai" || hostname3 === "staging-api.openpond.ai" || hostname3.startsWith("api") && hostname3.endsWith(".openpond.ai");
3763
3903
  }
3764
3904
 
3765
- // ../../packages/cloud/src/sandbox/sandbox-instance-client.ts
3905
+ // ../../packages/cloud/dist/sandbox/sandbox-instance-client.js
3766
3906
  var OpenPondSandboxInstanceClient = class {
3767
3907
  apiKey;
3768
3908
  apiRootUrl;
3769
3909
  sandboxApiUrl;
3770
3910
  constructor(options) {
3771
3911
  this.apiKey = options.apiKey;
3772
- this.sandboxApiUrl = normalizeSandboxApiUrl(
3773
- options.sandboxApiUrl ?? options.baseUrl ?? DEFAULT_OPENPOND_API_BASE_URL
3774
- );
3912
+ this.sandboxApiUrl = normalizeSandboxApiUrl(options.sandboxApiUrl ?? options.baseUrl ?? DEFAULT_OPENPOND_API_BASE_URL2);
3775
3913
  this.apiRootUrl = apiRootUrlFromSandboxApiUrl(this.sandboxApiUrl);
3776
3914
  }
3777
3915
  create(input, options = {}) {
@@ -3782,52 +3920,33 @@ var OpenPondSandboxInstanceClient = class {
3782
3920
  }).then((payload) => payload.sandbox);
3783
3921
  }
3784
3922
  get(sandboxId) {
3785
- return this.request(
3786
- `/${encodeURIComponent(sandboxId)}`
3787
- ).then((payload) => payload.sandbox);
3923
+ return this.request(`/${encodeURIComponent(sandboxId)}`).then((payload) => payload.sandbox);
3788
3924
  }
3789
3925
  exec(sandboxId, input) {
3790
- return this.request(
3791
- `/${encodeURIComponent(sandboxId)}/exec`,
3792
- {
3793
- method: "POST",
3794
- body: JSON.stringify(input)
3795
- }
3796
- );
3926
+ return this.request(`/${encodeURIComponent(sandboxId)}/exec`, {
3927
+ method: "POST",
3928
+ body: JSON.stringify(input)
3929
+ });
3797
3930
  }
3798
3931
  startProcess(sandboxId, input) {
3799
- return this.request(
3800
- `/${encodeURIComponent(sandboxId)}/processes`,
3801
- {
3802
- method: "POST",
3803
- body: JSON.stringify(input)
3804
- }
3805
- );
3932
+ return this.request(`/${encodeURIComponent(sandboxId)}/processes`, {
3933
+ method: "POST",
3934
+ body: JSON.stringify(input)
3935
+ });
3806
3936
  }
3807
3937
  listProcesses(sandboxId) {
3808
- return this.request(
3809
- `/${encodeURIComponent(sandboxId)}/processes`
3810
- );
3938
+ return this.request(`/${encodeURIComponent(sandboxId)}/processes`);
3811
3939
  }
3812
3940
  getProcess(sandboxId, processId, input = {}) {
3813
3941
  const query = new URLSearchParams();
3814
3942
  if (input.since !== void 0)
3815
3943
  query.set("since", String(Math.max(0, input.since)));
3816
- return this.request(
3817
- `/${encodeURIComponent(sandboxId)}/processes/${encodeURIComponent(
3818
- processId
3819
- )}${query.size > 0 ? `?${query.toString()}` : ""}`
3820
- );
3944
+ return this.request(`/${encodeURIComponent(sandboxId)}/processes/${encodeURIComponent(processId)}${query.size > 0 ? `?${query.toString()}` : ""}`);
3821
3945
  }
3822
3946
  stopProcess(sandboxId, processId) {
3823
- return this.request(
3824
- `/${encodeURIComponent(sandboxId)}/processes/${encodeURIComponent(
3825
- processId
3826
- )}`,
3827
- {
3828
- method: "DELETE"
3829
- }
3830
- );
3947
+ return this.request(`/${encodeURIComponent(sandboxId)}/processes/${encodeURIComponent(processId)}`, {
3948
+ method: "DELETE"
3949
+ });
3831
3950
  }
3832
3951
  async streamProcessOutput(sandboxId, processId, input = {}) {
3833
3952
  const query = new URLSearchParams();
@@ -3836,51 +3955,34 @@ var OpenPondSandboxInstanceClient = class {
3836
3955
  await streamSandboxEventOutput({
3837
3956
  sandboxApiUrl: this.sandboxApiUrl,
3838
3957
  apiKey: this.apiKey,
3839
- path: `/${encodeURIComponent(sandboxId)}/processes/${encodeURIComponent(
3840
- processId
3841
- )}/stream${query.size > 0 ? `?${query.toString()}` : ""}`
3958
+ path: `/${encodeURIComponent(sandboxId)}/processes/${encodeURIComponent(processId)}/stream${query.size > 0 ? `?${query.toString()}` : ""}`
3842
3959
  });
3843
3960
  }
3844
3961
  startPty(sandboxId, input = {}) {
3845
- return this.request(
3846
- `/${encodeURIComponent(sandboxId)}/pty`,
3847
- {
3848
- method: "POST",
3849
- body: JSON.stringify(input)
3850
- }
3851
- );
3962
+ return this.request(`/${encodeURIComponent(sandboxId)}/pty`, {
3963
+ method: "POST",
3964
+ body: JSON.stringify(input)
3965
+ });
3852
3966
  }
3853
3967
  listPtys(sandboxId) {
3854
- return this.request(
3855
- `/${encodeURIComponent(sandboxId)}/pty`
3856
- );
3968
+ return this.request(`/${encodeURIComponent(sandboxId)}/pty`);
3857
3969
  }
3858
3970
  getPty(sandboxId, ptyId, input = {}) {
3859
3971
  const query = new URLSearchParams();
3860
3972
  if (input.since !== void 0)
3861
3973
  query.set("since", String(Math.max(0, input.since)));
3862
- return this.request(
3863
- `/${encodeURIComponent(sandboxId)}/pty/${encodeURIComponent(ptyId)}${query.size > 0 ? `?${query.toString()}` : ""}`
3864
- );
3974
+ return this.request(`/${encodeURIComponent(sandboxId)}/pty/${encodeURIComponent(ptyId)}${query.size > 0 ? `?${query.toString()}` : ""}`);
3865
3975
  }
3866
3976
  writePtyInput(sandboxId, ptyId, input) {
3867
- return this.request(
3868
- `/${encodeURIComponent(sandboxId)}/pty/${encodeURIComponent(
3869
- ptyId
3870
- )}/input`,
3871
- {
3872
- method: "POST",
3873
- body: JSON.stringify(normalizePtyInput(input))
3874
- }
3875
- );
3977
+ return this.request(`/${encodeURIComponent(sandboxId)}/pty/${encodeURIComponent(ptyId)}/input`, {
3978
+ method: "POST",
3979
+ body: JSON.stringify(normalizePtyInput(input))
3980
+ });
3876
3981
  }
3877
3982
  stopPty(sandboxId, ptyId) {
3878
- return this.request(
3879
- `/${encodeURIComponent(sandboxId)}/pty/${encodeURIComponent(ptyId)}`,
3880
- {
3881
- method: "DELETE"
3882
- }
3883
- );
3983
+ return this.request(`/${encodeURIComponent(sandboxId)}/pty/${encodeURIComponent(ptyId)}`, {
3984
+ method: "DELETE"
3985
+ });
3884
3986
  }
3885
3987
  async streamPtyOutput(sandboxId, ptyId, input = {}) {
3886
3988
  const query = new URLSearchParams();
@@ -3889,29 +3991,20 @@ var OpenPondSandboxInstanceClient = class {
3889
3991
  await streamSandboxEventOutput({
3890
3992
  sandboxApiUrl: this.sandboxApiUrl,
3891
3993
  apiKey: this.apiKey,
3892
- path: `/${encodeURIComponent(sandboxId)}/pty/${encodeURIComponent(
3893
- ptyId
3894
- )}/stream${query.size > 0 ? `?${query.toString()}` : ""}`
3994
+ path: `/${encodeURIComponent(sandboxId)}/pty/${encodeURIComponent(ptyId)}/stream${query.size > 0 ? `?${query.toString()}` : ""}`
3895
3995
  });
3896
3996
  }
3897
3997
  uploadFile(sandboxId, path10, contents) {
3898
- return this.uploadFileBase64(
3899
- sandboxId,
3900
- path10,
3901
- Buffer.from(contents, "utf-8").toString("base64")
3902
- );
3998
+ return this.uploadFileBase64(sandboxId, path10, Buffer.from(contents, "utf-8").toString("base64"));
3903
3999
  }
3904
4000
  uploadFileBase64(sandboxId, path10, contentsBase64) {
3905
- return this.request(
3906
- `/${encodeURIComponent(sandboxId)}/files`,
3907
- {
3908
- method: "POST",
3909
- body: JSON.stringify({
3910
- path: path10,
3911
- contentsBase64
3912
- })
3913
- }
3914
- );
4001
+ return this.request(`/${encodeURIComponent(sandboxId)}/files`, {
4002
+ method: "POST",
4003
+ body: JSON.stringify({
4004
+ path: path10,
4005
+ contentsBase64
4006
+ })
4007
+ });
3915
4008
  }
3916
4009
  async downloadFile(sandboxId, path10) {
3917
4010
  const payload = await this.downloadFileResponse(sandboxId, path10);
@@ -3926,49 +4019,38 @@ var OpenPondSandboxInstanceClient = class {
3926
4019
  if (normalized.maxBytes !== void 0) {
3927
4020
  query.set("maxBytes", String(normalized.maxBytes));
3928
4021
  }
3929
- return this.request(
3930
- `/${encodeURIComponent(sandboxId)}/files?${query.toString()}`
3931
- );
4022
+ return this.request(`/${encodeURIComponent(sandboxId)}/files?${query.toString()}`);
3932
4023
  }
3933
4024
  listFiles(sandboxId, input = {}) {
3934
4025
  const query = new URLSearchParams({ list: "1" });
3935
- if (input.path) query.set("path", input.path);
4026
+ if (input.path)
4027
+ query.set("path", input.path);
3936
4028
  if (input.recursive !== void 0)
3937
4029
  query.set("recursive", String(input.recursive));
3938
4030
  if (input.maxEntries !== void 0)
3939
4031
  query.set("maxEntries", String(input.maxEntries));
3940
- return this.request(
3941
- `/${encodeURIComponent(sandboxId)}/files?${query.toString()}`
3942
- );
4032
+ return this.request(`/${encodeURIComponent(sandboxId)}/files?${query.toString()}`);
3943
4033
  }
3944
4034
  deleteFile(sandboxId, path10, input = {}) {
3945
4035
  const query = new URLSearchParams({ path: path10 });
3946
4036
  if (input.recursive !== void 0)
3947
4037
  query.set("recursive", String(input.recursive));
3948
- return this.request(
3949
- `/${encodeURIComponent(sandboxId)}/files?${query.toString()}`,
3950
- {
3951
- method: "DELETE"
3952
- }
3953
- );
4038
+ return this.request(`/${encodeURIComponent(sandboxId)}/files?${query.toString()}`, {
4039
+ method: "DELETE"
4040
+ });
3954
4041
  }
3955
4042
  statFile(sandboxId, path10) {
3956
4043
  const query = new URLSearchParams({ stat: "1", path: path10 });
3957
- return this.request(
3958
- `/${encodeURIComponent(sandboxId)}/files?${query.toString()}`
3959
- );
4044
+ return this.request(`/${encodeURIComponent(sandboxId)}/files?${query.toString()}`);
3960
4045
  }
3961
4046
  mkdir(sandboxId, input) {
3962
4047
  const normalized = typeof input === "string" ? { path: input } : input;
3963
4048
  const query = new URLSearchParams({ path: normalized.path });
3964
4049
  if (normalized.recursive !== void 0)
3965
4050
  query.set("recursive", String(normalized.recursive));
3966
- return this.request(
3967
- `/${encodeURIComponent(sandboxId)}/files?${query.toString()}`,
3968
- {
3969
- method: "PUT"
3970
- }
3971
- );
4051
+ return this.request(`/${encodeURIComponent(sandboxId)}/files?${query.toString()}`, {
4052
+ method: "PUT"
4053
+ });
3972
4054
  }
3973
4055
  moveFile(sandboxId, input) {
3974
4056
  const query = new URLSearchParams({
@@ -3977,281 +4059,201 @@ var OpenPondSandboxInstanceClient = class {
3977
4059
  });
3978
4060
  if (input.overwrite !== void 0)
3979
4061
  query.set("overwrite", String(input.overwrite));
3980
- return this.request(
3981
- `/${encodeURIComponent(sandboxId)}/files?${query.toString()}`,
3982
- {
3983
- method: "PATCH"
3984
- }
3985
- );
4062
+ return this.request(`/${encodeURIComponent(sandboxId)}/files?${query.toString()}`, {
4063
+ method: "PATCH"
4064
+ });
3986
4065
  }
3987
4066
  searchFiles(sandboxId, input) {
3988
4067
  const query = new URLSearchParams({
3989
4068
  search: "1",
3990
4069
  query: input.query
3991
4070
  });
3992
- if (input.path) query.set("path", input.path);
4071
+ if (input.path)
4072
+ query.set("path", input.path);
3993
4073
  if (input.maxResults !== void 0)
3994
4074
  query.set("maxResults", String(input.maxResults));
3995
- return this.request(
3996
- `/${encodeURIComponent(sandboxId)}/files?${query.toString()}`
3997
- );
4075
+ return this.request(`/${encodeURIComponent(sandboxId)}/files?${query.toString()}`);
3998
4076
  }
3999
4077
  openPort(sandboxId, input) {
4000
- return this.request(
4001
- `/${encodeURIComponent(sandboxId)}/ports`,
4002
- {
4003
- method: "POST",
4004
- body: JSON.stringify(input)
4005
- }
4006
- );
4078
+ return this.request(`/${encodeURIComponent(sandboxId)}/ports`, {
4079
+ method: "POST",
4080
+ body: JSON.stringify(input)
4081
+ });
4007
4082
  }
4008
4083
  createSnapshot(sandboxId, input) {
4009
- return this.request(
4010
- `/${encodeURIComponent(sandboxId)}/snapshots`,
4011
- {
4012
- method: "POST",
4013
- body: JSON.stringify(input)
4014
- }
4015
- );
4084
+ return this.request(`/${encodeURIComponent(sandboxId)}/snapshots`, {
4085
+ method: "POST",
4086
+ body: JSON.stringify(input)
4087
+ });
4016
4088
  }
4017
4089
  updateSnapshot(sandboxId, snapshotId, input) {
4018
- return this.request(
4019
- `/${encodeURIComponent(sandboxId)}/snapshots/${encodeURIComponent(
4020
- snapshotId
4021
- )}`,
4022
- {
4023
- method: "PATCH",
4024
- body: JSON.stringify(input)
4025
- }
4026
- );
4090
+ return this.request(`/${encodeURIComponent(sandboxId)}/snapshots/${encodeURIComponent(snapshotId)}`, {
4091
+ method: "PATCH",
4092
+ body: JSON.stringify(input)
4093
+ });
4027
4094
  }
4028
4095
  validateSnapshot(sandboxId, snapshotId, input = {}) {
4029
- return this.request(
4030
- `/${encodeURIComponent(sandboxId)}/snapshots/${encodeURIComponent(
4031
- snapshotId
4032
- )}/validate`,
4033
- {
4034
- method: "POST",
4035
- body: JSON.stringify(input)
4036
- }
4037
- );
4096
+ return this.request(`/${encodeURIComponent(sandboxId)}/snapshots/${encodeURIComponent(snapshotId)}/validate`, {
4097
+ method: "POST",
4098
+ body: JSON.stringify(input)
4099
+ });
4038
4100
  }
4039
4101
  publishSnapshot(sandboxId, snapshotId) {
4040
- return this.request(
4041
- `/${encodeURIComponent(sandboxId)}/snapshots/${encodeURIComponent(
4042
- snapshotId
4043
- )}/publish`,
4044
- {
4045
- method: "POST"
4046
- }
4047
- );
4102
+ return this.request(`/${encodeURIComponent(sandboxId)}/snapshots/${encodeURIComponent(snapshotId)}/publish`, {
4103
+ method: "POST"
4104
+ });
4048
4105
  }
4049
4106
  fork(sandboxId, input = {}) {
4050
- return this.request(
4051
- `/${encodeURIComponent(sandboxId)}/fork`,
4052
- {
4053
- method: "POST",
4054
- body: JSON.stringify(input)
4055
- }
4056
- );
4107
+ return this.request(`/${encodeURIComponent(sandboxId)}/fork`, {
4108
+ method: "POST",
4109
+ body: JSON.stringify(input)
4110
+ });
4057
4111
  }
4058
4112
  stop(sandboxId, options = {}) {
4059
4113
  const query = new URLSearchParams();
4060
4114
  if (options.failOnUnpreservedChanges) {
4061
4115
  query.set("failOnUnpreservedChanges", "true");
4062
4116
  }
4063
- return this.request(
4064
- `/${encodeURIComponent(sandboxId)}/stop${query.size > 0 ? `?${query.toString()}` : ""}`,
4065
- {
4066
- method: "POST",
4067
- headers: asyncRequestHeaders(options)
4068
- }
4069
- );
4117
+ return this.request(`/${encodeURIComponent(sandboxId)}/stop${query.size > 0 ? `?${query.toString()}` : ""}`, {
4118
+ method: "POST",
4119
+ headers: asyncRequestHeaders(options)
4120
+ });
4070
4121
  }
4071
4122
  start(sandboxId, options = {}) {
4072
- return this.request(
4073
- `/${encodeURIComponent(sandboxId)}/start`,
4074
- {
4075
- method: "POST",
4076
- headers: asyncRequestHeaders(options)
4077
- }
4078
- );
4123
+ return this.request(`/${encodeURIComponent(sandboxId)}/start`, {
4124
+ method: "POST",
4125
+ headers: asyncRequestHeaders(options)
4126
+ });
4079
4127
  }
4080
4128
  restore(sandboxId) {
4081
- return this.request(
4082
- `/${encodeURIComponent(sandboxId)}/restore`,
4083
- {
4084
- method: "POST"
4085
- }
4086
- );
4129
+ return this.request(`/${encodeURIComponent(sandboxId)}/restore`, {
4130
+ method: "POST"
4131
+ });
4087
4132
  }
4088
4133
  delete(sandboxId, options = {}) {
4089
4134
  const query = new URLSearchParams();
4090
4135
  if (options.failOnUnpreservedChanges) {
4091
4136
  query.set("failOnUnpreservedChanges", "true");
4092
4137
  }
4093
- return this.request(
4094
- `/${encodeURIComponent(sandboxId)}${query.size > 0 ? `?${query.toString()}` : ""}`,
4095
- {
4096
- method: "DELETE",
4097
- headers: asyncRequestHeaders(options)
4098
- }
4099
- ).then((payload) => payload.sandbox);
4138
+ return this.request(`/${encodeURIComponent(sandboxId)}${query.size > 0 ? `?${query.toString()}` : ""}`, {
4139
+ method: "DELETE",
4140
+ headers: asyncRequestHeaders(options)
4141
+ }).then((payload) => payload.sandbox);
4100
4142
  }
4101
4143
  receipts(sandboxId) {
4102
- return this.request(
4103
- `/${encodeURIComponent(sandboxId)}/receipts`
4104
- ).then((payload) => payload.receipts);
4144
+ return this.request(`/${encodeURIComponent(sandboxId)}/receipts`).then((payload) => payload.receipts);
4105
4145
  }
4106
4146
  logs(sandboxId) {
4107
- return this.request(
4108
- `/${encodeURIComponent(sandboxId)}/logs`
4109
- ).then((payload) => payload.logs);
4147
+ return this.request(`/${encodeURIComponent(sandboxId)}/logs`).then((payload) => payload.logs);
4110
4148
  }
4111
4149
  gitStatus(sandboxId) {
4112
- return this.request(
4113
- `/${encodeURIComponent(sandboxId)}/git/status`
4114
- );
4150
+ return this.request(`/${encodeURIComponent(sandboxId)}/git/status`);
4115
4151
  }
4116
4152
  gitDiff(sandboxId, input = {}) {
4117
- return this.request(
4118
- `/${encodeURIComponent(sandboxId)}/git/diff`,
4119
- {
4120
- method: "POST",
4121
- body: JSON.stringify(input)
4122
- }
4123
- );
4153
+ return this.request(`/${encodeURIComponent(sandboxId)}/git/diff`, {
4154
+ method: "POST",
4155
+ body: JSON.stringify(input)
4156
+ });
4124
4157
  }
4125
4158
  gitExportPatch(sandboxId, input = {}) {
4126
- return this.request(
4127
- `/${encodeURIComponent(sandboxId)}/git/export-patch`,
4128
- {
4129
- method: "POST",
4130
- body: JSON.stringify(input)
4131
- }
4132
- );
4159
+ return this.request(`/${encodeURIComponent(sandboxId)}/git/export-patch`, {
4160
+ method: "POST",
4161
+ body: JSON.stringify(input)
4162
+ });
4133
4163
  }
4134
4164
  gitBranch(sandboxId, input) {
4135
- return this.request(
4136
- `/${encodeURIComponent(sandboxId)}/git/branch`,
4137
- {
4138
- method: "POST",
4139
- body: JSON.stringify(input)
4140
- }
4141
- );
4165
+ return this.request(`/${encodeURIComponent(sandboxId)}/git/branch`, {
4166
+ method: "POST",
4167
+ body: JSON.stringify(input)
4168
+ });
4142
4169
  }
4143
4170
  gitCommit(sandboxId, input) {
4144
- return this.request(
4145
- `/${encodeURIComponent(sandboxId)}/git/commit`,
4146
- {
4147
- method: "POST",
4148
- body: JSON.stringify(input)
4149
- }
4150
- );
4171
+ return this.request(`/${encodeURIComponent(sandboxId)}/git/commit`, {
4172
+ method: "POST",
4173
+ body: JSON.stringify(input)
4174
+ });
4151
4175
  }
4152
4176
  gitPull(sandboxId, input = {}) {
4153
- return this.request(
4154
- `/${encodeURIComponent(sandboxId)}/git/pull`,
4155
- {
4156
- method: "POST",
4157
- body: JSON.stringify(input)
4158
- }
4159
- );
4177
+ return this.request(`/${encodeURIComponent(sandboxId)}/git/pull`, {
4178
+ method: "POST",
4179
+ body: JSON.stringify(input)
4180
+ });
4160
4181
  }
4161
4182
  gitPush(sandboxId, input = {}) {
4162
- return this.request(
4163
- `/${encodeURIComponent(sandboxId)}/git/push`,
4164
- {
4165
- method: "POST",
4166
- body: JSON.stringify(input)
4167
- }
4168
- );
4183
+ return this.request(`/${encodeURIComponent(sandboxId)}/git/push`, {
4184
+ method: "POST",
4185
+ body: JSON.stringify(input)
4186
+ });
4169
4187
  }
4170
4188
  billing(sandboxId) {
4171
- return this.request(
4172
- `/${encodeURIComponent(sandboxId)}/billing`
4173
- );
4189
+ return this.request(`/${encodeURIComponent(sandboxId)}/billing`);
4174
4190
  }
4175
4191
  pricing() {
4176
4192
  return this.request("/pricing");
4177
4193
  }
4178
4194
  costs(input = {}) {
4179
4195
  const query = new URLSearchParams();
4180
- if (input.teamId) query.set("teamId", input.teamId);
4181
- if (input.projectId) query.set("projectId", input.projectId);
4182
- if (input.agentId) query.set("agentId", input.agentId);
4183
- return this.request(
4184
- `/costs${query.size > 0 ? `?${query.toString()}` : ""}`
4185
- );
4196
+ if (input.teamId)
4197
+ query.set("teamId", input.teamId);
4198
+ if (input.projectId)
4199
+ query.set("projectId", input.projectId);
4200
+ if (input.agentId)
4201
+ query.set("agentId", input.agentId);
4202
+ return this.request(`/costs${query.size > 0 ? `?${query.toString()}` : ""}`);
4186
4203
  }
4187
4204
  integrationLeases(sandboxId) {
4188
- return this.request(
4189
- `/${encodeURIComponent(sandboxId)}/integrations`
4190
- );
4205
+ return this.request(`/${encodeURIComponent(sandboxId)}/integrations`);
4191
4206
  }
4192
4207
  attachIntegrationConnection(sandboxId, input) {
4193
- return this.request(
4194
- `/${encodeURIComponent(sandboxId)}/integrations`,
4195
- {
4196
- method: "POST",
4197
- body: JSON.stringify(input)
4198
- }
4199
- );
4208
+ return this.request(`/${encodeURIComponent(sandboxId)}/integrations`, {
4209
+ method: "POST",
4210
+ body: JSON.stringify(input)
4211
+ });
4200
4212
  }
4201
4213
  removeIntegrationLease(sandboxId, leaseId) {
4202
- return this.request(
4203
- `/${encodeURIComponent(sandboxId)}/integrations`,
4204
- {
4205
- method: "DELETE",
4206
- body: JSON.stringify({ leaseId })
4207
- }
4208
- );
4214
+ return this.request(`/${encodeURIComponent(sandboxId)}/integrations`, {
4215
+ method: "DELETE",
4216
+ body: JSON.stringify({ leaseId })
4217
+ });
4209
4218
  }
4210
4219
  async request(path10, init = {}) {
4211
- const response = await apiFetch(
4212
- this.sandboxApiUrl,
4213
- this.apiKey,
4214
- path10,
4215
- init
4216
- );
4217
- return readApiJson(response, "Sandbox request");
4220
+ const response = await apiFetch2(this.sandboxApiUrl, this.apiKey, path10, init);
4221
+ return readApiJson2(response, "Sandbox request");
4218
4222
  }
4219
4223
  async requestApiRoot(path10, init = {}) {
4220
- const response = await apiFetch(this.apiRootUrl, this.apiKey, path10, init);
4221
- return readApiJson(response, "OpenPond API request");
4224
+ const response = await apiFetch2(this.apiRootUrl, this.apiKey, path10, init);
4225
+ return readApiJson2(response, "OpenPond API request");
4222
4226
  }
4223
4227
  };
4224
4228
 
4225
- // ../../packages/cloud/src/sandbox/client.ts
4229
+ // ../../packages/cloud/dist/sandbox/client.js
4226
4230
  var OpenPondSandboxClient = class extends OpenPondSandboxInstanceClient {
4227
4231
  runtimes = createSandboxRuntimeNamespace(this);
4228
4232
  sandboxes = createSandboxNamespace(this);
4229
4233
  profile = createSandboxProfileNamespace(this);
4230
4234
  projects = createSandboxProjectNamespace(this);
4231
4235
  agents = createSandboxAgentNamespace(this);
4232
- workItems = createSandboxWorkItemNamespace(this);
4233
4236
  list(input = {}) {
4234
4237
  const query = new URLSearchParams();
4235
- if (input.teamId) query.set("teamId", input.teamId);
4236
- if (input.projectId) query.set("projectId", input.projectId);
4237
- if (input.agentId) query.set("agentId", input.agentId);
4238
- return this.request(
4239
- query.size > 0 ? `?${query.toString()}` : ""
4240
- ).then((payload) => payload.sandboxes);
4238
+ if (input.teamId)
4239
+ query.set("teamId", input.teamId);
4240
+ if (input.projectId)
4241
+ query.set("projectId", input.projectId);
4242
+ if (input.agentId)
4243
+ query.set("agentId", input.agentId);
4244
+ return this.request(query.size > 0 ? `?${query.toString()}` : "").then((payload) => payload.sandboxes);
4241
4245
  }
4242
4246
  listSecrets(input = {}) {
4243
4247
  const query = new URLSearchParams();
4244
- if (input.teamId) query.set("teamId", input.teamId);
4245
- return this.requestApiRoot(
4246
- `/sandbox-secrets${query.size > 0 ? `?${query.toString()}` : ""}`
4247
- ).then((payload) => payload.secrets);
4248
+ if (input.teamId)
4249
+ query.set("teamId", input.teamId);
4250
+ return this.requestApiRoot(`/sandbox-secrets${query.size > 0 ? `?${query.toString()}` : ""}`).then((payload) => payload.secrets);
4248
4251
  }
4249
4252
  getSecret(secretId, input = {}) {
4250
4253
  const query = new URLSearchParams();
4251
- if (input.teamId) query.set("teamId", input.teamId);
4252
- return this.requestApiRoot(
4253
- `/sandbox-secrets/${encodeURIComponent(secretId)}${query.size > 0 ? `?${query.toString()}` : ""}`
4254
- ).then((payload) => payload.secret);
4254
+ if (input.teamId)
4255
+ query.set("teamId", input.teamId);
4256
+ return this.requestApiRoot(`/sandbox-secrets/${encodeURIComponent(secretId)}${query.size > 0 ? `?${query.toString()}` : ""}`).then((payload) => payload.secret);
4255
4257
  }
4256
4258
  createSecret(input) {
4257
4259
  return this.requestApiRoot("/sandbox-secrets", {
@@ -4261,74 +4263,73 @@ var OpenPondSandboxClient = class extends OpenPondSandboxInstanceClient {
4261
4263
  }
4262
4264
  rotateSecret(secretId, input) {
4263
4265
  const query = new URLSearchParams();
4264
- if (input.teamId) query.set("teamId", input.teamId);
4266
+ if (input.teamId)
4267
+ query.set("teamId", input.teamId);
4265
4268
  const { teamId: _teamId, ...body } = input;
4266
- return this.requestApiRoot(
4267
- `/sandbox-secrets/${encodeURIComponent(secretId)}/rotate${query.size > 0 ? `?${query.toString()}` : ""}`,
4268
- {
4269
- method: "POST",
4270
- body: JSON.stringify(body)
4271
- }
4272
- ).then((payload) => payload.secret);
4269
+ return this.requestApiRoot(`/sandbox-secrets/${encodeURIComponent(secretId)}/rotate${query.size > 0 ? `?${query.toString()}` : ""}`, {
4270
+ method: "POST",
4271
+ body: JSON.stringify(body)
4272
+ }).then((payload) => payload.secret);
4273
4273
  }
4274
4274
  attachSecret(secretId, input) {
4275
4275
  const query = new URLSearchParams();
4276
- if (input.teamId) query.set("teamId", input.teamId);
4276
+ if (input.teamId)
4277
+ query.set("teamId", input.teamId);
4277
4278
  const { teamId: _teamId, ...body } = input;
4278
- return this.requestApiRoot(
4279
- `/sandbox-secrets/${encodeURIComponent(secretId)}/attach${query.size > 0 ? `?${query.toString()}` : ""}`,
4280
- {
4281
- method: "POST",
4282
- body: JSON.stringify(body)
4283
- }
4284
- ).then((payload) => payload.secret);
4279
+ return this.requestApiRoot(`/sandbox-secrets/${encodeURIComponent(secretId)}/attach${query.size > 0 ? `?${query.toString()}` : ""}`, {
4280
+ method: "POST",
4281
+ body: JSON.stringify(body)
4282
+ }).then((payload) => payload.secret);
4285
4283
  }
4286
4284
  revokeSecret(secretId, input = {}) {
4287
4285
  const query = new URLSearchParams();
4288
- if (input.teamId) query.set("teamId", input.teamId);
4289
- return this.requestApiRoot(
4290
- `/sandbox-secrets/${encodeURIComponent(secretId)}/revoke${query.size > 0 ? `?${query.toString()}` : ""}`,
4291
- { method: "POST" }
4292
- ).then((payload) => payload.secret);
4286
+ if (input.teamId)
4287
+ query.set("teamId", input.teamId);
4288
+ return this.requestApiRoot(`/sandbox-secrets/${encodeURIComponent(secretId)}/revoke${query.size > 0 ? `?${query.toString()}` : ""}`, { method: "POST" }).then((payload) => payload.secret);
4293
4289
  }
4294
4290
  deleteSecret(secretId, input = {}) {
4295
4291
  const query = new URLSearchParams();
4296
- if (input.teamId) query.set("teamId", input.teamId);
4297
- return this.requestApiRoot(
4298
- `/sandbox-secrets/${encodeURIComponent(secretId)}${query.size > 0 ? `?${query.toString()}` : ""}`,
4299
- { method: "DELETE" }
4300
- ).then((payload) => payload.secret);
4292
+ if (input.teamId)
4293
+ query.set("teamId", input.teamId);
4294
+ return this.requestApiRoot(`/sandbox-secrets/${encodeURIComponent(secretId)}${query.size > 0 ? `?${query.toString()}` : ""}`, { method: "DELETE" }).then((payload) => payload.secret);
4301
4295
  }
4302
4296
  snapshotCatalog(input = {}) {
4303
4297
  const query = new URLSearchParams();
4304
- if (input.teamId) query.set("teamId", input.teamId);
4305
- if (input.projectId) query.set("projectId", input.projectId);
4306
- if (input.agentId) query.set("agentId", input.agentId);
4307
- if (input.q) query.set("q", input.q);
4308
- if (input.kind) query.set("kind", input.kind);
4309
- if (input.replayState) query.set("replayState", input.replayState);
4310
- if (input.visibility) query.set("visibility", input.visibility);
4311
- if (input.tag) query.set("tag", input.tag);
4312
- if (input.useCase) query.set("useCase", input.useCase);
4313
- if (input.limit) query.set("limit", String(input.limit));
4314
- return this.request(
4315
- `/catalog/snapshots${query.size > 0 ? `?${query.toString()}` : ""}`
4316
- );
4298
+ if (input.teamId)
4299
+ query.set("teamId", input.teamId);
4300
+ if (input.projectId)
4301
+ query.set("projectId", input.projectId);
4302
+ if (input.agentId)
4303
+ query.set("agentId", input.agentId);
4304
+ if (input.q)
4305
+ query.set("q", input.q);
4306
+ if (input.kind)
4307
+ query.set("kind", input.kind);
4308
+ if (input.replayState)
4309
+ query.set("replayState", input.replayState);
4310
+ if (input.visibility)
4311
+ query.set("visibility", input.visibility);
4312
+ if (input.tag)
4313
+ query.set("tag", input.tag);
4314
+ if (input.useCase)
4315
+ query.set("useCase", input.useCase);
4316
+ if (input.limit)
4317
+ query.set("limit", String(input.limit));
4318
+ return this.request(`/catalog/snapshots${query.size > 0 ? `?${query.toString()}` : ""}`);
4317
4319
  }
4318
4320
  listSandboxRuntimes(input = {}) {
4319
4321
  const query = new URLSearchParams();
4320
- if (input.teamId) query.set("teamId", input.teamId);
4321
- if (input.projectId) query.set("projectId", input.projectId);
4322
- if (input.agentId) query.set("agentId", input.agentId);
4323
- return this.requestApiRoot(
4324
- `/runtimes${query.size > 0 ? `?${query.toString()}` : ""}`
4325
- ).then((payload) => payload.runtimes);
4322
+ if (input.teamId)
4323
+ query.set("teamId", input.teamId);
4324
+ if (input.projectId)
4325
+ query.set("projectId", input.projectId);
4326
+ if (input.agentId)
4327
+ query.set("agentId", input.agentId);
4328
+ return this.requestApiRoot(`/runtimes${query.size > 0 ? `?${query.toString()}` : ""}`).then((payload) => payload.runtimes);
4326
4329
  }
4327
4330
  listProjects(input) {
4328
4331
  const query = new URLSearchParams({ teamId: input.teamId });
4329
- return this.requestApiRoot(
4330
- `/projects?${query.toString()}`
4331
- ).then((payload) => payload.projects);
4332
+ return this.requestApiRoot(`/projects?${query.toString()}`).then((payload) => payload.projects);
4332
4333
  }
4333
4334
  upsertProject(input) {
4334
4335
  return this.requestApiRoot("/projects", {
@@ -4338,16 +4339,11 @@ var OpenPondSandboxClient = class extends OpenPondSandboxInstanceClient {
4338
4339
  }
4339
4340
  getHostedProfile(input) {
4340
4341
  const query = new URLSearchParams({ teamId: input.teamId });
4341
- return this.requestApiRoot(
4342
- `/profile?${query.toString()}`
4343
- ).then((payload) => payload.profile);
4342
+ return this.requestApiRoot(`/profile?${query.toString()}`).then((payload) => payload.profile);
4344
4343
  }
4345
4344
  ensureHostedProfile(input) {
4346
4345
  const query = new URLSearchParams({ teamId: input.teamId });
4347
- return this.requestApiRoot(
4348
- `/profile/ensure?${query.toString()}`,
4349
- { method: "POST" }
4350
- ).then((payload) => {
4346
+ return this.requestApiRoot(`/profile/ensure?${query.toString()}`, { method: "POST" }).then((payload) => {
4351
4347
  if (!payload.profile) {
4352
4348
  throw new Error("hosted_profile_missing");
4353
4349
  }
@@ -4357,13 +4353,10 @@ var OpenPondSandboxClient = class extends OpenPondSandboxInstanceClient {
4357
4353
  pushHostedProfile(input) {
4358
4354
  const query = new URLSearchParams({ teamId: input.teamId });
4359
4355
  const { teamId: _teamId, ...body } = input;
4360
- return this.requestApiRoot(
4361
- `/profile/push?${query.toString()}`,
4362
- {
4363
- method: "POST",
4364
- body: JSON.stringify(body)
4365
- }
4366
- );
4356
+ return this.requestApiRoot(`/profile/push?${query.toString()}`, {
4357
+ method: "POST",
4358
+ body: JSON.stringify(body)
4359
+ });
4367
4360
  }
4368
4361
  async upsertProjectGitRemote(input) {
4369
4362
  const project = await this.upsertProject(input);
@@ -4371,58 +4364,39 @@ var OpenPondSandboxClient = class extends OpenPondSandboxInstanceClient {
4371
4364
  }
4372
4365
  getProject(projectId, input) {
4373
4366
  const query = new URLSearchParams({ teamId: input.teamId });
4374
- return this.requestApiRoot(
4375
- `/projects/${encodeURIComponent(projectId)}?${query.toString()}`
4376
- ).then((payload) => payload.project);
4367
+ return this.requestApiRoot(`/projects/${encodeURIComponent(projectId)}?${query.toString()}`).then((payload) => payload.project);
4377
4368
  }
4378
4369
  syncProject(projectId, input) {
4379
4370
  const query = new URLSearchParams({ teamId: input.teamId });
4380
- return this.requestApiRoot(
4381
- `/projects/${encodeURIComponent(projectId)}/sync?${query.toString()}`,
4382
- { method: "POST" }
4383
- ).then((payload) => payload.project);
4371
+ return this.requestApiRoot(`/projects/${encodeURIComponent(projectId)}/sync?${query.toString()}`, { method: "POST" }).then((payload) => payload.project);
4384
4372
  }
4385
4373
  ensureProjectGitRemote(projectId, input) {
4386
4374
  const query = new URLSearchParams({ teamId: input.teamId });
4387
- return this.requestApiRoot(
4388
- `/projects/${encodeURIComponent(projectId)}/git?${query.toString()}`,
4389
- { method: "POST" }
4390
- );
4375
+ return this.requestApiRoot(`/projects/${encodeURIComponent(projectId)}/git?${query.toString()}`, { method: "POST" });
4391
4376
  }
4392
4377
  uploadProjectSource(projectId, input) {
4393
4378
  const query = new URLSearchParams({ teamId: input.teamId });
4394
4379
  const { teamId: _teamId, ...body } = input;
4395
- return this.requestApiRoot(
4396
- `/projects/${encodeURIComponent(projectId)}/source?${query.toString()}`,
4397
- {
4398
- method: "POST",
4399
- body: JSON.stringify(body)
4400
- }
4401
- ).then((payload) => payload.project);
4380
+ return this.requestApiRoot(`/projects/${encodeURIComponent(projectId)}/source?${query.toString()}`, {
4381
+ method: "POST",
4382
+ body: JSON.stringify(body)
4383
+ }).then((payload) => payload.project);
4402
4384
  }
4403
4385
  updateProject(projectId, input) {
4404
4386
  const query = new URLSearchParams({ teamId: input.teamId });
4405
4387
  const { teamId: _teamId, ...body } = input;
4406
- return this.requestApiRoot(
4407
- `/projects/${encodeURIComponent(projectId)}?${query.toString()}`,
4408
- {
4409
- method: "PATCH",
4410
- body: JSON.stringify(body)
4411
- }
4412
- ).then((payload) => payload.project);
4388
+ return this.requestApiRoot(`/projects/${encodeURIComponent(projectId)}?${query.toString()}`, {
4389
+ method: "PATCH",
4390
+ body: JSON.stringify(body)
4391
+ }).then((payload) => payload.project);
4413
4392
  }
4414
4393
  archiveProject(projectId, input) {
4415
4394
  const query = new URLSearchParams({ teamId: input.teamId });
4416
- return this.requestApiRoot(
4417
- `/projects/${encodeURIComponent(projectId)}?${query.toString()}`,
4418
- { method: "DELETE" }
4419
- ).then((payload) => payload.project);
4395
+ return this.requestApiRoot(`/projects/${encodeURIComponent(projectId)}?${query.toString()}`, { method: "DELETE" }).then((payload) => payload.project);
4420
4396
  }
4421
4397
  listAgents(input) {
4422
4398
  const query = new URLSearchParams({ teamId: input.teamId });
4423
- return this.requestApiRoot(
4424
- `/agents?${query.toString()}`
4425
- ).then((payload) => payload.agents);
4399
+ return this.requestApiRoot(`/agents?${query.toString()}`).then((payload) => payload.agents);
4426
4400
  }
4427
4401
  upsertAgent(input) {
4428
4402
  return this.requestApiRoot("/agents", {
@@ -4432,179 +4406,76 @@ var OpenPondSandboxClient = class extends OpenPondSandboxInstanceClient {
4432
4406
  }
4433
4407
  getAgent(agentId, input) {
4434
4408
  const query = new URLSearchParams({ teamId: input.teamId });
4435
- return this.requestApiRoot(
4436
- `/agents/${encodeURIComponent(agentId)}?${query.toString()}`
4437
- ).then((payload) => payload.agent);
4409
+ return this.requestApiRoot(`/agents/${encodeURIComponent(agentId)}?${query.toString()}`).then((payload) => payload.agent);
4438
4410
  }
4439
4411
  archiveAgent(agentId, input) {
4440
4412
  const query = new URLSearchParams({ teamId: input.teamId });
4441
- return this.requestApiRoot(
4442
- `/agents/${encodeURIComponent(agentId)}?${query.toString()}`,
4443
- { method: "DELETE" }
4444
- ).then((payload) => payload.agent);
4413
+ return this.requestApiRoot(`/agents/${encodeURIComponent(agentId)}?${query.toString()}`, { method: "DELETE" }).then((payload) => payload.agent);
4445
4414
  }
4446
4415
  updateAgent(agentId, input) {
4447
4416
  const query = new URLSearchParams({ teamId: input.teamId });
4448
4417
  const { teamId: _teamId, ...body } = input;
4449
- return this.requestApiRoot(
4450
- `/agents/${encodeURIComponent(agentId)}?${query.toString()}`,
4451
- {
4452
- method: "PATCH",
4453
- body: JSON.stringify(body)
4454
- }
4455
- ).then((payload) => payload.agent);
4418
+ return this.requestApiRoot(`/agents/${encodeURIComponent(agentId)}?${query.toString()}`, {
4419
+ method: "PATCH",
4420
+ body: JSON.stringify(body)
4421
+ }).then((payload) => payload.agent);
4456
4422
  }
4457
4423
  runAgent(agentId, input) {
4458
- return this.requestApiRoot(
4459
- `/agents/${encodeURIComponent(agentId)}/run`,
4460
- {
4461
- method: "POST",
4462
- headers: {
4463
- Prefer: "respond-async"
4464
- },
4465
- body: JSON.stringify(input)
4466
- }
4467
- );
4424
+ return this.requestApiRoot(`/agents/${encodeURIComponent(agentId)}/run`, {
4425
+ method: "POST",
4426
+ headers: {
4427
+ Prefer: "respond-async"
4428
+ },
4429
+ body: JSON.stringify(input)
4430
+ });
4468
4431
  }
4469
4432
  getAgentSourceDeployPlan(agentId, input) {
4470
4433
  const query = new URLSearchParams({ teamId: input.teamId });
4471
- return this.requestApiRoot(
4472
- `/agents/${encodeURIComponent(
4473
- agentId
4474
- )}/source/deploy-plan?${query.toString()}`
4475
- ).then((payload) => payload.deployPlan);
4434
+ return this.requestApiRoot(`/agents/${encodeURIComponent(agentId)}/source/deploy-plan?${query.toString()}`).then((payload) => payload.deployPlan);
4476
4435
  }
4477
4436
  listAgentManifestSnapshots(agentId, input) {
4478
4437
  const query = new URLSearchParams({ teamId: input.teamId });
4479
- if (input.limit !== void 0) query.set("limit", String(input.limit));
4480
- return this.requestApiRoot(
4481
- `/agents/${encodeURIComponent(
4482
- agentId
4483
- )}/source/manifest-snapshots?${query.toString()}`
4484
- ).then((payload) => payload.manifestSnapshots);
4438
+ if (input.limit !== void 0)
4439
+ query.set("limit", String(input.limit));
4440
+ return this.requestApiRoot(`/agents/${encodeURIComponent(agentId)}/source/manifest-snapshots?${query.toString()}`).then((payload) => payload.manifestSnapshots);
4485
4441
  }
4486
4442
  requestAgentSourceChecks(agentId, input) {
4487
4443
  const query = new URLSearchParams({ teamId: input.teamId });
4488
4444
  const { teamId: _teamId, ...body } = input;
4489
- return this.requestApiRoot(
4490
- `/agents/${encodeURIComponent(
4491
- agentId
4492
- )}/source/checks?${query.toString()}`,
4493
- {
4494
- method: "POST",
4495
- body: JSON.stringify(body)
4496
- }
4497
- );
4445
+ return this.requestApiRoot(`/agents/${encodeURIComponent(agentId)}/source/checks?${query.toString()}`, {
4446
+ method: "POST",
4447
+ body: JSON.stringify(body)
4448
+ });
4498
4449
  }
4499
4450
  publishAgentSource(agentId, input) {
4500
4451
  const query = new URLSearchParams({ teamId: input.teamId });
4501
4452
  const { teamId: _teamId, ...body } = input;
4502
- return this.requestApiRoot(
4503
- `/agents/${encodeURIComponent(
4504
- agentId
4505
- )}/source/publish?${query.toString()}`,
4506
- {
4507
- method: "POST",
4508
- body: JSON.stringify(body)
4509
- }
4510
- );
4511
- }
4512
- openAgentEditWorkItem(agentId, input) {
4513
- const query = new URLSearchParams({ teamId: input.teamId });
4514
- const { teamId: _teamId, ...body } = input;
4515
- return this.requestApiRoot(
4516
- `/agents/${encodeURIComponent(
4517
- agentId
4518
- )}/edit-work-item?${query.toString()}`,
4519
- {
4520
- method: "POST",
4521
- body: JSON.stringify(body)
4522
- }
4523
- );
4524
- }
4525
- getCodingWorkItem(workItemId, input) {
4526
- const query = new URLSearchParams({ teamId: input.teamId });
4527
- if (input.includeArchived) query.set("includeArchived", "true");
4528
- return this.requestApiRoot(
4529
- `/work-items/${encodeURIComponent(workItemId)}?${query.toString()}`
4530
- ).then((payload) => payload.workItem);
4531
- }
4532
- sendCodingWorkItemChat(workItemId, input) {
4533
- return this.requestApiRoot(
4534
- `/work-items/${encodeURIComponent(workItemId)}/chat`,
4535
- {
4536
- method: "POST",
4537
- body: JSON.stringify(input)
4538
- }
4539
- );
4540
- }
4541
- listCodingWorkItemActivity(workItemId, input) {
4542
- const query = new URLSearchParams({ teamId: input.teamId });
4543
- if (input.limit !== void 0) query.set("limit", String(input.limit));
4544
- return this.requestApiRoot(
4545
- `/work-items/${encodeURIComponent(
4546
- workItemId
4547
- )}/activity?${query.toString()}`
4548
- ).then((payload) => payload.activity);
4549
- }
4550
- getCodingWorkItemStatus(workItemId, input) {
4551
- const query = new URLSearchParams({ teamId: input.teamId });
4552
- if (input.limit !== void 0) query.set("limit", String(input.limit));
4553
- if (input.includeArchived) query.set("includeArchived", "true");
4554
- return this.requestApiRoot(
4555
- `/work-items/${encodeURIComponent(workItemId)}/status?${query.toString()}`
4556
- );
4557
- }
4558
- handleCodingWorkItemInBackground(workItemId, input) {
4559
- return this.requestApiRoot(
4560
- `/work-items/${encodeURIComponent(workItemId)}/handle-background`,
4561
- {
4562
- method: "POST",
4563
- body: JSON.stringify(input)
4564
- }
4565
- );
4566
- }
4567
- promoteCodingWorkItemResult(workItemId, action, input) {
4568
- return this.requestApiRoot(
4569
- `/work-items/${encodeURIComponent(workItemId)}/result/${action}`,
4570
- {
4571
- method: "POST",
4572
- body: JSON.stringify(input)
4573
- }
4574
- ).then((payload) => payload.artifact);
4453
+ return this.requestApiRoot(`/agents/${encodeURIComponent(agentId)}/source/publish?${query.toString()}`, {
4454
+ method: "POST",
4455
+ body: JSON.stringify(body)
4456
+ });
4575
4457
  }
4576
4458
  getMicrosoftTeamsBotOverview(input) {
4577
4459
  const query = new URLSearchParams({ teamId: input.teamId });
4578
- return this.requestApiRoot(
4579
- `/teams/bot/overview?${query.toString()}`
4580
- );
4460
+ return this.requestApiRoot(`/teams/bot/overview?${query.toString()}`);
4581
4461
  }
4582
4462
  bindMicrosoftTeamsBotConversation(input) {
4583
- return this.requestApiRoot(
4584
- "/teams/bot/bindings",
4585
- {
4586
- method: "POST",
4587
- body: JSON.stringify(input)
4588
- }
4589
- );
4463
+ return this.requestApiRoot("/teams/bot/bindings", {
4464
+ method: "POST",
4465
+ body: JSON.stringify(input)
4466
+ });
4590
4467
  }
4591
4468
  rebindMicrosoftTeamsBotConversation(bindingId, input) {
4592
- return this.requestApiRoot(
4593
- `/teams/bot/bindings/${encodeURIComponent(bindingId)}`,
4594
- {
4595
- method: "PATCH",
4596
- body: JSON.stringify(input)
4597
- }
4598
- );
4469
+ return this.requestApiRoot(`/teams/bot/bindings/${encodeURIComponent(bindingId)}`, {
4470
+ method: "PATCH",
4471
+ body: JSON.stringify(input)
4472
+ });
4599
4473
  }
4600
4474
  unlinkMicrosoftTeamsBotConversation(input) {
4601
- return this.requestApiRoot(
4602
- `/teams/bot/bindings/${encodeURIComponent(input.bindingId)}`,
4603
- {
4604
- method: "DELETE",
4605
- body: JSON.stringify({ teamId: input.teamId })
4606
- }
4607
- );
4475
+ return this.requestApiRoot(`/teams/bot/bindings/${encodeURIComponent(input.bindingId)}`, {
4476
+ method: "DELETE",
4477
+ body: JSON.stringify({ teamId: input.teamId })
4478
+ });
4608
4479
  }
4609
4480
  sendMicrosoftTeamsBotDiagnostic(input) {
4610
4481
  return this.requestApiRoot("/teams/bot/diagnostics", {
@@ -4613,13 +4484,10 @@ var OpenPondSandboxClient = class extends OpenPondSandboxInstanceClient {
4613
4484
  });
4614
4485
  }
4615
4486
  sendMicrosoftTeamsBotDiagnosticRun(input) {
4616
- return this.requestApiRoot(
4617
- "/teams/bot/diagnostics/run",
4618
- {
4619
- method: "POST",
4620
- body: JSON.stringify(input)
4621
- }
4622
- );
4487
+ return this.requestApiRoot("/teams/bot/diagnostics/run", {
4488
+ method: "POST",
4489
+ body: JSON.stringify(input)
4490
+ });
4623
4491
  }
4624
4492
  createSandboxRuntime(input) {
4625
4493
  return this.requestApiRoot("/runtimes", {
@@ -4631,121 +4499,115 @@ var OpenPondSandboxClient = class extends OpenPondSandboxInstanceClient {
4631
4499
  return createSandboxRuntimeHandle(this, runtimeId, initial);
4632
4500
  }
4633
4501
  getSandboxRuntime(runtimeId) {
4634
- return this.requestApiRoot(
4635
- `/runtimes/${encodeURIComponent(runtimeId)}`
4636
- ).then((payload) => payload.runtime);
4502
+ return this.requestApiRoot(`/runtimes/${encodeURIComponent(runtimeId)}`).then((payload) => payload.runtime);
4637
4503
  }
4638
4504
  createSandboxRuntimeSandbox(runtimeId, input = {}, options = {}) {
4639
- return this.requestApiRoot(
4640
- `/runtimes/${encodeURIComponent(runtimeId)}/sandbox`,
4641
- {
4642
- method: "POST",
4643
- headers: asyncRequestHeaders(options),
4644
- body: JSON.stringify(input)
4645
- }
4646
- );
4505
+ return this.requestApiRoot(`/runtimes/${encodeURIComponent(runtimeId)}/sandbox`, {
4506
+ method: "POST",
4507
+ headers: asyncRequestHeaders(options),
4508
+ body: JSON.stringify(input)
4509
+ });
4647
4510
  }
4648
4511
  updateSandboxRuntimeStatus(runtimeId, input) {
4649
- return this.requestApiRoot(
4650
- `/runtimes/${encodeURIComponent(runtimeId)}/status`,
4651
- {
4652
- method: "PATCH",
4653
- body: JSON.stringify(input)
4654
- }
4655
- ).then((payload) => payload.runtime);
4512
+ return this.requestApiRoot(`/runtimes/${encodeURIComponent(runtimeId)}/status`, {
4513
+ method: "PATCH",
4514
+ body: JSON.stringify(input)
4515
+ }).then((payload) => payload.runtime);
4656
4516
  }
4657
4517
  listSandboxRuntimeEvents(runtimeId) {
4658
- return this.requestApiRoot(
4659
- `/runtimes/${encodeURIComponent(runtimeId)}/events`
4660
- );
4518
+ return this.requestApiRoot(`/runtimes/${encodeURIComponent(runtimeId)}/events`);
4661
4519
  }
4662
4520
  emitSandboxRuntimeEvent(runtimeId, input) {
4663
- return this.requestApiRoot(
4664
- `/runtimes/${encodeURIComponent(runtimeId)}/events`,
4665
- {
4666
- method: "POST",
4667
- body: JSON.stringify(input)
4668
- }
4669
- );
4521
+ return this.requestApiRoot(`/runtimes/${encodeURIComponent(runtimeId)}/events`, {
4522
+ method: "POST",
4523
+ body: JSON.stringify(input)
4524
+ });
4670
4525
  }
4671
4526
  checkpointSandboxRuntime(runtimeId, input) {
4672
- return this.requestApiRoot(
4673
- `/runtimes/${encodeURIComponent(runtimeId)}/checkpoints`,
4674
- {
4675
- method: "POST",
4676
- body: JSON.stringify(input)
4677
- }
4678
- ).then((payload) => payload.runtime);
4527
+ return this.requestApiRoot(`/runtimes/${encodeURIComponent(runtimeId)}/checkpoints`, {
4528
+ method: "POST",
4529
+ body: JSON.stringify(input)
4530
+ }).then((payload) => payload.runtime);
4679
4531
  }
4680
4532
  promoteSandboxRuntime(runtimeId, input, options = {}) {
4681
4533
  const query = new URLSearchParams();
4682
- if (options.teamId) query.set("teamId", options.teamId);
4683
- return this.requestApiRoot(
4684
- `/runtimes/${encodeURIComponent(runtimeId)}/promote${query.size > 0 ? `?${query.toString()}` : ""}`,
4685
- {
4686
- method: "POST",
4687
- body: JSON.stringify(input)
4688
- }
4689
- );
4534
+ if (options.teamId)
4535
+ query.set("teamId", options.teamId);
4536
+ return this.requestApiRoot(`/runtimes/${encodeURIComponent(runtimeId)}/promote${query.size > 0 ? `?${query.toString()}` : ""}`, {
4537
+ method: "POST",
4538
+ body: JSON.stringify(input)
4539
+ });
4690
4540
  }
4691
4541
  preserveSandboxRuntimeSource(runtimeId, input = {}, options = {}) {
4692
4542
  const query = new URLSearchParams();
4693
- if (options.teamId) query.set("teamId", options.teamId);
4694
- return this.requestApiRoot(
4695
- `/runtimes/${encodeURIComponent(runtimeId)}/preserve-source${query.size > 0 ? `?${query.toString()}` : ""}`,
4696
- {
4697
- method: "POST",
4698
- body: JSON.stringify(input)
4699
- }
4700
- );
4543
+ if (options.teamId)
4544
+ query.set("teamId", options.teamId);
4545
+ return this.requestApiRoot(`/runtimes/${encodeURIComponent(runtimeId)}/preserve-source${query.size > 0 ? `?${query.toString()}` : ""}`, {
4546
+ method: "POST",
4547
+ body: JSON.stringify(input)
4548
+ });
4701
4549
  }
4702
4550
  forkSnapshot(snapshotId, input = {}, options = {}) {
4703
4551
  const query = new URLSearchParams();
4704
- if (input.teamId) query.set("teamId", input.teamId);
4705
- if (input.projectId) query.set("projectId", input.projectId);
4706
- if (options.async) query.set("async", "1");
4552
+ if (input.teamId)
4553
+ query.set("teamId", input.teamId);
4554
+ if (input.projectId)
4555
+ query.set("projectId", input.projectId);
4556
+ if (options.async)
4557
+ query.set("async", "1");
4707
4558
  const { teamId: _teamId, projectId: _projectId, ...body } = input;
4708
- return this.request(
4709
- `/catalog/snapshots/${encodeURIComponent(snapshotId)}/fork${query.size > 0 ? `?${query.toString()}` : ""}`,
4710
- {
4711
- method: "POST",
4712
- headers: options.async ? { Prefer: "respond-async" } : void 0,
4713
- body: JSON.stringify({
4714
- ...body,
4715
- snapshotId
4716
- })
4717
- }
4718
- );
4559
+ return this.request(`/catalog/snapshots/${encodeURIComponent(snapshotId)}/fork${query.size > 0 ? `?${query.toString()}` : ""}`, {
4560
+ method: "POST",
4561
+ headers: options.async ? { Prefer: "respond-async" } : void 0,
4562
+ body: JSON.stringify({
4563
+ ...body,
4564
+ snapshotId
4565
+ })
4566
+ });
4719
4567
  }
4720
4568
  templates(input = {}) {
4721
4569
  const query = new URLSearchParams();
4722
- if (input.teamId) query.set("teamId", input.teamId);
4723
- if (input.projectId) query.set("projectId", input.projectId);
4724
- if (input.q) query.set("q", input.q);
4725
- if (input.name) query.set("name", input.name);
4726
- if (input.version) query.set("version", input.version);
4727
- if (input.visibility) query.set("visibility", input.visibility);
4728
- if (input.tag) query.set("tag", input.tag);
4729
- if (input.useCase) query.set("useCase", input.useCase);
4730
- if (input.limit) query.set("limit", String(input.limit));
4731
- return this.request(
4732
- `/templates${query.size > 0 ? `?${query.toString()}` : ""}`
4733
- );
4570
+ if (input.teamId)
4571
+ query.set("teamId", input.teamId);
4572
+ if (input.projectId)
4573
+ query.set("projectId", input.projectId);
4574
+ if (input.q)
4575
+ query.set("q", input.q);
4576
+ if (input.name)
4577
+ query.set("name", input.name);
4578
+ if (input.version)
4579
+ query.set("version", input.version);
4580
+ if (input.visibility)
4581
+ query.set("visibility", input.visibility);
4582
+ if (input.tag)
4583
+ query.set("tag", input.tag);
4584
+ if (input.useCase)
4585
+ query.set("useCase", input.useCase);
4586
+ if (input.limit)
4587
+ query.set("limit", String(input.limit));
4588
+ return this.request(`/templates${query.size > 0 ? `?${query.toString()}` : ""}`);
4734
4589
  }
4735
4590
  publishedSnapshots(input = {}) {
4736
4591
  const query = new URLSearchParams();
4737
- if (input.teamId) query.set("teamId", input.teamId);
4738
- if (input.projectId) query.set("projectId", input.projectId);
4739
- if (input.q) query.set("q", input.q);
4740
- if (input.name) query.set("name", input.name);
4741
- if (input.version) query.set("version", input.version);
4742
- if (input.visibility) query.set("visibility", input.visibility);
4743
- if (input.tag) query.set("tag", input.tag);
4744
- if (input.useCase) query.set("useCase", input.useCase);
4745
- if (input.limit) query.set("limit", String(input.limit));
4746
- return this.request(
4747
- `/published-snapshots${query.size > 0 ? `?${query.toString()}` : ""}`
4748
- ).then((payload) => {
4592
+ if (input.teamId)
4593
+ query.set("teamId", input.teamId);
4594
+ if (input.projectId)
4595
+ query.set("projectId", input.projectId);
4596
+ if (input.q)
4597
+ query.set("q", input.q);
4598
+ if (input.name)
4599
+ query.set("name", input.name);
4600
+ if (input.version)
4601
+ query.set("version", input.version);
4602
+ if (input.visibility)
4603
+ query.set("visibility", input.visibility);
4604
+ if (input.tag)
4605
+ query.set("tag", input.tag);
4606
+ if (input.useCase)
4607
+ query.set("useCase", input.useCase);
4608
+ if (input.limit)
4609
+ query.set("limit", String(input.limit));
4610
+ return this.request(`/published-snapshots${query.size > 0 ? `?${query.toString()}` : ""}`).then((payload) => {
4749
4611
  const publishedSnapshots = payload.publishedSnapshots ?? payload.templates;
4750
4612
  return {
4751
4613
  ...payload,
@@ -4756,29 +4618,27 @@ var OpenPondSandboxClient = class extends OpenPondSandboxInstanceClient {
4756
4618
  }
4757
4619
  launchTemplate(input) {
4758
4620
  const query = new URLSearchParams();
4759
- if (input.teamId) query.set("teamId", input.teamId);
4760
- if (input.projectId) query.set("projectId", input.projectId);
4621
+ if (input.teamId)
4622
+ query.set("teamId", input.teamId);
4623
+ if (input.projectId)
4624
+ query.set("projectId", input.projectId);
4761
4625
  const { teamId: _teamId, projectId: _projectId, ...body } = input;
4762
- return this.request(
4763
- `/templates/launch${query.size > 0 ? `?${query.toString()}` : ""}`,
4764
- {
4765
- method: "POST",
4766
- body: JSON.stringify(body)
4767
- }
4768
- );
4626
+ return this.request(`/templates/launch${query.size > 0 ? `?${query.toString()}` : ""}`, {
4627
+ method: "POST",
4628
+ body: JSON.stringify(body)
4629
+ });
4769
4630
  }
4770
4631
  runPublishedSnapshot(input) {
4771
4632
  const query = new URLSearchParams();
4772
- if (input.teamId) query.set("teamId", input.teamId);
4773
- if (input.projectId) query.set("projectId", input.projectId);
4633
+ if (input.teamId)
4634
+ query.set("teamId", input.teamId);
4635
+ if (input.projectId)
4636
+ query.set("projectId", input.projectId);
4774
4637
  const { teamId: _teamId, projectId: _projectId, ...body } = input;
4775
- return this.request(
4776
- `/published-snapshots/launch${query.size > 0 ? `?${query.toString()}` : ""}`,
4777
- {
4778
- method: "POST",
4779
- body: JSON.stringify(body)
4780
- }
4781
- ).then((payload) => {
4638
+ return this.request(`/published-snapshots/launch${query.size > 0 ? `?${query.toString()}` : ""}`, {
4639
+ method: "POST",
4640
+ body: JSON.stringify(body)
4641
+ }).then((payload) => {
4782
4642
  const publishedSnapshot = payload.publishedSnapshot ?? payload.template;
4783
4643
  return {
4784
4644
  ...payload,
@@ -4789,134 +4649,94 @@ var OpenPondSandboxClient = class extends OpenPondSandboxInstanceClient {
4789
4649
  }
4790
4650
  listSchedules(input = {}) {
4791
4651
  const query = new URLSearchParams();
4792
- if (input.teamId) query.set("teamId", input.teamId);
4793
- if (input.projectId) query.set("projectId", input.projectId);
4652
+ if (input.teamId)
4653
+ query.set("teamId", input.teamId);
4654
+ if (input.projectId)
4655
+ query.set("projectId", input.projectId);
4794
4656
  if (input.sourceSandboxId)
4795
4657
  query.set("sourceSandboxId", input.sourceSandboxId);
4796
- return this.request(
4797
- `/schedules${query.size > 0 ? `?${query.toString()}` : ""}`
4798
- );
4658
+ return this.request(`/schedules${query.size > 0 ? `?${query.toString()}` : ""}`);
4799
4659
  }
4800
4660
  createSchedule(input) {
4801
4661
  const query = new URLSearchParams();
4802
- if (input.projectId) query.set("projectId", input.projectId);
4662
+ if (input.projectId)
4663
+ query.set("projectId", input.projectId);
4803
4664
  const { projectId: _projectId, ...body } = input;
4804
- return this.request(
4805
- `/schedules${query.size > 0 ? `?${query.toString()}` : ""}`,
4806
- {
4807
- method: "POST",
4808
- body: JSON.stringify(body)
4809
- }
4810
- );
4665
+ return this.request(`/schedules${query.size > 0 ? `?${query.toString()}` : ""}`, {
4666
+ method: "POST",
4667
+ body: JSON.stringify(body)
4668
+ });
4811
4669
  }
4812
4670
  getSchedule(scheduleId) {
4813
- return this.request(
4814
- `/schedules/${encodeURIComponent(scheduleId)}`
4815
- );
4671
+ return this.request(`/schedules/${encodeURIComponent(scheduleId)}`);
4816
4672
  }
4817
4673
  updateSchedule(scheduleId, input) {
4818
- return this.request(
4819
- `/schedules/${encodeURIComponent(scheduleId)}`,
4820
- {
4821
- method: "PATCH",
4822
- body: JSON.stringify(input)
4823
- }
4824
- );
4674
+ return this.request(`/schedules/${encodeURIComponent(scheduleId)}`, {
4675
+ method: "PATCH",
4676
+ body: JSON.stringify(input)
4677
+ });
4825
4678
  }
4826
4679
  deleteSchedule(scheduleId) {
4827
- return this.request(
4828
- `/schedules/${encodeURIComponent(scheduleId)}`,
4829
- {
4830
- method: "DELETE"
4831
- }
4832
- );
4680
+ return this.request(`/schedules/${encodeURIComponent(scheduleId)}`, {
4681
+ method: "DELETE"
4682
+ });
4833
4683
  }
4834
4684
  listScheduleRuns(scheduleId, input = {}) {
4835
4685
  const query = new URLSearchParams();
4836
- if (input.limit !== void 0) query.set("limit", String(input.limit));
4837
- return this.request(
4838
- `/schedules/${encodeURIComponent(scheduleId)}/runs${query.size > 0 ? `?${query.toString()}` : ""}`
4839
- );
4686
+ if (input.limit !== void 0)
4687
+ query.set("limit", String(input.limit));
4688
+ return this.request(`/schedules/${encodeURIComponent(scheduleId)}/runs${query.size > 0 ? `?${query.toString()}` : ""}`);
4840
4689
  }
4841
4690
  runScheduleNow(scheduleId, input = {}) {
4842
- return this.request(
4843
- `/schedules/${encodeURIComponent(scheduleId)}/run`,
4844
- {
4845
- method: "POST",
4846
- body: JSON.stringify(input)
4847
- }
4848
- );
4691
+ return this.request(`/schedules/${encodeURIComponent(scheduleId)}/run`, {
4692
+ method: "POST",
4693
+ body: JSON.stringify(input)
4694
+ });
4849
4695
  }
4850
4696
  listTemplateBuilds(input) {
4851
4697
  const query = new URLSearchParams({ teamId: input.teamId });
4852
- return this.requestApiRoot(
4853
- `/sandbox-template-builds?${query.toString()}`
4854
- ).then((payload) => payload.builds);
4698
+ return this.requestApiRoot(`/sandbox-template-builds?${query.toString()}`).then((payload) => payload.builds);
4855
4699
  }
4856
4700
  createTemplateBuild(input) {
4857
- return this.requestApiRoot(
4858
- "/sandbox-template-builds",
4859
- {
4860
- method: "POST",
4861
- body: JSON.stringify(input)
4862
- }
4863
- ).then((payload) => payload.build);
4701
+ return this.requestApiRoot("/sandbox-template-builds", {
4702
+ method: "POST",
4703
+ body: JSON.stringify(input)
4704
+ }).then((payload) => payload.build);
4864
4705
  }
4865
4706
  getTemplateBuild(buildId) {
4866
- return this.requestApiRoot(
4867
- `/sandbox-template-builds/${encodeURIComponent(buildId)}`
4868
- ).then((payload) => payload.build);
4707
+ return this.requestApiRoot(`/sandbox-template-builds/${encodeURIComponent(buildId)}`).then((payload) => payload.build);
4869
4708
  }
4870
4709
  getTemplateBuildLogs(buildId) {
4871
- return this.requestApiRoot(
4872
- `/sandbox-template-builds/${encodeURIComponent(buildId)}/logs`
4873
- );
4710
+ return this.requestApiRoot(`/sandbox-template-builds/${encodeURIComponent(buildId)}/logs`);
4874
4711
  }
4875
4712
  cancelTemplateBuild(buildId) {
4876
- return this.requestApiRoot(
4877
- `/sandbox-template-builds/${encodeURIComponent(buildId)}/cancel`,
4878
- {
4879
- method: "POST"
4880
- }
4881
- ).then((payload) => payload.build);
4713
+ return this.requestApiRoot(`/sandbox-template-builds/${encodeURIComponent(buildId)}/cancel`, {
4714
+ method: "POST"
4715
+ }).then((payload) => payload.build);
4882
4716
  }
4883
4717
  listPublishedSnapshotBuilds(input) {
4884
4718
  const query = new URLSearchParams({ teamId: input.teamId });
4885
- return this.requestApiRoot(
4886
- `/published-snapshot-builds?${query.toString()}`
4887
- ).then((payload) => payload.builds);
4719
+ return this.requestApiRoot(`/published-snapshot-builds?${query.toString()}`).then((payload) => payload.builds);
4888
4720
  }
4889
4721
  createPublishedSnapshotBuild(input) {
4890
- return this.requestApiRoot(
4891
- "/published-snapshot-builds",
4892
- {
4893
- method: "POST",
4894
- body: JSON.stringify(input)
4895
- }
4896
- ).then((payload) => payload.build);
4722
+ return this.requestApiRoot("/published-snapshot-builds", {
4723
+ method: "POST",
4724
+ body: JSON.stringify(input)
4725
+ }).then((payload) => payload.build);
4897
4726
  }
4898
4727
  getPublishedSnapshotBuild(buildId) {
4899
- return this.requestApiRoot(
4900
- `/published-snapshot-builds/${encodeURIComponent(buildId)}`
4901
- ).then((payload) => payload.build);
4728
+ return this.requestApiRoot(`/published-snapshot-builds/${encodeURIComponent(buildId)}`).then((payload) => payload.build);
4902
4729
  }
4903
4730
  getPublishedSnapshotBuildLogs(buildId) {
4904
- return this.requestApiRoot(
4905
- `/published-snapshot-builds/${encodeURIComponent(buildId)}/logs`
4906
- );
4731
+ return this.requestApiRoot(`/published-snapshot-builds/${encodeURIComponent(buildId)}/logs`);
4907
4732
  }
4908
4733
  cancelPublishedSnapshotBuild(buildId) {
4909
- return this.requestApiRoot(
4910
- `/published-snapshot-builds/${encodeURIComponent(buildId)}/cancel`,
4911
- {
4912
- method: "POST"
4913
- }
4914
- ).then((payload) => payload.build);
4734
+ return this.requestApiRoot(`/published-snapshot-builds/${encodeURIComponent(buildId)}/cancel`, {
4735
+ method: "POST"
4736
+ }).then((payload) => payload.build);
4915
4737
  }
4916
4738
  listOrganizations() {
4917
- return this.requestApiRoot(
4918
- "/organizations"
4919
- ).then((payload) => payload.organizations ?? payload.teams ?? []);
4739
+ return this.requestApiRoot("/organizations").then((payload) => payload.organizations ?? payload.teams ?? []);
4920
4740
  }
4921
4741
  createOrganization(input) {
4922
4742
  return this.requestApiRoot("/organizations", {
@@ -4925,136 +4745,112 @@ var OpenPondSandboxClient = class extends OpenPondSandboxInstanceClient {
4925
4745
  }).then((payload) => payload.organization);
4926
4746
  }
4927
4747
  getOrganization(slug2) {
4928
- return this.requestApiRoot(
4929
- `/organizations/${encodeURIComponent(slug2)}`
4930
- ).then((payload) => payload.organization);
4748
+ return this.requestApiRoot(`/organizations/${encodeURIComponent(slug2)}`).then((payload) => payload.organization);
4931
4749
  }
4932
4750
  updateOrganization(slug2, input) {
4933
- return this.requestApiRoot(
4934
- `/organizations/${encodeURIComponent(slug2)}`,
4935
- {
4936
- method: "PATCH",
4937
- body: JSON.stringify(input)
4938
- }
4939
- ).then((payload) => payload.organization);
4751
+ return this.requestApiRoot(`/organizations/${encodeURIComponent(slug2)}`, {
4752
+ method: "PATCH",
4753
+ body: JSON.stringify(input)
4754
+ }).then((payload) => payload.organization);
4940
4755
  }
4941
4756
  listOrganizationMembers(slug2) {
4942
- return this.requestApiRoot(
4943
- `/organizations/${encodeURIComponent(slug2)}/members`
4944
- ).then((payload) => payload.members);
4757
+ return this.requestApiRoot(`/organizations/${encodeURIComponent(slug2)}/members`).then((payload) => payload.members);
4945
4758
  }
4946
4759
  upsertOrganizationMember(slug2, input) {
4947
- return this.requestApiRoot(
4948
- `/organizations/${encodeURIComponent(slug2)}/members`,
4949
- {
4950
- method: "POST",
4951
- body: JSON.stringify(input)
4952
- }
4953
- ).then((payload) => payload.member);
4760
+ return this.requestApiRoot(`/organizations/${encodeURIComponent(slug2)}/members`, {
4761
+ method: "POST",
4762
+ body: JSON.stringify(input)
4763
+ }).then((payload) => payload.member);
4954
4764
  }
4955
4765
  getOrganizationMcpServer(slug2) {
4956
- return this.requestApiRoot(
4957
- `/organizations/${encodeURIComponent(slug2)}/mcp-server`
4958
- ).then((payload) => payload.mcpServer);
4766
+ return this.requestApiRoot(`/organizations/${encodeURIComponent(slug2)}/mcp-server`).then((payload) => payload.mcpServer);
4959
4767
  }
4960
4768
  generateOrganizationMcpServer(slug2, input = {}) {
4961
- return this.requestApiRoot(
4962
- `/organizations/${encodeURIComponent(slug2)}/mcp-server`,
4963
- {
4964
- method: "POST",
4965
- body: JSON.stringify(input)
4966
- }
4967
- ).then((payload) => payload.mcpServer);
4769
+ return this.requestApiRoot(`/organizations/${encodeURIComponent(slug2)}/mcp-server`, {
4770
+ method: "POST",
4771
+ body: JSON.stringify(input)
4772
+ }).then((payload) => payload.mcpServer);
4968
4773
  }
4969
4774
  rotateOrganizationMcpServer(slug2) {
4970
- return this.requestApiRoot(
4971
- `/organizations/${encodeURIComponent(slug2)}/mcp-server/rotate`,
4972
- {
4973
- method: "POST"
4974
- }
4975
- ).then((payload) => payload.mcpServer);
4775
+ return this.requestApiRoot(`/organizations/${encodeURIComponent(slug2)}/mcp-server/rotate`, {
4776
+ method: "POST"
4777
+ }).then((payload) => payload.mcpServer);
4976
4778
  }
4977
4779
  disableOrganizationMcpServer(slug2) {
4978
- return this.requestApiRoot(
4979
- `/organizations/${encodeURIComponent(slug2)}/mcp-server/disable`,
4980
- {
4981
- method: "POST"
4982
- }
4983
- ).then((payload) => payload.mcpServer);
4780
+ return this.requestApiRoot(`/organizations/${encodeURIComponent(slug2)}/mcp-server/disable`, {
4781
+ method: "POST"
4782
+ }).then((payload) => payload.mcpServer);
4984
4783
  }
4985
4784
  enableOrganizationMcpServer(slug2) {
4986
- return this.requestApiRoot(
4987
- `/organizations/${encodeURIComponent(slug2)}/mcp-server/enable`,
4988
- {
4989
- method: "POST"
4990
- }
4991
- ).then((payload) => payload.mcpServer);
4785
+ return this.requestApiRoot(`/organizations/${encodeURIComponent(slug2)}/mcp-server/enable`, {
4786
+ method: "POST"
4787
+ }).then((payload) => payload.mcpServer);
4992
4788
  }
4993
4789
  startReplay(input) {
4994
4790
  const query = new URLSearchParams();
4995
- if (input.teamId) query.set("teamId", input.teamId);
4996
- if (input.projectId) query.set("projectId", input.projectId);
4791
+ if (input.teamId)
4792
+ query.set("teamId", input.teamId);
4793
+ if (input.projectId)
4794
+ query.set("projectId", input.projectId);
4997
4795
  const { teamId: _teamId, projectId: _projectId, ...body } = input;
4998
- return this.requestApiRoot(
4999
- `/sandbox-replays${query.size > 0 ? `?${query.toString()}` : ""}`,
5000
- {
5001
- method: "POST",
5002
- body: JSON.stringify(body)
5003
- }
5004
- );
4796
+ return this.requestApiRoot(`/sandbox-replays${query.size > 0 ? `?${query.toString()}` : ""}`, {
4797
+ method: "POST",
4798
+ body: JSON.stringify(body)
4799
+ });
5005
4800
  }
5006
4801
  listReplays(input = {}) {
5007
4802
  const query = new URLSearchParams();
5008
- if (input.teamId) query.set("teamId", input.teamId);
5009
- if (input.projectId) query.set("projectId", input.projectId);
5010
- return this.requestApiRoot(
5011
- `/sandbox-replays${query.size > 0 ? `?${query.toString()}` : ""}`
5012
- );
4803
+ if (input.teamId)
4804
+ query.set("teamId", input.teamId);
4805
+ if (input.projectId)
4806
+ query.set("projectId", input.projectId);
4807
+ return this.requestApiRoot(`/sandbox-replays${query.size > 0 ? `?${query.toString()}` : ""}`);
5013
4808
  }
5014
4809
  getReplay(replayId, input = {}) {
5015
4810
  const query = new URLSearchParams();
5016
- if (input.teamId) query.set("teamId", input.teamId);
5017
- if (input.projectId) query.set("projectId", input.projectId);
5018
- return this.requestApiRoot(
5019
- `/sandbox-replays/${encodeURIComponent(replayId)}${query.size > 0 ? `?${query.toString()}` : ""}`
5020
- );
4811
+ if (input.teamId)
4812
+ query.set("teamId", input.teamId);
4813
+ if (input.projectId)
4814
+ query.set("projectId", input.projectId);
4815
+ return this.requestApiRoot(`/sandbox-replays/${encodeURIComponent(replayId)}${query.size > 0 ? `?${query.toString()}` : ""}`);
5021
4816
  }
5022
4817
  getReplayLogs(replayId, input = {}) {
5023
4818
  const query = new URLSearchParams();
5024
- if (input.teamId) query.set("teamId", input.teamId);
5025
- if (input.projectId) query.set("projectId", input.projectId);
5026
- return this.requestApiRoot(
5027
- `/sandbox-replays/${encodeURIComponent(replayId)}/logs${query.size > 0 ? `?${query.toString()}` : ""}`
5028
- );
4819
+ if (input.teamId)
4820
+ query.set("teamId", input.teamId);
4821
+ if (input.projectId)
4822
+ query.set("projectId", input.projectId);
4823
+ return this.requestApiRoot(`/sandbox-replays/${encodeURIComponent(replayId)}/logs${query.size > 0 ? `?${query.toString()}` : ""}`);
5029
4824
  }
5030
4825
  getReplayArtifacts(replayId, input = {}) {
5031
4826
  const query = new URLSearchParams();
5032
- if (input.teamId) query.set("teamId", input.teamId);
5033
- if (input.projectId) query.set("projectId", input.projectId);
5034
- return this.requestApiRoot(
5035
- `/sandbox-replays/${encodeURIComponent(replayId)}/artifacts${query.size > 0 ? `?${query.toString()}` : ""}`
5036
- );
4827
+ if (input.teamId)
4828
+ query.set("teamId", input.teamId);
4829
+ if (input.projectId)
4830
+ query.set("projectId", input.projectId);
4831
+ return this.requestApiRoot(`/sandbox-replays/${encodeURIComponent(replayId)}/artifacts${query.size > 0 ? `?${query.toString()}` : ""}`);
5037
4832
  }
5038
4833
  cancelReplay(replayId, input = {}) {
5039
4834
  const query = new URLSearchParams();
5040
- if (input.teamId) query.set("teamId", input.teamId);
5041
- if (input.projectId) query.set("projectId", input.projectId);
5042
- return this.requestApiRoot(
5043
- `/sandbox-replays/${encodeURIComponent(replayId)}/cancel${query.size > 0 ? `?${query.toString()}` : ""}`,
5044
- {
5045
- method: "POST"
5046
- }
5047
- );
4835
+ if (input.teamId)
4836
+ query.set("teamId", input.teamId);
4837
+ if (input.projectId)
4838
+ query.set("projectId", input.projectId);
4839
+ return this.requestApiRoot(`/sandbox-replays/${encodeURIComponent(replayId)}/cancel${query.size > 0 ? `?${query.toString()}` : ""}`, {
4840
+ method: "POST"
4841
+ });
5048
4842
  }
5049
4843
  integrationConnections(input = {}) {
5050
4844
  const query = new URLSearchParams();
5051
- if (input.teamId) query.set("teamId", input.teamId);
5052
- if (input.projectId) query.set("projectId", input.projectId);
5053
- if (input.agentId) query.set("agentId", input.agentId);
5054
- if (input.status) query.set("status", input.status);
5055
- return this.requestApiRoot(
5056
- `/integrations/connections${query.size > 0 ? `?${query.toString()}` : ""}`
5057
- );
4845
+ if (input.teamId)
4846
+ query.set("teamId", input.teamId);
4847
+ if (input.projectId)
4848
+ query.set("projectId", input.projectId);
4849
+ if (input.agentId)
4850
+ query.set("agentId", input.agentId);
4851
+ if (input.status)
4852
+ query.set("status", input.status);
4853
+ return this.requestApiRoot(`/integrations/connections${query.size > 0 ? `?${query.toString()}` : ""}`);
5058
4854
  }
5059
4855
  mcpServerConfig() {
5060
4856
  return {
@@ -5074,6 +4870,34 @@ function createOpenPondSandboxClient(options) {
5074
4870
  return new OpenPondSandboxClient(options);
5075
4871
  }
5076
4872
 
4873
+ // ../../packages/sdk/src/work.ts
4874
+ var MAX_WORK_INPUT_BYTES = 100 * 1024 * 1024;
4875
+ var WORK_OUTPUT_MIME_TYPES = Object.freeze({
4876
+ ".avif": "image/avif",
4877
+ ".csv": "text/csv",
4878
+ ".docx": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
4879
+ ".gif": "image/gif",
4880
+ ".html": "text/html",
4881
+ ".jpeg": "image/jpeg",
4882
+ ".jpg": "image/jpeg",
4883
+ ".json": "application/json",
4884
+ ".m4a": "audio/mp4",
4885
+ ".md": "text/markdown",
4886
+ ".mov": "video/quicktime",
4887
+ ".mp3": "audio/mpeg",
4888
+ ".mp4": "video/mp4",
4889
+ ".pdf": "application/pdf",
4890
+ ".png": "image/png",
4891
+ ".pptx": "application/vnd.openxmlformats-officedocument.presentationml.presentation",
4892
+ ".svg": "image/svg+xml",
4893
+ ".tsv": "text/tab-separated-values",
4894
+ ".txt": "text/plain",
4895
+ ".wav": "audio/wav",
4896
+ ".webm": "video/webm",
4897
+ ".webp": "image/webp",
4898
+ ".xlsx": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
4899
+ });
4900
+
5077
4901
  // ../../node_modules/.pnpm/js-yaml@4.3.0/node_modules/js-yaml/dist/js-yaml.mjs
5078
4902
  function getDefaultExportFromCjs(x) {
5079
4903
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
@@ -23428,6 +23252,7 @@ function slug(value) {
23428
23252
 
23429
23253
  // ../../packages/cloud/src/profile/local-profile.ts
23430
23254
  import { createRequire } from "node:module";
23255
+ import { createHash as createHash4, randomUUID as randomUUID3 } from "node:crypto";
23431
23256
  import { spawn as spawn2 } from "node:child_process";
23432
23257
  import { existsSync as existsSync4 } from "node:fs";
23433
23258
  import {
@@ -23435,6 +23260,8 @@ import {
23435
23260
  mkdir,
23436
23261
  readFile as readFile5,
23437
23262
  readdir as readdir2,
23263
+ rename,
23264
+ rm,
23438
23265
  symlink,
23439
23266
  writeFile as writeFile2
23440
23267
  } from "node:fs/promises";
@@ -23504,6 +23331,7 @@ import path4 from "node:path";
23504
23331
  var AGENT_MANIFEST_PATH = ".openpond/agent-manifest.json";
23505
23332
  var ACTION_REGISTRY_PATH = ".openpond/action-registry.json";
23506
23333
  var SOURCE_UPLOAD_METADATA_PATH = ".openpond/source-upload-metadata.json";
23334
+ var AGENT_PACKAGE_ORIGIN_PATH = ".openpond/agent-package-origin.json";
23507
23335
  async function loadProfileActionCatalog(sourcePath) {
23508
23336
  return loadProfileActionCatalogSource({
23509
23337
  agentId: "default",
@@ -23530,7 +23358,9 @@ async function loadProfileActionCatalogForSources(sources) {
23530
23358
  ...sources.filter((source) => source.preferred),
23531
23359
  ...sources.filter((source) => !source.preferred)
23532
23360
  ];
23533
- const results = await Promise.all(sortedSources.map(loadProfileActionCatalogSource));
23361
+ const results = await Promise.all(
23362
+ sortedSources.map(loadProfileActionCatalogSource)
23363
+ );
23534
23364
  const byId = /* @__PURE__ */ new Map();
23535
23365
  const actionCatalog = [];
23536
23366
  for (const result of results) {
@@ -23541,7 +23371,9 @@ async function loadProfileActionCatalogForSources(sources) {
23541
23371
  actionCatalog.push(next);
23542
23372
  }
23543
23373
  }
23544
- const generatedAt = latestIso(results.map((result) => result.catalog.generatedAt));
23374
+ const generatedAt = latestIso(
23375
+ results.map((result) => result.catalog.generatedAt)
23376
+ );
23545
23377
  const errors = results.map((result) => result.catalog.error).filter(Boolean);
23546
23378
  return {
23547
23379
  catalog: {
@@ -23553,20 +23385,37 @@ async function loadProfileActionCatalogForSources(sources) {
23553
23385
  error: errors.length > 0 ? errors.join("; ") : null
23554
23386
  },
23555
23387
  actionCatalog,
23556
- sourceSetupRequirements: results.flatMap((result) => result.sourceSetupRequirements)
23388
+ sourceSetupRequirements: results.flatMap(
23389
+ (result) => result.sourceSetupRequirements
23390
+ )
23557
23391
  };
23558
23392
  }
23559
23393
  async function loadProfileActionCatalogSource(source) {
23560
23394
  const sourcePath = source.sourcePath;
23561
23395
  const manifestPath = path4.join(sourcePath, AGENT_MANIFEST_PATH);
23562
23396
  const registryPath = path4.join(sourcePath, ACTION_REGISTRY_PATH);
23563
- const sourceUploadMetadataPath = path4.join(sourcePath, SOURCE_UPLOAD_METADATA_PATH);
23397
+ const sourceUploadMetadataPath = path4.join(
23398
+ sourcePath,
23399
+ SOURCE_UPLOAD_METADATA_PATH
23400
+ );
23401
+ const agentPackageOriginPath = path4.join(
23402
+ sourcePath,
23403
+ AGENT_PACKAGE_ORIGIN_PATH
23404
+ );
23564
23405
  try {
23565
23406
  const manifest = await readJsonIfExists(manifestPath);
23566
23407
  const registry2 = await readJsonIfExists(registryPath);
23567
- const sourceUploadMetadata = await readJsonIfExists(sourceUploadMetadataPath);
23408
+ const sourceUploadMetadata = await readJsonIfExists(
23409
+ sourceUploadMetadataPath
23410
+ );
23411
+ const agentPackageOrigin = asRecord2(
23412
+ await readJsonIfExists(agentPackageOriginPath)
23413
+ );
23414
+ const namedInputSchemas = asRecord2(asRecord2(manifest)?.inputSchemas);
23568
23415
  const sourceSetupRequirements = recordArray(asRecord2(sourceUploadMetadata)?.setupRequirements) ?? [];
23569
- const sourceRequirementsByAction = sourceSetupRequirementsByAction(sourceSetupRequirements);
23416
+ const sourceRequirementsByAction = sourceSetupRequirementsByAction(
23417
+ sourceSetupRequirements
23418
+ );
23570
23419
  const byId = /* @__PURE__ */ new Map();
23571
23420
  for (const record3 of [
23572
23421
  ...records(asRecord2(manifest)?.actionCatalog),
@@ -23594,14 +23443,17 @@ async function loadProfileActionCatalogSource(source) {
23594
23443
  label: text(record3.label) ?? existing?.label ?? titleFromActionId(id),
23595
23444
  description: text(record3.description) ?? existing?.description ?? null,
23596
23445
  visibility: text(record3.visibility) ?? existing?.visibility ?? "default",
23597
- inputSchema: schemaValue(record3.inputSchema) ?? existing?.inputSchema ?? null,
23446
+ inputSchema: resolvedSchemaValue(record3.inputSchema, namedInputSchemas) ?? existing?.inputSchema ?? null,
23598
23447
  outputSchema: schemaValue(record3.outputSchema) ?? existing?.outputSchema ?? null,
23599
23448
  approvalPolicy: asRecord2(record3.approvalPolicy) ?? existing?.approvalPolicy ?? null,
23600
23449
  artifactPolicy: asRecord2(record3.artifactPolicy) ?? existing?.artifactPolicy ?? null,
23601
23450
  setupRequirements,
23602
23451
  mcp: asRecord2(record3.mcp) ?? existing?.mcp ?? null,
23603
23452
  schedulePolicy: asRecord2(record3.schedulePolicy) ?? existing?.schedulePolicy ?? null,
23604
- trace: asRecord2(record3.trace) ?? existing?.trace ?? null,
23453
+ trace: mergeAgentPackageTrace(
23454
+ asRecord2(record3.trace) ?? existing?.trace ?? null,
23455
+ agentPackageOrigin
23456
+ ),
23605
23457
  implementation: asRecord2(record3.implementation) ?? existing?.implementation ?? null,
23606
23458
  invokesModel: typeof record3.invokesModel === "boolean" ? record3.invokesModel : existing?.invokesModel
23607
23459
  };
@@ -23642,6 +23494,24 @@ async function loadProfileActionCatalogSource(source) {
23642
23494
  };
23643
23495
  }
23644
23496
  }
23497
+ function mergeAgentPackageTrace(trace, origin) {
23498
+ if (!origin) return trace;
23499
+ const versionId = text(origin.versionId);
23500
+ const digest = text(origin.digest);
23501
+ if (!versionId || !digest) return trace;
23502
+ return {
23503
+ ...trace ?? {},
23504
+ agentVersionId: versionId,
23505
+ agentPackageDigest: digest,
23506
+ validationReceiptIds: stringArray(origin.validationReceiptIds),
23507
+ evalReceiptIds: stringArray(origin.evalReceiptIds)
23508
+ };
23509
+ }
23510
+ function stringArray(value) {
23511
+ return Array.isArray(value) ? value.filter(
23512
+ (entry) => typeof entry === "string" && entry.trim().length > 0
23513
+ ) : [];
23514
+ }
23645
23515
  function latestIso(values) {
23646
23516
  let latest = 0;
23647
23517
  for (const value of values) {
@@ -23719,11 +23589,15 @@ function asRecord2(value) {
23719
23589
  return value && typeof value === "object" && !Array.isArray(value) ? value : null;
23720
23590
  }
23721
23591
  function records(value) {
23722
- return Array.isArray(value) ? value.filter((item) => Boolean(asRecord2(item))) : [];
23592
+ return Array.isArray(value) ? value.filter(
23593
+ (item) => Boolean(asRecord2(item))
23594
+ ) : [];
23723
23595
  }
23724
23596
  function recordArray(value) {
23725
23597
  if (!Array.isArray(value)) return null;
23726
- return value.filter((item) => Boolean(asRecord2(item)));
23598
+ return value.filter(
23599
+ (item) => Boolean(asRecord2(item))
23600
+ );
23727
23601
  }
23728
23602
  function text(value) {
23729
23603
  return typeof value === "string" && value.trim() ? value.trim() : null;
@@ -23731,6 +23605,11 @@ function text(value) {
23731
23605
  function schemaValue(value) {
23732
23606
  return text(value) ?? asRecord2(value);
23733
23607
  }
23608
+ function resolvedSchemaValue(value, namedSchemas) {
23609
+ const schema2 = schemaValue(value);
23610
+ if (typeof schema2 !== "string") return schema2;
23611
+ return asRecord2(namedSchemas?.[schema2]) ?? schema2;
23612
+ }
23734
23613
  function titleFromActionId(id) {
23735
23614
  const title = id.replace(/[._-]+/g, " ").trim();
23736
23615
  return title ? title.replace(/\b\w/g, (letter) => letter.toUpperCase()) : id;
@@ -24058,7 +23937,6 @@ var PROFILE_REPO_GITIGNORE = [
24058
23937
  "**/.bun/",
24059
23938
  "**/.env",
24060
23939
  "**/.env.*",
24061
- "**/.openpond/goals/",
24062
23940
  "**/.openpond/traces/",
24063
23941
  "**/.openpond/vendor/",
24064
23942
  "**/.openpond/eval-results.json",
@@ -24469,12 +24347,10 @@ function hostedSourceCheckStatusFromPayload(input) {
24469
24347
  const deployPlan = record2(checkResult?.deployPlan) ?? record2(input.deployPlan);
24470
24348
  const source = record2(deployPlan?.source);
24471
24349
  const checks = record2(deployPlan?.checks);
24472
- const workItem = record2(checkResult?.workItem);
24473
24350
  const sourceCheckStatus = record2(checkResult?.sourceCheckStatus);
24474
24351
  return {
24475
24352
  status: input.status,
24476
24353
  agentId: input.agentId,
24477
- workItemId: text4(workItem?.id),
24478
24354
  deployPlanStatus: text4(deployPlan?.status),
24479
24355
  canRun: booleanValue(deployPlan?.canRun),
24480
24356
  canDeploy: booleanValue(deployPlan?.canDeploy),
@@ -24587,19 +24463,58 @@ function mergeProfileRepoManifestEntry(existing, profilePath) {
24587
24463
  };
24588
24464
  }
24589
24465
  function mergeActiveLocalProfileConfig(existing, repoPath, profile) {
24466
+ const previousEntries = profileConfigEntries(existing);
24467
+ if (existing) {
24468
+ const previousIndex = previousEntries.findIndex(
24469
+ (entry) => path9.resolve(entry.repoPath) === path9.resolve(existing.repoPath) && entry.profile === existing.profile
24470
+ );
24471
+ const previousEntry = {
24472
+ source: previousEntries[previousIndex]?.source ?? "local",
24473
+ repositoryId: previousEntries[previousIndex]?.repositoryId ?? path9.resolve(existing.repoPath),
24474
+ repoPath: path9.resolve(existing.repoPath),
24475
+ profile: existing.profile,
24476
+ ...existing.lastCheck ? { lastCheck: existing.lastCheck } : {},
24477
+ ...existing.lastPush ? { lastPush: existing.lastPush } : {}
24478
+ };
24479
+ if (previousIndex >= 0) previousEntries[previousIndex] = previousEntry;
24480
+ else previousEntries.push(previousEntry);
24481
+ }
24482
+ const targetIndex = previousEntries.findIndex(
24483
+ (entry) => path9.resolve(entry.repoPath) === path9.resolve(repoPath) && entry.profile === profile
24484
+ );
24485
+ const target = targetIndex >= 0 ? previousEntries[targetIndex] : {
24486
+ source: "local",
24487
+ repositoryId: path9.resolve(repoPath),
24488
+ repoPath: path9.resolve(repoPath),
24489
+ profile
24490
+ };
24491
+ if (targetIndex < 0) previousEntries.push(target);
24590
24492
  const next = {
24591
- repoPath,
24493
+ repoPath: path9.resolve(repoPath),
24592
24494
  profile,
24593
- mode: "local"
24495
+ mode: "local",
24496
+ profiles: previousEntries,
24497
+ ...target.lastCheck ? { lastCheck: target.lastCheck } : {},
24498
+ ...target.lastPush ? { lastPush: target.lastPush } : {}
24594
24499
  };
24595
- if (!existing) return next;
24596
- if (path9.resolve(existing.repoPath) !== path9.resolve(repoPath) || existing.profile !== profile) {
24597
- return next;
24500
+ return next;
24501
+ }
24502
+ function profileConfigEntries(config2) {
24503
+ if (!config2) return [];
24504
+ const configured = config2.profiles?.map((entry) => ({ ...entry })) ?? [];
24505
+ if (!configured.some(
24506
+ (entry) => path9.resolve(entry.repoPath) === path9.resolve(config2.repoPath) && entry.profile === config2.profile
24507
+ )) {
24508
+ configured.push({
24509
+ source: "local",
24510
+ repositoryId: path9.resolve(config2.repoPath),
24511
+ repoPath: path9.resolve(config2.repoPath),
24512
+ profile: config2.profile,
24513
+ ...config2.lastCheck ? { lastCheck: config2.lastCheck } : {},
24514
+ ...config2.lastPush ? { lastPush: config2.lastPush } : {}
24515
+ });
24598
24516
  }
24599
- return {
24600
- ...existing,
24601
- ...next
24602
- };
24517
+ return configured;
24603
24518
  }
24604
24519
  var require2 = createRequire(import.meta.url);
24605
24520
  function defaultLocalProfileRepoPath() {
@@ -24635,22 +24550,36 @@ async function initLocalProfileRepo(input = {}) {
24635
24550
  const profile = normalizeProfileName(input.profile);
24636
24551
  const profilePath = path9.join("profiles", profile);
24637
24552
  const profileSourcePath2 = path9.join(repoPath, profilePath);
24553
+ const template = input.template ?? "blank-agent";
24554
+ const blankProfile = template === "blank-profile";
24638
24555
  await mkdir(repoPath, { recursive: true });
24556
+ const manifestAlreadyExists = existsSync4(
24557
+ path9.join(repoPath, PROFILE_REPO_MANIFEST)
24558
+ );
24639
24559
  const manifest = await readProfileManifest(repoPath).catch(
24640
24560
  () => defaultProfileManifest(profile, profilePath)
24641
24561
  );
24562
+ if (blankProfile && manifestAlreadyExists && manifest.profiles[profile]) {
24563
+ throw new Error(`Profile "${profile}" already exists in ${repoPath}.`);
24564
+ }
24642
24565
  manifest.defaultProfile = manifest.defaultProfile || profile;
24643
24566
  manifest.profiles[profile] = mergeProfileRepoManifestEntry(
24644
24567
  manifest.profiles[profile],
24645
24568
  profilePath
24646
24569
  );
24647
- await ensureProfileSource(
24648
- profileSourcePath2,
24649
- input.template ?? "blank-agent",
24650
- Boolean(input.force)
24651
- );
24570
+ if (blankProfile) manifest.profiles[profile].enabledAgents = [];
24571
+ if (blankProfile) await mkdir(profileSourcePath2, { recursive: true });
24572
+ else {
24573
+ await ensureProfileSource(
24574
+ profileSourcePath2,
24575
+ template,
24576
+ Boolean(input.force)
24577
+ );
24578
+ }
24652
24579
  await ensureProfileDependencies(profileSourcePath2);
24653
- await ensureProfileScaffoldFiles(repoPath, profileSourcePath2, profile);
24580
+ await ensureProfileScaffoldFiles(repoPath, profileSourcePath2, profile, {
24581
+ includeDefaultAgent: !blankProfile
24582
+ });
24654
24583
  await writeProfileManifest(repoPath, manifest);
24655
24584
  await ensureProfileGitRepo(repoPath);
24656
24585
  const currentConfig = (await loadGlobalConfig()).openpondProfile;
@@ -24663,21 +24592,51 @@ async function initLocalProfileRepo(input = {}) {
24663
24592
  });
24664
24593
  return loadOpenPondProfileState();
24665
24594
  }
24666
- async function loadLocalProfileRepo(repoPathInput, profileInput) {
24595
+ async function loadLocalProfileRepo(repoPathInput, profileInput, identity) {
24667
24596
  const repoPath = path9.resolve(repoPathInput);
24668
24597
  const manifest = await readProfileManifest(repoPath);
24669
24598
  const profile = normalizeProfileName(profileInput ?? manifest.defaultProfile);
24670
24599
  profileSourcePath(manifest, repoPath, profile);
24671
24600
  const currentConfig = (await loadGlobalConfig()).openpondProfile;
24672
- await saveGlobalConfig({
24673
- openpondProfile: mergeActiveLocalProfileConfig(
24674
- currentConfig,
24675
- repoPath,
24676
- profile
24677
- )
24678
- });
24601
+ const next = mergeActiveLocalProfileConfig(currentConfig, repoPath, profile);
24602
+ applyProfileIdentity(next, repoPath, profile, identity);
24603
+ await saveGlobalConfig({ openpondProfile: next });
24679
24604
  return loadOpenPondProfileState();
24680
24605
  }
24606
+ async function registerLocalProfileRepo(repoPathInput, profileInput, identity) {
24607
+ const repoPath = path9.resolve(repoPathInput);
24608
+ const manifest = await readProfileManifest(repoPath);
24609
+ const profile = normalizeProfileName(profileInput ?? manifest.defaultProfile);
24610
+ profileSourcePath(manifest, repoPath, profile);
24611
+ const currentConfig = (await loadGlobalConfig()).openpondProfile;
24612
+ const next = mergeActiveLocalProfileConfig(currentConfig, repoPath, profile);
24613
+ applyProfileIdentity(next, repoPath, profile, identity);
24614
+ if (currentConfig) {
24615
+ next.repoPath = currentConfig.repoPath;
24616
+ next.profile = currentConfig.profile;
24617
+ next.lastCheck = currentConfig.lastCheck;
24618
+ next.lastPush = currentConfig.lastPush;
24619
+ }
24620
+ await saveGlobalConfig({ openpondProfile: next });
24621
+ return loadOpenPondProfileStateForRef(
24622
+ openPondProfileRef({
24623
+ repoPath,
24624
+ profile,
24625
+ source: identity?.source,
24626
+ repositoryId: identity?.repositoryId
24627
+ })
24628
+ );
24629
+ }
24630
+ function applyProfileIdentity(config2, repoPath, profile, identity) {
24631
+ if (!identity) return;
24632
+ config2.profiles = profileConfigEntries(config2).map(
24633
+ (entry) => path9.resolve(entry.repoPath) === repoPath && entry.profile === profile ? {
24634
+ ...entry,
24635
+ source: identity.source,
24636
+ repositoryId: identity.repositoryId
24637
+ } : entry
24638
+ );
24639
+ }
24681
24640
  async function renameActiveProfileAgent(agentIdInput, nameInput) {
24682
24641
  const agentId = agentIdInput.trim();
24683
24642
  const name = normalizeAgentDisplayName(nameInput);
@@ -24705,10 +24664,196 @@ async function renameActiveProfileAgent(agentIdInput, nameInput) {
24705
24664
  await writeProfileManifest(active.repoPath, manifest);
24706
24665
  return loadOpenPondProfileState();
24707
24666
  }
24667
+ async function installAgentPackageIntoActiveProfile(input) {
24668
+ const agentPackage = input.agentPackage;
24669
+ verifyAgentPackageIntegrity(agentPackage);
24670
+ if (!/^[a-z0-9][a-z0-9._-]{0,190}$/.test(agentPackage.agentId)) {
24671
+ throw new Error("Agent package ID is not safe for a local Profile.");
24672
+ }
24673
+ const active = await requireActiveLocalProfile();
24674
+ const profileSourcePath2 = active.state.sourcePath;
24675
+ await ensureProfileDependencies(profileSourcePath2);
24676
+ const agentsRoot = path9.join(profileSourcePath2, "agents");
24677
+ await mkdir(agentsRoot, { recursive: true });
24678
+ const target = path9.join(agentsRoot, agentPackage.agentId);
24679
+ const targetExists = existsSync4(target);
24680
+ if (targetExists && input.overwrite !== true) {
24681
+ throw new Error(
24682
+ `Agent "${agentPackage.agentId}" already exists. Confirm replacement to install this version.`
24683
+ );
24684
+ }
24685
+ const temporary = path9.join(
24686
+ agentsRoot,
24687
+ `.${agentPackage.agentId}.${randomUUID3()}.installing`
24688
+ );
24689
+ const backup = path9.join(
24690
+ agentsRoot,
24691
+ `.${agentPackage.agentId}.${randomUUID3()}.backup`
24692
+ );
24693
+ const manifest = await readProfileManifest(active.config.repoPath);
24694
+ const originalManifest = JSON.stringify(manifest);
24695
+ let movedExisting = false;
24696
+ let installed = false;
24697
+ try {
24698
+ await materializeAgentPackage(temporary, agentPackage);
24699
+ if (targetExists) {
24700
+ await rename(target, backup);
24701
+ movedExisting = true;
24702
+ }
24703
+ await rename(temporary, target);
24704
+ installed = true;
24705
+ const profileConfig = manifest.profiles[active.config.profile];
24706
+ if (!profileConfig) {
24707
+ throw new Error(`Profile "${active.config.profile}" was not found.`);
24708
+ }
24709
+ const enabledAgents = new Set(profileConfig.enabledAgents ?? []);
24710
+ enabledAgents.add(agentPackage.agentId);
24711
+ profileConfig.enabledAgents = [...enabledAgents];
24712
+ if (!profileConfig.defaultAgent) {
24713
+ profileConfig.defaultAgent = agentPackage.agentId;
24714
+ }
24715
+ profileConfig.agentNames = {
24716
+ ...profileConfig.agentNames ?? {},
24717
+ [agentPackage.agentId]: agentPackage.title
24718
+ };
24719
+ await writeProfileManifest(active.config.repoPath, manifest);
24720
+ if (movedExisting) await rm(backup, { recursive: true, force: true });
24721
+ } catch (error51) {
24722
+ await rm(temporary, { recursive: true, force: true });
24723
+ if (installed) await rm(target, { recursive: true, force: true });
24724
+ if (movedExisting && existsSync4(backup)) await rename(backup, target);
24725
+ if (JSON.stringify(manifest) !== originalManifest) {
24726
+ await writeProfileManifest(
24727
+ active.config.repoPath,
24728
+ JSON.parse(originalManifest)
24729
+ ).catch(() => void 0);
24730
+ }
24731
+ throw error51;
24732
+ }
24733
+ return {
24734
+ state: await loadOpenPondProfileState(),
24735
+ agentId: agentPackage.agentId,
24736
+ versionId: agentPackage.versionId,
24737
+ digest: agentPackage.digest
24738
+ };
24739
+ }
24708
24740
  async function loadOpenPondProfileState() {
24709
24741
  const config2 = await loadGlobalConfig();
24710
24742
  const active = config2.openpondProfile;
24711
24743
  if (!active) return emptyProfileState();
24744
+ return loadOpenPondProfileStateForConfig(active);
24745
+ }
24746
+ function openPondProfileRef(input) {
24747
+ return {
24748
+ source: input.source ?? "local",
24749
+ repositoryId: input.repositoryId?.trim() || path9.resolve(input.repoPath),
24750
+ profileId: input.profile
24751
+ };
24752
+ }
24753
+ async function loadOpenPondProfileLibrary() {
24754
+ const active = (await loadGlobalConfig()).openpondProfile;
24755
+ if (!active) return { lastUsed: null, profiles: [] };
24756
+ const entries = profileConfigEntries(active);
24757
+ const profiles = await Promise.all(
24758
+ entries.map(async (entry) => {
24759
+ const state = await loadOpenPondProfileStateForConfig({
24760
+ repoPath: entry.repoPath,
24761
+ profile: entry.profile,
24762
+ mode: "local",
24763
+ ...entry.lastCheck ? { lastCheck: entry.lastCheck } : {},
24764
+ ...entry.lastPush ? { lastPush: entry.lastPush } : {}
24765
+ });
24766
+ return {
24767
+ ref: openPondProfileRef(entry),
24768
+ name: entry.profile,
24769
+ repoPath: entry.repoPath,
24770
+ sourcePath: state.sourcePath,
24771
+ state
24772
+ };
24773
+ })
24774
+ );
24775
+ return {
24776
+ lastUsed: openPondProfileRef({
24777
+ repoPath: active.repoPath,
24778
+ profile: active.profile,
24779
+ source: profileConfigEntries(active).find(
24780
+ (entry) => path9.resolve(entry.repoPath) === path9.resolve(active.repoPath) && entry.profile === active.profile
24781
+ )?.source,
24782
+ repositoryId: profileConfigEntries(active).find(
24783
+ (entry) => path9.resolve(entry.repoPath) === path9.resolve(active.repoPath) && entry.profile === active.profile
24784
+ )?.repositoryId
24785
+ }),
24786
+ profiles
24787
+ };
24788
+ }
24789
+ async function loadOpenPondProfileStateForRef(ref) {
24790
+ if (!ref) return loadOpenPondProfileState();
24791
+ const active = (await loadGlobalConfig()).openpondProfile;
24792
+ const entry = profileConfigEntries(active).find(
24793
+ (candidate) => candidate.source === ref.source && candidate.repositoryId === ref.repositoryId && candidate.profile === ref.profileId
24794
+ );
24795
+ if (!entry) {
24796
+ return emptyProfileState(
24797
+ `Profile "${ref.profileId}" is not installed on this device.`
24798
+ );
24799
+ }
24800
+ return loadOpenPondProfileStateForConfig({
24801
+ repoPath: entry.repoPath,
24802
+ profile: entry.profile,
24803
+ mode: "local",
24804
+ ...entry.lastCheck ? { lastCheck: entry.lastCheck } : {},
24805
+ ...entry.lastPush ? { lastPush: entry.lastPush } : {}
24806
+ });
24807
+ }
24808
+ async function selectOpenPondProfile(ref) {
24809
+ const config2 = (await loadGlobalConfig()).openpondProfile;
24810
+ const entry = profileConfigEntries(config2).find(
24811
+ (candidate) => candidate.source === ref.source && candidate.repositoryId === ref.repositoryId && candidate.profile === ref.profileId
24812
+ );
24813
+ if (!entry)
24814
+ throw new Error(
24815
+ `Profile "${ref.profileId}" is not installed on this device.`
24816
+ );
24817
+ await saveGlobalConfig({
24818
+ openpondProfile: mergeActiveLocalProfileConfig(
24819
+ config2,
24820
+ entry.repoPath,
24821
+ entry.profile
24822
+ )
24823
+ });
24824
+ return loadOpenPondProfileState();
24825
+ }
24826
+ async function removeOpenPondProfile(ref) {
24827
+ const config2 = (await loadGlobalConfig()).openpondProfile;
24828
+ if (!config2) return { lastUsed: null, profiles: [] };
24829
+ const remaining = profileConfigEntries(config2).filter(
24830
+ (candidate) => candidate.source !== ref.source || candidate.repositoryId !== ref.repositoryId || candidate.profile !== ref.profileId
24831
+ );
24832
+ if (remaining.length === 0) {
24833
+ await saveGlobalConfig({ openpondProfile: null });
24834
+ return { lastUsed: null, profiles: [] };
24835
+ }
24836
+ const currentRemoved = path9.resolve(config2.repoPath) === path9.resolve(
24837
+ profileConfigEntries(config2).find(
24838
+ (candidate) => candidate.source === ref.source && candidate.repositoryId === ref.repositoryId && candidate.profile === ref.profileId
24839
+ )?.repoPath ?? ""
24840
+ ) && config2.profile === ref.profileId;
24841
+ const next = currentRemoved ? remaining[0] : remaining.find(
24842
+ (entry) => path9.resolve(entry.repoPath) === path9.resolve(config2.repoPath) && entry.profile === config2.profile
24843
+ ) ?? remaining[0];
24844
+ await saveGlobalConfig({
24845
+ openpondProfile: {
24846
+ repoPath: next.repoPath,
24847
+ profile: next.profile,
24848
+ mode: "local",
24849
+ profiles: remaining,
24850
+ ...next.lastCheck ? { lastCheck: next.lastCheck } : {},
24851
+ ...next.lastPush ? { lastPush: next.lastPush } : {}
24852
+ }
24853
+ });
24854
+ return loadOpenPondProfileLibrary();
24855
+ }
24856
+ async function loadOpenPondProfileStateForConfig(active) {
24712
24857
  try {
24713
24858
  const manifest = await readProfileManifest(active.repoPath);
24714
24859
  const sourcePath = profileSourcePath(
@@ -24841,7 +24986,9 @@ async function runProfileSdkCommand(input) {
24841
24986
  inherit: input.inherit,
24842
24987
  throwOnFailure: false
24843
24988
  });
24844
- await saveProfileCheckStatus(input.command, result.code);
24989
+ if (input.command === "inspect" || input.command === "build" || input.command === "validate" || input.command === "eval") {
24990
+ await saveProfileCheckStatus(input.command, result.code);
24991
+ }
24845
24992
  if (result.code !== 0) {
24846
24993
  const detail = result.stderr.trim() || result.stdout.trim();
24847
24994
  throw new Error(
@@ -24949,10 +25096,14 @@ async function commitActiveProfileChanges(message) {
24949
25096
  async function saveProfilePushStatus(status) {
24950
25097
  const config2 = (await loadGlobalConfig()).openpondProfile;
24951
25098
  if (!config2) return;
25099
+ const profiles = profileConfigEntries(config2).map(
25100
+ (entry) => path9.resolve(entry.repoPath) === path9.resolve(config2.repoPath) && entry.profile === config2.profile ? { ...entry, lastPush: status } : entry
25101
+ );
24952
25102
  await saveGlobalConfig({
24953
25103
  openpondProfile: {
24954
25104
  ...config2,
24955
- lastPush: status
25105
+ lastPush: status,
25106
+ profiles
24956
25107
  }
24957
25108
  });
24958
25109
  }
@@ -24960,16 +25111,21 @@ async function saveProfileCheckStatus(command, exitCode) {
24960
25111
  const config2 = (await loadGlobalConfig()).openpondProfile;
24961
25112
  if (!config2) return;
24962
25113
  const sourceHead = await profileGitHead(config2.repoPath).catch(() => null);
25114
+ const lastCheck = {
25115
+ command,
25116
+ status: exitCode === 0 ? "passed" : "failed",
25117
+ checkedAt: (/* @__PURE__ */ new Date()).toISOString(),
25118
+ exitCode,
25119
+ sourceHead
25120
+ };
25121
+ const profiles = profileConfigEntries(config2).map(
25122
+ (entry) => path9.resolve(entry.repoPath) === path9.resolve(config2.repoPath) && entry.profile === config2.profile ? { ...entry, lastCheck } : entry
25123
+ );
24963
25124
  await saveGlobalConfig({
24964
25125
  openpondProfile: {
24965
25126
  ...config2,
24966
- lastCheck: {
24967
- command,
24968
- status: exitCode === 0 ? "passed" : "failed",
24969
- checkedAt: (/* @__PURE__ */ new Date()).toISOString(),
24970
- exitCode,
24971
- sourceHead
24972
- }
25127
+ lastCheck,
25128
+ profiles
24973
25129
  }
24974
25130
  });
24975
25131
  }
@@ -24989,7 +25145,7 @@ async function ensureProfileSource(profileSourcePath2, template, force) {
24989
25145
  });
24990
25146
  await rewriteTemplateSdkDependency(profileSourcePath2, sdkRoot);
24991
25147
  }
24992
- async function ensureProfileScaffoldFiles(repoPath, profileSourcePath2, profile) {
25148
+ async function ensureProfileScaffoldFiles(repoPath, profileSourcePath2, profile, options = {}) {
24993
25149
  await mkdir(path9.join(repoPath, "profiles"), { recursive: true });
24994
25150
  for (const dir of [
24995
25151
  "agents",
@@ -25006,15 +25162,18 @@ async function ensureProfileScaffoldFiles(repoPath, profileSourcePath2, profile)
25006
25162
  }
25007
25163
  const profileManifestPath = path9.join(profileSourcePath2, PROFILE_MANIFEST);
25008
25164
  if (!existsSync4(profileManifestPath)) {
25165
+ const agentLines = options.includeDefaultAgent === false ? ["agents: []"] : [
25166
+ "agents:",
25167
+ ` - id: ${DEFAULT_PROFILE_AGENT}`,
25168
+ " path: agent/agent.ts",
25169
+ " enabled: true"
25170
+ ];
25009
25171
  await writeFile2(
25010
25172
  profileManifestPath,
25011
25173
  [
25012
25174
  "schema: openpond.profile.v1",
25013
25175
  `profile: ${profile}`,
25014
- "agents:",
25015
- ` - id: ${DEFAULT_PROFILE_AGENT}`,
25016
- " path: agent/agent.ts",
25017
- " enabled: true",
25176
+ ...agentLines,
25018
25177
  ""
25019
25178
  ].join("\n"),
25020
25179
  "utf8"
@@ -25408,6 +25567,95 @@ function profileSourcePath(manifest, repoPath, profile) {
25408
25567
  }
25409
25568
  return sourcePath;
25410
25569
  }
25570
+ function verifyAgentPackageIntegrity(agentPackage) {
25571
+ let totalSizeBytes = 0;
25572
+ const seen = /* @__PURE__ */ new Set();
25573
+ for (const file2 of agentPackage.source.files) {
25574
+ const filePath = normalizeAgentPackagePath(file2.path);
25575
+ if (seen.has(filePath)) {
25576
+ throw new Error(
25577
+ `Agent package contains duplicate source path ${filePath}.`
25578
+ );
25579
+ }
25580
+ seen.add(filePath);
25581
+ const bytes = Buffer.from(file2.contentsBase64, "base64");
25582
+ if (bytes.byteLength !== file2.sizeBytes || createHash4("sha256").update(bytes).digest("hex") !== file2.sha256) {
25583
+ throw new Error(`Agent package source checksum failed for ${filePath}.`);
25584
+ }
25585
+ totalSizeBytes += bytes.byteLength;
25586
+ }
25587
+ if (totalSizeBytes !== agentPackage.source.totalSizeBytes) {
25588
+ throw new Error("Agent package source size does not match its manifest.");
25589
+ }
25590
+ const { digest: _digest, versionId: _versionId, ...canonical } = agentPackage;
25591
+ const digest = createHash4("sha256").update(stableAgentPackageJson(canonical)).digest("hex");
25592
+ if (digest !== agentPackage.digest || agentPackage.versionId !== `agent-${digest.slice(0, 20)}`) {
25593
+ throw new Error("Agent package content digest does not match its version.");
25594
+ }
25595
+ }
25596
+ async function materializeAgentPackage(target, agentPackage) {
25597
+ await mkdir(target, { recursive: true, mode: 448 });
25598
+ for (const file2 of agentPackage.source.files) {
25599
+ const relativePath = normalizeAgentPackagePath(file2.path);
25600
+ const destination = path9.resolve(target, relativePath);
25601
+ if (!destination.startsWith(`${path9.resolve(target)}${path9.sep}`)) {
25602
+ throw new Error("Agent package source path escapes its install root.");
25603
+ }
25604
+ await mkdir(path9.dirname(destination), { recursive: true, mode: 448 });
25605
+ let bytes = Buffer.from(file2.contentsBase64, "base64");
25606
+ if (relativePath === "package.json") {
25607
+ const packageJson = JSON.parse(bytes.toString("utf8"));
25608
+ packageJson.dependencies = {
25609
+ ...packageJson.dependencies ?? {},
25610
+ "openpond-agent-sdk": `file:${resolveAgentSdkRoot()}`
25611
+ };
25612
+ bytes = Buffer.from(`${JSON.stringify(packageJson, null, 2)}
25613
+ `, "utf8");
25614
+ }
25615
+ await writeFile2(destination, bytes, { mode: 384, flag: "wx" });
25616
+ }
25617
+ const provenancePath = path9.join(
25618
+ target,
25619
+ ".openpond",
25620
+ "agent-package-origin.json"
25621
+ );
25622
+ await mkdir(path9.dirname(provenancePath), { recursive: true, mode: 448 });
25623
+ await writeFile2(
25624
+ provenancePath,
25625
+ `${JSON.stringify(
25626
+ {
25627
+ schema: "openpond.agent-package-origin.v1",
25628
+ agentId: agentPackage.agentId,
25629
+ versionId: agentPackage.versionId,
25630
+ digest: agentPackage.digest,
25631
+ validationReceiptIds: agentPackage.receipts.filter((receipt) => receipt.kind === "sdk_validation").map((receipt) => receipt.id),
25632
+ evalReceiptIds: agentPackage.receipts.filter((receipt) => receipt.kind === "sdk_eval").map((receipt) => receipt.id)
25633
+ },
25634
+ null,
25635
+ 2
25636
+ )}
25637
+ `,
25638
+ { mode: 384, flag: "wx" }
25639
+ );
25640
+ }
25641
+ function normalizeAgentPackagePath(value) {
25642
+ const normalized = value.trim().replaceAll("\\", "/");
25643
+ const clean = path9.posix.normalize(normalized);
25644
+ if (!clean || clean === "." || clean === ".." || clean.startsWith("/") || clean.startsWith("../") || clean.split("/").some((part) => part === "..")) {
25645
+ throw new Error(`Agent package contains an invalid source path: ${value}.`);
25646
+ }
25647
+ return clean;
25648
+ }
25649
+ function stableAgentPackageJson(value) {
25650
+ return JSON.stringify(sortAgentPackageJson(value));
25651
+ }
25652
+ function sortAgentPackageJson(value) {
25653
+ if (Array.isArray(value)) return value.map(sortAgentPackageJson);
25654
+ if (!value || typeof value !== "object") return value;
25655
+ return Object.fromEntries(
25656
+ Object.entries(value).sort(([left], [right]) => left.localeCompare(right)).map(([key, child]) => [key, sortAgentPackageJson(child)])
25657
+ );
25658
+ }
25411
25659
  function resolveAgentSdkRoot() {
25412
25660
  const packageJsonPath = require2.resolve("openpond-agent-sdk/package.json");
25413
25661
  return path9.dirname(packageJsonPath);
@@ -25594,6 +25842,7 @@ export {
25594
25842
  hostedRunSummaryFromPayload,
25595
25843
  hostedSourceCheckStatusFromPayload,
25596
25844
  initLocalProfileRepo,
25845
+ installAgentPackageIntoActiveProfile,
25597
25846
  listAppSchedules,
25598
25847
  listApps,
25599
25848
  listConfiguredProfiles,
@@ -25609,14 +25858,19 @@ export {
25609
25858
  loadConfig,
25610
25859
  loadGlobalConfig,
25611
25860
  loadLocalProfileRepo,
25861
+ loadOpenPondProfileLibrary,
25612
25862
  loadOpenPondProfileState,
25863
+ loadOpenPondProfileStateForRef,
25613
25864
  mergeActiveLocalProfileConfig,
25614
25865
  mergeProfileRepoManifestEntry,
25615
25866
  normalizeDataFrames,
25616
25867
  normalizeSandboxApiUrl,
25868
+ openPondProfileRef,
25617
25869
  parseSandboxTemplateYaml,
25618
25870
  postAgentDigest,
25619
25871
  promotePreviewToProduction,
25872
+ registerLocalProfileRepo,
25873
+ removeOpenPondProfile,
25620
25874
  renameActiveProfileAgent,
25621
25875
  requireActiveLocalProfile,
25622
25876
  resolveHostedChatApiBaseUrl,
@@ -25642,6 +25896,7 @@ export {
25642
25896
  saveProfileApiKey,
25643
25897
  saveProfilePushStatus,
25644
25898
  searchOpenToolRecipes,
25899
+ selectOpenPondProfile,
25645
25900
  sendHostedChatTurn,
25646
25901
  setActiveProfile,
25647
25902
  setCachedApps,