openpond 0.2.9 → 0.2.11
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 +2 -0
- package/dist/app-server.js +1 -1
- package/dist/chunks/{app-layer-SFV6ZPKZ.js → app-layer-Y7SEYQCA.js} +1 -1
- package/dist/chunks/{app-server-runtime-RBWHBX7T.js → app-server-runtime-R7O7EWVF.js} +1 -1
- package/dist/chunks/{apps-SR7CAM42.js → apps-HSS4KWPK.js} +1 -1
- package/dist/chunks/{chunk-QOR55VHT.js → chunk-2I4W24NK.js} +1 -1
- package/dist/chunks/{chunk-LLJI6QAY.js → chunk-3DJF6IZ7.js} +1 -1
- package/dist/chunks/{chunk-5N6YRABR.js → chunk-3T5XJEDM.js} +2 -2
- package/dist/chunks/{chunk-KRNLKKN6.js → chunk-5NGYLR3V.js} +2 -2
- package/dist/chunks/{chunk-LFL4M4DL.js → chunk-B3RE35SQ.js} +1 -1
- package/dist/chunks/{chunk-WDE3KN3N.js → chunk-ENCAWWFY.js} +318 -318
- package/dist/chunks/{chunk-S64WASAO.js → chunk-GA7VBKCH.js} +14 -14
- package/dist/chunks/chunk-J2MP4LSF.js +2 -0
- package/dist/chunks/{chunk-4LLHOG7L.js → chunk-LCKCUSP7.js} +1 -1
- package/dist/chunks/{chunk-RQLWYR5B.js → chunk-RPS53CGT.js} +1 -1
- package/dist/chunks/{chunk-DY5RF2YE.js → chunk-WW5SGVGJ.js} +1 -1
- package/dist/chunks/{cli-3LLBTPP5.js → cli-KSVNPTUC.js} +1 -1
- package/dist/chunks/{configuration-command-EBN7RH3X.js → configuration-command-QFJTY4ZU.js} +1 -1
- package/dist/chunks/{core-commands-2S4UQPXW.js → core-commands-TO3M5MO4.js} +1 -1
- package/dist/chunks/{desktop-test-WN7ZLQVQ.js → desktop-test-5SU5G4FN.js} +1 -1
- package/dist/chunks/{extension-ERM5EUUO.js → extension-DCZ5DPRY.js} +1 -1
- package/dist/chunks/{help-N25BKIHM.js → help-IHCPRO43.js} +1 -1
- package/dist/chunks/{opchat-V4A4WCND.js → opchat-YQVCNDDK.js} +1 -1
- package/dist/chunks/{organizations-TSOT7MDT.js → organizations-TJAS5AO2.js} +1 -1
- package/dist/chunks/{profile-3JQ3XM6Q.js → profile-2XAUWXP5.js} +1 -1
- package/dist/chunks/{project-agent-S76FWVPV.js → project-agent-EN66WJBL.js} +1 -1
- package/dist/chunks/{sandbox-command-YQDGQBBQ.js → sandbox-command-LYUXPY4U.js} +1 -1
- package/dist/chunks/{sandbox-template-GM2A3437.js → sandbox-template-HXH2CSY4.js} +1 -1
- package/dist/chunks/{src-BC7WOVGF.js → src-4DML3FLR.js} +1 -1
- package/dist/chunks/src-KE3LWA75.js +319 -0
- package/dist/chunks/{teams-bot-M6QLZAHA.js → teams-bot-YH7QUK2N.js} +1 -1
- package/dist/chunks/{workspaces-ZWG55DFE.js → workspaces-DC33D43W.js} +1 -1
- package/dist/cli.js +1 -1
- package/dist/web/assets/{App-Dx38Dhlo.js → App-Br9-pOIC.js} +15 -15
- package/dist/web/assets/{AppDialog-DdWbnFnr.js → AppDialog-C6Xd84LF.js} +1 -1
- package/dist/web/assets/{AppTerminalPanel-BotH-2y4.js → AppTerminalPanel-CjLTHGd7.js} +2 -2
- package/dist/web/assets/{AppsView-B3ybXi71.js → AppsView-BaOXLPG_.js} +1 -1
- package/dist/web/assets/{BrowserSidebar-CLE27mjT.js → BrowserSidebar-C1UHkaci.js} +1 -1
- package/dist/web/assets/{CartesianChart-SB3Jq3CQ.js → CartesianChart-CC6gURj1.js} +1 -1
- package/dist/web/assets/{CollaborationTabs-C3jO5y5v.js → CollaborationTabs-D3v9jxIV.js} +1 -1
- package/dist/web/assets/{CommandMenu-DqtJane1.js → CommandMenu-DZJ4xot1.js} +1 -1
- package/dist/web/assets/{CommunityView-Dg02tZmL.js → CommunityView-VElVyeHB.js} +1 -1
- package/dist/web/assets/{ComposerCreateImproveStrip-BTJhG8aU.js → ComposerCreateImproveStrip-D_Pldm1h.js} +1 -1
- package/dist/web/assets/{GetStartedView-BlyP6VY8.js → GetStartedView-Ciy_6VB-.js} +1 -1
- package/dist/web/assets/HostedModelLearningReview-__PVEYUw.js +1 -0
- package/dist/web/assets/{HostedModelLearningSettings-CiY2K8Fz.js → HostedModelLearningSettings-Cba2jDOj.js} +1 -1
- package/dist/web/assets/{LabModelVersionDetailPage-cE1kuSWk.js → LabModelVersionDetailPage-YGGjl8dY.js} +1 -1
- package/dist/web/assets/{LabSkillSidebar-BrSa3H3m.js → LabSkillSidebar-D55wufz-.js} +1 -1
- package/dist/web/assets/{LabsRoute-CY7rB25U.js → LabsRoute-BvJAvcAo.js} +4 -4
- package/dist/web/assets/{MainChatThread-BM8l-LiB.js → MainChatThread-CQ9hEgUz.js} +2 -2
- package/dist/web/assets/{MainPane-CsAYR_EF.js → MainPane-CH2CUmxD.js} +4 -4
- package/dist/web/assets/{MarkdownText-8GA7g1qR.js → MarkdownText-B7CT2cwK.js} +1 -1
- package/dist/web/assets/{Messages-CX08x24k.js → Messages-9_Bf5Lii.js} +1 -1
- package/dist/web/assets/{NativeSkillSidebar-mSz4GlxA.js → NativeSkillSidebar-BIpYM4uF.js} +1 -1
- package/dist/web/assets/{NewExperienceSwitcher-CHAC2Zid.js → NewExperienceSwitcher-D6RLDRgD.js} +1 -1
- package/dist/web/assets/{NewProjectDialog-5B17C6Vh.js → NewProjectDialog-DlnYnpsm.js} +1 -1
- package/dist/web/assets/{OutputsPage-27Gp1K5N.js → OutputsPage-D1JY14ij.js} +1 -1
- package/dist/web/assets/{ProjectsPage-DJpPuKBP.js → ProjectsPage-kRy0z4oP.js} +1 -1
- package/dist/web/assets/{RightChatPanelStack-C_4rbc1i.js → RightChatPanelStack-D0Zdekbb.js} +1 -1
- package/dist/web/assets/{RightSidebarHomePanel-PHndCapL.js → RightSidebarHomePanel-BCW78Zbx.js} +1 -1
- package/dist/web/assets/{ScheduledWorkPage-CYQZ0Zal.js → ScheduledWorkPage-D2iewjFh.js} +1 -1
- package/dist/web/assets/{SettingsView-CAH0vreE.css → SettingsView-CLSg--Vp.css} +1 -1
- package/dist/web/assets/SettingsView-JjtvXV3D.js +9 -0
- package/dist/web/assets/{TeamChatView-DRvqhiOV.js → TeamChatView-BhcWyJXF.js} +1 -1
- package/dist/web/assets/{TerminalOverlay-C8FbaVVP.js → TerminalOverlay-GXVklUL1.js} +1 -1
- package/dist/web/assets/{TrainingCreationPanel-BGsd95vF.js → TrainingCreationPanel-DPEt3Kcq.js} +1 -1
- package/dist/web/assets/{TrainingDraftPanel-Bm6j-IuS.js → TrainingDraftPanel-BiYk2Ti6.js} +1 -1
- package/dist/web/assets/{UsageSettingsSection-CTCDOE-_.js → UsageSettingsSection-DOR-WjP_.js} +1 -1
- package/dist/web/assets/{WorkSidebarPanel-UaymQC_e.js → WorkSidebarPanel-MFyj6kAC.js} +1 -1
- package/dist/web/assets/{WorkspaceDiffPanel-D6mKLQha.js → WorkspaceDiffPanel-Dhk5IRNe.js} +3 -3
- package/dist/web/assets/{WorkspaceEnvironmentMenu-C4Uw5qMA.js → WorkspaceEnvironmentMenu-CR-2HGxj.js} +1 -1
- package/dist/web/assets/{WorkspaceGitDialogs--t9VpTCT.js → WorkspaceGitDialogs-YTvn4Rpj.js} +1 -1
- package/dist/web/assets/{WorkspaceMonacoEditor-CElU0vIN.js → WorkspaceMonacoEditor-C_NHJaDf.js} +3 -3
- package/dist/web/assets/{arrow-up-right-C0HJHPjq.js → arrow-up-right-B_joTAq0.js} +1 -1
- package/dist/web/assets/{chat-file-links-D5q1as_h.js → chat-file-links-CtG3brZZ.js} +1 -1
- package/dist/web/assets/chevron-up-BKSpg6hY.js +1 -0
- package/dist/web/assets/{clipboard-wiphvxrN.js → clipboard-BuMCABK6.js} +1 -1
- package/dist/web/assets/{cloud-upload-Bgm5_SSr.js → cloud-upload-Cx6hdgxq.js} +1 -1
- package/dist/web/assets/{cssMode-DudNT1l3.js → cssMode-DgBmbKa2.js} +1 -1
- package/dist/web/assets/{folder-open-DLuZSDXn.js → folder-open-CbqwcgQ4.js} +1 -1
- package/dist/web/assets/{folder-plus-DXN0q9GR.js → folder-plus-DsZqlrho.js} +1 -1
- package/dist/web/assets/{git-commit-horizontal-CdiI4K5M.js → git-commit-horizontal-DI-UCrjd.js} +1 -1
- package/dist/web/assets/{htmlMode-B2sAXhgB.js → htmlMode-BuyogX60.js} +1 -1
- package/dist/web/assets/{index-DSK9XSir.js → index-BPeus0zA.js} +2 -2
- package/dist/web/assets/{info-DcmIP9D3.js → info-Csd_7rfz.js} +1 -1
- package/dist/web/assets/{jsonMode-aQlrpuz5.js → jsonMode-DflDpOXZ.js} +1 -1
- package/dist/web/assets/{lspLanguageFeatures-BMskOvs7.js → lspLanguageFeatures-C_Z8VeHY.js} +1 -1
- package/dist/web/assets/{minimize-2-CvKd6Q_r.js → minimize-2-CiM53hsa.js} +1 -1
- package/dist/web/assets/{monaco.contribution-BSRllZgB.js → monaco.contribution-BINeU8ff.js} +2 -2
- package/dist/web/assets/{monaco.contribution-VS3RCwFP.js → monaco.contribution-CGcq8kux.js} +2 -2
- package/dist/web/assets/{monaco.contribution-BHv_qQG9.js → monaco.contribution-CRL61P2H.js} +2 -2
- package/dist/web/assets/{monaco.contribution-tZUXzebU.js → monaco.contribution-JwSEb0Jo.js} +2 -2
- package/dist/web/assets/{play-BzfQJMmu.js → play-DkIcSdr1.js} +1 -1
- package/dist/web/assets/{python-Bm9eN64d.js → python--dgmZUVn.js} +1 -1
- package/dist/web/assets/{refresh-cw-Cvy0BqFv.js → refresh-cw-DgmxGLBV.js} +1 -1
- package/dist/web/assets/{save-miVdIz56.js → save-C_D7xpZD.js} +1 -1
- package/dist/web/assets/{square-DlJ_-dur.js → square-BcHQSDWK.js} +1 -1
- package/dist/web/assets/{toggleHighContrast-B8jte8Lm.js → toggleHighContrast-8waBinRS.js} +1 -1
- package/dist/web/assets/{tsMode-CmAPBzqb.js → tsMode-BBuDuuGt.js} +1 -1
- package/dist/web/assets/{upload-C71OnfRd.js → upload-C7vLlEEp.js} +1 -1
- package/dist/web/assets/{useLocalAgentSchedules-D9hDhAba.js → useLocalAgentSchedules-Bjl2NojO.js} +1 -1
- package/dist/web/assets/{wifi-off-DhI7P9WW.js → wifi-off-BLh536Wc.js} +1 -1
- package/dist/web/assets/{workers-BDI2xQio.js → workers-B6wHgIsA.js} +1 -1
- package/dist/web/assets/{yaml-DNSpZj5_.js → yaml-8rW7oQNv.js} +1 -1
- package/dist/web/index.html +1 -1
- package/package.json +1 -1
- package/dist/chunks/chunk-ADMQIREX.js +0 -2
- package/dist/chunks/src-KNUCNVBC.js +0 -319
- package/dist/web/assets/HostedModelLearningReview-BwSAO9y6.js +0 -1
- package/dist/web/assets/SettingsView-DQPMLKNH.js +0 -9
- package/dist/web/assets/chevron-up-B3Cyo8SJ.js +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
+
import{a as n}from"./chunk-FTQLQJQV.js";var s="127.0.0.1";var f="0.2.11",m="You are OpenPond Chat. Respond in the user's language. If the user's latest message is language-neutral, ambiguous, or only a short test, respond in English. Be concise and directly answer the latest request. Do not use emojis. Use Markdown when it improves scanability. If you emit reasoning or thinking content, keep it sparse and user-readable: at most one short sentence for major progress, decisions, or blockers. Omit reasoning for routine searches, reads, tool calls, and obvious next steps. Do not restate the user request, narrate every action, or include code blocks, code excerpts, diffs, raw tool payloads, or markdown examples in reasoning. Put necessary code or exact snippets only in the final assistant answer. When the user asks to show or preview an image that is available as a workspace path or signed image URL, use Markdown image syntax like  instead of a bare path or raw HTML. For workspace-backed answers, use a Codex-style shape: brief outcome first, then Changed Files if files changed, then Verification if checks ran. End with a concise final answer that summarizes the result and verification when relevant. Do not mention raw tool JSON, internal repo paths, or origin/remote URLs unless the user explicitly asks for them or they are necessary to explain a git/deploy failure.";import{randomUUID as p}from"node:crypto";import i from"node:path";import{fileURLToPath as c}from"node:url";function u(){return new Date().toISOString()}n(u,"now");function l(e){if(typeof e=="string")return e;if(e instanceof Error)return e.message||e.name;if(e==null)return"";try{return JSON.stringify(e)}catch{return String(e)}}n(l,"textFromUnknown");function w(e){if(!e||typeof e!="object")return"";let t=e;for(let r of["delta","text","output","chunk","message"])if(typeof t[r]=="string")return t[r];return t.delta&&typeof t.delta=="object"?l(t.delta):""}n(w,"extractDelta");function x(e){return{id:p(),timestamp:u(),...e}}n(x,"event");function k(e){let t=e.replace(/^https?:\/\//,""),[r,o]=t.split(":");return{host:r||s,port:o?Number.parseInt(o,10):17874}}n(k,"parseListen");function b(e){return(process.argv[1]?i.resolve(process.argv[1]):"")===i.resolve(c(e))}n(b,"isCliEntrypoint");export{s as a,f as b,m as c,u as d,l as e,w as f,x as g,k as h,b as i};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{A as F,a as fe,b as L,c as R,d as me,e as D,f as G,g as j,h as z,j as ye,l as T,m as we,n as S,o as he,y as B}from"./chunk-G2VYRU27.js";import{b as H,c as be,d as ve,f as w,h as P,i as Re}from"./chunk-ZVOO7FKM.js";import{$ as ge,M as ce,N as le,R as de,V as pe,Z as y,_ as ue,aa as C,h as $,i as ne,l as oe,n as re,o as ie,p as ae,q as se}from"./chunk-SS3EG6S2.js";import{a as Z,b as ee,c as te}from"./chunk-5N6YRABR.js";import{a as M,f as v,k as X}from"./chunk-3M53YXEI.js";import{a as g}from"./chunk-FTQLQJQV.js";import{promises as V,existsSync as W}from"node:fs";import U from"node:path";import{stdin as $e}from"node:process";async function Ge(e,o){let t=await y(),r=w(t),n=P(t),i=await R(t,r),{app:a}=await T(n,i,o),s=await ie(n,i,a.id);console.log(JSON.stringify(s,null,2))}g(Ge,"runTemplateStatus");async function je(e,o){let t=await y(),r=w(t),n=P(t),i=await R(t,r),{app:a}=await T(n,i,o),s=await ae(n,i,a.id);console.log(JSON.stringify(s,null,2))}g(je,"runTemplateBranches");async function ze(e,o){let t=await y(),r=w(t),n=P(t),i=await R(t,r),{app:a}=await T(n,i,o),s=typeof e.env=="string"?e.env:typeof e.environment=="string"?e.environment:void 0,f=X(s),c=await se(n,i,a.id,{environment:f});console.log(JSON.stringify(c,null,2))}g(ze,"runTemplateUpdate");async function He(e){let o=await y(),t=w(o),r=typeof e.apiKey=="string"?e.apiKey:typeof e.key=="string"?e.key:null,n=r?r.trim():await L();if(!n)throw new Error("API key is required");n.startsWith("opk_")||console.log("warning: API keys usually start with opk_."),await C({handle:o.activeProfile?.handle||"default",apiKey:n,baseUrl:t,apiBaseUrl:o.apiBaseUrl,chatApiBaseUrl:o.chatApiBaseUrl,setActive:!0}),console.log("Saved account credentials to the encrypted OpenPond credential store.")}g(He,"runLogin");async function Fe(e,o){let t=o[0]||"list";if(t==="list"){let r=await ue();console.log(JSON.stringify({profiles:r},null,2));return}if(t==="use"){let r=o[1];if(!r)throw new Error("usage: profiles use <name> [--base-url <url>]");let n=await ge(r,{baseUrl:H(e)});console.log(JSON.stringify({profile:n},null,2));return}if(t==="save"){let r=o[1];if(!r)throw new Error("usage: profiles save <name> --api-key <key> [--base-url <url>] [--api-base-url <url>] [--chat-api-base-url <url>]");let n=typeof e.apiKey=="string"?e.apiKey:typeof e.key=="string"?e.key:null,i=n?n.trim():await L(),a=typeof e.environment=="string"?e.environment:typeof e.env=="string"?e.env:void 0,s=await C({handle:r,apiKey:i,baseUrl:H(e),apiBaseUrl:be(e),chatApiBaseUrl:ve(e),environment:a,setActive:!0});console.log(JSON.stringify({profile:s},null,2));return}throw new Error("usage: profiles <list|use|save> [args]")}g(Fe,"runProfiles");async function Ve(){let e=await y(),o=w(e),t=P(e),r=await R(e,o),n=await ce(t,r);console.log(JSON.stringify(n,null,2))}g(Ve,"runAccount");async function We(e){let o=await y(),t=P(o),r=fe(o),n=await le(t,r);console.log(JSON.stringify(n,null,2))}g(We,"runHealth");async function qe(e,o){let t=await y(),r=w(t),n=P(t),i=await R(t,r),{app:a}=await T(n,i,o),s=typeof e.branch=="string"?String(e.branch):void 0,f=await $(n,i,a.id,{branch:s});if(!f?.id){console.log("no deployments found");return}let c=await ne(n,i,f.id),d=(c&&Array.isArray(c.toolsJson)?c.toolsJson:null)||(c&&typeof c.metadataJson=="object"&&c.metadataJson?c.metadataJson.tools:null),u=Array.isArray(d)?d:[];if(u.length===0){console.log("no tools found");return}for(let l of u){let m=l,h=m.profile||m.function,I=m.name||h?.name||"unknown",p=m.description||h?.description||"";console.log(p?`${I} - ${p}`:I)}}g(qe,"runToolList");async function Ye(e,o,t){let r=await y(),n=w(r),i=P(r),a=await R(r,n),{app:s}=await T(i,a,o),f=typeof e.branch=="string"?String(e.branch):void 0,c=await $(i,a,s.id,{branch:f});if(!c?.id)throw new Error("no deployments found");let d;if(typeof e.body=="string")try{d=JSON.parse(e.body)}catch{throw new Error("tool body must be valid JSON")}let u=typeof e.method=="string"?String(e.method).toUpperCase():"POST",l=await pe(n,a,{appId:s.id,deploymentId:c.id,toolName:t,method:u,body:d,headers:a?{"openpond-api-key":a}:void 0});if(!l.ok)throw new Error(l.error||`tool failed (${l.status})`);let m=l.data??{ok:!0};console.log(JSON.stringify(m,null,2))}g(Ye,"runToolRun");async function Qe(e,o,t){let r=await y(),n=w(r),i=P(r),a=await R(r,n),{app:s}=await T(i,a,o),f=typeof e.branch=="string"?String(e.branch):void 0,c=typeof e.deploymentId=="string"?String(e.deploymentId):void 0,d=c?{id:c}:await $(i,a,s.id,{branch:f});if(!d?.id)throw new Error("no deployments found");let u=typeof e.body=="string"?M(String(e.body),"body"):{};if(!u||typeof u!="object"||Array.isArray(u))throw new Error("body must be a JSON object");let l=typeof e.method=="string"?String(e.method).toUpperCase():"POST",m={...u,appId:s.id,deploymentId:d.id,toolName:t,method:l},h=await de(i,a,m);console.log(JSON.stringify(h,null,2))}g(Qe,"runBacktestRun");async function Xe(e,o){let t=await y(),r=w(t),n=P(t),i=await R(t,r),{app:a,handle:s,repo:f}=await T(n,i,o),c=typeof e.branch=="string"?String(e.branch):void 0,d=typeof e.deploymentId=="string"?String(e.deploymentId):void 0,u=d?{id:d}:await $(n,i,a.id,{branch:c});if(!u?.id){console.log("no deployments found");return}await we({baseUrl:n,apiKey:i,deploymentId:u.id,prefix:`[${s}/${f}] `,intervalMs:e.interval?Number(e.interval):void 0,timeoutMs:e.timeout?Number(e.timeout):void 0})}g(Xe,"runDeployWatch");async function Ze(e,o){let r=((typeof e.name=="string"?e.name:null)||o.join(" ")).trim();if(!r)throw new Error("usage: repo create --name <name> [--team-id <id>] [--path <dir>] [--template <owner/repo|url>] [--template-branch <branch>] [--empty|--opentool] [--sandbox] [--token] [--auto-schedule-migration <true|false>]");let n=await y(),i=w(n),a=await R(n,i),s=P(n),f=typeof e.teamId=="string"&&e.teamId.trim()?e.teamId.trim():void 0,c=typeof e.template=="string"?e.template.trim():"";if(c&&(e.empty==="true"||e.opentool==="true"))throw new Error("choose one: --template or --empty/--opentool");if(e.empty==="true"&&e.opentool==="true")throw new Error("choose one: --empty or --opentool");let d=typeof e.description=="string"?e.description.trim():void 0,u=typeof e.templateBranch=="string"&&e.templateBranch.trim().length>0?e.templateBranch.trim():void 0,l=typeof e.env=="string"?M(e.env,"env"):void 0;if(l){if(typeof l!="object"||Array.isArray(l))throw new Error("env must be a JSON object");for(let[b,A]of Object.entries(l))if(typeof A!="string")throw new Error(`env value for ${b} must be a string`)}if(c){e.deployOnPush!==void 0&&console.warn("deploy-on-push is not used for template create (auto deploys)");let b=Re(c,i),k=(await re(s,a,[{name:r,...d?{description:d}:{},templateRepoUrl:b,...u?{templateBranch:u}:{},...l?{envVars:l}:{}}],f)).items?.[0];if(!k||k.status!=="ok"||!k.appId)throw new Error(k?.error||"Template create failed");console.log(`app_id: ${k.appId}`),k.deploymentId&&console.log(`deployment_id: ${k.deploymentId}`),k.conversationId&&console.log(`conversation_id: ${k.conversationId}`);return}let m=process.cwd(),h=typeof e.path=="string"?e.path:typeof e.dir=="string"?e.dir:null,I=h&&h.trim().length>0?h.trim():$e.isTTY?await he(m):m,p=U.resolve(I);if(W(p)){if(!(await V.stat(p)).isDirectory())throw new Error(`path is not a directory: ${p}`)}else await V.mkdir(p,{recursive:!0});let Pe=(await V.readdir(p)).filter(b=>b!==".git").length===0,x=v(e.yes)||v(e.force);if(!Pe&&!x&&!await S(`Directory is not empty (${p}). Continue?`,!1)){console.log("aborted");return}let ke=U.join(p,".git");if(!W(ke)){if(!(x?!0:await S("Initialize git repository here?",!0))){console.log("aborted");return}let A=await B("git",["init"],{cwd:p});if(A.code!==0)throw new Error(`git init failed: ${A.stderr.trim()||A.stdout.trim()||"unknown error"}`)}let K=await F(p,"origin");if(K&&!x&&!await S(`Remote "origin" already set (${K}). Replace it?`,!1)){console.log("aborted");return}let q=e.opentool==="true"?"opentool":"empty",Te=v(e.sandbox),Be=v(e.deployOnPush),N=e.autoScheduleMigration,Y=typeof N=="string"||typeof N=="boolean",Ee=Y?v(N):void 0,E=await oe(s,a,{name:r,...f?{teamId:f}:{},...d?{description:d}:{},...q?{repoInit:q}:{},...Te?{sandbox:!0}:{},...l?{envVars:l}:{},...Be?{deployOnPush:!0}:{},...Y?{autoScheduleMigration:Ee}:{}}),O=me(E);z(O);let J=v(e.token)||v(e.setRemoteToken),Oe=D(O,a),Q=J?Oe:O,_=await B("git",K?["remote","set-url","origin",Q]:["remote","add","origin",Q],{cwd:p});if(_.code!==0)throw new Error(`git remote failed: ${j(_.stderr.trim()||_.stdout.trim()||"unknown error")}`);let Ae=J?G(O):O;console.log(`app_id: ${E.appId}`),E.gitOwner&&E.gitRepo&&console.log(`repo: ${E.gitOwner}/${E.gitRepo}`),console.log(`remote: ${Ae}`),console.log('next: git add . && git commit -m "init"');let Ie=E.defaultBranch||"master";console.log(`next: openpond repo push --path ${p} --branch ${Ie}`),J||console.log(`token-remote (non-interactive): git -C ${p} remote set-url origin ${G(O)}`);try{await ye({apiBase:s,apiKey:a,forceRefresh:!0})}catch(b){console.warn("cache refresh failed",b)}}g(Ze,"runRepoCreate");async function Se(e){let o=await B("git",["rev-parse","--abbrev-ref","HEAD"],{cwd:e});if(o.code!==0)return null;let t=o.stdout.trim();return t.length>0?t:null}g(Se,"resolveGitBranch");async function et(e){let o=await y(),t=w(o),r=await R(o,t),n=typeof e.path=="string"?e.path:typeof e.dir=="string"?e.dir:null,i=U.resolve(n&&n.trim().length>0?n.trim():"."),a=U.join(i,".git");if(!W(a))throw new Error(`git repo not found at ${i} (missing .git)`);let s=await F(i,"origin");if(!s)throw new Error("origin remote not set; run `openpond repo create` first");z(s);let c=(typeof e.branch=="string"?e.branch.trim():"")||await Se(i);if(!c)throw new Error("unable to resolve git branch; pass --branch");let d;try{d=D(s,r)}catch{throw new Error("origin remote must be https for tokenized pushes")}let u=v(e.keepTokenRemote)||v(e.token)||v(e.setRemoteToken),l=s.includes("x-access-token:"),m=!u&&!l?s:null,h=process.env.GIT_TERMINAL_PROMPT;process.env.GIT_TERMINAL_PROMPT="0";try{if(!l){let p=await B("git",["remote","set-url","origin",d],{cwd:i});if(p.code!==0)throw new Error(`git remote set-url failed: ${j(p.stderr.trim()||p.stdout.trim()||"unknown error")}`)}if((await B("git",["push","-u","origin",c],{cwd:i,inherit:!0})).code!==0)throw new Error("git push failed")}finally{m&&await B("git",["remote","set-url","origin",m],{cwd:i}).catch(()=>null),h===void 0?delete process.env.GIT_TERMINAL_PROMPT:process.env.GIT_TERMINAL_PROMPT=h}}g(et,"runRepoPush");async function tt(e){if(e.length===0)throw new Error("usage: opentool <init|validate|build> [args]");let o=process.platform==="win32"?"npx.cmd":"npx";if((await B(o,["opentool",...e],{inherit:!0})).code!==0)throw new Error("opentool command failed")}g(tt,"runOpentool");async function nt(){let e="openpond",o=Z(),t=await te(e),r=`npm i -g ${e}@${t}`,n=ee(o,t);if(n===0){console.log(`${e} is up to date (${o})`);return}if(n===-1){console.log(`Update available: ${o} -> ${t}`),console.log(`Run: ${r}`);return}if(n===1){console.log(`Installed version (${o}) is newer than npm latest (${t}).`);return}if(o===t){console.log(`${e} is up to date (${o})`);return}console.log(`Installed: ${o}`),console.log(`Latest: ${t}`),console.log(`Run: ${r}`)}g(nt,"runCheckUpdate");export{Ge as a,je as b,ze as c,He as d,Fe as e,Ve as f,We as g,qe as h,Ye as i,Qe as j,Xe as k,Ze as l,Se as m,et as n,tt as o,nt as p};
|
|
2
|
+
import{A as F,a as fe,b as L,c as R,d as me,e as D,f as G,g as j,h as z,j as ye,l as T,m as we,n as S,o as he,y as B}from"./chunk-G2VYRU27.js";import{b as H,c as be,d as ve,f as w,h as P,i as Re}from"./chunk-ZVOO7FKM.js";import{$ as ge,M as ce,N as le,R as de,V as pe,Z as y,_ as ue,aa as C,h as $,i as ne,l as oe,n as re,o as ie,p as ae,q as se}from"./chunk-SS3EG6S2.js";import{a as Z,b as ee,c as te}from"./chunk-3T5XJEDM.js";import{a as M,f as v,k as X}from"./chunk-3M53YXEI.js";import{a as g}from"./chunk-FTQLQJQV.js";import{promises as V,existsSync as W}from"node:fs";import U from"node:path";import{stdin as $e}from"node:process";async function Ge(e,o){let t=await y(),r=w(t),n=P(t),i=await R(t,r),{app:a}=await T(n,i,o),s=await ie(n,i,a.id);console.log(JSON.stringify(s,null,2))}g(Ge,"runTemplateStatus");async function je(e,o){let t=await y(),r=w(t),n=P(t),i=await R(t,r),{app:a}=await T(n,i,o),s=await ae(n,i,a.id);console.log(JSON.stringify(s,null,2))}g(je,"runTemplateBranches");async function ze(e,o){let t=await y(),r=w(t),n=P(t),i=await R(t,r),{app:a}=await T(n,i,o),s=typeof e.env=="string"?e.env:typeof e.environment=="string"?e.environment:void 0,f=X(s),c=await se(n,i,a.id,{environment:f});console.log(JSON.stringify(c,null,2))}g(ze,"runTemplateUpdate");async function He(e){let o=await y(),t=w(o),r=typeof e.apiKey=="string"?e.apiKey:typeof e.key=="string"?e.key:null,n=r?r.trim():await L();if(!n)throw new Error("API key is required");n.startsWith("opk_")||console.log("warning: API keys usually start with opk_."),await C({handle:o.activeProfile?.handle||"default",apiKey:n,baseUrl:t,apiBaseUrl:o.apiBaseUrl,chatApiBaseUrl:o.chatApiBaseUrl,setActive:!0}),console.log("Saved account credentials to the encrypted OpenPond credential store.")}g(He,"runLogin");async function Fe(e,o){let t=o[0]||"list";if(t==="list"){let r=await ue();console.log(JSON.stringify({profiles:r},null,2));return}if(t==="use"){let r=o[1];if(!r)throw new Error("usage: profiles use <name> [--base-url <url>]");let n=await ge(r,{baseUrl:H(e)});console.log(JSON.stringify({profile:n},null,2));return}if(t==="save"){let r=o[1];if(!r)throw new Error("usage: profiles save <name> --api-key <key> [--base-url <url>] [--api-base-url <url>] [--chat-api-base-url <url>]");let n=typeof e.apiKey=="string"?e.apiKey:typeof e.key=="string"?e.key:null,i=n?n.trim():await L(),a=typeof e.environment=="string"?e.environment:typeof e.env=="string"?e.env:void 0,s=await C({handle:r,apiKey:i,baseUrl:H(e),apiBaseUrl:be(e),chatApiBaseUrl:ve(e),environment:a,setActive:!0});console.log(JSON.stringify({profile:s},null,2));return}throw new Error("usage: profiles <list|use|save> [args]")}g(Fe,"runProfiles");async function Ve(){let e=await y(),o=w(e),t=P(e),r=await R(e,o),n=await ce(t,r);console.log(JSON.stringify(n,null,2))}g(Ve,"runAccount");async function We(e){let o=await y(),t=P(o),r=fe(o),n=await le(t,r);console.log(JSON.stringify(n,null,2))}g(We,"runHealth");async function qe(e,o){let t=await y(),r=w(t),n=P(t),i=await R(t,r),{app:a}=await T(n,i,o),s=typeof e.branch=="string"?String(e.branch):void 0,f=await $(n,i,a.id,{branch:s});if(!f?.id){console.log("no deployments found");return}let c=await ne(n,i,f.id),d=(c&&Array.isArray(c.toolsJson)?c.toolsJson:null)||(c&&typeof c.metadataJson=="object"&&c.metadataJson?c.metadataJson.tools:null),u=Array.isArray(d)?d:[];if(u.length===0){console.log("no tools found");return}for(let l of u){let m=l,h=m.profile||m.function,I=m.name||h?.name||"unknown",p=m.description||h?.description||"";console.log(p?`${I} - ${p}`:I)}}g(qe,"runToolList");async function Ye(e,o,t){let r=await y(),n=w(r),i=P(r),a=await R(r,n),{app:s}=await T(i,a,o),f=typeof e.branch=="string"?String(e.branch):void 0,c=await $(i,a,s.id,{branch:f});if(!c?.id)throw new Error("no deployments found");let d;if(typeof e.body=="string")try{d=JSON.parse(e.body)}catch{throw new Error("tool body must be valid JSON")}let u=typeof e.method=="string"?String(e.method).toUpperCase():"POST",l=await pe(n,a,{appId:s.id,deploymentId:c.id,toolName:t,method:u,body:d,headers:a?{"openpond-api-key":a}:void 0});if(!l.ok)throw new Error(l.error||`tool failed (${l.status})`);let m=l.data??{ok:!0};console.log(JSON.stringify(m,null,2))}g(Ye,"runToolRun");async function Qe(e,o,t){let r=await y(),n=w(r),i=P(r),a=await R(r,n),{app:s}=await T(i,a,o),f=typeof e.branch=="string"?String(e.branch):void 0,c=typeof e.deploymentId=="string"?String(e.deploymentId):void 0,d=c?{id:c}:await $(i,a,s.id,{branch:f});if(!d?.id)throw new Error("no deployments found");let u=typeof e.body=="string"?M(String(e.body),"body"):{};if(!u||typeof u!="object"||Array.isArray(u))throw new Error("body must be a JSON object");let l=typeof e.method=="string"?String(e.method).toUpperCase():"POST",m={...u,appId:s.id,deploymentId:d.id,toolName:t,method:l},h=await de(i,a,m);console.log(JSON.stringify(h,null,2))}g(Qe,"runBacktestRun");async function Xe(e,o){let t=await y(),r=w(t),n=P(t),i=await R(t,r),{app:a,handle:s,repo:f}=await T(n,i,o),c=typeof e.branch=="string"?String(e.branch):void 0,d=typeof e.deploymentId=="string"?String(e.deploymentId):void 0,u=d?{id:d}:await $(n,i,a.id,{branch:c});if(!u?.id){console.log("no deployments found");return}await we({baseUrl:n,apiKey:i,deploymentId:u.id,prefix:`[${s}/${f}] `,intervalMs:e.interval?Number(e.interval):void 0,timeoutMs:e.timeout?Number(e.timeout):void 0})}g(Xe,"runDeployWatch");async function Ze(e,o){let r=((typeof e.name=="string"?e.name:null)||o.join(" ")).trim();if(!r)throw new Error("usage: repo create --name <name> [--team-id <id>] [--path <dir>] [--template <owner/repo|url>] [--template-branch <branch>] [--empty|--opentool] [--sandbox] [--token] [--auto-schedule-migration <true|false>]");let n=await y(),i=w(n),a=await R(n,i),s=P(n),f=typeof e.teamId=="string"&&e.teamId.trim()?e.teamId.trim():void 0,c=typeof e.template=="string"?e.template.trim():"";if(c&&(e.empty==="true"||e.opentool==="true"))throw new Error("choose one: --template or --empty/--opentool");if(e.empty==="true"&&e.opentool==="true")throw new Error("choose one: --empty or --opentool");let d=typeof e.description=="string"?e.description.trim():void 0,u=typeof e.templateBranch=="string"&&e.templateBranch.trim().length>0?e.templateBranch.trim():void 0,l=typeof e.env=="string"?M(e.env,"env"):void 0;if(l){if(typeof l!="object"||Array.isArray(l))throw new Error("env must be a JSON object");for(let[b,A]of Object.entries(l))if(typeof A!="string")throw new Error(`env value for ${b} must be a string`)}if(c){e.deployOnPush!==void 0&&console.warn("deploy-on-push is not used for template create (auto deploys)");let b=Re(c,i),k=(await re(s,a,[{name:r,...d?{description:d}:{},templateRepoUrl:b,...u?{templateBranch:u}:{},...l?{envVars:l}:{}}],f)).items?.[0];if(!k||k.status!=="ok"||!k.appId)throw new Error(k?.error||"Template create failed");console.log(`app_id: ${k.appId}`),k.deploymentId&&console.log(`deployment_id: ${k.deploymentId}`),k.conversationId&&console.log(`conversation_id: ${k.conversationId}`);return}let m=process.cwd(),h=typeof e.path=="string"?e.path:typeof e.dir=="string"?e.dir:null,I=h&&h.trim().length>0?h.trim():$e.isTTY?await he(m):m,p=U.resolve(I);if(W(p)){if(!(await V.stat(p)).isDirectory())throw new Error(`path is not a directory: ${p}`)}else await V.mkdir(p,{recursive:!0});let Pe=(await V.readdir(p)).filter(b=>b!==".git").length===0,x=v(e.yes)||v(e.force);if(!Pe&&!x&&!await S(`Directory is not empty (${p}). Continue?`,!1)){console.log("aborted");return}let ke=U.join(p,".git");if(!W(ke)){if(!(x?!0:await S("Initialize git repository here?",!0))){console.log("aborted");return}let A=await B("git",["init"],{cwd:p});if(A.code!==0)throw new Error(`git init failed: ${A.stderr.trim()||A.stdout.trim()||"unknown error"}`)}let K=await F(p,"origin");if(K&&!x&&!await S(`Remote "origin" already set (${K}). Replace it?`,!1)){console.log("aborted");return}let q=e.opentool==="true"?"opentool":"empty",Te=v(e.sandbox),Be=v(e.deployOnPush),N=e.autoScheduleMigration,Y=typeof N=="string"||typeof N=="boolean",Ee=Y?v(N):void 0,E=await oe(s,a,{name:r,...f?{teamId:f}:{},...d?{description:d}:{},...q?{repoInit:q}:{},...Te?{sandbox:!0}:{},...l?{envVars:l}:{},...Be?{deployOnPush:!0}:{},...Y?{autoScheduleMigration:Ee}:{}}),O=me(E);z(O);let J=v(e.token)||v(e.setRemoteToken),Oe=D(O,a),Q=J?Oe:O,_=await B("git",K?["remote","set-url","origin",Q]:["remote","add","origin",Q],{cwd:p});if(_.code!==0)throw new Error(`git remote failed: ${j(_.stderr.trim()||_.stdout.trim()||"unknown error")}`);let Ae=J?G(O):O;console.log(`app_id: ${E.appId}`),E.gitOwner&&E.gitRepo&&console.log(`repo: ${E.gitOwner}/${E.gitRepo}`),console.log(`remote: ${Ae}`),console.log('next: git add . && git commit -m "init"');let Ie=E.defaultBranch||"master";console.log(`next: openpond repo push --path ${p} --branch ${Ie}`),J||console.log(`token-remote (non-interactive): git -C ${p} remote set-url origin ${G(O)}`);try{await ye({apiBase:s,apiKey:a,forceRefresh:!0})}catch(b){console.warn("cache refresh failed",b)}}g(Ze,"runRepoCreate");async function Se(e){let o=await B("git",["rev-parse","--abbrev-ref","HEAD"],{cwd:e});if(o.code!==0)return null;let t=o.stdout.trim();return t.length>0?t:null}g(Se,"resolveGitBranch");async function et(e){let o=await y(),t=w(o),r=await R(o,t),n=typeof e.path=="string"?e.path:typeof e.dir=="string"?e.dir:null,i=U.resolve(n&&n.trim().length>0?n.trim():"."),a=U.join(i,".git");if(!W(a))throw new Error(`git repo not found at ${i} (missing .git)`);let s=await F(i,"origin");if(!s)throw new Error("origin remote not set; run `openpond repo create` first");z(s);let c=(typeof e.branch=="string"?e.branch.trim():"")||await Se(i);if(!c)throw new Error("unable to resolve git branch; pass --branch");let d;try{d=D(s,r)}catch{throw new Error("origin remote must be https for tokenized pushes")}let u=v(e.keepTokenRemote)||v(e.token)||v(e.setRemoteToken),l=s.includes("x-access-token:"),m=!u&&!l?s:null,h=process.env.GIT_TERMINAL_PROMPT;process.env.GIT_TERMINAL_PROMPT="0";try{if(!l){let p=await B("git",["remote","set-url","origin",d],{cwd:i});if(p.code!==0)throw new Error(`git remote set-url failed: ${j(p.stderr.trim()||p.stdout.trim()||"unknown error")}`)}if((await B("git",["push","-u","origin",c],{cwd:i,inherit:!0})).code!==0)throw new Error("git push failed")}finally{m&&await B("git",["remote","set-url","origin",m],{cwd:i}).catch(()=>null),h===void 0?delete process.env.GIT_TERMINAL_PROMPT:process.env.GIT_TERMINAL_PROMPT=h}}g(et,"runRepoPush");async function tt(e){if(e.length===0)throw new Error("usage: opentool <init|validate|build> [args]");let o=process.platform==="win32"?"npx.cmd":"npx";if((await B(o,["opentool",...e],{inherit:!0})).code!==0)throw new Error("opentool command failed")}g(tt,"runOpentool");async function nt(){let e="openpond",o=Z(),t=await te(e),r=`npm i -g ${e}@${t}`,n=ee(o,t);if(n===0){console.log(`${e} is up to date (${o})`);return}if(n===-1){console.log(`Update available: ${o} -> ${t}`),console.log(`Run: ${r}`);return}if(n===1){console.log(`Installed version (${o}) is newer than npm latest (${t}).`);return}if(o===t){console.log(`${e} is up to date (${o})`);return}console.log(`Installed: ${o}`),console.log(`Latest: ${t}`),console.log(`Run: ${r}`)}g(nt,"runCheckUpdate");export{Ge as a,je as b,ze as c,He as d,Fe as e,Ve as f,We as g,qe as h,Ye as i,Qe as j,Xe as k,Ze as l,Se as m,et as n,tt as o,nt as p};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{d as F}from"./chunk-
|
|
2
|
+
import{d as F}from"./chunk-J2MP4LSF.js";import{a as o}from"./chunk-FTQLQJQV.js";import{spawn as nt,spawnSync as At}from"node:child_process";import{accessSync as vt,constants as Rt,existsSync as _t,promises as Bt}from"node:fs";import et from"node:path";var rt="Git is required for OpenPond app workspaces, but macOS reports Apple Command Line Tools are not installed. OpenPond skipped /usr/bin/git to avoid opening the Xcode installer prompt. Install Command Line Tools with `xcode-select --install`, install Git from Homebrew, or put a non-Apple git binary earlier on PATH.",T;function Lt(e){try{return _t(e)?(vt(e,Rt.X_OK),!0):!1}catch{return!1}}o(Lt,"isExecutable");function Ot(){let e=(process.env.PATH??"").split(et.delimiter).map(t=>t.trim()).filter(Boolean);for(let t of e){let n=et.join(t,"git");if(!(n==="/usr/bin/git"||n==="/bin/git")&&Lt(n))return n}return null}o(Ot,"firstNonAppleGitOnPath");function it(){let e=At("/usr/bin/xcode-select",["-p"],{encoding:"utf8",stdio:["ignore","pipe","pipe"]});return e.status===0&&!!e.stdout.trim()}o(it,"appleDeveloperToolsAvailable");function Dt(e){if(e!=="git"||process.platform!=="darwin")return{command:e};if(T!==void 0)return{command:T};let t=Ot();return t?(T=t,{command:t}):it()?(T="git",{command:"git"}):{error:rt}}o(Dt,"resolveWorkspaceCommand");function u(e,t,n,r={},i){return new Promise(s=>{let a=Dt(e);if("error"in a){s({code:1,stdout:"",stderr:a.error});return}let c=nt(a.command,t,{cwd:n,env:{...process.env,...r,GIT_TERMINAL_PROMPT:"0"},stdio:[i===void 0?"ignore":"pipe","pipe","pipe"]}),d=[],p=[];i!==void 0&&c.stdin?.end(i),c.stdout?.on("data",h=>d.push(h)),c.stderr?.on("data",h=>p.push(h)),c.on("error",h=>{s({code:1,stdout:"",stderr:h.message})}),c.on("close",h=>{s({code:h??1,stdout:Buffer.concat(d).toString("utf8"),stderr:Buffer.concat(p).toString("utf8")})})})}o(u,"runCommand");function Gt(e){return!!(e&&e.includes(rt.slice(0,80)))}o(Gt,"isMacOSGitDeveloperToolsMissing");async function Se(e){await Bt.mkdir(e,{recursive:!0});let t=await u("git",["--version"],e);if(t.code===0)return{ok:!0,command:T??"git",version:(t.stdout||t.stderr).trim()};let n=t.stderr.trim()||t.stdout.trim()||"Git is required for OpenPond app workspaces.";return{ok:!1,error:n,installAction:process.platform==="darwin"&&Gt(n)?"macos_command_line_tools":"manual_git_install"}}o(Se,"checkWorkspaceGitAvailability");function ye(){if(process.platform!=="darwin")return{ok:!1,error:"Apple Command Line Tools installation is only available on macOS."};if(it())return{ok:!0,message:"Apple Command Line Tools already appear to be installed."};try{return nt("/usr/bin/xcode-select",["--install"],{detached:!0,stdio:"ignore"}).unref(),{ok:!0,message:"Opened the Apple Command Line Tools installer."}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}o(ye,"startMacOSCommandLineToolsInstall");import{promises as k}from"node:fs";import m from"node:path";var st=24e3,ot=8e4,It=512*1024,ct=15*1024*1024,Tt=20*1024*1024,Mt=new Set([".cache",".eggs",".git",".ipynb_checkpoints",".mypy_cache",".next",".nox",".nuxt",".openpond",".output",".parcel-cache",".pytest_cache",".pyre",".ruff_cache",".svelte-kit",".tox",".turbo",".venv","__pycache__","artifacts","build","coverage","dist","env","node_modules","out","site-packages","target","venv","volumes"]),zt=new Set([".7z",".avif",".db",".doc",".docx",".gif",".gz",".ico",".jpeg",".jpg",".mov",".mp4",".pdf",".png",".sqlite",".tar",".webp",".xls",".xlsm",".xlsx",".zip"]),$t=new Map([[".avif","image/avif"],[".gif","image/gif"],[".jpeg","image/jpeg"],[".jpg","image/jpeg"],[".png","image/png"],[".webp","image/webp"]]),Nt=new Map([[".m4v","video/x-m4v"],[".mov","video/quicktime"],[".mp4","video/mp4"],[".webm","video/webm"]]),Ht=new Set([".doc",".docx",".pdf"]);function Ut(e){return e.replace(/[^a-zA-Z0-9._-]/g,"-").slice(0,120)||"app"}o(Ut,"safeAppSegment");function N(e){if(!e)return"unknown";try{let t=new URL(e).hostname.toLowerCase();if(t==="github.com"||t.endsWith(".github.com"))return"github";if(t==="openpond.ai"||t.endsWith(".openpond.ai"))return"openpond"}catch{return"unknown"}return"local_git"}o(N,"sourceFromRemote");function $(e){return e.replace(/x-access-token:[^@]+@/g,"x-access-token:***@").replace(/Authorization:\s*Basic\s+[A-Za-z0-9+/=]+/gi,"Authorization: Basic ***")}o($,"redactRemoteUrl");async function G(e){try{return await k.access(e),!0}catch{return!1}}o(G,"pathExists");async function O(e){return await G(e)?(await u("git",["rev-parse","--git-dir"],e)).code===0:!1}o(O,"isGitRepo");function X(e){return e.length<=st?e:`${e.slice(0,st)}
|
|
3
3
|
|
|
4
4
|
[diff truncated]`}o(X,"truncatePatch");function jt(e){return e.length<=ot?e:`${e.slice(0,ot)}
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{I as Ur,Ma as On,S as In,U as An,Wc as Pt,Xc as Ct,Yc as Tt,Zc as Un,b as _n,c as It,ca as Pn,cd as Ne,da as Cn,fa as Hr,g as kn,ia as Lr,ja as Tn,jc as Mn,ka as jn,ma as Br,na as qr,oa as $r,pa as Dr,qa as En,ra as Nr,sa as zr,t as wn,ta as At,u as Rn,vb as Fr}from"./chunk-S64WASAO.js";import{a as Hn,b as Vr,c as Gr}from"./chunk-6MI4KKWF.js";import{b as ae,d as kt,e as wt}from"./chunk-J2S7BOZU.js";import{J as Cr,L as vn,M as Tr,N as jr,Za as Or,h as wr,i as Rr,k as Ir,l as Ar,p as ve,q as Pr,s as Rt,t as Sn,xa as Er,z as re}from"./chunk-UW6ES5DM.js";import{a as Mr}from"./chunk-6FA3GG5B.js";import{A as ot,B as mr,D as ur,Ja as _r,Ka as kr,M as dr,N as pr,O as $e,P as pn,Q as De,R as it,S as Se,U as gr,Ua as yn,V as fr,Y as hr,Z as br,_ as gn,aa as xr,ba as yr,ca as fn,da as Sr,f as _t,s as dn,t as cr,ya as bn,z as rt,za as xn}from"./chunk-NNLI4OWY.js";import{a as m,b as g,c as S,e as b,f as O,p as lr,q as $}from"./chunk-HZP5U2AA.js";import{b as e}from"./chunk-ES2ISFJC.js";import{f as X,h as vt,p as hn,r as vr}from"./chunk-H7IWJN7L.js";import{a as s}from"./chunk-FTQLQJQV.js";import{createHash as Fl}from"node:crypto";import{existsSync as Yr}from"node:fs";import{readdir as Xr,readFile as Qr,stat as Vl}from"node:fs/promises";import le from"node:path";var Ln="skills",jt="SKILL.md",Kr=8e4;async function Bn(t){let n=le.join(t,Ln);if(!Yr(n))return{skillCatalog:Wr({stale:!1}),skills:[]};try{let a=await Xr(n,{withFileTypes:!0}),r=(await Promise.all(a.filter(o=>o.isDirectory()).map(o=>Gl(t,o.name)))).sort((o,l)=>o.name.localeCompare(l.name)||o.path.localeCompare(l.path));Wl(r);let i=await Jl(t,r);return{skillCatalog:{skillCount:r.length,generatedAt:i,stale:!1,error:null},skills:r}}catch(a){return{skillCatalog:Wr({stale:!0,error:a instanceof Error?a.message:String(a)}),skills:[]}}}s(Bn,"loadProfileSkills");function ze(t){let n=[],a=/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)([\s\S]*)$/.exec(t);if(!a)return{name:null,description:null,body:t.trim(),messages:["SKILL.md must start with YAML frontmatter bounded by ---."]};let r=a[1]??"",i=(a[2]??"").trim(),o;try{o=Mr.load(r)}catch(p){n.push(`SKILL.md frontmatter is invalid YAML: ${p instanceof Error?p.message:String(p)}`)}let l=Yl(o),c=Jr(l?.name),u=Jr(l?.description);return c||n.push("Skill frontmatter must include a non-empty name."),u||n.push("Skill frontmatter must include a non-empty description."),i||n.push("Skill body must be non-empty markdown."),{name:c,description:u,body:i,messages:n}}s(ze,"parseProfileSkillMarkdown");async function wh(t){let n=t.name.trim();if(!Zr(n))throw new Error("Profile skill name must be lowercase kebab-case.");let r=(await Bn(t.profileSourcePath)).skills.find(c=>c.name===n);if(!r)throw new Error(`Profile skill not found: ${n}`);if(!r.enabled||r.validationStatus!=="valid"){let c=r.validationMessages.length>0?` ${r.validationMessages.join(" ")}`:"";throw new Error(`Profile skill ${n} is not valid.${c}`)}let i=le.join(t.profileSourcePath,r.path),o=await Qr(i,"utf8"),l=ze(o);if(l.messages.length>0)throw new Error(`Profile skill ${n} is not valid. ${l.messages.join(" ")}`);return{name:r.name,description:r.description,body:l.body,path:r.path,sourcePath:r.sourcePath,sourceHash:r.sourceHash,charCount:r.charCount,packagePath:le.dirname(i),resourceFiles:r.resourceFiles}}s(wh,"readProfileSkill");function Wr(t={}){return{skillCount:0,generatedAt:null,stale:t.stale??!0,error:t.error??null}}s(Wr,"emptyProfileSkillCatalogState");async function Gl(t,n){let a=le.join(Ln,n,jt).replace(/\\/g,"/"),r=le.join(t,a),i=[],o=le.join(t,Ln,n),l=await Kl(o),c="";Yr(r)?c=await Qr(r,"utf8"):i.push(`Missing ${jt}.`),c.length>Kr&&i.push(`Skill markdown exceeds the limit of ${Kr} characters.`);let u=ze(c);i.push(...u.messages);let p=u.name??n,k=u.description??"";return Zr(p)||i.push("Skill name must be lowercase kebab-case."),p!==n&&i.push(`Skill name must match its directory name (${n}).`),{name:p,description:k,path:a,scope:"profile",enabled:i.length===0,sourcePath:t,charCount:c.length,sourceHash:Xl(c),validationStatus:i.length>0?"error":"valid",validationMessages:i,resourceFiles:l.filter(v=>v!==jt)}}s(Gl,"loadProfileSkillDirectory");async function Kl(t){let n=[];async function a(r,i){let o=await Xr(r,{withFileTypes:!0});await Promise.all(o.map(async l=>{let c=i?`${i}/${l.name}`:l.name;l.isDirectory()?await a(le.join(r,l.name),c):l.isFile()&&n.push(c)}))}return s(a,"visit"),await a(t,""),n.sort()}s(Kl,"listPackageFiles");function Wl(t){let n=new Map;for(let a of t)n.set(a.name,(n.get(a.name)??0)+1);for(let a of t)(n.get(a.name)??0)<=1||(a.enabled=!1,a.validationStatus="error",a.validationMessages=[...a.validationMessages,`Duplicate skill name: ${a.name}`])}s(Wl,"markDuplicateSkillNames");async function Jl(t,n){let a=0;for(let r of n){let i=le.dirname(le.join(t,r.path)),o=[jt,...r.resourceFiles];for(let l of o){let c=await Vl(le.join(i,l)).catch(()=>null);c?.isFile()&&(a=Math.max(a,c.mtimeMs))}}return a>0?new Date(a).toISOString():null}s(Jl,"latestSkillMtime");function Zr(t){return/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(t)}s(Zr,"isKebabCaseSkillName");function Yl(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}s(Yl,"asRecord");function Jr(t){if(typeof t!="string")return null;let n=t.trim();return n.length>0?n:null}s(Jr,"text");function Xl(t){return Fl("sha256").update(t).digest("hex")}s(Xl,"sha256Hex");import{createRequire as Fo}from"node:module";import{createHash as Bo,randomUUID as qo}from"node:crypto";import{spawn as Xc}from"node:child_process";import{existsSync as G}from"node:fs";import{cp as Qc,mkdir as ue,readFile as Vo,readdir as Go,rename as ra,rm as oa,symlink as Zc,writeFile as Je}from"node:fs/promises";import f from"node:path";import Ql from"node:path";var Et="default",eo=["apiKey","baseUrl","apiBaseUrl","chatApiBaseUrl","token","appId","conversationId"];function _e(t,n){return Object.prototype.hasOwnProperty.call(t,n)}s(_e,"hasOwn");function ge(t){if(typeof t!="string")return null;let n=t.trim();return n.length>0?n:null}s(ge,"normalizeHandle");function N(t){if(typeof t!="string")return null;let n=t.trim();return n?n.replace(/\/$/,""):null}s(N,"normalizeBaseUrl");function so(t){let n=ge(t);if(!n)throw new Error("profile handle must be non-empty");return n}s(so,"requireHandle");function Zl(t){if(typeof t!="string")throw new Error("apiKey must be a non-empty string");let n=t.trim();if(!n)throw new Error("apiKey must be a non-empty string");return n}s(Zl,"requireApiKey");function st(t,n){let a=ge(t),r=ge(n);return!!(a&&r&&a.toLowerCase()===r.toLowerCase())}s(st,"handleEquals");function $n(t,n,a){let r=N(a);return t.findIndex(i=>st(i.handle,n)?r?N(i.baseUrl)===r:!0:!1)}s($n,"findAccountIndex");function Ve(t){let n=ge(t.handle)??Et,a=N(t.baseUrl);return a?{handle:n,baseUrl:a}:{handle:n}}s(Ve,"selectorFromAccount");function Fe(t){if(!t||typeof t!="object"||Array.isArray(t))return null;let n=t,a=ge(typeof n.handle=="string"?n.handle:void 0);if(!a)return null;let r=N(typeof n.baseUrl=="string"?n.baseUrl:void 0);return r?{handle:a,baseUrl:r}:{handle:a}}s(Fe,"sanitizeActiveProfile");function Dn(t){if(!t||typeof t!="object"||Array.isArray(t))return;let n=t,a=typeof n.repoPath=="string"?n.repoPath.trim():"",r=typeof n.profile=="string"&&n.profile.trim()?n.profile.trim():"default";if(!a)return;let i={repoPath:a,profile:r,mode:"local"};if(n.lastCheck&&typeof n.lastCheck=="object"&&!Array.isArray(n.lastCheck)){let o=n.lastCheck,l=o.command,c=o.status,u=o.checkedAt;(l==="inspect"||l==="build"||l==="validate"||l==="eval"||l==="run")&&(c==="passed"||c==="failed")&&typeof u=="string"&&(i.lastCheck={command:l,status:c,checkedAt:u,...typeof o.exitCode=="number"||o.exitCode===null?{exitCode:o.exitCode}:{},...typeof o.sourceHead=="string"||o.sourceHead===null?{sourceHead:o.sourceHead}:{}})}if(n.lastPush&&typeof n.lastPush=="object"&&!Array.isArray(n.lastPush)){let o=n.lastPush,l=o.status,c=o.pushedAt;(l==="pushed"||l==="failed")&&typeof c=="string"&&(i.lastPush={status:l,pushedAt:c,...typeof o.teamId=="string"||o.teamId===null?{teamId:o.teamId}:{},...typeof o.projectId=="string"||o.projectId===null?{projectId:o.projectId}:{},...typeof o.localHead=="string"||o.localHead===null?{localHead:o.localHead}:{},...typeof o.hostedHead=="string"||o.hostedHead===null?{hostedHead:o.hostedHead}:{},...typeof o.sourceRef=="string"||o.sourceRef===null?{sourceRef:o.sourceRef}:{},...o.promotionStatus==="uploaded"||o.promotionStatus==="hosted_source_materialized"||o.promotionStatus==="hosted_source_materialize_failed"||o.promotionStatus==="hosted_source_check_pending"||o.promotionStatus==="hosted_source_check_failed"||o.promotionStatus==="hosted_source_published"||o.promotionStatus==="hosted_source_publish_failed"||o.promotionStatus==="hosted_run_pending"||o.promotionStatus==="hosted_run_passed"||o.promotionStatus==="hosted_run_failed"||o.promotionStatus===null?{promotionStatus:o.promotionStatus}:{},...o.hostedRunStatus==="not_started"||o.hostedRunStatus==="running"||o.hostedRunStatus==="passed"||o.hostedRunStatus==="failed"||o.hostedRunStatus===null?{hostedRunStatus:o.hostedRunStatus}:{},...typeof o.hostedRunAgentId=="string"||o.hostedRunAgentId===null?{hostedRunAgentId:o.hostedRunAgentId}:{},...typeof o.hostedRunId=="string"||o.hostedRunId===null?{hostedRunId:o.hostedRunId}:{},...typeof o.hostedRunAt=="string"||o.hostedRunAt===null?{hostedRunAt:o.hostedRunAt}:{},...to(o.hostedSourceMaterialization)?{hostedSourceMaterialization:to(o.hostedSourceMaterialization)}:{},...no(o.hostedSourceCheck)?{hostedSourceCheck:no(o.hostedSourceCheck)}:{},...ao(o.hostedPublish)?{hostedPublish:ao(o.hostedPublish)}:{},...ro(o.hostedRun)?{hostedRun:ro(o.hostedRun)}:{},...typeof o.error=="string"||o.error===null?{error:o.error}:{}})}if(Array.isArray(n.profiles)){let o=n.profiles.flatMap(l=>{let c=Dn(l);if(!c)return[];let u=l,p=u.source==="github"||u.source==="openpond_git"?u.source:"local",k=typeof u.repositoryId=="string"&&u.repositoryId.trim()?u.repositoryId.trim():Ql.resolve(c.repoPath);return[{source:p,repositoryId:k,repoPath:c.repoPath,profile:c.profile,...c.lastCheck?{lastCheck:c.lastCheck}:{},...c.lastPush?{lastPush:c.lastPush}:{}}]});o.length>0&&(i.profiles=o)}return i}s(Dn,"sanitizeLocalOpenPondProfile");function to(t){if(!t||typeof t!="object"||Array.isArray(t))return null;let n=t,a=Ot(n.status);return a?{status:a,...A(n,"agentId"),...A(n,"runtimeAgentId"),...A(n,"projectId"),...A(n,"sourceRoot"),...A(n,"sourceRef"),...A(n,"sourceCommitSha"),...A(n,"manifestHash"),...A(n,"manifestPath"),...A(n,"manifestSyncedAt"),...oo(n,"fileCount"),...oo(n,"totalBytes"),...A(n,"generatedManifestPath"),...qn(n,"synthesizedOpenPondYaml"),...A(n,"uploadMetadataPath"),...F(n,"setupCommands"),...F(n,"validationCommands"),...A(n,"materializedAt"),...A(n,"error")}:null}s(to,"sanitizeHostedMaterializationStatus");function no(t){if(!t||typeof t!="object"||Array.isArray(t))return null;let n=t,a=Ot(n.status);return a?{status:a,...A(n,"agentId"),...A(n,"deployPlanStatus"),...qn(n,"canRun"),...qn(n,"canDeploy"),...A(n,"sourceRef"),...A(n,"sourceCommitSha"),...A(n,"manifestHash"),...A(n,"manifestPath"),...F(n,"setupCommands"),...F(n,"validationCommands"),...F(n,"requiredChecks"),...F(n,"evalNames"),...F(n,"blockedReasons"),...F(n,"staleReasons"),...A(n,"runtimeId"),...A(n,"sandboxId"),...F(n,"traceArtifactRefs"),...F(n,"evalResultArtifactRefs"),...F(n,"validatorArtifactRefs"),...A(n,"checkedAt"),...A(n,"error")}:null}s(no,"sanitizeHostedSourceCheckStatus");function ao(t){if(!t||typeof t!="object"||Array.isArray(t))return null;let n=t,a=Ot(n.status);return a?{status:a,...A(n,"agentId"),...A(n,"snapshotId"),...A(n,"sourceRef"),...A(n,"sourceCommitSha"),...A(n,"manifestHash"),...A(n,"manifestPath"),...A(n,"buildStatus"),...A(n,"validationStatus"),...A(n,"evalStatus"),...A(n,"publishedAt"),...A(n,"error")}:null}s(ao,"sanitizeHostedPublishStatus");function ro(t){if(!t||typeof t!="object"||Array.isArray(t))return null;let n=t,a=Ot(n.status);return a?{status:a,...A(n,"agentId"),...A(n,"runId"),...A(n,"runtimeId"),...A(n,"sandboxId"),...A(n,"sourceRef"),...A(n,"sourceCommitSha"),...A(n,"manifestHash"),...A(n,"setupGateStatus"),...F(n,"setupRequirementRefs"),...F(n,"artifactRefs"),...F(n,"traceArtifactRefs"),...F(n,"evalArtifactRefs"),...A(n,"startedAt"),...A(n,"completedAt"),...A(n,"error")}:null}s(ro,"sanitizeHostedRunSummary");function A(t,n){let a=t[n];return typeof a=="string"||a===null?{[n]:a}:{}}s(A,"nullableStringProp");function qn(t,n){let a=t[n];return typeof a=="boolean"||a===null?{[n]:a}:{}}s(qn,"nullableBooleanProp");function oo(t,n){let a=t[n];return typeof a=="number"||a===null?{[n]:a}:{}}s(oo,"nullableNumberProp");function F(t,n){let a=t[n];if(!Array.isArray(a))return{};let r=a.filter(i=>typeof i=="string");return{[n]:r}}s(F,"stringArrayProp");function Ot(t){return typeof t=="string"&&t.trim()?t.trim():null}s(Ot,"stringField");function lo(t,n){if(!st(t.handle,n.handle))return!1;let a=N(n.baseUrl);return a?N(t.baseUrl)===a:!N(t.baseUrl)}s(lo,"accountMatchesSelector");function Nn(t,n,a={}){let r=N(n.baseUrl);if(r)return $n(t,n.handle,r);let i=t.findIndex(l=>lo(l,n));if(i!==-1)return i;let o=t.map((l,c)=>({account:l,index:c})).filter(({account:l})=>st(l.handle,n.handle));if(o.length>1&&a.requireUnambiguous)throw new Error(`multiple profiles found for ${n.handle}; pass --base-url to select one`);return o[0]?.index??-1}s(Nn,"findAccountIndexForSelector");function ec(t){if(!t||typeof t!="object"||Array.isArray(t))return;let n=t,a={};return typeof n.token=="string"&&(a.token=n.token),(typeof n.appId=="string"||n.appId===null)&&(a.appId=n.appId),(typeof n.conversationId=="string"||n.conversationId===null)&&(a.conversationId=n.conversationId),Object.keys(a).length>0?a:void 0}s(ec,"sanitizeSession");function tc(t){if(!t||typeof t!="object"||Array.isArray(t))return null;let n=t,a=ge(typeof n.handle=="string"?n.handle:void 0);if(!a)return null;let r={handle:a};typeof n.apiKey=="string"&&(r.apiKey=n.apiKey),typeof n.baseUrl=="string"&&(r.baseUrl=n.baseUrl),typeof n.apiBaseUrl=="string"&&(r.apiBaseUrl=n.apiBaseUrl),typeof n.chatApiBaseUrl=="string"&&(r.chatApiBaseUrl=n.chatApiBaseUrl),typeof n.environment=="string"&&(r.environment=n.environment);let i=ec(n.session);return i&&(r.session=i),r}s(tc,"sanitizeAccount");function nc(t){let n={};return typeof t.token=="string"&&(n.token=t.token),(typeof t.appId=="string"||t.appId===null)&&(n.appId=t.appId),(typeof t.conversationId=="string"||t.conversationId===null)&&(n.conversationId=t.conversationId),Object.keys(n).length>0?n:void 0}s(nc,"extractLegacySession");function ac(t,n){let a={handle:n};typeof t.apiKey=="string"&&(a.apiKey=t.apiKey),typeof t.baseUrl=="string"&&(a.baseUrl=t.baseUrl),typeof t.apiBaseUrl=="string"&&(a.apiBaseUrl=t.apiBaseUrl),typeof t.chatApiBaseUrl=="string"&&(a.chatApiBaseUrl=t.chatApiBaseUrl);let r=nc(t);return r&&(a.session=r),a}s(ac,"extractLegacyAccount");function co(t){let n={};typeof t.lspEnabled=="boolean"&&(n.lspEnabled=t.lspEnabled),(t.executionMode==="local"||t.executionMode==="hosted")&&(n.executionMode=t.executionMode),(t.mode==="general"||t.mode==="builder")&&(n.mode=t.mode);let a=Dn(t.openpondProfile);a&&(n.openpondProfile=a);let r=[],i=Array.isArray(t.accounts)?t.accounts:[];for(let u of i){let p=tc(u);p&&$n(r,p.handle,p.baseUrl)===-1&&r.push(p)}if(r.length===0){let u=Fe(t.activeProfile)?.handle||Et;r.push(ac(t,u))}let o=Fe(t.activeProfile),l=o?Nn(r,o):-1,c=r[l===-1?0:l];return n.accounts=r,n.activeProfile=Ve(c),n}s(co,"normalizeGlobalConfig");function rc(t,n,a){let r=t.accounts??[],i=N(a??process.env.OPENPOND_BASE_URL),o=ge(n);if(o)return i?{handle:o,baseUrl:i}:{handle:o};let l=ge(process.env.OPENPOND_ACCOUNT);if(l)return i?{handle:l,baseUrl:i}:{handle:l};let c=Fe(t.activeProfile);return c?i?{handle:c.handle,baseUrl:i}:c:r[0]?Ve(r[0]):{handle:Et}}s(rc,"resolveRequestedProfile");function mo(t,n,a){let r=N(a);if(r){let o=$n(t,n,r);if(o!==-1)return t[o]}else{let o=t.filter(l=>st(l.handle,n));if(o.length>1)throw new Error(`multiple profiles found for ${n}; pass --base-url to select one`);if(o.length===1)return o[0]}let i={handle:n};return r&&(i.baseUrl=r),t.push(i),i}s(mo,"ensureAccount");function io(t){t.session&&Object.keys(t.session).length===0&&delete t.session}s(io,"cleanupAccount");function oc(t,n,a,r){let i=a===null||a===void 0&&r.undefinedDeletes;switch(n){case"apiKey":{if(i){delete t.apiKey;return}typeof a=="string"&&(t.apiKey=a);return}case"baseUrl":{if(i){delete t.baseUrl;return}typeof a=="string"&&(t.baseUrl=a);return}case"apiBaseUrl":{if(i){delete t.apiBaseUrl;return}typeof a=="string"&&(t.apiBaseUrl=a);return}case"chatApiBaseUrl":{if(i){delete t.chatApiBaseUrl;return}typeof a=="string"&&(t.chatApiBaseUrl=a);return}case"token":case"appId":case"conversationId":{if(t.session||(t.session={}),i){delete t.session[n],io(t);return}(typeof a=="string"||a===null)&&(t.session[n]=a),io(t);return}}}s(oc,"applyScopedKey");function ic(t,n,a){if(!eo.some(u=>_e(n,u)))return!1;let i=t.accounts??[],o=Fe(n.activeProfile)??rc(t),l=N(_e(n,"baseUrl")?n.baseUrl??null:o.baseUrl??process.env.OPENPOND_BASE_URL),c=mo(i,o.handle,l);for(let u of eo)_e(n,u)&&oc(c,u,n[u],a);return t.accounts=i,t.activeProfile=Ve(c),!0}s(ic,"applyAccountPatch");function sc(t,n){if(_e(n,"lspEnabled")&&(typeof n.lspEnabled=="boolean"?t.lspEnabled=n.lspEnabled:n.lspEnabled===null&&delete t.lspEnabled),_e(n,"executionMode")&&(n.executionMode==="local"||n.executionMode==="hosted"?t.executionMode=n.executionMode:n.executionMode===null&&delete t.executionMode),_e(n,"mode")&&(n.mode==="general"||n.mode==="builder"?t.mode=n.mode:n.mode===null&&delete t.mode),_e(n,"activeProfile")){let a=Fe(n.activeProfile);if(a){let r=Nn(t.accounts??[],a);t.activeProfile=r===-1?a:Ve((t.accounts??[])[r])}else n.activeProfile===null&&delete t.activeProfile}if(_e(n,"openpondProfile")){let a=Dn(n.openpondProfile);a?t.openpondProfile=a:n.openpondProfile===null&&delete t.openpondProfile}}s(sc,"applyTopLevelPatch");async function Mt(t){let n=X();return await yn(n),await kr(n,a=>{let r=co(a);return t(r),r})}s(Mt,"updateGlobalConfig");async function V(){let t=X();return await yn(t),co(await _r(t))}s(V,"loadGlobalConfig");async function zn(){let t=await V(),n=Fe(t.activeProfile);return(t.accounts??[]).map(a=>{let r=ge(a.handle)??Et;return{handle:r,baseUrl:N(a.baseUrl),apiBaseUrl:N(a.apiBaseUrl),chatApiBaseUrl:N(a.chatApiBaseUrl),environment:a.environment?.trim()||null,isActive:!!(n&&lo({...a,handle:r},n)),hasApiKey:!!a.apiKey?.trim(),hasSessionToken:!!a.session?.token?.trim(),sessionAppId:a.session?.appId??null,sessionConversationId:a.session?.conversationId??null}})}s(zn,"listConfiguredProfiles");async function lc(t,n={}){let a=so(t),r=N(n.baseUrl),i=-1;await Mt(l=>{let c=l.accounts??[];if(i=Nn(c,r?{handle:a,baseUrl:r}:{handle:a},{requireUnambiguous:!0}),i===-1)throw new Error(`profile not found: ${a}`);l.activeProfile=Ve(c[i])});let o=await zn();return o.find(l=>l.isActive)??o[i]}s(lc,"setActiveProfile");async function cc(t){let n=so(t.handle),a=Zl(t.apiKey),r=N(t.baseUrl),i=N(t.apiBaseUrl),o=N(t.chatApiBaseUrl),l={handle:n};await Mt(p=>{let k=p.accounts??[],v=mo(k,n,r);v.apiKey=a,r&&(v.baseUrl=r),i?v.apiBaseUrl=i:t.apiBaseUrl===null&&delete v.apiBaseUrl,o?v.chatApiBaseUrl=o:t.chatApiBaseUrl===null&&delete v.chatApiBaseUrl,t.environment===null?delete v.environment:typeof t.environment=="string"&&t.environment.trim()&&(v.environment=t.environment.trim()),p.accounts=k,l=Ve(v),t.setActive!==!1&&(p.activeProfile=l)});let u=(await zn()).find(p=>st(p.handle,l.handle)?r?N(p.baseUrl)===r:!0:!1);if(!u)throw new Error(`failed to save profile: ${n}`);return u}s(cc,"saveProfileApiKey");async function ce(t){await Mt(n=>{sc(n,t),ic(n,t,{undefinedDeletes:!1})})}s(ce,"saveGlobalConfig");function Fn(t=null){return{actionCount:0,generatedAt:null,manifestPath:null,registryPath:null,stale:!0,error:t}}s(Fn,"emptyProfileCatalogState");function Vn(t=null){return{skillCount:0,generatedAt:null,stale:!0,error:t}}s(Vn,"emptyProfileSkillCatalogState");function Gn(){return{status:"ready",requirementCount:0,blockingCount:0,optionalMissingCount:0,readyCount:0,requirements:[],blockingRequirements:[]}}s(Gn,"emptyProfileSetupGate");function Ut(){return{changedAgents:[],newAgents:[],deletedAgents:[],changedSkills:[],changedActions:[],changedExtensions:[],setupChanges:[],envRequirementChanges:[],files:[]}}s(Ut,"emptyProfileDiffSummary");function Kn(t=null){return{state:t?"error":"none",message:t??"No active OpenPond profile.",agentCount:0,actionCount:0,defaultAction:null,checkFresh:!1,checkStaleReason:t??"No active profile.",localHead:null,hostedHead:null}}s(Kn,"emptyProfileSummary");import{existsSync as Ge}from"node:fs";import{readFile as mc,stat as uc}from"node:fs/promises";import Ht from"node:path";var uo=".openpond/agent-manifest.json",po=".openpond/action-registry.json",dc=".openpond/source-upload-metadata.json",pc=".openpond/agent-package-origin.json";async function ho(t){return xo({agentId:"default",sourcePath:t,preferred:!0})}s(ho,"loadProfileActionCatalog");async function bo(t){if(t.length===0)return{catalog:{actionCount:0,generatedAt:null,manifestPath:null,registryPath:null,stale:!0,error:"No profile agent sources are enabled."},actionCatalog:[],sourceSetupRequirements:[]};let n=[...t.filter(c=>c.preferred),...t.filter(c=>!c.preferred)],a=await Promise.all(n.map(xo)),r=new Map,i=[];for(let c of a)for(let u of c.actionCatalog){let p=r.has(u.id)?`${u.agentId??"agent"}.${u.sourceActionId??u.id}`:u.id,k=p===u.id?u:{...u,id:p};r.set(p,k),i.push(k)}let o=fc(a.map(c=>c.catalog.generatedAt)),l=a.map(c=>c.catalog.error).filter(Boolean);return{catalog:{actionCount:i.length,generatedAt:o,manifestPath:a.find(c=>c.catalog.manifestPath)?.catalog.manifestPath??null,registryPath:a.find(c=>c.catalog.registryPath)?.catalog.registryPath??null,stale:a.some(c=>c.catalog.stale),error:l.length>0?l.join("; "):null},actionCatalog:i,sourceSetupRequirements:a.flatMap(c=>c.sourceSetupRequirements)}}s(bo,"loadProfileActionCatalogForSources");async function xo(t){let n=t.sourcePath,a=Ht.join(n,uo),r=Ht.join(n,po),i=Ht.join(n,dc),o=Ht.join(n,pc);try{let l=await Lt(a),c=await Lt(r),u=await Lt(i),p=z(await Lt(o)),k=z(z(l)?.inputSchemas),v=fo(z(u)?.setupRequirements)??[],E=hc(v),H=new Map;for(let y of[...Wn(z(l)?.actionCatalog),...Wn(z(c)?.actions),...Wn(z(l)?.actions)]){let R=U(y.id)??U(y.name);if(!R)continue;let C=H.get(R),B=bc({sourceRequirementsByAction:E,actionId:R,actionName:U(y.name)}),Y=xc(fo(y.setupRequirements)??C?.setupRequirements??[],B),ye={id:R,agentId:t.agentId,sourcePath:n,sourceActionId:R,name:U(y.name)??C?.name??R,label:U(y.label)??C?.label??kc(R),description:U(y.description)??C?.description??null,visibility:U(y.visibility)??C?.visibility??"default",inputSchema:_c(y.inputSchema,k)??C?.inputSchema??null,outputSchema:yo(y.outputSchema)??C?.outputSchema??null,approvalPolicy:z(y.approvalPolicy)??C?.approvalPolicy??null,artifactPolicy:z(y.artifactPolicy)??C?.artifactPolicy??null,setupRequirements:Y,mcp:z(y.mcp)??C?.mcp??null,schedulePolicy:z(y.schedulePolicy)??C?.schedulePolicy??null,trace:gc(z(y.trace)??C?.trace??null,p),implementation:z(y.implementation)??C?.implementation??null,invokesModel:typeof y.invokesModel=="boolean"?y.invokesModel:C?.invokesModel};H.set(R,ye)}let x=Array.from(H.values()).filter(y=>y.visibility!=="internal"&&y.visibility!=="debug"),_=[...l?[]:[uo],...c?[]:[po]],w=await vc([a,r]);return{catalog:{actionCount:x.length,generatedAt:w,manifestPath:Ge(a)?a:null,registryPath:Ge(r)?r:null,stale:_.length>0,error:_.length>0?Sc(t,_):null},actionCatalog:x,sourceSetupRequirements:v}}catch(l){return{catalog:{actionCount:0,generatedAt:null,manifestPath:Ge(a)?a:null,registryPath:Ge(r)?r:null,stale:!0,error:l instanceof Error?l.message:String(l)},actionCatalog:[],sourceSetupRequirements:[]}}}s(xo,"loadProfileActionCatalogSource");function gc(t,n){if(!n)return t;let a=U(n.versionId),r=U(n.digest);return!a||!r?t:{...t??{},agentVersionId:a,agentPackageDigest:r,validationReceiptIds:go(n.validationReceiptIds),evalReceiptIds:go(n.evalReceiptIds)}}s(gc,"mergeAgentPackageTrace");function go(t){return Array.isArray(t)?t.filter(n=>typeof n=="string"&&n.trim().length>0):[]}s(go,"stringArray");function fc(t){let n=0;for(let a of t){if(!a)continue;let r=Date.parse(a);Number.isFinite(r)&&(n=Math.max(n,r))}return n>0?new Date(n).toISOString():null}s(fc,"latestIso");function hc(t){let n=new Map;for(let a of t){let r=[U(a.actionId),U(a.sourceActionId),U(a.actionName)].filter(i=>!!i);for(let i of r){let o=n.get(i)??[];o.push(a),n.set(i,o)}}return n}s(hc,"sourceSetupRequirementsByAction");function bc(t){return[...t.sourceRequirementsByAction.get(t.actionId)??[],...t.actionName&&t.actionName!==t.actionId?t.sourceRequirementsByAction.get(t.actionName)??[]:[]].map(a=>({...a,source:"source_upload_metadata"}))}s(bc,"setupRequirementsForActionSource");function xc(t,n){if(n.length===0)return t;let a=[],r=new Set;for(let i of[...t,...n]){let o=yc(i);r.has(o)||(r.add(o),a.push(i))}return a}s(xc,"mergeSetupRequirements");function yc(t){return[U(t.actionId)??U(t.sourceActionId)??U(t.actionName)??"",U(t.kind)??U(t.type)??"",U(t.name)??U(t.key)??U(t.provider)??U(t.tool)??U(t.command)??U(t.packageName)??U(t.path)??U(t.repo)??U(t.url)??U(t.id)??""].join(":")}s(yc,"setupRequirementIdentity");function Sc(t,n){return[`Profile agent ${t.agentId} at ${t.sourcePath} is missing SDK catalog artifact(s): ${n.join(", ")}.`,"Run `openpond profile check --kind all` after source materialization so each enabled profile agent has inspect/build artifacts."].join(" ")}s(Sc,"missingSourceArtifactsMessage");async function Lt(t){return Ge(t)?JSON.parse(await mc(t,"utf8")):null}s(Lt,"readJsonIfExists");async function vc(t){let n=0;for(let a of t){if(!Ge(a))continue;let r=await uc(a);n=Math.max(n,r.mtimeMs)}return n>0?new Date(n).toISOString():null}s(vc,"latestMtime");function z(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}s(z,"asRecord");function Wn(t){return Array.isArray(t)?t.filter(n=>!!z(n)):[]}s(Wn,"records");function fo(t){return Array.isArray(t)?t.filter(n=>!!z(n)):null}s(fo,"recordArray");function U(t){return typeof t=="string"&&t.trim()?t.trim():null}s(U,"text");function yo(t){return U(t)??z(t)}s(yo,"schemaValue");function _c(t,n){let a=yo(t);return typeof a!="string"?a:z(n?.[a])??a}s(_c,"resolvedSchemaValue");function kc(t){let n=t.replace(/[._-]+/g," ").trim();return n?n.replace(/\b\w/g,a=>a.toUpperCase()):t}s(kc,"titleFromActionId");var Bt=class extends Error{static{s(this,"OpenPondProfileSetupRequiredError")}code="agent_source_setup_required";details;constructor(n,a){let r=a.blockingRequirements.map(i=>i.label);super(["agent_source_setup_required",`Profile action ${n} has unresolved required setup.`,r.length?`Missing setup: ${r.join(", ")}`:""].filter(Boolean).join(`
|
|
2
|
+
import{$c as Un,I as Ur,Oa as On,U as In,W as An,Yc as Pt,Zc as Ct,_c as Tt,b as _n,c as It,ea as Pn,ed as Ne,fa as Cn,g as kn,ha as Hr,ka as Lr,la as Tn,lc as Mn,ma as jn,oa as Br,pa as qr,qa as $r,ra as Dr,sa as En,t as wn,ta as Nr,u as Rn,ua as zr,va as At,xb as Fr}from"./chunk-GA7VBKCH.js";import{a as Hn,b as Vr,c as Gr}from"./chunk-6MI4KKWF.js";import{b as ae,d as kt,e as wt}from"./chunk-J2S7BOZU.js";import{J as Cr,L as vn,M as Tr,N as jr,Za as Or,h as wr,i as Rr,k as Ir,l as Ar,p as ve,q as Pr,s as Rt,t as Sn,xa as Er,z as re}from"./chunk-UW6ES5DM.js";import{a as Mr}from"./chunk-6FA3GG5B.js";import{A as ot,B as mr,D as ur,Ja as _r,Ka as kr,M as dr,N as pr,O as $e,P as pn,Q as De,R as it,S as Se,U as gr,Ua as yn,V as fr,Y as hr,Z as br,_ as gn,aa as xr,ba as yr,ca as fn,da as Sr,f as _t,s as dn,t as cr,ya as bn,z as rt,za as xn}from"./chunk-NNLI4OWY.js";import{a as m,b as g,c as S,e as b,f as O,p as lr,q as $}from"./chunk-HZP5U2AA.js";import{b as e}from"./chunk-ES2ISFJC.js";import{f as X,h as vt,p as hn,r as vr}from"./chunk-H7IWJN7L.js";import{a as s}from"./chunk-FTQLQJQV.js";import{createHash as Fl}from"node:crypto";import{existsSync as Yr}from"node:fs";import{readdir as Xr,readFile as Qr,stat as Vl}from"node:fs/promises";import le from"node:path";var Ln="skills",jt="SKILL.md",Kr=8e4;async function Bn(t){let n=le.join(t,Ln);if(!Yr(n))return{skillCatalog:Wr({stale:!1}),skills:[]};try{let a=await Xr(n,{withFileTypes:!0}),r=(await Promise.all(a.filter(o=>o.isDirectory()).map(o=>Gl(t,o.name)))).sort((o,l)=>o.name.localeCompare(l.name)||o.path.localeCompare(l.path));Wl(r);let i=await Jl(t,r);return{skillCatalog:{skillCount:r.length,generatedAt:i,stale:!1,error:null},skills:r}}catch(a){return{skillCatalog:Wr({stale:!0,error:a instanceof Error?a.message:String(a)}),skills:[]}}}s(Bn,"loadProfileSkills");function ze(t){let n=[],a=/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)([\s\S]*)$/.exec(t);if(!a)return{name:null,description:null,body:t.trim(),messages:["SKILL.md must start with YAML frontmatter bounded by ---."]};let r=a[1]??"",i=(a[2]??"").trim(),o;try{o=Mr.load(r)}catch(p){n.push(`SKILL.md frontmatter is invalid YAML: ${p instanceof Error?p.message:String(p)}`)}let l=Yl(o),c=Jr(l?.name),u=Jr(l?.description);return c||n.push("Skill frontmatter must include a non-empty name."),u||n.push("Skill frontmatter must include a non-empty description."),i||n.push("Skill body must be non-empty markdown."),{name:c,description:u,body:i,messages:n}}s(ze,"parseProfileSkillMarkdown");async function wh(t){let n=t.name.trim();if(!Zr(n))throw new Error("Profile skill name must be lowercase kebab-case.");let r=(await Bn(t.profileSourcePath)).skills.find(c=>c.name===n);if(!r)throw new Error(`Profile skill not found: ${n}`);if(!r.enabled||r.validationStatus!=="valid"){let c=r.validationMessages.length>0?` ${r.validationMessages.join(" ")}`:"";throw new Error(`Profile skill ${n} is not valid.${c}`)}let i=le.join(t.profileSourcePath,r.path),o=await Qr(i,"utf8"),l=ze(o);if(l.messages.length>0)throw new Error(`Profile skill ${n} is not valid. ${l.messages.join(" ")}`);return{name:r.name,description:r.description,body:l.body,path:r.path,sourcePath:r.sourcePath,sourceHash:r.sourceHash,charCount:r.charCount,packagePath:le.dirname(i),resourceFiles:r.resourceFiles}}s(wh,"readProfileSkill");function Wr(t={}){return{skillCount:0,generatedAt:null,stale:t.stale??!0,error:t.error??null}}s(Wr,"emptyProfileSkillCatalogState");async function Gl(t,n){let a=le.join(Ln,n,jt).replace(/\\/g,"/"),r=le.join(t,a),i=[],o=le.join(t,Ln,n),l=await Kl(o),c="";Yr(r)?c=await Qr(r,"utf8"):i.push(`Missing ${jt}.`),c.length>Kr&&i.push(`Skill markdown exceeds the limit of ${Kr} characters.`);let u=ze(c);i.push(...u.messages);let p=u.name??n,k=u.description??"";return Zr(p)||i.push("Skill name must be lowercase kebab-case."),p!==n&&i.push(`Skill name must match its directory name (${n}).`),{name:p,description:k,path:a,scope:"profile",enabled:i.length===0,sourcePath:t,charCount:c.length,sourceHash:Xl(c),validationStatus:i.length>0?"error":"valid",validationMessages:i,resourceFiles:l.filter(v=>v!==jt)}}s(Gl,"loadProfileSkillDirectory");async function Kl(t){let n=[];async function a(r,i){let o=await Xr(r,{withFileTypes:!0});await Promise.all(o.map(async l=>{let c=i?`${i}/${l.name}`:l.name;l.isDirectory()?await a(le.join(r,l.name),c):l.isFile()&&n.push(c)}))}return s(a,"visit"),await a(t,""),n.sort()}s(Kl,"listPackageFiles");function Wl(t){let n=new Map;for(let a of t)n.set(a.name,(n.get(a.name)??0)+1);for(let a of t)(n.get(a.name)??0)<=1||(a.enabled=!1,a.validationStatus="error",a.validationMessages=[...a.validationMessages,`Duplicate skill name: ${a.name}`])}s(Wl,"markDuplicateSkillNames");async function Jl(t,n){let a=0;for(let r of n){let i=le.dirname(le.join(t,r.path)),o=[jt,...r.resourceFiles];for(let l of o){let c=await Vl(le.join(i,l)).catch(()=>null);c?.isFile()&&(a=Math.max(a,c.mtimeMs))}}return a>0?new Date(a).toISOString():null}s(Jl,"latestSkillMtime");function Zr(t){return/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(t)}s(Zr,"isKebabCaseSkillName");function Yl(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}s(Yl,"asRecord");function Jr(t){if(typeof t!="string")return null;let n=t.trim();return n.length>0?n:null}s(Jr,"text");function Xl(t){return Fl("sha256").update(t).digest("hex")}s(Xl,"sha256Hex");import{createRequire as Fo}from"node:module";import{createHash as Bo,randomUUID as qo}from"node:crypto";import{spawn as Xc}from"node:child_process";import{existsSync as G}from"node:fs";import{cp as Qc,mkdir as ue,readFile as Vo,readdir as Go,rename as ra,rm as oa,symlink as Zc,writeFile as Je}from"node:fs/promises";import f from"node:path";import Ql from"node:path";var Et="default",eo=["apiKey","baseUrl","apiBaseUrl","chatApiBaseUrl","token","appId","conversationId"];function _e(t,n){return Object.prototype.hasOwnProperty.call(t,n)}s(_e,"hasOwn");function ge(t){if(typeof t!="string")return null;let n=t.trim();return n.length>0?n:null}s(ge,"normalizeHandle");function N(t){if(typeof t!="string")return null;let n=t.trim();return n?n.replace(/\/$/,""):null}s(N,"normalizeBaseUrl");function so(t){let n=ge(t);if(!n)throw new Error("profile handle must be non-empty");return n}s(so,"requireHandle");function Zl(t){if(typeof t!="string")throw new Error("apiKey must be a non-empty string");let n=t.trim();if(!n)throw new Error("apiKey must be a non-empty string");return n}s(Zl,"requireApiKey");function st(t,n){let a=ge(t),r=ge(n);return!!(a&&r&&a.toLowerCase()===r.toLowerCase())}s(st,"handleEquals");function $n(t,n,a){let r=N(a);return t.findIndex(i=>st(i.handle,n)?r?N(i.baseUrl)===r:!0:!1)}s($n,"findAccountIndex");function Ve(t){let n=ge(t.handle)??Et,a=N(t.baseUrl);return a?{handle:n,baseUrl:a}:{handle:n}}s(Ve,"selectorFromAccount");function Fe(t){if(!t||typeof t!="object"||Array.isArray(t))return null;let n=t,a=ge(typeof n.handle=="string"?n.handle:void 0);if(!a)return null;let r=N(typeof n.baseUrl=="string"?n.baseUrl:void 0);return r?{handle:a,baseUrl:r}:{handle:a}}s(Fe,"sanitizeActiveProfile");function Dn(t){if(!t||typeof t!="object"||Array.isArray(t))return;let n=t,a=typeof n.repoPath=="string"?n.repoPath.trim():"",r=typeof n.profile=="string"&&n.profile.trim()?n.profile.trim():"default";if(!a)return;let i={repoPath:a,profile:r,mode:"local"};if(n.lastCheck&&typeof n.lastCheck=="object"&&!Array.isArray(n.lastCheck)){let o=n.lastCheck,l=o.command,c=o.status,u=o.checkedAt;(l==="inspect"||l==="build"||l==="validate"||l==="eval"||l==="run")&&(c==="passed"||c==="failed")&&typeof u=="string"&&(i.lastCheck={command:l,status:c,checkedAt:u,...typeof o.exitCode=="number"||o.exitCode===null?{exitCode:o.exitCode}:{},...typeof o.sourceHead=="string"||o.sourceHead===null?{sourceHead:o.sourceHead}:{}})}if(n.lastPush&&typeof n.lastPush=="object"&&!Array.isArray(n.lastPush)){let o=n.lastPush,l=o.status,c=o.pushedAt;(l==="pushed"||l==="failed")&&typeof c=="string"&&(i.lastPush={status:l,pushedAt:c,...typeof o.teamId=="string"||o.teamId===null?{teamId:o.teamId}:{},...typeof o.projectId=="string"||o.projectId===null?{projectId:o.projectId}:{},...typeof o.localHead=="string"||o.localHead===null?{localHead:o.localHead}:{},...typeof o.hostedHead=="string"||o.hostedHead===null?{hostedHead:o.hostedHead}:{},...typeof o.sourceRef=="string"||o.sourceRef===null?{sourceRef:o.sourceRef}:{},...o.promotionStatus==="uploaded"||o.promotionStatus==="hosted_source_materialized"||o.promotionStatus==="hosted_source_materialize_failed"||o.promotionStatus==="hosted_source_check_pending"||o.promotionStatus==="hosted_source_check_failed"||o.promotionStatus==="hosted_source_published"||o.promotionStatus==="hosted_source_publish_failed"||o.promotionStatus==="hosted_run_pending"||o.promotionStatus==="hosted_run_passed"||o.promotionStatus==="hosted_run_failed"||o.promotionStatus===null?{promotionStatus:o.promotionStatus}:{},...o.hostedRunStatus==="not_started"||o.hostedRunStatus==="running"||o.hostedRunStatus==="passed"||o.hostedRunStatus==="failed"||o.hostedRunStatus===null?{hostedRunStatus:o.hostedRunStatus}:{},...typeof o.hostedRunAgentId=="string"||o.hostedRunAgentId===null?{hostedRunAgentId:o.hostedRunAgentId}:{},...typeof o.hostedRunId=="string"||o.hostedRunId===null?{hostedRunId:o.hostedRunId}:{},...typeof o.hostedRunAt=="string"||o.hostedRunAt===null?{hostedRunAt:o.hostedRunAt}:{},...to(o.hostedSourceMaterialization)?{hostedSourceMaterialization:to(o.hostedSourceMaterialization)}:{},...no(o.hostedSourceCheck)?{hostedSourceCheck:no(o.hostedSourceCheck)}:{},...ao(o.hostedPublish)?{hostedPublish:ao(o.hostedPublish)}:{},...ro(o.hostedRun)?{hostedRun:ro(o.hostedRun)}:{},...typeof o.error=="string"||o.error===null?{error:o.error}:{}})}if(Array.isArray(n.profiles)){let o=n.profiles.flatMap(l=>{let c=Dn(l);if(!c)return[];let u=l,p=u.source==="github"||u.source==="openpond_git"?u.source:"local",k=typeof u.repositoryId=="string"&&u.repositoryId.trim()?u.repositoryId.trim():Ql.resolve(c.repoPath);return[{source:p,repositoryId:k,repoPath:c.repoPath,profile:c.profile,...c.lastCheck?{lastCheck:c.lastCheck}:{},...c.lastPush?{lastPush:c.lastPush}:{}}]});o.length>0&&(i.profiles=o)}return i}s(Dn,"sanitizeLocalOpenPondProfile");function to(t){if(!t||typeof t!="object"||Array.isArray(t))return null;let n=t,a=Ot(n.status);return a?{status:a,...A(n,"agentId"),...A(n,"runtimeAgentId"),...A(n,"projectId"),...A(n,"sourceRoot"),...A(n,"sourceRef"),...A(n,"sourceCommitSha"),...A(n,"manifestHash"),...A(n,"manifestPath"),...A(n,"manifestSyncedAt"),...oo(n,"fileCount"),...oo(n,"totalBytes"),...A(n,"generatedManifestPath"),...qn(n,"synthesizedOpenPondYaml"),...A(n,"uploadMetadataPath"),...F(n,"setupCommands"),...F(n,"validationCommands"),...A(n,"materializedAt"),...A(n,"error")}:null}s(to,"sanitizeHostedMaterializationStatus");function no(t){if(!t||typeof t!="object"||Array.isArray(t))return null;let n=t,a=Ot(n.status);return a?{status:a,...A(n,"agentId"),...A(n,"deployPlanStatus"),...qn(n,"canRun"),...qn(n,"canDeploy"),...A(n,"sourceRef"),...A(n,"sourceCommitSha"),...A(n,"manifestHash"),...A(n,"manifestPath"),...F(n,"setupCommands"),...F(n,"validationCommands"),...F(n,"requiredChecks"),...F(n,"evalNames"),...F(n,"blockedReasons"),...F(n,"staleReasons"),...A(n,"runtimeId"),...A(n,"sandboxId"),...F(n,"traceArtifactRefs"),...F(n,"evalResultArtifactRefs"),...F(n,"validatorArtifactRefs"),...A(n,"checkedAt"),...A(n,"error")}:null}s(no,"sanitizeHostedSourceCheckStatus");function ao(t){if(!t||typeof t!="object"||Array.isArray(t))return null;let n=t,a=Ot(n.status);return a?{status:a,...A(n,"agentId"),...A(n,"snapshotId"),...A(n,"sourceRef"),...A(n,"sourceCommitSha"),...A(n,"manifestHash"),...A(n,"manifestPath"),...A(n,"buildStatus"),...A(n,"validationStatus"),...A(n,"evalStatus"),...A(n,"publishedAt"),...A(n,"error")}:null}s(ao,"sanitizeHostedPublishStatus");function ro(t){if(!t||typeof t!="object"||Array.isArray(t))return null;let n=t,a=Ot(n.status);return a?{status:a,...A(n,"agentId"),...A(n,"runId"),...A(n,"runtimeId"),...A(n,"sandboxId"),...A(n,"sourceRef"),...A(n,"sourceCommitSha"),...A(n,"manifestHash"),...A(n,"setupGateStatus"),...F(n,"setupRequirementRefs"),...F(n,"artifactRefs"),...F(n,"traceArtifactRefs"),...F(n,"evalArtifactRefs"),...A(n,"startedAt"),...A(n,"completedAt"),...A(n,"error")}:null}s(ro,"sanitizeHostedRunSummary");function A(t,n){let a=t[n];return typeof a=="string"||a===null?{[n]:a}:{}}s(A,"nullableStringProp");function qn(t,n){let a=t[n];return typeof a=="boolean"||a===null?{[n]:a}:{}}s(qn,"nullableBooleanProp");function oo(t,n){let a=t[n];return typeof a=="number"||a===null?{[n]:a}:{}}s(oo,"nullableNumberProp");function F(t,n){let a=t[n];if(!Array.isArray(a))return{};let r=a.filter(i=>typeof i=="string");return{[n]:r}}s(F,"stringArrayProp");function Ot(t){return typeof t=="string"&&t.trim()?t.trim():null}s(Ot,"stringField");function lo(t,n){if(!st(t.handle,n.handle))return!1;let a=N(n.baseUrl);return a?N(t.baseUrl)===a:!N(t.baseUrl)}s(lo,"accountMatchesSelector");function Nn(t,n,a={}){let r=N(n.baseUrl);if(r)return $n(t,n.handle,r);let i=t.findIndex(l=>lo(l,n));if(i!==-1)return i;let o=t.map((l,c)=>({account:l,index:c})).filter(({account:l})=>st(l.handle,n.handle));if(o.length>1&&a.requireUnambiguous)throw new Error(`multiple profiles found for ${n.handle}; pass --base-url to select one`);return o[0]?.index??-1}s(Nn,"findAccountIndexForSelector");function ec(t){if(!t||typeof t!="object"||Array.isArray(t))return;let n=t,a={};return typeof n.token=="string"&&(a.token=n.token),(typeof n.appId=="string"||n.appId===null)&&(a.appId=n.appId),(typeof n.conversationId=="string"||n.conversationId===null)&&(a.conversationId=n.conversationId),Object.keys(a).length>0?a:void 0}s(ec,"sanitizeSession");function tc(t){if(!t||typeof t!="object"||Array.isArray(t))return null;let n=t,a=ge(typeof n.handle=="string"?n.handle:void 0);if(!a)return null;let r={handle:a};typeof n.apiKey=="string"&&(r.apiKey=n.apiKey),typeof n.baseUrl=="string"&&(r.baseUrl=n.baseUrl),typeof n.apiBaseUrl=="string"&&(r.apiBaseUrl=n.apiBaseUrl),typeof n.chatApiBaseUrl=="string"&&(r.chatApiBaseUrl=n.chatApiBaseUrl),typeof n.environment=="string"&&(r.environment=n.environment);let i=ec(n.session);return i&&(r.session=i),r}s(tc,"sanitizeAccount");function nc(t){let n={};return typeof t.token=="string"&&(n.token=t.token),(typeof t.appId=="string"||t.appId===null)&&(n.appId=t.appId),(typeof t.conversationId=="string"||t.conversationId===null)&&(n.conversationId=t.conversationId),Object.keys(n).length>0?n:void 0}s(nc,"extractLegacySession");function ac(t,n){let a={handle:n};typeof t.apiKey=="string"&&(a.apiKey=t.apiKey),typeof t.baseUrl=="string"&&(a.baseUrl=t.baseUrl),typeof t.apiBaseUrl=="string"&&(a.apiBaseUrl=t.apiBaseUrl),typeof t.chatApiBaseUrl=="string"&&(a.chatApiBaseUrl=t.chatApiBaseUrl);let r=nc(t);return r&&(a.session=r),a}s(ac,"extractLegacyAccount");function co(t){let n={};typeof t.lspEnabled=="boolean"&&(n.lspEnabled=t.lspEnabled),(t.executionMode==="local"||t.executionMode==="hosted")&&(n.executionMode=t.executionMode),(t.mode==="general"||t.mode==="builder")&&(n.mode=t.mode);let a=Dn(t.openpondProfile);a&&(n.openpondProfile=a);let r=[],i=Array.isArray(t.accounts)?t.accounts:[];for(let u of i){let p=tc(u);p&&$n(r,p.handle,p.baseUrl)===-1&&r.push(p)}if(r.length===0){let u=Fe(t.activeProfile)?.handle||Et;r.push(ac(t,u))}let o=Fe(t.activeProfile),l=o?Nn(r,o):-1,c=r[l===-1?0:l];return n.accounts=r,n.activeProfile=Ve(c),n}s(co,"normalizeGlobalConfig");function rc(t,n,a){let r=t.accounts??[],i=N(a??process.env.OPENPOND_BASE_URL),o=ge(n);if(o)return i?{handle:o,baseUrl:i}:{handle:o};let l=ge(process.env.OPENPOND_ACCOUNT);if(l)return i?{handle:l,baseUrl:i}:{handle:l};let c=Fe(t.activeProfile);return c?i?{handle:c.handle,baseUrl:i}:c:r[0]?Ve(r[0]):{handle:Et}}s(rc,"resolveRequestedProfile");function mo(t,n,a){let r=N(a);if(r){let o=$n(t,n,r);if(o!==-1)return t[o]}else{let o=t.filter(l=>st(l.handle,n));if(o.length>1)throw new Error(`multiple profiles found for ${n}; pass --base-url to select one`);if(o.length===1)return o[0]}let i={handle:n};return r&&(i.baseUrl=r),t.push(i),i}s(mo,"ensureAccount");function io(t){t.session&&Object.keys(t.session).length===0&&delete t.session}s(io,"cleanupAccount");function oc(t,n,a,r){let i=a===null||a===void 0&&r.undefinedDeletes;switch(n){case"apiKey":{if(i){delete t.apiKey;return}typeof a=="string"&&(t.apiKey=a);return}case"baseUrl":{if(i){delete t.baseUrl;return}typeof a=="string"&&(t.baseUrl=a);return}case"apiBaseUrl":{if(i){delete t.apiBaseUrl;return}typeof a=="string"&&(t.apiBaseUrl=a);return}case"chatApiBaseUrl":{if(i){delete t.chatApiBaseUrl;return}typeof a=="string"&&(t.chatApiBaseUrl=a);return}case"token":case"appId":case"conversationId":{if(t.session||(t.session={}),i){delete t.session[n],io(t);return}(typeof a=="string"||a===null)&&(t.session[n]=a),io(t);return}}}s(oc,"applyScopedKey");function ic(t,n,a){if(!eo.some(u=>_e(n,u)))return!1;let i=t.accounts??[],o=Fe(n.activeProfile)??rc(t),l=N(_e(n,"baseUrl")?n.baseUrl??null:o.baseUrl??process.env.OPENPOND_BASE_URL),c=mo(i,o.handle,l);for(let u of eo)_e(n,u)&&oc(c,u,n[u],a);return t.accounts=i,t.activeProfile=Ve(c),!0}s(ic,"applyAccountPatch");function sc(t,n){if(_e(n,"lspEnabled")&&(typeof n.lspEnabled=="boolean"?t.lspEnabled=n.lspEnabled:n.lspEnabled===null&&delete t.lspEnabled),_e(n,"executionMode")&&(n.executionMode==="local"||n.executionMode==="hosted"?t.executionMode=n.executionMode:n.executionMode===null&&delete t.executionMode),_e(n,"mode")&&(n.mode==="general"||n.mode==="builder"?t.mode=n.mode:n.mode===null&&delete t.mode),_e(n,"activeProfile")){let a=Fe(n.activeProfile);if(a){let r=Nn(t.accounts??[],a);t.activeProfile=r===-1?a:Ve((t.accounts??[])[r])}else n.activeProfile===null&&delete t.activeProfile}if(_e(n,"openpondProfile")){let a=Dn(n.openpondProfile);a?t.openpondProfile=a:n.openpondProfile===null&&delete t.openpondProfile}}s(sc,"applyTopLevelPatch");async function Mt(t){let n=X();return await yn(n),await kr(n,a=>{let r=co(a);return t(r),r})}s(Mt,"updateGlobalConfig");async function V(){let t=X();return await yn(t),co(await _r(t))}s(V,"loadGlobalConfig");async function zn(){let t=await V(),n=Fe(t.activeProfile);return(t.accounts??[]).map(a=>{let r=ge(a.handle)??Et;return{handle:r,baseUrl:N(a.baseUrl),apiBaseUrl:N(a.apiBaseUrl),chatApiBaseUrl:N(a.chatApiBaseUrl),environment:a.environment?.trim()||null,isActive:!!(n&&lo({...a,handle:r},n)),hasApiKey:!!a.apiKey?.trim(),hasSessionToken:!!a.session?.token?.trim(),sessionAppId:a.session?.appId??null,sessionConversationId:a.session?.conversationId??null}})}s(zn,"listConfiguredProfiles");async function lc(t,n={}){let a=so(t),r=N(n.baseUrl),i=-1;await Mt(l=>{let c=l.accounts??[];if(i=Nn(c,r?{handle:a,baseUrl:r}:{handle:a},{requireUnambiguous:!0}),i===-1)throw new Error(`profile not found: ${a}`);l.activeProfile=Ve(c[i])});let o=await zn();return o.find(l=>l.isActive)??o[i]}s(lc,"setActiveProfile");async function cc(t){let n=so(t.handle),a=Zl(t.apiKey),r=N(t.baseUrl),i=N(t.apiBaseUrl),o=N(t.chatApiBaseUrl),l={handle:n};await Mt(p=>{let k=p.accounts??[],v=mo(k,n,r);v.apiKey=a,r&&(v.baseUrl=r),i?v.apiBaseUrl=i:t.apiBaseUrl===null&&delete v.apiBaseUrl,o?v.chatApiBaseUrl=o:t.chatApiBaseUrl===null&&delete v.chatApiBaseUrl,t.environment===null?delete v.environment:typeof t.environment=="string"&&t.environment.trim()&&(v.environment=t.environment.trim()),p.accounts=k,l=Ve(v),t.setActive!==!1&&(p.activeProfile=l)});let u=(await zn()).find(p=>st(p.handle,l.handle)?r?N(p.baseUrl)===r:!0:!1);if(!u)throw new Error(`failed to save profile: ${n}`);return u}s(cc,"saveProfileApiKey");async function ce(t){await Mt(n=>{sc(n,t),ic(n,t,{undefinedDeletes:!1})})}s(ce,"saveGlobalConfig");function Fn(t=null){return{actionCount:0,generatedAt:null,manifestPath:null,registryPath:null,stale:!0,error:t}}s(Fn,"emptyProfileCatalogState");function Vn(t=null){return{skillCount:0,generatedAt:null,stale:!0,error:t}}s(Vn,"emptyProfileSkillCatalogState");function Gn(){return{status:"ready",requirementCount:0,blockingCount:0,optionalMissingCount:0,readyCount:0,requirements:[],blockingRequirements:[]}}s(Gn,"emptyProfileSetupGate");function Ut(){return{changedAgents:[],newAgents:[],deletedAgents:[],changedSkills:[],changedActions:[],changedExtensions:[],setupChanges:[],envRequirementChanges:[],files:[]}}s(Ut,"emptyProfileDiffSummary");function Kn(t=null){return{state:t?"error":"none",message:t??"No active OpenPond profile.",agentCount:0,actionCount:0,defaultAction:null,checkFresh:!1,checkStaleReason:t??"No active profile.",localHead:null,hostedHead:null}}s(Kn,"emptyProfileSummary");import{existsSync as Ge}from"node:fs";import{readFile as mc,stat as uc}from"node:fs/promises";import Ht from"node:path";var uo=".openpond/agent-manifest.json",po=".openpond/action-registry.json",dc=".openpond/source-upload-metadata.json",pc=".openpond/agent-package-origin.json";async function ho(t){return xo({agentId:"default",sourcePath:t,preferred:!0})}s(ho,"loadProfileActionCatalog");async function bo(t){if(t.length===0)return{catalog:{actionCount:0,generatedAt:null,manifestPath:null,registryPath:null,stale:!0,error:"No profile agent sources are enabled."},actionCatalog:[],sourceSetupRequirements:[]};let n=[...t.filter(c=>c.preferred),...t.filter(c=>!c.preferred)],a=await Promise.all(n.map(xo)),r=new Map,i=[];for(let c of a)for(let u of c.actionCatalog){let p=r.has(u.id)?`${u.agentId??"agent"}.${u.sourceActionId??u.id}`:u.id,k=p===u.id?u:{...u,id:p};r.set(p,k),i.push(k)}let o=fc(a.map(c=>c.catalog.generatedAt)),l=a.map(c=>c.catalog.error).filter(Boolean);return{catalog:{actionCount:i.length,generatedAt:o,manifestPath:a.find(c=>c.catalog.manifestPath)?.catalog.manifestPath??null,registryPath:a.find(c=>c.catalog.registryPath)?.catalog.registryPath??null,stale:a.some(c=>c.catalog.stale),error:l.length>0?l.join("; "):null},actionCatalog:i,sourceSetupRequirements:a.flatMap(c=>c.sourceSetupRequirements)}}s(bo,"loadProfileActionCatalogForSources");async function xo(t){let n=t.sourcePath,a=Ht.join(n,uo),r=Ht.join(n,po),i=Ht.join(n,dc),o=Ht.join(n,pc);try{let l=await Lt(a),c=await Lt(r),u=await Lt(i),p=z(await Lt(o)),k=z(z(l)?.inputSchemas),v=fo(z(u)?.setupRequirements)??[],E=hc(v),H=new Map;for(let y of[...Wn(z(l)?.actionCatalog),...Wn(z(c)?.actions),...Wn(z(l)?.actions)]){let R=U(y.id)??U(y.name);if(!R)continue;let C=H.get(R),B=bc({sourceRequirementsByAction:E,actionId:R,actionName:U(y.name)}),Y=xc(fo(y.setupRequirements)??C?.setupRequirements??[],B),ye={id:R,agentId:t.agentId,sourcePath:n,sourceActionId:R,name:U(y.name)??C?.name??R,label:U(y.label)??C?.label??kc(R),description:U(y.description)??C?.description??null,visibility:U(y.visibility)??C?.visibility??"default",inputSchema:_c(y.inputSchema,k)??C?.inputSchema??null,outputSchema:yo(y.outputSchema)??C?.outputSchema??null,approvalPolicy:z(y.approvalPolicy)??C?.approvalPolicy??null,artifactPolicy:z(y.artifactPolicy)??C?.artifactPolicy??null,setupRequirements:Y,mcp:z(y.mcp)??C?.mcp??null,schedulePolicy:z(y.schedulePolicy)??C?.schedulePolicy??null,trace:gc(z(y.trace)??C?.trace??null,p),implementation:z(y.implementation)??C?.implementation??null,invokesModel:typeof y.invokesModel=="boolean"?y.invokesModel:C?.invokesModel};H.set(R,ye)}let x=Array.from(H.values()).filter(y=>y.visibility!=="internal"&&y.visibility!=="debug"),_=[...l?[]:[uo],...c?[]:[po]],w=await vc([a,r]);return{catalog:{actionCount:x.length,generatedAt:w,manifestPath:Ge(a)?a:null,registryPath:Ge(r)?r:null,stale:_.length>0,error:_.length>0?Sc(t,_):null},actionCatalog:x,sourceSetupRequirements:v}}catch(l){return{catalog:{actionCount:0,generatedAt:null,manifestPath:Ge(a)?a:null,registryPath:Ge(r)?r:null,stale:!0,error:l instanceof Error?l.message:String(l)},actionCatalog:[],sourceSetupRequirements:[]}}}s(xo,"loadProfileActionCatalogSource");function gc(t,n){if(!n)return t;let a=U(n.versionId),r=U(n.digest);return!a||!r?t:{...t??{},agentVersionId:a,agentPackageDigest:r,validationReceiptIds:go(n.validationReceiptIds),evalReceiptIds:go(n.evalReceiptIds)}}s(gc,"mergeAgentPackageTrace");function go(t){return Array.isArray(t)?t.filter(n=>typeof n=="string"&&n.trim().length>0):[]}s(go,"stringArray");function fc(t){let n=0;for(let a of t){if(!a)continue;let r=Date.parse(a);Number.isFinite(r)&&(n=Math.max(n,r))}return n>0?new Date(n).toISOString():null}s(fc,"latestIso");function hc(t){let n=new Map;for(let a of t){let r=[U(a.actionId),U(a.sourceActionId),U(a.actionName)].filter(i=>!!i);for(let i of r){let o=n.get(i)??[];o.push(a),n.set(i,o)}}return n}s(hc,"sourceSetupRequirementsByAction");function bc(t){return[...t.sourceRequirementsByAction.get(t.actionId)??[],...t.actionName&&t.actionName!==t.actionId?t.sourceRequirementsByAction.get(t.actionName)??[]:[]].map(a=>({...a,source:"source_upload_metadata"}))}s(bc,"setupRequirementsForActionSource");function xc(t,n){if(n.length===0)return t;let a=[],r=new Set;for(let i of[...t,...n]){let o=yc(i);r.has(o)||(r.add(o),a.push(i))}return a}s(xc,"mergeSetupRequirements");function yc(t){return[U(t.actionId)??U(t.sourceActionId)??U(t.actionName)??"",U(t.kind)??U(t.type)??"",U(t.name)??U(t.key)??U(t.provider)??U(t.tool)??U(t.command)??U(t.packageName)??U(t.path)??U(t.repo)??U(t.url)??U(t.id)??""].join(":")}s(yc,"setupRequirementIdentity");function Sc(t,n){return[`Profile agent ${t.agentId} at ${t.sourcePath} is missing SDK catalog artifact(s): ${n.join(", ")}.`,"Run `openpond profile check --kind all` after source materialization so each enabled profile agent has inspect/build artifacts."].join(" ")}s(Sc,"missingSourceArtifactsMessage");async function Lt(t){return Ge(t)?JSON.parse(await mc(t,"utf8")):null}s(Lt,"readJsonIfExists");async function vc(t){let n=0;for(let a of t){if(!Ge(a))continue;let r=await uc(a);n=Math.max(n,r.mtimeMs)}return n>0?new Date(n).toISOString():null}s(vc,"latestMtime");function z(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}s(z,"asRecord");function Wn(t){return Array.isArray(t)?t.filter(n=>!!z(n)):[]}s(Wn,"records");function fo(t){return Array.isArray(t)?t.filter(n=>!!z(n)):null}s(fo,"recordArray");function U(t){return typeof t=="string"&&t.trim()?t.trim():null}s(U,"text");function yo(t){return U(t)??z(t)}s(yo,"schemaValue");function _c(t,n){let a=yo(t);return typeof a!="string"?a:z(n?.[a])??a}s(_c,"resolvedSchemaValue");function kc(t){let n=t.replace(/[._-]+/g," ").trim();return n?n.replace(/\b\w/g,a=>a.toUpperCase()):t}s(kc,"titleFromActionId");var Bt=class extends Error{static{s(this,"OpenPondProfileSetupRequiredError")}code="agent_source_setup_required";details;constructor(n,a){let r=a.blockingRequirements.map(i=>i.label);super(["agent_source_setup_required",`Profile action ${n} has unresolved required setup.`,r.length?`Missing setup: ${r.join(", ")}`:""].filter(Boolean).join(`
|
|
3
3
|
`)),this.name="OpenPondProfileSetupRequiredError",this.details={error:"agent_source_setup_required",actionId:n,setupGate:a,missing:r,blockingSetupRequirements:a.blockingRequirements,setupRequirements:a.requirements}}};function qt(t){let n=new Map;for(let l of t.sourceSetupRequirements??[]){let c=Rc(l);if(t.actionId&&c&&c!==t.actionId&&q(l.actionName)!==t.actionId&&q(l.sourceActionId)!==t.actionId)continue;let u=So({record:l,source:"source_upload_metadata",actionId:c});u&&n.set(u.ref,u)}for(let l of t.actionCatalog)if(!(t.actionId&&l.id!==t.actionId&&l.name!==t.actionId))for(let c of l.setupRequirements??[]){let u=So({record:c,source:"action_catalog",actionId:l.id});u&&n.set(u.ref,u)}let a=Array.from(n.values()),r=a.filter(l=>l.blocking),i=a.filter(l=>!l.required&&!Jn(l.status)).length,o=a.filter(l=>Jn(l.status)).length;return{status:Ac(r),requirementCount:a.length,blockingCount:r.length,optionalMissingCount:i,readyCount:o,requirements:a,blockingRequirements:r}}s(qt,"buildOpenPondProfileSetupGate");function Yn(t,n){if(n.blockingRequirements.length>0)throw new Bt(t,n)}s(Yn,"assertOpenPondProfileActionReady");function wc(t){let n=t.actionId?`${t.actionId}: `:"",a=t.required?"required":"optional";return`${n}${t.label} (${a}, ${t.status})`}s(wc,"formatOpenPondProfileSetupRequirement");function So(t){let n=t.source==="action_catalog"&&q(t.record.source)==="source_upload_metadata"?"source_upload_metadata":t.source,a=q(t.record.kind)??q(t.record.type),r=q(t.record.label)??q(t.record.name)??q(t.record.key)??q(t.record.provider)??q(t.record.tool)??q(t.record.command)??q(t.record.packageName)??q(t.record.path)??q(t.record.repo)??q(t.record.url)??q(t.record.id)??a??"setup requirement",i=t.record.required!==!1,o=Ic(t.record);return{ref:[n,t.actionId??"source",a??"requirement",r].join(":"),source:n,actionId:t.actionId,kind:a,label:r,status:o,required:i,blocking:i&&!Jn(o)}}s(So,"setupRequirementFromRecord");function Rc(t){return q(t.actionId)??q(t.sourceActionId)??q(t.actionName)}s(Rc,"setupRequirementActionId");function Ic(t){let n=q(t.status)??q(t.state);return n?n==="satisfied"||n==="connected"||n==="provided"?"ready":n:typeof t.satisfied=="boolean"?t.satisfied?"ready":"setup_required":typeof t.ready=="boolean"&&t.ready?"ready":"setup_required"}s(Ic,"setupStatus");function Ac(t){return t.length===0?"ready":t.some(n=>["blocked","unsupported","unsupported_dependency","stale"].includes(n.status))?"blocked":"setup_required"}s(Ac,"gateStatus");function Jn(t){return t==="ready"||t==="disabled"}s(Jn,"isReadyStatus");function q(t){return typeof t=="string"&&t.trim()?t.trim():null}s(q,"text");import{spawn as Pc}from"node:child_process";import{randomUUID as Cc}from"node:crypto";import{existsSync as Xn}from"node:fs";import{readFile as Tc,rm as jc,writeFile as ko}from"node:fs/promises";import $t from"node:path";var wo=["**/node_modules/","**/.bun/","**/.env","**/.env.*","**/.openpond/traces/","**/.openpond/vendor/","**/.openpond/eval-results.json","**/.openpond/artifact-index.json","**/.openpond/source-upload-cache.json",""].join(`
|
|
4
4
|
`);async function Ro(t){if(!Xn($t.join(t,".git"))){let o=await J(t,["init","-b","main"]);if(o.code!==0)throw new Error(Pe("git init",o))}let n=$t.join(t,".gitignore");if(Xn(n)?await Ec(n):await ko(n,wo,"utf8"),await Mc(t))return;let a=await Ce(t);if(!a.dirty&&a.files.length===0)return;let r=await J(t,["add","-A"]);if(r.code!==0)throw new Error(Pe("git add",r));let i=await J(t,["commit","-m","Initialize OpenPond profile"],{env:{...process.env,GIT_AUTHOR_NAME:process.env.GIT_AUTHOR_NAME||"OpenPond",GIT_AUTHOR_EMAIL:process.env.GIT_AUTHOR_EMAIL||"openpond@example.invalid",GIT_COMMITTER_NAME:process.env.GIT_COMMITTER_NAME||"OpenPond",GIT_COMMITTER_EMAIL:process.env.GIT_COMMITTER_EMAIL||"openpond@example.invalid"}});if(i.code!==0&&!/nothing to commit/i.test(i.stdout+i.stderr))throw new Error(Pe("git commit",i))}s(Ro,"ensureProfileGitRepo");async function Ec(t){let n=await Tc(t,"utf8").catch(()=>""),a=wo.split(/\r?\n/).map(i=>i.trim()).filter(Boolean).filter(i=>!n.split(/\r?\n/).some(o=>o.trim()===i));if(a.length===0)return;let r=n.endsWith(`
|
|
5
5
|
`)||n.length===0?"":`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{i as a,j as b,k as c}from"./chunk-
|
|
2
|
+
import{i as a,j as b,k as c}from"./chunk-B3RE35SQ.js";import"./chunk-5NGYLR3V.js";import"./chunk-J2MP4LSF.js";import"./chunk-3DJF6IZ7.js";import"./chunk-WW5SGVGJ.js";import"./chunk-GA7VBKCH.js";import"./chunk-6MI4KKWF.js";import"./chunk-SDO4FC4Q.js";import"./chunk-IR3YJWPW.js";import"./chunk-J2S7BOZU.js";import"./chunk-UW6ES5DM.js";import"./chunk-6FA3GG5B.js";import"./chunk-NNLI4OWY.js";import"./chunk-HZP5U2AA.js";import"./chunk-ES2ISFJC.js";import"./chunk-H7IWJN7L.js";import"./chunk-FTQLQJQV.js";export{a as resolveWebLaunchMessages,c as runOpenPondAppServerCli,b as runOpenPondServerCli};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{a as f}from"./chunk-
|
|
2
|
+
import{a as f}from"./chunk-2I4W24NK.js";import{$a as I,Ba as J,Qa as N,Ra as q,Ua as k,Wa as A,Xa as B,_a as H,b as d,c as w,e as b,hb as E,ib as M,ja as C,jb as T,la as m,ma as j,na as x,oa as F,pa as v,qa as P}from"./chunk-NNLI4OWY.js";import"./chunk-HZP5U2AA.js";import"./chunk-ES2ISFJC.js";import{d as O,f as S,h as g}from"./chunk-H7IWJN7L.js";import"./chunk-3T5XJEDM.js";import"./chunk-3M53YXEI.js";import{a as l}from"./chunk-FTQLQJQV.js";import R from"node:path";import{readFile as p}from"node:fs/promises";var n=l((t,s)=>typeof t[s]=="string"?t[s]:void 0,"stringOption");function a(t){console.log(JSON.stringify(t,null,2))}l(a,"print");function U(t,s){let i=n(t,"keyPath");if(i){let r=JSON.parse(i);if(Array.isArray(r)&&r.length&&r.every(c=>typeof c=="string"&&c.length))return r;throw new f("--key-path must be a JSON array of key segments.")}if(!s)throw new f("Specify a setting key, or --key-path for keys containing dots.");return s.split(".")}l(U,"keyPath");async function G(t,s){let i=S({home:n(t,"home")}),r=s[0]??"get",c=g(i).config;if(r==="path"){console.log(c);return}if(r==="export"){let e=await T(i),o=n(t,"file");o?(await b(R.resolve(o),JSON.stringify(e,null,2),{privateParent:!1}),a({path:R.resolve(o),requiresRebinding:e.requiresRebinding})):a(e);return}if(r==="backup"||r==="restore"){let e=n(t,"file"),o=n(t,"keyFile");if(!e||!o)throw new f(`config ${r} requires --file <encrypted-backup> and --key-file <separate-32-byte-key-file>.`);let u=await p(o),y=u.length===32?u:Buffer.from(u.toString("utf8").trim(),"base64");try{a(r==="backup"?await E(i,e,y):await M(e,i,y))}finally{y.fill(0),u.fill(0)}return}if(r==="collect-orphans"){a(await N(i));return}if(r==="schema"){a(F());return}if(r==="migrate"){let e=n(t,"resolutionFile"),o=e?q.parse(JSON.parse(await p(e,"utf8"))):void 0;a(await k(i,{resolutions:o,sourceAppHome:n(t,"sourceAppHome"),sourceConfig:n(t,"sourceConfig"),sourceBrowserState:n(t,"sourceBrowserState"),dryRun:t.dryRun===!0||t.dryRun==="true"}));return}if(r==="recover"){let e=n(t,"revision");a(e?await x(i,e,n(t,"expectedRevision")??d(await w(c))):await A(i));return}if(r==="restart-migration"){a(await B(i));return}if(r==="effective"){a(await I(i,{projectRoot:n(t,"projectRoot"),accountId:n(t,"accountId")}));return}if(r==="trust"||r==="untrust"){let e=n(t,"projectRoot")??s[1];if(!e)throw new f("Specify the canonical project root with --project-root.");await H(i,e,n(t,"accountId")??"local",r==="trust"),a({root:e,trusted:r==="trust"});return}if(r==="revisions"){a(await m(i));return}if(r==="validate"){let e=n(t,"file")??c;C(await p(e,"utf8"),e,t.project===!0||t.project==="true"?"project":"user"),a({valid:!0,path:e});return}if(r==="replace"){let e=n(t,"file");if(!e)throw new f("config replace requires --file <validated-toml-file>.");a(await j(i,n(t,"expectedRevision")??d(await w(c)),await p(e,"utf8")));return}if(r==="doctor"){let e=await w(c),o=null;try{await v(i)}catch(u){o=O(u,c)}a({home:i,path:c,rawRevision:d(e),issue:o,recoverableRevisions:await m(i),migration:await w(R.join(g(i).runtime,"migration.json"))!==null}),o&&(process.exitCode=1);return}if(await k(i),r==="clear-cache"){await J(i),a({cleared:!0,path:g(i).cache});return}let h=await v(i);if(r==="get"){if(!s[1]&&!t.keyPath){a(h);return}let e=h.document;for(let o of U(t,s[1]))e=e&&typeof e=="object"?e[o]:void 0;a(e??null);return}if(r==="set"||r==="unset"){let e=U(t,s[1]),o;if(r==="set"){let u=n(t,"value")??s[2];if(u===void 0)throw new f("config set requires a value. Use JSON for arrays, tables, numbers and booleans.");try{o=JSON.parse(u)}catch{o=u}}a(await P(i,n(t,"expectedRevision")??h.rawRevision,[r==="set"?{op:"set",path:e,value:o}:{op:"unset",path:e}]));return}throw new f(`Unknown config command: ${r}`)}l(G,"runConfigurationCommand");export{G as runConfigurationCommand};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p}from"./chunk-
|
|
2
|
+
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p}from"./chunk-LCKCUSP7.js";import"./chunk-G2VYRU27.js";import"./chunk-ZVOO7FKM.js";import"./chunk-OGPHXXCD.js";import"./chunk-B6IIGPWS.js";import"./chunk-SS3EG6S2.js";import"./chunk-GLUWATL5.js";import"./chunk-O4IARD7H.js";import"./chunk-J2S7BOZU.js";import"./chunk-UW6ES5DM.js";import"./chunk-2I4W24NK.js";import"./chunk-NNLI4OWY.js";import"./chunk-HZP5U2AA.js";import"./chunk-ES2ISFJC.js";import"./chunk-H7IWJN7L.js";import"./chunk-3T5XJEDM.js";import"./chunk-3M53YXEI.js";import"./chunk-FTQLQJQV.js";export{m as resolveGitBranch,f as runAccount,j as runBacktestRun,p as runCheckUpdate,k as runDeployWatch,g as runHealth,d as runLogin,o as runOpentool,e as runProfiles,l as runRepoCreate,n as runRepoPush,b as runTemplateBranches,a as runTemplateStatus,c as runTemplateUpdate,h as runToolList,i as runToolRun};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{x as f}from"./chunk-G2VYRU27.js";import"./chunk-ZVOO7FKM.js";import"./chunk-OGPHXXCD.js";import"./chunk-B6IIGPWS.js";import"./chunk-SS3EG6S2.js";import"./chunk-GLUWATL5.js";import"./chunk-O4IARD7H.js";import"./chunk-J2S7BOZU.js";import"./chunk-UW6ES5DM.js";import{a as c}from"./chunk-
|
|
2
|
+
import{x as f}from"./chunk-G2VYRU27.js";import"./chunk-ZVOO7FKM.js";import"./chunk-OGPHXXCD.js";import"./chunk-B6IIGPWS.js";import"./chunk-SS3EG6S2.js";import"./chunk-GLUWATL5.js";import"./chunk-O4IARD7H.js";import"./chunk-J2S7BOZU.js";import"./chunk-UW6ES5DM.js";import{a as c}from"./chunk-2I4W24NK.js";import"./chunk-NNLI4OWY.js";import"./chunk-HZP5U2AA.js";import"./chunk-ES2ISFJC.js";import"./chunk-H7IWJN7L.js";import"./chunk-3T5XJEDM.js";import{c as p,f as u}from"./chunk-3M53YXEI.js";import{a as r}from"./chunk-FTQLQJQV.js";import d from"node:path";import{access as v}from"node:fs/promises";import{constants as C}from"node:fs";import{createRequire as P}from"node:module";var l=d.join("scripts","desktop-harness.ts");async function $(n,t){let o=await j({options:n,rest:t}),e=await f(o.command,o.args,{cwd:o.cwd,inherit:!0,timeoutMs:0});if(e.code!==0)throw new m(e.code)}r($,"runDesktopTestCommand");async function j(n){let t=n.options,o=n.rest,e=o[0];if(e!=="run"&&e!=="attach")throw new c(D());let a=o.slice(1);if(a.length===0)throw new c("usage: openpond desktop-test run <scenario...> [options]");let g=p(t,"cwd")||n.cwd||process.cwd(),w=await O(g),k=(n.env??process.env).OPENPOND_NODE_BINARY?.trim()||process.execPath,s=[P(import.meta.url).resolve("tsx/cli"),l,"run",...a],h=x(t,e);return h&&s.push(`--${h}`),i(s,"--app",t,"app"),i(s,"--server",t,"server"),i(s,"--token",t,"token"),i(s,"--token-file",t,"tokenFile"),i(s,"--devtools-port",t,"devtoolsPort"),i(s,"--artifacts-dir",t,"artifactsDir"),H(s,t),i(s,"--grep",t,"grep"),i(s,"--timeout-ms",t,"timeoutMs"),u(t.keepHome)&&s.push("--keep-home"),{command:k,args:s,cwd:w}}r(j,"buildDesktopHarnessInvocation");async function O(n){let t=d.resolve(n);for(;;){let o=d.join(t,l);if(await R(o))return t;let e=d.dirname(t);if(e===t)throw new c(`Could not find ${l}. Run this command from the OpenPond source checkout or pass --cwd <repo>.`);t=e}}r(O,"resolveDesktopHarnessRepoRoot");function x(n,t){let o=t==="attach"?"attach":null;for(let e of["isolated","attach","packaged","none"])if(u(n[e])){if(o&&o!==e)throw new c("Choose only one desktop harness launch mode: --isolated, --attach, --packaged, or --none.");o=e}return o}r(x,"resolveLaunchMode");function i(n,t,o,e){let a=p(o,e);a&&n.push(t,a)}r(i,"appendStringFlag");function H(n,t){let o=p(t,"json"),e=p(t,"jsonPath");if(o&&y(o))throw new c("harness --json requires a report path. Use --json <path> or --json-path <path>.");if(o&&e&&o!==e)throw new c("Use only one JSON report path: --json <path> or --json-path <path>.");let a=o||e;a&&n.push("--json",a)}r(H,"appendJsonFlag");function y(n){return/^(true|false|1|0|yes|no)$/i.test(n)}r(y,"isBooleanLiteral");async function R(n){try{return await v(n,C.R_OK),!0}catch{return!1}}r(R,"fileExists");function D(){return["usage: openpond desktop-test run <scenario...> [options]"," openpond desktop-test attach <scenario...> [options]","","Options include --isolated, --attach, --packaged, --none, --app <path>,","--server <url>, --token <token>, --token-file <path>, --devtools-port <port>, --artifacts-dir <path>,","--json <path>, --json-path <path>, --grep <pattern>, --timeout-ms <ms>,","--keep-home, and --cwd <repo>."].join(`
|
|
3
3
|
`)}r(D,"desktopHarnessCliUsage");var m=class extends Error{static{r(this,"HarnessCommandFailedError")}exitCode;constructor(t){let o=typeof t=="number"&&t>0?t:1;super(`desktop harness failed with exit code ${o}`),this.name="HarnessCommandFailedError",this.exitCode=o}};export{j as buildDesktopHarnessInvocation,O as resolveDesktopHarnessRepoRoot,$ as runDesktopTestCommand};
|