openpond 0.2.30 → 0.2.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/types.d.ts +8 -0
- package/dist/app-server.d.ts +27797 -513
- package/dist/app-server.js +1 -1
- package/dist/chunks/{actions-command-NOCBOF5S.js → actions-command-6LFZFTLA.js} +1 -1
- package/dist/chunks/{app-layer-GLXYIT4B.js → app-layer-ZZHTHTJU.js} +1 -1
- package/dist/chunks/app-server-runtime-C7YELTKS.js +2 -0
- package/dist/chunks/{apps-YSWZT656.js → apps-C2BMJ7DO.js} +1 -1
- package/dist/chunks/{chunk-GHGVF2KG.js → chunk-2OQ6LFSG.js} +1 -1
- package/dist/chunks/{chunk-GOQDMRUV.js → chunk-34URWDE7.js} +1 -1
- package/dist/chunks/{chunk-J3ZRHNGL.js → chunk-4QX2I2DX.js} +1 -1
- package/dist/chunks/{chunk-TOIG2PMH.js → chunk-55UCBRIX.js} +1 -1
- package/dist/chunks/{chunk-2LSP2AAN.js → chunk-5BFWDFPX.js} +1 -1
- package/dist/chunks/{chunk-HMADUZ5P.js → chunk-7FX5ABXG.js} +1 -1
- package/dist/chunks/{chunk-JPCPNW6T.js → chunk-B5LKUQGM.js} +1 -1
- package/dist/chunks/{chunk-I7XD5OBR.js → chunk-BAKCGJ5D.js} +1 -1
- package/dist/chunks/{chunk-7TV2VBSD.js → chunk-DR3XPQRZ.js} +1 -1
- package/dist/chunks/{chunk-C5OV4XWF.js → chunk-EFTLCT7C.js} +1 -1
- package/dist/chunks/{chunk-F4WS5QIT.js → chunk-IFP6W4OW.js} +22 -22
- package/dist/chunks/{chunk-I5K74TOH.js → chunk-JEVA7YQL.js} +2 -2
- package/dist/chunks/{chunk-JKMPJFMN.js → chunk-JFR34MIK.js} +2 -2
- package/dist/chunks/chunk-JVIHGSOV.js +6 -0
- package/dist/chunks/{chunk-6ZK5EZGN.js → chunk-K6EGNB2A.js} +1 -1
- package/dist/chunks/{chunk-XLF7VRKY.js → chunk-L54LZUGH.js} +1 -1
- package/dist/chunks/{chunk-J2S7BOZU.js → chunk-MJC26GOX.js} +4 -4
- package/dist/chunks/{chunk-MAMUNDBZ.js → chunk-MVAJMRCW.js} +3 -3
- package/dist/chunks/{chunk-Y2NQXJ2Q.js → chunk-MXLB6MEW.js} +1 -1
- package/dist/chunks/chunk-PSZKG3E3.js +4 -0
- package/dist/chunks/chunk-PZXZYP6Z.js +578 -0
- package/dist/chunks/{chunk-XRV4WLI7.js → chunk-QPZNN5Q3.js} +1 -1
- package/dist/chunks/{chunk-ETH4SZO6.js → chunk-QTEYV4TW.js} +1 -1
- package/dist/chunks/{chunk-Y2KDWP74.js → chunk-T22TCCWW.js} +1 -1
- package/dist/chunks/{chunk-WVUPFGU7.js → chunk-UU7RXSJS.js} +1 -1
- package/dist/chunks/{chunk-TJNIYJUH.js → chunk-XCTFXXVY.js} +1 -1
- package/dist/chunks/chunk-YD2IWF3T.js +2419 -0
- package/dist/chunks/chunk-YW6HS6TZ.js +42 -0
- package/dist/chunks/{chunk-6LY7GYNK.js → chunk-Z6F6PYF4.js} +1 -1
- package/dist/chunks/cli-HGDLR5TC.js +2 -0
- package/dist/chunks/{configuration-command-VGYAJAKN.js → configuration-command-IHUB6BBM.js} +1 -1
- package/dist/chunks/{core-commands-QQNCA4WQ.js → core-commands-F2HIN7V4.js} +1 -1
- package/dist/chunks/{desktop-test-BMDAEN6Z.js → desktop-test-BFFUGVRS.js} +1 -1
- package/dist/chunks/{dist-5C6RYTQQ.js → dist-XCT2G25K.js} +1 -1
- package/dist/chunks/extension-D7IYZW7H.js +4 -0
- package/dist/chunks/{help-DZBHIKVE.js → help-5MKQV36D.js} +1 -1
- package/dist/chunks/opchat-XO7EDHY7.js +3 -0
- package/dist/chunks/{organizations-LAUKUPDF.js → organizations-DIRGTVK5.js} +1 -1
- package/dist/chunks/{profile-ESJFHPYC.js → profile-EMVJ5DJQ.js} +1 -1
- package/dist/chunks/{project-agent-CPQP4ZY6.js → project-agent-4QC7N3MB.js} +1 -1
- package/dist/chunks/{sandbox-command-W6NWHFAR.js → sandbox-command-L263BBOL.js} +1 -1
- package/dist/chunks/{sandbox-template-SM62NUMJ.js → sandbox-template-RYKWTBW7.js} +1 -1
- package/dist/chunks/src-Q4W4NIPB.js +325 -0
- package/dist/chunks/{src-4L62URN6.js → src-RINMQ7IQ.js} +1 -1
- package/dist/chunks/{teams-bot-6LEMA4OH.js → teams-bot-NIZB6DOY.js} +1 -1
- package/dist/chunks/{workspaces-5PQMYPBV.js → workspaces-PFLMSDBR.js} +1 -1
- package/dist/cli.js +1 -1
- package/dist/hosted-chat.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/web/assets/App-BcbjzSeU.js +226 -0
- package/dist/web/assets/{AppDialog-FvWvdWfk.js → AppDialog-C1cvE0gH.js} +1 -1
- package/dist/web/assets/{AppTerminalPanel-Dfo_tXAE.js → AppTerminalPanel-BFJNR2ik.js} +2 -2
- package/dist/web/assets/{AppsView-CKg2_SXF.js → AppsView-CReOofAf.js} +1 -1
- package/dist/web/assets/BrowserSidebar-CPxAck2O.js +1 -0
- package/dist/web/assets/{CartesianChart-iXtVfIXm.js → CartesianChart-SlZ8Qfkg.js} +1 -1
- package/dist/web/assets/{CollaborationTabs-BFuRwsEy.js → CollaborationTabs-DgFEunqQ.js} +1 -1
- package/dist/web/assets/{CommandMenu-Coahy7-K.js → CommandMenu-BiROlSdv.js} +1 -1
- package/dist/web/assets/CommunityView-DVST_ZxO.js +1 -0
- package/dist/web/assets/ComposerCreateImproveStrip-jRBhdiFB.js +1 -0
- package/dist/web/assets/GetStartedView-Ck4EW1_s.js +1 -0
- package/dist/web/assets/HostedModelLearningReview-DYFjp-96.js +1 -0
- package/dist/web/assets/HostedModelLearningSettings-BD7quEFA.js +1 -0
- package/dist/web/assets/LabModelVersionDetailPage-8-Gb5AAH.js +1 -0
- package/dist/web/assets/{LabSkillSidebar-C7BuAuNK.js → LabSkillSidebar-DO-kFl9Z.js} +1 -1
- package/dist/web/assets/{LabsRoute-CUVbklNy.js → LabsRoute-Dc9RQKdA.js} +6 -6
- package/dist/web/assets/MainChatThread-DZXcFgmJ.js +2 -0
- package/dist/web/assets/MainPane-BYrnuI30.js +19 -0
- package/dist/web/assets/{MarkdownText-DV3sDJG3.js → MarkdownText-ueZFkEyk.js} +21 -21
- package/dist/web/assets/{NativeSkillSidebar-B3wc0iGh.js → NativeSkillSidebar-DlAX2-dH.js} +1 -1
- package/dist/web/assets/NewExperienceSwitcher-BHYLG0IZ.js +1 -0
- package/dist/web/assets/NewProjectDialog-BwN6SnxR.js +1 -0
- package/dist/web/assets/OutputsPage-Q0kpdfq_.js +1 -0
- package/dist/web/assets/ProjectsPage-TnlBYfFy.js +1 -0
- package/dist/web/assets/{ProjectsPage-DdG-U9ZW.css → ProjectsPage-kun3Ron2.css} +1 -1
- package/dist/web/assets/RightChatPanelStack-D2qZ-1nK.js +1 -0
- package/dist/web/assets/{RightSidebarHomePanel-DweT04nf.js → RightSidebarHomePanel-q6FF-DR9.js} +1 -1
- package/dist/web/assets/ScheduledWorkPage-BTX3Sjoa.js +1 -0
- package/dist/web/assets/SettingsView-C7av3zwv.css +1 -0
- package/dist/web/assets/SettingsView-gAhNO4Rg.js +9 -0
- package/dist/web/assets/{TeamChatView-BoQYnywK.js → TeamChatView-DZtfZ12z.js} +2 -2
- package/dist/web/assets/{TerminalOverlay-oLOOTbdP.js → TerminalOverlay-MJqx0xg6.js} +1 -1
- package/dist/web/assets/{TrainingCreationPanel-aCFYDuYZ.js → TrainingCreationPanel-ORoKcc3m.js} +1 -1
- package/dist/web/assets/{TrainingDraftPanel-CFa1YRTU.js → TrainingDraftPanel-oolNVDIx.js} +1 -1
- package/dist/web/assets/{UsageSettingsSection-CakaMl6_.js → UsageSettingsSection-Lh_fLOcC.js} +1 -1
- package/dist/web/assets/WorkSidebarPanel-BIqP9SXr.js +1 -0
- package/dist/web/assets/WorkspaceDiffPanel-B0Zwyx9a.js +14 -0
- package/dist/web/assets/WorkspaceEnvironmentMenu-BpgvG43X.js +32 -0
- package/dist/web/assets/{WorkspaceGitDialogs-CE6uwWBo.js → WorkspaceGitDialogs-Bw5ADFuc.js} +1 -1
- package/dist/web/assets/{WorkspaceMonacoEditor-Dd1yWxIF.js → WorkspaceMonacoEditor-BpivuGzo.js} +3 -3
- package/dist/web/assets/{arrow-up-right-DrBHDOjJ.js → arrow-up-right-BjC4ygxR.js} +1 -1
- package/dist/web/assets/{clipboard-BwxTBPCP.js → clipboard-BOJ-sNJz.js} +1 -1
- package/dist/web/assets/{cloud-upload-Ce9uYXcQ.js → cloud-upload-D-_3UWhI.js} +1 -1
- package/dist/web/assets/{cssMode-DDD1HmKz.js → cssMode-CnHRib-_.js} +1 -1
- package/dist/web/assets/{folder-open-BmWqQp0P.js → folder-open-CO3Vz0rT.js} +1 -1
- package/dist/web/assets/{folder-plus-B402AJf4.js → folder-plus-CL6B10XJ.js} +1 -1
- package/dist/web/assets/{git-commit-horizontal-C1uAivqm.js → git-commit-horizontal-C_SNHoOD.js} +1 -1
- package/dist/web/assets/git-dialogs-C-F47S10.css +1 -0
- package/dist/web/assets/{htmlMode-1MNILRvh.js → htmlMode-DBpIV7Gx.js} +1 -1
- package/dist/web/assets/{index-CPTsOhRN.js → index-Dx0lr1R3.js} +2 -2
- package/dist/web/assets/index-lqk3IxE0.css +1 -0
- package/dist/web/assets/{info-BNROwjpD.js → info-C1C3X2vW.js} +1 -1
- package/dist/web/assets/{jsonMode-mGxJ8u70.js → jsonMode-B9puI-La.js} +1 -1
- package/dist/web/assets/{lspLanguageFeatures-DnwAgCyz.js → lspLanguageFeatures-DwPRvLkn.js} +1 -1
- package/dist/web/assets/{minimize-2-DFgldo5D.js → minimize-2-Cr76Lc_J.js} +1 -1
- package/dist/web/assets/{monaco.contribution-BlgPPKyd.js → monaco.contribution-CnlZLXhW.js} +2 -2
- package/dist/web/assets/{monaco.contribution-CBuz55_x.js → monaco.contribution-DKa3PSXH.js} +2 -2
- package/dist/web/assets/{monaco.contribution-qZ9QzQ68.js → monaco.contribution-DQxsY08y.js} +2 -2
- package/dist/web/assets/{monaco.contribution-CGYtN1vj.js → monaco.contribution-OemObo_b.js} +2 -2
- package/dist/web/assets/monitor-CktBkAZk.js +1 -0
- package/dist/web/assets/{python-CpsWHcA8.js → python-CVC74_7Q.js} +1 -1
- package/dist/web/assets/refresh-cw-JaxiGpHD.js +1 -0
- package/dist/web/assets/{save-8XYI0E0Y.js → save-DFm1K29k.js} +1 -1
- package/dist/web/assets/{square-FQ0GLxuE.js → square-D5fFhDFt.js} +1 -1
- package/dist/web/assets/{toggleHighContrast-CX2hgvvU.js → toggleHighContrast-D_EkCruq.js} +1 -1
- package/dist/web/assets/{tsMode-D9XBNmxG.js → tsMode-BczIS4rA.js} +1 -1
- package/dist/web/assets/{upload-BNXILcvp.js → upload-DvED7nbd.js} +1 -1
- package/dist/web/assets/{useLocalAgentSchedules-Ccst1Wnz.js → useLocalAgentSchedules-DWd5OvYb.js} +1 -1
- package/dist/web/assets/useSessionTurnCache-oMoxBcGj.js +1 -0
- package/dist/web/assets/{wifi-off-BoQdtnnN.js → wifi-off-BZL-Op_B.js} +1 -1
- package/dist/web/assets/{workers-DpMJzLwE.js → workers-DapCJCaQ.js} +1 -1
- package/dist/web/assets/{yaml-BqS3gPsN.js → yaml-DB9KLqu1.js} +1 -1
- package/dist/web/index.html +2 -2
- package/docs/command-reference.md +1 -0
- package/package.json +1 -1
- package/dist/chunks/app-server-runtime-SNSNFJW7.js +0 -2
- package/dist/chunks/chunk-3YSCXFE6.js +0 -5
- package/dist/chunks/chunk-DDRIX3EP.js +0 -40
- package/dist/chunks/chunk-N6HBB2EA.js +0 -2985
- package/dist/chunks/chunk-P57W2CB2.js +0 -6
- package/dist/chunks/cli-DCFZ4GT6.js +0 -2
- package/dist/chunks/extension-IQW2KDT6.js +0 -6
- package/dist/chunks/opchat-BSTDLB7O.js +0 -3
- package/dist/chunks/src-G3GYZMCL.js +0 -323
- package/dist/web/assets/App-eRfSvxdE.js +0 -226
- package/dist/web/assets/BrowserSidebar-CBRz9dVj.js +0 -1
- package/dist/web/assets/CommunityView-C0B6EVIp.js +0 -1
- package/dist/web/assets/ComposerCreateImproveStrip-C0MkRhov.js +0 -1
- package/dist/web/assets/GetStartedView-f90pfPRp.js +0 -1
- package/dist/web/assets/HostedModelLearningReview-DdZnSPKb.js +0 -1
- package/dist/web/assets/HostedModelLearningSettings-p9RdBxGd.js +0 -1
- package/dist/web/assets/LabModelVersionDetailPage-DLqT1fMT.js +0 -1
- package/dist/web/assets/MainChatThread-Crjs_iFv.js +0 -2
- package/dist/web/assets/MainPane-Bl91XbhC.js +0 -10
- package/dist/web/assets/Messages-Bxo_ATcK.js +0 -10
- package/dist/web/assets/NewExperienceSwitcher-DBdsaysM.js +0 -1
- package/dist/web/assets/NewProjectDialog-CtJJ6u5l.js +0 -1
- package/dist/web/assets/OutputsPage-CV9rYjbQ.js +0 -1
- package/dist/web/assets/ProjectsPage-O162K_Yb.js +0 -1
- package/dist/web/assets/RightChatPanelStack-CXzHpD5V.js +0 -1
- package/dist/web/assets/ScheduledWorkPage-DFvjzhvz.js +0 -1
- package/dist/web/assets/SettingsView-B-O30p4h.js +0 -9
- package/dist/web/assets/SettingsView-BaWWvIJW.css +0 -1
- package/dist/web/assets/WorkSidebarPanel-XFwuIBFa.js +0 -1
- package/dist/web/assets/WorkspaceDiffPanel-CL-lAcvW.js +0 -14
- package/dist/web/assets/WorkspaceEnvironmentMenu-DcFKeae1.js +0 -32
- package/dist/web/assets/chat-file-links-DKYaOINv.js +0 -1
- package/dist/web/assets/chevron-up-CT-jxFh0.js +0 -1
- package/dist/web/assets/desktop-files-BQj1J-ob.js +0 -1
- package/dist/web/assets/git-dialogs-BZDqS1eT.css +0 -1
- package/dist/web/assets/index-BZ4iTv8E.css +0 -1
- package/dist/web/assets/play-BQFyTfNz.js +0 -1
- package/dist/web/assets/refresh-cw-DfFBmfXv.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{B as te,D as ne,E as oe,F as P,G as re,H as se,l as H,z as ee}from"./chunk-
|
|
2
|
+
import{B as te,D as ne,E as oe,F as P,G as re,H as se,l as H,z as ee}from"./chunk-B5LKUQGM.js";import{a as T,b as y,c as w,h as Y,i as B,j as K}from"./chunk-MJC26GOX.js";import{Ja as $,Mb as M,Va as Q,tb as F}from"./chunk-5BFWDFPX.js";import{k as l}from"./chunk-IFP6W4OW.js";import{b as a}from"./chunk-ES2ISFJC.js";import{a as d}from"./chunk-FTQLQJQV.js";function ie(r,e){return{supportsResume:!e,get:d((...t)=>r.get(...t),"get"),start:e?async()=>{throw new Error("This runtime does not support resuming a stopped guest; start fresh Work with saved outputs")}:(...t)=>r.start(...t),exec:d((t,n)=>r.exec(t,e?{...n,timeoutSeconds:Math.min(n.timeoutSeconds??30,60)}:n),"exec"),mkdir:d((...t)=>r.mkdir(...t),"mkdir"),uploadFile:d((...t)=>r.uploadFile(...t),"uploadFile"),uploadFileBase64:d((...t)=>r.uploadFileBase64(...t),"uploadFileBase64"),listFiles:d((...t)=>r.listFiles(...t),"listFiles"),downloadFileResponse:d((...t)=>r.downloadFileResponse(...t),"downloadFileResponse"),stop:d((...t)=>r.stop(...t),"stop"),delete:d((...t)=>r.delete(...t),"delete"),createWork:d(({requestId:t,repo:n,budgetUsd:o,metadata:s})=>{if(e){if(n?.trim())throw new Error("This runtime does not support repository provisioning; provide Work inputs instead");if(o!==void 0)throw new Error("Hosted spending budgets are not supported by this runtime");let p={resources:e.resources??{cpu:1,memoryGb:2,diskGb:10},...t?{requestId:t}:{}};return r.create(p)}let i=o?.trim()||"1.00";return r.create({...n?.trim()?{repo:n.trim()}:{},runtimeProfileId:"openpond-work-v1",resources:{cpu:2,memoryGb:4,diskGb:16},budget:{maxUsd:i},quotas:{maxSpendUsd:i,maxDurationSeconds:3600,idleTimeoutSeconds:900,maxCommands:200,maxOpenPorts:4},metadata:{source:"openpond-sdk-work",...s,...t?{workRequestId:t}:{}}},{async:!0})},"createWork")}}d(ie,"workSandbox");function N(r,e){let t=new URL(r);if(!["http:","https:"].includes(t.protocol)||t.username||t.password||t.search||t.hash)throw new Error(`${e} must be an HTTP(S) endpoint without embedded credentials, query or fragment`);return t.toString().replace(/\/$/,"")}d(N,"configuredEndpoint");function _(r,e){if(!r?.trim())throw new Error(`${e} is required`);return r.trim()}d(_,"configuredKey");var ke=a.object({choices:a.array(a.object({message:a.object({content:a.string().nullable().optional(),tool_calls:a.array(a.object({id:a.string().min(1),type:a.literal("function"),function:a.object({name:a.string().min(1),arguments:a.string()})})).optional()})})).min(1)});async function ae(r,e){if(!e)return K(r);let t=await fetch(`${r.apiBaseUrl}/chat/completions`,{method:"POST",headers:{authorization:`Bearer ${r.token}`,"content-type":"application/json"},body:JSON.stringify({model:r.model,messages:r.messages,tools:r.tools,tool_choice:"auto",stream:!1}),signal:r.signal,redirect:"error"});if(!t.ok)throw new Error(`Configured model request failed (${t.status})`);return ke.parse(await t.json())}d(ae,"workModelTurn");var xe="openpond-chat",Re=24,Se=4e4,D=2e4,z="outputs",J="inputs/previous-outputs",ue="inputs/.openpond-context.json",Ce=100,de=100,pe=100*1024*1024,x=class{static{d(this,"OpenPondWorkClient")}#e;#n;#t;#o;#r;#s;constructor(e){this.#e=e.apiKey,this.#n=e.apiBaseUrl,this.#t=e.chatApiBaseUrl,this.#o=ie(e.sandboxes,e.sandboxConfig),this.#r=e.defaultModel??xe,this.#s=e.customModel??!1}async run(e){let t=e.prompt.trim();if(!t)throw new Error("Work prompt is required");e.signal?.throwIfAborted();let n=d(async m=>e.onEvent?.(m),"emit"),o=e.cleanup??"keep",s=We(o),i=null,p=null,f=!1,g=le(e.maxSteps,1,100,Re),c="";try{await n({type:"status",message:"Preparing sandbox"}),i=await this.#g(e),await n({type:"sandbox",sandboxId:i.id,state:i.state}),await this.#u(i.id,e.inputs??[]),p=await this.#m(i.id);let m=[{role:"system",content:ve(i.id,(e.inputs?.length??0)>0)},...(e.history??[]).map(h=>({...h})),{role:"user",content:t}];for(let h=1;h<=g;h+=1){e.signal?.throwIfAborted(),await n({type:"status",message:`Thinking \xB7 step ${h}`});let G=(await ae({apiBaseUrl:this.#t,token:this.#e,model:e.model?.trim()||this.#r,messages:m,tools:Ie,toolChoice:"auto",signal:e.signal,metadata:{source:"openpond-sdk-work",sandboxId:i.id,apiBaseUrl:this.#n,...e.metadata}},this.#s)).choices?.[0],W=G?.message?.content?.trim()??"",L=G?.message?.tool_calls??[];if(m.push({role:"assistant",content:W||null,...L.length>0?{tool_calls:L}:{}}),W&&(c=W,await n({type:"assistant",text:W})),L.length===0){let b=await this.#p(i.id,p);for(let U of b)await n({type:"output",output:U});f=!0,await this.#i(i.id,b,e,s,n);let A={sandboxId:i.id,text:c,steps:h,outputs:b,lifecycle:s};return await n({type:"done",...A}),A}for(let[b,A]of L.entries()){e.signal?.throwIfAborted();let U=await this.#h(i.id,A,b,e.timeoutSeconds,n);m.push(U)}}throw new Error(`Work did not finish within ${g} steps`)}catch(m){if(i&&p&&!f)try{let h=await this.#p(i.id,p);for(let Z of h)await n({type:"output",output:Z});await this.#i(i.id,h,e,s,n)}catch(h){ce(m,s,h)}throw ce(m,s),m}}async deleteSandbox(e){try{if((await this.#o.get(e)).state==="deleted")return;await this.#o.delete(e)}catch(t){if(t instanceof T&&t.status===404)return;throw t}}async#u(e,t){if(t.length===0)return;if(t.length>de)throw new Error(`Work inputs exceed the ${de} file limit`);if(t.reduce((i,p)=>i+Buffer.byteLength(p.contentsBase64,"base64"),0)>pe)throw new Error(`Work inputs exceed the ${pe} byte limit`);await this.#o.mkdir(e,{path:J,recursive:!0});let o=new Set,s=[];for(let[i,p]of t.entries()){let f=Ae(p,i,o),g=`${J}/${f}`;await this.#o.uploadFileBase64(e,g,p.contentsBase64),s.push({id:p.id,path:g,name:p.name,mimeType:p.mimeType??null,checksumSha256:p.checksumSha256??null,revision:p.revision??null,metadata:p.metadata??{}})}await this.#o.uploadFile(e,ue,JSON.stringify({version:1,files:s},null,2))}async#i(e,t,n,o,s){if(o.persistence.outputCount=t.length,t.length===0)o.persistence.status="not_needed";else if(n.persistOutput){o.persistence.status="running";for(let i of t){await s({type:"persistence",output:i,status:"started"});try{let p=Le(this.#o,e,i);await n.persistOutput({output:i,download:p}),o.persistence.persistedCount+=1,await s({type:"persistence",output:i,status:"succeeded"})}catch(p){let f=k(p);throw o.persistence.status="failed",o.persistence.error=f,await s({type:"persistence",output:i,status:"failed",error:f}),(n.cleanup??"keep")!=="keep"&&await this.#a(e,o,s),p}}o.persistence.status="complete"}else{if((n.cleanup??"keep")==="delete"&&!n.discardOutputs)throw o.persistence.status="failed",o.persistence.error="Deleting a Work sandbox with outputs requires persistOutput or discardOutputs: true",await this.#a(e,o,s),new Error(o.persistence.error);o.persistence.status="not_requested"}await this.#d(e,n.cleanup??"keep",o,s)}async#a(e,t,n){if(this.#o.supportsResume){await this.#d(e,"stop",t,n);return}t.cleanup.status="pending",t.cleanup.finalSandboxState="running",t.cleanup.error="Output persistence must be retried before guest deletion",await n({type:"cleanup",policy:t.cleanupPolicy,status:"pending",sandboxState:"running",error:t.cleanup.error})}async#d(e,t,n,o){if(t!=="keep"){n.cleanup.status="running",await o({type:"cleanup",policy:t,status:"started"});try{let s=t==="delete"?await this.#o.delete(e):(await this.#o.stop(e)).sandbox;n.cleanup.finalSandboxState=s.state,n.cleanup.status=t==="delete"&&s.state==="deleted"||t==="stop"&&s.state==="stopped"?"complete":"pending",await o({type:"cleanup",policy:t,status:n.cleanup.status,sandboxState:s.state})}catch(s){let i=k(s);throw n.cleanup.status="failed",n.cleanup.error=i,await o({type:"cleanup",policy:t,status:"failed",error:i}),s}}}downloadOutput(e,t){return this.#o.downloadFileResponse(e,typeof t=="string"?t:t.path)}async#m(e){return await this.#o.mkdir(e,{path:z,recursive:!0}),Te(await this.#c(e))}async#p(e,t){return(await this.#c(e)).filter(o=>t.get(o.path)!==me(o)).sort((o,s)=>o.path.localeCompare(s.path)).slice(0,Ce).map(_e)}async#c(e){return(await this.#o.listFiles(e,{path:z,recursive:!0,maxEntries:500})).files.filter(n=>n.type==="file"&&!ge(n.path).includes("/.openpond-"))}async#g(e){if(e.sandboxId){let n=await this.#o.get(e.sandboxId);if(n.state==="stopped")await this.#o.start(n.id,{async:!0});else if(n.state==="deleted"||n.state==="error")throw new Error(`Cannot resume sandbox ${n.id} in state ${n.state}`);return await this.#l(n.id,e.signal)}let t=await this.#o.createWork(e);return this.#l(t.id,e.signal)}async#l(e,t){let n=Date.now()+72e4,o=await this.#o.get(e);for(;Date.now()<n;){if(t?.throwIfAborted(),o.state==="running")return o;if(o.state==="error"||o.state==="deleted")throw new Error(`Sandbox ${o.id} entered ${o.state}${o.logs.length?`: ${o.logs.join(`
|
|
3
3
|
`)}`:""}`);await Ue(2e3,t),o=await this.#o.get(e)}throw new Error(`Sandbox ${e} did not become ready before timeout`)}async#h(e,t,n,o,s){let i=t.id||`work_tool_${n}`,p=t.function?.name;if(p!=="run_command")return O(i,{error:`Unknown tool: ${p??"missing"}`});let f;try{f=JSON.parse(t.function?.arguments||"{}")}catch(c){return O(i,{error:`Invalid tool arguments: ${k(c)}`})}let g=typeof f.command=="string"?f.command.trim():"";if(!g)return O(i,{error:"command is required"});if(g.length>D){let c=`command exceeds the ${D} character limit`;return await s({type:"tool",toolCallId:i,command:g,status:"failed",output:c}),O(i,{status:"failed",error:c})}await s({type:"tool",toolCallId:i,command:g,status:"started"});try{let c=await this.#o.exec(e,{command:g,timeoutSeconds:le(o,1,900,180)}),m=Ee(c.command.output,Se),h=c.command.status==="succeeded"?"succeeded":"failed";return await s({type:"tool",toolCallId:i,command:g,status:h,output:m,exitCode:c.command.exitCode}),O(i,{status:c.command.status,exitCode:c.command.exitCode,output:m})}catch(c){if(c instanceof T)throw c;let m=k(c);return await s({type:"tool",toolCallId:i,command:g,status:"failed",output:m}),O(i,{status:"failed",error:m})}}},Ie=[{type:"function",function:{name:"run_command",description:"Run a shell command inside the persistent OpenPond sandbox. Use standard shell tools to inspect, edit, build, and test files. Commands start in the repository workspace.",parameters:{type:"object",additionalProperties:!1,properties:{command:{type:"string",minLength:1,maxLength:D,description:"Shell command to execute."}},required:["command"]}}}];function ve(r,e){return["You are OpenPond Work, a careful coding agent operating in an isolated Linux sandbox.",`The active sandbox is ${r}.`,...e?[`The authoritative saved files for this turn are staged under /workspace/${J}; their manifest is /workspace/${ue}.`,"Before revising a previous output, read its staged file and manifest. Copy the staged input into the output directory before editing it; previous output paths may not exist in this sandbox.","Preserve the actual file bytes. Never reconstruct a saved file from the conversation or claim to have preserved it without reading the staged input."]:[],"Use run_command to inspect the workspace, edit files, and validate your work.",`Place completed user-facing files in ${z}. The runtime collects new and revised files there automatically when the turn completes.`,"Do the requested work completely. Preserve existing user changes and avoid destructive commands.","Keep the user informed with concise prose, but call tools whenever verification or file changes are needed.","Before finishing, run relevant tests and summarize the concrete result."].join(`
|
|
4
4
|
`)}d(ve,"systemPrompt");function We(r){return{cleanupPolicy:r,persistence:{status:"not_requested",outputCount:0,persistedCount:0},cleanup:{status:"not_requested"}}}d(We,"initialLifecycle");function Le(r,e,t){let n=null;return()=>(n??=r.downloadFileResponse(e,{path:t.path,maxBytes:Math.max(1,t.sizeBytes)}).then(o=>{let s=Buffer.byteLength(o.file.contentsBase64,"base64");if(o.file.truncated||o.file.returnedBytes!==o.file.totalSizeBytes||s!==t.sizeBytes)throw new Error(`Output download was incomplete for ${t.name}`);return o}),n)}d(Le,"lazyOutputDownload");function Ae(r,e,t){let n=r.id.replace(/[^a-zA-Z0-9._-]+/g,"-").slice(0,80)||`input-${e+1}`,o=r.name.replace(/[^a-zA-Z0-9._-]+/g,"-").slice(-120)||"file",s=`${n}-${o}`,i=s,p=1;for(;t.has(i);)p+=1,i=`${s}-${p}`;return t.add(i),i}d(Ae,"uniqueInputName");function ce(r,e,t){!r||typeof r!="object"||Object.assign(r,{workLifecycle:e,...t?{workFinalizationError:k(t)}:{}})}d(ce,"attachWorkFailure");function Te(r){return new Map(r.map(e=>[e.path,me(e)]))}d(Te,"outputSignatures");function me(r){return`${r.sizeBytes}:${r.updatedAt}`}d(me,"outputSignature");function _e(r){let e=ge(r.path).split("/").at(-1)||r.path,t=qe(e);return{path:r.path,name:e,mimeType:t,sizeBytes:r.sizeBytes,updatedAt:r.updatedAt,isBinary:r.isBinary??null,previewable:r.previewable??(t.startsWith("image/")||t==="application/pdf"||t.startsWith("text/"))}}d(_e,"workOutputFromFile");function ge(r){return r.replaceAll("\\","/")}d(ge,"normalizedOutputPath");function qe(r){let e=r.toLowerCase().match(/\.[^.]+$/)?.[0]??"";return je[e]??"application/octet-stream"}d(qe,"workOutputMimeType");var je=Object.freeze({".avif":"image/avif",".csv":"text/csv",".docx":"application/vnd.openxmlformats-officedocument.wordprocessingml.document",".gif":"image/gif",".html":"text/html",".jpeg":"image/jpeg",".jpg":"image/jpeg",".json":"application/json",".m4a":"audio/mp4",".md":"text/markdown",".mov":"video/quicktime",".mp3":"audio/mpeg",".mp4":"video/mp4",".pdf":"application/pdf",".png":"image/png",".pptx":"application/vnd.openxmlformats-officedocument.presentationml.presentation",".svg":"image/svg+xml",".tsv":"text/tab-separated-values",".txt":"text/plain",".wav":"audio/wav",".webm":"video/webm",".webp":"image/webp",".xlsx":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"});function O(r,e){return{role:"tool",tool_call_id:r,content:JSON.stringify(e)}}d(O,"toolMessage");function le(r,e,t,n){return Number.isFinite(r)?Math.min(t,Math.max(e,Math.floor(r))):n}d(le,"boundedInteger");function Ee(r,e){return r.length<=e?r:`${r.slice(0,e)}
|
|
5
5
|
\u2026 output truncated by openpond-sdk`}d(Ee,"truncate");function k(r){return r instanceof Error?r.message:String(r)}d(k,"errorMessage");function Ue(r,e){return new Promise((t,n)=>{if(e?.aborted){n(e.reason);return}let o=setTimeout(t,r);o.unref?.(),e?.addEventListener("abort",()=>{clearTimeout(o),n(e.reason)},{once:!0})})}d(Ue,"sleep");import{promises as he}from"node:fs";var R=class{static{d(this,"OpenPondProjectActionsClient")}#e;#n;constructor(e){this.#e=e.apiKey,this.#n=e.apiBaseUrl.replace(/\/+$/,"")}async list(e){let t=await y(this.#n,this.#e,q(e.projectId,"releases",e.teamId));return(await w(t,"List Project Action releases")).releases}async catalog(e){let t=await y(this.#n,this.#e,q(e.projectId,"catalog",e.teamId));return(await w(t,"Get Project Action catalog")).catalog}async publish(e){let[t,n]=await Promise.all([he.readFile(e.build.bundlePath),he.readFile(e.build.runnerPath)]),o=await y(this.#n,this.#e,q(e.projectId,"releases",e.teamId),{method:"POST",body:JSON.stringify({sourceRef:e.sourceRef,sourceCommitSha:e.sourceCommitSha,bundleBase64:t.toString("base64"),runnerBase64:n.toString("base64"),registry:e.build.registry,manifest:e.build.manifest,metadata:e.metadata})});return(await w(o,"Publish Project Actions")).release}async run(e){let t=await y(this.#n,this.#e,q(e.projectId,`actions/${encodeURIComponent(e.actionId)}`,e.teamId),{method:"POST",body:JSON.stringify({input:e.value??{},releaseId:e.releaseId,idempotencyKey:e.idempotencyKey,callerType:e.callerType??"sdk",callerId:e.callerId}),signal:e.signal,timeoutMs:9e5});return(await w(t,"Run Project Action")).invocation}};function q(r,e,t){return`/v1/project-actions/${encodeURIComponent(r)}/${e}?teamId=${encodeURIComponent(t)}`}d(q,"projectActionPath");var C=class{static{d(this,"OpenPondProfileActionsClient")}#e;#n;constructor(e){this.#e=e.apiKey,this.#n=e.apiBaseUrl.replace(/\/+$/,"")}async catalog(e){let t=S(e.teamId,"teamId"),n=new URLSearchParams({teamId:t});e.profileId?.trim()&&n.set("profileId",e.profileId.trim()),e.profileName?.trim()&&n.set("profileName",e.profileName.trim());let o=await y(this.#n,this.#e,`/v1/profile/actions?${n.toString()}`);return(await w(o,"Get Profile Action catalog")).catalog}async run(e){let t=S(e.teamId,"teamId"),n=S(e.actionKey,"actionKey"),o=S(e.idempotencyKey,"idempotencyKey"),s=S(e.catalogVersion,"catalogVersion"),i=await y(this.#n,this.#e,`/v1/profile/actions/run?${new URLSearchParams({teamId:t}).toString()}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...e.profileId?.trim()?{profileId:e.profileId.trim()}:{},...e.profileName?.trim()?{profileName:e.profileName.trim()}:{},actionKey:n,value:e.value??{},conversationId:e.conversationId??null,createConversation:e.createConversation,conversationTitle:e.conversationTitle??null,idempotencyKey:o,catalogVersion:s,externalCapabilityLeases:e.externalCapabilityLeases})});return w(i,"Run Profile Action")}};function S(r,e){let t=r.trim();if(!t)throw new Error(`${e} is required`);return t}d(S,"requiredValue");import{randomUUID as fe}from"node:crypto";var I=class{static{d(this,"OpenPondWorkflowsClient")}#e;#n;constructor(e){this.#e=e.apiKey,this.#n=e.apiBaseUrl.replace(/\/+$/,"")}async list(e={}){return this.#t("","List Workflows",{signal:e.signal})}async create(e,t={}){return this.#t("","Create Workflow",{method:"POST",body:JSON.stringify({...e,clientRequestId:e.clientRequestId?.trim()||fe()}),signal:t.signal})}async update(e,t,n={}){return this.#t(`/schedules/${encodeURIComponent(V(e,"scheduleId"))}`,"Update Workflow",{method:"PATCH",body:JSON.stringify(t),signal:n.signal})}async delete(e,t={}){return this.#t(`/schedules/${encodeURIComponent(V(e,"scheduleId"))}`,"Delete Workflow",{method:"DELETE",signal:t.signal})}async runNow(e,t={},n={}){return this.#t(`/schedules/${encodeURIComponent(V(e,"scheduleId"))}/run`,"Run Workflow",{method:"POST",body:JSON.stringify({clientRequestId:t.clientRequestId?.trim()||fe()}),signal:n.signal})}async#t(e,t,n={}){let o=await y(this.#n,this.#e,`/v1/saved-work${e}`,n);return w(o,t)}};function V(r,e){let t=r.trim();if(!t)throw new Error(`${e} is required`);return t}d(V,"requiredId");var j=a.object({id:l,scope:l,sourceId:l,name:a.string().trim().min(1).max(100),keyPrefix:a.string().min(1).max(100),createdAt:a.iso.datetime(),expiresAt:a.iso.datetime(),revokedAt:a.iso.datetime().nullable()}).strict(),ye=a.string().regex(/^opk_key_[A-Za-z0-9]{16}_[A-Za-z0-9]{48}$/),E=a.discriminatedUnion("action",[a.object({action:a.literal("create"),scope:l,sourceId:l,name:a.string().trim().min(1).max(100),expiresAt:a.iso.datetime(),operationId:l,apiKey:ye}).strict(),a.object({action:a.literal("list"),scope:l,sourceId:l,afterId:l.optional(),limit:a.number().int().min(1).max(100).default(30)}).strict(),a.object({action:a.literal("revoke"),scope:l,sourceId:l,id:l}).strict()]),we=a.object({credential:j,apiKey:ye}).strict(),Pe=a.object({items:a.array(j).max(100),nextCursor:l.nullable()}).strict(),Oe=a.object({scope:l,sourceId:l}).strict(),be=a.object({scope:l,source:F,taskDefinition:F,enabled:a.boolean(),allowedSplits:a.array(Q).min(1).max(4)}).strict();var Be=a.object({batchId:a.string().trim().min(1).max(500),modelProjectId:a.string().trim().min(1).max(500)}).strict(),Ke=a.object({batchId:a.string().min(1),projectId:a.string().min(1),tasksetId:a.string().min(1),releaseId:a.string().min(1),revision:a.number().int().positive(),contentHash:a.string().regex(/^[a-f0-9]{64}$/)}).strict(),u=class extends Error{constructor(t,n,o,s){super(o);this.status=t;this.code=n;this.details=s;this.name="OpenPondLearningError"}status;code;details;static{d(this,"OpenPondLearningError")}},v=class{static{d(this,"OpenPondLearningClient")}#e;constructor(e){if(!e.apiKey.trim()||!e.scope.trim())throw new Error("Learning API key and scope are required.");let t=new URL(e.baseUrl);if(!["http:","https:"].includes(t.protocol)||t.username||t.password||t.search||t.hash)throw new Error("Learning base URL must be an HTTP(S) endpoint without credentials, query, or fragment.");this.#e={...e,baseUrl:t.toString().replace(/\/+$/,"")}}async command(e,t={}){ne(e);let n=oe.parse({scope:this.#e.scope,command:e}),o=se.parse(await this.#t("commands",n,t));if(o.operationId!==e.operationId)throw new u(502,"operation_identity_mismatch","Learning response did not match the submitted operation.",null);return o}submitExample(e,t={}){return this.command({action:"submit_example",operationId:e.idempotencyKey,example:e},t)}submitFeedback(e,t={}){return this.command({action:"submit_feedback",operationId:e.idempotencyKey,feedback:e},t)}async get(e,t,n,o={}){let s=P.parse({action:"get",scope:this.#e.scope,kind:e,id:t,...n===void 0?{}:{revision:n}});return H[e].parse(await this.#t("read",s,o))}async inspectEvidence(e,t={}){let n=P.parse({action:"inspect_evidence",scope:this.#e.scope,evidence:e}),o=re.parse(await this.#t("read",n,t));if(!M(o.evidence,e))throw new u(502,"evidence_identity_mismatch","Inspection did not match the requested evidence release.",null);return o}async inspectTaskQueue(e=null,t={}){let n=P.parse({action:"inspect_task_queue",scope:this.#e.scope,modelProjectId:e}),o=te.parse(await this.#t("read",n,t));if(o.modelProjectId!==e)throw new u(502,"model_identity_mismatch","Task queue did not match the requested Model.",null);return o}async inspectPolicy(e,t={}){let n=P.parse({action:"inspect_policy",scope:this.#e.scope,policy:e}),o=ee.parse(await this.#t("read",n,t));if(!M(o.policy,e))throw new u(502,"policy_identity_mismatch","Inspection did not match the requested policy release.",null);return o}async createSourceCredential(e,t={}){let n=E.parse({...e,action:"create",scope:this.#e.scope}),o=we.parse(await this.#t("credentials",n,t));if(this.#n(o.credential,e.sourceId),o.apiKey!==e.apiKey||!e.apiKey.startsWith(`${o.credential.keyPrefix}_`))throw new u(502,"credential_identity_mismatch","Credential response did not match the prepared credential.",null);return o}async listSourceCredentials(e,t={},n={}){let o=E.parse({...t,action:"list",scope:this.#e.scope,sourceId:e}),s=Pe.parse(await this.#t("credentials",o,n));if(s.items.length>(t.limit??30))throw new u(502,"credential_page_invalid","Credential response exceeded the requested page size.",null);for(let i of s.items)this.#n(i,e);return s}async revokeSourceCredential(e,t,n={}){let o=E.parse({action:"revoke",scope:this.#e.scope,sourceId:e,id:t}),s=j.parse(await this.#t("credentials",o,n));if(this.#n(s,e),s.id!==t||s.revokedAt===null)throw new u(502,"credential_revocation_mismatch","Credential revocation did not match the requested credential.",null);return s}async sourceConfiguration(e,t={}){let n=Oe.parse({scope:this.#e.scope,sourceId:e}),o=be.parse(await this.#t("source-config",n,t));if(o.scope!==this.#e.scope||o.source.id!==e)throw new u(502,"source_identity_mismatch","Source configuration did not match the requested source.",null);return o}#n(e,t){if(e.scope!==this.#e.scope||e.sourceId!==t)throw new u(502,"credential_scope_mismatch","Credential response did not match the requested source.",null)}async list(e,t={},n={}){let o=P.parse({action:"list",scope:this.#e.scope,kind:e,...t});return a.object({items:a.array(H[e]).max(100),nextCursor:a.string().nullable()}).strict().parse(await this.#t("read",o,n))}async publishBatch(e,t={}){let n=Be.parse(e),o=Ke.parse(await this.#t("publish-batch",{...n,scope:this.#e.scope},t));if(o.batchId!==n.batchId)throw new u(502,"batch_identity_mismatch","Published batch response did not match the requested batch.",null);return o}async#t(e,t,n){$(t,16777216);let o=await(this.#e.fetch??globalThis.fetch)(`${this.#e.baseUrl}/v1/learning/${e}`,{method:"POST",headers:{Authorization:`Bearer ${this.#e.apiKey}`,"Content-Type":"application/json",Accept:"application/json","X-OpenPond-Team-Id":this.#e.scope},body:JSON.stringify(t),signal:n.signal,redirect:"error"}),s=await $e(o);if(!o.ok){let i=a.object({code:a.string().optional(),error:a.string().optional()}).passthrough().safeParse(s);throw new u(o.status,i.success?i.data.code??"learning_request_failed":"learning_request_failed",i.success?i.data.error??`Learning request failed (${o.status}).`:`Learning request failed (${o.status}).`,s)}return s}};async function $e(r){let t=r.body?.getReader();if(!t)throw new u(r.status,"empty_response","Learning response was empty.",null);let n=new TextDecoder,o=0,s="";try{for(;;){let p=await t.read();if(p.done)break;if(o+=p.value.byteLength,o>16777216)throw new u(r.status,"response_too_large","Learning response exceeded 16 MiB; request a smaller page.",null);s+=n.decode(p.value,{stream:!0})}s+=n.decode();let i=JSON.parse(s);return $(i,16777216),i}finally{await t.cancel(),t.releaseLock()}}d($e,"readBoundedLearningResponse");var X=class{static{d(this,"OpenPondClient")}sandboxes;work;workflows;actions;profileActions;learning;constructor(e){let t=e.apiKey?.trim()??"";if(!t&&(!e.sandbox||!e.model))throw new Error("OpenPond API key is required when using a default sandbox or model");let n=e.sandbox?{...e.sandbox,endpoint:N(e.sandbox.endpoint,"Sandbox endpoint"),apiKey:_(e.sandbox.apiKey,"Sandbox API key")}:void 0,o=e.model?{endpoint:N(e.model.endpoint,"Model endpoint"),apiKey:_(e.model.apiKey,"Model API key"),model:_(e.model.model,"Model ID")}:void 0,s=e.baseUrl?.trim()||"https://api.openpond.ai";this.learning=i=>new v({apiKey:t,baseUrl:s,scope:i}),this.sandboxes=Y({apiKey:n?.apiKey??t,baseUrl:s,sandboxApiUrl:n?.endpoint??e.sandboxApiUrl,customEndpoint:!!n}),this.work=new x({apiKey:o?.apiKey??t,apiBaseUrl:s,chatApiBaseUrl:o?.endpoint||e.chatApiUrl?.trim()||B({apiBaseUrl:s,env:{}}),sandboxes:this.sandboxes,sandboxConfig:n,defaultModel:o?.model,customModel:!!o}),this.workflows=new I({apiKey:t,apiBaseUrl:s}),this.actions=new R({apiKey:t,apiBaseUrl:s}),this.profileActions=new C({apiKey:t,apiBaseUrl:s})}};function Jt(r){return new X(r)}d(Jt,"createOpenPondClient");export{Jt as a};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{Pa as u,Qa as h}from"./chunk-
|
|
2
|
+
import{Pa as u,Qa as h}from"./chunk-IFP6W4OW.js";import{f as c}from"./chunk-H7IWJN7L.js";import{a as s}from"./chunk-FTQLQJQV.js";import{createHash as i}from"node:crypto";import{readFile as m}from"node:fs/promises";import y from"node:path";var U=".openpond/source-upload-cache.json",d="openpond.source-upload-cache.v1";async function E(e){try{let a=(await u(c(),"source-upload.v1",l(e)))?.payload;if(!a)return new Map;if(a.schema!==d||!a.entries)return new Map;let t=new Map;for(let[o,n]of Object.entries(a.entries))!f(n)||o!==p(n)||t.set(o,n);return t}catch{return new Map}}s(E,"readSourceUploadCache");async function b(e,r){let a=await m(e.absolutePath),t=i("sha256").update(a).digest("hex"),o=p({...e,sha256:t}),n=r.get(o);return n&&n.sha256===t&&i("sha256").update(Buffer.from(n.contentsBase64,"base64")).digest("hex")===t?{file:e,entry:{path:e.path,type:"file",contentsBase64:n.contentsBase64},sha256:n.sha256}:{file:e,entry:{path:e.path,type:"file",contentsBase64:a.toString("base64")},sha256:t}}s(b,"materializeSourceUploadFile");async function A(e,r){let a={};for(let t of r){let o={path:t.file.path,size:t.file.size,mtimeMs:t.file.mtimeMs,ctimeMs:t.file.ctimeMs,sha256:t.sha256,contentsBase64:t.entry.contentsBase64};a[p(o)]=o}await h(c(),"source-upload.v1",l(e),{schema:d,generatedAt:new Date().toISOString(),entries:a})}s(A,"writeSourceUploadCache");function p(e){return`${e.path}\0${e.sha256}`}s(p,"cacheKeyForFile");function f(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;let r=e;return typeof r.path=="string"&&typeof r.size=="number"&&typeof r.mtimeMs=="number"&&typeof r.ctimeMs=="number"&&typeof r.sha256=="string"&&typeof r.contentsBase64=="string"}s(f,"isCacheEntry");function l(e){return i("sha256").update(y.resolve(e)).digest("hex")}s(l,"sourceScope");export{U as a,E as b,b as c,A as d};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{n as V,o as G,u as J}from"./chunk-
|
|
2
|
+
import{n as V,o as G,u as J}from"./chunk-MXLB6MEW.js";import{b as ie,c as se,d as ce}from"./chunk-DR3XPQRZ.js";import{h as X,k as Z}from"./chunk-EAPFMACH.js";import{a as I}from"./chunk-6FA3GG5B.js";import{c as o,d as H,e as l,f as K,h as ae,i as w}from"./chunk-3M53YXEI.js";import{a as i}from"./chunk-FTQLQJQV.js";import{existsSync as j,readFileSync as _e}from"node:fs";import{createRequire as Ie}from"node:module";import b from"node:path";function de(e){let n=b.join(e,"node_modules","openpond-agent-sdk","dist","cli.js");if(j(n))return{command:process.execPath,args:[n]};let t=b.join(e,"node_modules",".bin","openpond-agent");if(j(t))return{command:t,args:[]};let r=b.join(e,"node_modules","openpond-agent-sdk","src","cli.ts");if(j(r))return ue(b.dirname(b.dirname(r)),r);let a=De(e);return a||{command:"openpond-agent",args:[]}}i(de,"resolveLocalAgentSdkCommand");function De(e){let n=b.join(e,"package.json");if(!j(n))return null;try{let t=JSON.parse(_e(n,"utf8")),r=t.dependencies?.["openpond-agent-sdk"]??t.devDependencies?.["openpond-agent-sdk"]??t.peerDependencies?.["openpond-agent-sdk"];if(!r?.startsWith("file:"))return null;let a=b.resolve(e,r.slice(5)),d=b.join(a,"src","cli.ts");if(j(d))return ue(a,d);let s=b.join(a,"dist","cli.js");if(j(s))return{command:process.execPath,args:[s]}}catch{return null}return null}i(De,"resolveAgentSdkDependencyCli");function ue(e,n){let t=Ie(b.join(e,"package.json")).resolve("tsx/cli");return{command:process.execPath,args:[t,n]}}i(ue,"nodeTypescriptCommand");import{Buffer as A}from"node:buffer";import{existsSync as U,promises as P}from"node:fs";import m from"node:path";import{createHash as Te}from"node:crypto";import{existsSync as T,promises as M,readFileSync as ye,statSync as Me}from"node:fs";import{tmpdir as $e}from"node:os";import y from"node:path";import{gunzipSync as ze}from"node:zlib";import{existsSync as C}from"node:fs";import v from"node:path";function L(e,n){let t=n.packageManager;if(typeof t=="string"){let r=t.split("@")[0];if(r==="bun"||r==="npm"||r==="pnpm"||r==="yarn")return r}return C(v.join(e,"bun.lock"))||C(v.join(e,"bun.lockb"))?"bun":C(v.join(e,"pnpm-lock.yaml"))?"pnpm":C(v.join(e,"yarn.lock"))?"yarn":C(v.join(e,"package-lock.json"))||C(v.join(e,"npm-shrinkwrap.json"))?"npm":"unknown"}i(L,"detectAgentSdkPackageManager");function le(e){return e==="npm"?"npm install --offline":e==="pnpm"?"pnpm install --offline":e==="yarn"?"yarn install --offline":e==="bun"?"bun install --offline":"pnpm install --offline"}i(le,"agentSdkDependencyInstallCommand");function pe(e,n){return e==="pnpm"?`pnpm run ${n}`:e==="yarn"?`yarn ${n}`:e==="npm"?`npm run ${n}`:e==="bun"?`bun run ${n}`:`pnpm run ${n}`}i(pe,"agentSdkRunScriptCommand");function ge(e,n){return e==="pnpm"?`pnpm --silent run ${n}`:e==="yarn"?`yarn --silent ${n}`:e==="npm"?`npm run --silent ${n}`:e==="bun"?`bun run --silent ${n}`:`pnpm --silent run ${n}`}i(ge,"agentSdkRunJsonScriptCommand");var ke=".openpond/vendor/openpond-agent-sdk.tgz",Ue=".openpond/vendor/npm",Ne=`file:${ke}`,fe="# openpond-agent-sdk-source-upload: synthesized-openpond-yaml";async function ne(e,n,t={}){return J(e,n,{cwd:t.cwd})}i(ne,"runCommand");function Je(e){for(let n of["dependencies","devDependencies","peerDependencies"]){let t=e[n];if(!t||typeof t!="object"||Array.isArray(t))continue;let r=t["openpond-agent-sdk"];if(typeof r=="string"&&r.trim())return r.trim()}return null}i(Je,"readOpenPondAgentSdkVersionSpec");async function he(e,n){let t=Ke(e,n);if(!t)return null;let r=await M.mkdtemp(y.join($e(),"openpond-agent-sdk-pack-"));try{let a=t.kind==="package_root"?await Le(t.packageRoot,r):t.kind==="registry"?await He(t.versionSpec,r):t.tarballContents,d=await Fe({sdkPackageJson:t.packageJson,dependencyBaseDir:t.dependencyBaseDir,projectPackageJson:n,projectPath:e,tempDir:r}),s=L(e,n),c=Xe(n,d,s),u=s==="pnpm"||s==="unknown"?Ze(e,d):null,p=le(s),f={packageName:"openpond-agent-sdk",source:"uploaded_tarball",path:ke,sha256:O(a),sizeBytes:a.byteLength};return{rewrittenPackageJson:c,pnpmWorkspaceSource:u,tarballs:[{...f,contents:a},...d],dependencySetup:{required:!0,packageManager:s,installCommand:p,commands:[p],packageJsonPath:"package.json",expectedBinaryPath:"node_modules/.bin/openpond-agent",generatedArtifactDirectory:".openpond",sdkPackage:f,dependencyPackages:d.map(g=>({packageName:g.packageName,source:g.source,versionSpec:g.versionSpec,path:g.path,sha256:g.sha256,sizeBytes:g.sizeBytes}))}}}finally{await M.rm(r,{recursive:!0,force:!0})}}i(he,"buildAgentSdkMaterializedDependency");async function Le(e,n){let t=await ne("npm",["pack","--silent","--pack-destination",n,e],{cwd:e});if(t.code!==0){let a=[t.stderr.trim(),t.stdout.trim()].filter(Boolean).join(`
|
|
3
3
|
`);throw new Error(`failed to pack openpond-agent-sdk for source upload${a?`:
|
|
4
4
|
${a}`:""}`)}let r=t.stdout.trim().split(/\r?\n/).filter(Boolean).pop();if(!r)throw new Error("failed to pack openpond-agent-sdk for source upload: npm pack did not return a tarball name");return M.readFile(y.join(n,r))}i(Le,"packOpenPondAgentSdkPackageRoot");async function Fe(e){let n=D(e.sdkPackageJson.dependencies),t=D(e.projectPackageJson.dependencies),r=D(e.projectPackageJson.devDependencies);delete t["openpond-agent-sdk"],delete r["openpond-agent-sdk"];let a=[...Object.entries(n).map(([c,u])=>({packageName:c,versionSpec:u,dependencyBaseDir:e.dependencyBaseDir})),...Object.entries(t).map(([c,u])=>({packageName:c,versionSpec:u,dependencyBaseDir:e.projectPath})),...Object.entries(r).map(([c,u])=>({packageName:c,versionSpec:u,dependencyBaseDir:e.projectPath}))].sort((c,u)=>c.packageName.localeCompare(u.packageName)),d=new Set,s=[];for(;a.length>0;){let{packageName:c,versionSpec:u,dependencyBaseDir:p}=a.shift();if(d.has(c))continue;d.add(c);let f=We({packageName:c,versionSpec:u,dependencyBaseDir:p}),g=await ne("npm",["pack","--silent","--pack-destination",e.tempDir,f],{cwd:p});if(g.code!==0){let h=[g.stderr.trim(),g.stdout.trim()].filter(Boolean).join(`
|
|
5
5
|
`);throw new Error(`failed to pack openpond-agent-sdk dependency ${c}${h?`:
|