openpond 0.2.7 → 0.2.8
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.d.ts +28 -1
- package/dist/app-server.js +1 -1
- package/dist/chunks/{actions-command-FJM6WNUI.js → actions-command-V5DZWEON.js} +1 -1
- package/dist/chunks/{app-layer-XNA7UVWS.js → app-layer-SFV6ZPKZ.js} +1 -1
- package/dist/chunks/app-server-runtime-OYF6XBVI.js +2 -0
- package/dist/chunks/{apps-SC5SKRJC.js → apps-SR7CAM42.js} +1 -1
- package/dist/chunks/{chunk-FOZVXTZM.js → chunk-4LLHOG7L.js} +1 -1
- package/dist/chunks/{chunk-MVPNEF5P.js → chunk-5N6YRABR.js} +2 -2
- package/dist/chunks/{chunk-3NDRIQTI.js → chunk-73KFNV3D.js} +1 -1
- package/dist/chunks/chunk-B6IIGPWS.js +6 -0
- package/dist/chunks/chunk-BB6DJKXX.js +19 -0
- package/dist/chunks/chunk-DY5RF2YE.js +26 -0
- package/dist/chunks/{chunk-3WTRTL56.js → chunk-EEBLJPIB.js} +1 -1
- package/dist/chunks/{chunk-36OUIHLX.js → chunk-G2VYRU27.js} +1 -1
- package/dist/chunks/chunk-KRNLKKN6.js +5 -0
- package/dist/chunks/{chunk-7P6ZK5IG.js → chunk-LLJI6QAY.js} +1 -1
- package/dist/chunks/{chunk-FYCJSUFV.js → chunk-NNLI4OWY.js} +1 -1
- package/dist/chunks/{chunk-HTTZFZEP.js → chunk-O4IARD7H.js} +1 -1
- package/dist/chunks/{chunk-URZJ4Y2A.js → chunk-QOR55VHT.js} +1 -1
- package/dist/chunks/{chunk-WRMXQAYN.js → chunk-QWE3RHNY.js} +1 -1
- package/dist/chunks/{chunk-NC6ITVZS.js → chunk-S64WASAO.js} +1 -1
- package/dist/chunks/{chunk-HCJADRKO.js → chunk-SS3EG6S2.js} +1 -1
- package/dist/chunks/{chunk-EDD5KGLG.js → chunk-T2GNPVRY.js} +7 -3
- package/dist/chunks/{chunk-3VQIZYAN.js → chunk-UW4XDFLU.js} +439 -343
- package/dist/chunks/chunk-UW6ES5DM.js +28 -0
- package/dist/chunks/{chunk-W56MAK5K.js → chunk-V4ACXLID.js} +1 -1
- package/dist/chunks/{chunk-WUHDI23M.js → chunk-VJBEK64H.js} +1 -1
- package/dist/chunks/{chunk-2S2UONFI.js → chunk-Y7ZYJQGZ.js} +1 -1
- package/dist/chunks/{cli-LBXU6SRW.js → cli-MS4KADND.js} +1 -1
- package/dist/chunks/{configuration-command-3ZVMKIZK.js → configuration-command-EBN7RH3X.js} +1 -1
- package/dist/chunks/{core-commands-IXY7BKVS.js → core-commands-2S4UQPXW.js} +1 -1
- package/dist/chunks/{desktop-test-V5YO4LCV.js → desktop-test-WN7ZLQVQ.js} +1 -1
- package/dist/chunks/{dist-NKLXFA37.js → dist-UA2RQUA4.js} +1 -1
- package/dist/chunks/extension-ERM5EUUO.js +6 -0
- package/dist/chunks/{help-UIHQZ4CU.js → help-N25BKIHM.js} +1 -1
- package/dist/chunks/{opchat-G7QSVFAI.js → opchat-V4A4WCND.js} +1 -1
- package/dist/chunks/{organizations-Z4SFKZZ7.js → organizations-TSOT7MDT.js} +1 -1
- package/dist/chunks/{profile-XZWNVG5R.js → profile-3JQ3XM6Q.js} +1 -1
- package/dist/chunks/{project-agent-P6TRRYOC.js → project-agent-S76FWVPV.js} +1 -1
- package/dist/chunks/{sandbox-command-JISHBUMC.js → sandbox-command-YQDGQBBQ.js} +1 -1
- package/dist/chunks/{sandbox-template-YGPOBKNA.js → sandbox-template-GM2A3437.js} +1 -1
- package/dist/chunks/{src-S7SFHJYJ.js → src-BC7WOVGF.js} +1 -1
- package/dist/chunks/src-S7XTFQ4V.js +319 -0
- package/dist/chunks/{teams-bot-TXCL4DNV.js → teams-bot-M6QLZAHA.js} +1 -1
- package/dist/chunks/{workspaces-5XC34YIM.js → workspaces-MJVCPH22.js} +1 -1
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/dist/profile/local-profile.d.ts +7 -0
- package/dist/skills/openpond-agent-authoring/references/profile-layout.md +9 -0
- package/dist/web/assets/App-7h_oHCFd.css +1 -0
- package/dist/web/assets/App-Dx38Dhlo.js +176 -0
- package/dist/web/assets/{AppDialog-CtqbY289.js → AppDialog-DdWbnFnr.js} +1 -1
- package/dist/web/assets/AppTerminalPanel-BotH-2y4.js +2 -0
- package/dist/web/assets/{AppsView-BeGbrJkU.js → AppsView-B3ybXi71.js} +1 -1
- package/dist/web/assets/BrowserSidebar-CLE27mjT.js +1 -0
- package/dist/web/assets/{BrowserSidebar-D9i7gQzw.css → BrowserSidebar-lNqqj4Ip.css} +1 -1
- package/dist/web/assets/{CartesianChart-Cp_-LaJY.js → CartesianChart-SB3Jq3CQ.js} +1 -1
- package/dist/web/assets/{CollaborationTabs-BL6guh-3.js → CollaborationTabs-C3jO5y5v.js} +1 -1
- package/dist/web/assets/{CommandMenu-hNQCm8mw.css → CommandMenu-Cb3vNGJr.css} +1 -1
- package/dist/web/assets/{CommandMenu-B-DEtpTp.js → CommandMenu-DqtJane1.js} +1 -1
- package/dist/web/assets/{CommunityView-DaIS0cHw.css → CommunityView-CnZqWEjK.css} +1 -1
- package/dist/web/assets/{CommunityView-DcEhEMm_.js → CommunityView-Dg02tZmL.js} +1 -1
- package/dist/web/assets/{ComposerCreateImproveStrip-C4mCZcKl.js → ComposerCreateImproveStrip-BTJhG8aU.js} +1 -1
- package/dist/web/assets/{GetStartedView-BUlaCO6a.js → GetStartedView-BlyP6VY8.js} +1 -1
- package/dist/web/assets/HostedModelLearningReview-BwSAO9y6.js +1 -0
- package/dist/web/assets/HostedModelLearningSettings-CiY2K8Fz.js +1 -0
- package/dist/web/assets/{LabModelVersionDetailPage-Bb1XRvo_.js → LabModelVersionDetailPage-cE1kuSWk.js} +1 -1
- package/dist/web/assets/{LabSkillSidebar-CPucMztm.js → LabSkillSidebar-BrSa3H3m.js} +1 -1
- package/dist/web/assets/{LabsRoute-C_HDADl0.js → LabsRoute-CY7rB25U.js} +4 -4
- package/dist/web/assets/MainChatThread-BM8l-LiB.js +2 -0
- package/dist/web/assets/MainPane-CsAYR_EF.js +10 -0
- package/dist/web/assets/{MarkdownText-_zVYW4pN.js → MarkdownText-8GA7g1qR.js} +1 -1
- package/dist/web/assets/{Messages-DxctstDI.js → Messages-CX08x24k.js} +6 -6
- package/dist/web/assets/{NativeSkillSidebar-DV4AGiCD.js → NativeSkillSidebar-mSz4GlxA.js} +1 -1
- package/dist/web/assets/{NewExperienceSwitcher-CZCLJj99.js → NewExperienceSwitcher-CHAC2Zid.js} +1 -1
- package/dist/web/assets/{NewProjectDialog-CQSipZ5d.js → NewProjectDialog-5B17C6Vh.js} +1 -1
- package/dist/web/assets/{OutputsPage-aPJP4mTV.js → OutputsPage-27Gp1K5N.js} +1 -1
- package/dist/web/assets/{ProjectsPage-CyThuXQv.js → ProjectsPage-DJpPuKBP.js} +1 -1
- package/dist/web/assets/RightChatPanelStack-C_4rbc1i.js +1 -0
- package/dist/web/assets/{RightSidebarHomePanel-CtH0vZ36.js → RightSidebarHomePanel-PHndCapL.js} +1 -1
- package/dist/web/assets/{ScheduledWorkPage-BY_4jFm7.js → ScheduledWorkPage-CYQZ0Zal.js} +1 -1
- package/dist/web/assets/{SettingsView-ZPnupcpg.js → SettingsView-DQPMLKNH.js} +7 -7
- package/dist/web/assets/{TeamChatView-DWjwVxMp.js → TeamChatView-DRvqhiOV.js} +2 -2
- package/dist/web/assets/{TeamChatView-Br3VdxhD.css → TeamChatView-dL6B0qib.css} +1 -1
- package/dist/web/assets/{TerminalOverlay-DxuUGKYH.js → TerminalOverlay-C8FbaVVP.js} +1 -1
- package/dist/web/assets/{TrainingCreationPanel-CjIPEoTX.js → TrainingCreationPanel-BGsd95vF.js} +1 -1
- package/dist/web/assets/{TrainingDraftPanel-CxevAlkr.js → TrainingDraftPanel-Bm6j-IuS.js} +1 -1
- package/dist/web/assets/{UsageSettingsSection-CY1lQB_g.js → UsageSettingsSection-CTCDOE-_.js} +3 -3
- package/dist/web/assets/{WorkSidebarPanel-DMsiwOSi.js → WorkSidebarPanel-UaymQC_e.js} +1 -1
- package/dist/web/assets/WorkspaceDiffPanel-D6mKLQha.js +14 -0
- package/dist/web/assets/{WorkspaceEnvironmentMenu-7DSF_BpI.js → WorkspaceEnvironmentMenu-C4Uw5qMA.js} +3 -3
- package/dist/web/assets/{WorkspaceGitDialogs-Ck8BzH11.js → WorkspaceGitDialogs--t9VpTCT.js} +1 -1
- package/dist/web/assets/{WorkspaceMonacoEditor-gsEP4W37.js → WorkspaceMonacoEditor-CElU0vIN.js} +3 -3
- package/dist/web/assets/{arrow-up-right-BK6EpHpC.js → arrow-up-right-C0HJHPjq.js} +1 -1
- package/dist/web/assets/{chat-file-links-BQe708gU.js → chat-file-links-D5q1as_h.js} +1 -1
- package/dist/web/assets/chevron-up-B3Cyo8SJ.js +1 -0
- package/dist/web/assets/{clipboard-DOmCP7eR.js → clipboard-wiphvxrN.js} +1 -1
- package/dist/web/assets/{cloud-upload-DLtawDYW.js → cloud-upload-Bgm5_SSr.js} +1 -1
- package/dist/web/assets/{cssMode-C0Qw8i_8.js → cssMode-DudNT1l3.js} +1 -1
- package/dist/web/assets/{folder-open-B_Ayxxo8.js → folder-open-DLuZSDXn.js} +1 -1
- package/dist/web/assets/{folder-plus-CPgtt3pN.js → folder-plus-DXN0q9GR.js} +1 -1
- package/dist/web/assets/{git-commit-horizontal-23xCJjd8.js → git-commit-horizontal-CdiI4K5M.js} +1 -1
- package/dist/web/assets/{htmlMode-DuQ7zaau.js → htmlMode-B2sAXhgB.js} +1 -1
- package/dist/web/assets/index-C5EoPZr0.css +1 -0
- package/dist/web/assets/{index-BoaTQ0Rb.js → index-DSK9XSir.js} +2 -1
- package/dist/web/assets/{info-CQ2kJJ5E.js → info-DcmIP9D3.js} +1 -1
- package/dist/web/assets/{jsonMode-DVQSEPUy.js → jsonMode-aQlrpuz5.js} +1 -1
- package/dist/web/assets/{lspLanguageFeatures-DWKH3min.js → lspLanguageFeatures-BMskOvs7.js} +1 -1
- package/dist/web/assets/{minimize-2-1M-fFBeP.js → minimize-2-CvKd6Q_r.js} +1 -1
- package/dist/web/assets/{monaco.contribution-jXX7-l5p.js → monaco.contribution-BHv_qQG9.js} +2 -2
- package/dist/web/assets/{monaco.contribution-ytVV-s22.js → monaco.contribution-BSRllZgB.js} +2 -2
- package/dist/web/assets/{monaco.contribution-B5Jz7f4W.js → monaco.contribution-VS3RCwFP.js} +2 -2
- package/dist/web/assets/{monaco.contribution-DB7pp5Y-.js → monaco.contribution-tZUXzebU.js} +2 -2
- package/dist/web/assets/{play-D9jaK5MP.js → play-BzfQJMmu.js} +1 -1
- package/dist/web/assets/{python-_yRitN2I.js → python-Bm9eN64d.js} +1 -1
- package/dist/web/assets/{refresh-cw-DZHqZGos.js → refresh-cw-Cvy0BqFv.js} +1 -1
- package/dist/web/assets/{save-DOT3oYfU.js → save-miVdIz56.js} +1 -1
- package/dist/web/assets/{square-D_1V6onE.js → square-DlJ_-dur.js} +1 -1
- package/dist/web/assets/{toggleHighContrast-C06C-luq.js → toggleHighContrast-B8jte8Lm.js} +1 -1
- package/dist/web/assets/{tsMode-CTMYvh-R.js → tsMode-CmAPBzqb.js} +1 -1
- package/dist/web/assets/{upload-EAAHd0Nx.js → upload-C71OnfRd.js} +1 -1
- package/dist/web/assets/{useLocalAgentSchedules-DBsx4aIY.js → useLocalAgentSchedules-D9hDhAba.js} +1 -1
- package/dist/web/assets/{wifi-off-DYRTrfYa.js → wifi-off-DhI7P9WW.js} +1 -1
- package/dist/web/assets/{workers-DAytqxd3.js → workers-BDI2xQio.js} +1 -1
- package/dist/web/assets/{yaml-iZnWWABr.js → yaml-DNSpZj5_.js} +1 -1
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/dist/chunks/app-server-runtime-MICKKE3S.js +0 -2
- package/dist/chunks/chunk-AD3RLKPP.js +0 -5
- package/dist/chunks/chunk-AIGGIV44.js +0 -5
- package/dist/chunks/chunk-HEUO2XEH.js +0 -28
- package/dist/chunks/chunk-L6OFNJ6Y.js +0 -19
- package/dist/chunks/chunk-XSFF4T2Z.js +0 -24
- package/dist/chunks/extension-N5SBQPJO.js +0 -5
- package/dist/chunks/src-UDJ7D55P.js +0 -319
- package/dist/web/assets/App-DNZ5VhFd.js +0 -176
- package/dist/web/assets/AppTerminalPanel-C1U1RKU6.js +0 -2
- package/dist/web/assets/BrowserSidebar-XgQLeXw1.js +0 -1
- package/dist/web/assets/HostedModelLearningReview-CZyb95R_.js +0 -1
- package/dist/web/assets/HostedModelLearningSettings-D2o7rh0w.js +0 -1
- package/dist/web/assets/MainChatThread-CnXHxCy3.js +0 -2
- package/dist/web/assets/MainPane-DjnT-kvm.js +0 -8
- package/dist/web/assets/RightChatPanelStack-jsP9CukH.js +0 -1
- package/dist/web/assets/WorkspaceDiffPanel-HdfItqu2.js +0 -14
- package/dist/web/assets/chevron-up-CHxYR4AX.js +0 -1
- package/dist/web/assets/index-BGMzUaup.css +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{c as Ye}from"./chunk-IR3YJWPW.js";import{Aa as Rr,Bb as qx,Cb as P8,Da as ex,Db as Y,Ea as yr,Fa as G8,Ga as wr,Ha as r8,Ia as qr,Ja as _r,Ka as t8,La as ze,Ma as yx,Mb as We,Na as j0,Nb as M8,Oa as wx,Ob as Ax,Pb as Pr,Qa as cx,Sa as lx,Ub as E0,Vb as Mr,Wb as Nr,Xa as Tr,Xb as N8,Ya as p0,Yb as Or,Zb as _x,_b as O8,b as kr,bb as $r,db as R0,eb as O0,gb as Xe,h as gr,ib as Hr,lb as Ir,pb as Gr,qb as Qr,wa as U,wb as N,xa as Sr,xb as C0,ya as A8,yb as t0,zb as Q8}from"./chunk-HEUO2XEH.js";import{a as Lr}from"./chunk-6FA3GG5B.js";import{a as _,b as $,c as e0,d as Z,e as g,g as Sx,h as i0,i as I8,k as hr,l as S,m as Rx,n as N0}from"./chunk-HZP5U2AA.js";import{b as x}from"./chunk-ES2ISFJC.js";import{a as s,b as Vn,c as Jn,e as Un}from"./chunk-FTQLQJQV.js";var uF=Jn((fE,mF)=>{"use strict";var Jv=Object.create,g8=Object.defineProperty,Uv=Object.getOwnPropertyDescriptor,KA=Object.getOwnPropertyNames,Kv=Object.getPrototypeOf,Zv=Object.prototype.hasOwnProperty,zv=s((e,A,r)=>A in e?g8(e,A,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[A]=r,"__defNormalProp"),Xv=s((e,A)=>function(){return e&&(A=(0,e[KA(e)[0]])(e=0)),A},"__esm"),Wv=s((e,A)=>function(){return A||(0,e[KA(e)[0]])((A={exports:{}}).exports,A),A.exports},"__commonJS"),cF=s((e,A)=>{for(var r in A)g8(e,r,{get:A[r],enumerable:!0})},"__export"),lF=s((e,A,r,t)=>{if(A&&typeof A=="object"||typeof A=="function")for(let a of KA(A))!Zv.call(e,a)&&a!==r&&g8(e,a,{get:s(()=>A[a],"get"),enumerable:!(t=Uv(A,a))||t.enumerable});return e},"__copyProps"),Yv=s((e,A,r)=>(r=e!=null?Jv(Kv(e)):{},lF(A||!e||!e.__esModule?g8(r,"default",{value:e,enumerable:!0}):r,e)),"__toESM"),xB=s(e=>lF(g8({},"__esModule",{value:!0}),e),"__toCommonJS"),eB=s((e,A,r)=>(zv(e,typeof A!="symbol"?A+"":A,r),r),"__publicField"),EF={};cF(EF,{QuickJSFFI:s(()=>dF,"QuickJSFFI")});var dF,AB=Xv({"src/ffi.ts"(){"use strict";dF=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"])}}}}),rB=Wv({"dist/emscripten-module.cjs"(e,A){"use strict";var r=(()=>{var t=globalThis.document?.currentScript?.src;return async function(a={}){var n,F=a,i=!!globalThis.window,f=!!globalThis.WorkerGlobalScope,o=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 Bx}});var v="./this.program",c=s((E,d)=>{throw d},"u");if(typeof __filename<"u"?t=__filename:f&&(t=self.location.href),o){var b=Vn("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(i||f)try{new URL(".",t)}catch{}var u=console.log.bind(console),m=console.error.bind(console),D=!1,y;function w(E){for(var d=0,l=E.length,R=new Uint8Array(l),M;d<l;++d)M=E.charCodeAt(d),R[d]=~M>>8&M;return R}s(w,"ca");var h,x0,q,T,Q,G,n0=!1;function S0(){var E=Bx.buffer;F.HEAP8=q=new Int8Array(E),new Int16Array(E),F.HEAPU8=T=new Uint8Array(E),new Uint16Array(E),Q=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),D=!0,E=new WebAssembly.RuntimeError(E+". Build with -sASSERTIONS for more info."),x0?.(E),E}s(B0,"I");var Oe;async function $n(E){return E}s($n,"da");async function Hn(E){var d=Oe;try{var l=await $n(d);return await WebAssembly.instantiate(l,E)}catch(R){m(`failed to asynchronously prepare wasm: ${R}`),B0(R)}}s(Hn,"ea");async function In(E){return Hn(E)}s(In,"fa");class Le{static{s(this,"K")}constructor(d){eB(this,"name","ExitStatus"),this.message=`Program terminated with exit(${d})`,this.status=d}}for(var lr=E=>{for(;0<E.length;)E.shift()(F)},Er=[],dr=[],Gn=()=>{var E=F.preRun.shift();dr.push(E)},$8=!0,Bx,br=new TextDecoder,mr=(E,d,l,R)=>{if(l=d+l,R)return l;for(;E[d]&&!(d>=l);)++d;return d},Y0=(E,d,l)=>E?br.decode(T.subarray(E,mr(T,E,d,l))):"",Ve=0,Qn=[0,31,60,91,121,152,182,213,244,274,305,335],Pn=[0,31,59,90,120,151,181,212,243,273,304,334],x8={},ur=E=>{y=E,$8||0<Ve||(F.onExit?.(E),D=!0),c(E,new Le(E))},Mn=E=>{if(!D)try{E()}catch(d){d instanceof Le||d=="unwind"||c(1,d)}finally{if(!($8||0<Ve))try{y=E=y,ur(E)}catch(d){d instanceof Le||d=="unwind"||c(1,d)}}},fx=(E,d,l)=>{var R=T;if(!(0<l))return 0;var M=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-M},Je={},jr=()=>{if(!Ue){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 Je)Je[d]===void 0?delete E[d]:E[d]=Je[d];var l=[];for(d in E)l.push(`${d}=${E[d]}`);Ue=l}return Ue},Ue,Ke=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},Nn=[null,[],[]],On=(E,d,l,R)=>{var M={string:s(s0=>{var r0=0;if(s0!=null&&s0!==0){r0=Ke(s0)+1;var M0=Ze(r0);fx(s0,M0,r0),r0=M0}return r0},"string"),array:s(s0=>{var r0=Ze(s0.length);return q.set(s0,r0),r0},"array")};E=F["_"+E];var X=[],W=0;if(R)for(var l0=0;l0<R.length;l0++){var gx=M[l[l0]];gx?(W===0&&(W=Dr()),X[l0]=gx(R[l0])):X[l0]=R[l0]}return l=E(...X),l=(function(s0){return W!==0&&Cr(W),d==="string"?Y0(s0):d==="boolean"?!!s0:s0})(l)},e8=new Uint8Array(123),xx=25;0<=xx;--xx)e8[48+xx]=52+xx,e8[65+xx]=xx,e8[97+xx]=26+xx;if(e8[43]=62,e8[47]=63,F.wasmMemory?Bx=F.wasmMemory:Bx=new WebAssembly.Memory({initial:(F.INITIAL_MEMORY||16777216)/65536,maximum:32768}),S0(),F.noExitRuntime&&($8=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 M=!l||l.every(X=>X==="number"||X==="boolean");return d!=="string"&&M&&!R?F["_"+E]:(...X)=>On(E,d,l,X)},F.UTF8ToString=Y0,F.stringToUTF8=(E,d,l)=>fx(E,d,l),F.lengthBytesUTF8=Ke;var pr,Cr,Ze,Dr,Ln={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(()=>{$8=!1,Ve=0},"l"),m:s(function(E,d){E=-9007199254740992>E||9007199254740992<E?NaN:Number(E),E=new Date(1e3*E),Q[d>>2]=E.getSeconds(),Q[d+4>>2]=E.getMinutes(),Q[d+8>>2]=E.getHours(),Q[d+12>>2]=E.getDate(),Q[d+16>>2]=E.getMonth(),Q[d+20>>2]=E.getFullYear()-1900,Q[d+24>>2]=E.getDay();var l=E.getFullYear();Q[d+28>>2]=(l%4!==0||l%100===0&&l%400!==0?Pn:Qn)[E.getMonth()]+E.getDate()-1|0,Q[d+36>>2]=-(60*E.getTimezoneOffset()),l=new Date(E.getFullYear(),6,1).getTimezoneOffset();var R=new Date(E.getFullYear(),0,1).getTimezoneOffset();Q[d+32>>2]=(l!=R&&E.getTimezoneOffset()==Math.min(R,l))|0},"m"),j:s((E,d)=>{if(x8[E]&&(clearTimeout(x8[E].id),delete x8[E]),!d)return 0;var l=setTimeout(()=>{delete x8[E],Mn(()=>pr(E,performance.now()))},d);return x8[E]={id:l,Qa:d},0},"j"),n:s((E,d,l,R)=>{var M=new Date().getFullYear(),X=new Date(M,0,1).getTimezoneOffset();M=new Date(M,6,1).getTimezoneOffset(),G[E>>2]=60*Math.max(X,M),Q[d>>2]=+(X!=M),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(M),M<X?(fx(E,l,17),fx(d,R,17)):(fx(E,R,17),fx(d,l,17))},"n"),p:s(()=>Date.now(),"p"),k:s(E=>{var d=T.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))-Bx.buffer.byteLength+65535)/65536|0;try{Bx.grow(R),S0();var M=1;break x}catch{}M=void 0}if(M)return!0}return!1},"k"),e:s((E,d)=>{var l=0,R=0,M;for(M of jr()){var X=d+l;G[E+R>>2]=X,l+=fx(M,X,1/0)+1,R+=4}return 0},"e"),f:s((E,d)=>{var l=jr();G[E>>2]=l.length,E=0;for(var R of l)E+=Ke(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 M=0,X=0;X<l;X++){var W=G[d>>2],l0=G[d+4>>2];d+=8;for(var gx=0;gx<l0;gx++){var s0=E,r0=T[W+gx],M0=Nn[s0];r0===0||r0===10?(s0=s0===1?u:m,r0=mr(M0,0),r0=br.decode(M0.buffer?M0.subarray(0,r0):new Uint8Array(M0.slice(0,r0))),s0(r0),M0.length=0):M0.push(r0)}M+=l0}return G[R>>2]=M,0},"c"),a:Bx,r:ur,s:s(function(E,d,l,R,M){return F.callbacks.callFunction(void 0,E,d,l,R,M)},"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")},H8;return H8=await(async function(){function E(l){return l=H8=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,pr=l.La,Cr=l.Ma,Ze=l.Na,Dr=l.Oa,H8}s(E,"b");var d={a:Ln};return F.instantiateWasm?new Promise(l=>{F.instantiateWasm(d,(R,M)=>{l(E(R,M))})}):(Oe??(Oe=w(`\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 Ye}from"./chunk-IR3YJWPW.js";import{$b as Nr,Ba as U,Bb as N,Ca as Sr,Cb as C0,Da as A8,Db as t0,Eb as Q8,Fa as Rr,Gb as qx,Hb as P8,Ia as ex,Ib as Y,Ja as yr,Ka as G8,La as wr,Ma as r8,Na as qr,Oa as _r,Pa as t8,Qa as ze,Ra as yx,Rb as We,Sa as j0,Sb as M8,Ta as wx,Tb as Ax,Ub as Pr,Va as cx,Xa as lx,Zb as E0,_b as Mr,ab as Tr,ac as N8,b as kr,bb as p0,bc as Or,cc as _x,dc as O8,gb as $r,h as gr,ib as R0,jb as O0,lb as Xe,nb as Hr,qb as Ir,ub as Gr,vb as Qr}from"./chunk-UW6ES5DM.js";import{a as Lr}from"./chunk-6FA3GG5B.js";import{a as _,b as $,c as e0,d as Z,e as g,g as Sx,h as i0,i as I8,k as hr,l as S,m as Rx,n as N0}from"./chunk-HZP5U2AA.js";import{b as x}from"./chunk-ES2ISFJC.js";import{a as s,b as Vn,c as Jn,e as Un}from"./chunk-FTQLQJQV.js";var uF=Jn((fE,mF)=>{"use strict";var Jv=Object.create,g8=Object.defineProperty,Uv=Object.getOwnPropertyDescriptor,KA=Object.getOwnPropertyNames,Kv=Object.getPrototypeOf,Zv=Object.prototype.hasOwnProperty,zv=s((e,A,r)=>A in e?g8(e,A,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[A]=r,"__defNormalProp"),Xv=s((e,A)=>function(){return e&&(A=(0,e[KA(e)[0]])(e=0)),A},"__esm"),Wv=s((e,A)=>function(){return A||(0,e[KA(e)[0]])((A={exports:{}}).exports,A),A.exports},"__commonJS"),cF=s((e,A)=>{for(var r in A)g8(e,r,{get:A[r],enumerable:!0})},"__export"),lF=s((e,A,r,t)=>{if(A&&typeof A=="object"||typeof A=="function")for(let a of KA(A))!Zv.call(e,a)&&a!==r&&g8(e,a,{get:s(()=>A[a],"get"),enumerable:!(t=Uv(A,a))||t.enumerable});return e},"__copyProps"),Yv=s((e,A,r)=>(r=e!=null?Jv(Kv(e)):{},lF(A||!e||!e.__esModule?g8(r,"default",{value:e,enumerable:!0}):r,e)),"__toESM"),xB=s(e=>lF(g8({},"__esModule",{value:!0}),e),"__toCommonJS"),eB=s((e,A,r)=>(zv(e,typeof A!="symbol"?A+"":A,r),r),"__publicField"),EF={};cF(EF,{QuickJSFFI:s(()=>dF,"QuickJSFFI")});var dF,AB=Xv({"src/ffi.ts"(){"use strict";dF=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"])}}}}),rB=Wv({"dist/emscripten-module.cjs"(e,A){"use strict";var r=(()=>{var t=globalThis.document?.currentScript?.src;return async function(a={}){var n,F=a,i=!!globalThis.window,f=!!globalThis.WorkerGlobalScope,o=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 Bx}});var v="./this.program",c=s((E,d)=>{throw d},"u");if(typeof __filename<"u"?t=__filename:f&&(t=self.location.href),o){var b=Vn("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(i||f)try{new URL(".",t)}catch{}var u=console.log.bind(console),m=console.error.bind(console),D=!1,y;function w(E){for(var d=0,l=E.length,R=new Uint8Array(l),M;d<l;++d)M=E.charCodeAt(d),R[d]=~M>>8&M;return R}s(w,"ca");var h,x0,q,T,Q,G,n0=!1;function S0(){var E=Bx.buffer;F.HEAP8=q=new Int8Array(E),new Int16Array(E),F.HEAPU8=T=new Uint8Array(E),new Uint16Array(E),Q=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),D=!0,E=new WebAssembly.RuntimeError(E+". Build with -sASSERTIONS for more info."),x0?.(E),E}s(B0,"I");var Oe;async function $n(E){return E}s($n,"da");async function Hn(E){var d=Oe;try{var l=await $n(d);return await WebAssembly.instantiate(l,E)}catch(R){m(`failed to asynchronously prepare wasm: ${R}`),B0(R)}}s(Hn,"ea");async function In(E){return Hn(E)}s(In,"fa");class Le{static{s(this,"K")}constructor(d){eB(this,"name","ExitStatus"),this.message=`Program terminated with exit(${d})`,this.status=d}}for(var lr=E=>{for(;0<E.length;)E.shift()(F)},Er=[],dr=[],Gn=()=>{var E=F.preRun.shift();dr.push(E)},$8=!0,Bx,br=new TextDecoder,mr=(E,d,l,R)=>{if(l=d+l,R)return l;for(;E[d]&&!(d>=l);)++d;return d},Y0=(E,d,l)=>E?br.decode(T.subarray(E,mr(T,E,d,l))):"",Ve=0,Qn=[0,31,60,91,121,152,182,213,244,274,305,335],Pn=[0,31,59,90,120,151,181,212,243,273,304,334],x8={},ur=E=>{y=E,$8||0<Ve||(F.onExit?.(E),D=!0),c(E,new Le(E))},Mn=E=>{if(!D)try{E()}catch(d){d instanceof Le||d=="unwind"||c(1,d)}finally{if(!($8||0<Ve))try{y=E=y,ur(E)}catch(d){d instanceof Le||d=="unwind"||c(1,d)}}},fx=(E,d,l)=>{var R=T;if(!(0<l))return 0;var M=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-M},Je={},jr=()=>{if(!Ue){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 Je)Je[d]===void 0?delete E[d]:E[d]=Je[d];var l=[];for(d in E)l.push(`${d}=${E[d]}`);Ue=l}return Ue},Ue,Ke=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},Nn=[null,[],[]],On=(E,d,l,R)=>{var M={string:s(s0=>{var r0=0;if(s0!=null&&s0!==0){r0=Ke(s0)+1;var M0=Ze(r0);fx(s0,M0,r0),r0=M0}return r0},"string"),array:s(s0=>{var r0=Ze(s0.length);return q.set(s0,r0),r0},"array")};E=F["_"+E];var X=[],W=0;if(R)for(var l0=0;l0<R.length;l0++){var gx=M[l[l0]];gx?(W===0&&(W=Dr()),X[l0]=gx(R[l0])):X[l0]=R[l0]}return l=E(...X),l=(function(s0){return W!==0&&Cr(W),d==="string"?Y0(s0):d==="boolean"?!!s0:s0})(l)},e8=new Uint8Array(123),xx=25;0<=xx;--xx)e8[48+xx]=52+xx,e8[65+xx]=xx,e8[97+xx]=26+xx;if(e8[43]=62,e8[47]=63,F.wasmMemory?Bx=F.wasmMemory:Bx=new WebAssembly.Memory({initial:(F.INITIAL_MEMORY||16777216)/65536,maximum:32768}),S0(),F.noExitRuntime&&($8=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 M=!l||l.every(X=>X==="number"||X==="boolean");return d!=="string"&&M&&!R?F["_"+E]:(...X)=>On(E,d,l,X)},F.UTF8ToString=Y0,F.stringToUTF8=(E,d,l)=>fx(E,d,l),F.lengthBytesUTF8=Ke;var pr,Cr,Ze,Dr,Ln={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(()=>{$8=!1,Ve=0},"l"),m:s(function(E,d){E=-9007199254740992>E||9007199254740992<E?NaN:Number(E),E=new Date(1e3*E),Q[d>>2]=E.getSeconds(),Q[d+4>>2]=E.getMinutes(),Q[d+8>>2]=E.getHours(),Q[d+12>>2]=E.getDate(),Q[d+16>>2]=E.getMonth(),Q[d+20>>2]=E.getFullYear()-1900,Q[d+24>>2]=E.getDay();var l=E.getFullYear();Q[d+28>>2]=(l%4!==0||l%100===0&&l%400!==0?Pn:Qn)[E.getMonth()]+E.getDate()-1|0,Q[d+36>>2]=-(60*E.getTimezoneOffset()),l=new Date(E.getFullYear(),6,1).getTimezoneOffset();var R=new Date(E.getFullYear(),0,1).getTimezoneOffset();Q[d+32>>2]=(l!=R&&E.getTimezoneOffset()==Math.min(R,l))|0},"m"),j:s((E,d)=>{if(x8[E]&&(clearTimeout(x8[E].id),delete x8[E]),!d)return 0;var l=setTimeout(()=>{delete x8[E],Mn(()=>pr(E,performance.now()))},d);return x8[E]={id:l,Qa:d},0},"j"),n:s((E,d,l,R)=>{var M=new Date().getFullYear(),X=new Date(M,0,1).getTimezoneOffset();M=new Date(M,6,1).getTimezoneOffset(),G[E>>2]=60*Math.max(X,M),Q[d>>2]=+(X!=M),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(M),M<X?(fx(E,l,17),fx(d,R,17)):(fx(E,R,17),fx(d,l,17))},"n"),p:s(()=>Date.now(),"p"),k:s(E=>{var d=T.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))-Bx.buffer.byteLength+65535)/65536|0;try{Bx.grow(R),S0();var M=1;break x}catch{}M=void 0}if(M)return!0}return!1},"k"),e:s((E,d)=>{var l=0,R=0,M;for(M of jr()){var X=d+l;G[E+R>>2]=X,l+=fx(M,X,1/0)+1,R+=4}return 0},"e"),f:s((E,d)=>{var l=jr();G[E>>2]=l.length,E=0;for(var R of l)E+=Ke(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 M=0,X=0;X<l;X++){var W=G[d>>2],l0=G[d+4>>2];d+=8;for(var gx=0;gx<l0;gx++){var s0=E,r0=T[W+gx],M0=Nn[s0];r0===0||r0===10?(s0=s0===1?u:m,r0=mr(M0,0),r0=br.decode(M0.buffer?M0.subarray(0,r0):new Uint8Array(M0.slice(0,r0))),s0(r0),M0.length=0):M0.push(r0)}M+=l0}return G[R>>2]=M,0},"c"),a:Bx,r:ur,s:s(function(E,d,l,R,M){return F.callbacks.callFunction(void 0,E,d,l,R,M)},"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")},H8;return H8=await(async function(){function E(l){return l=H8=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,pr=l.La,Cr=l.Ma,Ze=l.Na,Dr=l.Oa,H8}s(E,"b");var d={a:Ln};return F.instantiateWasm?new Promise(l=>{F.instantiateWasm(d,(R,M)=>{l(E(R,M))})}):(Oe??(Oe=w(`\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{a as X,b as Q}from"./chunk-GLUWATL5.js";import{Ja as W,Ka as q,Ua as L,ya as Y,za as D}from"./chunk-FYCJSUFV.js";import{f as P,h as V}from"./chunk-H7IWJN7L.js";import{a as i}from"./chunk-FTQLQJQV.js";var I=class extends Error{constructor(n,o){super(`API request timed out after ${n}ms: ${o}`);this.timeoutMs=n;this.requestUrl=o;this.name="ApiTimeoutError"}timeoutMs;requestUrl;static{i(this,"ApiTimeoutError")}code="OPENPOND_API_TIMEOUT"},E=class extends Error{constructor(n,o){super(`API response exceeded ${n} bytes: ${o}`);this.maximumBytes=n;this.requestUrl=o;this.name="ApiResponseTooLargeError"}maximumBytes;requestUrl;static{i(this,"ApiResponseTooLargeError")}code="OPENPOND_API_RESPONSE_TOO_LARGE"},N=class extends Error{constructor(n,o,r,s=null){let a=s||o;super(`${r} failed: ${n}${a?` ${a}`:""}`);this.status=n;this.apiMessage=s;this.name="OpenPondApiError",this.code=o||"OPENPOND_API_ERROR"}status;apiMessage;static{i(this,"OpenPondApiError")}code};async function c(t,e,n,o={}){let{timeoutMs:r=3e4,maxResponseBytes:s=8388608,explicitBearerAuth:a=!1,...l}=o,p=`${t}${n}`,d=new Headers(l.headers);d.set("Content-Type","application/json");let h=a?void 0:process.env.OPENPOND_API_KEY,g=e?.trim()||"",f=!a&&g.startsWith("opk_"),k=h||(f?g:null);k&&!d.has("openpond-api-key")&&d.set("openpond-api-key",k),e?d.set("Authorization",f?`ApiKey ${g}`:`Bearer ${e}`):h&&!d.has("Authorization")&&d.set("Authorization",`ApiKey ${h}`);let x=new AbortController,T=new I(r,p),O=r>0?setTimeout(()=>x.abort(T),r):null;O?.unref?.();let _=ye(l.signal,x.signal,r),F=i(()=>{O&&clearTimeout(O)},"cleanup");try{let B=await fetch(p,{...l,headers:d,signal:_});return he(B,{cleanup:F,maximumBytes:s,requestUrl:p,timeoutController:x,timeoutError:T})}catch(B){throw F(),x.signal.aborted?T:B}}i(c,"apiFetch");async function y(t,e){let n;try{let o=await t.text();n=o?JSON.parse(o):{}}catch(o){if(o instanceof I||o instanceof E)throw o;n={}}if(!t.ok){let o=typeof n.error=="string"?n.error:null,r=typeof n.message=="string"?n.message:null;throw new N(t.status,o,e,r)}return n}i(y,"readApiJson");function he(t,e){if(!t.body)return e.cleanup(),t;let n=Number(t.headers.get("content-length"));if(e.maximumBytes>0&&Number.isFinite(n)&&n>e.maximumBytes)throw e.cleanup(),t.body.cancel(),new E(e.maximumBytes,e.requestUrl);let o=t.body.getReader(),r=0,s=new ReadableStream({async pull(a){try{let l=await o.read();if(l.done){e.cleanup(),a.close();return}if(r+=l.value.byteLength,e.maximumBytes>0&&r>e.maximumBytes){e.cleanup(),await o.cancel(),a.error(new E(e.maximumBytes,e.requestUrl));return}a.enqueue(l.value)}catch(l){e.cleanup(),a.error(e.timeoutController.signal.aborted?e.timeoutError:l)}},async cancel(a){e.cleanup(),await o.cancel(a)}});return new Response(s,{headers:t.headers,status:t.status,statusText:t.statusText})}i(he,"boundedResponse");function ye(t,e,n){return n<=0?t??void 0:t?AbortSignal.any([t,e]):e}i(ye,"composedSignal");async function Re(t,e,n,o,r){let s=await c(t,e,`/v4/apps/${n}/commits`,{method:"POST",body:JSON.stringify({files:o,message:r})});if(!s.ok){let a=await s.text().catch(()=>"");throw new Error(`Commit failed: ${s.status} ${a}`)}return await s.json()}i(Re,"commitFiles");async function Pe(t,e,n,o){let r=o?.environment??"production",s=await c(t,e,`/v4/apps/${n}/deployments`,{method:"POST",body:JSON.stringify({environment:r,...o?.commitSha?{commitSha:o.commitSha}:{},...o?.branch?{branch:o.branch}:{}})});if(!s.ok){let a=await s.text().catch(()=>"");throw new Error(`Deploy failed: ${s.status} ${a}`)}return await s.json()}i(Pe,"deployApp");async function Ae(t,e,n,o){let r=await c(t,e,`/v4/apps/${encodeURIComponent(n)}/deployments/promote-preview`,{method:"POST",body:JSON.stringify(o)});return y(r,"Preview promotion")}i(Ae,"promotePreviewToProduction");async function Se(t,e,n,o){let r=await c(t,e,`/v1/apps/${encodeURIComponent(n)}/lifecycle/start`,{method:"POST",body:JSON.stringify(o)});return y(r,"App lifecycle start")}i(Se,"startAppLifecycle");async function we(t,e,n){let o=await c(t,e,`/apps/deployments/${n}/logs`,{method:"GET"});if(!o.ok){let a=await o.text().catch(()=>"");throw new Error(`Deployment logs failed: ${o.status} ${a}`)}let r=await o.json().catch(()=>({}));return(Array.isArray(r.logs)?r.logs:[]).map(a=>{let l=typeof a.createdAt=="string"?a.createdAt:a.createdAt instanceof Date?a.createdAt.toISOString():new Date().toISOString();return{id:typeof a.id=="string"?a.id:`${Math.random()}`,type:typeof a.type=="string"?a.type:void 0,message:typeof a.message=="string"?a.message:"",createdAt:l}})}i(we,"getDeploymentLogs");async function xe(t,e,n){let o=await c(t,e,`/apps/deployments/${n}/status`,{method:"GET"});if(!o.ok){let s=await o.text().catch(()=>"");throw new Error(`Deployment status failed: ${o.status} ${s}`)}return{status:(await o.json().catch(()=>({}))).deployment?.status}}i(xe,"getDeploymentStatus");async function be(t,e,n,o){let r=new URLSearchParams;o?.status&&o.status.length>0&&r.set("status",o.status.join(",")),o?.createdAfter&&r.set("createdAfter",o.createdAfter),o?.branch&&r.set("branch",o.branch);let s=r.toString(),a=await c(t,e,`/apps/${n}/deployments/latest${s?`?${s}`:""}`,{method:"GET"});if(!a.ok){let p=await a.text().catch(()=>"");throw new Error(`Latest deployment lookup failed: ${a.status} ${p}`)}let l=await a.json().catch(()=>({}));return l.deployment?{id:l.deployment.id,status:l.deployment.status}:null}i(be,"getLatestDeploymentForApp");async function Te(t,e,n){let o=await c(t,e,`/apps/deployments/${n}`,{method:"GET"});if(!o.ok){let s=await o.text().catch(()=>"");throw new Error(`Deployment fetch failed: ${o.status} ${s}`)}return(await o.json().catch(()=>({}))).deployment??null}i(Te,"getDeploymentDetail");var Oe=new URL(Q).hostname,Ee=new URL(X).hostname;async function We(t,e,n){let o=new URLSearchParams;n?.handle&&o.set("handle",n.handle),typeof n?.limit=="number"&&Number.isFinite(n.limit)&&o.set("limit",String(Math.max(1,Math.floor(n.limit)))),typeof n?.offset=="number"&&Number.isFinite(n.offset)&&o.set("offset",String(Math.max(0,Math.floor(n.offset)))),typeof n?.includeScheduled=="boolean"&&o.set("includeScheduled",n.includeScheduled?"true":"false");let r=o.toString(),s=await c(t,e,`/apps/list${r?`?${r}`:""}`,{method:"GET"});if(!s.ok){let l=await s.text().catch(()=>"");throw new Error(`Apps list failed: ${s.status} ${l}`)}let a=await s.json().catch(()=>({}));return Array.isArray(a.apps)?a.apps:[]}i(We,"listApps");async function Xe(t,e,n){let o=await c(t,e,"/api/projects/local",{method:"POST",body:JSON.stringify(n)});if(!o.ok){let r=await o.text().catch(()=>"");throw new Error(`Create project failed: ${o.status} ${r}`)}return await o.json()}i(Xe,"createLocalProject");async function Qe(t,e,n){let o=await c(t,e,"/apps/repo/create",{method:"POST",body:JSON.stringify(n)});if(!o.ok){let r=await o.text().catch(()=>"");throw new Error(`Repo create failed: ${o.status} ${r}`)}return await o.json()}i(Qe,"createRepo");async function Ze(t,e,n,o){let r=await c(t,e,`/apps/${encodeURIComponent(n)}/code-visibility`,{method:"PATCH",body:JSON.stringify({codeVisibility:o})});if(!r.ok){let s=await r.text().catch(()=>"");throw new Error(`Code visibility update failed: ${r.status} ${s}`)}return await r.json()}i(Ze,"updateAppCodeVisibility");async function et(t,e,n,o){let r=await c(t,e,"/v4/apps/headless",{method:"POST",body:JSON.stringify({items:n,...o?{teamId:o}:{}})});if(!r.ok){let s=await r.text().catch(()=>"");throw new Error(`Headless create failed: ${r.status} ${s}`)}return await r.json()}i(et,"createHeadlessApps");async function tt(t,e,n){let o=await c(t,e,`/v4/apps/${n}/template/status`,{method:"GET"});if(!o.ok){let r=await o.text().catch(()=>"");throw new Error(`Template status failed: ${o.status} ${r}`)}return await o.json()}i(tt,"getTemplateStatus");async function nt(t,e,n){let o=await c(t,e,`/v4/apps/${n}/template/branches`,{method:"GET"});if(!o.ok){let r=await o.text().catch(()=>"");throw new Error(`Template branches failed: ${o.status} ${r}`)}return await o.json()}i(nt,"listTemplateBranches");async function ot(t,e,n,o){let r=await c(t,e,`/v4/apps/${n}/template/deploy-latest`,{method:"POST",body:JSON.stringify(o)});if(!r.ok){let s=await r.text().catch(()=>"");throw new Error(`Template deploy failed: ${r.status} ${s}`)}return await r.json()}i(ot,"deployLatestTemplate");async function st(t,e,n,o){let r=await c(t,e,`/v4/apps/${n}/environment`,{method:"POST",body:JSON.stringify(o)});if(!r.ok){let s=await r.text().catch(()=>"");throw new Error(`Environment update failed: ${r.status} ${s}`)}return await r.json()}i(st,"updateAppEnvironment");async function rt(t,e,n){let o=await c(t,e,`/v4/apps/${n}/environment`,{method:"GET"});if(!o.ok){let r=await o.text().catch(()=>"");throw new Error(`Environment get failed: ${o.status} ${r}`)}return await o.json()}i(rt,"getAppEnvironment");async function it(t,e){let n=await c(t,e,"/api/tools/manifest",{method:"GET"});if(!n.ok){let o=await n.text().catch(()=>"");throw new Error(`Manifest fetch failed: ${n.status} ${o}`)}return await n.json()}i(it,"fetchToolManifest");async function at(t,e){let n=await c(t,e,"/apps/tools",{method:"GET"});if(!n.ok){let o=await n.text().catch(()=>"");throw new Error(`Tools lookup failed: ${n.status} ${o}`)}return await n.json()}i(at,"listUserTools");async function lt(t,e,n){let o=await c(t,e,`/apps/${encodeURIComponent(n)}/schedules`,{method:"GET"});if(!o.ok){let s=await o.text().catch(()=>"");throw new Error(`Schedules lookup failed: ${o.status} ${s}`)}let r=await o.json().catch(()=>({}));return{schedules:Array.isArray(r.schedules)?r.schedules:[]}}i(lt,"listAppSchedules");async function ct(t,e,n={}){let o=new URLSearchParams;n.domain&&o.set("domain",n.domain),n.opentoolVersion&&o.set("opentoolVersion",n.opentoolVersion),typeof n.limit=="number"&&o.set("limit",String(n.limit));for(let a of n.tags??[])o.append("tag",a);let r=o.toString(),s=await c(t,e,`/v1/opentool/recipes${r?`?${r}`:""}`,{method:"GET"});return y(s,"OpenTool recipe list")}i(ct,"listOpenToolRecipes");async function ut(t,e,n){let o=await c(t,e,"/v1/opentool/recipes/search",{method:"POST",body:JSON.stringify(n)});return y(o,"OpenTool recipe search")}i(ut,"searchOpenToolRecipes");async function pt(t,e,n){let o=new URLSearchParams;typeof n.includeExamples=="boolean"&&o.set("includeExamples",String(n.includeExamples)),typeof n.includeTests=="boolean"&&o.set("includeTests",String(n.includeTests)),n.opentoolVersion&&o.set("opentoolVersion",n.opentoolVersion);let r=o.toString(),s=await c(t,e,`/v1/opentool/recipes/${encodeURIComponent(n.id)}${r?`?${r}`:""}`,{method:"GET"});return y(s,"OpenTool recipe get")}i(pt,"getOpenToolRecipe");async function dt(t,e,n){let o=await c(t,e,"/v1/opentool/rules",{method:"POST",body:JSON.stringify(n)});return y(o,"OpenTool rules get")}i(dt,"getOpenToolRules");function H(t){let e=new URLSearchParams;typeof t=="number"&&Number.isFinite(t)&&e.set("limit",String(Math.max(1,Math.floor(t))));let n=e.toString();return n?`?${n}`:""}i(H,"buildLimitQuery");function Z(t){if(Array.isArray(t))return t;if(!t||typeof t!="object")return[];let e=t;return Array.isArray(e.logs)?e.logs:Array.isArray(e.runs)?e.runs:Array.isArray(e.scheduleRuns)?e.scheduleRuns:Array.isArray(e.items)?e.items:[]}i(Z,"normalizeScheduleExecutionLogs");async function ft(t,e,n,o){let r={...o?.preferredScheduleId?{preferredScheduleId:o.preferredScheduleId}:{},...o?.scheduleId?{scheduleId:o.scheduleId}:{},...o?.startAt?{startAt:o.startAt}:{},...o&&"endAt"in o?{endAt:o.endAt??null}:{}},s=await c(t,e,`/apps/${encodeURIComponent(n)}/schedules/start`,{method:"POST",body:JSON.stringify(r)});return y(s,"Schedule start")}i(ft,"startAppSchedules");async function mt(t,e,n){let o=await c(t,e,`/apps/${encodeURIComponent(n)}/schedules/stop`,{method:"POST",body:JSON.stringify({})});return y(o,"Schedule stop")}i(mt,"stopAppSchedules");async function gt(t,e){let n=await c(t,e,"/apps/schedules/current/stop",{method:"POST",body:JSON.stringify({})});return y(n,"Current schedule stop")}i(gt,"stopCurrentAppSchedules");async function ht(t,e,n){let o=await c(t,e,"/v1/schedules/run",{method:"POST",body:JSON.stringify({scheduleId:n.scheduleId})});return y(o,"Schedule run")}i(ht,"runScheduleNow");async function yt(t,e,n,o){let r=await c(t,e,`/apps/${encodeURIComponent(n)}/schedules/${encodeURIComponent(o)}`,{method:"DELETE"});return y(r,"Schedule delete")}i(yt,"deleteOrArchiveSchedule");async function Rt(t,e,n,o){let r=await c(t,e,`/v1/schedules/${encodeURIComponent(n)}/execution-logs${H(o?.limit)}`,{method:"GET"}),s=await y(r,"Schedule execution logs");return{logs:Z(s)}}i(Rt,"listScheduleExecutionLogs");async function Pt(t,e,n,o){let r=await c(t,e,`/v1/deployments/${encodeURIComponent(n)}/schedule-execution-logs${H(o?.limit)}`,{method:"GET"}),s=await y(r,"Deployment schedule execution logs");return{logs:Z(s)}}i(Pt,"listDeploymentScheduleExecutionLogs");async function At(t,e,n){let o=await c(t,e,`/v1/schedule-execution-logs/${encodeURIComponent(n)}`,{method:"GET"});return y(o,"Schedule execution log")}i(At,"getScheduleExecutionLog");async function St(t,e,n,o){let r=await c(t,e,`/v1/apps/${encodeURIComponent(n)}/execution-timeline${H(o?.limit)}`,{method:"GET"});return y(r,"App execution timeline")}i(St,"getAppExecutionTimeline");async function wt(t,e,n){return c(t,e,"/apps/agent/create",{method:"POST",body:JSON.stringify(n)})}i(wt,"createAgentFromPrompt");async function xt(t,e,n){let o=new URLSearchParams;n?.appId&&o.set("appId",n.appId);let r=o.toString(),s=await c(t,e,`/apps/performance${r?`?${r}`:""}`,{method:"GET"});if(!s.ok){let a=await s.text().catch(()=>"");throw new Error(`Performance lookup failed: ${s.status} ${a}`)}return await s.json()}i(xt,"getUserPerformance");async function bt(t,e,n){let o=new URLSearchParams({appId:n}),r=await c(t,e,`/apps/summary?${o.toString()}`,{method:"GET"});if(!r.ok){let s=await r.text().catch(()=>"");throw new Error(`Summary lookup failed: ${r.status} ${s}`)}return await r.json()}i(bt,"getAppRuntimeSummary");async function Ce(t,e){let n=await c(t,e,"/v1/account",{method:"GET"});if(!n.ok){let o=await n.text().catch(()=>"");throw new Error(`Account lookup failed: ${n.status} ${o}`)}return await n.json()}i(Ce,"getOpenPondAccount");async function Tt(t,e){let n=new Date().toISOString(),o=Date.now(),r=t.replace(/\/$/,"");try{let s=await c(r,null,"/health",{method:"GET",headers:{Accept:"application/json"}}),a=Date.now()-o,l=await s.json().catch(()=>({})),p=null,d=null;if(e?.trim())try{let h=await Ce(r,e);p=!0,d=h.account}catch{p=!1}return{reachable:s.ok,authenticated:p,apiBase:r,latencyMs:a,status:s.status,service:typeof l.service=="string"?l.service:null,checkedAt:n,account:d,...s.ok?{}:{error:s.statusText||`HTTP ${s.status}`}}}catch(s){return{reachable:!1,authenticated:e?.trim()?!1:null,apiBase:r,latencyMs:Date.now()-o,status:null,service:null,checkedAt:n,error:s instanceof Error?s.message:String(s)}}}i(Tt,"checkOpenPondApiHealth");async function Ot(t,e,n){let o=await c(t,e,"/apps/assistant/run",{method:"POST",body:JSON.stringify(n)});if(!o.ok){let r=await o.text().catch(()=>"");throw new Error(`Assistant run failed: ${o.status} ${r}`)}return await o.json()}i(Ot,"runAssistantMode");async function Et(t,e,n){let o=await c(t,e,"/apps/agent/digest",{method:"POST",body:JSON.stringify(n)});if(!o.ok){let r=await o.text().catch(()=>"");throw new Error(`Agent digest failed: ${o.status} ${r}`)}return await o.json()}i(Et,"postAgentDigest");async function Ct(t,e,n){let o=await c(t,e,"/apps/tools/execute",{method:"POST",body:JSON.stringify(n)}),r=await o.text().catch(()=>""),s=null;try{s=r?JSON.parse(r):null}catch{s=r}return o.ok?{ok:!0,status:o.status,data:s}:{ok:!1,status:o.status,error:s&&typeof s=="object"&&"error"in s?String(s.error):r||o.statusText}}i(Ct,"executeUserTool");async function kt(t,e,n){let o=await c(t,e,"/apps/backtests/run",{method:"POST",body:JSON.stringify(n)});if(!o.ok){let r=await o.text().catch(()=>"");throw new Error(`Backtest run failed: ${o.status} ${r}`)}return await o.json()}i(kt,"submitBacktestRun");async function Lt(t,e,n){let o=n.query&&Object.keys(n.query).length>0?`?${new URLSearchParams(n.query).toString()}`:"",r=await c(t,e,`/apps/backtests/tx${o}`,{method:n.method,body:n.method==="POST"&&n.body!==void 0?JSON.stringify(n.body):void 0});if(!r.ok){let s=await r.text().catch(()=>"");throw new Error(`Backtests request failed: ${r.status} ${s}`)}return await r.json()}i(Lt,"submitBacktestTx");async function It(t,e,n){let o=new URLSearchParams(n).toString(),r=await c(t,e,`/apps/backtests/detail?${o}`,{method:"GET"});if(!r.ok){let s=await r.text().catch(()=>"");throw new Error(`Backtest detail failed: ${r.status} ${s}`)}return await r.json()}i(It,"submitBacktestDetail");function ke(t){let e=t.trim().replace(/^\/+/,"");return encodeURIComponent(e||"tool")}i(ke,"normalizeToolPathSegment");function Le(t){let e=t.replace(/\/$/,""),n=process.env.OPENPOND_TOOL_URL;if(n)return n.replace(/\/$/,"");try{let o=new URL(e),r=o.hostname.toLowerCase(),s=r==="apps.openpond.live"?null:r===Oe||r===Ee||r==="openpond.live"||r==="www.openpond.live"?"https://apps.openpond.live":null;if(s)return s;let a=r==="localhost"||r==="127.0.0.1",l=o.port||(o.protocol==="https:"?"443":"80");if(a&&l==="3000")return e}catch{}return e}i(Le,"resolveWorkerBaseUrl");async function Ut(t,e,n){let o=Le(t),r=ke(n.toolName),a=`${n.deploymentId?`/${n.appId}/deployments/${n.deploymentId}`:`/${n.appId}`}/${r}`,l=new Headers(n.headers||{}),p=n.method??"POST",d=n.body===void 0||p==="GET"?void 0:JSON.stringify(n.body),h=await c(o,e,a,{method:p,body:d,headers:l}),g=await h.text().catch(()=>""),f=null;try{f=g?JSON.parse(g):null}catch{f=g}let k=f&&typeof f=="object"&&"ok"in f?!!f.ok:!0,x=h.ok&&k,T=f&&typeof f=="object"&&"status"in f&&Number(f.status)||h.status,O=f&&typeof f=="object"&&"error"in f?String(f.error):h.ok?void 0:g||h.statusText,_=f&&typeof f=="object"&&"data"in f?f.data:f;return{ok:x,status:T,data:_,error:O}}i(Ut,"executeHostedTool");import Ie from"node:path";var U="default",ee=["apiKey","baseUrl","apiBaseUrl","chatApiBaseUrl","token","appId","conversationId"];function Nt(){return Ue()}i(Nt,"getConfigPath");function Ue(){return V(P()).config}i(Ue,"getGlobalConfigPath");function S(t,e){return Object.prototype.hasOwnProperty.call(t,e)}i(S,"hasOwn");function A(t){if(typeof t!="string")return null;let e=t.trim();return e.length>0?e:null}i(A,"normalizeHandle");function m(t){if(typeof t!="string")return null;let e=t.trim();return e?e.replace(/\/$/,""):null}i(m,"normalizeBaseUrl");function ae(t){let e=A(t);if(!e)throw new Error("profile handle must be non-empty");return e}i(ae,"requireHandle");function ve(t){if(typeof t!="string")throw new Error("apiKey must be a non-empty string");let e=t.trim();if(!e)throw new Error("apiKey must be a non-empty string");return e}i(ve,"requireApiKey");function C(t,e){let n=A(t),o=A(e);return!!(n&&o&&n.toLowerCase()===o.toLowerCase())}i(C,"handleEquals");function M(t,e,n){let o=m(n);return t.findIndex(r=>C(r.handle,e)?o?m(r.baseUrl)===o:!0:!1)}i(M,"findAccountIndex");function w(t){let e=A(t.handle)??U,n=m(t.baseUrl);return n?{handle:e,baseUrl:n}:{handle:e}}i(w,"selectorFromAccount");function b(t){if(!t||typeof t!="object"||Array.isArray(t))return null;let e=t,n=A(typeof e.handle=="string"?e.handle:void 0);if(!n)return null;let o=m(typeof e.baseUrl=="string"?e.baseUrl:void 0);return o?{handle:n,baseUrl:o}:{handle:n}}i(b,"sanitizeActiveProfile");function G(t){if(!t||typeof t!="object"||Array.isArray(t))return;let e=t,n=typeof e.repoPath=="string"?e.repoPath.trim():"",o=typeof e.profile=="string"&&e.profile.trim()?e.profile.trim():"default";if(!n)return;let r={repoPath:n,profile:o,mode:"local"};if(e.lastCheck&&typeof e.lastCheck=="object"&&!Array.isArray(e.lastCheck)){let s=e.lastCheck,a=s.command,l=s.status,p=s.checkedAt;(a==="inspect"||a==="build"||a==="validate"||a==="eval"||a==="run")&&(l==="passed"||l==="failed")&&typeof p=="string"&&(r.lastCheck={command:a,status:l,checkedAt:p,...typeof s.exitCode=="number"||s.exitCode===null?{exitCode:s.exitCode}:{},...typeof s.sourceHead=="string"||s.sourceHead===null?{sourceHead:s.sourceHead}:{}})}if(e.lastPush&&typeof e.lastPush=="object"&&!Array.isArray(e.lastPush)){let s=e.lastPush,a=s.status,l=s.pushedAt;(a==="pushed"||a==="failed")&&typeof l=="string"&&(r.lastPush={status:a,pushedAt:l,...typeof s.teamId=="string"||s.teamId===null?{teamId:s.teamId}:{},...typeof s.projectId=="string"||s.projectId===null?{projectId:s.projectId}:{},...typeof s.localHead=="string"||s.localHead===null?{localHead:s.localHead}:{},...typeof s.hostedHead=="string"||s.hostedHead===null?{hostedHead:s.hostedHead}:{},...typeof s.sourceRef=="string"||s.sourceRef===null?{sourceRef:s.sourceRef}:{},...s.promotionStatus==="uploaded"||s.promotionStatus==="hosted_source_materialized"||s.promotionStatus==="hosted_source_materialize_failed"||s.promotionStatus==="hosted_source_check_pending"||s.promotionStatus==="hosted_source_check_failed"||s.promotionStatus==="hosted_source_published"||s.promotionStatus==="hosted_source_publish_failed"||s.promotionStatus==="hosted_run_pending"||s.promotionStatus==="hosted_run_passed"||s.promotionStatus==="hosted_run_failed"||s.promotionStatus===null?{promotionStatus:s.promotionStatus}:{},...s.hostedRunStatus==="not_started"||s.hostedRunStatus==="running"||s.hostedRunStatus==="passed"||s.hostedRunStatus==="failed"||s.hostedRunStatus===null?{hostedRunStatus:s.hostedRunStatus}:{},...typeof s.hostedRunAgentId=="string"||s.hostedRunAgentId===null?{hostedRunAgentId:s.hostedRunAgentId}:{},...typeof s.hostedRunId=="string"||s.hostedRunId===null?{hostedRunId:s.hostedRunId}:{},...typeof s.hostedRunAt=="string"||s.hostedRunAt===null?{hostedRunAt:s.hostedRunAt}:{},...te(s.hostedSourceMaterialization)?{hostedSourceMaterialization:te(s.hostedSourceMaterialization)}:{},...ne(s.hostedSourceCheck)?{hostedSourceCheck:ne(s.hostedSourceCheck)}:{},...oe(s.hostedPublish)?{hostedPublish:oe(s.hostedPublish)}:{},...se(s.hostedRun)?{hostedRun:se(s.hostedRun)}:{},...typeof s.error=="string"||s.error===null?{error:s.error}:{}})}if(Array.isArray(e.profiles)){let s=e.profiles.flatMap(a=>{let l=G(a);if(!l)return[];let p=a,d=p.source==="github"||p.source==="openpond_git"?p.source:"local",h=typeof p.repositoryId=="string"&&p.repositoryId.trim()?p.repositoryId.trim():Ie.resolve(l.repoPath);return[{source:d,repositoryId:h,repoPath:l.repoPath,profile:l.profile,...l.lastCheck?{lastCheck:l.lastCheck}:{},...l.lastPush?{lastPush:l.lastPush}:{}}]});s.length>0&&(r.profiles=s)}return r}i(G,"sanitizeLocalOpenPondProfile");function te(t){if(!t||typeof t!="object"||Array.isArray(t))return null;let e=t,n=v(e.status);return n?{status:n,...u(e,"agentId"),...u(e,"runtimeAgentId"),...u(e,"projectId"),...u(e,"sourceRoot"),...u(e,"sourceRef"),...u(e,"sourceCommitSha"),...u(e,"manifestHash"),...u(e,"manifestPath"),...u(e,"manifestSyncedAt"),...re(e,"fileCount"),...re(e,"totalBytes"),...u(e,"generatedManifestPath"),...j(e,"synthesizedOpenPondYaml"),...u(e,"uploadMetadataPath"),...R(e,"setupCommands"),...R(e,"validationCommands"),...u(e,"materializedAt"),...u(e,"error")}:null}i(te,"sanitizeHostedMaterializationStatus");function ne(t){if(!t||typeof t!="object"||Array.isArray(t))return null;let e=t,n=v(e.status);return n?{status:n,...u(e,"agentId"),...u(e,"deployPlanStatus"),...j(e,"canRun"),...j(e,"canDeploy"),...u(e,"sourceRef"),...u(e,"sourceCommitSha"),...u(e,"manifestHash"),...u(e,"manifestPath"),...R(e,"setupCommands"),...R(e,"validationCommands"),...R(e,"requiredChecks"),...R(e,"evalNames"),...R(e,"blockedReasons"),...R(e,"staleReasons"),...u(e,"runtimeId"),...u(e,"sandboxId"),...R(e,"traceArtifactRefs"),...R(e,"evalResultArtifactRefs"),...R(e,"validatorArtifactRefs"),...u(e,"checkedAt"),...u(e,"error")}:null}i(ne,"sanitizeHostedSourceCheckStatus");function oe(t){if(!t||typeof t!="object"||Array.isArray(t))return null;let e=t,n=v(e.status);return n?{status:n,...u(e,"agentId"),...u(e,"snapshotId"),...u(e,"sourceRef"),...u(e,"sourceCommitSha"),...u(e,"manifestHash"),...u(e,"manifestPath"),...u(e,"buildStatus"),...u(e,"validationStatus"),...u(e,"evalStatus"),...u(e,"publishedAt"),...u(e,"error")}:null}i(oe,"sanitizeHostedPublishStatus");function se(t){if(!t||typeof t!="object"||Array.isArray(t))return null;let e=t,n=v(e.status);return n?{status:n,...u(e,"agentId"),...u(e,"runId"),...u(e,"runtimeId"),...u(e,"sandboxId"),...u(e,"sourceRef"),...u(e,"sourceCommitSha"),...u(e,"manifestHash"),...u(e,"setupGateStatus"),...R(e,"setupRequirementRefs"),...R(e,"artifactRefs"),...R(e,"traceArtifactRefs"),...R(e,"evalArtifactRefs"),...u(e,"startedAt"),...u(e,"completedAt"),...u(e,"error")}:null}i(se,"sanitizeHostedRunSummary");function u(t,e){let n=t[e];return typeof n=="string"||n===null?{[e]:n}:{}}i(u,"nullableStringProp");function j(t,e){let n=t[e];return typeof n=="boolean"||n===null?{[e]:n}:{}}i(j,"nullableBooleanProp");function re(t,e){let n=t[e];return typeof n=="number"||n===null?{[e]:n}:{}}i(re,"nullableNumberProp");function R(t,e){let n=t[e];if(!Array.isArray(n))return{};let o=n.filter(r=>typeof r=="string");return{[e]:o}}i(R,"stringArrayProp");function v(t){return typeof t=="string"&&t.trim()?t.trim():null}i(v,"stringField");function le(t,e){if(!C(t.handle,e.handle))return!1;let n=m(e.baseUrl);return n?m(t.baseUrl)===n:!m(t.baseUrl)}i(le,"accountMatchesSelector");function $(t,e,n={}){let o=m(e.baseUrl);if(o)return M(t,e.handle,o);let r=t.findIndex(a=>le(a,e));if(r!==-1)return r;let s=t.map((a,l)=>({account:a,index:l})).filter(({account:a})=>C(a.handle,e.handle));if(s.length>1&&n.requireUnambiguous)throw new Error(`multiple profiles found for ${e.handle}; pass --base-url to select one`);return s[0]?.index??-1}i($,"findAccountIndexForSelector");function $e(t){if(!t||typeof t!="object"||Array.isArray(t))return;let e=t,n={};return typeof e.token=="string"&&(n.token=e.token),(typeof e.appId=="string"||e.appId===null)&&(n.appId=e.appId),(typeof e.conversationId=="string"||e.conversationId===null)&&(n.conversationId=e.conversationId),Object.keys(n).length>0?n:void 0}i($e,"sanitizeSession");function _e(t){if(!t||typeof t!="object"||Array.isArray(t))return null;let e=t,n=A(typeof e.handle=="string"?e.handle:void 0);if(!n)return null;let o={handle:n};typeof e.apiKey=="string"&&(o.apiKey=e.apiKey),typeof e.baseUrl=="string"&&(o.baseUrl=e.baseUrl),typeof e.apiBaseUrl=="string"&&(o.apiBaseUrl=e.apiBaseUrl),typeof e.chatApiBaseUrl=="string"&&(o.chatApiBaseUrl=e.chatApiBaseUrl),typeof e.environment=="string"&&(o.environment=e.environment);let r=$e(e.session);return r&&(o.session=r),o}i(_e,"sanitizeAccount");function Be(t){let e={};return typeof t.token=="string"&&(e.token=t.token),(typeof t.appId=="string"||t.appId===null)&&(e.appId=t.appId),(typeof t.conversationId=="string"||t.conversationId===null)&&(e.conversationId=t.conversationId),Object.keys(e).length>0?e:void 0}i(Be,"extractLegacySession");function De(t,e){let n={handle:e};typeof t.apiKey=="string"&&(n.apiKey=t.apiKey),typeof t.baseUrl=="string"&&(n.baseUrl=t.baseUrl),typeof t.apiBaseUrl=="string"&&(n.apiBaseUrl=t.apiBaseUrl),typeof t.chatApiBaseUrl=="string"&&(n.chatApiBaseUrl=t.chatApiBaseUrl);let o=Be(t);return o&&(n.session=o),n}i(De,"extractLegacyAccount");function z(t){let e={};typeof t.lspEnabled=="boolean"&&(e.lspEnabled=t.lspEnabled),(t.executionMode==="local"||t.executionMode==="hosted")&&(e.executionMode=t.executionMode),(t.mode==="general"||t.mode==="builder")&&(e.mode=t.mode);let n=G(t.openpondProfile);n&&(e.openpondProfile=n);let o=[],r=Array.isArray(t.accounts)?t.accounts:[];for(let p of r){let d=_e(p);d&&M(o,d.handle,d.baseUrl)===-1&&o.push(d)}if(o.length===0){let p=b(t.activeProfile)?.handle||U;o.push(De(t,p))}let s=b(t.activeProfile),a=s?$(o,s):-1,l=o[a===-1?0:a];return e.accounts=o,e.activeProfile=w(l),e}i(z,"normalizeGlobalConfig");function ce(t,e,n){let o=t.accounts??[],r=m(n??process.env.OPENPOND_BASE_URL),s=A(e);if(s)return r?{handle:s,baseUrl:r}:{handle:s};let a=A(process.env.OPENPOND_ACCOUNT);if(a)return r?{handle:a,baseUrl:r}:{handle:a};let l=b(t.activeProfile);return l?r?{handle:l.handle,baseUrl:r}:l:o[0]?w(o[0]):{handle:U}}i(ce,"resolveRequestedProfile");function ue(t,e,n){let o=m(n);if(o){let s=M(t,e,o);if(s!==-1)return t[s]}else{let s=t.filter(a=>C(a.handle,e));if(s.length>1)throw new Error(`multiple profiles found for ${e}; pass --base-url to select one`);if(s.length===1)return s[0]}let r={handle:e};return o&&(r.baseUrl=o),t.push(r),r}i(ue,"ensureAccount");function ie(t){t.session&&Object.keys(t.session).length===0&&delete t.session}i(ie,"cleanupAccount");function qe(t,e,n,o){let r=n===null||n===void 0&&o.undefinedDeletes;switch(e){case"apiKey":{if(r){delete t.apiKey;return}typeof n=="string"&&(t.apiKey=n);return}case"baseUrl":{if(r){delete t.baseUrl;return}typeof n=="string"&&(t.baseUrl=n);return}case"apiBaseUrl":{if(r){delete t.apiBaseUrl;return}typeof n=="string"&&(t.apiBaseUrl=n);return}case"chatApiBaseUrl":{if(r){delete t.chatApiBaseUrl;return}typeof n=="string"&&(t.chatApiBaseUrl=n);return}case"token":case"appId":case"conversationId":{if(t.session||(t.session={}),r){delete t.session[e],ie(t);return}(typeof n=="string"||n===null)&&(t.session[e]=n),ie(t);return}}}i(qe,"applyScopedKey");function pe(t,e,n){if(!ee.some(p=>S(e,p)))return!1;let r=t.accounts??[],s=b(e.activeProfile)??ce(t),a=m(S(e,"baseUrl")?e.baseUrl??null:s.baseUrl??process.env.OPENPOND_BASE_URL),l=ue(r,s.handle,a);for(let p of ee)S(e,p)&&qe(l,p,e[p],n);return t.accounts=r,t.activeProfile=w(l),!0}i(pe,"applyAccountPatch");function de(t,e){if(S(e,"lspEnabled")&&(typeof e.lspEnabled=="boolean"?t.lspEnabled=e.lspEnabled:e.lspEnabled===null&&delete t.lspEnabled),S(e,"executionMode")&&(e.executionMode==="local"||e.executionMode==="hosted"?t.executionMode=e.executionMode:e.executionMode===null&&delete t.executionMode),S(e,"mode")&&(e.mode==="general"||e.mode==="builder"?t.mode=e.mode:e.mode===null&&delete t.mode),S(e,"activeProfile")){let n=b(e.activeProfile);if(n){let o=$(t.accounts??[],n);t.activeProfile=o===-1?n:w((t.accounts??[])[o])}else e.activeProfile===null&&delete t.activeProfile}if(S(e,"openpondProfile")){let n=G(e.openpondProfile);n?t.openpondProfile=n:e.openpondProfile===null&&delete t.openpondProfile}}i(de,"applyTopLevelPatch");async function Ne(t){let e=P();await L(e),await q(e,()=>t)}i(Ne,"writeGlobalConfig");async function K(t){let e=P();return await L(e),await q(e,n=>{let o=z(n);return t(o),o})}i(K,"updateGlobalConfig");async function fe(){let t=P();return await L(t),z(await W(t))}i(fe,"loadGlobalConfig");async function Ht(t={}){let e=await fe(),n=e.accounts??[],o=ce(e,t.account,t.baseUrl),r=$(n,o,{requireUnambiguous:!0}),s=r===-1?null:n[r],a=s?.session;return{...e,activeProfile:s?w(s):o,apiKey:s?.apiKey,baseUrl:s?.baseUrl,apiBaseUrl:s?.apiBaseUrl,chatApiBaseUrl:s?.chatApiBaseUrl,token:a?.token,appId:a?.appId,conversationId:a?.conversationId}}i(Ht,"loadConfig");async function me(){let t=await fe(),e=b(t.activeProfile);return(t.accounts??[]).map(n=>{let o=A(n.handle)??U;return{handle:o,baseUrl:m(n.baseUrl),apiBaseUrl:m(n.apiBaseUrl),chatApiBaseUrl:m(n.chatApiBaseUrl),environment:n.environment?.trim()||null,isActive:!!(e&&le({...n,handle:o},e)),hasApiKey:!!n.apiKey?.trim(),hasSessionToken:!!n.session?.token?.trim(),sessionAppId:n.session?.appId??null,sessionConversationId:n.session?.conversationId??null}})}i(me,"listConfiguredProfiles");async function jt(t,e={}){let n=ae(t),o=m(e.baseUrl),r=-1;await K(a=>{let l=a.accounts??[];if(r=$(l,o?{handle:n,baseUrl:o}:{handle:n},{requireUnambiguous:!0}),r===-1)throw new Error(`profile not found: ${n}`);a.activeProfile=w(l[r])});let s=await me();return s.find(a=>a.isActive)??s[r]}i(jt,"setActiveProfile");async function Mt(t){let e=ae(t.handle),n=ve(t.apiKey),o=m(t.baseUrl),r=m(t.apiBaseUrl),s=m(t.chatApiBaseUrl),a={handle:e};await K(d=>{let h=d.accounts??[],g=ue(h,e,o);g.apiKey=n,o&&(g.baseUrl=o),r?g.apiBaseUrl=r:t.apiBaseUrl===null&&delete g.apiBaseUrl,s?g.chatApiBaseUrl=s:t.chatApiBaseUrl===null&&delete g.chatApiBaseUrl,t.environment===null?delete g.environment:typeof t.environment=="string"&&t.environment.trim()&&(g.environment=t.environment.trim()),d.accounts=h,a=w(g),t.setActive!==!1&&(d.activeProfile=a)});let p=(await me()).find(d=>C(d.handle,a.handle)?o?m(d.baseUrl)===o:!0:!1);if(!p)throw new Error(`failed to save profile: ${e}`);return p}i(Mt,"saveProfileApiKey");async function Gt(t){let e=z(t);de(e,t),pe(e,t,{undefinedDeletes:!0}),await Ne(e)}i(Gt,"saveConfig");async function zt(t){await K(e=>{de(e,t),pe(e,t,{undefinedDeletes:!1})})}i(zt,"saveGlobalConfig");import{createHash as He}from"node:crypto";var je=3600*1e3;function J(t){return He("sha256").update(JSON.stringify([t.apiBase.replace(/\/$/,""),t.apiKey.trim()])).digest("hex")}i(J,"buildCacheKey");async function ge(t,e){let n=await Y(P(),t,J(e),{allowStale:!0});return!n||Date.now()-Date.parse(n.updatedAt)>=(e.ttlMs??je)?null:n.payload}i(ge,"cached");async function on(t){return ge("cloud.apps",t)}i(on,"getCachedApps");async function sn(t){await D(P(),"cloud.apps",J(t),t.apps)}i(sn,"setCachedApps");async function rn(t){return ge("cloud.tools",t)}i(rn,"getCachedTools");async function an(t){await D(P(),"cloud.tools",J(t),t.tools)}i(an,"setCachedTools");var un=["openpond-generic-v1","openpond-work-v1","openpond-coding-core-v1","openpond-agent-harness-v1"];export{c as a,Re as b,Pe as c,Ae as d,Se as e,we as f,xe as g,be as h,Te as i,We as j,Xe as k,Qe as l,Ze as m,et as n,tt as o,nt as p,ot as q,st as r,rt as s,it as t,at as u,lt as v,ct as w,ut as x,pt as y,dt as z,ft as A,mt as B,gt as C,ht as D,yt as E,Rt as F,Pt as G,At as H,St as I,wt as J,xt as K,bt as L,Ce as M,Tt as N,Ot as O,Et as P,Ct as Q,kt as R,Lt as S,It as T,Le as U,Ut as V,Nt as W,K as X,fe as Y,Ht as Z,me as _,jt as $,Mt as aa,Gt as ba,zt as ca,je as da,on as ea,sn as fa,rn as ga,an as ha,un as ia};
|
|
2
|
+
import{a as X,b as Q}from"./chunk-GLUWATL5.js";import{Ja as W,Ka as q,Ua as L,ya as Y,za as D}from"./chunk-NNLI4OWY.js";import{f as P,h as V}from"./chunk-H7IWJN7L.js";import{a as i}from"./chunk-FTQLQJQV.js";var I=class extends Error{constructor(n,o){super(`API request timed out after ${n}ms: ${o}`);this.timeoutMs=n;this.requestUrl=o;this.name="ApiTimeoutError"}timeoutMs;requestUrl;static{i(this,"ApiTimeoutError")}code="OPENPOND_API_TIMEOUT"},E=class extends Error{constructor(n,o){super(`API response exceeded ${n} bytes: ${o}`);this.maximumBytes=n;this.requestUrl=o;this.name="ApiResponseTooLargeError"}maximumBytes;requestUrl;static{i(this,"ApiResponseTooLargeError")}code="OPENPOND_API_RESPONSE_TOO_LARGE"},N=class extends Error{constructor(n,o,r,s=null){let a=s||o;super(`${r} failed: ${n}${a?` ${a}`:""}`);this.status=n;this.apiMessage=s;this.name="OpenPondApiError",this.code=o||"OPENPOND_API_ERROR"}status;apiMessage;static{i(this,"OpenPondApiError")}code};async function c(t,e,n,o={}){let{timeoutMs:r=3e4,maxResponseBytes:s=8388608,explicitBearerAuth:a=!1,...l}=o,p=`${t}${n}`,d=new Headers(l.headers);d.set("Content-Type","application/json");let h=a?void 0:process.env.OPENPOND_API_KEY,g=e?.trim()||"",f=!a&&g.startsWith("opk_"),k=h||(f?g:null);k&&!d.has("openpond-api-key")&&d.set("openpond-api-key",k),e?d.set("Authorization",f?`ApiKey ${g}`:`Bearer ${e}`):h&&!d.has("Authorization")&&d.set("Authorization",`ApiKey ${h}`);let x=new AbortController,T=new I(r,p),O=r>0?setTimeout(()=>x.abort(T),r):null;O?.unref?.();let _=ye(l.signal,x.signal,r),F=i(()=>{O&&clearTimeout(O)},"cleanup");try{let B=await fetch(p,{...l,headers:d,signal:_});return he(B,{cleanup:F,maximumBytes:s,requestUrl:p,timeoutController:x,timeoutError:T})}catch(B){throw F(),x.signal.aborted?T:B}}i(c,"apiFetch");async function y(t,e){let n;try{let o=await t.text();n=o?JSON.parse(o):{}}catch(o){if(o instanceof I||o instanceof E)throw o;n={}}if(!t.ok){let o=typeof n.error=="string"?n.error:null,r=typeof n.message=="string"?n.message:null;throw new N(t.status,o,e,r)}return n}i(y,"readApiJson");function he(t,e){if(!t.body)return e.cleanup(),t;let n=Number(t.headers.get("content-length"));if(e.maximumBytes>0&&Number.isFinite(n)&&n>e.maximumBytes)throw e.cleanup(),t.body.cancel(),new E(e.maximumBytes,e.requestUrl);let o=t.body.getReader(),r=0,s=new ReadableStream({async pull(a){try{let l=await o.read();if(l.done){e.cleanup(),a.close();return}if(r+=l.value.byteLength,e.maximumBytes>0&&r>e.maximumBytes){e.cleanup(),await o.cancel(),a.error(new E(e.maximumBytes,e.requestUrl));return}a.enqueue(l.value)}catch(l){e.cleanup(),a.error(e.timeoutController.signal.aborted?e.timeoutError:l)}},async cancel(a){e.cleanup(),await o.cancel(a)}});return new Response(s,{headers:t.headers,status:t.status,statusText:t.statusText})}i(he,"boundedResponse");function ye(t,e,n){return n<=0?t??void 0:t?AbortSignal.any([t,e]):e}i(ye,"composedSignal");async function Re(t,e,n,o,r){let s=await c(t,e,`/v4/apps/${n}/commits`,{method:"POST",body:JSON.stringify({files:o,message:r})});if(!s.ok){let a=await s.text().catch(()=>"");throw new Error(`Commit failed: ${s.status} ${a}`)}return await s.json()}i(Re,"commitFiles");async function Pe(t,e,n,o){let r=o?.environment??"production",s=await c(t,e,`/v4/apps/${n}/deployments`,{method:"POST",body:JSON.stringify({environment:r,...o?.commitSha?{commitSha:o.commitSha}:{},...o?.branch?{branch:o.branch}:{}})});if(!s.ok){let a=await s.text().catch(()=>"");throw new Error(`Deploy failed: ${s.status} ${a}`)}return await s.json()}i(Pe,"deployApp");async function Ae(t,e,n,o){let r=await c(t,e,`/v4/apps/${encodeURIComponent(n)}/deployments/promote-preview`,{method:"POST",body:JSON.stringify(o)});return y(r,"Preview promotion")}i(Ae,"promotePreviewToProduction");async function Se(t,e,n,o){let r=await c(t,e,`/v1/apps/${encodeURIComponent(n)}/lifecycle/start`,{method:"POST",body:JSON.stringify(o)});return y(r,"App lifecycle start")}i(Se,"startAppLifecycle");async function we(t,e,n){let o=await c(t,e,`/apps/deployments/${n}/logs`,{method:"GET"});if(!o.ok){let a=await o.text().catch(()=>"");throw new Error(`Deployment logs failed: ${o.status} ${a}`)}let r=await o.json().catch(()=>({}));return(Array.isArray(r.logs)?r.logs:[]).map(a=>{let l=typeof a.createdAt=="string"?a.createdAt:a.createdAt instanceof Date?a.createdAt.toISOString():new Date().toISOString();return{id:typeof a.id=="string"?a.id:`${Math.random()}`,type:typeof a.type=="string"?a.type:void 0,message:typeof a.message=="string"?a.message:"",createdAt:l}})}i(we,"getDeploymentLogs");async function xe(t,e,n){let o=await c(t,e,`/apps/deployments/${n}/status`,{method:"GET"});if(!o.ok){let s=await o.text().catch(()=>"");throw new Error(`Deployment status failed: ${o.status} ${s}`)}return{status:(await o.json().catch(()=>({}))).deployment?.status}}i(xe,"getDeploymentStatus");async function be(t,e,n,o){let r=new URLSearchParams;o?.status&&o.status.length>0&&r.set("status",o.status.join(",")),o?.createdAfter&&r.set("createdAfter",o.createdAfter),o?.branch&&r.set("branch",o.branch);let s=r.toString(),a=await c(t,e,`/apps/${n}/deployments/latest${s?`?${s}`:""}`,{method:"GET"});if(!a.ok){let p=await a.text().catch(()=>"");throw new Error(`Latest deployment lookup failed: ${a.status} ${p}`)}let l=await a.json().catch(()=>({}));return l.deployment?{id:l.deployment.id,status:l.deployment.status}:null}i(be,"getLatestDeploymentForApp");async function Te(t,e,n){let o=await c(t,e,`/apps/deployments/${n}`,{method:"GET"});if(!o.ok){let s=await o.text().catch(()=>"");throw new Error(`Deployment fetch failed: ${o.status} ${s}`)}return(await o.json().catch(()=>({}))).deployment??null}i(Te,"getDeploymentDetail");var Oe=new URL(Q).hostname,Ee=new URL(X).hostname;async function We(t,e,n){let o=new URLSearchParams;n?.handle&&o.set("handle",n.handle),typeof n?.limit=="number"&&Number.isFinite(n.limit)&&o.set("limit",String(Math.max(1,Math.floor(n.limit)))),typeof n?.offset=="number"&&Number.isFinite(n.offset)&&o.set("offset",String(Math.max(0,Math.floor(n.offset)))),typeof n?.includeScheduled=="boolean"&&o.set("includeScheduled",n.includeScheduled?"true":"false");let r=o.toString(),s=await c(t,e,`/apps/list${r?`?${r}`:""}`,{method:"GET"});if(!s.ok){let l=await s.text().catch(()=>"");throw new Error(`Apps list failed: ${s.status} ${l}`)}let a=await s.json().catch(()=>({}));return Array.isArray(a.apps)?a.apps:[]}i(We,"listApps");async function Xe(t,e,n){let o=await c(t,e,"/api/projects/local",{method:"POST",body:JSON.stringify(n)});if(!o.ok){let r=await o.text().catch(()=>"");throw new Error(`Create project failed: ${o.status} ${r}`)}return await o.json()}i(Xe,"createLocalProject");async function Qe(t,e,n){let o=await c(t,e,"/apps/repo/create",{method:"POST",body:JSON.stringify(n)});if(!o.ok){let r=await o.text().catch(()=>"");throw new Error(`Repo create failed: ${o.status} ${r}`)}return await o.json()}i(Qe,"createRepo");async function Ze(t,e,n,o){let r=await c(t,e,`/apps/${encodeURIComponent(n)}/code-visibility`,{method:"PATCH",body:JSON.stringify({codeVisibility:o})});if(!r.ok){let s=await r.text().catch(()=>"");throw new Error(`Code visibility update failed: ${r.status} ${s}`)}return await r.json()}i(Ze,"updateAppCodeVisibility");async function et(t,e,n,o){let r=await c(t,e,"/v4/apps/headless",{method:"POST",body:JSON.stringify({items:n,...o?{teamId:o}:{}})});if(!r.ok){let s=await r.text().catch(()=>"");throw new Error(`Headless create failed: ${r.status} ${s}`)}return await r.json()}i(et,"createHeadlessApps");async function tt(t,e,n){let o=await c(t,e,`/v4/apps/${n}/template/status`,{method:"GET"});if(!o.ok){let r=await o.text().catch(()=>"");throw new Error(`Template status failed: ${o.status} ${r}`)}return await o.json()}i(tt,"getTemplateStatus");async function nt(t,e,n){let o=await c(t,e,`/v4/apps/${n}/template/branches`,{method:"GET"});if(!o.ok){let r=await o.text().catch(()=>"");throw new Error(`Template branches failed: ${o.status} ${r}`)}return await o.json()}i(nt,"listTemplateBranches");async function ot(t,e,n,o){let r=await c(t,e,`/v4/apps/${n}/template/deploy-latest`,{method:"POST",body:JSON.stringify(o)});if(!r.ok){let s=await r.text().catch(()=>"");throw new Error(`Template deploy failed: ${r.status} ${s}`)}return await r.json()}i(ot,"deployLatestTemplate");async function st(t,e,n,o){let r=await c(t,e,`/v4/apps/${n}/environment`,{method:"POST",body:JSON.stringify(o)});if(!r.ok){let s=await r.text().catch(()=>"");throw new Error(`Environment update failed: ${r.status} ${s}`)}return await r.json()}i(st,"updateAppEnvironment");async function rt(t,e,n){let o=await c(t,e,`/v4/apps/${n}/environment`,{method:"GET"});if(!o.ok){let r=await o.text().catch(()=>"");throw new Error(`Environment get failed: ${o.status} ${r}`)}return await o.json()}i(rt,"getAppEnvironment");async function it(t,e){let n=await c(t,e,"/api/tools/manifest",{method:"GET"});if(!n.ok){let o=await n.text().catch(()=>"");throw new Error(`Manifest fetch failed: ${n.status} ${o}`)}return await n.json()}i(it,"fetchToolManifest");async function at(t,e){let n=await c(t,e,"/apps/tools",{method:"GET"});if(!n.ok){let o=await n.text().catch(()=>"");throw new Error(`Tools lookup failed: ${n.status} ${o}`)}return await n.json()}i(at,"listUserTools");async function lt(t,e,n){let o=await c(t,e,`/apps/${encodeURIComponent(n)}/schedules`,{method:"GET"});if(!o.ok){let s=await o.text().catch(()=>"");throw new Error(`Schedules lookup failed: ${o.status} ${s}`)}let r=await o.json().catch(()=>({}));return{schedules:Array.isArray(r.schedules)?r.schedules:[]}}i(lt,"listAppSchedules");async function ct(t,e,n={}){let o=new URLSearchParams;n.domain&&o.set("domain",n.domain),n.opentoolVersion&&o.set("opentoolVersion",n.opentoolVersion),typeof n.limit=="number"&&o.set("limit",String(n.limit));for(let a of n.tags??[])o.append("tag",a);let r=o.toString(),s=await c(t,e,`/v1/opentool/recipes${r?`?${r}`:""}`,{method:"GET"});return y(s,"OpenTool recipe list")}i(ct,"listOpenToolRecipes");async function ut(t,e,n){let o=await c(t,e,"/v1/opentool/recipes/search",{method:"POST",body:JSON.stringify(n)});return y(o,"OpenTool recipe search")}i(ut,"searchOpenToolRecipes");async function pt(t,e,n){let o=new URLSearchParams;typeof n.includeExamples=="boolean"&&o.set("includeExamples",String(n.includeExamples)),typeof n.includeTests=="boolean"&&o.set("includeTests",String(n.includeTests)),n.opentoolVersion&&o.set("opentoolVersion",n.opentoolVersion);let r=o.toString(),s=await c(t,e,`/v1/opentool/recipes/${encodeURIComponent(n.id)}${r?`?${r}`:""}`,{method:"GET"});return y(s,"OpenTool recipe get")}i(pt,"getOpenToolRecipe");async function dt(t,e,n){let o=await c(t,e,"/v1/opentool/rules",{method:"POST",body:JSON.stringify(n)});return y(o,"OpenTool rules get")}i(dt,"getOpenToolRules");function H(t){let e=new URLSearchParams;typeof t=="number"&&Number.isFinite(t)&&e.set("limit",String(Math.max(1,Math.floor(t))));let n=e.toString();return n?`?${n}`:""}i(H,"buildLimitQuery");function Z(t){if(Array.isArray(t))return t;if(!t||typeof t!="object")return[];let e=t;return Array.isArray(e.logs)?e.logs:Array.isArray(e.runs)?e.runs:Array.isArray(e.scheduleRuns)?e.scheduleRuns:Array.isArray(e.items)?e.items:[]}i(Z,"normalizeScheduleExecutionLogs");async function ft(t,e,n,o){let r={...o?.preferredScheduleId?{preferredScheduleId:o.preferredScheduleId}:{},...o?.scheduleId?{scheduleId:o.scheduleId}:{},...o?.startAt?{startAt:o.startAt}:{},...o&&"endAt"in o?{endAt:o.endAt??null}:{}},s=await c(t,e,`/apps/${encodeURIComponent(n)}/schedules/start`,{method:"POST",body:JSON.stringify(r)});return y(s,"Schedule start")}i(ft,"startAppSchedules");async function mt(t,e,n){let o=await c(t,e,`/apps/${encodeURIComponent(n)}/schedules/stop`,{method:"POST",body:JSON.stringify({})});return y(o,"Schedule stop")}i(mt,"stopAppSchedules");async function gt(t,e){let n=await c(t,e,"/apps/schedules/current/stop",{method:"POST",body:JSON.stringify({})});return y(n,"Current schedule stop")}i(gt,"stopCurrentAppSchedules");async function ht(t,e,n){let o=await c(t,e,"/v1/schedules/run",{method:"POST",body:JSON.stringify({scheduleId:n.scheduleId})});return y(o,"Schedule run")}i(ht,"runScheduleNow");async function yt(t,e,n,o){let r=await c(t,e,`/apps/${encodeURIComponent(n)}/schedules/${encodeURIComponent(o)}`,{method:"DELETE"});return y(r,"Schedule delete")}i(yt,"deleteOrArchiveSchedule");async function Rt(t,e,n,o){let r=await c(t,e,`/v1/schedules/${encodeURIComponent(n)}/execution-logs${H(o?.limit)}`,{method:"GET"}),s=await y(r,"Schedule execution logs");return{logs:Z(s)}}i(Rt,"listScheduleExecutionLogs");async function Pt(t,e,n,o){let r=await c(t,e,`/v1/deployments/${encodeURIComponent(n)}/schedule-execution-logs${H(o?.limit)}`,{method:"GET"}),s=await y(r,"Deployment schedule execution logs");return{logs:Z(s)}}i(Pt,"listDeploymentScheduleExecutionLogs");async function At(t,e,n){let o=await c(t,e,`/v1/schedule-execution-logs/${encodeURIComponent(n)}`,{method:"GET"});return y(o,"Schedule execution log")}i(At,"getScheduleExecutionLog");async function St(t,e,n,o){let r=await c(t,e,`/v1/apps/${encodeURIComponent(n)}/execution-timeline${H(o?.limit)}`,{method:"GET"});return y(r,"App execution timeline")}i(St,"getAppExecutionTimeline");async function wt(t,e,n){return c(t,e,"/apps/agent/create",{method:"POST",body:JSON.stringify(n)})}i(wt,"createAgentFromPrompt");async function xt(t,e,n){let o=new URLSearchParams;n?.appId&&o.set("appId",n.appId);let r=o.toString(),s=await c(t,e,`/apps/performance${r?`?${r}`:""}`,{method:"GET"});if(!s.ok){let a=await s.text().catch(()=>"");throw new Error(`Performance lookup failed: ${s.status} ${a}`)}return await s.json()}i(xt,"getUserPerformance");async function bt(t,e,n){let o=new URLSearchParams({appId:n}),r=await c(t,e,`/apps/summary?${o.toString()}`,{method:"GET"});if(!r.ok){let s=await r.text().catch(()=>"");throw new Error(`Summary lookup failed: ${r.status} ${s}`)}return await r.json()}i(bt,"getAppRuntimeSummary");async function Ce(t,e){let n=await c(t,e,"/v1/account",{method:"GET"});if(!n.ok){let o=await n.text().catch(()=>"");throw new Error(`Account lookup failed: ${n.status} ${o}`)}return await n.json()}i(Ce,"getOpenPondAccount");async function Tt(t,e){let n=new Date().toISOString(),o=Date.now(),r=t.replace(/\/$/,"");try{let s=await c(r,null,"/health",{method:"GET",headers:{Accept:"application/json"}}),a=Date.now()-o,l=await s.json().catch(()=>({})),p=null,d=null;if(e?.trim())try{let h=await Ce(r,e);p=!0,d=h.account}catch{p=!1}return{reachable:s.ok,authenticated:p,apiBase:r,latencyMs:a,status:s.status,service:typeof l.service=="string"?l.service:null,checkedAt:n,account:d,...s.ok?{}:{error:s.statusText||`HTTP ${s.status}`}}}catch(s){return{reachable:!1,authenticated:e?.trim()?!1:null,apiBase:r,latencyMs:Date.now()-o,status:null,service:null,checkedAt:n,error:s instanceof Error?s.message:String(s)}}}i(Tt,"checkOpenPondApiHealth");async function Ot(t,e,n){let o=await c(t,e,"/apps/assistant/run",{method:"POST",body:JSON.stringify(n)});if(!o.ok){let r=await o.text().catch(()=>"");throw new Error(`Assistant run failed: ${o.status} ${r}`)}return await o.json()}i(Ot,"runAssistantMode");async function Et(t,e,n){let o=await c(t,e,"/apps/agent/digest",{method:"POST",body:JSON.stringify(n)});if(!o.ok){let r=await o.text().catch(()=>"");throw new Error(`Agent digest failed: ${o.status} ${r}`)}return await o.json()}i(Et,"postAgentDigest");async function Ct(t,e,n){let o=await c(t,e,"/apps/tools/execute",{method:"POST",body:JSON.stringify(n)}),r=await o.text().catch(()=>""),s=null;try{s=r?JSON.parse(r):null}catch{s=r}return o.ok?{ok:!0,status:o.status,data:s}:{ok:!1,status:o.status,error:s&&typeof s=="object"&&"error"in s?String(s.error):r||o.statusText}}i(Ct,"executeUserTool");async function kt(t,e,n){let o=await c(t,e,"/apps/backtests/run",{method:"POST",body:JSON.stringify(n)});if(!o.ok){let r=await o.text().catch(()=>"");throw new Error(`Backtest run failed: ${o.status} ${r}`)}return await o.json()}i(kt,"submitBacktestRun");async function Lt(t,e,n){let o=n.query&&Object.keys(n.query).length>0?`?${new URLSearchParams(n.query).toString()}`:"",r=await c(t,e,`/apps/backtests/tx${o}`,{method:n.method,body:n.method==="POST"&&n.body!==void 0?JSON.stringify(n.body):void 0});if(!r.ok){let s=await r.text().catch(()=>"");throw new Error(`Backtests request failed: ${r.status} ${s}`)}return await r.json()}i(Lt,"submitBacktestTx");async function It(t,e,n){let o=new URLSearchParams(n).toString(),r=await c(t,e,`/apps/backtests/detail?${o}`,{method:"GET"});if(!r.ok){let s=await r.text().catch(()=>"");throw new Error(`Backtest detail failed: ${r.status} ${s}`)}return await r.json()}i(It,"submitBacktestDetail");function ke(t){let e=t.trim().replace(/^\/+/,"");return encodeURIComponent(e||"tool")}i(ke,"normalizeToolPathSegment");function Le(t){let e=t.replace(/\/$/,""),n=process.env.OPENPOND_TOOL_URL;if(n)return n.replace(/\/$/,"");try{let o=new URL(e),r=o.hostname.toLowerCase(),s=r==="apps.openpond.live"?null:r===Oe||r===Ee||r==="openpond.live"||r==="www.openpond.live"?"https://apps.openpond.live":null;if(s)return s;let a=r==="localhost"||r==="127.0.0.1",l=o.port||(o.protocol==="https:"?"443":"80");if(a&&l==="3000")return e}catch{}return e}i(Le,"resolveWorkerBaseUrl");async function Ut(t,e,n){let o=Le(t),r=ke(n.toolName),a=`${n.deploymentId?`/${n.appId}/deployments/${n.deploymentId}`:`/${n.appId}`}/${r}`,l=new Headers(n.headers||{}),p=n.method??"POST",d=n.body===void 0||p==="GET"?void 0:JSON.stringify(n.body),h=await c(o,e,a,{method:p,body:d,headers:l}),g=await h.text().catch(()=>""),f=null;try{f=g?JSON.parse(g):null}catch{f=g}let k=f&&typeof f=="object"&&"ok"in f?!!f.ok:!0,x=h.ok&&k,T=f&&typeof f=="object"&&"status"in f&&Number(f.status)||h.status,O=f&&typeof f=="object"&&"error"in f?String(f.error):h.ok?void 0:g||h.statusText,_=f&&typeof f=="object"&&"data"in f?f.data:f;return{ok:x,status:T,data:_,error:O}}i(Ut,"executeHostedTool");import Ie from"node:path";var U="default",ee=["apiKey","baseUrl","apiBaseUrl","chatApiBaseUrl","token","appId","conversationId"];function Nt(){return Ue()}i(Nt,"getConfigPath");function Ue(){return V(P()).config}i(Ue,"getGlobalConfigPath");function S(t,e){return Object.prototype.hasOwnProperty.call(t,e)}i(S,"hasOwn");function A(t){if(typeof t!="string")return null;let e=t.trim();return e.length>0?e:null}i(A,"normalizeHandle");function m(t){if(typeof t!="string")return null;let e=t.trim();return e?e.replace(/\/$/,""):null}i(m,"normalizeBaseUrl");function ae(t){let e=A(t);if(!e)throw new Error("profile handle must be non-empty");return e}i(ae,"requireHandle");function ve(t){if(typeof t!="string")throw new Error("apiKey must be a non-empty string");let e=t.trim();if(!e)throw new Error("apiKey must be a non-empty string");return e}i(ve,"requireApiKey");function C(t,e){let n=A(t),o=A(e);return!!(n&&o&&n.toLowerCase()===o.toLowerCase())}i(C,"handleEquals");function M(t,e,n){let o=m(n);return t.findIndex(r=>C(r.handle,e)?o?m(r.baseUrl)===o:!0:!1)}i(M,"findAccountIndex");function w(t){let e=A(t.handle)??U,n=m(t.baseUrl);return n?{handle:e,baseUrl:n}:{handle:e}}i(w,"selectorFromAccount");function b(t){if(!t||typeof t!="object"||Array.isArray(t))return null;let e=t,n=A(typeof e.handle=="string"?e.handle:void 0);if(!n)return null;let o=m(typeof e.baseUrl=="string"?e.baseUrl:void 0);return o?{handle:n,baseUrl:o}:{handle:n}}i(b,"sanitizeActiveProfile");function G(t){if(!t||typeof t!="object"||Array.isArray(t))return;let e=t,n=typeof e.repoPath=="string"?e.repoPath.trim():"",o=typeof e.profile=="string"&&e.profile.trim()?e.profile.trim():"default";if(!n)return;let r={repoPath:n,profile:o,mode:"local"};if(e.lastCheck&&typeof e.lastCheck=="object"&&!Array.isArray(e.lastCheck)){let s=e.lastCheck,a=s.command,l=s.status,p=s.checkedAt;(a==="inspect"||a==="build"||a==="validate"||a==="eval"||a==="run")&&(l==="passed"||l==="failed")&&typeof p=="string"&&(r.lastCheck={command:a,status:l,checkedAt:p,...typeof s.exitCode=="number"||s.exitCode===null?{exitCode:s.exitCode}:{},...typeof s.sourceHead=="string"||s.sourceHead===null?{sourceHead:s.sourceHead}:{}})}if(e.lastPush&&typeof e.lastPush=="object"&&!Array.isArray(e.lastPush)){let s=e.lastPush,a=s.status,l=s.pushedAt;(a==="pushed"||a==="failed")&&typeof l=="string"&&(r.lastPush={status:a,pushedAt:l,...typeof s.teamId=="string"||s.teamId===null?{teamId:s.teamId}:{},...typeof s.projectId=="string"||s.projectId===null?{projectId:s.projectId}:{},...typeof s.localHead=="string"||s.localHead===null?{localHead:s.localHead}:{},...typeof s.hostedHead=="string"||s.hostedHead===null?{hostedHead:s.hostedHead}:{},...typeof s.sourceRef=="string"||s.sourceRef===null?{sourceRef:s.sourceRef}:{},...s.promotionStatus==="uploaded"||s.promotionStatus==="hosted_source_materialized"||s.promotionStatus==="hosted_source_materialize_failed"||s.promotionStatus==="hosted_source_check_pending"||s.promotionStatus==="hosted_source_check_failed"||s.promotionStatus==="hosted_source_published"||s.promotionStatus==="hosted_source_publish_failed"||s.promotionStatus==="hosted_run_pending"||s.promotionStatus==="hosted_run_passed"||s.promotionStatus==="hosted_run_failed"||s.promotionStatus===null?{promotionStatus:s.promotionStatus}:{},...s.hostedRunStatus==="not_started"||s.hostedRunStatus==="running"||s.hostedRunStatus==="passed"||s.hostedRunStatus==="failed"||s.hostedRunStatus===null?{hostedRunStatus:s.hostedRunStatus}:{},...typeof s.hostedRunAgentId=="string"||s.hostedRunAgentId===null?{hostedRunAgentId:s.hostedRunAgentId}:{},...typeof s.hostedRunId=="string"||s.hostedRunId===null?{hostedRunId:s.hostedRunId}:{},...typeof s.hostedRunAt=="string"||s.hostedRunAt===null?{hostedRunAt:s.hostedRunAt}:{},...te(s.hostedSourceMaterialization)?{hostedSourceMaterialization:te(s.hostedSourceMaterialization)}:{},...ne(s.hostedSourceCheck)?{hostedSourceCheck:ne(s.hostedSourceCheck)}:{},...oe(s.hostedPublish)?{hostedPublish:oe(s.hostedPublish)}:{},...se(s.hostedRun)?{hostedRun:se(s.hostedRun)}:{},...typeof s.error=="string"||s.error===null?{error:s.error}:{}})}if(Array.isArray(e.profiles)){let s=e.profiles.flatMap(a=>{let l=G(a);if(!l)return[];let p=a,d=p.source==="github"||p.source==="openpond_git"?p.source:"local",h=typeof p.repositoryId=="string"&&p.repositoryId.trim()?p.repositoryId.trim():Ie.resolve(l.repoPath);return[{source:d,repositoryId:h,repoPath:l.repoPath,profile:l.profile,...l.lastCheck?{lastCheck:l.lastCheck}:{},...l.lastPush?{lastPush:l.lastPush}:{}}]});s.length>0&&(r.profiles=s)}return r}i(G,"sanitizeLocalOpenPondProfile");function te(t){if(!t||typeof t!="object"||Array.isArray(t))return null;let e=t,n=v(e.status);return n?{status:n,...u(e,"agentId"),...u(e,"runtimeAgentId"),...u(e,"projectId"),...u(e,"sourceRoot"),...u(e,"sourceRef"),...u(e,"sourceCommitSha"),...u(e,"manifestHash"),...u(e,"manifestPath"),...u(e,"manifestSyncedAt"),...re(e,"fileCount"),...re(e,"totalBytes"),...u(e,"generatedManifestPath"),...j(e,"synthesizedOpenPondYaml"),...u(e,"uploadMetadataPath"),...R(e,"setupCommands"),...R(e,"validationCommands"),...u(e,"materializedAt"),...u(e,"error")}:null}i(te,"sanitizeHostedMaterializationStatus");function ne(t){if(!t||typeof t!="object"||Array.isArray(t))return null;let e=t,n=v(e.status);return n?{status:n,...u(e,"agentId"),...u(e,"deployPlanStatus"),...j(e,"canRun"),...j(e,"canDeploy"),...u(e,"sourceRef"),...u(e,"sourceCommitSha"),...u(e,"manifestHash"),...u(e,"manifestPath"),...R(e,"setupCommands"),...R(e,"validationCommands"),...R(e,"requiredChecks"),...R(e,"evalNames"),...R(e,"blockedReasons"),...R(e,"staleReasons"),...u(e,"runtimeId"),...u(e,"sandboxId"),...R(e,"traceArtifactRefs"),...R(e,"evalResultArtifactRefs"),...R(e,"validatorArtifactRefs"),...u(e,"checkedAt"),...u(e,"error")}:null}i(ne,"sanitizeHostedSourceCheckStatus");function oe(t){if(!t||typeof t!="object"||Array.isArray(t))return null;let e=t,n=v(e.status);return n?{status:n,...u(e,"agentId"),...u(e,"snapshotId"),...u(e,"sourceRef"),...u(e,"sourceCommitSha"),...u(e,"manifestHash"),...u(e,"manifestPath"),...u(e,"buildStatus"),...u(e,"validationStatus"),...u(e,"evalStatus"),...u(e,"publishedAt"),...u(e,"error")}:null}i(oe,"sanitizeHostedPublishStatus");function se(t){if(!t||typeof t!="object"||Array.isArray(t))return null;let e=t,n=v(e.status);return n?{status:n,...u(e,"agentId"),...u(e,"runId"),...u(e,"runtimeId"),...u(e,"sandboxId"),...u(e,"sourceRef"),...u(e,"sourceCommitSha"),...u(e,"manifestHash"),...u(e,"setupGateStatus"),...R(e,"setupRequirementRefs"),...R(e,"artifactRefs"),...R(e,"traceArtifactRefs"),...R(e,"evalArtifactRefs"),...u(e,"startedAt"),...u(e,"completedAt"),...u(e,"error")}:null}i(se,"sanitizeHostedRunSummary");function u(t,e){let n=t[e];return typeof n=="string"||n===null?{[e]:n}:{}}i(u,"nullableStringProp");function j(t,e){let n=t[e];return typeof n=="boolean"||n===null?{[e]:n}:{}}i(j,"nullableBooleanProp");function re(t,e){let n=t[e];return typeof n=="number"||n===null?{[e]:n}:{}}i(re,"nullableNumberProp");function R(t,e){let n=t[e];if(!Array.isArray(n))return{};let o=n.filter(r=>typeof r=="string");return{[e]:o}}i(R,"stringArrayProp");function v(t){return typeof t=="string"&&t.trim()?t.trim():null}i(v,"stringField");function le(t,e){if(!C(t.handle,e.handle))return!1;let n=m(e.baseUrl);return n?m(t.baseUrl)===n:!m(t.baseUrl)}i(le,"accountMatchesSelector");function $(t,e,n={}){let o=m(e.baseUrl);if(o)return M(t,e.handle,o);let r=t.findIndex(a=>le(a,e));if(r!==-1)return r;let s=t.map((a,l)=>({account:a,index:l})).filter(({account:a})=>C(a.handle,e.handle));if(s.length>1&&n.requireUnambiguous)throw new Error(`multiple profiles found for ${e.handle}; pass --base-url to select one`);return s[0]?.index??-1}i($,"findAccountIndexForSelector");function $e(t){if(!t||typeof t!="object"||Array.isArray(t))return;let e=t,n={};return typeof e.token=="string"&&(n.token=e.token),(typeof e.appId=="string"||e.appId===null)&&(n.appId=e.appId),(typeof e.conversationId=="string"||e.conversationId===null)&&(n.conversationId=e.conversationId),Object.keys(n).length>0?n:void 0}i($e,"sanitizeSession");function _e(t){if(!t||typeof t!="object"||Array.isArray(t))return null;let e=t,n=A(typeof e.handle=="string"?e.handle:void 0);if(!n)return null;let o={handle:n};typeof e.apiKey=="string"&&(o.apiKey=e.apiKey),typeof e.baseUrl=="string"&&(o.baseUrl=e.baseUrl),typeof e.apiBaseUrl=="string"&&(o.apiBaseUrl=e.apiBaseUrl),typeof e.chatApiBaseUrl=="string"&&(o.chatApiBaseUrl=e.chatApiBaseUrl),typeof e.environment=="string"&&(o.environment=e.environment);let r=$e(e.session);return r&&(o.session=r),o}i(_e,"sanitizeAccount");function Be(t){let e={};return typeof t.token=="string"&&(e.token=t.token),(typeof t.appId=="string"||t.appId===null)&&(e.appId=t.appId),(typeof t.conversationId=="string"||t.conversationId===null)&&(e.conversationId=t.conversationId),Object.keys(e).length>0?e:void 0}i(Be,"extractLegacySession");function De(t,e){let n={handle:e};typeof t.apiKey=="string"&&(n.apiKey=t.apiKey),typeof t.baseUrl=="string"&&(n.baseUrl=t.baseUrl),typeof t.apiBaseUrl=="string"&&(n.apiBaseUrl=t.apiBaseUrl),typeof t.chatApiBaseUrl=="string"&&(n.chatApiBaseUrl=t.chatApiBaseUrl);let o=Be(t);return o&&(n.session=o),n}i(De,"extractLegacyAccount");function z(t){let e={};typeof t.lspEnabled=="boolean"&&(e.lspEnabled=t.lspEnabled),(t.executionMode==="local"||t.executionMode==="hosted")&&(e.executionMode=t.executionMode),(t.mode==="general"||t.mode==="builder")&&(e.mode=t.mode);let n=G(t.openpondProfile);n&&(e.openpondProfile=n);let o=[],r=Array.isArray(t.accounts)?t.accounts:[];for(let p of r){let d=_e(p);d&&M(o,d.handle,d.baseUrl)===-1&&o.push(d)}if(o.length===0){let p=b(t.activeProfile)?.handle||U;o.push(De(t,p))}let s=b(t.activeProfile),a=s?$(o,s):-1,l=o[a===-1?0:a];return e.accounts=o,e.activeProfile=w(l),e}i(z,"normalizeGlobalConfig");function ce(t,e,n){let o=t.accounts??[],r=m(n??process.env.OPENPOND_BASE_URL),s=A(e);if(s)return r?{handle:s,baseUrl:r}:{handle:s};let a=A(process.env.OPENPOND_ACCOUNT);if(a)return r?{handle:a,baseUrl:r}:{handle:a};let l=b(t.activeProfile);return l?r?{handle:l.handle,baseUrl:r}:l:o[0]?w(o[0]):{handle:U}}i(ce,"resolveRequestedProfile");function ue(t,e,n){let o=m(n);if(o){let s=M(t,e,o);if(s!==-1)return t[s]}else{let s=t.filter(a=>C(a.handle,e));if(s.length>1)throw new Error(`multiple profiles found for ${e}; pass --base-url to select one`);if(s.length===1)return s[0]}let r={handle:e};return o&&(r.baseUrl=o),t.push(r),r}i(ue,"ensureAccount");function ie(t){t.session&&Object.keys(t.session).length===0&&delete t.session}i(ie,"cleanupAccount");function qe(t,e,n,o){let r=n===null||n===void 0&&o.undefinedDeletes;switch(e){case"apiKey":{if(r){delete t.apiKey;return}typeof n=="string"&&(t.apiKey=n);return}case"baseUrl":{if(r){delete t.baseUrl;return}typeof n=="string"&&(t.baseUrl=n);return}case"apiBaseUrl":{if(r){delete t.apiBaseUrl;return}typeof n=="string"&&(t.apiBaseUrl=n);return}case"chatApiBaseUrl":{if(r){delete t.chatApiBaseUrl;return}typeof n=="string"&&(t.chatApiBaseUrl=n);return}case"token":case"appId":case"conversationId":{if(t.session||(t.session={}),r){delete t.session[e],ie(t);return}(typeof n=="string"||n===null)&&(t.session[e]=n),ie(t);return}}}i(qe,"applyScopedKey");function pe(t,e,n){if(!ee.some(p=>S(e,p)))return!1;let r=t.accounts??[],s=b(e.activeProfile)??ce(t),a=m(S(e,"baseUrl")?e.baseUrl??null:s.baseUrl??process.env.OPENPOND_BASE_URL),l=ue(r,s.handle,a);for(let p of ee)S(e,p)&&qe(l,p,e[p],n);return t.accounts=r,t.activeProfile=w(l),!0}i(pe,"applyAccountPatch");function de(t,e){if(S(e,"lspEnabled")&&(typeof e.lspEnabled=="boolean"?t.lspEnabled=e.lspEnabled:e.lspEnabled===null&&delete t.lspEnabled),S(e,"executionMode")&&(e.executionMode==="local"||e.executionMode==="hosted"?t.executionMode=e.executionMode:e.executionMode===null&&delete t.executionMode),S(e,"mode")&&(e.mode==="general"||e.mode==="builder"?t.mode=e.mode:e.mode===null&&delete t.mode),S(e,"activeProfile")){let n=b(e.activeProfile);if(n){let o=$(t.accounts??[],n);t.activeProfile=o===-1?n:w((t.accounts??[])[o])}else e.activeProfile===null&&delete t.activeProfile}if(S(e,"openpondProfile")){let n=G(e.openpondProfile);n?t.openpondProfile=n:e.openpondProfile===null&&delete t.openpondProfile}}i(de,"applyTopLevelPatch");async function Ne(t){let e=P();await L(e),await q(e,()=>t)}i(Ne,"writeGlobalConfig");async function K(t){let e=P();return await L(e),await q(e,n=>{let o=z(n);return t(o),o})}i(K,"updateGlobalConfig");async function fe(){let t=P();return await L(t),z(await W(t))}i(fe,"loadGlobalConfig");async function Ht(t={}){let e=await fe(),n=e.accounts??[],o=ce(e,t.account,t.baseUrl),r=$(n,o,{requireUnambiguous:!0}),s=r===-1?null:n[r],a=s?.session;return{...e,activeProfile:s?w(s):o,apiKey:s?.apiKey,baseUrl:s?.baseUrl,apiBaseUrl:s?.apiBaseUrl,chatApiBaseUrl:s?.chatApiBaseUrl,token:a?.token,appId:a?.appId,conversationId:a?.conversationId}}i(Ht,"loadConfig");async function me(){let t=await fe(),e=b(t.activeProfile);return(t.accounts??[]).map(n=>{let o=A(n.handle)??U;return{handle:o,baseUrl:m(n.baseUrl),apiBaseUrl:m(n.apiBaseUrl),chatApiBaseUrl:m(n.chatApiBaseUrl),environment:n.environment?.trim()||null,isActive:!!(e&&le({...n,handle:o},e)),hasApiKey:!!n.apiKey?.trim(),hasSessionToken:!!n.session?.token?.trim(),sessionAppId:n.session?.appId??null,sessionConversationId:n.session?.conversationId??null}})}i(me,"listConfiguredProfiles");async function jt(t,e={}){let n=ae(t),o=m(e.baseUrl),r=-1;await K(a=>{let l=a.accounts??[];if(r=$(l,o?{handle:n,baseUrl:o}:{handle:n},{requireUnambiguous:!0}),r===-1)throw new Error(`profile not found: ${n}`);a.activeProfile=w(l[r])});let s=await me();return s.find(a=>a.isActive)??s[r]}i(jt,"setActiveProfile");async function Mt(t){let e=ae(t.handle),n=ve(t.apiKey),o=m(t.baseUrl),r=m(t.apiBaseUrl),s=m(t.chatApiBaseUrl),a={handle:e};await K(d=>{let h=d.accounts??[],g=ue(h,e,o);g.apiKey=n,o&&(g.baseUrl=o),r?g.apiBaseUrl=r:t.apiBaseUrl===null&&delete g.apiBaseUrl,s?g.chatApiBaseUrl=s:t.chatApiBaseUrl===null&&delete g.chatApiBaseUrl,t.environment===null?delete g.environment:typeof t.environment=="string"&&t.environment.trim()&&(g.environment=t.environment.trim()),d.accounts=h,a=w(g),t.setActive!==!1&&(d.activeProfile=a)});let p=(await me()).find(d=>C(d.handle,a.handle)?o?m(d.baseUrl)===o:!0:!1);if(!p)throw new Error(`failed to save profile: ${e}`);return p}i(Mt,"saveProfileApiKey");async function Gt(t){let e=z(t);de(e,t),pe(e,t,{undefinedDeletes:!0}),await Ne(e)}i(Gt,"saveConfig");async function zt(t){await K(e=>{de(e,t),pe(e,t,{undefinedDeletes:!1})})}i(zt,"saveGlobalConfig");import{createHash as He}from"node:crypto";var je=3600*1e3;function J(t){return He("sha256").update(JSON.stringify([t.apiBase.replace(/\/$/,""),t.apiKey.trim()])).digest("hex")}i(J,"buildCacheKey");async function ge(t,e){let n=await Y(P(),t,J(e),{allowStale:!0});return!n||Date.now()-Date.parse(n.updatedAt)>=(e.ttlMs??je)?null:n.payload}i(ge,"cached");async function on(t){return ge("cloud.apps",t)}i(on,"getCachedApps");async function sn(t){await D(P(),"cloud.apps",J(t),t.apps)}i(sn,"setCachedApps");async function rn(t){return ge("cloud.tools",t)}i(rn,"getCachedTools");async function an(t){await D(P(),"cloud.tools",J(t),t.tools)}i(an,"setCachedTools");var un=["openpond-generic-v1","openpond-work-v1","openpond-coding-core-v1","openpond-agent-harness-v1"];export{c as a,Re as b,Pe as c,Ae as d,Se as e,we as f,xe as g,be as h,Te as i,We as j,Xe as k,Qe as l,Ze as m,et as n,tt as o,nt as p,ot as q,st as r,rt as s,it as t,at as u,lt as v,ct as w,ut as x,pt as y,dt as z,ft as A,mt as B,gt as C,ht as D,yt as E,Rt as F,Pt as G,At as H,St as I,wt as J,xt as K,bt as L,Ce as M,Tt as N,Ot as O,Et as P,Ct as Q,kt as R,Lt as S,It as T,Le as U,Ut as V,Nt as W,K as X,fe as Y,Ht as Z,me as _,jt as $,Mt as aa,Gt as ba,zt as ca,je as da,on as ea,sn as fa,rn as ga,an as ha,un as ia};
|
|
@@ -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,
|
|
2
|
+
import{b as Q,c as Z,t as ee,y as oe}from"./chunk-KRNLKKN6.js";import{a as T,b as X,h as K}from"./chunk-EEBLJPIB.js";import{n as te,p as re}from"./chunk-LLJI6QAY.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>
|
|
@@ -20,7 +20,7 @@ for(const [id,action] of [['preview','preview'],['migrate','migrate'],['restart'
|
|
|
20
20
|
el('diagnostics').onclick=()=>{if(!state)return;const blob=new Blob([JSON.stringify({issue:state.issue,migration:state.migration,config:{path:state.config.path,rawRevision:state.config.rawRevision,issue:state.config.issue}},null,2)],{type:'application/json'});const a=document.createElement('a');a.href=URL.createObjectURL(blob);a.download='openpond-recovery-diagnostics.json';a.click();URL.revokeObjectURL(a.href)};
|
|
21
21
|
el('retry').onclick=async()=>{try{await request('/v1/recovery',{action:'retry'});message('Starting OpenPond\u2026');const timer=setInterval(async()=>{try{const h=await(await fetch('/health')).json();if(!h.recovery){clearInterval(timer);const next=new URLSearchParams(location.hash.slice(1)).get('returnTo');if(next){const u=new URL(next);if(['localhost','127.0.0.1','[::1]'].includes(u.hostname)){location.replace(u.toString());return}}location.reload();}}catch{}},500)}catch(e){message(e)}};
|
|
22
22
|
(async()=>{const params=new URLSearchParams(location.hash.slice(1));token=params.get('openpondToken')||'';if(!token&&window.openpond?.getConnection)token=(await window.openpond.getConnection()).token;if(!token){message('Open the authenticated recovery URL from the launcher.');return}await load()})().catch(message);
|
|
23
|
-
</script></html>`}s(pe,"startupRecoveryPage");var
|
|
23
|
+
</script></html>`}s(pe,"startupRecoveryPage");var _e=i.strictObject({action:i.enum(["preview","migrate","restart","retry"]),sourceAppHome:i.string().optional(),sourceConfig:i.string().optional(),resolutions:V.optional()});function ue(e){return e instanceof N&&/^(PRIVATE_STORAGE_|UNSAFE_STORAGE_|INVALID_CONFIG|CONFIG_|MIGRATION_|SOURCE_CHANGED_|CREDENTIAL_|UNSUPPORTED_STORAGE_|INVALID_MIGRATION_|INVALID_ACCOUNT_|MISSING_INSTRUCTION_|INVALID_PROFILE_|DATABASE_RECOVERY_)/.test(e.issue.code)}s(ue,"isRecoverableStartupError");async function de(e,t,r){let o=/^(UNSUPPORTED_STORAGE_|INVALID_MIGRATION_|UNSAFE_STORAGE_|PRIVATE_STORAGE_)/.test(r.issue.code),l=o?await U.mkdtemp(Ae.join(Ee.tmpdir(),"openpond-recovery-")):e;return Q(l,async()=>{let{token:n,tokenFile:g}=await oe(l),w=ne(e),p=r.issue,d,y=new Promise(u=>{d=u}),v=Ie((u,f)=>{(async()=>{let a=new URL(u.url??"/","http://127.0.0.1");if(!ae(u,f).allowed){h(f,403,{error:"Origin not allowed"});return}if(u.method==="OPTIONS"){h(f,204,{});return}if(u.method==="GET"&&a.pathname==="/health"){h(f,200,{ok:!0,server:"openpond-app-server",version:X,recovery:!0});return}if(u.method==="GET"&&a.pathname==="/"){let m=Te(18).toString("base64");f.writeHead(200,{"Content-Type":"text/html; charset=utf-8","Cache-Control":"no-store","Content-Security-Policy":`default-src 'none'; script-src 'nonce-${m}'; style-src 'nonce-${m}'; connect-src 'self'; base-uri 'none'; frame-ancestors 'none'`}),f.end(pe(m));return}if(!le(u,a,n)){h(f,401,{error:"Unauthorized"});return}let c=!o;if(u.method==="GET"&&a.pathname==="/v1/recovery"){h(f,200,{issue:p,configEditable:c,config:o?{path:R(e).config,text:null,rawRevision:"unavailable",issue:p,recoverableRevisions:[]}:await w.status(),migration:await J(e).catch(m=>({issue:C(m,e)}))});return}if(u.method==="POST"&&a.pathname==="/v1/configuration"&&c){h(f,200,await w.mutate(await _(u)));return}if(u.method==="POST"&&a.pathname==="/v1/recovery"){let m=_e.parse(await _(u));if(o&&m.action!=="retry"&&m.action!=="preview")throw r;if(m.action==="restart"){h(f,200,await F(e));return}if(m.action==="preview"||m.action==="migrate"){h(f,200,await I(e,{sourceAppHome:m.sourceAppHome,sourceConfig:m.sourceConfig,resolutions:m.resolutions,dryRun:m.action==="preview"}));return}await I(e),await E(e),h(f,200,{ready:!0}),d();return}h(f,503,{error:`${p.message} ${p.action}`,issue:p,recovery:!0})})().catch(a=>{p=C(a,e),h(f,422,{error:`${p.message} ${p.action}`,issue:p})})});await new Promise((u,f)=>{v.once("error",f),v.listen(t,"127.0.0.1",()=>{v.off("error",f),u()})});let O=v.address().port,P=`http://127.0.0.1:${O}`;return await Z(l,P,"startup-recovery"),{url:P,port:O,token:n,tokenFile:g,storePath:R(e).database,repaired:y,close:s(async()=>{v.closeIdleConnections(),await new Promise((u,f)=>v.close(a=>a?f(a):u())),o&&await U.rm(l,{recursive:!0,force:!0})},"close")}}).catch(async n=>{throw o&&await U.rm(l,{recursive:!0,force:!0}),n})}s(de,"startRecoveryServer");import{existsSync as Ue}from"node:fs";import b from"node:path";import{fileURLToPath as Ne}from"node:url";var fe=b.dirname(Ne(import.meta.url));function S(e,t,r){let o=e[t+1];if(!o||o.startsWith("--"))throw new Error(`${r} requires a value.`);return o}s(S,"requireValue");function ge(e,t){let r=Number.parseInt(e,10);if(!Number.isFinite(r)||r<0||r>65535)throw new Error(`${t} must be a port from 0 to 65535.`);return r}s(ge,"parsePort");function we(e){let t="serve",r=T,o=17874,l=null,n=!1,g=!1,w=null,p,d=null,y=null,v=null,O=null,P=0,u=e[0];if(u&&!u.startsWith("-")){if(u==="serve"||u==="server")t="serve";else if(u==="app-server")t="app-server";else if(u==="web")t="web";else{if(u==="help")return{mode:t,host:r,port:o,webRoot:l,openBrowser:n,printAccessUrl:g,storeDir:w,help:!0};throw new Error(`Unknown command: ${u}`)}P=1}for(let a=P;a<e.length;a+=1){let c=e[a];if(c==="--help"||c==="-h")return{mode:t,host:r,port:o,webRoot:l,openBrowser:n,printAccessUrl:g,storeDir:w,help:!0};if(c==="--listen"){let m=K(S(e,a,c));r=m.host,o=ge(String(m.port),c),a+=1}else if(c==="--hostname"||c==="--host")r=S(e,a,c),a+=1;else if(c==="--port")o=ge(S(e,a,c),c),a+=1;else if(c==="--web-root")l=b.resolve(S(e,a,c)),a+=1;else if(c==="--source-browser-state")p=b.resolve(S(e,a,c)),a+=1;else{if(c==="--store-dir")throw new Error("--store-dir has been replaced by --home. Use --home <directory> or OPENPOND_HOME.");if(c==="--home")w=b.resolve(S(e,a,c)),a+=1;else if(c==="--profile-source-root")d=b.resolve(S(e,a,c)),a+=1;else if(c==="--profile-repository-id")y=S(e,a,c),a+=1;else if(c==="--profile-id")v=S(e,a,c),a+=1;else if(c==="--profile-revision")O=S(e,a,c),a+=1;else if(c==="--open-browser")n=!0;else if(c==="--print-access-url")g=!0;else throw new Error(`Unknown option: ${c}`)}}if(n&&g)throw new Error("--open-browser and --print-access-url cannot be used together.");if(t!=="web"&&(n||g))throw new Error("Browser options are only available in web mode.");let f=[d,y,v,O].filter(Boolean).length;if(f&&(f!==4||t!=="app-server"))throw new Error("Profile source flags require app-server mode and --profile-source-root, --profile-repository-id, --profile-id, and --profile-revision together.");return{mode:t,host:r,port:o,webRoot:l,openBrowser:n,printAccessUrl:g,storeDir:w,sourceBrowserState:p,...f?{profileSource:{repoPath:d,repositoryId:y,profileId:v,sourceRevision:O}}:{},help:!1}}s(we,"parseCliArgs");function ke(){return[process.env.OPENPOND_WEB_ROOT,b.resolve(process.cwd(),"apps/web/dist"),b.resolve(fe,"../../web/dist"),b.resolve(process.cwd(),"web"),b.resolve(fe,"../web")].filter(e=>!!e)}s(ke,"defaultWebRootCandidates");function Le(e){let t=e?[e]:ke();for(let r of t){let o=b.resolve(r);if(Ue(b.join(o,"index.html")))return o}return null}s(Le,"resolveWebRoot");function Be(e){let t=e==="0.0.0.0"||e==="::"?"127.0.0.1":e;return t.includes(":")&&!t.startsWith("[")?`[${t}]`:t}s(Be,"formatHostForUrl");function De(e){return`http://${Be(e.status.host)}:${e.status.port}`}s(De,"browserBaseUrl");function He(e,t){let r=new URL(e),o=new URLSearchParams;return o.set("openpondServerUrl",e),o.set("openpondToken",t),r.hash=o.toString(),r.toString()}s(He,"tokenizedWebUrl");async function me(e,t=re){let r=He(e.baseUrl,e.token);if(e.printAccessUrl)return{stdout:[`OpenPond access URL: ${r}`],stderr:[]};if(!e.openBrowser)return{stdout:[`OpenPond web UI: ${e.baseUrl}`],stderr:[]};let o=await t(r);return o.opened?{stdout:[`Opened OpenPond in your browser: ${e.baseUrl}`],stderr:[]}:{stdout:[`OpenPond access URL: ${r}`],stderr:[`Could not open the system browser: ${o.error}`]}}s(me,"resolveWebLaunchMessages");function he(){console.log(`Usage:
|
|
24
24
|
openpond-app-server serve [--hostname HOST] [--port PORT]
|
|
25
25
|
openpond-app-server app-server [--home DIR]
|
|
26
26
|
openpond-app-server web [--hostname HOST] [--port PORT] [--web-root DIR]
|
|
@@ -31,6 +31,10 @@ Options:
|
|
|
31
31
|
--port PORT Bind port, or 0 for any free port (default ${17874})
|
|
32
32
|
--web-root DIR Directory containing the built web UI for web mode
|
|
33
33
|
--home DIR Local app-server state directory
|
|
34
|
+
--profile-source-root DIR Authorized Profile repository source for app-server
|
|
35
|
+
--profile-repository-id ID Source repository identity supplied by the host
|
|
36
|
+
--profile-id ID Profile within that source
|
|
37
|
+
--profile-revision REV Accepted immutable source revision
|
|
34
38
|
--open-browser Open the authenticated web URL in the system browser
|
|
35
39
|
--print-access-url Print the authenticated URL instead of opening it
|
|
36
|
-
`)}s(he,"printHelp");async function bt(e){let t=we(process.argv.slice(2));if(t.help){he();return}let r=t.mode==="web"?Le(t.webRoot):null;if(t.mode==="web"&&!r)throw new Error("Could not find a built OpenPond web UI. Run `pnpm build:web` or pass --web-root.");if(t.mode==="app-server"){await ye(e.createOpenPondAppServer,t.storeDir);return}t.storeDir&&(process.env.OPENPOND_HOME=t.storeDir);let o,
|
|
40
|
+
`)}s(he,"printHelp");async function bt(e){let t=we(process.argv.slice(2));if(t.help){he();return}let r=t.mode==="web"?Le(t.webRoot):null;if(t.mode==="web"&&!r)throw new Error("Could not find a built OpenPond web UI. Run `pnpm build:web` or pass --web-root.");if(t.mode==="app-server"){await ye(e.createOpenPondAppServer,t.storeDir,t.profileSource);return}t.storeDir&&(process.env.OPENPOND_HOME=t.storeDir);let o,l=t.port;for(;;)try{o=await e.createOpenPondServer({host:t.host,port:l,webRoot:r,sourceBrowserState:t.sourceBrowserState,...t.storeDir?{storeDir:t.storeDir}:{},httpEnabled:!0});break}catch(p){if(!ue(p))throw p;let d=await de(k({home:t.storeDir??void 0}),l,p);l=d.port,console.log(`OPENPOND_APP_SERVER_READY ${JSON.stringify({mode:"recovery",url:d.url,tokenFile:d.tokenFile,storePath:d.storePath})}`),console.error(`${p.issue.code}: ${p.issue.message} ${p.issue.action}`);let y=await me({baseUrl:d.url,openBrowser:t.openBrowser,printAccessUrl:t.printAccessUrl,token:d.token});for(let O of y.stdout)console.log(O);for(let O of y.stderr)console.error(O);let v=s(()=>{d.close().finally(()=>process.exit(0))},"close");process.once("SIGINT",v),process.once("SIGTERM",v);try{await d.repaired}finally{process.off("SIGINT",v),process.off("SIGTERM",v),await d.close()}}let n=t.mode==="web"?De(o):null;if(console.log(`OPENPOND_APP_SERVER_READY ${JSON.stringify({mode:t.mode,url:o.url,webUrl:null,webRoot:r,tokenFile:o.tokenFile,storePath:o.storePath,runtime:te()})}`),n){let p=await me({baseUrl:n,openBrowser:t.openBrowser,printAccessUrl:t.printAccessUrl,token:o.token});for(let d of p.stderr)console.error(d);for(let d of p.stdout)console.log(d)}else console.log(`OpenPond API server: ${o.url}`);let g=!1,w=s(async()=>{g||(g=!0,await o.close(),process.exit(0))},"shutdown");process.on("SIGINT",()=>{w()}),process.on("SIGTERM",()=>{w()}),await new Promise(()=>{})}s(bt,"runOpenPondServerCli");async function Ot(e){let t=process.argv.slice(2),r=we(!t[0]||t[0].startsWith("-")?["app-server",...t]:t);if(r.help){he();return}if(r.mode!=="app-server")throw new Error("The app-server entrypoint only accepts the app-server command.");await ye(e,r.storeDir,r.profileSource)}s(Ot,"runOpenPondAppServerCli");async function ye(e,t,r){t&&(process.env.OPENPOND_HOME=t);let o=await e({...t?{storeDir:t}:{},...r?{profileSource:r}:{}});await ee({appServer:o,readable:process.stdin,writable:process.stdout})}s(ye,"runAgentServer");export{ne as a,x as b,ae as c,h as d,Je as e,Fe as f,_ as g,le as h,me as i,bt as j,Ot as k};
|