openpond 0.2.22 → 0.2.23
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/app-server.js +1 -1
- package/dist/chunks/{actions-command-P62RTUD6.js → actions-command-CZD7U6CC.js} +1 -1
- package/dist/chunks/{app-layer-6SOR3QBT.js → app-layer-4CK6ZEKN.js} +1 -1
- package/dist/chunks/app-server-runtime-5XZWU7JL.js +2 -0
- package/dist/chunks/{apps-HFTYJ74Q.js → apps-NIQBGOGH.js} +1 -1
- package/dist/chunks/{chunk-TDEMXZ3R.js → chunk-3XUBKIBN.js} +1 -1
- package/dist/chunks/{chunk-VNCJGHJC.js → chunk-3YAGJU2X.js} +1 -1
- package/dist/chunks/{chunk-ONMUSXZU.js → chunk-CTC5EYSH.js} +1 -1
- package/dist/chunks/{chunk-YH35HMNN.js → chunk-CXDS2LSW.js} +1 -1
- package/dist/chunks/{chunk-QIQDNEFD.js → chunk-H75VJFMZ.js} +1 -1
- package/dist/chunks/{chunk-HPJFRC4R.js → chunk-J3WNPOLS.js} +1 -1
- package/dist/chunks/{chunk-VU4NRDKZ.js → chunk-JS6MS2NR.js} +2 -2
- package/dist/chunks/{chunk-GKSPJZSF.js → chunk-NS3VMSTX.js} +2 -2
- package/dist/chunks/{chunk-MCDTLTSV.js → chunk-Q76GR2JM.js} +1 -1
- package/dist/chunks/{chunk-GTV6J3M2.js → chunk-T3VPZRIX.js} +1 -1
- package/dist/chunks/{chunk-GGFXBQ3B.js → chunk-V2BBMZ7I.js} +1 -1
- package/dist/chunks/{chunk-DQNSR2Q7.js → chunk-WYHHDJEG.js} +16 -16
- package/dist/chunks/{chunk-2ESK5DPT.js → chunk-XDVKDELR.js} +1 -1
- package/dist/chunks/{cli-J5YD6UAN.js → cli-GWKOPTLS.js} +1 -1
- package/dist/chunks/{configuration-command-QIY6A4XZ.js → configuration-command-OAZNWOFX.js} +1 -1
- package/dist/chunks/{core-commands-GDEELWSN.js → core-commands-VGUAOSWS.js} +1 -1
- package/dist/chunks/{desktop-test-QIW5H3YZ.js → desktop-test-SPTFR43A.js} +1 -1
- package/dist/chunks/{extension-T5IOOMNR.js → extension-AZRG5IPK.js} +1 -1
- package/dist/chunks/{help-A2NLYYDQ.js → help-6IMGNP7A.js} +1 -1
- package/dist/chunks/{opchat-WMMKFVVB.js → opchat-OS7WAVZO.js} +1 -1
- package/dist/chunks/{organizations-RVMJ2UXS.js → organizations-QPACFCMH.js} +1 -1
- package/dist/chunks/{profile-M5YD4P5E.js → profile-A3YR3WVU.js} +1 -1
- package/dist/chunks/{project-agent-6JUCQ4JO.js → project-agent-5H6VCDAY.js} +1 -1
- package/dist/chunks/{sandbox-command-KADUJT5Y.js → sandbox-command-RKUHXCZJ.js} +1 -1
- package/dist/chunks/{sandbox-template-4SOHDYWY.js → sandbox-template-FK2TGQPK.js} +1 -1
- package/dist/chunks/{src-T3RRUIRF.js → src-RZFKQSHW.js} +1 -1
- package/dist/chunks/{src-GHTPFT4Q.js → src-UIX7LWM7.js} +1 -1
- package/dist/chunks/{teams-bot-B2TEGEXF.js → teams-bot-PASMNRFS.js} +1 -1
- package/dist/chunks/{workspaces-66IE4AVY.js → workspaces-YFAAPNVP.js} +1 -1
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/app-server-runtime-7POHOWYT.js +0 -2
package/dist/app-server.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{fd as r}from"./chunks/chunk-
|
|
2
|
+
import{fd as r}from"./chunks/chunk-NS3VMSTX.js";import"./chunks/chunk-T3VPZRIX.js";import{j as e,t as p}from"./chunks/chunk-MD7IADMT.js";import"./chunks/chunk-XDVKDELR.js";import"./chunks/chunk-V2BBMZ7I.js";import"./chunks/chunk-Q76GR2JM.js";import"./chunks/chunk-XEOEKFG6.js";import"./chunks/chunk-CTC5EYSH.js";import"./chunks/chunk-6MI4KKWF.js";import"./chunks/chunk-SDO4FC4Q.js";import"./chunks/chunk-IR3YJWPW.js";import"./chunks/chunk-J3WNPOLS.js";import"./chunks/chunk-J2S7BOZU.js";import"./chunks/chunk-WYHHDJEG.js";import"./chunks/chunk-6FA3GG5B.js";import"./chunks/chunk-NNLI4OWY.js";import"./chunks/chunk-HZP5U2AA.js";import"./chunks/chunk-ES2ISFJC.js";import"./chunks/chunk-H7IWJN7L.js";import"./chunks/chunk-FTQLQJQV.js";export{e as AGENT_PROTOCOL_VERSION,r as createOpenPondAppServer,p as runAppServerJsonl};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{b as h,c as f,d as p}from"./chunk-XEOEKFG6.js";import{a as w}from"./chunk-
|
|
2
|
+
import{b as h,c as f,d as p}from"./chunk-XEOEKFG6.js";import{a as w}from"./chunk-H75VJFMZ.js";import"./chunk-J3WNPOLS.js";import"./chunk-J2S7BOZU.js";import"./chunk-WYHHDJEG.js";import"./chunk-HZP5U2AA.js";import"./chunk-ES2ISFJC.js";import{f as y}from"./chunk-3M53YXEI.js";import{a as c}from"./chunk-FTQLQJQV.js";import{promises as I,watch as N}from"node:fs";import m from"node:path";import{execFile as A}from"node:child_process";import{promisify as E}from"node:util";var S=E(A);async function x(t,n){let r=n[0]??"check",e=m.resolve(s(t,"cwd")??process.cwd()),l=s(t,"sourceDirectory"),u=s(t,"outputDirectory"),d=y(t.json);if(r==="check"||r==="build"){let o=await f({projectRoot:e,sourceDirectory:l,outputDirectory:u});if(d){console.log(JSON.stringify({status:"passed",actionCount:o.registry.actions.length,registry:o.registry,manifest:o.manifest,outputDirectory:o.outputDirectory},null,2));return}console.log(`${r==="check"?"Validated":"Built"} ${o.registry.actions.length} Project Action${o.registry.actions.length===1?"":"s"}.`),console.log(`Registry: ${o.registryPath}`),console.log(`Bundle: ${o.bundlePath}`);return}if(r==="run"){let o=n[1];if(!o)throw new Error("usage: openpond actions run <action-id> [--input JSON|--input-file PATH]");let a=await p({projectRoot:e,sourceDirectory:l,outputDirectory:u,build:"always"}).run({actionId:o,input:await v(t,e),timeoutMs:R(t,"timeoutMs")});console.log(JSON.stringify(a,null,2));return}if(r==="dev"){let o=n[1]??null;await $({projectRoot:e,sourceDirectory:l,outputDirectory:u,actionId:o,options:t,json:d});return}if(r==="publish"){let o=b(t,"projectId"),i=b(t,"teamId"),a=s(t,"apiKey")??process.env.OPENPOND_API_KEY?.trim();if(!a)throw new Error("OpenPond API key is required. Set OPENPOND_API_KEY or pass --api-key.");let j=await f({projectRoot:e,sourceDirectory:l,outputDirectory:u}),D=s(t,"sourceCommitSha")??await P(e,["rev-parse","HEAD"]),O=s(t,"sourceRef")??await P(e,["rev-parse","--abbrev-ref","HEAD"]),g=await w({apiKey:a,baseUrl:s(t,"baseUrl")??process.env.OPENPOND_API_URL}).actions.publish({projectId:o,teamId:i,sourceRef:O,sourceCommitSha:D,build:j});console.log(d?JSON.stringify({release:g},null,2):`Published Project Actions release ${g.id} from ${g.sourceCommitSha}.`);return}throw new Error("usage: openpond actions <check|build|run|dev|publish> [action-id]")}c(x,"runProjectActionsCommand");async function $(t){let n=!1,r=!1,e=c(async()=>{if(n){r=!0;return}n=!0;try{let o=p({projectRoot:t.projectRoot,sourceDirectory:t.sourceDirectory,outputDirectory:t.outputDirectory,build:"always"});if(t.actionId){let i=await o.run({actionId:t.actionId,input:await v(t.options,t.projectRoot),timeoutMs:R(t.options,"timeoutMs")});console.log(JSON.stringify(i,null,2))}else{let i=await o.build(),a={status:"ready",actionCount:i.registry.actions.length,bundleHash:i.manifest.bundleHash};console.log(t.json?JSON.stringify(a):`Ready with ${a.actionCount} Project Action${a.actionCount===1?"":"s"}.`)}}catch(o){console.error(o instanceof Error?o.message:String(o))}finally{n=!1,r&&(r=!1,await e())}},"execute");await e();let l=await h(t.projectRoot),u=m.resolve(t.projectRoot,t.sourceDirectory??l.sourceDirectory??"openpond/actions");console.log(`Watching ${u}`);let d=N(u,{recursive:!0},()=>{setTimeout(()=>{e()},50)});await new Promise(o=>{let i=c(()=>{d.close(),o()},"stop");process.once("SIGINT",i),process.once("SIGTERM",i)})}c($,"runDev");async function v(t,n){let r=s(t,"input"),e=s(t,"inputFile");if(r&&e)throw new Error("Use either --input or --input-file, not both.");return r?JSON.parse(r):e?JSON.parse(await I.readFile(m.resolve(n,e),"utf8")):{}}c(v,"actionInput");function s(t,n){let r=t[n];return typeof r=="string"&&r.trim()?r.trim():void 0}c(s,"stringOption");function b(t,n){let r=s(t,n);if(!r)throw new Error(`--${n.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)} is required.`);return r}c(b,"requiredOption");async function P(t,n){let{stdout:r}=await S("git",n,{cwd:t}),e=r.trim();if(!e)throw new Error(`git ${n.join(" ")} returned no value.`);return e}c(P,"gitValue");function R(t,n){let r=s(t,n);if(r===void 0)return;let e=Number(r);if(!Number.isInteger(e)||e<=0)throw new Error(`--${n} must be a positive integer.`);return e}c(R,"integerOption");export{x as runProjectActionsCommand};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{x as m}from"./chunk-G2VYRU27.js";import"./chunk-ZVOO7FKM.js";import"./chunk-OGPHXXCD.js";import"./chunk-
|
|
2
|
+
import{x as m}from"./chunk-G2VYRU27.js";import"./chunk-ZVOO7FKM.js";import"./chunk-OGPHXXCD.js";import"./chunk-H75VJFMZ.js";import"./chunk-SS3EG6S2.js";import"./chunk-GLUWATL5.js";import"./chunk-J3WNPOLS.js";import"./chunk-J2S7BOZU.js";import"./chunk-WYHHDJEG.js";import{a as l}from"./chunk-CXDS2LSW.js";import"./chunk-NNLI4OWY.js";import"./chunk-HZP5U2AA.js";import"./chunk-ES2ISFJC.js";import"./chunk-H7IWJN7L.js";import"./chunk-JS6MS2NR.js";import"./chunk-3M53YXEI.js";import{a as i}from"./chunk-FTQLQJQV.js";import{existsSync as c}from"node:fs";import{createRequire as v}from"node:module";import s from"node:path";import{fileURLToPath as E}from"node:url";var p="24.18.0";function N(e=process.versions.node){let r=/^(\d+)\.(\d+)\.(\d+)/.exec(e),n=r?Number(r[1]):Number.NaN,o=r?Number(r[2]):Number.NaN;return n===24&&o>=18?null:[`OpenPond TUI requires Node.js ${p} or newer in the Node 24 release line; detected Node.js ${e}.`,`Switch Node versions and retry (with nvm: \`nvm install ${p} && nvm use ${p}\`).`].join(`
|
|
3
3
|
`)}i(N,"openPondTuiNodeRuntimeMessage");var u=s.dirname(E(import.meta.url)),O=class extends Error{constructor(n,o){super(n);this.exitCode=o;this.name="OpenPondChildProcessExitError"}exitCode;static{i(this,"OpenPondChildProcessExitError")}};async function F(e,r,n){let o=f(e==="app-server"?"app-server":"server"),t=[...o.args,e,...P(r),...n];e==="web"&&t.push(r.noOpen===!0||r.noOpen==="true"?"--print-access-url":"--open-browser");let a=e==="web"&&typeof r.webRoot!="string"?C():null;a&&t.push("--web-root",a),await w(o.runner,t,e==="app-server"?process.cwd():o.cwd)}i(F,"runOpenPondServerCommand");async function q(e,r){b(e);let n=N();if(n)throw new l(n);let o=f("terminal"),t=f("server"),a=[...o.args,"chat",...P(R(e)),...r];await w(o.runner,a,process.cwd(),{OPENPOND_SERVER_RUNNER:t.runner,OPENPOND_SERVER_ARGS:JSON.stringify(t.args),OPENPOND_SERVER_CWD:t.cwd})}i(q,"runOpenPondTerminalCommand");function h(){if(process.env.OPENPOND_FORCE_EMBEDDED_COMPANIONS==="1")return null;let e=[s.resolve(u,"../../../.."),s.resolve(u,"../../.."),process.cwd()];for(let r of e)if(c(s.join(r,"apps","server"))&&c(s.join(r,"apps","terminal")))return r;return null}i(h,"findWorkspaceRoot");function f(e){let r=h();if(r){let t=e==="app-server"?s.join(r,"apps","server","src","app-server-entry.ts"):s.join(r,"apps",e,"src","index.ts");if(c(t)){let d=v(s.join(r,"package.json"));return{runner:process.execPath,args:[d.resolve("tsx/cli"),t],cwd:r}}let a=e==="app-server"?s.join(r,"apps","server","dist","app-server-entry.js"):s.join(r,"apps",e,"dist","index.js");if(c(a))return{runner:process.execPath,args:[a],cwd:r}}let n=_(),o=e==="app-server"?"__app-server":e==="server"?"__server":"__terminal";if(n)return{runner:process.execPath,args:[n,o],cwd:s.dirname(s.dirname(n))};if(D())return{runner:process.execPath,args:[o],cwd:process.cwd()};throw new Error(`Could not find the installed OpenPond ${e} companion.`)}i(f,"resolveAppEntrypoint");function _(){for(let e of[s.resolve(u,"../cli.js"),s.resolve(u,"../../dist/cli.js")])if(c(e))return e;return null}i(_,"installedCliEntrypoint");function C(){if(!1){let n=s.join(s.dirname(process.execPath),"web");return c(s.join(n,"index.html"))?n:null}let e=_();if(!e)return null;let r=s.join(s.dirname(e),"web");return c(s.join(r,"index.html"))?r:null}i(C,"packagedWebRoot");function D(){if(!1)return!0;let e=process.argv[1];return!!(e&&s.resolve(e)===s.resolve(process.execPath))}i(D,"isCompiledExecutable");function P(e){let r=new Set(["account","handle","baseUrl","noOpen","tui","home"]),n=[];for(let[o,t]of Object.entries(e)){if(r.has(o))continue;let a=`--${o.replace(/[A-Z]/g,d=>`-${d.toLowerCase()}`)}`;if(t===!0||t==="true")n.push(a);else{if(t===!1||t==="false")continue;n.push(a,t)}}return n}i(P,"forwardedOptions");function R(e){let r=process.cwd(),n={...e};return typeof e.cwd=="string"&&e.cwd.trim().length>0&&(n.cwd=s.resolve(r,e.cwd)),typeof e.messageFile=="string"&&e.messageFile.trim().length>0&&(n.messageFile=s.resolve(r,e.messageFile)),n}i(R,"normalizeTerminalPaths");function b(e){if(typeof e.approvalPolicy=="string"&&!["on-request","never","on-failure","untrusted"].includes(e.approvalPolicy))throw new l("approval-policy must be on-request, never, on-failure, or untrusted");if(typeof e.sandbox=="string"&&!["read-only","workspace-write","danger-full-access"].includes(e.sandbox))throw new l("sandbox must be read-only, workspace-write, or danger-full-access")}i(b,"validateTerminalForwardingOptions");async function w(e,r,n,o){let t=await m(e,r,{cwd:n,detached:!1,env:o,inherit:!0,timeoutMs:0});if(t.code!==0||t.signal){let a=t.signal?`signal ${t.signal}`:`code ${t.code??"unknown"}`;throw new O(`${s.basename(e)} exited with ${a}`,t.code??1)}}i(w,"runChild");export{O as OpenPondChildProcessExitError,F as runOpenPondServerCommand,q as runOpenPondTerminalCommand};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
+
import{ed as c,fd as d}from"./chunk-NS3VMSTX.js";import"./chunk-T3VPZRIX.js";import{j as a,t as b}from"./chunk-MD7IADMT.js";import"./chunk-XDVKDELR.js";import"./chunk-V2BBMZ7I.js";import"./chunk-Q76GR2JM.js";import"./chunk-XEOEKFG6.js";import"./chunk-CTC5EYSH.js";import"./chunk-6MI4KKWF.js";import"./chunk-SDO4FC4Q.js";import"./chunk-IR3YJWPW.js";import"./chunk-J3WNPOLS.js";import"./chunk-J2S7BOZU.js";import"./chunk-WYHHDJEG.js";import"./chunk-6FA3GG5B.js";import"./chunk-NNLI4OWY.js";import"./chunk-HZP5U2AA.js";import"./chunk-ES2ISFJC.js";import"./chunk-H7IWJN7L.js";import"./chunk-FTQLQJQV.js";export{a as AGENT_PROTOCOL_VERSION,c as APP_SERVER_COMPOSITION,d as createOpenPondAppServer,b as runAppServerJsonl};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{c as g,i as $,j as J,k as L,l as v,m as q}from"./chunk-G2VYRU27.js";import{f as m,h as y}from"./chunk-ZVOO7FKM.js";import{b as H,c as Q}from"./chunk-22UARBPW.js";import"./chunk-OGPHXXCD.js";import"./chunk-
|
|
2
|
+
import{c as g,i as $,j as J,k as L,l as v,m as q}from"./chunk-G2VYRU27.js";import{f as m,h as y}from"./chunk-ZVOO7FKM.js";import{b as H,c as Q}from"./chunk-22UARBPW.js";import"./chunk-OGPHXXCD.js";import"./chunk-H75VJFMZ.js";import{J as C,K as G,L as k,O as W,Q as M,S as z,T as F,Z as f,c as D,m as K,r as V,s as _}from"./chunk-SS3EG6S2.js";import"./chunk-GLUWATL5.js";import"./chunk-J3WNPOLS.js";import"./chunk-J2S7BOZU.js";import"./chunk-WYHHDJEG.js";import"./chunk-CXDS2LSW.js";import"./chunk-NNLI4OWY.js";import"./chunk-HZP5U2AA.js";import"./chunk-ES2ISFJC.js";import"./chunk-H7IWJN7L.js";import"./chunk-JS6MS2NR.js";import{a as S,f as w,j as T,k as j}from"./chunk-3M53YXEI.js";import{a as p}from"./chunk-FTQLQJQV.js";async function ie(){let e=await f(),s=m(e),t=await g(e,s),n=y(e),r=await L({apiBase:n,apiKey:t});console.log(JSON.stringify(r,null,2))}p(ie,"runAppsTools");async function se(e){let s=await f(),t=m(s),n=y(s),r=await g(s,t),i=typeof e.handle=="string"?String(e.handle):void 0,o=i?$(i):null,c=e.refresh!==void 0?w(e.refresh):void 0,l=await J({apiBase:n,apiKey:r,forceRefresh:c}),u=o?l.filter(a=>$(a.handle||a.gitOwner)===o):l;if(u.length===0){console.log("no apps found");return}if(w(e.json)){console.log(JSON.stringify({apps:u},null,2));return}for(let a of u){let d=a.handle||a.gitOwner||"unknown",h=a.repo||a.gitRepo||a.id,B=a.latestDeployment?.status||"no-deploy",R=a.latestDeployment?.gitBranch||a.defaultBranch||"-",I=a.codeVisibility||"unknown",E=a.sandbox?"yes":"no";console.log(`${d}/${h} ${B} ${R} code=${I} sandbox=${E} ${a.id}`)}}p(se,"runAppsList");async function oe(e,s){let t=typeof e.visibility=="string"?e.visibility.trim():typeof e.codeVisibility=="string"?e.codeVisibility.trim():"";if(t!=="public"&&t!=="private")throw new Error("usage: apps code-visibility <handle>/<repo> --visibility public|private");let n=await f(),r=m(n),i=y(n),o=await g(n,r),{app:c,handle:l,repo:u}=await v(i,o,s),a=await K(i,o,c.id,t);console.log(`${l}/${u} code_visibility=${a.app?.codeVisibility??t} app_id=${c.id}`)}p(oe,"runAppsCodeVisibility");async function ae(e){let s=await f(),t=m(s),n=await g(s,t),r=y(s),i=typeof e.appId=="string"?String(e.appId):void 0,o=await G(r,n,{appId:i});console.log(JSON.stringify(o,null,2))}p(ae,"runAppsPerformance");async function ce(e,s){let t=await f(),n=m(t),r=y(t),i=await g(t,n),{app:o}=await v(r,i,s),c=await k(r,i,o.id);console.log(JSON.stringify(c,null,2))}p(ce,"runAppsSummary");async function le(e,s,t,n){let r=(typeof e.prompt=="string"?e.prompt:null)||n.join(" ");if(!r.trim())throw new Error("usage: apps assistant <plan|performance> <handle>/<repo> --prompt <text>");let i=await f(),o=m(i),c=y(i),l=await g(i,o),{app:u}=await v(c,l,t),a=await W(c,l,{appId:u.id,mode:s,prompt:r.trim()});console.log(JSON.stringify(a,null,2))}p(le,"runAppsAssistant");async function de(e,s){let t=await f(),n=m(t),r=await g(t,n),i=y(t),o=(typeof e.prompt=="string"?e.prompt:null)||s.join(" ");if(!o.trim())throw new Error("usage: apps agent create --prompt <text> [--team-id <id>]");let c=typeof e.templateRepoUrl=="string"?e.templateRepoUrl:void 0,l=typeof e.templateBranch=="string"?e.templateBranch:void 0,u=typeof e.templateLocalPath=="string"?e.templateLocalPath:void 0,a=typeof e.teamId=="string"&&e.teamId.trim()?e.teamId.trim():void 0;if(u&&String(u).trim().length>0)throw new Error("templateLocalPath is not supported; use templateRepoUrl");let d=typeof e.env=="string"?S(e.env,"env"):void 0;if(d){if(typeof d!="object"||Array.isArray(d))throw new Error("env must be a JSON object");for(let[b,A]of Object.entries(d))if(typeof A!="string")throw new Error(`env value for ${b} must be a string`)}let h=c||l||d?{templateRepoUrl:c,templateBranch:l,envVars:d}:void 0,B=typeof e.deployEnvironment=="string"?e.deployEnvironment==="preview"?"preview":"production":void 0,R=e.deployDisabled!==void 0?w(e.deployDisabled):void 0,I=e.streamDeployLogs!==void 0?w(e.streamDeployLogs):!0,E=await C(i,r,{prompt:o.trim(),...a?{teamId:a}:{},...h?{template:h}:{},...B?{deployEnvironment:B}:{},...R!==void 0?{deployDisabled:R}:{},streamDeployLogs:I});if(!E.ok){let b=await E.text().catch(()=>"");throw new Error(`agent create failed: ${E.status} ${b}`)}let N=null,O=null,P=null;await H(E,{onConversationId:p(b=>{N=b},"onConversationId"),onItems:p(b=>{for(let A of b){let U=Q(A);U&&console.log(U);let x=A;!O&&typeof x.appId=="string"&&(O=x.appId),!P&&typeof x.deploymentId=="string"&&(P=x.deploymentId)}},"onItems")}),N&&console.log(`conversation_id: ${N}`),O&&console.log(`app_id: ${O}`),P&&console.log(`deployment_id: ${P}`);try{await J({apiBase:i,apiKey:r,forceRefresh:!0}),await L({apiBase:i,apiKey:r,forceRefresh:!0})}catch(b){console.warn("cache refresh failed",b)}}p(de,"runAppsAgentCreate");async function pe(e,s,t,n){let r=await f(),i=m(r),o=await g(r,i),c=y(r),l=typeof e.method=="string"?String(e.method).toUpperCase():void 0,u=l&&["GET","POST","PUT","DELETE"].includes(l)?l:void 0;if(l&&!u)throw new Error("method must be GET, POST, PUT, or DELETE");let a=typeof e.body=="string"?S(String(e.body),"body"):void 0,d=typeof e.headers=="string"?S(String(e.headers),"headers"):void 0,h=typeof e.scheduleId=="string"?String(e.scheduleId):void 0,B=w(e.notifyEmail),R=w(e.summary)||w(e.withSummary),I=await M(c,o,{appId:s,deploymentId:t,toolName:n,scheduleId:h,method:u,body:a,headers:d,notifyEmail:B||void 0});if(console.log(JSON.stringify(I,null,2)),R&&I.ok){let E=await k(c,o,s);console.log(JSON.stringify({summary:E},null,2))}}p(pe,"runAppsToolsExecute");async function ue(e,s){let t=typeof e.env=="string"?e.env:typeof e.vars=="string"?e.vars:typeof e.envVars=="string"?e.envVars:null;if(!t)throw new Error("usage: apps env set <handle>/<repo> --env <json>");let n=S(t,"env");if(!n||typeof n!="object"||Array.isArray(n))throw new Error("env must be a JSON object");let r={};for(let[d,h]of Object.entries(n)){if(typeof h!="string")throw new Error(`env value for ${d} must be a string`);if(!d.startsWith("OPENTOOL_PUBLIC_"))throw new Error("only OPENTOOL_PUBLIC_ env vars can be set");r[d]=h}let i=await f(),o=m(i),c=y(i),l=await g(i,o),{app:u}=await v(c,l,s),a=await V(c,l,u.id,{envVars:r});console.log(JSON.stringify(a,null,2))}p(ue,"runAppsEnvSet");async function fe(e,s){let t=await f(),n=m(t),r=y(t),i=await g(t,n),{app:o}=await v(r,i,s),c=await _(r,i,o.id);console.log(JSON.stringify(c,null,2))}p(fe,"runAppsEnvGet");async function ge(e,s){let t=await f(),n=m(t),r=y(t),i=await g(t,n),{app:o,handle:c,repo:l}=await v(r,i,s),u=typeof e.env=="string"?e.env:typeof e.environment=="string"?e.environment:void 0,a=j(u),d=await D(r,i,o.id,{environment:a});console.log(JSON.stringify(d,null,2)),(w(e.watch)||w(e.wait)||w(e.follow))&&await q({baseUrl:r,apiKey:i,deploymentId:d.deploymentId,prefix:`[${c}/${l}] `,intervalMs:e.interval?Number(e.interval):void 0,timeoutMs:e.timeout?Number(e.timeout):void 0})}p(ge,"runAppsDeploy");function X(e){let s={};if(typeof e.params=="string"){let n=S(String(e.params),"params");if(!n||typeof n!="object"||Array.isArray(n))throw new Error("params must be a JSON object");for(let[r,i]of Object.entries(n))i!==void 0&&(s[r]=typeof i=="string"?i:JSON.stringify(i))}let t=p((n,r)=>{r===void 0||r===""||(s[n]=r)},"addParam");if(t("source",typeof e.source=="string"?e.source.trim():void 0),t("symbol",typeof e.symbol=="string"?e.symbol.trim():void 0),t("cursor",typeof e.cursor=="string"?e.cursor.trim():void 0),t("status",typeof e.status=="string"?e.status.trim():void 0),t("backtestRunId",typeof e.runId=="string"?e.runId.trim():typeof e.backtestRunId=="string"?e.backtestRunId.trim():void 0),t("since",T(e.since,"since")),t("until",T(e.until,"until")),typeof e.limit=="string"&&e.limit.trim().length>0){let n=Number.parseInt(e.limit,10);if(!Number.isFinite(n))throw new Error("limit must be a number");t("limit",String(n))}return Object.keys(s).length?s:void 0}p(X,"resolveBacktestEventsParams");async function me(e,s){let t=await f(),n=m(t),r=await g(t,n),i=y(t),{app:o}=await v(i,r,s),c={...X(e)??{},appId:o.id},l=await z(i,r,{method:"GET",query:c});console.log(JSON.stringify(l,null,2))}p(me,"runBacktestEvents");async function ye(e,s){let t=typeof e.runId=="string"?e.runId.trim():typeof e.backtestRunId=="string"?e.backtestRunId.trim():"";if(!t)throw new Error("usage: backtest get <handle>/<repo> --run-id <id>");let n=await f(),r=m(n),i=await g(n,r),o=y(n),{app:c}=await v(o,i,s),l=await F(o,i,{appId:c.id,runId:t});console.log(JSON.stringify(l,null,2))}p(ye,"runBacktestGet");export{X as resolveBacktestEventsParams,de as runAppsAgentCreate,le as runAppsAssistant,oe as runAppsCodeVisibility,ge as runAppsDeploy,fe as runAppsEnvGet,ue as runAppsEnvSet,se as runAppsList,ae as runAppsPerformance,ce as runAppsSummary,ie as runAppsTools,pe as runAppsToolsExecute,me as runBacktestEvents,ye as runBacktestGet};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{b as Q,c as Z,t as ee,y as oe}from"./chunk-MD7IADMT.js";import{a as T,b as X,h as K}from"./chunk-
|
|
2
|
+
import{b as Q,c as Z,t as ee,y as oe}from"./chunk-MD7IADMT.js";import{a as T,b as X,h as K}from"./chunk-XDVKDELR.js";import{n as te,p as re}from"./chunk-V2BBMZ7I.js";import{$a as E,Ra as V,Sa as J,Ua as I,Xa as F,_a as W,b as L,c as B,db as z,fb as q,gb as Y,ja as D,la as H,ma as M,na as $,oa as j,qa as G}from"./chunk-NNLI4OWY.js";import{b as i}from"./chunk-ES2ISFJC.js";import{c as N,d as C,f as k,h as R}from"./chunk-H7IWJN7L.js";import{a as s}from"./chunk-FTQLQJQV.js";import{promises as U}from"node:fs";import Ee from"node:os";import Ae from"node:path";import{createServer as Ie}from"node:http";import{randomBytes as Te}from"node:crypto";var be=i.discriminatedUnion("op",[i.strictObject({op:i.literal("set"),path:i.array(i.string().min(1)).min(1),value:i.unknown()}),i.strictObject({op:i.literal("unset"),path:i.array(i.string().min(1)).min(1)})]),Oe=i.discriminatedUnion("action",[i.strictObject({action:i.literal("patch"),expectedRevision:i.string(),operations:i.array(be).max(100)}),i.strictObject({action:i.literal("replace"),expectedRevision:i.string(),text:i.string().max(1048576)}),i.strictObject({action:i.literal("validate"),text:i.string().max(1048576)}),i.strictObject({action:i.literal("restore"),expectedRevision:i.string(),revision:i.string()}),i.strictObject({action:i.literal("trust"),root:i.string(),accountId:i.string(),trusted:i.boolean()}),i.strictObject({action:i.literal("client-state"),owner:i.string(),patch:z,importOnly:i.boolean().optional()})]);function ne(e){let t=null;async function r(l,n){let g=R(e).config,w=null,p=null,d=null;try{w=await B(g),d=await E(e,{projectRoot:l,accountId:n}),l||(t=d)}catch(v){p=C(v,g)}let y=d??(l?null:t);return{path:g,text:w,rawRevision:L(w),issue:p,effective:y,usingLastValid:!d&&!!y,applies:"next_turn",recoverableRevisions:await H(e),clientState:p?null:await q(e)}}s(r,"status");async function o(l){let n=Oe.parse(l);return n.action==="validate"?{valid:!0,document:D(n.text,R(e).config)}:(n.action==="patch"&&await G(e,n.expectedRevision,n.operations),n.action==="replace"&&await M(e,n.expectedRevision,n.text),n.action==="restore"&&await $(e,n.revision,n.expectedRevision),n.action==="trust"&&await W(e,n.root,n.accountId,n.trusted),n.action==="client-state"?Y(e,n.owner,n.patch,n.importOnly):r())}return s(o,"mutate"),{status:r,mutate:o,schema:j}}s(ne,"createConfigurationPayloads");import{Buffer as ie}from"node:buffer";var A={"Access-Control-Allow-Headers":"authorization, content-type, x-openpond-team-id","Access-Control-Allow-Methods":"GET, POST, PUT, PATCH, DELETE, OPTIONS"},Se=25*1024*1024,x=class extends Error{constructor(r,o,l){super(l);this.status=r;this.code=o;this.name="HttpBodyError"}status;code;static{s(this,"HttpBodyError")}};function ae(e,t,r={}){for(let[l,n]of Object.entries(A))t.setHeader(l,n);let o=ce(e.headers.origin);return o?(t.setHeader("Vary",xe(t.getHeader("Vary"))),Re(o,r)?(t.setHeader("Access-Control-Allow-Origin",o),{allowed:!0,origin:o}):{allowed:!1,origin:o}):{allowed:!0,origin:null}}s(ae,"applyCorsHeaders");function Re(e,t={}){if(e==="null")return!0;let r=se(e);return r?Ce(r)?!0:new Set((t.allowedOrigins??[]).map(l=>l?se(l):null).filter(l=>!!l)).has(r):!1}s(Re,"isAllowedCorsOrigin");function h(e,t,r){e.writeHead(t,{"Content-Type":"application/json",...A}),e.end(JSON.stringify(r))}s(h,"sendJson");function Je(e,t,r){e.writeHead(t,{"Content-Type":"text/plain; charset=utf-8",...A}),e.end(r)}s(Je,"sendText");function Fe(e,t,r,o){e.writeHead(t,{"Content-Type":o,"Content-Length":String(r.byteLength),"Cache-Control":"no-store","X-Content-Type-Options":"nosniff",...A}),e.end(r)}s(Fe,"sendBinary");async function _(e,t={}){let r=t.maxBytes??Se,o=ce(e.headers["content-type"]),l=[],n=0;for await(let w of e){let p=ie.from(w);if(n+=p.byteLength,n>r)throw new x(413,"request_body_too_large",`JSON request body exceeds ${r} bytes.`);l.push(p)}let g=ie.concat(l).toString("utf8").trim();if(!g)return{};if(!Pe(o))throw new x(415,"unsupported_media_type","JSON request body requires Content-Type: application/json.");try{return JSON.parse(g)}catch{throw new x(400,"invalid_json","Request body is not valid JSON.")}}s(_,"readJson");function le(e,t,r){let o=e.headers.authorization;return(typeof o=="string"&&o.startsWith("Bearer ")?o.slice(7):null)===r}s(le,"hasAuth");function ce(e){return Array.isArray(e)?e[0]??null:e??null}s(ce,"headerValue");function Pe(e){if(!e)return!1;let t=e.split(";")[0]?.trim().toLowerCase();return t==="application/json"||!!t?.endsWith("+json")}s(Pe,"isJsonContentType");function se(e){try{let t=new URL(e);return t.protocol!=="http:"&&t.protocol!=="https:"?null:t.origin}catch{return null}}s(se,"normalizeOrigin");function Ce(e){let t=new URL(e);return t.hostname==="localhost"||t.hostname==="127.0.0.1"||t.hostname==="::1"||t.hostname==="[::1]"}s(Ce,"isLoopbackOrigin");function xe(e){let r=(Array.isArray(e)?e.join(", "):e?String(e):"").split(",").map(o=>o.trim()).filter(Boolean);return r.some(o=>o.toLowerCase()==="origin")||r.push("Origin"),r.join(", ")}s(xe,"appendVaryOrigin");function pe(e){return`<!doctype html><html lang="en"><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>OpenPond recovery</title>
|
|
3
3
|
<style nonce="${e}">body{font:16px system-ui;background:#171819;color:#eee;max-width:850px;margin:6vh auto;padding:24px}textarea{box-sizing:border-box;width:100%;min-height:280px;background:#222;color:#eee;padding:14px;border:1px solid #777;border-radius:8px;font:14px monospace}button,input,select{font:inherit;margin:6px;padding:8px}pre{white-space:pre-wrap}code{overflow-wrap:anywhere}button{cursor:pointer}p{line-height:1.5}</style>
|
|
4
4
|
<h1>OpenPond needs a storage repair</h1><p id="issue" role="alert">Loading recovery details\u2026</p><p><code id="file"></code></p>
|
|
5
5
|
<p id="action"></p><p>Migration backups and the source installation remain available. Execution services are stopped while recovery is open.</p>
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{A as F,a as fe,b as L,c as R,d as me,e as D,f as G,g as j,h as z,j as ye,l as T,m as we,n as S,o as he,y as B}from"./chunk-G2VYRU27.js";import{b as H,c as be,d as ve,f as w,h as P,i as Re}from"./chunk-ZVOO7FKM.js";import{$ as ge,M as ce,N as le,R as de,V as pe,Z as y,_ as ue,aa as C,h as $,i as ne,l as oe,n as re,o as ie,p as ae,q as se}from"./chunk-SS3EG6S2.js";import{a as Z,b as ee,c as te}from"./chunk-VU4NRDKZ.js";import{a as M,f as v,k as X}from"./chunk-3M53YXEI.js";import{a as g}from"./chunk-FTQLQJQV.js";import{promises as V,existsSync as W}from"node:fs";import U from"node:path";import{stdin as $e}from"node:process";async function Ge(e,o){let t=await y(),r=w(t),n=P(t),i=await R(t,r),{app:a}=await T(n,i,o),s=await ie(n,i,a.id);console.log(JSON.stringify(s,null,2))}g(Ge,"runTemplateStatus");async function je(e,o){let t=await y(),r=w(t),n=P(t),i=await R(t,r),{app:a}=await T(n,i,o),s=await ae(n,i,a.id);console.log(JSON.stringify(s,null,2))}g(je,"runTemplateBranches");async function ze(e,o){let t=await y(),r=w(t),n=P(t),i=await R(t,r),{app:a}=await T(n,i,o),s=typeof e.env=="string"?e.env:typeof e.environment=="string"?e.environment:void 0,f=X(s),c=await se(n,i,a.id,{environment:f});console.log(JSON.stringify(c,null,2))}g(ze,"runTemplateUpdate");async function He(e){let o=await y(),t=w(o),r=typeof e.apiKey=="string"?e.apiKey:typeof e.key=="string"?e.key:null,n=r?r.trim():await L();if(!n)throw new Error("API key is required");n.startsWith("opk_")||console.log("warning: API keys usually start with opk_."),await C({handle:o.activeProfile?.handle||"default",apiKey:n,baseUrl:t,apiBaseUrl:o.apiBaseUrl,chatApiBaseUrl:o.chatApiBaseUrl,setActive:!0}),console.log("Saved account credentials to the encrypted OpenPond credential store.")}g(He,"runLogin");async function Fe(e,o){let t=o[0]||"list";if(t==="list"){let r=await ue();console.log(JSON.stringify({profiles:r},null,2));return}if(t==="use"){let r=o[1];if(!r)throw new Error("usage: profiles use <name> [--base-url <url>]");let n=await ge(r,{baseUrl:H(e)});console.log(JSON.stringify({profile:n},null,2));return}if(t==="save"){let r=o[1];if(!r)throw new Error("usage: profiles save <name> --api-key <key> [--base-url <url>] [--api-base-url <url>] [--chat-api-base-url <url>]");let n=typeof e.apiKey=="string"?e.apiKey:typeof e.key=="string"?e.key:null,i=n?n.trim():await L(),a=typeof e.environment=="string"?e.environment:typeof e.env=="string"?e.env:void 0,s=await C({handle:r,apiKey:i,baseUrl:H(e),apiBaseUrl:be(e),chatApiBaseUrl:ve(e),environment:a,setActive:!0});console.log(JSON.stringify({profile:s},null,2));return}throw new Error("usage: profiles <list|use|save> [args]")}g(Fe,"runProfiles");async function Ve(){let e=await y(),o=w(e),t=P(e),r=await R(e,o),n=await ce(t,r);console.log(JSON.stringify(n,null,2))}g(Ve,"runAccount");async function We(e){let o=await y(),t=P(o),r=fe(o),n=await le(t,r);console.log(JSON.stringify(n,null,2))}g(We,"runHealth");async function qe(e,o){let t=await y(),r=w(t),n=P(t),i=await R(t,r),{app:a}=await T(n,i,o),s=typeof e.branch=="string"?String(e.branch):void 0,f=await $(n,i,a.id,{branch:s});if(!f?.id){console.log("no deployments found");return}let c=await ne(n,i,f.id),d=(c&&Array.isArray(c.toolsJson)?c.toolsJson:null)||(c&&typeof c.metadataJson=="object"&&c.metadataJson?c.metadataJson.tools:null),u=Array.isArray(d)?d:[];if(u.length===0){console.log("no tools found");return}for(let l of u){let m=l,h=m.profile||m.function,I=m.name||h?.name||"unknown",p=m.description||h?.description||"";console.log(p?`${I} - ${p}`:I)}}g(qe,"runToolList");async function Ye(e,o,t){let r=await y(),n=w(r),i=P(r),a=await R(r,n),{app:s}=await T(i,a,o),f=typeof e.branch=="string"?String(e.branch):void 0,c=await $(i,a,s.id,{branch:f});if(!c?.id)throw new Error("no deployments found");let d;if(typeof e.body=="string")try{d=JSON.parse(e.body)}catch{throw new Error("tool body must be valid JSON")}let u=typeof e.method=="string"?String(e.method).toUpperCase():"POST",l=await pe(n,a,{appId:s.id,deploymentId:c.id,toolName:t,method:u,body:d,headers:a?{"openpond-api-key":a}:void 0});if(!l.ok)throw new Error(l.error||`tool failed (${l.status})`);let m=l.data??{ok:!0};console.log(JSON.stringify(m,null,2))}g(Ye,"runToolRun");async function Qe(e,o,t){let r=await y(),n=w(r),i=P(r),a=await R(r,n),{app:s}=await T(i,a,o),f=typeof e.branch=="string"?String(e.branch):void 0,c=typeof e.deploymentId=="string"?String(e.deploymentId):void 0,d=c?{id:c}:await $(i,a,s.id,{branch:f});if(!d?.id)throw new Error("no deployments found");let u=typeof e.body=="string"?M(String(e.body),"body"):{};if(!u||typeof u!="object"||Array.isArray(u))throw new Error("body must be a JSON object");let l=typeof e.method=="string"?String(e.method).toUpperCase():"POST",m={...u,appId:s.id,deploymentId:d.id,toolName:t,method:l},h=await de(i,a,m);console.log(JSON.stringify(h,null,2))}g(Qe,"runBacktestRun");async function Xe(e,o){let t=await y(),r=w(t),n=P(t),i=await R(t,r),{app:a,handle:s,repo:f}=await T(n,i,o),c=typeof e.branch=="string"?String(e.branch):void 0,d=typeof e.deploymentId=="string"?String(e.deploymentId):void 0,u=d?{id:d}:await $(n,i,a.id,{branch:c});if(!u?.id){console.log("no deployments found");return}await we({baseUrl:n,apiKey:i,deploymentId:u.id,prefix:`[${s}/${f}] `,intervalMs:e.interval?Number(e.interval):void 0,timeoutMs:e.timeout?Number(e.timeout):void 0})}g(Xe,"runDeployWatch");async function Ze(e,o){let r=((typeof e.name=="string"?e.name:null)||o.join(" ")).trim();if(!r)throw new Error("usage: repo create --name <name> [--team-id <id>] [--path <dir>] [--template <owner/repo|url>] [--template-branch <branch>] [--empty|--opentool] [--sandbox] [--token] [--auto-schedule-migration <true|false>]");let n=await y(),i=w(n),a=await R(n,i),s=P(n),f=typeof e.teamId=="string"&&e.teamId.trim()?e.teamId.trim():void 0,c=typeof e.template=="string"?e.template.trim():"";if(c&&(e.empty==="true"||e.opentool==="true"))throw new Error("choose one: --template or --empty/--opentool");if(e.empty==="true"&&e.opentool==="true")throw new Error("choose one: --empty or --opentool");let d=typeof e.description=="string"?e.description.trim():void 0,u=typeof e.templateBranch=="string"&&e.templateBranch.trim().length>0?e.templateBranch.trim():void 0,l=typeof e.env=="string"?M(e.env,"env"):void 0;if(l){if(typeof l!="object"||Array.isArray(l))throw new Error("env must be a JSON object");for(let[b,A]of Object.entries(l))if(typeof A!="string")throw new Error(`env value for ${b} must be a string`)}if(c){e.deployOnPush!==void 0&&console.warn("deploy-on-push is not used for template create (auto deploys)");let b=Re(c,i),k=(await re(s,a,[{name:r,...d?{description:d}:{},templateRepoUrl:b,...u?{templateBranch:u}:{},...l?{envVars:l}:{}}],f)).items?.[0];if(!k||k.status!=="ok"||!k.appId)throw new Error(k?.error||"Template create failed");console.log(`app_id: ${k.appId}`),k.deploymentId&&console.log(`deployment_id: ${k.deploymentId}`),k.conversationId&&console.log(`conversation_id: ${k.conversationId}`);return}let m=process.cwd(),h=typeof e.path=="string"?e.path:typeof e.dir=="string"?e.dir:null,I=h&&h.trim().length>0?h.trim():$e.isTTY?await he(m):m,p=U.resolve(I);if(W(p)){if(!(await V.stat(p)).isDirectory())throw new Error(`path is not a directory: ${p}`)}else await V.mkdir(p,{recursive:!0});let Pe=(await V.readdir(p)).filter(b=>b!==".git").length===0,x=v(e.yes)||v(e.force);if(!Pe&&!x&&!await S(`Directory is not empty (${p}). Continue?`,!1)){console.log("aborted");return}let ke=U.join(p,".git");if(!W(ke)){if(!(x?!0:await S("Initialize git repository here?",!0))){console.log("aborted");return}let A=await B("git",["init"],{cwd:p});if(A.code!==0)throw new Error(`git init failed: ${A.stderr.trim()||A.stdout.trim()||"unknown error"}`)}let K=await F(p,"origin");if(K&&!x&&!await S(`Remote "origin" already set (${K}). Replace it?`,!1)){console.log("aborted");return}let q=e.opentool==="true"?"opentool":"empty",Te=v(e.sandbox),Be=v(e.deployOnPush),N=e.autoScheduleMigration,Y=typeof N=="string"||typeof N=="boolean",Ee=Y?v(N):void 0,E=await oe(s,a,{name:r,...f?{teamId:f}:{},...d?{description:d}:{},...q?{repoInit:q}:{},...Te?{sandbox:!0}:{},...l?{envVars:l}:{},...Be?{deployOnPush:!0}:{},...Y?{autoScheduleMigration:Ee}:{}}),O=me(E);z(O);let J=v(e.token)||v(e.setRemoteToken),Oe=D(O,a),Q=J?Oe:O,_=await B("git",K?["remote","set-url","origin",Q]:["remote","add","origin",Q],{cwd:p});if(_.code!==0)throw new Error(`git remote failed: ${j(_.stderr.trim()||_.stdout.trim()||"unknown error")}`);let Ae=J?G(O):O;console.log(`app_id: ${E.appId}`),E.gitOwner&&E.gitRepo&&console.log(`repo: ${E.gitOwner}/${E.gitRepo}`),console.log(`remote: ${Ae}`),console.log('next: git add . && git commit -m "init"');let Ie=E.defaultBranch||"master";console.log(`next: openpond repo push --path ${p} --branch ${Ie}`),J||console.log(`token-remote (non-interactive): git -C ${p} remote set-url origin ${G(O)}`);try{await ye({apiBase:s,apiKey:a,forceRefresh:!0})}catch(b){console.warn("cache refresh failed",b)}}g(Ze,"runRepoCreate");async function Se(e){let o=await B("git",["rev-parse","--abbrev-ref","HEAD"],{cwd:e});if(o.code!==0)return null;let t=o.stdout.trim();return t.length>0?t:null}g(Se,"resolveGitBranch");async function et(e){let o=await y(),t=w(o),r=await R(o,t),n=typeof e.path=="string"?e.path:typeof e.dir=="string"?e.dir:null,i=U.resolve(n&&n.trim().length>0?n.trim():"."),a=U.join(i,".git");if(!W(a))throw new Error(`git repo not found at ${i} (missing .git)`);let s=await F(i,"origin");if(!s)throw new Error("origin remote not set; run `openpond repo create` first");z(s);let c=(typeof e.branch=="string"?e.branch.trim():"")||await Se(i);if(!c)throw new Error("unable to resolve git branch; pass --branch");let d;try{d=D(s,r)}catch{throw new Error("origin remote must be https for tokenized pushes")}let u=v(e.keepTokenRemote)||v(e.token)||v(e.setRemoteToken),l=s.includes("x-access-token:"),m=!u&&!l?s:null,h=process.env.GIT_TERMINAL_PROMPT;process.env.GIT_TERMINAL_PROMPT="0";try{if(!l){let p=await B("git",["remote","set-url","origin",d],{cwd:i});if(p.code!==0)throw new Error(`git remote set-url failed: ${j(p.stderr.trim()||p.stdout.trim()||"unknown error")}`)}if((await B("git",["push","-u","origin",c],{cwd:i,inherit:!0})).code!==0)throw new Error("git push failed")}finally{m&&await B("git",["remote","set-url","origin",m],{cwd:i}).catch(()=>null),h===void 0?delete process.env.GIT_TERMINAL_PROMPT:process.env.GIT_TERMINAL_PROMPT=h}}g(et,"runRepoPush");async function tt(e){if(e.length===0)throw new Error("usage: opentool <init|validate|build> [args]");let o=process.platform==="win32"?"npx.cmd":"npx";if((await B(o,["opentool",...e],{inherit:!0})).code!==0)throw new Error("opentool command failed")}g(tt,"runOpentool");async function nt(){let e="openpond",o=Z(),t=await te(e),r=`npm i -g ${e}@${t}`,n=ee(o,t);if(n===0){console.log(`${e} is up to date (${o})`);return}if(n===-1){console.log(`Update available: ${o} -> ${t}`),console.log(`Run: ${r}`);return}if(n===1){console.log(`Installed version (${o}) is newer than npm latest (${t}).`);return}if(o===t){console.log(`${e} is up to date (${o})`);return}console.log(`Installed: ${o}`),console.log(`Latest: ${t}`),console.log(`Run: ${r}`)}g(nt,"runCheckUpdate");export{Ge as a,je as b,ze as c,He as d,Fe as e,Ve as f,We as g,qe as h,Ye as i,Qe as j,Xe as k,Ze as l,Se as m,et as n,tt as o,nt as p};
|
|
2
|
+
import{A as F,a as fe,b as L,c as R,d as me,e as D,f as G,g as j,h as z,j as ye,l as T,m as we,n as S,o as he,y as B}from"./chunk-G2VYRU27.js";import{b as H,c as be,d as ve,f as w,h as P,i as Re}from"./chunk-ZVOO7FKM.js";import{$ as ge,M as ce,N as le,R as de,V as pe,Z as y,_ as ue,aa as C,h as $,i as ne,l as oe,n as re,o as ie,p as ae,q as se}from"./chunk-SS3EG6S2.js";import{a as Z,b as ee,c as te}from"./chunk-JS6MS2NR.js";import{a as M,f as v,k as X}from"./chunk-3M53YXEI.js";import{a as g}from"./chunk-FTQLQJQV.js";import{promises as V,existsSync as W}from"node:fs";import U from"node:path";import{stdin as $e}from"node:process";async function Ge(e,o){let t=await y(),r=w(t),n=P(t),i=await R(t,r),{app:a}=await T(n,i,o),s=await ie(n,i,a.id);console.log(JSON.stringify(s,null,2))}g(Ge,"runTemplateStatus");async function je(e,o){let t=await y(),r=w(t),n=P(t),i=await R(t,r),{app:a}=await T(n,i,o),s=await ae(n,i,a.id);console.log(JSON.stringify(s,null,2))}g(je,"runTemplateBranches");async function ze(e,o){let t=await y(),r=w(t),n=P(t),i=await R(t,r),{app:a}=await T(n,i,o),s=typeof e.env=="string"?e.env:typeof e.environment=="string"?e.environment:void 0,f=X(s),c=await se(n,i,a.id,{environment:f});console.log(JSON.stringify(c,null,2))}g(ze,"runTemplateUpdate");async function He(e){let o=await y(),t=w(o),r=typeof e.apiKey=="string"?e.apiKey:typeof e.key=="string"?e.key:null,n=r?r.trim():await L();if(!n)throw new Error("API key is required");n.startsWith("opk_")||console.log("warning: API keys usually start with opk_."),await C({handle:o.activeProfile?.handle||"default",apiKey:n,baseUrl:t,apiBaseUrl:o.apiBaseUrl,chatApiBaseUrl:o.chatApiBaseUrl,setActive:!0}),console.log("Saved account credentials to the encrypted OpenPond credential store.")}g(He,"runLogin");async function Fe(e,o){let t=o[0]||"list";if(t==="list"){let r=await ue();console.log(JSON.stringify({profiles:r},null,2));return}if(t==="use"){let r=o[1];if(!r)throw new Error("usage: profiles use <name> [--base-url <url>]");let n=await ge(r,{baseUrl:H(e)});console.log(JSON.stringify({profile:n},null,2));return}if(t==="save"){let r=o[1];if(!r)throw new Error("usage: profiles save <name> --api-key <key> [--base-url <url>] [--api-base-url <url>] [--chat-api-base-url <url>]");let n=typeof e.apiKey=="string"?e.apiKey:typeof e.key=="string"?e.key:null,i=n?n.trim():await L(),a=typeof e.environment=="string"?e.environment:typeof e.env=="string"?e.env:void 0,s=await C({handle:r,apiKey:i,baseUrl:H(e),apiBaseUrl:be(e),chatApiBaseUrl:ve(e),environment:a,setActive:!0});console.log(JSON.stringify({profile:s},null,2));return}throw new Error("usage: profiles <list|use|save> [args]")}g(Fe,"runProfiles");async function Ve(){let e=await y(),o=w(e),t=P(e),r=await R(e,o),n=await ce(t,r);console.log(JSON.stringify(n,null,2))}g(Ve,"runAccount");async function We(e){let o=await y(),t=P(o),r=fe(o),n=await le(t,r);console.log(JSON.stringify(n,null,2))}g(We,"runHealth");async function qe(e,o){let t=await y(),r=w(t),n=P(t),i=await R(t,r),{app:a}=await T(n,i,o),s=typeof e.branch=="string"?String(e.branch):void 0,f=await $(n,i,a.id,{branch:s});if(!f?.id){console.log("no deployments found");return}let c=await ne(n,i,f.id),d=(c&&Array.isArray(c.toolsJson)?c.toolsJson:null)||(c&&typeof c.metadataJson=="object"&&c.metadataJson?c.metadataJson.tools:null),u=Array.isArray(d)?d:[];if(u.length===0){console.log("no tools found");return}for(let l of u){let m=l,h=m.profile||m.function,I=m.name||h?.name||"unknown",p=m.description||h?.description||"";console.log(p?`${I} - ${p}`:I)}}g(qe,"runToolList");async function Ye(e,o,t){let r=await y(),n=w(r),i=P(r),a=await R(r,n),{app:s}=await T(i,a,o),f=typeof e.branch=="string"?String(e.branch):void 0,c=await $(i,a,s.id,{branch:f});if(!c?.id)throw new Error("no deployments found");let d;if(typeof e.body=="string")try{d=JSON.parse(e.body)}catch{throw new Error("tool body must be valid JSON")}let u=typeof e.method=="string"?String(e.method).toUpperCase():"POST",l=await pe(n,a,{appId:s.id,deploymentId:c.id,toolName:t,method:u,body:d,headers:a?{"openpond-api-key":a}:void 0});if(!l.ok)throw new Error(l.error||`tool failed (${l.status})`);let m=l.data??{ok:!0};console.log(JSON.stringify(m,null,2))}g(Ye,"runToolRun");async function Qe(e,o,t){let r=await y(),n=w(r),i=P(r),a=await R(r,n),{app:s}=await T(i,a,o),f=typeof e.branch=="string"?String(e.branch):void 0,c=typeof e.deploymentId=="string"?String(e.deploymentId):void 0,d=c?{id:c}:await $(i,a,s.id,{branch:f});if(!d?.id)throw new Error("no deployments found");let u=typeof e.body=="string"?M(String(e.body),"body"):{};if(!u||typeof u!="object"||Array.isArray(u))throw new Error("body must be a JSON object");let l=typeof e.method=="string"?String(e.method).toUpperCase():"POST",m={...u,appId:s.id,deploymentId:d.id,toolName:t,method:l},h=await de(i,a,m);console.log(JSON.stringify(h,null,2))}g(Qe,"runBacktestRun");async function Xe(e,o){let t=await y(),r=w(t),n=P(t),i=await R(t,r),{app:a,handle:s,repo:f}=await T(n,i,o),c=typeof e.branch=="string"?String(e.branch):void 0,d=typeof e.deploymentId=="string"?String(e.deploymentId):void 0,u=d?{id:d}:await $(n,i,a.id,{branch:c});if(!u?.id){console.log("no deployments found");return}await we({baseUrl:n,apiKey:i,deploymentId:u.id,prefix:`[${s}/${f}] `,intervalMs:e.interval?Number(e.interval):void 0,timeoutMs:e.timeout?Number(e.timeout):void 0})}g(Xe,"runDeployWatch");async function Ze(e,o){let r=((typeof e.name=="string"?e.name:null)||o.join(" ")).trim();if(!r)throw new Error("usage: repo create --name <name> [--team-id <id>] [--path <dir>] [--template <owner/repo|url>] [--template-branch <branch>] [--empty|--opentool] [--sandbox] [--token] [--auto-schedule-migration <true|false>]");let n=await y(),i=w(n),a=await R(n,i),s=P(n),f=typeof e.teamId=="string"&&e.teamId.trim()?e.teamId.trim():void 0,c=typeof e.template=="string"?e.template.trim():"";if(c&&(e.empty==="true"||e.opentool==="true"))throw new Error("choose one: --template or --empty/--opentool");if(e.empty==="true"&&e.opentool==="true")throw new Error("choose one: --empty or --opentool");let d=typeof e.description=="string"?e.description.trim():void 0,u=typeof e.templateBranch=="string"&&e.templateBranch.trim().length>0?e.templateBranch.trim():void 0,l=typeof e.env=="string"?M(e.env,"env"):void 0;if(l){if(typeof l!="object"||Array.isArray(l))throw new Error("env must be a JSON object");for(let[b,A]of Object.entries(l))if(typeof A!="string")throw new Error(`env value for ${b} must be a string`)}if(c){e.deployOnPush!==void 0&&console.warn("deploy-on-push is not used for template create (auto deploys)");let b=Re(c,i),k=(await re(s,a,[{name:r,...d?{description:d}:{},templateRepoUrl:b,...u?{templateBranch:u}:{},...l?{envVars:l}:{}}],f)).items?.[0];if(!k||k.status!=="ok"||!k.appId)throw new Error(k?.error||"Template create failed");console.log(`app_id: ${k.appId}`),k.deploymentId&&console.log(`deployment_id: ${k.deploymentId}`),k.conversationId&&console.log(`conversation_id: ${k.conversationId}`);return}let m=process.cwd(),h=typeof e.path=="string"?e.path:typeof e.dir=="string"?e.dir:null,I=h&&h.trim().length>0?h.trim():$e.isTTY?await he(m):m,p=U.resolve(I);if(W(p)){if(!(await V.stat(p)).isDirectory())throw new Error(`path is not a directory: ${p}`)}else await V.mkdir(p,{recursive:!0});let Pe=(await V.readdir(p)).filter(b=>b!==".git").length===0,x=v(e.yes)||v(e.force);if(!Pe&&!x&&!await S(`Directory is not empty (${p}). Continue?`,!1)){console.log("aborted");return}let ke=U.join(p,".git");if(!W(ke)){if(!(x?!0:await S("Initialize git repository here?",!0))){console.log("aborted");return}let A=await B("git",["init"],{cwd:p});if(A.code!==0)throw new Error(`git init failed: ${A.stderr.trim()||A.stdout.trim()||"unknown error"}`)}let K=await F(p,"origin");if(K&&!x&&!await S(`Remote "origin" already set (${K}). Replace it?`,!1)){console.log("aborted");return}let q=e.opentool==="true"?"opentool":"empty",Te=v(e.sandbox),Be=v(e.deployOnPush),N=e.autoScheduleMigration,Y=typeof N=="string"||typeof N=="boolean",Ee=Y?v(N):void 0,E=await oe(s,a,{name:r,...f?{teamId:f}:{},...d?{description:d}:{},...q?{repoInit:q}:{},...Te?{sandbox:!0}:{},...l?{envVars:l}:{},...Be?{deployOnPush:!0}:{},...Y?{autoScheduleMigration:Ee}:{}}),O=me(E);z(O);let J=v(e.token)||v(e.setRemoteToken),Oe=D(O,a),Q=J?Oe:O,_=await B("git",K?["remote","set-url","origin",Q]:["remote","add","origin",Q],{cwd:p});if(_.code!==0)throw new Error(`git remote failed: ${j(_.stderr.trim()||_.stdout.trim()||"unknown error")}`);let Ae=J?G(O):O;console.log(`app_id: ${E.appId}`),E.gitOwner&&E.gitRepo&&console.log(`repo: ${E.gitOwner}/${E.gitRepo}`),console.log(`remote: ${Ae}`),console.log('next: git add . && git commit -m "init"');let Ie=E.defaultBranch||"master";console.log(`next: openpond repo push --path ${p} --branch ${Ie}`),J||console.log(`token-remote (non-interactive): git -C ${p} remote set-url origin ${G(O)}`);try{await ye({apiBase:s,apiKey:a,forceRefresh:!0})}catch(b){console.warn("cache refresh failed",b)}}g(Ze,"runRepoCreate");async function Se(e){let o=await B("git",["rev-parse","--abbrev-ref","HEAD"],{cwd:e});if(o.code!==0)return null;let t=o.stdout.trim();return t.length>0?t:null}g(Se,"resolveGitBranch");async function et(e){let o=await y(),t=w(o),r=await R(o,t),n=typeof e.path=="string"?e.path:typeof e.dir=="string"?e.dir:null,i=U.resolve(n&&n.trim().length>0?n.trim():"."),a=U.join(i,".git");if(!W(a))throw new Error(`git repo not found at ${i} (missing .git)`);let s=await F(i,"origin");if(!s)throw new Error("origin remote not set; run `openpond repo create` first");z(s);let c=(typeof e.branch=="string"?e.branch.trim():"")||await Se(i);if(!c)throw new Error("unable to resolve git branch; pass --branch");let d;try{d=D(s,r)}catch{throw new Error("origin remote must be https for tokenized pushes")}let u=v(e.keepTokenRemote)||v(e.token)||v(e.setRemoteToken),l=s.includes("x-access-token:"),m=!u&&!l?s:null,h=process.env.GIT_TERMINAL_PROMPT;process.env.GIT_TERMINAL_PROMPT="0";try{if(!l){let p=await B("git",["remote","set-url","origin",d],{cwd:i});if(p.code!==0)throw new Error(`git remote set-url failed: ${j(p.stderr.trim()||p.stdout.trim()||"unknown error")}`)}if((await B("git",["push","-u","origin",c],{cwd:i,inherit:!0})).code!==0)throw new Error("git push failed")}finally{m&&await B("git",["remote","set-url","origin",m],{cwd:i}).catch(()=>null),h===void 0?delete process.env.GIT_TERMINAL_PROMPT:process.env.GIT_TERMINAL_PROMPT=h}}g(et,"runRepoPush");async function tt(e){if(e.length===0)throw new Error("usage: opentool <init|validate|build> [args]");let o=process.platform==="win32"?"npx.cmd":"npx";if((await B(o,["opentool",...e],{inherit:!0})).code!==0)throw new Error("opentool command failed")}g(tt,"runOpentool");async function nt(){let e="openpond",o=Z(),t=await te(e),r=`npm i -g ${e}@${t}`,n=ee(o,t);if(n===0){console.log(`${e} is up to date (${o})`);return}if(n===-1){console.log(`Update available: ${o} -> ${t}`),console.log(`Run: ${r}`);return}if(n===1){console.log(`Installed version (${o}) is newer than npm latest (${t}).`);return}if(o===t){console.log(`${e} is up to date (${o})`);return}console.log(`Installed: ${o}`),console.log(`Latest: ${t}`),console.log(`Run: ${r}`)}g(nt,"runCheckUpdate");export{Ge as a,je as b,ze as c,He as d,Fe as e,Ve as f,We as g,qe as h,Ye as i,Qe as j,Xe as k,Ze as l,Se as m,et as n,tt as o,nt as p};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{c as AA}from"./chunk-IR3YJWPW.js";import{$a as bx,Aa as _r,Da as U,Ea as Tr,Fa as te,Fb as O,Gb as C0,Ha as $r,Hb as a0,Ib as Ne,Kb as Tx,La as ex,Lb as Oe,Ma as Hr,Mb as Y,Na as Me,Oa as Ir,Pa as Ex,Qa as Gr,Ra as Pr,Sa as ae,Ta as Y8,Ua as _x,Va as p0,Vb as eA,Wa as Ax,Wb as Le,Xb as rx,Yb as Jr,Za as dx,b as yr,bc as E0,cc as Ur,dc as Kr,eb as Qr,ec as Ve,fb as j0,fc as Zr,gc as $x,h as qr,hc as Je,kb as Mr,mb as R0,nb as L0,pb as xA,rb as Nr,ub as Or,yb as Lr,zb as Vr}from"./chunk-DQNSR2Q7.js";import{a as zr}from"./chunk-6FA3GG5B.js";import{a as y,b as T,c as e0,d as Z,e as S,g as qx,h as i0,i as Pe,k as Qe,l as C,m as lx,n as O0}from"./chunk-HZP5U2AA.js";import{b as x}from"./chunk-ES2ISFJC.js";import{a as s,b as Fs,c as ns,e as ss}from"./chunk-FTQLQJQV.js";var $F=ns((ZE,TF)=>{"use strict";var oB=Object.create,Re=Object.defineProperty,vB=Object.getOwnPropertyDescriptor,xr=Object.getOwnPropertyNames,BB=Object.getPrototypeOf,fB=Object.prototype.hasOwnProperty,cB=s((e,A,r)=>A in e?Re(e,A,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[A]=r,"__defNormalProp"),lB=s((e,A)=>function(){return e&&(A=(0,e[xr(e)[0]])(e=0)),A},"__esm"),EB=s((e,A)=>function(){return A||(0,e[xr(e)[0]])((A={exports:{}}).exports,A),A.exports},"__commonJS"),RF=s((e,A)=>{for(var r in A)Re(e,r,{get:A[r],enumerable:!0})},"__export"),wF=s((e,A,r,t)=>{if(A&&typeof A=="object"||typeof A=="function")for(let a of xr(A))!fB.call(e,a)&&a!==r&&Re(e,a,{get:s(()=>A[a],"get"),enumerable:!(t=vB(A,a))||t.enumerable});return e},"__copyProps"),dB=s((e,A,r)=>(r=e!=null?oB(BB(e)):{},wF(A||!e||!e.__esModule?Re(r,"default",{value:e,enumerable:!0}):r,e)),"__toESM"),bB=s(e=>wF(Re({},"__esModule",{value:!0}),e),"__toCommonJS"),mB=s((e,A,r)=>(cB(e,typeof A!="symbol"?A+"":A,r),r),"__publicField"),yF={};RF(yF,{QuickJSFFI:s(()=>qF,"QuickJSFFI")});var qF,uB=lB({"src/ffi.ts"(){"use strict";qF=class{static{s(this,"QuickJSFFI")}constructor(e){this.module=e,this.DEBUG=!1,this.QTS_Throw=this.module.cwrap("QTS_Throw","number",["number","number"]),this.QTS_NewError=this.module.cwrap("QTS_NewError","number",["number"]),this.QTS_RuntimeSetMemoryLimit=this.module.cwrap("QTS_RuntimeSetMemoryLimit",null,["number","number"]),this.QTS_RuntimeComputeMemoryUsage=this.module.cwrap("QTS_RuntimeComputeMemoryUsage","number",["number","number"]),this.QTS_RuntimeDumpMemoryUsage=this.module.cwrap("QTS_RuntimeDumpMemoryUsage","number",["number"]),this.QTS_RecoverableLeakCheck=this.module.cwrap("QTS_RecoverableLeakCheck","number",[]),this.QTS_BuildIsSanitizeLeak=this.module.cwrap("QTS_BuildIsSanitizeLeak","number",[]),this.QTS_RuntimeSetMaxStackSize=this.module.cwrap("QTS_RuntimeSetMaxStackSize",null,["number","number"]),this.QTS_GetUndefined=this.module.cwrap("QTS_GetUndefined","number",[]),this.QTS_GetNull=this.module.cwrap("QTS_GetNull","number",[]),this.QTS_GetFalse=this.module.cwrap("QTS_GetFalse","number",[]),this.QTS_GetTrue=this.module.cwrap("QTS_GetTrue","number",[]),this.QTS_NewHostRef=this.module.cwrap("QTS_NewHostRef","number",["number","number"]),this.QTS_GetHostRefId=this.module.cwrap("QTS_GetHostRefId","number",["number"]),this.QTS_NewRuntime=this.module.cwrap("QTS_NewRuntime","number",[]),this.QTS_FreeRuntime=this.module.cwrap("QTS_FreeRuntime",null,["number"]),this.QTS_NewContext=this.module.cwrap("QTS_NewContext","number",["number","number"]),this.QTS_FreeContext=this.module.cwrap("QTS_FreeContext",null,["number"]),this.QTS_FreeValuePointer=this.module.cwrap("QTS_FreeValuePointer",null,["number","number"]),this.QTS_FreeValuePointerRuntime=this.module.cwrap("QTS_FreeValuePointerRuntime",null,["number","number"]),this.QTS_FreeVoidPointer=this.module.cwrap("QTS_FreeVoidPointer",null,["number","number"]),this.QTS_FreeCString=this.module.cwrap("QTS_FreeCString",null,["number","number"]),this.QTS_DupValuePointer=this.module.cwrap("QTS_DupValuePointer","number",["number","number"]),this.QTS_NewObject=this.module.cwrap("QTS_NewObject","number",["number"]),this.QTS_NewObjectProto=this.module.cwrap("QTS_NewObjectProto","number",["number","number"]),this.QTS_NewArray=this.module.cwrap("QTS_NewArray","number",["number"]),this.QTS_NewArrayBuffer=this.module.cwrap("QTS_NewArrayBuffer","number",["number","number","number"]),this.QTS_NewFloat64=this.module.cwrap("QTS_NewFloat64","number",["number","number"]),this.QTS_GetFloat64=this.module.cwrap("QTS_GetFloat64","number",["number","number"]),this.QTS_NewString=this.module.cwrap("QTS_NewString","number",["number","number"]),this.QTS_GetString=this.module.cwrap("QTS_GetString","number",["number","number"]),this.QTS_GetArrayBuffer=this.module.cwrap("QTS_GetArrayBuffer","number",["number","number"]),this.QTS_GetArrayBufferLength=this.module.cwrap("QTS_GetArrayBufferLength","number",["number","number"]),this.QTS_NewSymbol=this.module.cwrap("QTS_NewSymbol","number",["number","number","number"]),this.QTS_GetSymbolDescriptionOrKey=this.module.cwrap("QTS_GetSymbolDescriptionOrKey","number",["number","number"]),this.QTS_IsGlobalSymbol=this.module.cwrap("QTS_IsGlobalSymbol","number",["number","number"]),this.QTS_IsJobPending=this.module.cwrap("QTS_IsJobPending","number",["number"]),this.QTS_ExecutePendingJob=this.module.cwrap("QTS_ExecutePendingJob","number",["number","number","number"]),this.QTS_GetProp=this.module.cwrap("QTS_GetProp","number",["number","number","number"]),this.QTS_GetPropNumber=this.module.cwrap("QTS_GetPropNumber","number",["number","number","number"]),this.QTS_SetProp=this.module.cwrap("QTS_SetProp",null,["number","number","number","number"]),this.QTS_DefineProp=this.module.cwrap("QTS_DefineProp",null,["number","number","number","number","number","number","boolean","boolean","boolean"]),this.QTS_GetOwnPropertyNames=this.module.cwrap("QTS_GetOwnPropertyNames","number",["number","number","number","number","number"]),this.QTS_Call=this.module.cwrap("QTS_Call","number",["number","number","number","number","number"]),this.QTS_ResolveException=this.module.cwrap("QTS_ResolveException","number",["number","number"]),this.QTS_Dump=this.module.cwrap("QTS_Dump","number",["number","number"]),this.QTS_Eval=this.module.cwrap("QTS_Eval","number",["number","number","number","string","number","number"]),this.QTS_GetModuleNamespace=this.module.cwrap("QTS_GetModuleNamespace","number",["number","number"]),this.QTS_Typeof=this.module.cwrap("QTS_Typeof","number",["number","number"]),this.QTS_GetLength=this.module.cwrap("QTS_GetLength","number",["number","number","number"]),this.QTS_IsEqual=this.module.cwrap("QTS_IsEqual","number",["number","number","number","number"]),this.QTS_GetGlobalObject=this.module.cwrap("QTS_GetGlobalObject","number",["number"]),this.QTS_NewPromiseCapability=this.module.cwrap("QTS_NewPromiseCapability","number",["number","number"]),this.QTS_PromiseState=this.module.cwrap("QTS_PromiseState","number",["number","number"]),this.QTS_PromiseResult=this.module.cwrap("QTS_PromiseResult","number",["number","number"]),this.QTS_TestStringArg=this.module.cwrap("QTS_TestStringArg",null,["string"]),this.QTS_GetDebugLogEnabled=this.module.cwrap("QTS_GetDebugLogEnabled","number",["number"]),this.QTS_SetDebugLogEnabled=this.module.cwrap("QTS_SetDebugLogEnabled",null,["number","number"]),this.QTS_BuildIsDebug=this.module.cwrap("QTS_BuildIsDebug","number",[]),this.QTS_BuildIsAsyncify=this.module.cwrap("QTS_BuildIsAsyncify","number",[]),this.QTS_NewFunction=this.module.cwrap("QTS_NewFunction","number",["number","string","number","boolean","number"]),this.QTS_ArgvGetJSValueConstPointer=this.module.cwrap("QTS_ArgvGetJSValueConstPointer","number",["number","number"]),this.QTS_RuntimeEnableInterruptHandler=this.module.cwrap("QTS_RuntimeEnableInterruptHandler",null,["number"]),this.QTS_RuntimeDisableInterruptHandler=this.module.cwrap("QTS_RuntimeDisableInterruptHandler",null,["number"]),this.QTS_RuntimeEnableModuleLoader=this.module.cwrap("QTS_RuntimeEnableModuleLoader",null,["number","number"]),this.QTS_RuntimeDisableModuleLoader=this.module.cwrap("QTS_RuntimeDisableModuleLoader",null,["number"]),this.QTS_bjson_encode=this.module.cwrap("QTS_bjson_encode","number",["number","number"]),this.QTS_bjson_decode=this.module.cwrap("QTS_bjson_decode","number",["number","number"])}}}}),pB=EB({"dist/emscripten-module.cjs"(e,A){"use strict";var r=(()=>{var t=globalThis.document?.currentScript?.src;return async function(a={}){var n,F=a,o=!!globalThis.window,f=!!globalThis.WorkerGlobalScope,i=globalThis.process?.versions?.node&&globalThis.process?.type!="renderer";function B(E){E={log:E||function(){}};for(let d of B.Pa)d(E);return F.quickJSEmscriptenExtensions=E}s(B,"q"),B.Pa=[],F.quickjsEmscriptenInit=B,B.Pa.push(E=>{E.getWasmMemory=function(){return fx}});var v="./this.program",c=s((E,d)=>{throw d},"u");if(typeof __filename<"u"?t=__filename:f&&(t=self.location.href),i){var b=Fs("fs");1<process.argv.length&&(v=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),c=s((E,d)=>{throw process.exitCode=E,d},"u")}else if(o||f)try{new URL(".",t)}catch{}var u=console.log.bind(console),m=console.error.bind(console),h=!1,w;function q(E){for(var d=0,l=E.length,R=new Uint8Array(l),N;d<l;++d)N=E.charCodeAt(d),R[d]=~N>>8&N;return R}s(q,"ca");var k,x0,_,$,P,G,n0=!1;function S0(){var E=fx.buffer;F.HEAP8=_=new Int8Array(E),new Int16Array(E),F.HEAPU8=$=new Uint8Array(E),new Uint16Array(E),P=new Int32Array(E),G=new Uint32Array(E),new Float32Array(E),new Float64Array(E),new BigInt64Array(E),new BigUint64Array(E)}s(S0,"H");function B0(E){throw F.onAbort?.(E),E="Aborted("+E+")",m(E),h=!0,E=new WebAssembly.RuntimeError(E+". Build with -sASSERTIONS for more info."),x0?.(E),E}s(B0,"I");var J8;async function zn(E){return E}s(zn,"da");async function Xn(E){var d=J8;try{var l=await zn(d);return await WebAssembly.instantiate(l,E)}catch(R){m(`failed to asynchronously prepare wasm: ${R}`),B0(R)}}s(Xn,"ea");async function Wn(E){return Xn(E)}s(Wn,"fa");class U8{static{s(this,"K")}constructor(d){mB(this,"name","ExitStatus"),this.message=`Program terminated with exit(${d})`,this.status=d}}for(var pr=E=>{for(;0<E.length;)E.shift()(F)},jr=[],Cr=[],Yn=()=>{var E=F.preRun.shift();Cr.push(E)},Ie=!0,fx,Dr=new TextDecoder,hr=(E,d,l,R)=>{if(l=d+l,R)return l;for(;E[d]&&!(d>=l);)++d;return d},Y0=(E,d,l)=>E?Dr.decode($.subarray(E,hr($,E,d,l))):"",K8=0,xs=[0,31,60,91,121,152,182,213,244,274,305,335],es=[0,31,59,90,120,151,181,212,243,273,304,334],Ae={},kr=E=>{w=E,Ie||0<K8||(F.onExit?.(E),h=!0),c(E,new U8(E))},As=E=>{if(!h)try{E()}catch(d){d instanceof U8||d=="unwind"||c(1,d)}finally{if(!(Ie||0<K8))try{w=E=w,kr(E)}catch(d){d instanceof U8||d=="unwind"||c(1,d)}}},cx=(E,d,l)=>{var R=$;if(!(0<l))return 0;var N=d;l=d+l-1;for(var X=0;X<E.length;++X){var W=E.codePointAt(X);if(127>=W){if(d>=l)break;R[d++]=W}else if(2047>=W){if(d+1>=l)break;R[d++]=192|W>>6,R[d++]=128|W&63}else if(65535>=W){if(d+2>=l)break;R[d++]=224|W>>12,R[d++]=128|W>>6&63,R[d++]=128|W&63}else{if(d+3>=l)break;R[d++]=240|W>>18,R[d++]=128|W>>12&63,R[d++]=128|W>>6&63,R[d++]=128|W&63,X++}}return R[d]=0,d-N},Z8={},gr=()=>{if(!z8){var E={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:(globalThis.navigator?.language??"C").replace("-","_")+".UTF-8",_:v||"./this.program"},d;for(d in Z8)Z8[d]===void 0?delete E[d]:E[d]=Z8[d];var l=[];for(d in E)l.push(`${d}=${E[d]}`);z8=l}return z8},z8,X8=E=>{for(var d=0,l=0;l<E.length;++l){var R=E.charCodeAt(l);127>=R?d++:2047>=R?d+=2:55296<=R&&57343>=R?(d+=4,++l):d+=3}return d},rs=[null,[],[]],ts=(E,d,l,R)=>{var N={string:s(s0=>{var t0=0;if(s0!=null&&s0!==0){t0=X8(s0)+1;var N0=W8(t0);cx(s0,N0,t0),t0=N0}return t0},"string"),array:s(s0=>{var t0=W8(s0.length);return _.set(s0,t0),t0},"array")};E=F["_"+E];var X=[],W=0;if(R)for(var l0=0;l0<R.length;l0++){var yx=N[l[l0]];yx?(W===0&&(W=wr()),X[l0]=yx(R[l0])):X[l0]=R[l0]}return l=E(...X),l=(function(s0){return W!==0&&Rr(W),d==="string"?Y0(s0):d==="boolean"?!!s0:s0})(l)},re=new Uint8Array(123),xx=25;0<=xx;--xx)re[48+xx]=52+xx,re[65+xx]=xx,re[97+xx]=26+xx;if(re[43]=62,re[47]=63,F.wasmMemory?fx=F.wasmMemory:fx=new WebAssembly.Memory({initial:(F.INITIAL_MEMORY||16777216)/65536,maximum:32768}),S0(),F.noExitRuntime&&(Ie=F.noExitRuntime),F.print&&(u=F.print),F.printErr&&(m=F.printErr),F.thisProgram&&(v=F.thisProgram),F.preInit)for(typeof F.preInit=="function"&&(F.preInit=[F.preInit]);0<F.preInit.length;)F.preInit.shift()();F.cwrap=(E,d,l,R)=>{var N=!l||l.every(X=>X==="number"||X==="boolean");return d!=="string"&&N&&!R?F["_"+E]:(...X)=>ts(E,d,l,X)},F.UTF8ToString=Y0,F.stringToUTF8=(E,d,l)=>cx(E,d,l),F.lengthBytesUTF8=X8;var Sr,Rr,W8,wr,as={b:s((E,d,l,R)=>B0(`Assertion failed: ${Y0(E)}, at: `+[d?Y0(d):"unknown filename",l,R?Y0(R):"unknown function"]),"b"),q:s(()=>B0(""),"q"),l:s(()=>{Ie=!1,K8=0},"l"),m:s(function(E,d){E=-9007199254740992>E||9007199254740992<E?NaN:Number(E),E=new Date(1e3*E),P[d>>2]=E.getSeconds(),P[d+4>>2]=E.getMinutes(),P[d+8>>2]=E.getHours(),P[d+12>>2]=E.getDate(),P[d+16>>2]=E.getMonth(),P[d+20>>2]=E.getFullYear()-1900,P[d+24>>2]=E.getDay();var l=E.getFullYear();P[d+28>>2]=(l%4!==0||l%100===0&&l%400!==0?es:xs)[E.getMonth()]+E.getDate()-1|0,P[d+36>>2]=-(60*E.getTimezoneOffset()),l=new Date(E.getFullYear(),6,1).getTimezoneOffset();var R=new Date(E.getFullYear(),0,1).getTimezoneOffset();P[d+32>>2]=(l!=R&&E.getTimezoneOffset()==Math.min(R,l))|0},"m"),j:s((E,d)=>{if(Ae[E]&&(clearTimeout(Ae[E].id),delete Ae[E]),!d)return 0;var l=setTimeout(()=>{delete Ae[E],As(()=>Sr(E,performance.now()))},d);return Ae[E]={id:l,Qa:d},0},"j"),n:s((E,d,l,R)=>{var N=new Date().getFullYear(),X=new Date(N,0,1).getTimezoneOffset();N=new Date(N,6,1).getTimezoneOffset(),G[E>>2]=60*Math.max(X,N),P[d>>2]=+(X!=N),d=s(W=>{var l0=Math.abs(W);return`UTC${0<=W?"-":"+"}${String(Math.floor(l0/60)).padStart(2,"0")}${String(l0%60).padStart(2,"0")}`},"d"),E=d(X),d=d(N),N<X?(cx(E,l,17),cx(d,R,17)):(cx(E,R,17),cx(d,l,17))},"n"),p:s(()=>Date.now(),"p"),k:s(E=>{var d=$.length;if(E>>>=0,2147483648<E)return!1;for(var l=1;4>=l;l*=2){var R=d*(1+.2/l);R=Math.min(R,E+100663296);x:{R=(Math.min(2147483648,65536*Math.ceil(Math.max(E,R)/65536))-fx.buffer.byteLength+65535)/65536|0;try{fx.grow(R),S0();var N=1;break x}catch{}N=void 0}if(N)return!0}return!1},"k"),e:s((E,d)=>{var l=0,R=0,N;for(N of gr()){var X=d+l;G[E+R>>2]=X,l+=cx(N,X,1/0)+1,R+=4}return 0},"e"),f:s((E,d)=>{var l=gr();G[E>>2]=l.length,E=0;for(var R of l)E+=X8(R)+1;return G[d>>2]=E,0},"f"),d:s(()=>52,"d"),o:s(function(){return 70},"o"),c:s((E,d,l,R)=>{for(var N=0,X=0;X<l;X++){var W=G[d>>2],l0=G[d+4>>2];d+=8;for(var yx=0;yx<l0;yx++){var s0=E,t0=$[W+yx],N0=rs[s0];t0===0||t0===10?(s0=s0===1?u:m,t0=hr(N0,0),t0=Dr.decode(N0.buffer?N0.subarray(0,t0):new Uint8Array(N0.slice(0,t0))),s0(t0),N0.length=0):N0.push(t0)}N+=l0}return G[R>>2]=N,0},"c"),a:fx,r:kr,s:s(function(E,d,l,R,N){return F.callbacks.callFunction(void 0,E,d,l,R,N)},"s"),i:s(function(E){return F.callbacks.shouldInterrupt(void 0,E)},"i"),h:s(function(E,d,l){return l=Y0(l),F.callbacks.loadModuleSource(void 0,E,d,l)},"h"),g:s(function(E,d,l,R){return l=Y0(l),R=Y0(R),F.callbacks.normalizeModule(void 0,E,d,l,R)},"g"),t:s(function(E,d){F.callbacks.freeHostRef(void 0,E,d)},"t")},Ge;return Ge=await(async function(){function E(l){return l=Ge=l.exports,F._malloc=l.v,F._QTS_Throw=l.w,F._QTS_NewError=l.x,F._QTS_RuntimeSetMemoryLimit=l.y,F._QTS_RuntimeComputeMemoryUsage=l.z,F._QTS_RuntimeDumpMemoryUsage=l.A,F._QTS_RecoverableLeakCheck=l.B,F._QTS_BuildIsSanitizeLeak=l.C,F._QTS_RuntimeSetMaxStackSize=l.D,F._QTS_GetUndefined=l.E,F._QTS_GetNull=l.F,F._QTS_GetFalse=l.G,F._QTS_GetTrue=l.H,F._QTS_NewHostRef=l.I,F._QTS_GetHostRefId=l.J,F._QTS_NewRuntime=l.K,F._QTS_FreeRuntime=l.L,F._free=l.M,F._QTS_NewContext=l.N,F._QTS_FreeContext=l.O,F._QTS_FreeValuePointer=l.P,F._QTS_FreeValuePointerRuntime=l.Q,F._QTS_FreeVoidPointer=l.R,F._QTS_FreeCString=l.S,F._QTS_DupValuePointer=l.T,F._QTS_NewObject=l.U,F._QTS_NewObjectProto=l.V,F._QTS_NewArray=l.W,F._QTS_NewArrayBuffer=l.X,F._QTS_NewFloat64=l.Y,F._QTS_GetFloat64=l.Z,F._QTS_NewString=l._,F._QTS_GetString=l.$,F._QTS_GetArrayBuffer=l.aa,F._QTS_GetArrayBufferLength=l.ba,F._QTS_NewSymbol=l.ca,F._QTS_GetSymbolDescriptionOrKey=l.da,F._QTS_IsGlobalSymbol=l.ea,F._QTS_IsJobPending=l.fa,F._QTS_ExecutePendingJob=l.ga,F._QTS_GetProp=l.ha,F._QTS_GetPropNumber=l.ia,F._QTS_SetProp=l.ja,F._QTS_DefineProp=l.ka,F._QTS_GetOwnPropertyNames=l.la,F._QTS_Call=l.ma,F._QTS_ResolveException=l.na,F._QTS_Dump=l.oa,F._QTS_Eval=l.pa,F._QTS_GetModuleNamespace=l.qa,F._QTS_Typeof=l.ra,F._QTS_GetLength=l.sa,F._QTS_IsEqual=l.ta,F._QTS_GetGlobalObject=l.ua,F._QTS_NewPromiseCapability=l.va,F._QTS_PromiseState=l.wa,F._QTS_PromiseResult=l.xa,F._QTS_TestStringArg=l.ya,F._QTS_GetDebugLogEnabled=l.za,F._QTS_SetDebugLogEnabled=l.Aa,F._QTS_BuildIsDebug=l.Ba,F._QTS_BuildIsAsyncify=l.Ca,F._QTS_NewFunction=l.Da,F._QTS_ArgvGetJSValueConstPointer=l.Ea,F._QTS_RuntimeEnableInterruptHandler=l.Fa,F._QTS_RuntimeDisableInterruptHandler=l.Ga,F._QTS_RuntimeEnableModuleLoader=l.Ha,F._QTS_RuntimeDisableModuleLoader=l.Ia,F._QTS_bjson_encode=l.Ja,F._QTS_bjson_decode=l.Ka,Sr=l.La,Rr=l.Ma,W8=l.Na,wr=l.Oa,Ge}s(E,"b");var d={a:as};return F.instantiateWasm?new Promise(l=>{F.instantiateWasm(d,(R,N)=>{l(E(R,N))})}):(J8??(J8=q(`\0asm\0\0\0\xBEi\`\x7F\x7F\0\`\x7F\x7F\x7F\x7F\`\x7F~\x7F\x7F~\`\x7F\x7F\x7F\`\x7F\x7F\`\x7F~\x7F\x7F\x7F~\`\x7F\x7F\x7F\0\`\x7F~~\`\x7F\x7F\x7F\x7F\x7F\`\x7F\0\`\x7F~\0\`\x7F~\x7F\`||\`\x7F\x7F~\`\x7F\x7F~\x7F\`\x7F~\x7F\x7F\x7F\x7F~\`\x7F\x7F\x7F\x7F\x7F\x7F\`\x7F~\x7F~\`\x7F~\x7F\0\`\x7F\x7F\x7F\x7F\0\`\x7F~\x7F\x7F\`\x7F~~~\`\x7F\x7F\x7F~\`\x7F~~\x7F\x7F\x7F~\`\x7F\x7F~\x7F\x7F\`\x7F~~\x7F\`\x7F\x7F\x7F\x7F\x7F\x7F\x7F\`\x7F~~\x7F\x7F~\`\x7F\x7F\x7F\x7F~\`|||\`\0\x7F\`\x7F~\x7F\x7F\x7F\`~\x7F\`\0\0\`\x7F~\`\x07\x7F~\x7F~~~\x7F\x7F\`\x7F~\x7F~\x7F\x7F\`\x7F~~\x7F\x7F\`\x7F\x7F\x7F\x7F\x7F\0\`\x7F\x7F\x7F~\x7F\`\x7F~~~\x7F\x7F\`\x07\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\`~~\`\x7F|\x7F\`\x7F~\x7F~~\`\x7F~\x7F~~\x7F\x7F\`~\x7F\x7F\`\x7F\x7F\x7F\x7F\x7F~\`\x7F~\x7F\x7F\0\`\x7F\x7F|\`\x07\x7F~\x7F\x7F\x7F\x7F\x7F~\`~\x7F\0\`\x7F\x7F~\0\`\x7F~~\x7F~\`\x7F~\x7F~\x7F\`\x7F~\x7F~\0\`\x7F~~~\x7F\` \x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\`\x7F\x7F\x7F\x7F\x7F\x7F~\`~\x7F\x7F\x7F\`\b\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\`\x07\x7F\x7F\x7F\x7F\x7F\x7F\x7F\0\`\x7F~\x7F\x7F\x7F\x7F\`\x7F\x7F~~\`|\x7F\`\x7F~~\x7F\x7F\0\`\x7F~~\x7F\0\`|\x7F|\`||\x7F|\`\x7F\x7F~\x7F\0\`\x7F~~~~\x7F\x7F\`\x7F\x7F~~\x7F\`\x7F~~\x7F\x7F\x7F\`\x7F|\x7F\x7F\x7F\x7F\x7F\`\0|\`\x7F~\x7F~\x7F~\`\r\x7F\x7F\x7F\x7F\x7F\x7F\x7F~\x7F\x7F\x7F\x7F\x7F~\`\x7F\x7F~\x7F\x7F\x7F\`\x7F\x7F~~~~\x7F\`\x7F\x7F~\x7F~\`\x07\x7F~~~\x7F\x7F\x7F~\`\x7F|\`\x7F|\x7F\x7F\x7F~\`\b\x7F~~\x7F\x7F\x7F\x7F\x7F~\`\x7F~\x7F\x7F\x7F\x7F\0\`\b\x7F\x7F\x7F\x7F\x7F\x7F~\x7F~\`\x7F~\x7F\x7F\x7F\x7F\x7F\`
|
|
2
|
+
import{c as AA}from"./chunk-IR3YJWPW.js";import{$a as bx,Aa as _r,Da as U,Ea as Tr,Fa as te,Fb as O,Gb as C0,Ha as $r,Hb as a0,Ib as Ne,Kb as Tx,La as ex,Lb as Oe,Ma as Hr,Mb as Y,Na as Me,Oa as Ir,Pa as Ex,Qa as Gr,Ra as Pr,Sa as ae,Ta as Y8,Ua as _x,Va as p0,Vb as eA,Wa as Ax,Wb as Le,Xb as rx,Yb as Jr,Za as dx,b as yr,bc as E0,cc as Ur,dc as Kr,eb as Qr,ec as Ve,fb as j0,fc as Zr,gc as $x,h as qr,hc as Je,kb as Mr,mb as R0,nb as L0,pb as xA,rb as Nr,ub as Or,yb as Lr,zb as Vr}from"./chunk-WYHHDJEG.js";import{a as zr}from"./chunk-6FA3GG5B.js";import{a as y,b as T,c as e0,d as Z,e as S,g as qx,h as i0,i as Pe,k as Qe,l as C,m as lx,n as O0}from"./chunk-HZP5U2AA.js";import{b as x}from"./chunk-ES2ISFJC.js";import{a as s,b as Fs,c as ns,e as ss}from"./chunk-FTQLQJQV.js";var $F=ns((ZE,TF)=>{"use strict";var oB=Object.create,Re=Object.defineProperty,vB=Object.getOwnPropertyDescriptor,xr=Object.getOwnPropertyNames,BB=Object.getPrototypeOf,fB=Object.prototype.hasOwnProperty,cB=s((e,A,r)=>A in e?Re(e,A,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[A]=r,"__defNormalProp"),lB=s((e,A)=>function(){return e&&(A=(0,e[xr(e)[0]])(e=0)),A},"__esm"),EB=s((e,A)=>function(){return A||(0,e[xr(e)[0]])((A={exports:{}}).exports,A),A.exports},"__commonJS"),RF=s((e,A)=>{for(var r in A)Re(e,r,{get:A[r],enumerable:!0})},"__export"),wF=s((e,A,r,t)=>{if(A&&typeof A=="object"||typeof A=="function")for(let a of xr(A))!fB.call(e,a)&&a!==r&&Re(e,a,{get:s(()=>A[a],"get"),enumerable:!(t=vB(A,a))||t.enumerable});return e},"__copyProps"),dB=s((e,A,r)=>(r=e!=null?oB(BB(e)):{},wF(A||!e||!e.__esModule?Re(r,"default",{value:e,enumerable:!0}):r,e)),"__toESM"),bB=s(e=>wF(Re({},"__esModule",{value:!0}),e),"__toCommonJS"),mB=s((e,A,r)=>(cB(e,typeof A!="symbol"?A+"":A,r),r),"__publicField"),yF={};RF(yF,{QuickJSFFI:s(()=>qF,"QuickJSFFI")});var qF,uB=lB({"src/ffi.ts"(){"use strict";qF=class{static{s(this,"QuickJSFFI")}constructor(e){this.module=e,this.DEBUG=!1,this.QTS_Throw=this.module.cwrap("QTS_Throw","number",["number","number"]),this.QTS_NewError=this.module.cwrap("QTS_NewError","number",["number"]),this.QTS_RuntimeSetMemoryLimit=this.module.cwrap("QTS_RuntimeSetMemoryLimit",null,["number","number"]),this.QTS_RuntimeComputeMemoryUsage=this.module.cwrap("QTS_RuntimeComputeMemoryUsage","number",["number","number"]),this.QTS_RuntimeDumpMemoryUsage=this.module.cwrap("QTS_RuntimeDumpMemoryUsage","number",["number"]),this.QTS_RecoverableLeakCheck=this.module.cwrap("QTS_RecoverableLeakCheck","number",[]),this.QTS_BuildIsSanitizeLeak=this.module.cwrap("QTS_BuildIsSanitizeLeak","number",[]),this.QTS_RuntimeSetMaxStackSize=this.module.cwrap("QTS_RuntimeSetMaxStackSize",null,["number","number"]),this.QTS_GetUndefined=this.module.cwrap("QTS_GetUndefined","number",[]),this.QTS_GetNull=this.module.cwrap("QTS_GetNull","number",[]),this.QTS_GetFalse=this.module.cwrap("QTS_GetFalse","number",[]),this.QTS_GetTrue=this.module.cwrap("QTS_GetTrue","number",[]),this.QTS_NewHostRef=this.module.cwrap("QTS_NewHostRef","number",["number","number"]),this.QTS_GetHostRefId=this.module.cwrap("QTS_GetHostRefId","number",["number"]),this.QTS_NewRuntime=this.module.cwrap("QTS_NewRuntime","number",[]),this.QTS_FreeRuntime=this.module.cwrap("QTS_FreeRuntime",null,["number"]),this.QTS_NewContext=this.module.cwrap("QTS_NewContext","number",["number","number"]),this.QTS_FreeContext=this.module.cwrap("QTS_FreeContext",null,["number"]),this.QTS_FreeValuePointer=this.module.cwrap("QTS_FreeValuePointer",null,["number","number"]),this.QTS_FreeValuePointerRuntime=this.module.cwrap("QTS_FreeValuePointerRuntime",null,["number","number"]),this.QTS_FreeVoidPointer=this.module.cwrap("QTS_FreeVoidPointer",null,["number","number"]),this.QTS_FreeCString=this.module.cwrap("QTS_FreeCString",null,["number","number"]),this.QTS_DupValuePointer=this.module.cwrap("QTS_DupValuePointer","number",["number","number"]),this.QTS_NewObject=this.module.cwrap("QTS_NewObject","number",["number"]),this.QTS_NewObjectProto=this.module.cwrap("QTS_NewObjectProto","number",["number","number"]),this.QTS_NewArray=this.module.cwrap("QTS_NewArray","number",["number"]),this.QTS_NewArrayBuffer=this.module.cwrap("QTS_NewArrayBuffer","number",["number","number","number"]),this.QTS_NewFloat64=this.module.cwrap("QTS_NewFloat64","number",["number","number"]),this.QTS_GetFloat64=this.module.cwrap("QTS_GetFloat64","number",["number","number"]),this.QTS_NewString=this.module.cwrap("QTS_NewString","number",["number","number"]),this.QTS_GetString=this.module.cwrap("QTS_GetString","number",["number","number"]),this.QTS_GetArrayBuffer=this.module.cwrap("QTS_GetArrayBuffer","number",["number","number"]),this.QTS_GetArrayBufferLength=this.module.cwrap("QTS_GetArrayBufferLength","number",["number","number"]),this.QTS_NewSymbol=this.module.cwrap("QTS_NewSymbol","number",["number","number","number"]),this.QTS_GetSymbolDescriptionOrKey=this.module.cwrap("QTS_GetSymbolDescriptionOrKey","number",["number","number"]),this.QTS_IsGlobalSymbol=this.module.cwrap("QTS_IsGlobalSymbol","number",["number","number"]),this.QTS_IsJobPending=this.module.cwrap("QTS_IsJobPending","number",["number"]),this.QTS_ExecutePendingJob=this.module.cwrap("QTS_ExecutePendingJob","number",["number","number","number"]),this.QTS_GetProp=this.module.cwrap("QTS_GetProp","number",["number","number","number"]),this.QTS_GetPropNumber=this.module.cwrap("QTS_GetPropNumber","number",["number","number","number"]),this.QTS_SetProp=this.module.cwrap("QTS_SetProp",null,["number","number","number","number"]),this.QTS_DefineProp=this.module.cwrap("QTS_DefineProp",null,["number","number","number","number","number","number","boolean","boolean","boolean"]),this.QTS_GetOwnPropertyNames=this.module.cwrap("QTS_GetOwnPropertyNames","number",["number","number","number","number","number"]),this.QTS_Call=this.module.cwrap("QTS_Call","number",["number","number","number","number","number"]),this.QTS_ResolveException=this.module.cwrap("QTS_ResolveException","number",["number","number"]),this.QTS_Dump=this.module.cwrap("QTS_Dump","number",["number","number"]),this.QTS_Eval=this.module.cwrap("QTS_Eval","number",["number","number","number","string","number","number"]),this.QTS_GetModuleNamespace=this.module.cwrap("QTS_GetModuleNamespace","number",["number","number"]),this.QTS_Typeof=this.module.cwrap("QTS_Typeof","number",["number","number"]),this.QTS_GetLength=this.module.cwrap("QTS_GetLength","number",["number","number","number"]),this.QTS_IsEqual=this.module.cwrap("QTS_IsEqual","number",["number","number","number","number"]),this.QTS_GetGlobalObject=this.module.cwrap("QTS_GetGlobalObject","number",["number"]),this.QTS_NewPromiseCapability=this.module.cwrap("QTS_NewPromiseCapability","number",["number","number"]),this.QTS_PromiseState=this.module.cwrap("QTS_PromiseState","number",["number","number"]),this.QTS_PromiseResult=this.module.cwrap("QTS_PromiseResult","number",["number","number"]),this.QTS_TestStringArg=this.module.cwrap("QTS_TestStringArg",null,["string"]),this.QTS_GetDebugLogEnabled=this.module.cwrap("QTS_GetDebugLogEnabled","number",["number"]),this.QTS_SetDebugLogEnabled=this.module.cwrap("QTS_SetDebugLogEnabled",null,["number","number"]),this.QTS_BuildIsDebug=this.module.cwrap("QTS_BuildIsDebug","number",[]),this.QTS_BuildIsAsyncify=this.module.cwrap("QTS_BuildIsAsyncify","number",[]),this.QTS_NewFunction=this.module.cwrap("QTS_NewFunction","number",["number","string","number","boolean","number"]),this.QTS_ArgvGetJSValueConstPointer=this.module.cwrap("QTS_ArgvGetJSValueConstPointer","number",["number","number"]),this.QTS_RuntimeEnableInterruptHandler=this.module.cwrap("QTS_RuntimeEnableInterruptHandler",null,["number"]),this.QTS_RuntimeDisableInterruptHandler=this.module.cwrap("QTS_RuntimeDisableInterruptHandler",null,["number"]),this.QTS_RuntimeEnableModuleLoader=this.module.cwrap("QTS_RuntimeEnableModuleLoader",null,["number","number"]),this.QTS_RuntimeDisableModuleLoader=this.module.cwrap("QTS_RuntimeDisableModuleLoader",null,["number"]),this.QTS_bjson_encode=this.module.cwrap("QTS_bjson_encode","number",["number","number"]),this.QTS_bjson_decode=this.module.cwrap("QTS_bjson_decode","number",["number","number"])}}}}),pB=EB({"dist/emscripten-module.cjs"(e,A){"use strict";var r=(()=>{var t=globalThis.document?.currentScript?.src;return async function(a={}){var n,F=a,o=!!globalThis.window,f=!!globalThis.WorkerGlobalScope,i=globalThis.process?.versions?.node&&globalThis.process?.type!="renderer";function B(E){E={log:E||function(){}};for(let d of B.Pa)d(E);return F.quickJSEmscriptenExtensions=E}s(B,"q"),B.Pa=[],F.quickjsEmscriptenInit=B,B.Pa.push(E=>{E.getWasmMemory=function(){return fx}});var v="./this.program",c=s((E,d)=>{throw d},"u");if(typeof __filename<"u"?t=__filename:f&&(t=self.location.href),i){var b=Fs("fs");1<process.argv.length&&(v=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),c=s((E,d)=>{throw process.exitCode=E,d},"u")}else if(o||f)try{new URL(".",t)}catch{}var u=console.log.bind(console),m=console.error.bind(console),h=!1,w;function q(E){for(var d=0,l=E.length,R=new Uint8Array(l),N;d<l;++d)N=E.charCodeAt(d),R[d]=~N>>8&N;return R}s(q,"ca");var k,x0,_,$,P,G,n0=!1;function S0(){var E=fx.buffer;F.HEAP8=_=new Int8Array(E),new Int16Array(E),F.HEAPU8=$=new Uint8Array(E),new Uint16Array(E),P=new Int32Array(E),G=new Uint32Array(E),new Float32Array(E),new Float64Array(E),new BigInt64Array(E),new BigUint64Array(E)}s(S0,"H");function B0(E){throw F.onAbort?.(E),E="Aborted("+E+")",m(E),h=!0,E=new WebAssembly.RuntimeError(E+". Build with -sASSERTIONS for more info."),x0?.(E),E}s(B0,"I");var J8;async function zn(E){return E}s(zn,"da");async function Xn(E){var d=J8;try{var l=await zn(d);return await WebAssembly.instantiate(l,E)}catch(R){m(`failed to asynchronously prepare wasm: ${R}`),B0(R)}}s(Xn,"ea");async function Wn(E){return Xn(E)}s(Wn,"fa");class U8{static{s(this,"K")}constructor(d){mB(this,"name","ExitStatus"),this.message=`Program terminated with exit(${d})`,this.status=d}}for(var pr=E=>{for(;0<E.length;)E.shift()(F)},jr=[],Cr=[],Yn=()=>{var E=F.preRun.shift();Cr.push(E)},Ie=!0,fx,Dr=new TextDecoder,hr=(E,d,l,R)=>{if(l=d+l,R)return l;for(;E[d]&&!(d>=l);)++d;return d},Y0=(E,d,l)=>E?Dr.decode($.subarray(E,hr($,E,d,l))):"",K8=0,xs=[0,31,60,91,121,152,182,213,244,274,305,335],es=[0,31,59,90,120,151,181,212,243,273,304,334],Ae={},kr=E=>{w=E,Ie||0<K8||(F.onExit?.(E),h=!0),c(E,new U8(E))},As=E=>{if(!h)try{E()}catch(d){d instanceof U8||d=="unwind"||c(1,d)}finally{if(!(Ie||0<K8))try{w=E=w,kr(E)}catch(d){d instanceof U8||d=="unwind"||c(1,d)}}},cx=(E,d,l)=>{var R=$;if(!(0<l))return 0;var N=d;l=d+l-1;for(var X=0;X<E.length;++X){var W=E.codePointAt(X);if(127>=W){if(d>=l)break;R[d++]=W}else if(2047>=W){if(d+1>=l)break;R[d++]=192|W>>6,R[d++]=128|W&63}else if(65535>=W){if(d+2>=l)break;R[d++]=224|W>>12,R[d++]=128|W>>6&63,R[d++]=128|W&63}else{if(d+3>=l)break;R[d++]=240|W>>18,R[d++]=128|W>>12&63,R[d++]=128|W>>6&63,R[d++]=128|W&63,X++}}return R[d]=0,d-N},Z8={},gr=()=>{if(!z8){var E={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:(globalThis.navigator?.language??"C").replace("-","_")+".UTF-8",_:v||"./this.program"},d;for(d in Z8)Z8[d]===void 0?delete E[d]:E[d]=Z8[d];var l=[];for(d in E)l.push(`${d}=${E[d]}`);z8=l}return z8},z8,X8=E=>{for(var d=0,l=0;l<E.length;++l){var R=E.charCodeAt(l);127>=R?d++:2047>=R?d+=2:55296<=R&&57343>=R?(d+=4,++l):d+=3}return d},rs=[null,[],[]],ts=(E,d,l,R)=>{var N={string:s(s0=>{var t0=0;if(s0!=null&&s0!==0){t0=X8(s0)+1;var N0=W8(t0);cx(s0,N0,t0),t0=N0}return t0},"string"),array:s(s0=>{var t0=W8(s0.length);return _.set(s0,t0),t0},"array")};E=F["_"+E];var X=[],W=0;if(R)for(var l0=0;l0<R.length;l0++){var yx=N[l[l0]];yx?(W===0&&(W=wr()),X[l0]=yx(R[l0])):X[l0]=R[l0]}return l=E(...X),l=(function(s0){return W!==0&&Rr(W),d==="string"?Y0(s0):d==="boolean"?!!s0:s0})(l)},re=new Uint8Array(123),xx=25;0<=xx;--xx)re[48+xx]=52+xx,re[65+xx]=xx,re[97+xx]=26+xx;if(re[43]=62,re[47]=63,F.wasmMemory?fx=F.wasmMemory:fx=new WebAssembly.Memory({initial:(F.INITIAL_MEMORY||16777216)/65536,maximum:32768}),S0(),F.noExitRuntime&&(Ie=F.noExitRuntime),F.print&&(u=F.print),F.printErr&&(m=F.printErr),F.thisProgram&&(v=F.thisProgram),F.preInit)for(typeof F.preInit=="function"&&(F.preInit=[F.preInit]);0<F.preInit.length;)F.preInit.shift()();F.cwrap=(E,d,l,R)=>{var N=!l||l.every(X=>X==="number"||X==="boolean");return d!=="string"&&N&&!R?F["_"+E]:(...X)=>ts(E,d,l,X)},F.UTF8ToString=Y0,F.stringToUTF8=(E,d,l)=>cx(E,d,l),F.lengthBytesUTF8=X8;var Sr,Rr,W8,wr,as={b:s((E,d,l,R)=>B0(`Assertion failed: ${Y0(E)}, at: `+[d?Y0(d):"unknown filename",l,R?Y0(R):"unknown function"]),"b"),q:s(()=>B0(""),"q"),l:s(()=>{Ie=!1,K8=0},"l"),m:s(function(E,d){E=-9007199254740992>E||9007199254740992<E?NaN:Number(E),E=new Date(1e3*E),P[d>>2]=E.getSeconds(),P[d+4>>2]=E.getMinutes(),P[d+8>>2]=E.getHours(),P[d+12>>2]=E.getDate(),P[d+16>>2]=E.getMonth(),P[d+20>>2]=E.getFullYear()-1900,P[d+24>>2]=E.getDay();var l=E.getFullYear();P[d+28>>2]=(l%4!==0||l%100===0&&l%400!==0?es:xs)[E.getMonth()]+E.getDate()-1|0,P[d+36>>2]=-(60*E.getTimezoneOffset()),l=new Date(E.getFullYear(),6,1).getTimezoneOffset();var R=new Date(E.getFullYear(),0,1).getTimezoneOffset();P[d+32>>2]=(l!=R&&E.getTimezoneOffset()==Math.min(R,l))|0},"m"),j:s((E,d)=>{if(Ae[E]&&(clearTimeout(Ae[E].id),delete Ae[E]),!d)return 0;var l=setTimeout(()=>{delete Ae[E],As(()=>Sr(E,performance.now()))},d);return Ae[E]={id:l,Qa:d},0},"j"),n:s((E,d,l,R)=>{var N=new Date().getFullYear(),X=new Date(N,0,1).getTimezoneOffset();N=new Date(N,6,1).getTimezoneOffset(),G[E>>2]=60*Math.max(X,N),P[d>>2]=+(X!=N),d=s(W=>{var l0=Math.abs(W);return`UTC${0<=W?"-":"+"}${String(Math.floor(l0/60)).padStart(2,"0")}${String(l0%60).padStart(2,"0")}`},"d"),E=d(X),d=d(N),N<X?(cx(E,l,17),cx(d,R,17)):(cx(E,R,17),cx(d,l,17))},"n"),p:s(()=>Date.now(),"p"),k:s(E=>{var d=$.length;if(E>>>=0,2147483648<E)return!1;for(var l=1;4>=l;l*=2){var R=d*(1+.2/l);R=Math.min(R,E+100663296);x:{R=(Math.min(2147483648,65536*Math.ceil(Math.max(E,R)/65536))-fx.buffer.byteLength+65535)/65536|0;try{fx.grow(R),S0();var N=1;break x}catch{}N=void 0}if(N)return!0}return!1},"k"),e:s((E,d)=>{var l=0,R=0,N;for(N of gr()){var X=d+l;G[E+R>>2]=X,l+=cx(N,X,1/0)+1,R+=4}return 0},"e"),f:s((E,d)=>{var l=gr();G[E>>2]=l.length,E=0;for(var R of l)E+=X8(R)+1;return G[d>>2]=E,0},"f"),d:s(()=>52,"d"),o:s(function(){return 70},"o"),c:s((E,d,l,R)=>{for(var N=0,X=0;X<l;X++){var W=G[d>>2],l0=G[d+4>>2];d+=8;for(var yx=0;yx<l0;yx++){var s0=E,t0=$[W+yx],N0=rs[s0];t0===0||t0===10?(s0=s0===1?u:m,t0=hr(N0,0),t0=Dr.decode(N0.buffer?N0.subarray(0,t0):new Uint8Array(N0.slice(0,t0))),s0(t0),N0.length=0):N0.push(t0)}N+=l0}return G[R>>2]=N,0},"c"),a:fx,r:kr,s:s(function(E,d,l,R,N){return F.callbacks.callFunction(void 0,E,d,l,R,N)},"s"),i:s(function(E){return F.callbacks.shouldInterrupt(void 0,E)},"i"),h:s(function(E,d,l){return l=Y0(l),F.callbacks.loadModuleSource(void 0,E,d,l)},"h"),g:s(function(E,d,l,R){return l=Y0(l),R=Y0(R),F.callbacks.normalizeModule(void 0,E,d,l,R)},"g"),t:s(function(E,d){F.callbacks.freeHostRef(void 0,E,d)},"t")},Ge;return Ge=await(async function(){function E(l){return l=Ge=l.exports,F._malloc=l.v,F._QTS_Throw=l.w,F._QTS_NewError=l.x,F._QTS_RuntimeSetMemoryLimit=l.y,F._QTS_RuntimeComputeMemoryUsage=l.z,F._QTS_RuntimeDumpMemoryUsage=l.A,F._QTS_RecoverableLeakCheck=l.B,F._QTS_BuildIsSanitizeLeak=l.C,F._QTS_RuntimeSetMaxStackSize=l.D,F._QTS_GetUndefined=l.E,F._QTS_GetNull=l.F,F._QTS_GetFalse=l.G,F._QTS_GetTrue=l.H,F._QTS_NewHostRef=l.I,F._QTS_GetHostRefId=l.J,F._QTS_NewRuntime=l.K,F._QTS_FreeRuntime=l.L,F._free=l.M,F._QTS_NewContext=l.N,F._QTS_FreeContext=l.O,F._QTS_FreeValuePointer=l.P,F._QTS_FreeValuePointerRuntime=l.Q,F._QTS_FreeVoidPointer=l.R,F._QTS_FreeCString=l.S,F._QTS_DupValuePointer=l.T,F._QTS_NewObject=l.U,F._QTS_NewObjectProto=l.V,F._QTS_NewArray=l.W,F._QTS_NewArrayBuffer=l.X,F._QTS_NewFloat64=l.Y,F._QTS_GetFloat64=l.Z,F._QTS_NewString=l._,F._QTS_GetString=l.$,F._QTS_GetArrayBuffer=l.aa,F._QTS_GetArrayBufferLength=l.ba,F._QTS_NewSymbol=l.ca,F._QTS_GetSymbolDescriptionOrKey=l.da,F._QTS_IsGlobalSymbol=l.ea,F._QTS_IsJobPending=l.fa,F._QTS_ExecutePendingJob=l.ga,F._QTS_GetProp=l.ha,F._QTS_GetPropNumber=l.ia,F._QTS_SetProp=l.ja,F._QTS_DefineProp=l.ka,F._QTS_GetOwnPropertyNames=l.la,F._QTS_Call=l.ma,F._QTS_ResolveException=l.na,F._QTS_Dump=l.oa,F._QTS_Eval=l.pa,F._QTS_GetModuleNamespace=l.qa,F._QTS_Typeof=l.ra,F._QTS_GetLength=l.sa,F._QTS_IsEqual=l.ta,F._QTS_GetGlobalObject=l.ua,F._QTS_NewPromiseCapability=l.va,F._QTS_PromiseState=l.wa,F._QTS_PromiseResult=l.xa,F._QTS_TestStringArg=l.ya,F._QTS_GetDebugLogEnabled=l.za,F._QTS_SetDebugLogEnabled=l.Aa,F._QTS_BuildIsDebug=l.Ba,F._QTS_BuildIsAsyncify=l.Ca,F._QTS_NewFunction=l.Da,F._QTS_ArgvGetJSValueConstPointer=l.Ea,F._QTS_RuntimeEnableInterruptHandler=l.Fa,F._QTS_RuntimeDisableInterruptHandler=l.Ga,F._QTS_RuntimeEnableModuleLoader=l.Ha,F._QTS_RuntimeDisableModuleLoader=l.Ia,F._QTS_bjson_encode=l.Ja,F._QTS_bjson_decode=l.Ka,Sr=l.La,Rr=l.Ma,W8=l.Na,wr=l.Oa,Ge}s(E,"b");var d={a:as};return F.instantiateWasm?new Promise(l=>{F.instantiateWasm(d,(R,N)=>{l(E(R,N))})}):(J8??(J8=q(`\0asm\0\0\0\xBEi\`\x7F\x7F\0\`\x7F\x7F\x7F\x7F\`\x7F~\x7F\x7F~\`\x7F\x7F\x7F\`\x7F\x7F\`\x7F~\x7F\x7F\x7F~\`\x7F\x7F\x7F\0\`\x7F~~\`\x7F\x7F\x7F\x7F\x7F\`\x7F\0\`\x7F~\0\`\x7F~\x7F\`||\`\x7F\x7F~\`\x7F\x7F~\x7F\`\x7F~\x7F\x7F\x7F\x7F~\`\x7F\x7F\x7F\x7F\x7F\x7F\`\x7F~\x7F~\`\x7F~\x7F\0\`\x7F\x7F\x7F\x7F\0\`\x7F~\x7F\x7F\`\x7F~~~\`\x7F\x7F\x7F~\`\x7F~~\x7F\x7F\x7F~\`\x7F\x7F~\x7F\x7F\`\x7F~~\x7F\`\x7F\x7F\x7F\x7F\x7F\x7F\x7F\`\x7F~~\x7F\x7F~\`\x7F\x7F\x7F\x7F~\`|||\`\0\x7F\`\x7F~\x7F\x7F\x7F\`~\x7F\`\0\0\`\x7F~\`\x07\x7F~\x7F~~~\x7F\x7F\`\x7F~\x7F~\x7F\x7F\`\x7F~~\x7F\x7F\`\x7F\x7F\x7F\x7F\x7F\0\`\x7F\x7F\x7F~\x7F\`\x7F~~~\x7F\x7F\`\x07\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\`~~\`\x7F|\x7F\`\x7F~\x7F~~\`\x7F~\x7F~~\x7F\x7F\`~\x7F\x7F\`\x7F\x7F\x7F\x7F\x7F~\`\x7F~\x7F\x7F\0\`\x7F\x7F|\`\x07\x7F~\x7F\x7F\x7F\x7F\x7F~\`~\x7F\0\`\x7F\x7F~\0\`\x7F~~\x7F~\`\x7F~\x7F~\x7F\`\x7F~\x7F~\0\`\x7F~~~\x7F\` \x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\`\x7F\x7F\x7F\x7F\x7F\x7F~\`~\x7F\x7F\x7F\`\b\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\`\x07\x7F\x7F\x7F\x7F\x7F\x7F\x7F\0\`\x7F~\x7F\x7F\x7F\x7F\`\x7F\x7F~~\`|\x7F\`\x7F~~\x7F\x7F\0\`\x7F~~\x7F\0\`|\x7F|\`||\x7F|\`\x7F\x7F~\x7F\0\`\x7F~~~~\x7F\x7F\`\x7F\x7F~~\x7F\`\x7F~~\x7F\x7F\x7F\`\x7F|\x7F\x7F\x7F\x7F\x7F\`\0|\`\x7F~\x7F~\x7F~\`\r\x7F\x7F\x7F\x7F\x7F\x7F\x7F~\x7F\x7F\x7F\x7F\x7F~\`\x7F\x7F~\x7F\x7F\x7F\`\x7F\x7F~~~~\x7F\`\x7F\x7F~\x7F~\`\x07\x7F~~~\x7F\x7F\x7F~\`\x7F|\`\x7F|\x7F\x7F\x7F~\`\b\x7F~~\x7F\x7F\x7F\x7F\x7F~\`\x7F~\x7F\x7F\x7F\x7F\0\`\b\x7F\x7F\x7F\x7F\x7F\x7F~\x7F~\`\x7F~\x7F\x7F\x7F\x7F\x7F\`
|
|
3
3
|
\x7F\x7F~\x7F\x7F~~~\x7F\x7F\x7F\`\x7F\x7F~~~~\`||\x7F\`\x7F\x7F\x7F\x7F\x7F|\`\x7F\x7F~~\x7F\x7F\`\x7F~~\0\`\x07\x7F~\x7F\x7F\x7F\x7F\x7F\0\`\x7F~~~~\`|\x7F\x7F\`\x7F\x7F~~~\`\b\x7F~~~~\x7F~~~\`~~\x7F\x7F\`\x07\x7F\x7F\x7F~~~\x7F\x7F\`\x7F\x7F|\0\`\x7F~|~\`\0~\`\x7F|\0\` \x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\0~ab\0ac\0\bad\0ae\0af\0ag\0\bah\0ai\0aj\0+ak\0al\0!am\x003an\0ao\0ap\0Jaq\0!ar\0 as\0at\0\0aa\x80\x80\x80\xAB
|
|
4
4
|
\xA9
|
|
5
5
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{e as g,g as $,h as O,i as C}from"./chunk-
|
|
2
|
+
import{e as g,g as $,h as O,i as C}from"./chunk-JS6MS2NR.js";import{a as w}from"./chunk-3M53YXEI.js";import{a as r}from"./chunk-FTQLQJQV.js";var L=Symbol("openpondCliOptionValues"),a=class extends Error{static{r(this,"CliUsageError")}exitCode=2;constructor(t){super(t),this.name="CliUsageError"}},K=new Set(["maxOutputBytes","timeoutSec"]);function k(n){let t=[...n],o="",i={},e={},u=[];for(;t.length>0;){let s=t.shift();if(s==="--"){u.push(...t);break}if(s.startsWith("--")){let f=s.indexOf("="),c=f>=0?s.slice(2,f):s.slice(2),p=N(c),d=f>=0?s.slice(f+1):P(t,p,o);h(i,e,p,d,o)}else _(s)?y(s,t,i,e):o?u.push(s):o=s}return Object.defineProperty(i,L,{value:e,enumerable:!1,configurable:!1,writable:!1}),V(o,i),{command:o,options:i,rest:u}}r(k,"parseArgs");function N(n){return n.replace(/-([a-z])/g,(t,o)=>o.toUpperCase())}r(N,"normalizeCliOptionKey");function _(n){return/^-[^-].*/.test(n)&&!S(n)}r(_,"isShortOptionToken");function y(n,t,o,i){let e=n.slice(1);if(!e)return;let u=e.indexOf("="),s=u>=0?e.slice(0,u):e,f=u>=0?e.slice(u+1):null;if(s.length!==1){for(let d of s){let m=g[d];if(!m)throw new a(`unknown short option -${d}`);if(C(m)!=="boolean")throw new a(`short option -${d} requires its own value`);h(o,i,m,"true")}return}let c=g[s];if(!c)throw new a(`unknown short option -${s}`);let p=f??P(t,c);h(o,i,c,p)}r(y,"parseShortOptionToken");function P(n,t,o){let i=I(t,o);if(i==="boolean")return n[0]&&x(n[0])?n.shift():"true";if(i){let e=n.shift();if(e===void 0||R(e)&&!S(e))throw e!==void 0&&n.unshift(e),new a(`${l(t)} must be ${b(i)}`);return e}return n[0]&&!n[0].startsWith("--")?n.shift():"true"}r(P,"readOptionValue");function h(n,t,o,i,e){T(o,i,e),n[o]=i,(t[o]??=[]).push(i)}r(h,"setParsedOption");function T(n,t,o){let i=I(n,o);if(i){if(i==="boolean"){if(!x(t))throw new a(`${l(n)} must be a boolean`);return}if(t.trim().length===0||t==="true")throw new a(`${l(n)} must be ${b(i)}`);if(i==="number"||i==="integer"){let e=Number(t);if(!Number.isFinite(e))throw new a(`${l(n)} must be ${b(i)}`);if(i==="integer"&&!Number.isInteger(e))throw new a(`${l(n)} must be an integer`);if(i==="integer"&&K.has(n)&&e<=0)throw new a(`${l(n)} must be a positive integer`);return}if(i==="json")try{w(t,l(n))}catch(e){throw new a(e instanceof Error?e.message:String(e))}}}r(T,"validateParsedOptionValue");function I(n,t){return t?O(t,n):C(n)}r(I,"typedOptionKind");function l(n){return n.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}r(l,"cliOptionLabel");function E(n){return n==="json"?"JSON value":n}r(E,"optionKindLabel");function b(n){let t=E(n);return/^[aeiou]/i.test(t)?`an ${t}`:`a ${t}`}r(b,"optionKindPhrase");function x(n){return/^(true|false|1|0|yes|no)$/i.test(n)}r(x,"isBooleanLiteral");function R(n){return n.startsWith("-")&&n!=="-"}r(R,"isOptionLike");function S(n){return/^-\d+(?:\.\d+)?$/.test(n)}r(S,"isNegativeNumber");function V(n,t){let o=n?$(n):null;for(let i of Object.keys(t))if(!O(n,i)){let e=l(i),u=o?` for ${o.name}`:"";throw new a(`unknown option --${e}${u}`)}}r(V,"validateCommandOptions");export{a,k as b};
|
|
@@ -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-J3WNPOLS.js";import{a as T,b as y,c as w,h as Y,i as B,j as K}from"./chunk-J2S7BOZU.js";import{Da as $,Gb as M,Pa as Q,nb as F}from"./chunk-WYHHDJEG.js";import{a as l}from"./chunk-HZP5U2AA.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};
|