openpond 0.2.68 → 0.2.69

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 (64) hide show
  1. package/dist/app-server.js +1 -1
  2. package/dist/chunks/account-context-V3KLSNKS.js +12 -0
  3. package/dist/chunks/{acp-2OIXATRY.js → acp-ER6CUXG2.js} +1 -1
  4. package/dist/chunks/{acp-agent-PAGX2B47.js → acp-agent-AYJ5RPVF.js} +1 -1
  5. package/dist/chunks/{actions-command-2VE6YI4W.js → actions-command-BBUS3HDK.js} +1 -1
  6. package/dist/chunks/{app-layer-YNEUEOEP.js → app-layer-JCEWGUDH.js} +1 -1
  7. package/dist/chunks/{app-server-connected-apps-TZOAUOYR.js → app-server-connected-apps-ILXBFD3S.js} +1 -1
  8. package/dist/chunks/{app-server-runtime-GBX65JJ7.js → app-server-runtime-43MCH5SY.js} +1 -1
  9. package/dist/chunks/{apps-RSFEJOQN.js → apps-VNFGMQFG.js} +1 -1
  10. package/dist/chunks/{chunk-DWM5G7BU.js → chunk-22RLEU3Q.js} +1 -1
  11. package/dist/chunks/chunk-7EQLW2KM.js +12 -0
  12. package/dist/chunks/chunk-BDZDWHBJ.js +6 -0
  13. package/dist/chunks/{chunk-GEYZVOGD.js → chunk-EWDDDHJN.js} +1 -1
  14. package/dist/chunks/{chunk-XQAUHXL4.js → chunk-G4FRBT7G.js} +2 -2
  15. package/dist/chunks/{chunk-FKUWCJ73.js → chunk-LSKMALD6.js} +1 -1
  16. package/dist/chunks/chunk-M5X7XKXY.js +12 -0
  17. package/dist/chunks/{chunk-OIH2LPIT.js → chunk-NW6WGGSL.js} +1 -1
  18. package/dist/chunks/{chunk-JPUSTFZC.js → chunk-NZDLL6JN.js} +1 -1
  19. package/dist/chunks/{chunk-RBTDSI4L.js → chunk-R6I623SZ.js} +6 -6
  20. package/dist/chunks/{chunk-MEJLWNRS.js → chunk-RCRZXHAI.js} +1 -1
  21. package/dist/chunks/{chunk-BHKXPWFB.js → chunk-TB5P3FWM.js} +1 -1
  22. package/dist/chunks/{chunk-73TW6BKK.js → chunk-Z5CQXPIS.js} +1 -1
  23. package/dist/chunks/{configuration-command-CNITTZRP.js → configuration-command-C3QBDFND.js} +1 -1
  24. package/dist/chunks/{connected-app-executor-FGWCLOJO.js → connected-app-executor-LAEAQUJS.js} +1 -1
  25. package/dist/chunks/{connected-evidence-5VZBYNWN.js → connected-evidence-VKY6O2JW.js} +1 -1
  26. package/dist/chunks/{connected-starting-assets-KWOFEIE4.js → connected-starting-assets-5LAJ7CZY.js} +1 -1
  27. package/dist/chunks/{core-commands-BPYXVT7O.js → core-commands-5TNBVR72.js} +1 -1
  28. package/dist/chunks/{datasets-E5TXSVIY.js → datasets-BIDZJYDC.js} +1 -1
  29. package/dist/chunks/{desktop-test-FX7DTY4N.js → desktop-test-BY2MS3UL.js} +1 -1
  30. package/dist/chunks/{evaluation-coordination-KUTZEEPB.js → evaluation-coordination-FXB4DXZA.js} +1 -1
  31. package/dist/chunks/{experiment-improvements-PQNR5YHN.js → experiment-improvements-JPDLKZXD.js} +1 -1
  32. package/dist/chunks/{experiments-Z4BJWT3Y.js → experiments-IEN7RXLX.js} +1 -1
  33. package/dist/chunks/{experiments-signal-3GCLKUWZ.js → experiments-signal-L32D36NH.js} +1 -1
  34. package/dist/chunks/{help-K6YLZ3KL.js → help-PLQJOP4P.js} +1 -1
  35. package/dist/chunks/{hosted-app-server-composition-LA3BZ4SE.js → hosted-app-server-composition-GZES7QXJ.js} +1 -1
  36. package/dist/chunks/{hosted-tasksets-NXVF4AQA.js → hosted-tasksets-V24IBVJX.js} +1 -1
  37. package/dist/chunks/{human-review-2ZOB7CJZ.js → human-review-6V6EMNVN.js} +1 -1
  38. package/dist/chunks/{import-YHYKZ6JN.js → import-SI24Z7EF.js} +1 -1
  39. package/dist/chunks/{opchat-XXI2ZM53.js → opchat-SV67HVMX.js} +1 -1
  40. package/dist/chunks/{opchat-bounded-chat-3MZGCRLY.js → opchat-bounded-chat-KLMIYSZZ.js} +1 -1
  41. package/dist/chunks/{organizations-W7HI2JA4.js → organizations-OZZFX7RG.js} +1 -1
  42. package/dist/chunks/{profile-P2SJPBOJ.js → profile-TD5U3INY.js} +1 -1
  43. package/dist/chunks/{project-action-payload-LTIQBX77.js → project-action-payload-TK6G4VMC.js} +1 -1
  44. package/dist/chunks/{project-agent-XRIXMXQK.js → project-agent-FFXPNXCO.js} +1 -1
  45. package/dist/chunks/sandbox-command-4BCUDAED.js +2 -0
  46. package/dist/chunks/{sandbox-template-U536EEWY.js → sandbox-template-GOY7QQUY.js} +1 -1
  47. package/dist/chunks/{saved-work-KSIQPXC2.js → saved-work-M6PUHKCC.js} +1 -1
  48. package/dist/chunks/{src-SGQYVBNQ.js → src-MT4B43TD.js} +1 -1
  49. package/dist/chunks/{teams-bot-MPWL2PP4.js → teams-bot-YCUTDDDC.js} +1 -1
  50. package/dist/cli.js +1 -1
  51. package/dist/index.js +1 -1
  52. package/dist/sandbox/runtime-handle.d.ts +3 -5
  53. package/dist/sandbox/sandbox-instance-client.d.ts +11 -5
  54. package/dist/sandbox/types/billing.d.ts +53 -0
  55. package/dist/sandbox/types/responses.d.ts +11 -1
  56. package/dist/sandbox/types/snapshots.d.ts +52 -3
  57. package/dist/skills/manifest.json +1 -1
  58. package/docs/command-reference.md +11 -0
  59. package/package.json +1 -1
  60. package/dist/chunks/account-context-MWB6HN6I.js +0 -12
  61. package/dist/chunks/chunk-27JGS3KB.js +0 -12
  62. package/dist/chunks/chunk-DRTHKWHK.js +0 -6
  63. package/dist/chunks/chunk-KOC3YJEU.js +0 -12
  64. package/dist/chunks/sandbox-command-HVA5FJU4.js +0 -2
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import{a as Qe}from"./chunks/chunk-Q34IF4PW.js";import{a as fe,b as $e,c as ge,d as ye,e as Ve,f as Re,g as Ae,h as Ye,i as Ce,j as Oe}from"./chunks/chunk-6XSSM4WT.js";import{a as ze,b as de,c as Je}from"./chunks/chunk-22UARBPW.js";import"./chunks/chunk-X37KMV27.js";import{A as zt,B as Jt,C as $t,D as Vt,E as Yt,F as Qt,G as Xt,H as Zt,I as en,J as tn,K as nn,L as on,b as Ot,c as St,d as Tt,e as Pt,f as wt,g as Et,h as xt,i as bt,j as Lt,k as Bt,l as Dt,m as It,n as vt,o as Ut,p as Mt,q as _t,r as Ht,s as Nt,t as qt,u as kt,v as Kt,w as Ft,x as Gt,y as jt,z as Wt}from"./chunks/chunk-NRYC4NH6.js";import"./chunks/chunk-EXYSD45J.js";import{A as J,B as $,C as V,D as Y,E as Q,F as X,G as Z,H as ee,I as te,J as ne,K as oe,L as se,M as re,N as ae,O as je,P as le,T as We,U as pe,V as ie,W as ce,X as ue,Y as me,Z as he,_ as Ct,a as ke,b as E,c as x,d as b,e as L,f as B,g as D,h as I,i as v,j as Ke,k as U,m as Fe,n as M,o as _,p as H,q as N,r as q,s as Ge,t as k,u as K,v as F,w as G,x as j,y as W,z}from"./chunks/chunk-JEMECEQH.js";import"./chunks/chunk-73TW6BKK.js";import{a as Rt,b as At}from"./chunks/chunk-27JGS3KB.js";import"./chunks/chunk-BT5YNE5U.js";import{a as Be,b as De,c as Ie,d as ve,e as Ue,f as Me,g as _e,h as He,i as Ne}from"./chunks/chunk-RPM4FDRX.js";import{a as qe}from"./chunks/chunk-KTIBXRWQ.js";import"./chunks/chunk-KP2MYTP5.js";import"./chunks/chunk-PNPV2LDE.js";import"./chunks/chunk-4G3GTEVS.js";import"./chunks/chunk-KU4TPDPH.js";import"./chunks/chunk-55YD4UTW.js";import"./chunks/chunk-AFYYIJ6K.js";import"./chunks/chunk-J256AEEE.js";import"./chunks/chunk-UN2LKLGV.js";import{a as yt}from"./chunks/chunk-2LJCJOJ7.js";import"./chunks/chunk-AMC4Z7G4.js";import"./chunks/chunk-LK77GI6M.js";import"./chunks/chunk-HVM2GUM3.js";import"./chunks/chunk-I6VMRQF4.js";import"./chunks/chunk-D6L6UNUQ.js";import"./chunks/chunk-AJXWJLZA.js";import"./chunks/chunk-OKKNDQJF.js";import"./chunks/chunk-4PUOWSDE.js";import"./chunks/chunk-ZY32SZ2P.js";import"./chunks/chunk-OTDDXEQ6.js";import"./chunks/chunk-ECOH24MC.js";import"./chunks/chunk-3A7HZJNE.js";import{a as sn,b as rn,c as an,d as ln,e as pn,f as cn,g as un,h as mn,i as hn,j as dn,k as fn,l as gn,m as yn,n as Rn,o as An,p as Cn,q as On,r as Sn,s as Tn,t as Pn,u as wn}from"./chunks/chunk-G7X73SBG.js";import{a as P,b as w,c as be,d as Le}from"./chunks/chunk-GLUWATL5.js";import"./chunks/chunk-JCLTFDVW.js";import"./chunks/chunk-6FA3GG5B.js";import"./chunks/chunk-SV7ZBEK2.js";import"./chunks/chunk-2MEOUS24.js";import"./chunks/chunk-HNQPEOJD.js";import"./chunks/chunk-RCT3O3HQ.js";import"./chunks/chunk-UGOK7VTC.js";import"./chunks/chunk-TBODQT4W.js";import"./chunks/chunk-5HPZGLOL.js";import"./chunks/chunk-ZFJWA4JK.js";import"./chunks/chunk-X2J2P5ZT.js";import{a as s}from"./chunks/chunk-FTQLQJQV.js";function Xe(t,e=14){if(t.length<e+1)return null;let r=0,o=0;for(let l=1;l<=e;l+=1){let m=t[l]-t[l-1];m>=0?r+=m:o-=m}let a=r/e,i=o/e;for(let l=e+1;l<t.length;l+=1){let m=t[l]-t[l-1],d=m>0?m:0,n=m<0?-m:0;a=(a*(e-1)+d)/e,i=(i*(e-1)+n)/e}return i===0?100:100-100/(1+a/i)}s(Xe,"computeRsi");function T(t,e){if(t.length<e)return[];let r=[],o=0;for(let a=0;a<t.length;a+=1)o+=t[a],a>=e&&(o-=t[a-e]),a>=e-1&&r.push(o/e);return r}s(T,"computeSmaSeries");function Ze(t,e){let r=T(t,e);return r.length>0?r[r.length-1]:null}s(Ze,"computeSma");function A(t,e){if(t.length<e)return[];let r=2/(e+1),a=t.slice(0,e).reduce((p,l)=>p+l,0)/e,i=[a];for(let p=e;p<t.length;p+=1)a=t[p]*r+a*(1-r),i.push(a);return i}s(A,"computeEmaSeries");function et(t,e){let r=A(t,e);return r.length>0?r[r.length-1]:null}s(et,"computeEma");function tt(t){let e=A(t,12),r=A(t,26);if(e.length===0||r.length===0)return null;let o=e.length-r.length,a=r.map((m,d)=>e[d+o]-m),i=A(a,9);if(i.length===0)return null;let p=a[a.length-1],l=i[i.length-1];return{macd:p,signalLine:l,histogram:p-l}}s(tt,"computeMacd");function nt(t,e,r,o){if(t.length<o)return null;let a=e==="ema"?A(t,r):T(t,r),i=e==="ema"?A(t,o):T(t,o);if(a.length===0||i.length===0)return null;let p=a.length-i.length;if(p<0)return null;let l=i.length-1,m=a[l+p],d=i[l],n=l-1,c=n>=0?a[n+p]:null,u=n>=0?i[n]:null,h="neutral";return c!=null&&u!=null?c<=u&&m>d?h="bullish-cross":c>=u&&m<d?h="bearish-cross":m>d?h="bullish":m<d&&(h="bearish"):m>d?h="bullish":m<d&&(h="bearish"),{fast:m,slow:d,signal:h}}s(nt,"computeMaCross");function ot(t,e=20,r=2){if(t.length<e)return null;let o=t.slice(-e),a=o.reduce((l,m)=>l+m,0)/e,i=o.reduce((l,m)=>l+Math.pow(m-a,2),0)/e,p=Math.sqrt(i);return{middle:a,upper:a+r*p,lower:a-r*p}}s(ot,"computeBollinger");function st(t,e=24){if(t.length<2)return null;let r=t[t.length-1],o=Math.max(0,t.length-1-e),a=t[o];if(a===0)return null;let i=(r-a)/a*100;return{previous:a,percent:i}}s(st,"computePriceChange");function rt(t,e=14){if(t.length<e+1)return null;let r=[];for(let i=1;i<t.length;i+=1){let p=t[i],l=t[i-1],m=p.high-p.low,d=Math.abs(p.high-l.close),n=Math.abs(p.low-l.close);r.push(Math.max(m,d,n))}return r.length<e?null:r.slice(-e).reduce((i,p)=>i+p,0)/e}s(rt,"computeAtr");function Te(t){return t.replace(/\/$/,"")}s(Te,"resolveUrl");function at(t){let e=process.env.OPENPOND_BASE_URL,r=t.baseUrl||e||P;return Te(r.trim())}s(at,"resolveBaseUrl");function lt(t){let e=process.env.OPENPOND_API_URL,r=t.apiUrl||e||w;return Te(r.trim())}s(lt,"resolveApiUrl");function pt(t,e){return fe({apiBaseUrl:e,opChatApiBaseUrl:t.opChatApiUrl,chatApiBaseUrl:t.chatApiUrl})}s(pt,"resolveChatApiUrl");function it(t,e){let r=process.env.OPENPOND_TOOL_URL,o=t.toolUrl||r||e;return Te(o.trim())}s(it,"resolveToolUrl");function ct(t){let e=t.apiKey?.trim();if(e)return e;let r=process.env.OPENPOND_API_KEY?.trim();if(r)return r;throw new Error("OPENPOND_API_KEY is required")}s(ct,"resolveApiKey");function ut(t){let e=t.split("/").filter(Boolean);if(e.length!==2)throw new Error("expected <handle>/<repo>");return{handle:e[0],repo:e[1]}}s(ut,"parseHandleRepo");function Pe(t){return(t||"").trim().toLowerCase()}s(Pe,"normalizeRepoName");function mt(t){if(!t||typeof t!="object")return{name:"unknown",raw:t};let e=t,r=e.profile||e.function,o=typeof e.name=="string"?e.name:typeof r?.name=="string"?r.name:"unknown",a=typeof e.description=="string"?e.description:typeof r?.description=="string"?r.description:void 0;return{name:o,description:a,raw:t}}s(mt,"normalizeToolSummary");function ht(t){if(!t)return[];if(Array.isArray(t.toolsJson))return t.toolsJson;if(t.metadataJson&&typeof t.metadataJson=="object"){let e=t.metadataJson.tools;if(Array.isArray(e))return e}return[]}s(ht,"extractDeploymentTools");async function O(t){let{handle:e,repo:r}=ut(t.target),o=await Se({apiBase:t.apiBase,apiKey:t.apiKey,useCache:t.useCache,cacheTtlMs:t.cacheTtlMs,forceRefresh:t.forceRefresh}),a=Pe(r),i=o.find(p=>p.handle&&p.handle!==e?!1:[p.repo,p.gitRepo,p.id].map(Pe).includes(a));if(!i)throw new Error(`app not found for ${e}/${r}`);return{app:i,handle:e,repo:r}}s(O,"resolveAppTarget");async function Se(t){if(t.useCache&&!t.forceRefresh){let r=await ce({apiBase:t.apiBase,apiKey:t.apiKey,ttlMs:t.cacheTtlMs});if(r)return r}let e=await v(t.apiBase,t.apiKey);return t.useCache&&await ue({apiBase:t.apiBase,apiKey:t.apiKey,apps:e}),e}s(Se,"fetchAppsWithCache");async function we(t){if(t.useCache&&!t.forceRefresh){let o=await me({apiBase:t.apiBase,apiKey:t.apiKey,ttlMs:t.cacheTtlMs});if(o)return o}let e=await k(t.apiBase,t.apiKey),r=Array.isArray(e.tools)?e.tools:[];return t.useCache&&await he({apiBase:t.apiBase,apiKey:t.apiKey,tools:r}),r}s(we,"fetchToolsWithCache");function dt(t){if(!t)return"POST";let e=t.toUpperCase();switch(e){case"GET":case"POST":case"PUT":case"DELETE":return e;default:throw new Error("method must be GET, POST, PUT, or DELETE")}}s(dt,"normalizeMethod");async function ft(t,e){let r,o,a;return await de(t,{...e,onConversationId:s(i=>{r=i,e?.onConversationId?.(i)},"onConversationId"),onItems:s(i=>{for(let p of i){let l=p;!o&&typeof l.appId=="string"&&(o=l.appId,e?.onAppId?.(l.appId)),!a&&typeof l.deploymentId=="string"&&(a=l.deploymentId,e?.onDeploymentId?.(l.deploymentId))}e?.onItems?.(i)},"onItems")}),{conversationId:r,appId:o,deploymentId:a}}s(ft,"consumeAgentCreateStream");function vn(t){let e=ct(t),r=at(t),o=lt(t),a=pt(t,o),i=it(t,r),p=t.cacheTtlMs??ie,l=t.useCache!==!1,m=s(async()=>{l&&await Promise.all([Se({apiBase:o,apiKey:e,useCache:l,cacheTtlMs:p,forceRefresh:!0}),we({apiBase:o,apiKey:e,useCache:l,cacheTtlMs:p,forceRefresh:!0})])},"refreshCache"),d=s(async(n,c)=>(await D(o,e,n,{branch:c}))?.id??null,"resolveLatestDeploymentId");return{baseUrl:r,apiUrl:o,chatApiUrl:a,toolUrl:i,apiKey:e,account:{get:s(async()=>se(o,e),"get"),health:s(async()=>re(o,e),"health")},chat:{providers:s(async()=>Re({apiBaseUrl:a,token:e}),"providers"),provider:s(async n=>Ae({apiBaseUrl:a,token:e,provider:n}),"provider"),models:s(async()=>ge({apiBaseUrl:a,token:e}),"models"),model:s(async n=>ye({apiBaseUrl:a,token:e,model:n}),"model"),send:s(async n=>Ce({...n,apiBaseUrl:a,token:e}),"send"),stream:s(n=>Oe({...n,apiBaseUrl:a,token:e}),"stream")},tool:{list:s(async(n,c)=>{let{app:u}=await O({apiBase:o,apiKey:e,target:n,useCache:l,cacheTtlMs:p,forceRefresh:c?.forceRefresh}),h=c?.deploymentId||await d(u.id,c?.branch);if(!h)return{app:u,deploymentId:null,tools:[]};let g=await I(o,e,h),y=ht(g).map(mt);return{app:u,deploymentId:h,tools:y}},"list"),run:s(async(n,c,u)=>{let{app:h}=await O({apiBase:o,apiKey:e,target:n,useCache:l,cacheTtlMs:p,forceRefresh:u?.forceRefresh}),g=u?.deploymentId||await d(h.id,u?.branch);if(!g)throw new Error("no deployments found");let f=dt(u?.method);return pe(i,e,{appId:h.id,deploymentId:g,toolName:c,method:f,body:u?.body,headers:u?.headers})},"run")},deploy:{watch:s(async(n,c)=>{let{app:u}=await O({apiBase:o,apiKey:e,target:n,useCache:l,cacheTtlMs:p,forceRefresh:c?.forceRefresh}),h=c?.deploymentId||await d(u.id,c?.branch);if(!h)throw new Error("no deployments found");let g=c?.intervalMs??5e3,f=c?.timeoutMs??240*1e3,y=[],S=new Set,Ee=Date.now(),R=null;for(;Date.now()-Ee<f;){let xe=await L(o,e,h);for(let C of xe)S.has(C.id)||(S.add(C.id),y.push(C),c?.onLog?.(C));if(R=(await B(o,e,h)).status??null,c?.onStatus?.(R),R==="failed")return{deploymentId:h,status:R,logs:y};if(R==="running"||R==="deployed")return{deploymentId:h,status:R,logs:y};await new Promise(C=>setTimeout(C,g))}return{deploymentId:h,status:"timeout",logs:y}},"watch")},template:{status:s(async(n,c)=>{let{app:u}=await O({apiBase:o,apiKey:e,target:n,useCache:l,cacheTtlMs:p,forceRefresh:c?.forceRefresh});return M(o,e,u.id)},"status"),branches:s(async(n,c)=>{let{app:u}=await O({apiBase:o,apiKey:e,target:n,useCache:l,cacheTtlMs:p,forceRefresh:c?.forceRefresh});return _(o,e,u.id)},"branches"),update:s(async(n,c)=>{let{app:u}=await O({apiBase:o,apiKey:e,target:n,useCache:l,cacheTtlMs:p,forceRefresh:c?.forceRefresh}),h=c?.environment==="preview"?"preview":"production";return H(o,e,u.id,{environment:h})},"update")},opentool:{recipesList:s(async(n={})=>F(o,e,n),"recipesList"),recipesSearch:s(async n=>G(o,e,n),"recipesSearch"),recipeGet:s(async n=>j(o,e,n),"recipeGet"),rulesGet:s(async n=>W(o,e,n),"rulesGet")},apps:{list:s(async n=>{let c=await Se({apiBase:o,apiKey:e,useCache:l,cacheTtlMs:p,forceRefresh:n?.forceRefresh});return n?.handle?c.filter(u=>u.handle===n.handle):c},"list"),tools:s(async n=>we({apiBase:o,apiKey:e,useCache:l,cacheTtlMs:p,forceRefresh:n?.forceRefresh}),"tools"),performance:s(async n=>ne(o,e,{appId:n?.appId}),"performance"),summary:s(async n=>oe(o,e,n.appId),"summary"),schedules:s(async n=>K(o,e,n.appId),"schedules"),schedulesStart:s(async n=>{let{appId:c,...u}=n;return z(o,e,c,u)},"schedulesStart"),schedulesStop:s(async n=>J(o,e,n.appId),"schedulesStop"),schedulesStopCurrent:s(async()=>$(o,e),"schedulesStopCurrent"),scheduleRunNow:s(async n=>V(o,e,n),"scheduleRunNow"),scheduleDelete:s(async n=>Y(o,e,n.appId,n.scheduleId),"scheduleDelete"),scheduleExecutionLogs:s(async n=>Q(o,e,n.scheduleId,{limit:n.limit}),"scheduleExecutionLogs"),scheduleExecutionLog:s(async n=>Z(o,e,n.runId),"scheduleExecutionLog"),deploymentScheduleExecutionLogs:s(async n=>X(o,e,n.deploymentId,{limit:n.limit}),"deploymentScheduleExecutionLogs"),executionTimeline:s(async n=>ee(o,e,n.appId,{limit:n.limit}),"executionTimeline"),assistantRun:s(async n=>ae(o,e,n),"assistantRun"),agentCreate:s(async(n,c)=>{let{refreshCache:u,...h}=n,g={...h,streamDeployLogs:h.streamDeployLogs??!0},f=await te(o,e,g);if(!f.ok){let S=await f.text().catch(()=>"");throw new Error(`agent create failed: ${f.status} ${S}`)}let y=await ft(f,c);if(l&&u!==!1)try{await m()}catch{}return y},"agentCreate"),toolsExecute:s(async n=>le(o,e,n),"toolsExecute"),deploy:s(async n=>E(o,e,n.appId,{environment:n.environment,commitSha:n.commitSha,branch:n.branch}),"deploy"),startApp:s(async n=>{let{appId:c,...u}=n;return b(o,e,c,u)},"startApp"),promotePreview:s(async n=>{let{appId:c,...u}=n;return x(o,e,c,u)},"promotePreview"),envGet:s(async n=>q(o,e,n.appId),"envGet"),envSet:s(async n=>N(o,e,n.appId,{envVars:n.envVars}),"envSet")},repo:{create:s(async n=>{let{refreshCache:c,...u}=n,h=await U(o,e,u);if(l&&c!==!1)try{await m()}catch{}return h},"create")},cache:{refresh:m}}}s(vn,"createClient");export{ie as DEFAULT_CACHE_TTL_MS,It as DEFAULT_LOCAL_PROFILE,w as DEFAULT_OPENPOND_API_BASE_URL,Le as DEFAULT_OPENPOND_CHAT_API_BASE_URL,be as DEFAULT_OPENPOND_OPCHAT_API_BASE_URL,P as DEFAULT_OPENPOND_WEB_BASE_URL,vt as DEFAULT_PROFILE_AGENT,an as OPENPOND_MANIFEST_FILE_NAME,Ot as OpenPondProfileSetupRequiredError,Rt as OpenPondSandboxClient,Dt as PROFILE_MANIFEST,Bt as PROFILE_REPO_MANIFEST,Ct as SANDBOX_RUNTIME_PROFILE_IDS,ln as SANDBOX_TEMPLATE_BUILD_PLAN_FILE_NAME,pn as SANDBOX_TEMPLATE_BUILD_PLAN_KIND,rn as SANDBOX_TEMPLATE_PREVIEW_PORT_MAX,sn as SANDBOX_TEMPLATE_PREVIEW_PORT_MIN,cn as SandboxTemplateManifestSchema,un as SandboxTemplateValidationDiagnosticSchema,qe as apiFetch,Tt as assertOpenPondProfileActionReady,St as buildOpenPondProfileSetupGate,re as checkOpenPondApiHealth,wt as collectProfileSourceUploadEntries,tn as commitActiveProfileChanges,ke as commitFiles,rt as computeAtr,ot as computeBollinger,et as computeEma,A as computeEmaSeries,nt as computeMaCross,tt as computeMacd,st as computePriceChange,Xe as computeRsi,Ze as computeSma,T as computeSmaSeries,ft as consumeAgentCreateStream,de as consumeStream,te as createAgentFromPrompt,vn as createClient,Fe as createHeadlessApps,Ke as createLocalProject,At as createOpenPondSandboxClient,U as createRepo,_t as defaultLocalProfileRepoPath,gn as defineSandboxTemplate,Y as deleteOrArchiveSchedule,E as deployApp,H as deployLatestTemplate,Ht as emptyProfileState,pe as executeHostedTool,le as executeUserTool,Ge as fetchToolManifest,Pt as formatOpenPondProfileSetupRequirement,fn as formatSandboxTemplateDiagnostics,Je as formatStreamItem,q as getAppEnvironment,ee as getAppExecutionTimeline,oe as getAppRuntimeSummary,ce as getCachedApps,me as getCachedTools,Be as getConfigPath,I as getDeploymentDetail,L as getDeploymentLogs,B as getDeploymentStatus,D as getLatestDeploymentForApp,ye as getOpChatModel,Ae as getOpChatProvider,se as getOpenPondAccount,j as getOpenToolRecipe,W as getOpenToolRules,Z as getScheduleExecutionLog,M as getTemplateStatus,ne as getUserPerformance,xt as hostedPublishStatusFromPayload,Lt as hostedRunStatusFromRunSummary,bt as hostedRunSummaryFromPayload,Et as hostedSourceCheckStatusFromPayload,Nt as initLocalProfileRepo,Vt as inspectOpenPondProfileSource,Ft as installAgentPackageIntoActiveProfile,K as listAppSchedules,v as listApps,Ue as listConfiguredProfiles,X as listDeploymentScheduleExecutionLogs,Ve as listHostedModels,Ye as listHostedProviders,ge as listOpChatModels,Re as listOpChatProviders,F as listOpenToolRecipes,Q as listScheduleExecutionLogs,_ as listTemplateBranches,k as listUserTools,ve as loadConfig,Ie as loadGlobalConfig,qt as loadLocalProfileRepo,Wt as loadOpenPondProfileLibrary,Gt as loadOpenPondProfileState,zt as loadOpenPondProfileStateForRef,Yt as loadOpenPondProfileStateFromSource,Mt as mergeActiveLocalProfileConfig,Ut as mergeProfileRepoManifestEntry,ze as normalizeDataFrames,yt as normalizeSandboxApiUrl,jt as openPondProfileRef,dn as parseSandboxTemplateYaml,je as postAgentDigest,on as prepareAgentSdkRuntimePackage,x as promotePreviewToProduction,kt as registerLocalProfileRepo,$t as removeOpenPondProfile,Kt as renameActiveProfileAgent,Qt as requireActiveLocalProfile,$e as resolveHostedChatApiBaseUrl,fe as resolveOpChatApiBaseUrl,We as resolveWorkerBaseUrl,Zt as runAgentSdkProjectCommand,ae as runAssistantMode,Qe as runOpChatSmoke,en as runProfileCheck,Xt as runProfileSdkCommand,V as runScheduleNow,Sn as sandboxTemplateBuildMetadata,Tn as sandboxTemplateBuildPlan,Rn as sandboxTemplateDurableVolume,On as sandboxTemplateExecutableEntries,Cn as sandboxTemplateFileInput,wn as sandboxTemplateJsonSchema,An as sandboxTemplatePreviewPort,yn as sandboxTemplateResources,Pn as sandboxTemplateScaffoldFiles,He as saveConfig,Ne as saveGlobalConfig,_e as saveProfileApiKey,nn as saveProfilePushStatus,G as searchOpenToolRecipes,Jt as selectOpenPondProfile,Ce as sendHostedChatTurn,Me as setActiveProfile,ue as setCachedApps,he as setCachedTools,b as startAppLifecycle,z as startAppSchedules,J as stopAppSchedules,$ as stopCurrentAppSchedules,Oe as streamHostedChatTurn,N as updateAppEnvironment,De as updateGlobalConfig,hn as validateSandboxTemplateManifest,mn as validateSandboxTemplateYaml};
2
+ import{a as Qe}from"./chunks/chunk-Q34IF4PW.js";import{a as fe,b as $e,c as ge,d as ye,e as Ve,f as Re,g as Ae,h as Ye,i as Ce,j as Oe}from"./chunks/chunk-6XSSM4WT.js";import{a as ze,b as de,c as Je}from"./chunks/chunk-22UARBPW.js";import"./chunks/chunk-X37KMV27.js";import{A as zt,B as Jt,C as $t,D as Vt,E as Yt,F as Qt,G as Xt,H as Zt,I as en,J as tn,K as nn,L as on,b as Ot,c as St,d as Tt,e as Pt,f as wt,g as Et,h as xt,i as bt,j as Lt,k as Bt,l as Dt,m as It,n as vt,o as Ut,p as Mt,q as _t,r as Ht,s as Nt,t as qt,u as kt,v as Kt,w as Ft,x as Gt,y as jt,z as Wt}from"./chunks/chunk-NRYC4NH6.js";import"./chunks/chunk-EXYSD45J.js";import{A as J,B as $,C as V,D as Y,E as Q,F as X,G as Z,H as ee,I as te,J as ne,K as oe,L as se,M as re,N as ae,O as je,P as le,T as We,U as pe,V as ie,W as ce,X as ue,Y as me,Z as he,_ as Ct,a as ke,b as E,c as x,d as b,e as L,f as B,g as D,h as I,i as v,j as Ke,k as U,m as Fe,n as M,o as _,p as H,q as N,r as q,s as Ge,t as k,u as K,v as F,w as G,x as j,y as W,z}from"./chunks/chunk-JEMECEQH.js";import"./chunks/chunk-Z5CQXPIS.js";import{a as Rt,b as At}from"./chunks/chunk-7EQLW2KM.js";import"./chunks/chunk-BT5YNE5U.js";import{a as Be,b as De,c as Ie,d as ve,e as Ue,f as Me,g as _e,h as He,i as Ne}from"./chunks/chunk-RPM4FDRX.js";import{a as qe}from"./chunks/chunk-KTIBXRWQ.js";import"./chunks/chunk-KP2MYTP5.js";import"./chunks/chunk-PNPV2LDE.js";import"./chunks/chunk-4G3GTEVS.js";import"./chunks/chunk-KU4TPDPH.js";import"./chunks/chunk-55YD4UTW.js";import"./chunks/chunk-AFYYIJ6K.js";import"./chunks/chunk-J256AEEE.js";import"./chunks/chunk-UN2LKLGV.js";import{a as yt}from"./chunks/chunk-2LJCJOJ7.js";import"./chunks/chunk-AMC4Z7G4.js";import"./chunks/chunk-LK77GI6M.js";import"./chunks/chunk-HVM2GUM3.js";import"./chunks/chunk-I6VMRQF4.js";import"./chunks/chunk-D6L6UNUQ.js";import"./chunks/chunk-AJXWJLZA.js";import"./chunks/chunk-OKKNDQJF.js";import"./chunks/chunk-4PUOWSDE.js";import"./chunks/chunk-ZY32SZ2P.js";import"./chunks/chunk-OTDDXEQ6.js";import"./chunks/chunk-ECOH24MC.js";import"./chunks/chunk-3A7HZJNE.js";import{a as sn,b as rn,c as an,d as ln,e as pn,f as cn,g as un,h as mn,i as hn,j as dn,k as fn,l as gn,m as yn,n as Rn,o as An,p as Cn,q as On,r as Sn,s as Tn,t as Pn,u as wn}from"./chunks/chunk-G7X73SBG.js";import{a as P,b as w,c as be,d as Le}from"./chunks/chunk-GLUWATL5.js";import"./chunks/chunk-JCLTFDVW.js";import"./chunks/chunk-6FA3GG5B.js";import"./chunks/chunk-SV7ZBEK2.js";import"./chunks/chunk-2MEOUS24.js";import"./chunks/chunk-HNQPEOJD.js";import"./chunks/chunk-RCT3O3HQ.js";import"./chunks/chunk-UGOK7VTC.js";import"./chunks/chunk-TBODQT4W.js";import"./chunks/chunk-5HPZGLOL.js";import"./chunks/chunk-ZFJWA4JK.js";import"./chunks/chunk-X2J2P5ZT.js";import{a as s}from"./chunks/chunk-FTQLQJQV.js";function Xe(t,e=14){if(t.length<e+1)return null;let r=0,o=0;for(let l=1;l<=e;l+=1){let m=t[l]-t[l-1];m>=0?r+=m:o-=m}let a=r/e,i=o/e;for(let l=e+1;l<t.length;l+=1){let m=t[l]-t[l-1],d=m>0?m:0,n=m<0?-m:0;a=(a*(e-1)+d)/e,i=(i*(e-1)+n)/e}return i===0?100:100-100/(1+a/i)}s(Xe,"computeRsi");function T(t,e){if(t.length<e)return[];let r=[],o=0;for(let a=0;a<t.length;a+=1)o+=t[a],a>=e&&(o-=t[a-e]),a>=e-1&&r.push(o/e);return r}s(T,"computeSmaSeries");function Ze(t,e){let r=T(t,e);return r.length>0?r[r.length-1]:null}s(Ze,"computeSma");function A(t,e){if(t.length<e)return[];let r=2/(e+1),a=t.slice(0,e).reduce((p,l)=>p+l,0)/e,i=[a];for(let p=e;p<t.length;p+=1)a=t[p]*r+a*(1-r),i.push(a);return i}s(A,"computeEmaSeries");function et(t,e){let r=A(t,e);return r.length>0?r[r.length-1]:null}s(et,"computeEma");function tt(t){let e=A(t,12),r=A(t,26);if(e.length===0||r.length===0)return null;let o=e.length-r.length,a=r.map((m,d)=>e[d+o]-m),i=A(a,9);if(i.length===0)return null;let p=a[a.length-1],l=i[i.length-1];return{macd:p,signalLine:l,histogram:p-l}}s(tt,"computeMacd");function nt(t,e,r,o){if(t.length<o)return null;let a=e==="ema"?A(t,r):T(t,r),i=e==="ema"?A(t,o):T(t,o);if(a.length===0||i.length===0)return null;let p=a.length-i.length;if(p<0)return null;let l=i.length-1,m=a[l+p],d=i[l],n=l-1,c=n>=0?a[n+p]:null,u=n>=0?i[n]:null,h="neutral";return c!=null&&u!=null?c<=u&&m>d?h="bullish-cross":c>=u&&m<d?h="bearish-cross":m>d?h="bullish":m<d&&(h="bearish"):m>d?h="bullish":m<d&&(h="bearish"),{fast:m,slow:d,signal:h}}s(nt,"computeMaCross");function ot(t,e=20,r=2){if(t.length<e)return null;let o=t.slice(-e),a=o.reduce((l,m)=>l+m,0)/e,i=o.reduce((l,m)=>l+Math.pow(m-a,2),0)/e,p=Math.sqrt(i);return{middle:a,upper:a+r*p,lower:a-r*p}}s(ot,"computeBollinger");function st(t,e=24){if(t.length<2)return null;let r=t[t.length-1],o=Math.max(0,t.length-1-e),a=t[o];if(a===0)return null;let i=(r-a)/a*100;return{previous:a,percent:i}}s(st,"computePriceChange");function rt(t,e=14){if(t.length<e+1)return null;let r=[];for(let i=1;i<t.length;i+=1){let p=t[i],l=t[i-1],m=p.high-p.low,d=Math.abs(p.high-l.close),n=Math.abs(p.low-l.close);r.push(Math.max(m,d,n))}return r.length<e?null:r.slice(-e).reduce((i,p)=>i+p,0)/e}s(rt,"computeAtr");function Te(t){return t.replace(/\/$/,"")}s(Te,"resolveUrl");function at(t){let e=process.env.OPENPOND_BASE_URL,r=t.baseUrl||e||P;return Te(r.trim())}s(at,"resolveBaseUrl");function lt(t){let e=process.env.OPENPOND_API_URL,r=t.apiUrl||e||w;return Te(r.trim())}s(lt,"resolveApiUrl");function pt(t,e){return fe({apiBaseUrl:e,opChatApiBaseUrl:t.opChatApiUrl,chatApiBaseUrl:t.chatApiUrl})}s(pt,"resolveChatApiUrl");function it(t,e){let r=process.env.OPENPOND_TOOL_URL,o=t.toolUrl||r||e;return Te(o.trim())}s(it,"resolveToolUrl");function ct(t){let e=t.apiKey?.trim();if(e)return e;let r=process.env.OPENPOND_API_KEY?.trim();if(r)return r;throw new Error("OPENPOND_API_KEY is required")}s(ct,"resolveApiKey");function ut(t){let e=t.split("/").filter(Boolean);if(e.length!==2)throw new Error("expected <handle>/<repo>");return{handle:e[0],repo:e[1]}}s(ut,"parseHandleRepo");function Pe(t){return(t||"").trim().toLowerCase()}s(Pe,"normalizeRepoName");function mt(t){if(!t||typeof t!="object")return{name:"unknown",raw:t};let e=t,r=e.profile||e.function,o=typeof e.name=="string"?e.name:typeof r?.name=="string"?r.name:"unknown",a=typeof e.description=="string"?e.description:typeof r?.description=="string"?r.description:void 0;return{name:o,description:a,raw:t}}s(mt,"normalizeToolSummary");function ht(t){if(!t)return[];if(Array.isArray(t.toolsJson))return t.toolsJson;if(t.metadataJson&&typeof t.metadataJson=="object"){let e=t.metadataJson.tools;if(Array.isArray(e))return e}return[]}s(ht,"extractDeploymentTools");async function O(t){let{handle:e,repo:r}=ut(t.target),o=await Se({apiBase:t.apiBase,apiKey:t.apiKey,useCache:t.useCache,cacheTtlMs:t.cacheTtlMs,forceRefresh:t.forceRefresh}),a=Pe(r),i=o.find(p=>p.handle&&p.handle!==e?!1:[p.repo,p.gitRepo,p.id].map(Pe).includes(a));if(!i)throw new Error(`app not found for ${e}/${r}`);return{app:i,handle:e,repo:r}}s(O,"resolveAppTarget");async function Se(t){if(t.useCache&&!t.forceRefresh){let r=await ce({apiBase:t.apiBase,apiKey:t.apiKey,ttlMs:t.cacheTtlMs});if(r)return r}let e=await v(t.apiBase,t.apiKey);return t.useCache&&await ue({apiBase:t.apiBase,apiKey:t.apiKey,apps:e}),e}s(Se,"fetchAppsWithCache");async function we(t){if(t.useCache&&!t.forceRefresh){let o=await me({apiBase:t.apiBase,apiKey:t.apiKey,ttlMs:t.cacheTtlMs});if(o)return o}let e=await k(t.apiBase,t.apiKey),r=Array.isArray(e.tools)?e.tools:[];return t.useCache&&await he({apiBase:t.apiBase,apiKey:t.apiKey,tools:r}),r}s(we,"fetchToolsWithCache");function dt(t){if(!t)return"POST";let e=t.toUpperCase();switch(e){case"GET":case"POST":case"PUT":case"DELETE":return e;default:throw new Error("method must be GET, POST, PUT, or DELETE")}}s(dt,"normalizeMethod");async function ft(t,e){let r,o,a;return await de(t,{...e,onConversationId:s(i=>{r=i,e?.onConversationId?.(i)},"onConversationId"),onItems:s(i=>{for(let p of i){let l=p;!o&&typeof l.appId=="string"&&(o=l.appId,e?.onAppId?.(l.appId)),!a&&typeof l.deploymentId=="string"&&(a=l.deploymentId,e?.onDeploymentId?.(l.deploymentId))}e?.onItems?.(i)},"onItems")}),{conversationId:r,appId:o,deploymentId:a}}s(ft,"consumeAgentCreateStream");function vn(t){let e=ct(t),r=at(t),o=lt(t),a=pt(t,o),i=it(t,r),p=t.cacheTtlMs??ie,l=t.useCache!==!1,m=s(async()=>{l&&await Promise.all([Se({apiBase:o,apiKey:e,useCache:l,cacheTtlMs:p,forceRefresh:!0}),we({apiBase:o,apiKey:e,useCache:l,cacheTtlMs:p,forceRefresh:!0})])},"refreshCache"),d=s(async(n,c)=>(await D(o,e,n,{branch:c}))?.id??null,"resolveLatestDeploymentId");return{baseUrl:r,apiUrl:o,chatApiUrl:a,toolUrl:i,apiKey:e,account:{get:s(async()=>se(o,e),"get"),health:s(async()=>re(o,e),"health")},chat:{providers:s(async()=>Re({apiBaseUrl:a,token:e}),"providers"),provider:s(async n=>Ae({apiBaseUrl:a,token:e,provider:n}),"provider"),models:s(async()=>ge({apiBaseUrl:a,token:e}),"models"),model:s(async n=>ye({apiBaseUrl:a,token:e,model:n}),"model"),send:s(async n=>Ce({...n,apiBaseUrl:a,token:e}),"send"),stream:s(n=>Oe({...n,apiBaseUrl:a,token:e}),"stream")},tool:{list:s(async(n,c)=>{let{app:u}=await O({apiBase:o,apiKey:e,target:n,useCache:l,cacheTtlMs:p,forceRefresh:c?.forceRefresh}),h=c?.deploymentId||await d(u.id,c?.branch);if(!h)return{app:u,deploymentId:null,tools:[]};let g=await I(o,e,h),y=ht(g).map(mt);return{app:u,deploymentId:h,tools:y}},"list"),run:s(async(n,c,u)=>{let{app:h}=await O({apiBase:o,apiKey:e,target:n,useCache:l,cacheTtlMs:p,forceRefresh:u?.forceRefresh}),g=u?.deploymentId||await d(h.id,u?.branch);if(!g)throw new Error("no deployments found");let f=dt(u?.method);return pe(i,e,{appId:h.id,deploymentId:g,toolName:c,method:f,body:u?.body,headers:u?.headers})},"run")},deploy:{watch:s(async(n,c)=>{let{app:u}=await O({apiBase:o,apiKey:e,target:n,useCache:l,cacheTtlMs:p,forceRefresh:c?.forceRefresh}),h=c?.deploymentId||await d(u.id,c?.branch);if(!h)throw new Error("no deployments found");let g=c?.intervalMs??5e3,f=c?.timeoutMs??240*1e3,y=[],S=new Set,Ee=Date.now(),R=null;for(;Date.now()-Ee<f;){let xe=await L(o,e,h);for(let C of xe)S.has(C.id)||(S.add(C.id),y.push(C),c?.onLog?.(C));if(R=(await B(o,e,h)).status??null,c?.onStatus?.(R),R==="failed")return{deploymentId:h,status:R,logs:y};if(R==="running"||R==="deployed")return{deploymentId:h,status:R,logs:y};await new Promise(C=>setTimeout(C,g))}return{deploymentId:h,status:"timeout",logs:y}},"watch")},template:{status:s(async(n,c)=>{let{app:u}=await O({apiBase:o,apiKey:e,target:n,useCache:l,cacheTtlMs:p,forceRefresh:c?.forceRefresh});return M(o,e,u.id)},"status"),branches:s(async(n,c)=>{let{app:u}=await O({apiBase:o,apiKey:e,target:n,useCache:l,cacheTtlMs:p,forceRefresh:c?.forceRefresh});return _(o,e,u.id)},"branches"),update:s(async(n,c)=>{let{app:u}=await O({apiBase:o,apiKey:e,target:n,useCache:l,cacheTtlMs:p,forceRefresh:c?.forceRefresh}),h=c?.environment==="preview"?"preview":"production";return H(o,e,u.id,{environment:h})},"update")},opentool:{recipesList:s(async(n={})=>F(o,e,n),"recipesList"),recipesSearch:s(async n=>G(o,e,n),"recipesSearch"),recipeGet:s(async n=>j(o,e,n),"recipeGet"),rulesGet:s(async n=>W(o,e,n),"rulesGet")},apps:{list:s(async n=>{let c=await Se({apiBase:o,apiKey:e,useCache:l,cacheTtlMs:p,forceRefresh:n?.forceRefresh});return n?.handle?c.filter(u=>u.handle===n.handle):c},"list"),tools:s(async n=>we({apiBase:o,apiKey:e,useCache:l,cacheTtlMs:p,forceRefresh:n?.forceRefresh}),"tools"),performance:s(async n=>ne(o,e,{appId:n?.appId}),"performance"),summary:s(async n=>oe(o,e,n.appId),"summary"),schedules:s(async n=>K(o,e,n.appId),"schedules"),schedulesStart:s(async n=>{let{appId:c,...u}=n;return z(o,e,c,u)},"schedulesStart"),schedulesStop:s(async n=>J(o,e,n.appId),"schedulesStop"),schedulesStopCurrent:s(async()=>$(o,e),"schedulesStopCurrent"),scheduleRunNow:s(async n=>V(o,e,n),"scheduleRunNow"),scheduleDelete:s(async n=>Y(o,e,n.appId,n.scheduleId),"scheduleDelete"),scheduleExecutionLogs:s(async n=>Q(o,e,n.scheduleId,{limit:n.limit}),"scheduleExecutionLogs"),scheduleExecutionLog:s(async n=>Z(o,e,n.runId),"scheduleExecutionLog"),deploymentScheduleExecutionLogs:s(async n=>X(o,e,n.deploymentId,{limit:n.limit}),"deploymentScheduleExecutionLogs"),executionTimeline:s(async n=>ee(o,e,n.appId,{limit:n.limit}),"executionTimeline"),assistantRun:s(async n=>ae(o,e,n),"assistantRun"),agentCreate:s(async(n,c)=>{let{refreshCache:u,...h}=n,g={...h,streamDeployLogs:h.streamDeployLogs??!0},f=await te(o,e,g);if(!f.ok){let S=await f.text().catch(()=>"");throw new Error(`agent create failed: ${f.status} ${S}`)}let y=await ft(f,c);if(l&&u!==!1)try{await m()}catch{}return y},"agentCreate"),toolsExecute:s(async n=>le(o,e,n),"toolsExecute"),deploy:s(async n=>E(o,e,n.appId,{environment:n.environment,commitSha:n.commitSha,branch:n.branch}),"deploy"),startApp:s(async n=>{let{appId:c,...u}=n;return b(o,e,c,u)},"startApp"),promotePreview:s(async n=>{let{appId:c,...u}=n;return x(o,e,c,u)},"promotePreview"),envGet:s(async n=>q(o,e,n.appId),"envGet"),envSet:s(async n=>N(o,e,n.appId,{envVars:n.envVars}),"envSet")},repo:{create:s(async n=>{let{refreshCache:c,...u}=n,h=await U(o,e,u);if(l&&c!==!1)try{await m()}catch{}return h},"create")},cache:{refresh:m}}}s(vn,"createClient");export{ie as DEFAULT_CACHE_TTL_MS,It as DEFAULT_LOCAL_PROFILE,w as DEFAULT_OPENPOND_API_BASE_URL,Le as DEFAULT_OPENPOND_CHAT_API_BASE_URL,be as DEFAULT_OPENPOND_OPCHAT_API_BASE_URL,P as DEFAULT_OPENPOND_WEB_BASE_URL,vt as DEFAULT_PROFILE_AGENT,an as OPENPOND_MANIFEST_FILE_NAME,Ot as OpenPondProfileSetupRequiredError,Rt as OpenPondSandboxClient,Dt as PROFILE_MANIFEST,Bt as PROFILE_REPO_MANIFEST,Ct as SANDBOX_RUNTIME_PROFILE_IDS,ln as SANDBOX_TEMPLATE_BUILD_PLAN_FILE_NAME,pn as SANDBOX_TEMPLATE_BUILD_PLAN_KIND,rn as SANDBOX_TEMPLATE_PREVIEW_PORT_MAX,sn as SANDBOX_TEMPLATE_PREVIEW_PORT_MIN,cn as SandboxTemplateManifestSchema,un as SandboxTemplateValidationDiagnosticSchema,qe as apiFetch,Tt as assertOpenPondProfileActionReady,St as buildOpenPondProfileSetupGate,re as checkOpenPondApiHealth,wt as collectProfileSourceUploadEntries,tn as commitActiveProfileChanges,ke as commitFiles,rt as computeAtr,ot as computeBollinger,et as computeEma,A as computeEmaSeries,nt as computeMaCross,tt as computeMacd,st as computePriceChange,Xe as computeRsi,Ze as computeSma,T as computeSmaSeries,ft as consumeAgentCreateStream,de as consumeStream,te as createAgentFromPrompt,vn as createClient,Fe as createHeadlessApps,Ke as createLocalProject,At as createOpenPondSandboxClient,U as createRepo,_t as defaultLocalProfileRepoPath,gn as defineSandboxTemplate,Y as deleteOrArchiveSchedule,E as deployApp,H as deployLatestTemplate,Ht as emptyProfileState,pe as executeHostedTool,le as executeUserTool,Ge as fetchToolManifest,Pt as formatOpenPondProfileSetupRequirement,fn as formatSandboxTemplateDiagnostics,Je as formatStreamItem,q as getAppEnvironment,ee as getAppExecutionTimeline,oe as getAppRuntimeSummary,ce as getCachedApps,me as getCachedTools,Be as getConfigPath,I as getDeploymentDetail,L as getDeploymentLogs,B as getDeploymentStatus,D as getLatestDeploymentForApp,ye as getOpChatModel,Ae as getOpChatProvider,se as getOpenPondAccount,j as getOpenToolRecipe,W as getOpenToolRules,Z as getScheduleExecutionLog,M as getTemplateStatus,ne as getUserPerformance,xt as hostedPublishStatusFromPayload,Lt as hostedRunStatusFromRunSummary,bt as hostedRunSummaryFromPayload,Et as hostedSourceCheckStatusFromPayload,Nt as initLocalProfileRepo,Vt as inspectOpenPondProfileSource,Ft as installAgentPackageIntoActiveProfile,K as listAppSchedules,v as listApps,Ue as listConfiguredProfiles,X as listDeploymentScheduleExecutionLogs,Ve as listHostedModels,Ye as listHostedProviders,ge as listOpChatModels,Re as listOpChatProviders,F as listOpenToolRecipes,Q as listScheduleExecutionLogs,_ as listTemplateBranches,k as listUserTools,ve as loadConfig,Ie as loadGlobalConfig,qt as loadLocalProfileRepo,Wt as loadOpenPondProfileLibrary,Gt as loadOpenPondProfileState,zt as loadOpenPondProfileStateForRef,Yt as loadOpenPondProfileStateFromSource,Mt as mergeActiveLocalProfileConfig,Ut as mergeProfileRepoManifestEntry,ze as normalizeDataFrames,yt as normalizeSandboxApiUrl,jt as openPondProfileRef,dn as parseSandboxTemplateYaml,je as postAgentDigest,on as prepareAgentSdkRuntimePackage,x as promotePreviewToProduction,kt as registerLocalProfileRepo,$t as removeOpenPondProfile,Kt as renameActiveProfileAgent,Qt as requireActiveLocalProfile,$e as resolveHostedChatApiBaseUrl,fe as resolveOpChatApiBaseUrl,We as resolveWorkerBaseUrl,Zt as runAgentSdkProjectCommand,ae as runAssistantMode,Qe as runOpChatSmoke,en as runProfileCheck,Xt as runProfileSdkCommand,V as runScheduleNow,Sn as sandboxTemplateBuildMetadata,Tn as sandboxTemplateBuildPlan,Rn as sandboxTemplateDurableVolume,On as sandboxTemplateExecutableEntries,Cn as sandboxTemplateFileInput,wn as sandboxTemplateJsonSchema,An as sandboxTemplatePreviewPort,yn as sandboxTemplateResources,Pn as sandboxTemplateScaffoldFiles,He as saveConfig,Ne as saveGlobalConfig,_e as saveProfileApiKey,nn as saveProfilePushStatus,G as searchOpenToolRecipes,Jt as selectOpenPondProfile,Ce as sendHostedChatTurn,Me as setActiveProfile,ue as setCachedApps,he as setCachedTools,b as startAppLifecycle,z as startAppSchedules,J as stopAppSchedules,$ as stopCurrentAppSchedules,Oe as streamHostedChatTurn,N as updateAppEnvironment,De as updateGlobalConfig,hn as validateSandboxTemplateManifest,mn as validateSandboxTemplateYaml};
@@ -1,4 +1,4 @@
1
- import type { OpenPondSandboxRuntimeHandle, SandboxExecInput, SandboxFileDownloadInput, SandboxFileListInput, SandboxFileMkdirInput, SandboxFileMoveInput, SandboxFileSearchInput, SandboxOpenPortInput, SandboxRecord, SandboxRuntime, SandboxRuntimeCheckpointInput, SandboxRuntimeEventInput, SandboxRuntimePromoteInput, SandboxRuntimePromoteResponse, SandboxRuntimeSourcePreserveInput, SandboxRuntimeSourcePreserveResponse, SandboxRuntimeSandboxCreateInput, SandboxRuntimeSandboxResponse, SandboxRuntimeTransitionInput, SandboxRuntimeEventsResponse, SandboxRuntimeEventResponse, SandboxAsyncRequestOptions, SandboxFileUploadResponse, SandboxFileDownloadResponse, SandboxFileDeleteResponse, SandboxFileListResponse, SandboxFileMkdirResponse, SandboxFileMoveResponse, SandboxFileStatResponse, SandboxFileSearchResponse, SandboxOpenPortResponse, SandboxExecResponse } from "./types/index.js";
1
+ import type { OpenPondSandboxRuntimeHandle, SandboxExecInput, SandboxFileDownloadInput, SandboxFileListInput, SandboxFileMkdirInput, SandboxFileMoveInput, SandboxFileSearchInput, SandboxOpenPortInput, SandboxRecord, SandboxRestoreInput, SandboxRestoreResponse, SandboxStartInput, SandboxRuntime, SandboxRuntimeCheckpointInput, SandboxRuntimeEventInput, SandboxRuntimePromoteInput, SandboxRuntimePromoteResponse, SandboxRuntimeSourcePreserveInput, SandboxRuntimeSourcePreserveResponse, SandboxRuntimeSandboxCreateInput, SandboxRuntimeSandboxResponse, SandboxRuntimeTransitionInput, SandboxRuntimeEventsResponse, SandboxRuntimeEventResponse, SandboxAsyncRequestOptions, SandboxFileUploadResponse, SandboxFileDownloadResponse, SandboxFileDeleteResponse, SandboxFileListResponse, SandboxFileMkdirResponse, SandboxFileMoveResponse, SandboxFileStatResponse, SandboxFileSearchResponse, SandboxOpenPortResponse, SandboxExecResponse } from "./types/index.js";
2
2
  export type SandboxRuntimeHandleClient = {
3
3
  getSandboxRuntime(runtimeId: string): Promise<SandboxRuntime>;
4
4
  createSandboxRuntimeSandbox(runtimeId: string, input?: SandboxRuntimeSandboxCreateInput, options?: SandboxAsyncRequestOptions): Promise<SandboxRuntimeSandboxResponse>;
@@ -13,12 +13,10 @@ export type SandboxRuntimeHandleClient = {
13
13
  teamId?: string;
14
14
  }): Promise<SandboxRuntimeSourcePreserveResponse>;
15
15
  get(sandboxId: string): Promise<SandboxRecord>;
16
- start(sandboxId: string, options?: SandboxAsyncRequestOptions): Promise<{
17
- sandbox: SandboxRecord;
18
- }>;
19
- restore(sandboxId: string): Promise<{
16
+ start(sandboxId: string, options?: SandboxAsyncRequestOptions & SandboxStartInput): Promise<{
20
17
  sandbox: SandboxRecord;
21
18
  }>;
19
+ restore(sandboxId: string, input?: SandboxRestoreInput): Promise<SandboxRestoreResponse>;
22
20
  uploadFile(sandboxId: string, path: string, contents: string): Promise<SandboxFileUploadResponse>;
23
21
  downloadFile(sandboxId: string, path: string): Promise<string>;
24
22
  downloadFileResponse(sandboxId: string, input: string | SandboxFileDownloadInput): Promise<SandboxFileDownloadResponse>;
@@ -1,5 +1,5 @@
1
1
  import { type ApiFetchOptions } from "../api/core.js";
2
- import type { SandboxIntegrationConnectionLeaseInput, SandboxCreateInput, SandboxCreateOptions, SandboxAsyncRequestOptions, SandboxForkInput, SandboxExecInput, SandboxProcessStartInput, SandboxPtyStartInput, SandboxPtyInput, SandboxOpenPortInput, SandboxGitDiffInput, SandboxGitPatchExportInput, SandboxGitBranchInput, SandboxGitCommitInput, SandboxGitPullInput, SandboxGitPushInput, SandboxFileDownloadInput, SandboxFileListInput, SandboxFileMkdirInput, SandboxFileMoveInput, SandboxFileSearchInput, SandboxReceipt, SandboxSnapshotValidateInput, SandboxSnapshotUpdateInput, SandboxSnapshotInput, SandboxRecord, SandboxIntegrationLeasesResponse, SandboxExecResponse, SandboxProcessStartResponse, SandboxProcessListResponse, SandboxProcessStatusResponse, SandboxProcessStopResponse, SandboxPtyStartResponse, SandboxPtyListResponse, SandboxPtyStatusResponse, SandboxPtyInputResponse, SandboxPtyStopResponse, SandboxOpenPortResponse, SandboxSnapshotResponse, SandboxSnapshotValidationResponse, SandboxForkResponse, SandboxReceiptResponse, SandboxLifecycleAcceptedResponse, SandboxStartResponse, SandboxRestoreResponse, SandboxGitStatusResponse, SandboxGitDiffResponse, SandboxGitPatchExportResponse, SandboxGitBranchResponse, SandboxGitCommitResponse, SandboxGitPullResponse, SandboxGitPushResponse, SandboxFileUploadResponse, SandboxFileDownloadResponse, SandboxFileListResponse, SandboxFileDeleteResponse, SandboxFileMkdirResponse, SandboxFileMoveResponse, SandboxFileStatResponse, SandboxFileSearchResponse, SandboxBillingStatusResponse, SandboxPricingResponse, SandboxCostSummaryResponse, OpenPondSandboxClientOptions } from "./types/index.js";
2
+ import type { SandboxIntegrationConnectionLeaseInput, SandboxCreateInput, SandboxCreateOptions, SandboxAsyncRequestOptions, SandboxForkInput, SandboxExecInput, SandboxProcessStartInput, SandboxPtyStartInput, SandboxPtyInput, SandboxOpenPortInput, SandboxGitDiffInput, SandboxGitPatchExportInput, SandboxGitBranchInput, SandboxGitCommitInput, SandboxGitPullInput, SandboxGitPushInput, SandboxFileDownloadInput, SandboxFileListInput, SandboxFileMkdirInput, SandboxFileMoveInput, SandboxFileSearchInput, SandboxReceipt, SandboxSnapshotValidateInput, SandboxSnapshotUpdateInput, SandboxSnapshotInput, SandboxSnapshotRetentionQuoteInput, SandboxSnapshotJobResponse, SandboxRestoreInput, SandboxStartInput, SandboxRecord, SandboxIntegrationLeasesResponse, SandboxExecResponse, SandboxProcessStartResponse, SandboxProcessListResponse, SandboxProcessStatusResponse, SandboxProcessStopResponse, SandboxPtyStartResponse, SandboxPtyListResponse, SandboxPtyStatusResponse, SandboxPtyInputResponse, SandboxPtyStopResponse, SandboxOpenPortResponse, SandboxSnapshotResponse, SandboxSnapshotValidationResponse, SandboxForkResponse, SandboxReceiptResponse, SandboxLifecycleAcceptedResponse, SandboxStartResponse, SandboxRestoreResponse, SandboxGitStatusResponse, SandboxGitDiffResponse, SandboxGitPatchExportResponse, SandboxGitBranchResponse, SandboxGitCommitResponse, SandboxGitPullResponse, SandboxGitPushResponse, SandboxFileUploadResponse, SandboxFileDownloadResponse, SandboxFileListResponse, SandboxFileDeleteResponse, SandboxFileMkdirResponse, SandboxFileMoveResponse, SandboxFileStatResponse, SandboxFileSearchResponse, SandboxBillingStatusResponse, SandboxPricingResponse, SandboxCostSummaryResponse, OpenPondSandboxClientOptions } from "./types/index.js";
3
3
  export declare class OpenPondSandboxInstanceClient {
4
4
  readonly apiKey: string;
5
5
  readonly apiRootUrl: string;
@@ -41,14 +41,20 @@ export declare class OpenPondSandboxInstanceClient {
41
41
  moveFile(sandboxId: string, input: SandboxFileMoveInput): Promise<SandboxFileMoveResponse>;
42
42
  searchFiles(sandboxId: string, input: SandboxFileSearchInput): Promise<SandboxFileSearchResponse>;
43
43
  openPort(sandboxId: string, input: SandboxOpenPortInput): Promise<SandboxOpenPortResponse>;
44
- createSnapshot(sandboxId: string, input: SandboxSnapshotInput): Promise<SandboxSnapshotResponse>;
44
+ createSnapshot(sandboxId: string, input: SandboxSnapshotInput & {
45
+ async: true;
46
+ }): Promise<SandboxSnapshotJobResponse>;
47
+ createSnapshot(sandboxId: string, input: SandboxSnapshotInput & {
48
+ async?: false;
49
+ }): Promise<SandboxSnapshotResponse>;
50
+ createSnapshot(sandboxId: string, input: SandboxSnapshotInput): Promise<SandboxSnapshotResponse | SandboxSnapshotJobResponse>;
45
51
  updateSnapshot(sandboxId: string, snapshotId: string, input: SandboxSnapshotUpdateInput): Promise<SandboxSnapshotResponse>;
46
52
  validateSnapshot(sandboxId: string, snapshotId: string, input?: SandboxSnapshotValidateInput): Promise<SandboxSnapshotValidationResponse>;
47
53
  publishSnapshot(sandboxId: string, snapshotId: string): Promise<SandboxSnapshotResponse>;
48
54
  fork(sandboxId: string, input?: SandboxForkInput): Promise<SandboxForkResponse>;
49
55
  stop(sandboxId: string, options?: SandboxAsyncRequestOptions): Promise<SandboxReceiptResponse | SandboxLifecycleAcceptedResponse>;
50
- start(sandboxId: string, options?: SandboxAsyncRequestOptions): Promise<SandboxStartResponse>;
51
- restore(sandboxId: string): Promise<SandboxRestoreResponse>;
56
+ start(sandboxId: string, options?: SandboxAsyncRequestOptions & SandboxStartInput): Promise<SandboxStartResponse>;
57
+ restore(sandboxId: string, input?: SandboxRestoreInput): Promise<SandboxRestoreResponse>;
52
58
  delete(sandboxId: string, options?: SandboxAsyncRequestOptions): Promise<SandboxRecord>;
53
59
  receipts(sandboxId: string): Promise<SandboxReceipt[]>;
54
60
  logs(sandboxId: string): Promise<string[]>;
@@ -59,7 +65,7 @@ export declare class OpenPondSandboxInstanceClient {
59
65
  gitCommit(sandboxId: string, input: SandboxGitCommitInput): Promise<SandboxGitCommitResponse>;
60
66
  gitPull(sandboxId: string, input?: SandboxGitPullInput): Promise<SandboxGitPullResponse>;
61
67
  gitPush(sandboxId: string, input?: SandboxGitPushInput): Promise<SandboxGitPushResponse>;
62
- billing(sandboxId: string): Promise<SandboxBillingStatusResponse>;
68
+ billing(sandboxId: string, input?: SandboxSnapshotRetentionQuoteInput): Promise<SandboxBillingStatusResponse>;
63
69
  pricing(): Promise<SandboxPricingResponse>;
64
70
  costs(input?: {
65
71
  teamId?: string;
@@ -85,6 +85,8 @@ export type SandboxBillingStatus = {
85
85
  billingModel: "reserve_capture" | "session" | "actual_usage";
86
86
  computeUsage?: SandboxComputeUsageStatus;
87
87
  nativeRootStorage?: SandboxNativeRootStorageStatus;
88
+ snapshotRetention?: SandboxSnapshotRetentionStatus[];
89
+ snapshotRetentionOffer?: SandboxSnapshotRetentionOffer;
88
90
  reservationStatus: SandboxReservation["status"];
89
91
  budgetUsd: string | null;
90
92
  reservedUsd: string;
@@ -255,3 +257,54 @@ export interface SandboxNativeRootStorageStatus {
255
257
  status: "current" | "funding_shortfall";
256
258
  shortfallReason: "credit_exhausted" | "member_cap_reached" | "billing_suspended" | null;
257
259
  }
260
+ /** Finite reserved-source-disk retail; captured snapshot byte size is unknown. */
261
+ export type SandboxSnapshotRetentionStatus = {
262
+ snapshotId: string;
263
+ phase: "reserved" | "capture_submitted" | "ready" | "deleting" | "deleted" | "cancelled";
264
+ termsSha256: string;
265
+ reservedDiskGiB: number;
266
+ ttlSeconds: number;
267
+ expiresAt: string;
268
+ maximumUsd: string;
269
+ quotedUsd: string;
270
+ price: {
271
+ version: string;
272
+ currency: "USD";
273
+ unit: "GiB-second";
274
+ unitPriceUsd: string;
275
+ };
276
+ quantityGiBMillis: number;
277
+ ratedUsd: string;
278
+ chargedUsd: string;
279
+ includedStandardUsd: string;
280
+ prepaidStandardUsd: string;
281
+ prepaidPayableUsd: string;
282
+ heldIncludedStandardUsd: string;
283
+ heldPrepaidPayableUsd: string;
284
+ releasedUnusedStandardUsd: string | null;
285
+ meteredTo: string;
286
+ closedAt: string | null;
287
+ status: "current" | "funding_shortfall" | "external_settlement" | "internal_tracked";
288
+ shortfallReason: "credit_exhausted" | "member_cap_reached" | "billing_suspended" | null;
289
+ };
290
+ export type SandboxSnapshotRetentionQuoteInput = {
291
+ snapshotRetentionTtlSeconds: number;
292
+ snapshotRetentionClass: "ephemeral" | "cached" | "pinned";
293
+ };
294
+ /** Discovery/quote only; creates no reservation or execution authority. */
295
+ export type SandboxSnapshotRetentionOffer = {
296
+ available: false;
297
+ reason: "unsupported_source" | "source_unavailable" | "billing_unavailable" | "terms_unavailable" | "retention_out_of_range";
298
+ } | {
299
+ available: true;
300
+ termsSha256: string;
301
+ price: SandboxSnapshotRetentionStatus["price"];
302
+ reservedDiskGiB: number;
303
+ maximumTtlSeconds: number;
304
+ maximumCustomerUsd: string;
305
+ quote: null | {
306
+ retentionClass: "ephemeral" | "cached" | "pinned";
307
+ ttlSeconds: number;
308
+ quotedUsd: string;
309
+ };
310
+ };
@@ -1,4 +1,4 @@
1
- import type { OpenPondOrganization, OpenPondOrganizationMcpServer, OpenPondOrganizationMember, SandboxBillingStatus, SandboxBudget, SandboxCommand, SandboxCostSummary, SandboxFileEntry, SandboxFileRef, SandboxFileSearchMatch, SandboxGitBranch, SandboxGitCommit, SandboxGitDiff, SandboxGitPatchExport, SandboxGitRemoteOperation, SandboxGitStatus, SandboxIntegrationConnection, SandboxIntegrationLeaseInput, SandboxIntegrationLeaseRef, SandboxPreviewPort, SandboxPricingRateCard, SandboxProcess, SandboxPtySession, SandboxReceipt, SandboxRecord, SandboxScheduleRecord, SandboxScheduleRun, SandboxSnapshot, SandboxSnapshotValidationResult, SandboxTemplateBuildRecord, SandboxTemplateCatalogEntry } from "./index.js";
1
+ import type { OpenPondOrganization, OpenPondOrganizationMcpServer, OpenPondOrganizationMember, SandboxBillingStatus, SandboxBudget, SandboxCommand, SandboxCostSummary, SandboxFileEntry, SandboxFileRef, SandboxFileSearchMatch, SandboxGitBranch, SandboxGitCommit, SandboxGitDiff, SandboxGitPatchExport, SandboxGitRemoteOperation, SandboxGitStatus, SandboxIntegrationConnection, SandboxIntegrationLeaseInput, SandboxIntegrationLeaseRef, SandboxPreviewPort, SandboxPricingRateCard, SandboxProcess, SandboxPtySession, SandboxReceipt, SandboxRecord, SandboxScheduleRecord, SandboxScheduleRun, SandboxSnapshot, SandboxSnapshotJob, SandboxSnapshotValidationResult, SandboxTemplateBuildRecord, SandboxTemplateCatalogEntry } from "./index.js";
2
2
  export type SandboxIntegrationConnectionsResponse = {
3
3
  teamId: string;
4
4
  connections: SandboxIntegrationConnection[];
@@ -61,6 +61,10 @@ export type SandboxSnapshotResponse = {
61
61
  sandbox: SandboxRecord;
62
62
  snapshot: SandboxSnapshot;
63
63
  };
64
+ export type SandboxSnapshotJobResponse = {
65
+ sandbox: SandboxRecord;
66
+ snapshotJob: SandboxSnapshotJob;
67
+ };
64
68
  export type SandboxSnapshotValidationResponse = {
65
69
  sandbox: SandboxRecord;
66
70
  snapshot: SandboxSnapshot;
@@ -204,6 +208,12 @@ export type SandboxStartResponse = {
204
208
  };
205
209
  export type SandboxRestoreResponse = {
206
210
  sandbox: SandboxRecord;
211
+ restoreIntent?: {
212
+ operationId: string;
213
+ intentSha256: string;
214
+ checkpointId: string;
215
+ phase: "prepared" | "deleting" | "root_closed" | "booting" | "running";
216
+ };
207
217
  };
208
218
  export type SandboxReceiptsResponse = {
209
219
  receipts: SandboxReceipt[];
@@ -1,4 +1,4 @@
1
- import type { SandboxCommand, SandboxState } from "./index.js";
1
+ import type { SandboxCommand, SandboxState, SandboxSnapshotRetentionStatus } from "./index.js";
2
2
  export type SandboxSnapshotTemplateVisibility = "private" | "team";
3
3
  export type SandboxSnapshotTemplateInput = {
4
4
  name: string;
@@ -80,13 +80,60 @@ export type SandboxSnapshotUpdateInput = {
80
80
  template?: SandboxSnapshotTemplateUpdateInput;
81
81
  retention?: SandboxSnapshotRetentionUpdateInput;
82
82
  };
83
- export type SandboxSnapshotInput = Record<string, unknown>;
83
+ /** Capture options. Native filesystem capture requires finite retention and
84
+ * an accepted funding quote; template/cache operations depend on capability. */
85
+ export type SandboxSnapshotInput = Record<string, unknown> & {
86
+ name: string;
87
+ template?: SandboxSnapshotTemplateInput;
88
+ replay?: Record<string, unknown> & {
89
+ retention?: {
90
+ class?: SandboxSnapshotReplayRetentionClass;
91
+ ttlSeconds?: number | null;
92
+ };
93
+ };
94
+ cachePolicy?: {
95
+ packageCaches?: "keep" | "clean_before_capture";
96
+ hotCache?: "eligible" | "disabled";
97
+ };
98
+ async?: boolean;
99
+ retentionFunding?: {
100
+ termsSha256: string;
101
+ maxUsd: string;
102
+ };
103
+ };
104
+ /** Descriptor identity does not imply a measured filesystem checksum. */
105
+ export type SandboxFilesystemCheckpoint = {
106
+ custodyId: string;
107
+ descriptorSha256: string | null;
108
+ phase: "reserved" | "capture_submitted" | "ready" | "deleting" | "deleted" | "cancelled";
109
+ measuredSizeBytes: number | null;
110
+ checksumSha256: string | null;
111
+ };
112
+ /** Prepares replacement of an already stopped root. Does not start compute. */
113
+ export type SandboxRestoreInput = {
114
+ operationId: string;
115
+ checkpointId: string;
116
+ checkpointCustodyId: string;
117
+ expectedSourceUpdatedAt: string;
118
+ replaceStoppedRoot: true;
119
+ };
120
+ export type SandboxStartInput = {
121
+ restore?: {
122
+ operationId: string;
123
+ intentSha256: string;
124
+ /** Positive USD with six decimal places. */
125
+ maximumUsd: string;
126
+ /** Absolute accepted deadline; retries cannot extend it. */
127
+ executionUntil: string;
128
+ };
129
+ };
84
130
  export type SandboxSnapshot = {
85
131
  id: string;
86
132
  sandboxId: string;
87
133
  name: string;
88
134
  state: "ready";
89
- sizeGb: number;
135
+ sizeGb: number | null;
136
+ checkpoint?: SandboxFilesystemCheckpoint;
90
137
  template?: SandboxSnapshotTemplate | null;
91
138
  replay?: SandboxSnapshotReplayManifest | null;
92
139
  metadata?: Record<string, unknown>;
@@ -110,6 +157,7 @@ export type SandboxArchiveRef = {
110
157
  restoredAt: string | null;
111
158
  };
112
159
  export type SandboxSnapshotCatalogEntry = {
160
+ checkpoint?: SandboxFilesystemCheckpoint;
113
161
  id: string;
114
162
  kind: "snapshot" | "archive";
115
163
  sandboxId: string;
@@ -128,6 +176,7 @@ export type SandboxSnapshotCatalogEntry = {
128
176
  retentionClass: SandboxSnapshotReplayRetentionClass | null;
129
177
  estimatedMonthlyUsd: string | null;
130
178
  pricingSource: "configured" | "not_configured";
179
+ retention?: SandboxSnapshotRetentionStatus;
131
180
  };
132
181
  template: SandboxSnapshotTemplate | null;
133
182
  replay?: SandboxSnapshotReplayManifest | null;
@@ -26,7 +26,7 @@
26
26
  }
27
27
  ],
28
28
  "package": "openpond",
29
- "version": "0.2.68",
29
+ "version": "0.2.69",
30
30
  "sourceFiles": [
31
31
  {
32
32
  "path": "openpond-cli/SKILL.md",
@@ -851,6 +851,7 @@ Options:
851
851
  --branch <string>
852
852
  --budget <number>
853
853
  --budget-usd <number>
854
+ --checkpoint-custody-id <string>
854
855
  --cleanup
855
856
  --cols <integer>
856
857
  --command <string>
@@ -873,7 +874,9 @@ Options:
873
874
  --env-literal <string>
874
875
  --env-name <string>
875
876
  --env-ref <string>
877
+ --execution-until <string>
876
878
  --expected-mpp-mode <string>
879
+ --expected-source-updated-at <string>
877
880
  --expected-version <integer>
878
881
  --fail-on-unpreserved-changes
879
882
  --ff-only
@@ -899,12 +902,14 @@ Options:
899
902
  --max-bytes <integer>
900
903
  --max-duration-seconds <integer>
901
904
  --max-entries <number>
905
+ --maximum-usd <string>
902
906
  --max-results <number>
903
907
  --memory-gb <number>
904
908
  --message <string>
905
909
  --name <string>
906
910
  --no-preview
907
911
  --offset-bytes <integer>
912
+ --operation-id <string>
908
913
  --overwrite
909
914
  --params <json>
910
915
  --path <string>
@@ -920,9 +925,15 @@ Options:
920
925
  --recursive
921
926
  --registry-secret-ref <string>
922
927
  --remote <string>
928
+ --replace-stopped-root
923
929
  --replay-state <string>
924
930
  --repo <string>
925
931
  --respond-async
932
+ --restore-intent-sha256 <string>
933
+ --retention-class <string>
934
+ --retention-max-usd <string>
935
+ --retention-terms-sha256 <string>
936
+ --retention-ttl-seconds <integer>
926
937
  --rows <integer>
927
938
  --runtime-agent-id <string>
928
939
  --runtime-base-branch <string>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openpond",
3
- "version": "0.2.68",
3
+ "version": "0.2.69",
4
4
  "license": "MIT",
5
5
  "description": "OpenPond CLI and local harness",
6
6
  "main": "dist/index.js",
@@ -1,12 +0,0 @@
1
- import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import{a as h,b as y}from"./chunk-KTIBXRWQ.js";import{a as v}from"./chunk-V24VHT76.js";import{b as T,c as L}from"./chunk-BSHAIAXY.js";import"./chunk-XWPC3AN4.js";import{c as q}from"./chunk-3M53YXEI.js";import"./chunk-4N4EH3RJ.js";import"./chunk-GY7YSD6J.js";import"./chunk-KUE46HTH.js";import{a as j,b as l}from"./chunk-GLUWATL5.js";import"./chunk-JCLTFDVW.js";import"./chunk-6FA3GG5B.js";import{v as A}from"./chunk-SV7ZBEK2.js";import"./chunk-2MEOUS24.js";import"./chunk-HNQPEOJD.js";import"./chunk-RCT3O3HQ.js";import{f as $}from"./chunk-UGOK7VTC.js";import"./chunk-ZFJWA4JK.js";import"./chunk-X2J2P5ZT.js";import{a as r}from"./chunk-FTQLQJQV.js";function k(o){return{list:r((e={})=>o.listSandboxRuntimes(e),"list"),create:r(e=>o.createSandboxRuntime(e),"create"),handle:r((e,t=null)=>o.sandboxRuntime(e,t),"handle"),get:r(e=>o.getSandboxRuntime(e),"get"),createSandbox:r((e,t={},n={})=>o.createSandboxRuntimeSandbox(e,t,n),"createSandbox"),updateStatus:r((e,t)=>o.updateSandboxRuntimeStatus(e,t),"updateStatus"),events:r(e=>o.listSandboxRuntimeEvents(e),"events"),event:r((e,t)=>o.emitSandboxRuntimeEvent(e,t),"event"),checkpoint:r((e,t={})=>o.checkpointSandboxRuntime(e,t),"checkpoint"),promote:r((e,t,n={})=>o.promoteSandboxRuntime(e,t,n),"promote"),preserveSource:r((e,t={},n={})=>o.preserveSandboxRuntimeSource(e,t,n),"preserveSource")}}r(k,"createSandboxRuntimeNamespace");function E(o){return{list:r((e={})=>o.list(e),"list"),create:r(e=>o.create(e),"create"),get:r(e=>o.get(e),"get"),pricing:r(()=>o.pricing(),"pricing"),costs:r((e={})=>o.costs(e),"costs")}}r(E,"createSandboxNamespace");function F(o){return{list:r(e=>o.listProjects(e),"list"),upsert:r(e=>o.upsertProject(e),"upsert"),upsertGitRemote:r(e=>o.upsertProjectGitRemote(e),"upsertGitRemote"),get:r((e,t)=>o.getProject(e,t),"get"),update:r((e,t)=>o.updateProject(e,t),"update"),sync:r((e,t)=>o.syncProject(e,t),"sync"),ensureGitRemote:r((e,t)=>o.ensureProjectGitRemote(e,t),"ensureGitRemote"),getGitRemote:r((e,t)=>o.ensureProjectGitRemote(e,t),"getGitRemote"),git:r((e,t)=>o.ensureProjectGitRemote(e,t),"git"),uploadSource:r((e,t)=>o.uploadProjectSource(e,t),"uploadSource"),archive:r((e,t)=>o.archiveProject(e,t),"archive")}}r(F,"createSandboxProjectNamespace");function B(o){return{get:r(e=>o.getHostedProfile(e),"get"),status:r(e=>o.getHostedProfile(e),"status"),ensureHosted:r(e=>o.ensureHostedProfile(e),"ensureHosted"),push:r(e=>o.pushHostedProfile(e),"push")}}r(B,"createSandboxProfileNamespace");function M(o){return{list:r(e=>o.listAgents(e),"list"),upsert:r(e=>o.upsertAgent(e),"upsert"),get:r((e,t)=>o.getAgent(e,t),"get"),update:r((e,t)=>o.updateAgent(e,t),"update"),archive:r((e,t)=>o.archiveAgent(e,t),"archive"),run:r((e,t)=>o.runAgent(e,t),"run"),sourceDeployPlan:r((e,t)=>o.getAgentSourceDeployPlan(e,t),"sourceDeployPlan"),manifestSnapshots:r((e,t)=>o.listAgentManifestSnapshots(e,t),"manifestSnapshots"),requestSourceChecks:r((e,t)=>o.requestAgentSourceChecks(e,t),"requestSourceChecks"),configureSourceSetup:r((e,t)=>o.configureAgentSourceSetup(e,t),"configureSourceSetup"),publishSource:r((e,t)=>o.publishAgentSource(e,t),"publishSource")}}r(M,"createSandboxAgentNamespace");function z(o,e,t=null){let n=r(async(a={},d={})=>{let b=await o.getSandboxRuntime(e);return b.sandboxId?o.get(b.sandboxId):o.createSandboxRuntimeSandbox(e,a,d).then(p=>p.sandbox)},"currentSandbox"),s=r(async(a={},d={})=>{let b=await o.getSandboxRuntime(e);if(!b.sandboxId)return o.createSandboxRuntimeSandbox(e,a,d).then(S=>S.sandbox);let p=await o.get(b.sandboxId);return p.state==="stopped"?o.start(p.id,d).then(S=>S.sandbox):p.state==="archived"?o.restore(p.id).then(S=>S.sandbox):p.state==="deleted"||p.state==="error"?o.createSandboxRuntimeSandbox(e,a,d).then(S=>S.sandbox):p},"resume");return{id:e,initial:t,get:r(()=>o.getSandboxRuntime(e),"get"),sandbox:n,resume:s,createSandbox:r((a={},d={})=>o.createSandboxRuntimeSandbox(e,a,d),"createSandbox"),status:r(async a=>{if(typeof a!="string")return o.updateSandboxRuntimeStatus(e,a);let d=await o.getSandboxRuntime(e);return o.updateSandboxRuntimeStatus(e,{status:a,expectedVersion:d.version})},"status"),events:r(()=>o.listSandboxRuntimeEvents(e),"events"),event:r(a=>o.emitSandboxRuntimeEvent(e,a),"event"),recordCommit:r((a,d={})=>o.emitSandboxRuntimeEvent(e,{...d,type:d.type??"git.commit",commitSha:a}),"recordCommit"),checkpointHint:r((a={})=>o.emitSandboxRuntimeEvent(e,{type:"workflow.checkpoint_hint",summary:a.summary??a.reason??"Workflow checkpoint hint",payload:{...a.payload,reason:a.reason??null},artifactRefs:a.artifactRefs,lifecycleHint:{kind:"checkpoint",reason:a.reason??null}}),"checkpointHint"),waitForUser:r(async(a={})=>{await o.emitSandboxRuntimeEvent(e,{type:"workflow.waiting_for_user",summary:a.summary??a.reason??"Waiting for user",payload:{...a.payload,reason:a.reason??null},lifecycleHint:{kind:"waiting_for_user",reason:a.reason??null}});let d=await o.getSandboxRuntime(e);return d.status==="waiting_for_user"?d:o.updateSandboxRuntimeStatus(e,{status:"waiting_for_user",expectedVersion:d.version,summary:a.summary??a.reason,metadata:{workflowWaitForUserReason:a.reason??null}})},"waitForUser"),keepAlive:r((a={})=>{let d=X(a);return o.emitSandboxRuntimeEvent(e,{type:"workflow.keepalive",summary:a.summary??a.reason??"Workflow keepalive",payload:{...a.payload,reason:a.reason??null,keepaliveUntil:d},lifecycleHint:{kind:"keepalive",reason:a.reason??null,keepaliveUntil:d}})},"keepAlive"),checkpoint:r(a=>o.checkpointSandboxRuntime(e,a),"checkpoint"),files:{write:r(async(a,d)=>o.uploadFile((await s()).id,a,d),"write"),read:r(async a=>o.downloadFile((await s()).id,a),"read"),readResponse:r(async a=>o.downloadFileResponse((await s()).id,a),"readResponse"),list:r(async(a={})=>o.listFiles((await s()).id,a),"list"),delete:r(async(a,d={})=>o.deleteFile((await s()).id,a,d),"delete"),search:r(async a=>o.searchFiles((await s()).id,a),"search"),stat:r(async a=>o.statFile((await s()).id,a),"stat"),mkdir:r(async a=>o.mkdir((await s()).id,a),"mkdir"),move:r(async a=>o.moveFile((await s()).id,a),"move")},commands:{run:r(async a=>o.exec((await s()).id,typeof a=="string"?{command:a}:a),"run")},ports:{expose:r(async a=>o.openPort((await s()).id,typeof a=="number"?{port:a}:a),"expose")},promote:r((a,d={})=>o.promoteSandboxRuntime(e,a,d),"promote"),preserveSource:r((a={},d={})=>o.preserveSandboxRuntimeSource(e,a,d),"preserveSource"),archive:r(async a=>{let d=a??(await o.getSandboxRuntime(e)).version;return o.updateSandboxRuntimeStatus(e,{status:"archived",expectedVersion:d})},"archive")}}r(z,"createSandboxRuntimeHandle");function X(o){if(o?.until instanceof Date)return o.until.toISOString();if(typeof o?.until=="string"&&o.until.trim())return new Date(o.until).toISOString();let e=typeof o?.seconds=="number"&&Number.isFinite(o.seconds)?Math.max(1,Math.trunc(o.seconds)):60;return new Date(Date.now()+e*1e3).toISOString()}r(X,"runtimeKeepaliveUntilIso");async function J(o,e={}){let t=`openpond-code-smoke-${Date.now()}`,n=`openpond-code-exec-ok:${t}`,s=`openpond-code-preview-ok:${t}`,i=`openpond-code-file-ok:${t}`,u=4173,m=null,a=null,d=!1,b=!1;try{let p=await D(o,await o.create({repo:e.repo??"https://github.com/octocat/Hello-World",resources:{cpu:e.cpu??1,memoryGb:e.memoryGb??1,diskGb:e.diskGb??8},budget:{maxUsd:e.budgetUsd??"0.05"},quotas:{maxSpendUsd:e.budgetUsd??"0.05",maxDurationSeconds:600,idleTimeoutSeconds:600,maxOpenPorts:2},metadata:{runId:t,source:"openpond-code-sandbox-smoke"}},{async:!0}));m=p.id;let S=e.expectedMppMode;if(S&&p.reservation.mpp?.mode!==S)throw new Error(`expected ${S} reservation, got ${p.reservation.mpp?.mode??"none"}`);if(!S&&!p.reservation.mpp?.mode)throw new Error("expected sandbox reservation MPP metadata");let P=await o.exec(p.id,{command:[`printf '${n}\\n'`,"test -f README && printf 'repo-clone-ok\\n'","cat > server.cjs <<'EOF'","const { createServer } = require('node:http');",`createServer((_request, response) => response.end('${s}')).listen(${u}, '0.0.0.0');`,"EOF","nohup node server.cjs > server.log 2>&1 & sleep 1"].join(`
3
- `),timeoutSeconds:120});if(P.command.status!=="succeeded")throw new Error(`expected command success, got ${P.command.status}`);if(!P.command.output.includes(n))throw new Error("expected exec marker");if(await o.uploadFile(p.id,"openpond-code-smoke.txt",i),await o.downloadFile(p.id,"openpond-code-smoke.txt")!==i)throw new Error("expected file roundtrip marker");let x=null;if(e.snapshot||e.fork){let g=await o.createSnapshot(p.id,{async:!0,name:`openpond-code-smoke-${t}`,replay:{entrypoints:[{command:"cat openpond-code-smoke.txt",name:"default"}],retention:{class:"pinned"},safety:{cleanup:"delete",idleTimeoutSeconds:600,internetEgress:"block",maxDurationSeconds:600,maxSpendUsd:e.budgetUsd??"0.05",publicPreview:!1},validation:{commands:[{command:"test -f openpond-code-smoke.txt"}]}}}),c=g.snapshot??(await te(o,p.id,g.snapshotJob?.snapshotId)).snapshot;if(x=c.id,c.state!=="ready")throw new Error(`expected ready snapshot, got ${c.state}`)}if(e.fork){if(!x)throw new Error("expected snapshot id before fork");let g=await D(o,(await o.forkSnapshot(x,{budget:{maxUsd:e.budgetUsd??"0.05"},metadata:{source:"openpond-code-sandbox-smoke-fork",templateSnapshotId:x}},{async:!0})).sandbox);a=g.id;let c=await o.exec(g.id,{command:"cat openpond-code-smoke.txt",timeoutSeconds:120});if(c.command.status!=="succeeded")throw new Error(`expected fork command success, got ${c.command.status}`);if(!c.command.output.includes(i))throw new Error("expected fork snapshot marker");e.keep||(await O(o,g.id),b=!0)}let C=null;if(e.preview!==!1){let g=await o.openPort(p.id,{label:"openpond-code-smoke",port:u}),c=await fetch(g.preview.url);C=c.status;let Q=await c.text();if(c.status!==200)throw new Error(`expected preview HTTP 200, got ${c.status}`);if(!Q.includes(s))throw new Error("expected preview marker")}let{sandbox:V,receipts:Y}=await Z(o,p.id);return e.keep||(await O(o,p.id),d=!0),{deleted:d,execOutput:P.command.output.trim(),fileRoundtrip:!0,forkSandboxId:a,previewStatus:C,receiptRefs:Y.map(g=>g.mpp.receiptRef??null),reservationRef:p.reservation.mpp?.reservationRef??null,runId:t,sandboxId:p.id,snapshotId:x,state:V.state}}finally{a&&!e.keep&&!b&&await N(o,a),m&&!e.keep&&!d&&await N(o,m)}}r(J,"runSandboxSmoke");async function Z(o,e){try{await o.stop(e)}catch{await o.stop(e,{async:!0})}let t=await _(o,e,new Set(["stopped","deleted"]),"stop"),n=await ee(o,e);if(n.length===0)throw new Error("expected receipt readback");return{sandbox:t,receipts:n}}r(Z,"stopSandboxForSmoke");async function O(o,e){try{let t=await o.delete(e);if(t.state==="deleted")return t;await o.delete(e,{async:!0})}catch{await o.delete(e,{async:!0})}return _(o,e,new Set(["deleted"]),"delete")}r(O,"deleteSandboxForSmoke");async function N(o,e){try{await O(o,e)}catch{await o.delete(e,{async:!0}).catch(()=>{})}}r(N,"cleanupSandboxBestEffort");async function _(o,e,t,n){let u=Date.now()+3e5,m=await o.get(e);for(;Date.now()<u;){if(t.has(m.state))return m;if(m.state==="error")throw new Error(`sandbox ${n} failed: ${e}`);await I(3e3),m=await o.get(e)}throw new Error(`sandbox ${n} did not reach ${[...t].join("/")} before timeout: ${e} (${m.state})`)}r(_,"waitForSandboxState");async function ee(o,e){let s=Date.now()+12e4,i=await o.receipts(e);for(;Date.now()<s;){if(i.length>0)return i;await I(3e3),i=await o.receipts(e)}return i}r(ee,"waitForReceipts");async function D(o,e){if(e.state==="running"||e.state==="stopped")return e;if(e.state==="error")throw new Error(`sandbox create failed: ${e.id}
4
- ${e.logs.join(`
5
- `)}`);let t=12*6e4,n=3e3,s=Date.now()+t,i=e;for(;Date.now()<s;){if(await I(n),i=await o.get(e.id),i.state==="running"||i.state==="stopped")return i;if(i.state==="error")throw new Error(`sandbox create failed: ${i.id}
6
- ${i.logs.join(`
7
- `)}`)}throw new Error(`sandbox create did not reach running state before timeout: ${i.id} (${i.state})`)}r(D,"waitForCreateReady");async function te(o,e,t){if(!t)throw new Error("snapshot job did not return snapshot id");let n=12*6e4,s=3e3,i=Date.now()+n,u=await o.get(e);for(;Date.now()<i;){let m=u.snapshots?.find(d=>d.id===t);if(m?.state==="ready")return{sandbox:u,snapshot:m};let a=u.snapshotJobs?.find(d=>d.snapshotId===t);if(a?.status==="failed")throw new Error(`snapshot job failed: ${a.error??t}`);await I(s),u=await o.get(e)}throw new Error(`snapshot did not reach ready state before timeout: ${t}`)}r(te,"waitForSnapshotReady");function I(o){return new Promise(e=>setTimeout(e,o))}r(I,"sleep");function R(o={}){return o.async||o.respondAsync?{Prefer:"respond-async"}:void 0}r(R,"asyncRequestHeaders");async function w(o){let e=await h(o.sandboxApiUrl,o.apiKey,o.path,{timeoutMs:0,maxResponseBytes:0});if(!e.body)return;let t=e.body.getReader(),n=new TextDecoder,s="";try{for(;;){let{done:i,value:u}=await t.read();if(i)break;s+=n.decode(u,{stream:!0});let m=s.indexOf(`
8
-
9
- `);for(;m!==-1;){let a=s.slice(0,m);s=s.slice(m+2);let d=ne(a);d&&process.stdout.write(d),m=s.indexOf(`
10
-
11
- `)}}}finally{t.releaseLock()}}r(w,"streamSandboxEventOutput");function H(o){return typeof o=="string"?{dataBase64:Buffer.from(o,"utf-8").toString("base64")}:o instanceof Uint8Array?{dataBase64:Buffer.from(o).toString("base64")}:o}r(H,"normalizePtyInput");function ne(o){if(!o.includes("event: output"))return null;let e=o.split(/\r?\n/).filter(t=>t.startsWith("data: ")).map(t=>t.slice(6));if(e.length===0)return null;try{let t=JSON.parse(e.join(`
12
- `));return typeof t.output=="string"?t.output:null}catch{return null}}r(ne,"parseProcessOutputEvent");function G(o,e={}){let t=o.trim().replace(/\/$/,"");if(!t)throw new Error("sandbox API URL must be non-empty");let n=new URL(t),s=n.pathname.replace(/\/$/,"");if(s.endsWith("/v1/sandboxes")||s.endsWith("/api/sandboxes"))return`${n.origin}${s}`;if(s.endsWith("/v1"))return`${n.origin}${s}/sandboxes`;if(n.origin===j)return`${l}/v1/sandboxes`;let i=e.apiBaseUrl?new URL(e.apiBaseUrl).origin:l;return n.origin===i?`${n.origin}${s}/v1/sandboxes`:`${n.origin}${s}/api/sandboxes`}r(G,"normalizeSandboxApiUrl");function K(o){let e="/sandboxes";if(!o.endsWith(e))throw new Error("sandbox API URL must end with /sandboxes");return o.slice(0,-e.length)}r(K,"apiRootUrlFromSandboxApiUrl");var f=class{static{r(this,"OpenPondSandboxInstanceClient")}apiKey;apiRootUrl;sandboxApiUrl;customEndpoint;constructor(e){this.apiKey=e.apiKey,this.customEndpoint=e.customEndpoint??!1;let t=e.sandboxApiUrl??e.baseUrl??l;this.sandboxApiUrl=G(t,{apiBaseUrl:this.customEndpoint?void 0:t}),this.apiRootUrl=K(this.sandboxApiUrl)}create(e,t={}){return this.request("",{method:"POST",...this.customEndpoint?{timeoutMs:18e4}:{},headers:R(t),body:JSON.stringify(e)}).then(n=>n.sandbox)}get(e){return this.request(`/${encodeURIComponent(e)}`).then(t=>t.sandbox)}exec(e,t){return this.request(`/${encodeURIComponent(e)}/exec`,{method:"POST",body:JSON.stringify(t)})}startProcess(e,t){return this.request(`/${encodeURIComponent(e)}/processes`,{method:"POST",body:JSON.stringify(t)})}listProcesses(e){return this.request(`/${encodeURIComponent(e)}/processes`)}getProcess(e,t,n={}){let s=new URLSearchParams;return n.since!==void 0&&s.set("since",String(Math.max(0,n.since))),this.request(`/${encodeURIComponent(e)}/processes/${encodeURIComponent(t)}${s.size>0?`?${s.toString()}`:""}`)}stopProcess(e,t){return this.request(`/${encodeURIComponent(e)}/processes/${encodeURIComponent(t)}`,{method:"DELETE"})}async streamProcessOutput(e,t,n={}){let s=new URLSearchParams;n.since!==void 0&&s.set("since",String(Math.max(0,n.since))),await w({sandboxApiUrl:this.sandboxApiUrl,apiKey:this.apiKey,path:`/${encodeURIComponent(e)}/processes/${encodeURIComponent(t)}/stream${s.size>0?`?${s.toString()}`:""}`})}startPty(e,t={}){return this.request(`/${encodeURIComponent(e)}/pty`,{method:"POST",body:JSON.stringify(t)})}listPtys(e){return this.request(`/${encodeURIComponent(e)}/pty`)}getPty(e,t,n={}){let s=new URLSearchParams;return n.since!==void 0&&s.set("since",String(Math.max(0,n.since))),this.request(`/${encodeURIComponent(e)}/pty/${encodeURIComponent(t)}${s.size>0?`?${s.toString()}`:""}`)}writePtyInput(e,t,n){return this.request(`/${encodeURIComponent(e)}/pty/${encodeURIComponent(t)}/input`,{method:"POST",body:JSON.stringify(H(n))})}stopPty(e,t){return this.request(`/${encodeURIComponent(e)}/pty/${encodeURIComponent(t)}`,{method:"DELETE"})}async streamPtyOutput(e,t,n={}){let s=new URLSearchParams;n.since!==void 0&&s.set("since",String(Math.max(0,n.since))),await w({sandboxApiUrl:this.sandboxApiUrl,apiKey:this.apiKey,path:`/${encodeURIComponent(e)}/pty/${encodeURIComponent(t)}/stream${s.size>0?`?${s.toString()}`:""}`})}uploadFile(e,t,n){return this.uploadFileBase64(e,t,Buffer.from(n,"utf-8").toString("base64"))}uploadFileBase64(e,t,n){return this.request(`/${encodeURIComponent(e)}/files`,{method:"POST",body:JSON.stringify({path:t,contentsBase64:n})})}async downloadFile(e,t){let n=await this.downloadFileResponse(e,t);return Buffer.from(n.file.contentsBase64,"base64").toString("utf-8")}downloadFileResponse(e,t){let n=typeof t=="string"?{path:t}:t,s=new URLSearchParams({path:n.path});return n.offsetBytes!==void 0&&s.set("offsetBytes",String(n.offsetBytes)),n.maxBytes!==void 0&&s.set("maxBytes",String(n.maxBytes)),this.request(`/${encodeURIComponent(e)}/files?${s.toString()}`)}listFiles(e,t={}){let n=new URLSearchParams({list:"1"});return t.path&&n.set("path",t.path),t.recursive!==void 0&&n.set("recursive",String(t.recursive)),t.maxEntries!==void 0&&n.set("maxEntries",String(t.maxEntries)),this.request(`/${encodeURIComponent(e)}/files?${n.toString()}`)}deleteFile(e,t,n={}){let s=new URLSearchParams({path:t});return n.recursive!==void 0&&s.set("recursive",String(n.recursive)),this.request(`/${encodeURIComponent(e)}/files?${s.toString()}`,{method:"DELETE"})}statFile(e,t){let n=new URLSearchParams({stat:"1",path:t});return this.request(`/${encodeURIComponent(e)}/files?${n.toString()}`)}mkdir(e,t){let n=typeof t=="string"?{path:t}:t,s=new URLSearchParams({path:n.path});return n.recursive!==void 0&&s.set("recursive",String(n.recursive)),this.request(`/${encodeURIComponent(e)}/files?${s.toString()}`,{method:"PUT"})}moveFile(e,t){let n=new URLSearchParams({fromPath:t.fromPath,toPath:t.toPath});return t.overwrite!==void 0&&n.set("overwrite",String(t.overwrite)),this.request(`/${encodeURIComponent(e)}/files?${n.toString()}`,{method:"PATCH"})}searchFiles(e,t){let n=new URLSearchParams({search:"1",query:t.query});return t.path&&n.set("path",t.path),t.maxResults!==void 0&&n.set("maxResults",String(t.maxResults)),this.request(`/${encodeURIComponent(e)}/files?${n.toString()}`)}openPort(e,t){return this.request(`/${encodeURIComponent(e)}/ports`,{method:"POST",body:JSON.stringify(t)})}createSnapshot(e,t){return this.request(`/${encodeURIComponent(e)}/snapshots`,{method:"POST",body:JSON.stringify(t)})}updateSnapshot(e,t,n){return this.request(`/${encodeURIComponent(e)}/snapshots/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify(n)})}validateSnapshot(e,t,n={}){return this.request(`/${encodeURIComponent(e)}/snapshots/${encodeURIComponent(t)}/validate`,{method:"POST",body:JSON.stringify(n)})}publishSnapshot(e,t){return this.request(`/${encodeURIComponent(e)}/snapshots/${encodeURIComponent(t)}/publish`,{method:"POST"})}fork(e,t={}){return this.request(`/${encodeURIComponent(e)}/fork`,{method:"POST",body:JSON.stringify(t)})}stop(e,t={}){let n=new URLSearchParams;return t.failOnUnpreservedChanges&&n.set("failOnUnpreservedChanges","true"),this.request(`/${encodeURIComponent(e)}/stop${n.size>0?`?${n.toString()}`:""}`,{method:"POST",headers:R(t)})}start(e,t={}){return this.request(`/${encodeURIComponent(e)}/start`,{method:"POST",headers:R(t)})}restore(e){return this.request(`/${encodeURIComponent(e)}/restore`,{method:"POST"})}delete(e,t={}){let n=new URLSearchParams;return t.failOnUnpreservedChanges&&n.set("failOnUnpreservedChanges","true"),this.request(`/${encodeURIComponent(e)}${n.size>0?`?${n.toString()}`:""}`,{method:"DELETE",headers:R(t)}).then(s=>s.sandbox)}receipts(e){return this.request(`/${encodeURIComponent(e)}/receipts`).then(t=>t.receipts)}logs(e){return this.request(`/${encodeURIComponent(e)}/logs`).then(t=>t.logs)}gitStatus(e){return this.request(`/${encodeURIComponent(e)}/git/status`)}gitDiff(e,t={}){return this.request(`/${encodeURIComponent(e)}/git/diff`,{method:"POST",body:JSON.stringify(t)})}gitExportPatch(e,t={}){return this.request(`/${encodeURIComponent(e)}/git/export-patch`,{method:"POST",body:JSON.stringify(t)})}gitBranch(e,t){return this.request(`/${encodeURIComponent(e)}/git/branch`,{method:"POST",body:JSON.stringify(t)})}gitCommit(e,t){return this.request(`/${encodeURIComponent(e)}/git/commit`,{method:"POST",body:JSON.stringify(t)})}gitPull(e,t={}){return this.request(`/${encodeURIComponent(e)}/git/pull`,{method:"POST",body:JSON.stringify(t)})}gitPush(e,t={}){return this.request(`/${encodeURIComponent(e)}/git/push`,{method:"POST",body:JSON.stringify(t)})}billing(e){return this.request(`/${encodeURIComponent(e)}/billing`)}pricing(){return this.request("/pricing")}costs(e={}){let t=new URLSearchParams;return e.teamId&&t.set("teamId",e.teamId),e.projectId&&t.set("projectId",e.projectId),e.agentId&&t.set("agentId",e.agentId),this.request(`/costs${t.size>0?`?${t.toString()}`:""}`)}integrationLeases(e){return this.request(`/${encodeURIComponent(e)}/integrations`)}attachIntegrationConnection(e,t){return this.request(`/${encodeURIComponent(e)}/integrations`,{method:"POST",body:JSON.stringify(t)})}removeIntegrationLease(e,t){return this.request(`/${encodeURIComponent(e)}/integrations`,{method:"DELETE",body:JSON.stringify({leaseId:t})})}async request(e,t={}){let n=await h(this.sandboxApiUrl,this.apiKey,e,this.customEndpoint?{...t,explicitBearerAuth:!0,redirect:"error"}:t);return y(n,"Sandbox request")}async requestApiRoot(e,t={}){let n=await h(this.apiRootUrl,this.apiKey,e,this.customEndpoint?{...t,explicitBearerAuth:!0,redirect:"error"}:t);return y(n,"OpenPond API request")}};var U=class extends f{static{r(this,"OpenPondSandboxClient")}runtimes=k(this);sandboxes=E(this);profile=B(this);projects=F(this);agents=M(this);list(e={}){let t=new URLSearchParams;return e.teamId&&t.set("teamId",e.teamId),e.projectId&&t.set("projectId",e.projectId),e.agentId&&t.set("agentId",e.agentId),this.request(t.size>0?`?${t.toString()}`:"").then(n=>n.sandboxes)}listSecrets(e={}){let t=new URLSearchParams;return e.teamId&&t.set("teamId",e.teamId),this.requestApiRoot(`/sandbox-secrets${t.size>0?`?${t.toString()}`:""}`).then(n=>n.secrets)}getSecret(e,t={}){let n=new URLSearchParams;return t.teamId&&n.set("teamId",t.teamId),this.requestApiRoot(`/sandbox-secrets/${encodeURIComponent(e)}${n.size>0?`?${n.toString()}`:""}`).then(s=>s.secret)}createSecret(e){return this.requestApiRoot("/sandbox-secrets",{method:"POST",body:JSON.stringify(e)}).then(t=>t.secret)}rotateSecret(e,t){let n=new URLSearchParams;t.teamId&&n.set("teamId",t.teamId);let{teamId:s,...i}=t;return this.requestApiRoot(`/sandbox-secrets/${encodeURIComponent(e)}/rotate${n.size>0?`?${n.toString()}`:""}`,{method:"POST",body:JSON.stringify(i)}).then(u=>u.secret)}attachSecret(e,t){let n=new URLSearchParams;t.teamId&&n.set("teamId",t.teamId);let{teamId:s,...i}=t;return this.requestApiRoot(`/sandbox-secrets/${encodeURIComponent(e)}/attach${n.size>0?`?${n.toString()}`:""}`,{method:"POST",body:JSON.stringify(i)}).then(u=>u.secret)}revokeSecret(e,t={}){let n=new URLSearchParams;return t.teamId&&n.set("teamId",t.teamId),this.requestApiRoot(`/sandbox-secrets/${encodeURIComponent(e)}/revoke${n.size>0?`?${n.toString()}`:""}`,{method:"POST"}).then(s=>s.secret)}deleteSecret(e,t={}){let n=new URLSearchParams;return t.teamId&&n.set("teamId",t.teamId),this.requestApiRoot(`/sandbox-secrets/${encodeURIComponent(e)}${n.size>0?`?${n.toString()}`:""}`,{method:"DELETE"}).then(s=>s.secret)}snapshotCatalog(e={}){let t=new URLSearchParams;return e.teamId&&t.set("teamId",e.teamId),e.projectId&&t.set("projectId",e.projectId),e.agentId&&t.set("agentId",e.agentId),e.q&&t.set("q",e.q),e.kind&&t.set("kind",e.kind),e.replayState&&t.set("replayState",e.replayState),e.visibility&&t.set("visibility",e.visibility),e.tag&&t.set("tag",e.tag),e.useCase&&t.set("useCase",e.useCase),e.limit&&t.set("limit",String(e.limit)),this.request(`/catalog/snapshots${t.size>0?`?${t.toString()}`:""}`)}listSandboxRuntimes(e={}){let t=new URLSearchParams;return e.teamId&&t.set("teamId",e.teamId),e.projectId&&t.set("projectId",e.projectId),e.agentId&&t.set("agentId",e.agentId),this.requestApiRoot(`/runtimes${t.size>0?`?${t.toString()}`:""}`).then(n=>n.runtimes)}listProjects(e){let t=new URLSearchParams({teamId:e.teamId});return this.requestApiRoot(`/projects?${t.toString()}`).then(n=>n.projects)}upsertProject(e){let t=new URLSearchParams({teamId:e.teamId});return this.requestApiRoot(`/projects?${t.toString()}`,{method:"POST",body:JSON.stringify(e)}).then(n=>n.project)}getHostedProfile(e){let t=new URLSearchParams({teamId:e.teamId});return this.requestApiRoot(`/profile?${t.toString()}`).then(n=>n.profile)}ensureHostedProfile(e){let t=new URLSearchParams({teamId:e.teamId});return this.requestApiRoot(`/profile/ensure?${t.toString()}`,{method:"POST"}).then(n=>{if(!n.profile)throw new Error("hosted_profile_missing");return n.profile})}pushHostedProfile(e){let t=new URLSearchParams({teamId:e.teamId}),{teamId:n,...s}=e;return this.requestApiRoot(`/profile/push?${t.toString()}`,{method:"POST",body:JSON.stringify(s)})}async upsertProjectGitRemote(e){let t=await this.upsertProject(e);return this.ensureProjectGitRemote(t.id,{teamId:e.teamId})}getProject(e,t){let n=new URLSearchParams({teamId:t.teamId});return this.requestApiRoot(`/projects/${encodeURIComponent(e)}?${n.toString()}`).then(s=>s.project)}syncProject(e,t){let n=new URLSearchParams({teamId:t.teamId});return this.requestApiRoot(`/projects/${encodeURIComponent(e)}/sync?${n.toString()}`,{method:"POST"}).then(s=>s.project)}ensureProjectGitRemote(e,t){let n=new URLSearchParams({teamId:t.teamId});return this.requestApiRoot(`/projects/${encodeURIComponent(e)}/git?${n.toString()}`,{method:"POST"})}uploadProjectSource(e,t){let n=new URLSearchParams({teamId:t.teamId}),{teamId:s,...i}=t;return this.requestApiRoot(`/projects/${encodeURIComponent(e)}/source?${n.toString()}`,{method:"POST",body:JSON.stringify(i)}).then(u=>u.project)}updateProject(e,t){let n=new URLSearchParams({teamId:t.teamId}),{teamId:s,...i}=t;return this.requestApiRoot(`/projects/${encodeURIComponent(e)}?${n.toString()}`,{method:"PATCH",body:JSON.stringify(i)}).then(u=>u.project)}archiveProject(e,t){let n=new URLSearchParams({teamId:t.teamId});return this.requestApiRoot(`/projects/${encodeURIComponent(e)}?${n.toString()}`,{method:"DELETE"}).then(s=>s.project)}listAgents(e){let t=new URLSearchParams({teamId:e.teamId});return this.requestApiRoot(`/agents?${t.toString()}`).then(n=>n.agents)}upsertAgent(e){let t=new URLSearchParams({teamId:e.teamId});return this.requestApiRoot(`/agents?${t.toString()}`,{method:"POST",body:JSON.stringify(e)}).then(n=>n.agent)}getAgent(e,t){let n=new URLSearchParams({teamId:t.teamId});return this.requestApiRoot(`/agents/${encodeURIComponent(e)}?${n.toString()}`).then(s=>s.agent)}archiveAgent(e,t){let n=new URLSearchParams({teamId:t.teamId});return this.requestApiRoot(`/agents/${encodeURIComponent(e)}?${n.toString()}`,{method:"DELETE"}).then(s=>s.agent)}updateAgent(e,t){let n=new URLSearchParams({teamId:t.teamId}),{teamId:s,...i}=t;return this.requestApiRoot(`/agents/${encodeURIComponent(e)}?${n.toString()}`,{method:"PATCH",body:JSON.stringify(i)}).then(u=>u.agent)}runAgent(e,t){let n=new URLSearchParams({teamId:t.teamId}),{teamId:s,...i}=t;return this.requestApiRoot(`/agents/${encodeURIComponent(e)}/run?${n.toString()}`,{method:"POST",headers:{Prefer:"respond-async"},body:JSON.stringify(i)})}getAgentSourceDeployPlan(e,t){let n=new URLSearchParams({teamId:t.teamId});return this.requestApiRoot(`/agents/${encodeURIComponent(e)}/source/deploy-plan?${n.toString()}`).then(s=>s.deployPlan)}listAgentManifestSnapshots(e,t){let n=new URLSearchParams({teamId:t.teamId});return t.limit!==void 0&&n.set("limit",String(t.limit)),this.requestApiRoot(`/agents/${encodeURIComponent(e)}/source/manifest-snapshots?${n.toString()}`).then(s=>s.manifestSnapshots)}requestAgentSourceChecks(e,t){let n=new URLSearchParams({teamId:t.teamId}),{teamId:s,...i}=t;return this.requestApiRoot(`/agents/${encodeURIComponent(e)}/source/checks?${n.toString()}`,{method:"POST",body:JSON.stringify(i),timeoutMs:900*1e3})}configureAgentSourceSetup(e,t){let n=new URLSearchParams({teamId:t.teamId}),{teamId:s,...i}=t;return this.requestApiRoot(`/agents/${encodeURIComponent(e)}/source/setup?${n.toString()}`,{method:"POST",body:JSON.stringify(i)})}publishAgentSource(e,t){let n=new URLSearchParams({teamId:t.teamId}),{teamId:s,...i}=t;return this.requestApiRoot(`/agents/${encodeURIComponent(e)}/source/publish?${n.toString()}`,{method:"POST",body:JSON.stringify(i)})}getMicrosoftTeamsBotOverview(e){let t=new URLSearchParams({teamId:e.teamId});return this.requestApiRoot(`/teams/bot/overview?${t.toString()}`)}bindMicrosoftTeamsBotConversation(e){return this.requestApiRoot("/teams/bot/bindings",{method:"POST",body:JSON.stringify(e)})}rebindMicrosoftTeamsBotConversation(e,t){return this.requestApiRoot(`/teams/bot/bindings/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(t)})}unlinkMicrosoftTeamsBotConversation(e){return this.requestApiRoot(`/teams/bot/bindings/${encodeURIComponent(e.bindingId)}`,{method:"DELETE",body:JSON.stringify({teamId:e.teamId})})}sendMicrosoftTeamsBotDiagnostic(e){return this.requestApiRoot("/teams/bot/diagnostics",{method:"POST",body:JSON.stringify(e)})}sendMicrosoftTeamsBotDiagnosticRun(e){return this.requestApiRoot("/teams/bot/diagnostics/run",{method:"POST",body:JSON.stringify(e)})}createSandboxRuntime(e){return this.requestApiRoot("/runtimes",{method:"POST",body:JSON.stringify(e)}).then(t=>t.runtime)}sandboxRuntime(e,t=null){return z(this,e,t)}getSandboxRuntime(e){return this.requestApiRoot(`/runtimes/${encodeURIComponent(e)}`).then(t=>t.runtime)}createSandboxRuntimeSandbox(e,t={},n={}){return this.requestApiRoot(`/runtimes/${encodeURIComponent(e)}/sandbox`,{method:"POST",headers:R(n),body:JSON.stringify(t)})}updateSandboxRuntimeStatus(e,t){return this.requestApiRoot(`/runtimes/${encodeURIComponent(e)}/status`,{method:"PATCH",body:JSON.stringify(t)}).then(n=>n.runtime)}listSandboxRuntimeEvents(e){return this.requestApiRoot(`/runtimes/${encodeURIComponent(e)}/events`)}emitSandboxRuntimeEvent(e,t){return this.requestApiRoot(`/runtimes/${encodeURIComponent(e)}/events`,{method:"POST",body:JSON.stringify(t)})}checkpointSandboxRuntime(e,t){return this.requestApiRoot(`/runtimes/${encodeURIComponent(e)}/checkpoints`,{method:"POST",body:JSON.stringify(t)}).then(n=>n.runtime)}promoteSandboxRuntime(e,t,n={}){let s=new URLSearchParams;return n.teamId&&s.set("teamId",n.teamId),this.requestApiRoot(`/runtimes/${encodeURIComponent(e)}/promote${s.size>0?`?${s.toString()}`:""}`,{method:"POST",body:JSON.stringify(t)})}preserveSandboxRuntimeSource(e,t={},n={}){let s=new URLSearchParams;return n.teamId&&s.set("teamId",n.teamId),this.requestApiRoot(`/runtimes/${encodeURIComponent(e)}/preserve-source${s.size>0?`?${s.toString()}`:""}`,{method:"POST",body:JSON.stringify(t)})}forkSnapshot(e,t={},n={}){let s=new URLSearchParams;t.teamId&&s.set("teamId",t.teamId),t.projectId&&s.set("projectId",t.projectId),n.async&&s.set("async","1");let{teamId:i,projectId:u,...m}=t;return this.request(`/catalog/snapshots/${encodeURIComponent(e)}/fork${s.size>0?`?${s.toString()}`:""}`,{method:"POST",headers:n.async?{Prefer:"respond-async"}:void 0,body:JSON.stringify({...m,snapshotId:e})})}templates(e={}){let t=new URLSearchParams;return e.teamId&&t.set("teamId",e.teamId),e.projectId&&t.set("projectId",e.projectId),e.q&&t.set("q",e.q),e.name&&t.set("name",e.name),e.version&&t.set("version",e.version),e.visibility&&t.set("visibility",e.visibility),e.tag&&t.set("tag",e.tag),e.useCase&&t.set("useCase",e.useCase),e.limit&&t.set("limit",String(e.limit)),this.request(`/templates${t.size>0?`?${t.toString()}`:""}`)}publishedSnapshots(e={}){let t=new URLSearchParams;return e.teamId&&t.set("teamId",e.teamId),e.projectId&&t.set("projectId",e.projectId),e.q&&t.set("q",e.q),e.name&&t.set("name",e.name),e.version&&t.set("version",e.version),e.visibility&&t.set("visibility",e.visibility),e.tag&&t.set("tag",e.tag),e.useCase&&t.set("useCase",e.useCase),e.limit&&t.set("limit",String(e.limit)),this.request(`/published-snapshots${t.size>0?`?${t.toString()}`:""}`).then(n=>{let s=n.publishedSnapshots??n.templates;return{...n,templates:s,publishedSnapshots:s}})}launchTemplate(e){let t=new URLSearchParams;e.teamId&&t.set("teamId",e.teamId),e.projectId&&t.set("projectId",e.projectId);let{teamId:n,projectId:s,...i}=e;return this.request(`/templates/launch${t.size>0?`?${t.toString()}`:""}`,{method:"POST",body:JSON.stringify(i)})}runPublishedSnapshot(e){let t=new URLSearchParams;e.teamId&&t.set("teamId",e.teamId),e.projectId&&t.set("projectId",e.projectId);let{teamId:n,projectId:s,...i}=e;return this.request(`/published-snapshots/launch${t.size>0?`?${t.toString()}`:""}`,{method:"POST",body:JSON.stringify(i)}).then(u=>{let m=u.publishedSnapshot??u.template;return{...u,template:m,publishedSnapshot:m}})}listSchedules(e={}){let t=new URLSearchParams;return e.teamId&&t.set("teamId",e.teamId),e.projectId&&t.set("projectId",e.projectId),e.sourceSandboxId&&t.set("sourceSandboxId",e.sourceSandboxId),this.request(`/schedules${t.size>0?`?${t.toString()}`:""}`)}createSchedule(e){let t=new URLSearchParams;e.projectId&&t.set("projectId",e.projectId);let{projectId:n,...s}=e;return this.request(`/schedules${t.size>0?`?${t.toString()}`:""}`,{method:"POST",body:JSON.stringify(s)})}getSchedule(e){return this.request(`/schedules/${encodeURIComponent(e)}`)}updateSchedule(e,t){return this.request(`/schedules/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(t)})}deleteSchedule(e){return this.request(`/schedules/${encodeURIComponent(e)}`,{method:"DELETE"})}listScheduleRuns(e,t={}){let n=new URLSearchParams;return t.limit!==void 0&&n.set("limit",String(t.limit)),this.request(`/schedules/${encodeURIComponent(e)}/runs${n.size>0?`?${n.toString()}`:""}`)}runScheduleNow(e,t={}){return this.request(`/schedules/${encodeURIComponent(e)}/run`,{method:"POST",body:JSON.stringify(t)})}listTemplateBuilds(e){let t=new URLSearchParams({teamId:e.teamId});return this.requestApiRoot(`/sandbox-template-builds?${t.toString()}`).then(n=>n.builds)}createTemplateBuild(e){return this.requestApiRoot("/sandbox-template-builds",{method:"POST",body:JSON.stringify(e)}).then(t=>t.build)}getTemplateBuild(e){return this.requestApiRoot(`/sandbox-template-builds/${encodeURIComponent(e)}`).then(t=>t.build)}getTemplateBuildLogs(e){return this.requestApiRoot(`/sandbox-template-builds/${encodeURIComponent(e)}/logs`)}cancelTemplateBuild(e){return this.requestApiRoot(`/sandbox-template-builds/${encodeURIComponent(e)}/cancel`,{method:"POST"}).then(t=>t.build)}listPublishedSnapshotBuilds(e){let t=new URLSearchParams({teamId:e.teamId});return this.requestApiRoot(`/published-snapshot-builds?${t.toString()}`).then(n=>n.builds)}createPublishedSnapshotBuild(e){return this.requestApiRoot("/published-snapshot-builds",{method:"POST",body:JSON.stringify(e)}).then(t=>t.build)}getPublishedSnapshotBuild(e){return this.requestApiRoot(`/published-snapshot-builds/${encodeURIComponent(e)}`).then(t=>t.build)}getPublishedSnapshotBuildLogs(e){return this.requestApiRoot(`/published-snapshot-builds/${encodeURIComponent(e)}/logs`)}cancelPublishedSnapshotBuild(e){return this.requestApiRoot(`/published-snapshot-builds/${encodeURIComponent(e)}/cancel`,{method:"POST"}).then(t=>t.build)}listOrganizations(){return this.requestApiRoot("/organizations").then(e=>e.organizations??e.teams??[])}createOrganization(e){return this.requestApiRoot("/organizations",{method:"POST",body:JSON.stringify(e)}).then(t=>t.organization)}getOrganization(e){return this.requestApiRoot(`/organizations/${encodeURIComponent(e)}`).then(t=>t.organization)}updateOrganization(e,t){return this.requestApiRoot(`/organizations/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(t)}).then(n=>n.organization)}listOrganizationMembers(e){return this.requestApiRoot(`/organizations/${encodeURIComponent(e)}/members`).then(t=>t.members)}upsertOrganizationMember(e,t){return this.requestApiRoot(`/organizations/${encodeURIComponent(e)}/members`,{method:"POST",body:JSON.stringify(t)}).then(n=>n.member)}getOrganizationMcpServer(e){return this.requestApiRoot(`/organizations/${encodeURIComponent(e)}/mcp-server`).then(t=>t.mcpServer)}generateOrganizationMcpServer(e,t={}){return this.requestApiRoot(`/organizations/${encodeURIComponent(e)}/mcp-server`,{method:"POST",body:JSON.stringify(t)}).then(n=>n.mcpServer)}rotateOrganizationMcpServer(e){return this.requestApiRoot(`/organizations/${encodeURIComponent(e)}/mcp-server/rotate`,{method:"POST"}).then(t=>t.mcpServer)}disableOrganizationMcpServer(e){return this.requestApiRoot(`/organizations/${encodeURIComponent(e)}/mcp-server/disable`,{method:"POST"}).then(t=>t.mcpServer)}enableOrganizationMcpServer(e){return this.requestApiRoot(`/organizations/${encodeURIComponent(e)}/mcp-server/enable`,{method:"POST"}).then(t=>t.mcpServer)}startReplay(e){let t=new URLSearchParams;e.teamId&&t.set("teamId",e.teamId),e.projectId&&t.set("projectId",e.projectId);let{teamId:n,projectId:s,...i}=e;return this.requestApiRoot(`/sandbox-replays${t.size>0?`?${t.toString()}`:""}`,{method:"POST",body:JSON.stringify(i)})}listReplays(e={}){let t=new URLSearchParams;return e.teamId&&t.set("teamId",e.teamId),e.projectId&&t.set("projectId",e.projectId),this.requestApiRoot(`/sandbox-replays${t.size>0?`?${t.toString()}`:""}`)}getReplay(e,t={}){let n=new URLSearchParams;return t.teamId&&n.set("teamId",t.teamId),t.projectId&&n.set("projectId",t.projectId),this.requestApiRoot(`/sandbox-replays/${encodeURIComponent(e)}${n.size>0?`?${n.toString()}`:""}`)}getReplayLogs(e,t={}){let n=new URLSearchParams;return t.teamId&&n.set("teamId",t.teamId),t.projectId&&n.set("projectId",t.projectId),this.requestApiRoot(`/sandbox-replays/${encodeURIComponent(e)}/logs${n.size>0?`?${n.toString()}`:""}`)}getReplayArtifacts(e,t={}){let n=new URLSearchParams;return t.teamId&&n.set("teamId",t.teamId),t.projectId&&n.set("projectId",t.projectId),this.requestApiRoot(`/sandbox-replays/${encodeURIComponent(e)}/artifacts${n.size>0?`?${n.toString()}`:""}`)}cancelReplay(e,t={}){let n=new URLSearchParams;return t.teamId&&n.set("teamId",t.teamId),t.projectId&&n.set("projectId",t.projectId),this.requestApiRoot(`/sandbox-replays/${encodeURIComponent(e)}/cancel${n.size>0?`?${n.toString()}`:""}`,{method:"POST"})}integrationConnections(e={}){let t=new URLSearchParams;return e.teamId&&t.set("teamId",e.teamId),e.projectId&&t.set("projectId",e.projectId),e.agentId&&t.set("agentId",e.agentId),e.status&&t.set("status",e.status),this.requestApiRoot(`/integrations/connections${t.size>0?`?${t.toString()}`:""}`)}mcpServerConfig(){return{name:"openpond-sandboxes",transport:"streamable-http",url:`${this.sandboxApiUrl}/mcp`,headers:{"openpond-api-key":this.apiKey}}}smoke(e={}){return J(this,e)}};function W(o){return new U(o)}r(W,"createOpenPondSandboxClient");async function oe(o){let e=await v(q(o,"account"),T(o));if(!e.account||!e.token)throw new Error("Sign in to the selected OpenPond account before reading its teams.");if(process.env.OPENPOND_API_KEY?.trim()&&process.env.OPENPOND_API_KEY.trim()!==e.token)throw new Error("OPENPOND_API_KEY differs from the selected account. Remove that override before reading account-bound teams.");let t=new URL(L(o)??e.apiBaseUrl);if(t.origin!==new URL(e.apiBaseUrl).origin||t.username||t.password)throw new Error("The API URL must match the selected account\u2019s API origin.");let s=await W({apiKey:e.token,baseUrl:t.origin}).listOrganizations();if(s.length>200)throw new Error("Account team discovery exceeds 200 records; pass an explicit --team-id to the viewer.");let i=s.filter(p=>p.status==="active").map(p=>({teamId:p.teamId,name:(p.displayName||p.name||p.slug).slice(0,191),role:p.role,personalDefault:p.isPersonalDefault===!0||p.kind==="personal_default"||p.workspaceKind==="personal"})),u=new Set;for(let p of i){if(!p.teamId||p.teamId.length>191||u.has(p.teamId))throw new Error("The account returned invalid or duplicate team identities.");u.add(p.teamId)}let a=(await A($())).document.defaults?.team_id?.trim()||null,d=i.filter(p=>p.personalDefault),b=a?i.find(p=>p.teamId===a):d.length===1?d[0]:i.length===1?i[0]:void 0;return{schemaVersion:1,account:{handle:e.account.handle,baseUrl:e.account.baseUrl??null,apiOrigin:t.origin},defaultTeamId:a,selectedTeamId:b?.teamId??null,selection:b?a?"configuredDefault":d.length===1?"personalDefault":"onlyTeam":a?"unavailableDefault":"chooseTeam",teams:i}}r(oe,"readAccountTeamContext");async function Be(o){console.log(JSON.stringify(await oe(o),null,2))}r(Be,"runAccountContext");export{oe as readAccountTeamContext,Be as runAccountContext};