openpond 0.2.14 → 0.2.15
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 +22 -0
- package/dist/app-server.js +1 -1
- package/dist/chunks/{actions-command-Q5HXY5XD.js → actions-command-33SJXJKC.js} +1 -1
- package/dist/chunks/{app-layer-S6H572UM.js → app-layer-SSLVAUNI.js} +1 -1
- package/dist/chunks/app-server-runtime-QUC4HPQU.js +2 -0
- package/dist/chunks/{apps-K5HMFAPI.js → apps-JEKTEGSW.js} +1 -1
- package/dist/chunks/{chunk-ZZWAUD7I.js → chunk-4E5ETWKU.js} +318 -313
- package/dist/chunks/{chunk-BVYAP3M6.js → chunk-7I73OREC.js} +1 -1
- package/dist/chunks/{chunk-I4FOBNHQ.js → chunk-A2PIGBPD.js} +15 -15
- package/dist/chunks/chunk-DWROB2J6.js +19 -0
- package/dist/chunks/chunk-FHBQ6OWG.js +26 -0
- package/dist/chunks/{chunk-NYPLOXEP.js → chunk-JTQDNX2J.js} +1 -1
- package/dist/chunks/{chunk-ECH6PXVK.js → chunk-K4ZKAHLG.js} +1 -1
- package/dist/chunks/{chunk-3GLSX322.js → chunk-QLZ67Y6C.js} +2 -2
- package/dist/chunks/{chunk-OW4KET6I.js → chunk-TWA56GFU.js} +1 -1
- package/dist/chunks/{chunk-R33VLNFY.js → chunk-UN3A7GEU.js} +1 -1
- package/dist/chunks/{chunk-3V5FPSOK.js → chunk-UOQHYTCK.js} +1 -1
- package/dist/chunks/{chunk-ZMRT4B4H.js → chunk-VRXXKDF2.js} +9 -9
- package/dist/chunks/{chunk-O7SI3RQJ.js → chunk-YNXFXNQM.js} +1 -1
- package/dist/chunks/{chunk-Q3KAKIVM.js → chunk-ZYG2PXY2.js} +1 -1
- package/dist/chunks/{cli-2BUMKLMW.js → cli-7YSRAC4Y.js} +1 -1
- package/dist/chunks/{configuration-command-Q7XVBZ2E.js → configuration-command-DH4ZZUKL.js} +1 -1
- package/dist/chunks/{core-commands-6GZ7T4SK.js → core-commands-TUUSA6WB.js} +1 -1
- package/dist/chunks/{desktop-test-EKPOPWTL.js → desktop-test-S3RME4QT.js} +1 -1
- package/dist/chunks/extension-D64BYPFY.js +6 -0
- package/dist/chunks/{help-MTWG7AXZ.js → help-AOVE3SSY.js} +1 -1
- package/dist/chunks/{opchat-4QGK6MRL.js → opchat-KC2FL5TT.js} +1 -1
- package/dist/chunks/{organizations-TTUM577J.js → organizations-AAES2P7W.js} +1 -1
- package/dist/chunks/{profile-C33CIJOV.js → profile-FRYWK2IE.js} +1 -1
- package/dist/chunks/{project-agent-5P3ALPRY.js → project-agent-WPW6DWK7.js} +1 -1
- package/dist/chunks/{sandbox-command-CEIXSDW2.js → sandbox-command-ZHKJZ3FJ.js} +1 -1
- package/dist/chunks/{sandbox-template-KTKWVKZ7.js → sandbox-template-SPVQIMG5.js} +1 -1
- package/dist/chunks/{src-SKYU7PDL.js → src-AADCZ2JW.js} +2 -2
- package/dist/chunks/{src-ZAF6VEWJ.js → src-LYFCDA5G.js} +1 -1
- package/dist/chunks/{teams-bot-O7IFQ3L6.js → teams-bot-LD3QORJI.js} +1 -1
- package/dist/chunks/{workspaces-MXYF6QTH.js → workspaces-P2WNCMXC.js} +1 -1
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/dist/web/assets/{App-BqgpZNh-.js → App-kwt-UxX_.js} +30 -30
- package/dist/web/assets/{AppDialog-BCzsyF8y.js → AppDialog-LXQo_7oW.js} +1 -1
- package/dist/web/assets/{AppTerminalPanel-Cqtaoc93.js → AppTerminalPanel-CUqrUrkA.js} +2 -2
- package/dist/web/assets/{AppsView-BHz8ruGV.js → AppsView-5J2RX301.js} +1 -1
- package/dist/web/assets/{BrowserSidebar-vrHh2y_s.js → BrowserSidebar-mZ8RjUOr.js} +1 -1
- package/dist/web/assets/{CartesianChart-C5PgQkxh.js → CartesianChart-7x3SO8Hj.js} +1 -1
- package/dist/web/assets/{CollaborationTabs-OSqxEZgD.js → CollaborationTabs-ByC9WJqu.js} +1 -1
- package/dist/web/assets/{CommandMenu-XMeH3T6m.js → CommandMenu-CqDb2Kb2.js} +1 -1
- package/dist/web/assets/{CommunityView-BPsy_BnG.js → CommunityView-BmxYkWqC.js} +1 -1
- package/dist/web/assets/{ComposerCreateImproveStrip-Bsh9eyj1.js → ComposerCreateImproveStrip-2Tyj9KOQ.js} +1 -1
- package/dist/web/assets/{GetStartedView-Ay67q9mX.js → GetStartedView-1WYkmevY.js} +1 -1
- package/dist/web/assets/HostedModelLearningReview-DHahsQJH.js +1 -0
- package/dist/web/assets/{HostedModelLearningSettings-MG_1VD7H.js → HostedModelLearningSettings-Brza5hSD.js} +1 -1
- package/dist/web/assets/{LabModelVersionDetailPage-CPkCZhBg.js → LabModelVersionDetailPage-C4WtQKER.js} +1 -1
- package/dist/web/assets/{LabSkillSidebar-Y06Ghxe7.js → LabSkillSidebar-D3g6E0Ap.js} +1 -1
- package/dist/web/assets/{LabsRoute-CBy4evwc.js → LabsRoute-BO0yEsCR.js} +4 -4
- package/dist/web/assets/{MainChatThread-CqG9WewR.js → MainChatThread-CKPR_rY0.js} +2 -2
- package/dist/web/assets/{MainPane-CQVCd0hz.js → MainPane-B8mDzSqi.js} +4 -4
- package/dist/web/assets/{MarkdownText-BSXFJB5s.js → MarkdownText-D6_UI4Ly.js} +1 -1
- package/dist/web/assets/{Messages-CcKLreir.js → Messages-DptbENmQ.js} +1 -1
- package/dist/web/assets/{NativeSkillSidebar-BF4T1Tuy.js → NativeSkillSidebar-CF1NTAR6.js} +1 -1
- package/dist/web/assets/{NewExperienceSwitcher-BH2-_iQt.js → NewExperienceSwitcher-CwlpLsXW.js} +1 -1
- package/dist/web/assets/{NewProjectDialog-BSkPgqLX.js → NewProjectDialog-Ls4K9a5S.js} +1 -1
- package/dist/web/assets/{OutputsPage-DBAfj1e_.js → OutputsPage-ClNuidPW.js} +1 -1
- package/dist/web/assets/{ProjectsPage-DOTViI5-.js → ProjectsPage-Sj83NsdP.js} +1 -1
- package/dist/web/assets/{RightChatPanelStack-D3wuMm3F.js → RightChatPanelStack-m5-cI0NL.js} +1 -1
- package/dist/web/assets/{RightSidebarHomePanel-DLP1LFoX.js → RightSidebarHomePanel-B--t--OJ.js} +1 -1
- package/dist/web/assets/{ScheduledWorkPage-BETU42Pi.js → ScheduledWorkPage-JVfMtGMs.js} +1 -1
- package/dist/web/assets/{SettingsView-D2eKwMH6.js → SettingsView-B7FnZ-b0.js} +6 -6
- package/dist/web/assets/{TeamChatView-ytGArG3p.js → TeamChatView-D8ilbncz.js} +1 -1
- package/dist/web/assets/{TerminalOverlay-FV-T6Vk6.js → TerminalOverlay-A6nSxm5C.js} +1 -1
- package/dist/web/assets/{TrainingCreationPanel-D7UhsNpa.js → TrainingCreationPanel-CwpnBbuN.js} +1 -1
- package/dist/web/assets/{TrainingDraftPanel-BZ4ZhYbm.js → TrainingDraftPanel-B_Gh_0yq.js} +1 -1
- package/dist/web/assets/{UsageSettingsSection-Ml9cMCUi.js → UsageSettingsSection-qTX3k9-f.js} +1 -1
- package/dist/web/assets/{WorkSidebarPanel-DZZK0_vI.js → WorkSidebarPanel-B-fDRRRs.js} +1 -1
- package/dist/web/assets/{WorkspaceDiffPanel-CSLiV2LC.js → WorkspaceDiffPanel-CfvvifJg.js} +3 -3
- package/dist/web/assets/{WorkspaceEnvironmentMenu-dqDA6sik.js → WorkspaceEnvironmentMenu-BL6WHWLO.js} +1 -1
- package/dist/web/assets/{WorkspaceGitDialogs-C9ptN_7-.js → WorkspaceGitDialogs-pyZQJL_2.js} +1 -1
- package/dist/web/assets/{WorkspaceMonacoEditor-BOa6xAaO.js → WorkspaceMonacoEditor-C2cNf0UO.js} +3 -3
- package/dist/web/assets/{arrow-up-right-Qq_YNPUt.js → arrow-up-right-BQv8RCGD.js} +1 -1
- package/dist/web/assets/{chat-file-links-z54bmvhH.js → chat-file-links-C3erG0P2.js} +1 -1
- package/dist/web/assets/chevron-up-D9MMQKU3.js +1 -0
- package/dist/web/assets/{clipboard-C_cLfHiu.js → clipboard-BSPYX7yq.js} +1 -1
- package/dist/web/assets/{cloud-upload-B1A_725d.js → cloud-upload-CJVhhG6P.js} +1 -1
- package/dist/web/assets/{cssMode-DKjB86V7.js → cssMode-RCJXPUO-.js} +1 -1
- package/dist/web/assets/{folder-open-BAqrqIkA.js → folder-open-2a5riVSG.js} +1 -1
- package/dist/web/assets/{folder-plus-Aw6rEy1D.js → folder-plus-DuVvIFve.js} +1 -1
- package/dist/web/assets/{git-commit-horizontal-75RSWQ3Q.js → git-commit-horizontal-BifoV1dR.js} +1 -1
- package/dist/web/assets/{htmlMode-CH03ACqd.js → htmlMode-DnEOXzjT.js} +1 -1
- package/dist/web/assets/{index-C0gdp_hv.js → index-B5RqBp_p.js} +2 -2
- package/dist/web/assets/{info-CXzXdZ1o.js → info-BWvLCbJ2.js} +1 -1
- package/dist/web/assets/{jsonMode-Bvmzl5ln.js → jsonMode-DQfml7E4.js} +1 -1
- package/dist/web/assets/{lspLanguageFeatures-BKXLyuIE.js → lspLanguageFeatures-WKs-7xHz.js} +1 -1
- package/dist/web/assets/{minimize-2-C-6SC3Bs.js → minimize-2-C-_iqAbt.js} +1 -1
- package/dist/web/assets/{monaco.contribution-BwSCuTR3.js → monaco.contribution-B29c98Aa.js} +2 -2
- package/dist/web/assets/{monaco.contribution-BON5T_eJ.js → monaco.contribution-B5y78DUP.js} +2 -2
- package/dist/web/assets/{monaco.contribution-Cv_QTWVQ.js → monaco.contribution-DCekL-SI.js} +2 -2
- package/dist/web/assets/{monaco.contribution-rtAnmt_x.js → monaco.contribution-Qc1u700n.js} +2 -2
- package/dist/web/assets/{play-BnkiBq8x.js → play-DsP3gpGK.js} +1 -1
- package/dist/web/assets/{python-Rd5MxRAN.js → python-CJ1QdM8L.js} +1 -1
- package/dist/web/assets/{refresh-cw-BISaiIBt.js → refresh-cw-DaASy_i0.js} +1 -1
- package/dist/web/assets/{save-BcVbYiGU.js → save-BBQ7L8VS.js} +1 -1
- package/dist/web/assets/{square-Bn32OIid.js → square-DTl9YrMp.js} +1 -1
- package/dist/web/assets/{toggleHighContrast-DDw4wPS9.js → toggleHighContrast-D-DNRZ-D.js} +1 -1
- package/dist/web/assets/{tsMode-Dt73U5ww.js → tsMode-CmWbxnjM.js} +1 -1
- package/dist/web/assets/{upload-AB1N3bCZ.js → upload-juEp2zRQ.js} +1 -1
- package/dist/web/assets/{useLocalAgentSchedules-D7QTyYKj.js → useLocalAgentSchedules-DF_bIseW.js} +1 -1
- package/dist/web/assets/{wifi-off-BAX1UWLx.js → wifi-off-DrkIaS1O.js} +1 -1
- package/dist/web/assets/{workers-DE3-vPyS.js → workers-LygfviY3.js} +1 -1
- package/dist/web/assets/{yaml-C0JBPZbg.js → yaml-BIpimtDQ.js} +1 -1
- package/dist/web/index.html +1 -1
- package/package.json +1 -1
- package/dist/chunks/app-server-runtime-BHZQNP3K.js +0 -2
- package/dist/chunks/chunk-3YH3S5U2.js +0 -26
- package/dist/chunks/chunk-BB6DJKXX.js +0 -19
- package/dist/chunks/extension-A2BWJMRQ.js +0 -6
- package/dist/web/assets/HostedModelLearningReview-C8PfSxcz.js +0 -1
- package/dist/web/assets/chevron-up-CIrVx_eP.js +0 -1
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{a as Re,b as be,c as Ae,d as Ie}from"./chunk-73KFNV3D.js";import{Y as O,ca as L}from"./chunk-SS3EG6S2.js";import{a as Oe}from"./chunk-6FA3GG5B.js";import{f as Ce}from"./chunk-H7IWJN7L.js";import{a as s}from"./chunk-FTQLQJQV.js";var J=class extends Error{static{s(this,"OpenPondProfileSetupRequiredError")}code="agent_source_setup_required";details;constructor(t,n){let o=n.blockingRequirements.map(r=>r.label);super(["agent_source_setup_required",`Profile action ${t} has unresolved required setup.`,o.length?`Missing setup: ${o.join(", ")}`:""].filter(Boolean).join(`
|
|
3
|
-
`)),this.name="OpenPondProfileSetupRequiredError",this.details={error:"agent_source_setup_required",actionId:t,setupGate:n,missing:o,blockingSetupRequirements:n.blockingRequirements,setupRequirements:n.requirements}}};function W(e){let t=new Map;for(let a of e.sourceSetupRequirements??[]){let l=bt(a);if(e.actionId&&l&&l!==e.actionId&&h(a.actionName)!==e.actionId&&h(a.sourceActionId)!==e.actionId)continue;let c=ve({record:a,source:"source_upload_metadata",actionId:l});c&&t.set(c.ref,c)}for(let a of e.actionCatalog)if(!(e.actionId&&a.id!==e.actionId&&a.name!==e.actionId))for(let l of a.setupRequirements??[]){let c=ve({record:l,source:"action_catalog",actionId:a.id});c&&t.set(c.ref,c)}let n=Array.from(t.values()),o=n.filter(a=>a.blocking),r=n.filter(a=>!a.required&&!ne(a.status)).length,i=n.filter(a=>ne(a.status)).length;return{status:It(o),requirementCount:n.length,blockingCount:o.length,optionalMissingCount:r,readyCount:i,requirements:n,blockingRequirements:o}}s(W,"buildOpenPondProfileSetupGate");function oe(e,t){if(t.blockingRequirements.length>0)throw new J(e,t)}s(oe,"assertOpenPondProfileActionReady");function Rt(e){let t=e.actionId?`${e.actionId}: `:"",n=e.required?"required":"optional";return`${t}${e.label} (${n}, ${e.status})`}s(Rt,"formatOpenPondProfileSetupRequirement");function ve(e){let t=e.source==="action_catalog"&&h(e.record.source)==="source_upload_metadata"?"source_upload_metadata":e.source,n=h(e.record.kind)??h(e.record.type),o=h(e.record.label)??h(e.record.name)??h(e.record.key)??h(e.record.provider)??h(e.record.tool)??h(e.record.command)??h(e.record.packageName)??h(e.record.path)??h(e.record.repo)??h(e.record.url)??h(e.record.id)??n??"setup requirement",r=e.record.required!==!1,i=At(e.record);return{ref:[t,e.actionId??"source",n??"requirement",o].join(":"),source:t,actionId:e.actionId,kind:n,label:o,status:i,required:r,blocking:r&&!ne(i)}}s(ve,"setupRequirementFromRecord");function bt(e){return h(e.actionId)??h(e.sourceActionId)??h(e.actionName)}s(bt,"setupRequirementActionId");function At(e){let t=h(e.status)??h(e.state);return t?t==="satisfied"||t==="connected"||t==="provided"?"ready":t:typeof e.satisfied=="boolean"?e.satisfied?"ready":"setup_required":typeof e.ready=="boolean"&&e.ready?"ready":"setup_required"}s(At,"setupStatus");function It(e){return e.length===0?"ready":e.some(t=>["blocked","unsupported","unsupported_dependency","stale"].includes(t.status))?"blocked":"setup_required"}s(It,"gateStatus");function ne(e){return e==="ready"||e==="disabled"}s(ne,"isReadyStatus");function h(e){return typeof e=="string"&&e.trim()?e.trim():null}s(h,"text");import{stat as qt}from"node:fs/promises";import se from"node:path";import{spawn as vt}from"node:child_process";import{existsSync as re}from"node:fs";import{readFile as Et,rm as Kn,writeFile as xe}from"node:fs/promises";import ie from"node:path";var _e=["**/node_modules/","**/.bun/","**/.env","**/.env.*","**/.openpond/traces/","**/.openpond/vendor/","**/.openpond/eval-results.json","**/.openpond/artifact-index.json","**/.openpond/source-upload-cache.json",""].join(`
|
|
4
|
-
`);async function Le(e){if(!re(ie.join(e,".git"))){let i=await R(e,["init","-b","main"]);if(i.code!==0)throw new Error(G("git init",i))}let t=ie.join(e,".gitignore");if(re(t)?await xt(t):await xe(t,_e,"utf8"),await _t(e))return;let n=await N(e);if(!n.dirty&&n.files.length===0)return;let o=await R(e,["add","-A"]);if(o.code!==0)throw new Error(G("git add",o));let r=await R(e,["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(r.code!==0&&!/nothing to commit/i.test(r.stdout+r.stderr))throw new Error(G("git commit",r))}s(Le,"ensureProfileGitRepo");async function xt(e){let t=await Et(e,"utf8").catch(()=>""),n=_e.split(/\r?\n/).map(r=>r.trim()).filter(Boolean).filter(r=>!t.split(/\r?\n/).some(i=>i.trim()===r));if(n.length===0)return;let o=t.endsWith(`
|
|
5
|
-
`)||t.length===0?"":`
|
|
6
|
-
`;await xe(e,`${t}${o}${n.join(`
|
|
7
|
-
`)}
|
|
8
|
-
`,"utf8")}s(xt,"ensureProfileGitignoreRules");async function N(e){if(!re(ie.join(e,".git")))return{isRepo:!1,branch:null,head:null,shortHead:null,dirty:!1,upstream:null,ahead:null,behind:null,remoteUrl:null,files:[],error:null};let t=await R(e,["rev-parse","--is-inside-work-tree"]);if(t.code!==0||t.stdout.trim()!=="true")return{isRepo:!1,branch:null,head:null,shortHead:null,dirty:!1,upstream:null,ahead:null,behind:null,remoteUrl:null,files:[],error:t.stderr.trim()||t.stdout.trim()||"not a Git work tree"};let[n,o,r,i,a]=await Promise.all([B(e,["branch","--show-current"]),B(e,["rev-parse","HEAD"]),R(e,["status","--porcelain=v1","-uall"]),B(e,["rev-parse","--abbrev-ref","--symbolic-full-name","@{u}"]),B(e,["remote","get-url","origin"])]),l=r.code===0?Mt(r.stdout):[],c=i?await Lt(e):{ahead:null,behind:null},d=o||null;return{isRepo:!0,branch:n||null,head:d,shortHead:d?d.slice(0,12):null,dirty:l.length>0,upstream:i,ahead:c.ahead,behind:c.behind,remoteUrl:a,files:l,error:r.code===0?null:G("git status",r)}}s(N,"loadProfileGitState");async function Me(e,t){let n=await N(e);if(!n.isRepo)throw new Error(n.error??"Active OpenPond profile source is not a Git repo.");if(!n.dirty)return{committed:!1,stdout:"",stderr:"",state:n};let o=await R(e,["add","-A"]);if(o.code!==0)throw new Error(G("git add",o));let r=await R(e,["commit","-m",t]);if(r.code!==0)throw new Error(G("git commit",r));return{committed:!0,stdout:r.stdout,stderr:r.stderr,state:await N(e)}}s(Me,"commitProfileChanges");async function $e(e){return B(e,["rev-parse","HEAD"])}s($e,"profileGitHead");async function _t(e){return(await R(e,["rev-parse","--verify","HEAD"])).code===0}s(_t,"hasGitHead");async function Lt(e){let t=await R(e,["rev-list","--left-right","--count","@{u}...HEAD"]);if(t.code!==0)return{ahead:null,behind:null};let[n,o]=t.stdout.trim().split(/\s+/),r=n?Number.parseInt(n,10):Number.NaN,i=o?Number.parseInt(o,10):Number.NaN;return{ahead:Number.isFinite(i)?i:null,behind:Number.isFinite(r)?r:null}}s(Lt,"loadAheadBehind");async function B(e,t){let n=await R(e,t);return n.code!==0?null:n.stdout.trim()||null}s(B,"gitText");function Mt(e){return e.split(/\r?\n/).map(t=>t.trimEnd()).filter(Boolean).map(t=>{let n=t[0]??" ",o=t[1]??" ",r=`${n}${o}`.trim()||"changed",i=t.slice(3),a=i.split(" -> "),l=n===" "?null:n,c=o===" "?null:o,d=a.length===2?a[1]:i,g=a.length===2?a[0]:null;return{path:Ee(d),originalPath:g?Ee(g):null,indexStatus:l,worktreeStatus:c,status:r,category:$t(l,c)}})}s(Mt,"parsePorcelainStatus");function $t(e,t){return e==="?"&&t==="?"?"untracked":e==="R"||t==="R"?"renamed":e==="A"||t==="A"?"added":e==="D"||t==="D"?"deleted":e==="M"||t==="M"?"modified":"changed"}s($t,"gitChangeCategory");function Ee(e){let t=e.trim();if(!t.startsWith('"')||!t.endsWith('"'))return t;try{return JSON.parse(t)}catch{return t.slice(1,-1)}}s(Ee,"unquoteGitPath");function G(e,t){return t.stderr.trim()||t.stdout.trim()||`${e} failed with exit code ${t.code??"unknown"}`}s(G,"gitFailureMessage");async function R(e,t,n={}){return new Promise((o,r)=>{let i=vt("git",t,{cwd:e,env:n.env,stdio:"pipe"}),a="",l="";i.stdout?.on("data",c=>{a+=String(c)}),i.stderr?.on("data",c=>{l+=String(c)}),i.on("error",r),i.on("close",c=>{o({code:c,stdout:a,stderr:l})}),n.input!==void 0?i.stdin?.end(n.input):i.stdin?.end()})}s(R,"runGitCommand");var ae=1500,Fe=8*1024*1024,le=100*1024*1024,ce=8,jt={maxFiles:ae,maxFileBytes:Fe,maxTotalBytes:le,concurrency:ce},Ft={mode:"single_json_payload",chunkingSupported:!1};async function Tt(e){let t=await R(e,["ls-files","-z"]);if(t.code!==0)throw new Error(t.stderr.trim()||t.stdout.trim()||"git ls-files failed for profile source upload");let n=t.stdout.split("\0").map(c=>c.trim()).filter(Boolean).filter(c=>{let d=c.replace(/\\/g,"/");return je(d)&&!Ht(d)}).sort();if(n.length===0)throw new Error("No committed profile source files found to upload.");if(n.length>ae)throw new Error(`Too many profile source files to upload: ${n.length} > ${ae}`);let o=(await qe(n,ce,async c=>{let d=se.resolve(e,c),g=se.relative(e,d).replace(/\\/g,"/");if(!je(g))throw new Error(`Profile source path escapes repo: ${c}`);let P=await qt(d);if(!P.isFile())return null;if(P.size>Fe)throw new Error(`Profile source file is too large: ${c} (${P.size} bytes)`);return{path:g,absolutePath:d,size:P.size,mtimeMs:Math.trunc(P.mtimeMs),ctimeMs:Math.trunc(P.ctimeMs)}})).filter(c=>c!==null),r=0;for(let c of o)if(r+=c.size,r>le)throw new Error(`Profile source upload is too large: ${r} > ${le}`);let i=await be(e),a=await qe(o,ce,async c=>Ae(c,i));await Ie(e,a).catch(()=>{});let l=a.map(c=>c.entry);return{entries:l,fileCount:l.length,totalBytes:r,limits:jt,transport:Ft}}s(Tt,"collectProfileSourceUploadEntries");async function qe(e,t,n){let o=new Array(e.length),r=0,i=Math.max(1,Math.min(t,e.length));return await Promise.all(Array.from({length:i},async()=>{for(;r<e.length;){let a=r;r+=1,o[a]=await n(e[a],a)}})),o}s(qe,"mapWithConcurrency");function je(e){return e.length>0&&!e.includes("\0")&&!se.isAbsolute(e)&&!e.split(/[\\/]+/).some(t=>!t||t==="."||t==="..")}s(je,"isSafeProfileSourcePath");function Ht(e){return e.split(/[\\/]+/).some((t,n,o)=>{let r=t.toLowerCase();if(r===".git"||r==="node_modules"||r===".bun"||r===".env"||r.startsWith(".env.")||e.replace(/\\/g,"/")===Re)return!0;if(r!==".openpond")return!1;let i=o[n+1]?.toLowerCase();return i==="goals"||i==="traces"||i==="vendor"||i==="eval-results.json"||i==="artifact-index.json"})}s(Ht,"shouldSkipProfileSourcePath");function Gt(e){let t=y(e.checkResult),n=y(t?.deployPlan)??y(e.deployPlan),o=y(n?.source),r=y(n?.checks),i=y(t?.sourceCheckStatus);return{status:e.status,agentId:e.agentId,deployPlanStatus:f(n?.status),canRun:Te(n?.canRun),canDeploy:Te(n?.canDeploy),sourceRef:f(o?.sourceRef),sourceCommitSha:f(o?.sourceCommitSha),manifestHash:f(o?.manifestHash),manifestPath:f(o?.manifestPath),setupCommands:b(r?.setupCommands),validationCommands:b(r?.validationCommands),requiredChecks:b(r?.requiredChecks),evalNames:b(r?.evalNames),blockedReasons:b(n?.blockedReasons),staleReasons:b(n?.staleReasons),runtimeId:f(i?.latestRuntimeId),sandboxId:f(i?.latestSandboxId),traceArtifactRefs:b(i?.traceArtifactRefs),evalResultArtifactRefs:b(i?.evalResultArtifactRefs),validatorArtifactRefs:b(i?.validatorArtifactRefs),checkedAt:e.checkedAt??new Date().toISOString(),error:e.error??null}}s(Gt,"hostedSourceCheckStatusFromPayload");function Nt(e){let t=y(e.publishResult),n=y(t?.activeManifestSnapshot)??y(t?.manifestSnapshot)??y(t?.snapshot);return{status:e.status??"published",agentId:e.agentId,snapshotId:f(n?.id),sourceRef:f(n?.sourceRef),sourceCommitSha:f(n?.sourceCommitSha),manifestHash:f(n?.manifestHash),manifestPath:f(n?.manifestPath),buildStatus:f(n?.buildStatus),validationStatus:f(n?.validationStatus),evalStatus:f(n?.evalStatus),publishedAt:f(t?.publishedAt)??f(n?.publishedAt),error:e.error??null}}s(Nt,"hostedPublishStatusFromPayload");function Ut(e){let t=y(e.runResult),n=y(t?.run),o=y(n?.runtimeSource),r=y(n?.metadata),i=y(r?.sourceSummary),a=y(r?.setupGate),l=y(r?.responseSummary),c=y(r?.traceSummary),d=y(r?.evalSummary);return{status:f(n?.status)??(e.error?"failed":"running"),agentId:f(n?.agentId)??e.agentId,runId:f(n?.id),runtimeId:f(n?.runtimeId),sandboxId:f(n?.sandboxId),sourceRef:f(o?.sourceRef)??f(i?.sourceRef)??f(r?.sourceRef),sourceCommitSha:f(o?.sourceCommitSha)??f(i?.sourceCommitSha)??f(r?.hostedHead),manifestHash:f(o?.manifestHash)??f(i?.manifestHash),setupGateStatus:f(a?.status),setupRequirementRefs:Bt(a),artifactRefs:b(l?.artifactRefs),traceArtifactRefs:b(c?.artifactRefs),evalArtifactRefs:b(d?.artifactRefs),startedAt:f(n?.createdAt),completedAt:f(n?.completedAt),error:e.error??null}}s(Ut,"hostedRunSummaryFromPayload");function Dt(e){return e?.status?e.status==="succeeded"||e.status==="passed"?"passed":e.status==="failed"||e.status==="cancelled"?"failed":"running":"not_started"}s(Dt,"hostedRunStatusFromRunSummary");function Bt(e){return e?(Array.isArray(e.requirements)?e.requirements:Array.isArray(e.blockingRequirements)?e.blockingRequirements:[]).map(n=>{let o=y(n);return f(o?.ref)??f(o?.id)??f(o?.label)}).filter(n=>!!n):[]}s(Bt,"setupRequirementRefs");function y(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:null}s(y,"record");function f(e){return typeof e=="string"&&e.trim()?e.trim():null}s(f,"text");function Te(e){return typeof e=="boolean"?e:null}s(Te,"booleanValue");function b(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.trim().length>0):[]}s(b,"textArray");import{createRequire as it}from"node:module";import{createHash as Qe,randomUUID as et}from"node:crypto";import{spawn as hn}from"node:child_process";import{existsSync as k}from"node:fs";import{cp as yn,mkdir as E,readFile as st,readdir as at,rename as Pe,rm as he,symlink as wn,writeFile as D}from"node:fs/promises";import u from"node:path";function ue(e=null){return{actionCount:0,generatedAt:null,manifestPath:null,registryPath:null,stale:!0,error:e}}s(ue,"emptyProfileCatalogState");function de(e=null){return{skillCount:0,generatedAt:null,stale:!0,error:e}}s(de,"emptyProfileSkillCatalogState");function fe(){return{status:"ready",requirementCount:0,blockingCount:0,optionalMissingCount:0,readyCount:0,requirements:[],blockingRequirements:[]}}s(fe,"emptyProfileSetupGate");function K(){return{changedAgents:[],newAgents:[],deletedAgents:[],changedSkills:[],changedActions:[],changedExtensions:[],setupChanges:[],envRequirementChanges:[],files:[]}}s(K,"emptyProfileDiffSummary");function pe(e=null){return{state:e?"error":"none",message:e??"No active OpenPond profile.",agentCount:0,actionCount:0,defaultAction:null,checkFresh:!1,checkStaleReason:e??"No active profile.",localHead:null,hostedHead:null}}s(pe,"emptyProfileSummary");import{existsSync as U}from"node:fs";import{readFile as zt,stat as Jt}from"node:fs/promises";import Y from"node:path";var He=".openpond/agent-manifest.json",Ge=".openpond/action-registry.json",Wt=".openpond/source-upload-metadata.json",Kt=".openpond/agent-package-origin.json";async function De(e){return ze({agentId:"default",sourcePath:e,preferred:!0})}s(De,"loadProfileActionCatalog");async function Be(e){if(e.length===0)return{catalog:{actionCount:0,generatedAt:null,manifestPath:null,registryPath:null,stale:!0,error:"No profile agent sources are enabled."},actionCatalog:[],sourceSetupRequirements:[]};let t=[...e.filter(l=>l.preferred),...e.filter(l=>!l.preferred)],n=await Promise.all(t.map(ze)),o=new Map,r=[];for(let l of n)for(let c of l.actionCatalog){let d=o.has(c.id)?`${c.agentId??"agent"}.${c.sourceActionId??c.id}`:c.id,g=d===c.id?c:{...c,id:d};o.set(d,g),r.push(g)}let i=Vt(n.map(l=>l.catalog.generatedAt)),a=n.map(l=>l.catalog.error).filter(Boolean);return{catalog:{actionCount:r.length,generatedAt:i,manifestPath:n.find(l=>l.catalog.manifestPath)?.catalog.manifestPath??null,registryPath:n.find(l=>l.catalog.registryPath)?.catalog.registryPath??null,stale:n.some(l=>l.catalog.stale),error:a.length>0?a.join("; "):null},actionCatalog:r,sourceSetupRequirements:n.flatMap(l=>l.sourceSetupRequirements)}}s(Be,"loadProfileActionCatalogForSources");async function ze(e){let t=e.sourcePath,n=Y.join(t,He),o=Y.join(t,Ge),r=Y.join(t,Wt),i=Y.join(t,Kt);try{let a=await V(n),l=await V(o),c=await V(r),d=w(await V(i)),g=w(w(a)?.inputSchemas),P=Ue(w(c)?.setupRequirements)??[],x=Xt(P),S=new Map;for(let m of[...ge(w(a)?.actionCatalog),...ge(w(l)?.actions),...ge(w(a)?.actions)]){let $=p(m.id)??p(m.name);if(!$)continue;let C=S.get($),kt=Zt({sourceRequirementsByAction:x,actionId:$,actionName:p(m.name)}),Ct=Qt(Ue(m.setupRequirements)??C?.setupRequirements??[],kt),Ot={id:$,agentId:e.agentId,sourcePath:t,sourceActionId:$,name:p(m.name)??C?.name??$,label:p(m.label)??C?.label??rn($),description:p(m.description)??C?.description??null,visibility:p(m.visibility)??C?.visibility??"default",inputSchema:on(m.inputSchema,g)??C?.inputSchema??null,outputSchema:Je(m.outputSchema)??C?.outputSchema??null,approvalPolicy:w(m.approvalPolicy)??C?.approvalPolicy??null,artifactPolicy:w(m.artifactPolicy)??C?.artifactPolicy??null,setupRequirements:Ct,mcp:w(m.mcp)??C?.mcp??null,schedulePolicy:w(m.schedulePolicy)??C?.schedulePolicy??null,trace:Yt(w(m.trace)??C?.trace??null,d),implementation:w(m.implementation)??C?.implementation??null,invokesModel:typeof m.invokesModel=="boolean"?m.invokesModel:C?.invokesModel};S.set($,Ot)}let M=Array.from(S.values()).filter(m=>m.visibility!=="internal"&&m.visibility!=="debug"),H=[...a?[]:[He],...l?[]:[Ge]],_=await nn([n,o]);return{catalog:{actionCount:M.length,generatedAt:_,manifestPath:U(n)?n:null,registryPath:U(o)?o:null,stale:H.length>0,error:H.length>0?tn(e,H):null},actionCatalog:M,sourceSetupRequirements:P}}catch(a){return{catalog:{actionCount:0,generatedAt:null,manifestPath:U(n)?n:null,registryPath:U(o)?o:null,stale:!0,error:a instanceof Error?a.message:String(a)},actionCatalog:[],sourceSetupRequirements:[]}}}s(ze,"loadProfileActionCatalogSource");function Yt(e,t){if(!t)return e;let n=p(t.versionId),o=p(t.digest);return!n||!o?e:{...e??{},agentVersionId:n,agentPackageDigest:o,validationReceiptIds:Ne(t.validationReceiptIds),evalReceiptIds:Ne(t.evalReceiptIds)}}s(Yt,"mergeAgentPackageTrace");function Ne(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.trim().length>0):[]}s(Ne,"stringArray");function Vt(e){let t=0;for(let n of e){if(!n)continue;let o=Date.parse(n);Number.isFinite(o)&&(t=Math.max(t,o))}return t>0?new Date(t).toISOString():null}s(Vt,"latestIso");function Xt(e){let t=new Map;for(let n of e){let o=[p(n.actionId),p(n.sourceActionId),p(n.actionName)].filter(r=>!!r);for(let r of o){let i=t.get(r)??[];i.push(n),t.set(r,i)}}return t}s(Xt,"sourceSetupRequirementsByAction");function Zt(e){return[...e.sourceRequirementsByAction.get(e.actionId)??[],...e.actionName&&e.actionName!==e.actionId?e.sourceRequirementsByAction.get(e.actionName)??[]:[]].map(n=>({...n,source:"source_upload_metadata"}))}s(Zt,"setupRequirementsForActionSource");function Qt(e,t){if(t.length===0)return e;let n=[],o=new Set;for(let r of[...e,...t]){let i=en(r);o.has(i)||(o.add(i),n.push(r))}return n}s(Qt,"mergeSetupRequirements");function en(e){return[p(e.actionId)??p(e.sourceActionId)??p(e.actionName)??"",p(e.kind)??p(e.type)??"",p(e.name)??p(e.key)??p(e.provider)??p(e.tool)??p(e.command)??p(e.packageName)??p(e.path)??p(e.repo)??p(e.url)??p(e.id)??""].join(":")}s(en,"setupRequirementIdentity");function tn(e,t){return[`Profile agent ${e.agentId} at ${e.sourcePath} is missing SDK catalog artifact(s): ${t.join(", ")}.`,"Run `openpond profile check --kind all` after source materialization so each enabled profile agent has inspect/build artifacts."].join(" ")}s(tn,"missingSourceArtifactsMessage");async function V(e){return U(e)?JSON.parse(await zt(e,"utf8")):null}s(V,"readJsonIfExists");async function nn(e){let t=0;for(let n of e){if(!U(n))continue;let o=await Jt(n);t=Math.max(t,o.mtimeMs)}return t>0?new Date(t).toISOString():null}s(nn,"latestMtime");function w(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:null}s(w,"asRecord");function ge(e){return Array.isArray(e)?e.filter(t=>!!w(t)):[]}s(ge,"records");function Ue(e){return Array.isArray(e)?e.filter(t=>!!w(t)):null}s(Ue,"recordArray");function p(e){return typeof e=="string"&&e.trim()?e.trim():null}s(p,"text");function Je(e){return p(e)??w(e)}s(Je,"schemaValue");function on(e,t){let n=Je(e);return typeof n!="string"?n:w(t?.[n])??n}s(on,"resolvedSchemaValue");function rn(e){let t=e.replace(/[._-]+/g," ").trim();return t?t.replace(/\b\w/g,n=>n.toUpperCase()):e}s(rn,"titleFromActionId");import{createHash as sn}from"node:crypto";import{existsSync as Ve}from"node:fs";import{readdir as Xe,readFile as an,stat as ln}from"node:fs/promises";import q from"node:path";var me="skills",X="SKILL.md",We=8e4;async function Ze(e){let t=q.join(e,me);if(!Ve(t))return{skillCatalog:Ke({stale:!1}),skills:[]};try{let n=await Xe(t,{withFileTypes:!0}),o=(await Promise.all(n.filter(i=>i.isDirectory()).map(i=>un(e,i.name)))).sort((i,a)=>i.name.localeCompare(a.name)||i.path.localeCompare(a.path));fn(o);let r=await pn(e,o);return{skillCatalog:{skillCount:o.length,generatedAt:r,stale:!1,error:null},skills:o}}catch(n){return{skillCatalog:Ke({stale:!0,error:n instanceof Error?n.message:String(n)}),skills:[]}}}s(Ze,"loadProfileSkills");function cn(e){let t=[],n=/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)([\s\S]*)$/.exec(e);if(!n)return{name:null,description:null,body:e.trim(),messages:["SKILL.md must start with YAML frontmatter bounded by ---."]};let o=n[1]??"",r=(n[2]??"").trim(),i;try{i=Oe.load(o)}catch(d){t.push(`SKILL.md frontmatter is invalid YAML: ${d instanceof Error?d.message:String(d)}`)}let a=mn(i),l=Ye(a?.name),c=Ye(a?.description);return l||t.push("Skill frontmatter must include a non-empty name."),c||t.push("Skill frontmatter must include a non-empty description."),r||t.push("Skill body must be non-empty markdown."),{name:l,description:c,body:r,messages:t}}s(cn,"parseProfileSkillMarkdown");function Ke(e={}){return{skillCount:0,generatedAt:null,stale:e.stale??!0,error:e.error??null}}s(Ke,"emptyProfileSkillCatalogState");async function un(e,t){let n=q.join(me,t,X).replace(/\\/g,"/"),o=q.join(e,n),r=[],i=q.join(e,me,t),a=await dn(i),l="";Ve(o)?l=await an(o,"utf8"):r.push(`Missing ${X}.`),l.length>We&&r.push(`Skill markdown exceeds the limit of ${We} characters.`);let c=cn(l);r.push(...c.messages);let d=c.name??t,g=c.description??"";return gn(d)||r.push("Skill name must be lowercase kebab-case."),d!==t&&r.push(`Skill name must match its directory name (${t}).`),{name:d,description:g,path:n,scope:"profile",enabled:r.length===0,sourcePath:e,charCount:l.length,sourceHash:Pn(l),validationStatus:r.length>0?"error":"valid",validationMessages:r,resourceFiles:a.filter(P=>P!==X)}}s(un,"loadProfileSkillDirectory");async function dn(e){let t=[];async function n(o,r){let i=await Xe(o,{withFileTypes:!0});await Promise.all(i.map(async a=>{let l=r?`${r}/${a.name}`:a.name;a.isDirectory()?await n(q.join(o,a.name),l):a.isFile()&&t.push(l)}))}return s(n,"visit"),await n(e,""),t.sort()}s(dn,"listPackageFiles");function fn(e){let t=new Map;for(let n of e)t.set(n.name,(t.get(n.name)??0)+1);for(let n of e)(t.get(n.name)??0)<=1||(n.enabled=!1,n.validationStatus="error",n.validationMessages=[...n.validationMessages,`Duplicate skill name: ${n.name}`])}s(fn,"markDuplicateSkillNames");async function pn(e,t){let n=0;for(let o of t){let r=q.dirname(q.join(e,o.path)),i=[X,...o.resourceFiles];for(let a of i){let l=await ln(q.join(r,a)).catch(()=>null);l?.isFile()&&(n=Math.max(n,l.mtimeMs))}}return n>0?new Date(n).toISOString():null}s(pn,"latestSkillMtime");function gn(e){return/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(e)}s(gn,"isKebabCaseSkillName");function mn(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:null}s(mn,"asRecord");function Ye(e){if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null}s(Ye,"text");function Pn(e){return sn("sha256").update(e).digest("hex")}s(Pn,"sha256Hex");var F="openpond-profile.json",Sn="settings/profile.yaml",lt="default",A="default";function kn(e,t){let n=e?.defaultAgent??A,o=e?.enabledAgents&&e.enabledAgents.length>0?e.enabledAgents:[n];return{...e??{},path:t,defaultAgent:n,enabledAgents:o}}s(kn,"mergeProfileRepoManifestEntry");function Q(e,t,n){let o=I(e);if(e){let l=o.findIndex(d=>u.resolve(d.repoPath)===u.resolve(e.repoPath)&&d.profile===e.profile),c={source:o[l]?.source??"local",repositoryId:o[l]?.repositoryId??u.resolve(e.repoPath),repoPath:u.resolve(e.repoPath),profile:e.profile,...e.lastCheck?{lastCheck:e.lastCheck}:{},...e.lastPush?{lastPush:e.lastPush}:{}};l>=0?o[l]=c:o.push(c)}let r=o.findIndex(l=>u.resolve(l.repoPath)===u.resolve(t)&&l.profile===n),i=r>=0?o[r]:{source:"local",repositoryId:u.resolve(t),repoPath:u.resolve(t),profile:n};return r<0&&o.push(i),{repoPath:u.resolve(t),profile:n,mode:"local",profiles:o,...i.lastCheck?{lastCheck:i.lastCheck}:{},...i.lastPush?{lastPush:i.lastPush}:{}}}s(Q,"mergeActiveLocalProfileConfig");function I(e){if(!e)return[];let t=e.profiles?.map(n=>({...n}))??[];return t.some(n=>u.resolve(n.repoPath)===u.resolve(e.repoPath)&&n.profile===e.profile)||t.push({source:"local",repositoryId:u.resolve(e.repoPath),repoPath:u.resolve(e.repoPath),profile:e.profile,...e.lastCheck?{lastCheck:e.lastCheck}:{},...e.lastPush?{lastPush:e.lastPush}:{}}),t}s(I,"profileConfigEntries");var Cn=it(import.meta.url);function On(){return u.join(Ce(),"library","profiles","default-repo")}s(On,"defaultLocalProfileRepoPath");function ct(e=null){return{mode:"none",repoPath:null,activeProfile:null,sourcePath:null,manifestPath:null,agents:[],skills:[],evals:[],git:null,catalog:ue(e),skillCatalog:de(e),actionCatalog:[],sourceSetupRequirements:[],setupGate:fe(),diff:K(),hosted:null,summary:pe(e),lastCheck:null,error:e}}s(ct,"emptyProfileState");async function qo(e={}){let t=u.resolve(e.repoPath??On()),n=Se(e.profile),o=u.join("profiles",n),r=u.join(t,o),i=e.template??"blank-agent",a=i==="blank-profile";await E(t,{recursive:!0});let l=k(u.join(t,F)),c=await T(t).catch(()=>Tn(n,o));if(a&&l&&c.profiles[n])throw new Error(`Profile "${n}" already exists in ${t}.`);c.defaultProfile=c.defaultProfile||n,c.profiles[n]=kn(c.profiles[n],o),a&&(c.profiles[n].enabledAgents=[]),a?await E(r,{recursive:!0}):await In(r,i,!!e.force),await pt(r),await vn(t,r,n,{includeDefaultAgent:!a}),await Z(t,c),await Le(t);let d=(await O()).openpondProfile;return await L({openpondProfile:Q(d,t,n)}),j()}s(qo,"initLocalProfileRepo");async function jo(e,t,n){let o=u.resolve(e),r=await T(o),i=Se(t??r.defaultProfile);ke(r,o,i);let a=(await O()).openpondProfile,l=Q(a,o,i);return ut(l,o,i,n),await L({openpondProfile:l}),j()}s(jo,"loadLocalProfileRepo");async function Fo(e,t,n){let o=u.resolve(e),r=await T(o),i=Se(t??r.defaultProfile);ke(r,o,i);let a=(await O()).openpondProfile,l=Q(a,o,i);return ut(l,o,i,n),a&&(l.repoPath=a.repoPath,l.profile=a.profile,l.lastCheck=a.lastCheck,l.lastPush=a.lastPush),await L({openpondProfile:l}),bn(ye({repoPath:o,profile:i,source:n?.source,repositoryId:n?.repositoryId}))}s(Fo,"registerLocalProfileRepo");function ut(e,t,n,o){o&&(e.profiles=I(e).map(r=>u.resolve(r.repoPath)===t&&r.profile===n?{...r,source:o.source,repositoryId:o.repositoryId}:r))}s(ut,"applyProfileIdentity");async function To(e,t){let n=e.trim(),o=Fn(t);if(!n)throw new Error("Agent ID is required.");let i=(await O()).openpondProfile;if(!i)throw new Error("No active local Profile.");let a=await T(i.repoPath),l=a.profiles[i.profile];if(!l)throw new Error(`Profile "${i.profile}" was not found.`);let c=l.defaultAgent??A;if(!(l.enabledAgents??[c]).includes(n))throw new Error(`Agent "${n}" was not found in Profile "${i.profile}".`);let g={...l.agentNames??{}};return o===n?delete g[n]:g[n]=o,Object.keys(g).length?l.agentNames=g:delete l.agentNames,await Z(i.repoPath,a),j()}s(To,"renameActiveProfileAgent");async function Ho(e){let t=e.agentPackage;if(Hn(t),!/^[a-z0-9][a-z0-9._-]{0,190}$/.test(t.agentId))throw new Error("Agent package ID is not safe for a local Profile.");let n=await te(),o=n.state.sourcePath;await pt(o);let r=u.join(o,"agents");await E(r,{recursive:!0});let i=u.join(r,t.agentId),a=k(i);if(a&&e.overwrite!==!0)throw new Error(`Agent "${t.agentId}" already exists. Confirm replacement to install this version.`);let l=u.join(r,`.${t.agentId}.${et()}.installing`),c=u.join(r,`.${t.agentId}.${et()}.backup`),d=await T(n.config.repoPath),g=JSON.stringify(d),P=!1,x=!1;try{await Gn(l,t),a&&(await Pe(i,c),P=!0),await Pe(l,i),x=!0;let S=d.profiles[n.config.profile];if(!S)throw new Error(`Profile "${n.config.profile}" was not found.`);let M=new Set(S.enabledAgents??[]);M.add(t.agentId),S.enabledAgents=[...M],S.defaultAgent||(S.defaultAgent=t.agentId),S.agentNames={...S.agentNames??{},[t.agentId]:t.title},await Z(n.config.repoPath,d),P&&await he(c,{recursive:!0,force:!0})}catch(S){throw await he(l,{recursive:!0,force:!0}),x&&await he(i,{recursive:!0,force:!0}),P&&k(c)&&await Pe(c,i),JSON.stringify(d)!==g&&await Z(n.config.repoPath,JSON.parse(g)).catch(()=>{}),S}return{state:await j(),agentId:t.agentId,versionId:t.versionId,digest:t.digest}}s(Ho,"installAgentPackageIntoActiveProfile");async function j(){let t=(await O()).openpondProfile;return t?ee(t):ct()}s(j,"loadOpenPondProfileState");function ye(e){return{source:e.source??"local",repositoryId:e.repositoryId?.trim()||u.resolve(e.repoPath),profileId:e.profile}}s(ye,"openPondProfileRef");async function Rn(){let e=(await O()).openpondProfile;if(!e)return{lastUsed:null,profiles:[]};let t=I(e),n=await Promise.all(t.map(async o=>{let r=await ee({repoPath:o.repoPath,profile:o.profile,mode:"local",...o.lastCheck?{lastCheck:o.lastCheck}:{},...o.lastPush?{lastPush:o.lastPush}:{}});return{ref:ye(o),name:o.profile,repoPath:o.repoPath,sourcePath:r.sourcePath,state:r}}));return{lastUsed:ye({repoPath:e.repoPath,profile:e.profile,source:I(e).find(o=>u.resolve(o.repoPath)===u.resolve(e.repoPath)&&o.profile===e.profile)?.source,repositoryId:I(e).find(o=>u.resolve(o.repoPath)===u.resolve(e.repoPath)&&o.profile===e.profile)?.repositoryId}),profiles:n}}s(Rn,"loadOpenPondProfileLibrary");async function bn(e){if(!e)return j();let t=(await O()).openpondProfile,n=I(t).find(o=>o.source===e.source&&o.repositoryId===e.repositoryId&&o.profile===e.profileId);return n?ee({repoPath:n.repoPath,profile:n.profile,mode:"local",...n.lastCheck?{lastCheck:n.lastCheck}:{},...n.lastPush?{lastPush:n.lastPush}:{}}):ct(`Profile "${e.profileId}" is not installed on this device.`)}s(bn,"loadOpenPondProfileStateForRef");async function Go(e){let t=(await O()).openpondProfile,n=I(t).find(o=>o.source===e.source&&o.repositoryId===e.repositoryId&&o.profile===e.profileId);if(!n)throw new Error(`Profile "${e.profileId}" is not installed on this device.`);return await L({openpondProfile:Q(t,n.repoPath,n.profile)}),j()}s(Go,"selectOpenPondProfile");async function No(e){let t=(await O()).openpondProfile;if(!t)return{lastUsed:null,profiles:[]};let n=I(t).filter(i=>i.source!==e.source||i.repositoryId!==e.repositoryId||i.profile!==e.profileId);if(n.length===0)return await L({openpondProfile:null}),{lastUsed:null,profiles:[]};let r=u.resolve(t.repoPath)===u.resolve(I(t).find(i=>i.source===e.source&&i.repositoryId===e.repositoryId&&i.profile===e.profileId)?.repoPath??"")&&t.profile===e.profileId?n[0]:n.find(i=>u.resolve(i.repoPath)===u.resolve(t.repoPath)&&i.profile===t.profile)??n[0];return await L({openpondProfile:{repoPath:r.repoPath,profile:r.profile,mode:"local",profiles:n,...r.lastCheck?{lastCheck:r.lastCheck}:{},...r.lastPush?{lastPush:r.lastPush}:{}}}),Rn()}s(No,"removeOpenPondProfile");async function ee(e){try{let t=await T(e.repoPath),n=ke(t,e.repoPath,e.profile),o=await xn(t,e.profile),r=mt({manifest:t,profile:e.profile,profileSourcePath:n,agents:o}),[i,a,l,c]=await Promise.all([N(e.repoPath),Be(r),Ze(n),_n(n,r)]),d=nt(e),g=qn(i,e.profile),P=W({actionCatalog:a.actionCatalog,sourceSetupRequirements:a.sourceSetupRequirements}),x=Ln({agents:o,actionCatalog:a.actionCatalog,catalog:a.catalog,diff:g,git:i,hosted:d,lastCheck:e.lastCheck??null,error:null});return{mode:"local",repoPath:e.repoPath,activeProfile:e.profile,sourcePath:n,manifestPath:u.join(e.repoPath,F),agents:o,skills:l.skills,evals:c,git:i,catalog:a.catalog,skillCatalog:l.skillCatalog,actionCatalog:a.actionCatalog,sourceSetupRequirements:a.sourceSetupRequirements,setupGate:P,diff:g,hosted:d,summary:x,lastCheck:e.lastCheck??null,error:null}}catch(t){let n=await N(e.repoPath).catch(()=>null),o=t instanceof Error?t.message:String(t);return{mode:"local",repoPath:e.repoPath,activeProfile:e.profile,sourcePath:null,manifestPath:u.join(e.repoPath,F),agents:[],skills:[],evals:[],git:n,catalog:ue(o),skillCatalog:de(o),actionCatalog:[],sourceSetupRequirements:[],setupGate:fe(),diff:K(),hosted:nt(e),summary:pe(o),lastCheck:e.lastCheck??null,error:o}}}s(ee,"loadOpenPondProfileStateForConfig");async function Uo(e){return ee({repoPath:u.resolve(e.repoPath),profile:e.profileId,mode:"local"})}s(Uo,"loadOpenPondProfileStateFromSource");async function te(){let e=(await O()).openpondProfile;if(!e)throw new Error("No active OpenPond profile. Run `openpond init` or `openpond profile load --path <dir>`.");let t=await j();if(t.error)throw new Error(t.error);if(!t.sourcePath)throw new Error("Active OpenPond profile has no source path.");return{config:e,state:t}}s(te,"requireActiveLocalProfile");async function Do(e){let t=await te(),n=e.command==="run"?e.args??[]:[],o=e.command==="run"?t.state.actionCatalog.find(l=>l.id===n[0]):null,r=u.resolve(e.cwd??o?.sourcePath??t.state.sourcePath),i=e.command==="run"?tt(r,e.args??[],o?.sourceActionId??null):null;if(e.command==="run"&&i){let l=i[0],c=u.resolve(t.state.sourcePath)===r?{actionCatalog:t.state.actionCatalog,sourceSetupRequirements:t.state.sourceSetupRequirements}:await De(r);oe(l,W({actionCatalog:c.actionCatalog,sourceSetupRequirements:c.sourceSetupRequirements,actionId:l}))}let a=await dt({command:e.command,args:e.command==="run"?i??tt(r,e.args??[]):e.args,cwd:r,inherit:e.inherit,throwOnFailure:!1});if((e.command==="inspect"||e.command==="build"||e.command==="validate"||e.command==="eval")&&await ft(e.command,a.code),a.code!==0){let l=a.stderr.trim()||a.stdout.trim();throw new Error(l||`${e.command} failed with exit code ${a.code??"unknown"}`)}return a}s(Do,"runProfileSdkCommand");async function dt(e){let t=u.resolve(e.cwd),n=Un(),o=e.command==="run"?[...n.args,e.command,...e.args??[]]:[...n.args,e.command,"--cwd",t,...e.args??[]],r=await wt(n.command,o,{cwd:t,inherit:e.inherit,timeoutMs:e.timeoutMs,maxOutputBytes:e.maxOutputBytes});if(e.throwOnFailure!==!1&&r.code!==0){let i=St(r,e.command);throw new Error(i||`${e.command} failed with exit code ${r.code??"unknown"}`)}return r}s(dt,"runAgentSdkProjectCommand");function tt(e,t,n=null){let[o,...r]=t;if(!o||o.startsWith("--"))throw new Error("run requires an action name");return[n??o,"--cwd",e,...r]}s(tt,"runCommandArgs");async function Bo(e){let t=!e||e==="all"?["inspect","build","validate","eval"]:[e],n=await te(),o=await T(n.config.repoPath),r=mt({manifest:o,profile:n.config.profile,profileSourcePath:n.state.sourcePath,agents:n.state.agents});for(let i of t){if(i!=="inspect"&&i!=="build"&&i!=="validate"&&i!=="eval")throw new Error("check kind must be one of inspect, build, validate, eval, all");for(let a of r)await An({command:i,source:a,profileSourcePath:n.state.sourcePath,sourceCount:r.length})}}s(Bo,"runProfileCheck");async function An(e){let t=e.command==="inspect"||e.command==="validate"||e.command==="eval"?["--json"]:[];if(e.sourceCount>1){let o=u.relative(e.profileSourcePath,e.source.sourcePath)||".";console.log(`
|
|
9
|
-
[profile:${e.source.agentId}] ${e.command} ${o}`)}let n=await dt({command:e.command,args:t,cwd:e.source.sourcePath,inherit:!1,throwOnFailure:!1});if(n.stdout.trim()&&console.log(n.stdout.trim()),n.stderr.trim()&&console.error(n.stderr.trim()),await ft(e.command,n.code),n.code!==0){let o=St(n,e.command);throw new Error([`Profile check failed for enabled agent ${e.source.agentId} at ${e.source.sourcePath}.`,o||`${e.command} failed with exit code ${n.code??"unknown"}`].join(`
|
|
10
|
-
`))}}s(An,"runProfileCheckForSource");async function zo(e){let t=await te();if(!t.state.repoPath)throw new Error("Active OpenPond profile has no repo path.");let n=await Me(t.state.repoPath,e?.trim()||`Update OpenPond profile ${t.state.activeProfile??lt}`);return{committed:n.committed,stdout:n.stdout,stderr:n.stderr,state:await j()}}s(zo,"commitActiveProfileChanges");async function Jo(e){let t=(await O()).openpondProfile;if(!t)return;let n=I(t).map(o=>u.resolve(o.repoPath)===u.resolve(t.repoPath)&&o.profile===t.profile?{...o,lastPush:e}:o);await L({openpondProfile:{...t,lastPush:e,profiles:n}})}s(Jo,"saveProfilePushStatus");async function ft(e,t){let n=(await O()).openpondProfile;if(!n)return;let o=await $e(n.repoPath).catch(()=>null),r={command:e,status:t===0?"passed":"failed",checkedAt:new Date().toISOString(),exitCode:t,sourceHead:o},i=I(n).map(a=>u.resolve(a.repoPath)===u.resolve(n.repoPath)&&a.profile===n.profile?{...a,lastCheck:r}:a);await L({openpondProfile:{...n,lastCheck:r,profiles:i}})}s(ft,"saveProfileCheckStatus");async function In(e,t,n){if(await E(e,{recursive:!0}),(await at(e)).length>0&&!n)return;let r=z(),i=u.join(r,"templates",t);if(!k(i))throw new Error(`Unknown agent template "${t}".`);await yn(i,e,{recursive:!0,force:n,errorOnExist:!1}),await En(e,r)}s(In,"ensureProfileSource");async function vn(e,t,n,o={}){await E(u.join(e,"profiles"),{recursive:!0});for(let a of["agents","skills","workflows","actions","extensions","prompts","goals","evals","settings","traces"])await E(u.join(t,a),{recursive:!0});let r=u.join(t,Sn);if(!k(r)){let a=o.includeDefaultAgent===!1?["agents: []"]:["agents:",` - id: ${A}`," path: agent/agent.ts"," enabled: true"];await D(r,["schema: openpond.profile.v1",`profile: ${n}`,...a,""].join(`
|
|
11
|
-
`),"utf8")}let i=u.join(t,"openpond.lock");k(i)||await D(i,`# OpenPond profile lockfile placeholder
|
|
12
|
-
`,"utf8")}s(vn,"ensureProfileScaffoldFiles");async function En(e,t){let n=u.join(e,"package.json"),o=await st(n,"utf8"),r=JSON.parse(o);r.dependencies={...r.dependencies??{},"openpond-agent-sdk":`file:${t}`},await D(n,`${JSON.stringify(r,null,2)}
|
|
13
|
-
`,"utf8")}s(En,"rewriteTemplateSdkDependency");async function pt(e){if(!k(u.join(e,"package.json")))return;let t=z();await gt(t);let n=u.join(e,"node_modules"),o=u.join(n,"openpond-agent-sdk");await E(n,{recursive:!0}),k(o)||await wn(t,o,"dir")}s(pt,"ensureProfileDependencies");async function gt(e){if(k(u.join(e,"dist","cli.js"))&&k(u.join(e,"dist","primitives","index.js")))return;let t=u.join(e,"scripts","build.ts");if(!k(t))throw new Error(`Resolved openpond-agent-sdk at ${e}, but built SDK files are missing.`);let n=await wt(process.execPath,[yt(e),t],{cwd:e});if(n.code!==0){let o=n.stderr.trim()||n.stdout.trim();throw new Error(o||`openpond-agent-sdk build failed with exit code ${n.code??"unknown"}`)}}s(gt,"ensureAgentSdkBuilt");async function xn(e,t){let n=e.profiles[t];if(!n)return[];let o=n.defaultAgent??A,r=new Set(n.enabledAgents??[o]);return Array.from(r).map(i=>({id:i,name:n.agentNames?.[i]?.trim()||i,path:i===A?"agent/agent.ts":`agents/${i}`,enabled:!0}))}s(xn,"listProfileAgents");function mt(e){let t=e.manifest.profiles[e.profile]?.defaultAgent??A;return(e.agents.length>0?e.agents:[{id:A,name:A,path:"agent/agent.ts",enabled:!0}]).map(o=>({agentId:o.id,sourcePath:o.id===A?e.profileSourcePath:u.join(e.profileSourcePath,"agents",o.id),preferred:o.id===t}))}s(mt,"profileCatalogSources");async function _n(e,t){let n=new Map,o=[{root:u.join(e,"evals"),agentId:null},...t.flatMap(r=>[{root:u.join(r.sourcePath,"agent","evals"),agentId:r.agentId},{root:u.join(r.sourcePath,"evals"),agentId:r.agentId}])];for(let r of o)for(let i of await Pt(r.root)){let a=u.relative(e,i).split(u.sep).join("/");n.has(a)||n.set(a,{id:a,name:u.basename(i).replace(/\.eval\.[^.]+$/i,"").replace(/\.[^.]+$/i,""),path:a,agentId:r.agentId,sourcePath:i})}return[...n.values()].sort((r,i)=>r.name.localeCompare(i.name)||r.path.localeCompare(i.path))}s(_n,"loadProfileEvals");async function Pt(e){if(!k(e))return[];let t=[];for(let n of await at(e,{withFileTypes:!0})){let o=u.join(e,n.name);n.isDirectory()?t.push(...await Pt(o)):n.isFile()&&/\.eval\.(?:[cm]?[jt]sx?)$/i.test(n.name)&&t.push(o)}return t}s(Pt,"listEvalSourceFiles");function nt(e){let t=e.lastPush;return t?{teamId:t.teamId??null,projectId:t.projectId??null,sourceRef:t.sourceRef??null,sourceCommitSha:t.hostedHead??null,lastPushedAt:t.pushedAt,lastPushedLocalHead:t.localHead??null,lastPushedHostedHead:t.hostedHead??null,promotionStatus:t.promotionStatus??null,hostedRunStatus:t.hostedRunStatus??null,hostedRunAgentId:t.hostedRunAgentId??null,hostedRunId:t.hostedRunId??null,hostedRunAt:t.hostedRunAt??null,hostedSourceMaterialization:t.hostedSourceMaterialization??null,hostedSourceCheck:t.hostedSourceCheck??null,hostedPublish:t.hostedPublish??null,hostedRun:t.hostedRun??null}:null}s(nt,"hostedBindingFromConfig");function Ln(e){let t=e.actionCatalog.find(r=>r.id==="chat")?.id??e.actionCatalog.find(r=>r.name==="chat")?.id??e.actionCatalog.find(r=>r.id.endsWith(".chat"))?.id??null,n=!!(e.lastCheck&&e.lastCheck.status==="passed"&&e.lastCheck.sourceHead&&e.lastCheck.sourceHead===e.git.head&&!e.git.dirty&&!e.catalog.stale),o=Mn({catalog:e.catalog,git:e.git,lastCheck:e.lastCheck});return e.error?{state:"error",message:e.error,agentCount:e.agents.length,actionCount:e.actionCatalog.length,defaultAction:t,checkFresh:n,checkStaleReason:o,localHead:e.git.head,hostedHead:e.hosted?.sourceCommitSha??null}:e.git.isRepo?e.git.head?e.git.dirty?{state:"dirty",message:$n(e.diff),agentCount:e.agents.length,actionCount:e.actionCatalog.length,defaultAction:t,checkFresh:n,checkStaleReason:o,localHead:e.git.head,hostedHead:e.hosted?.sourceCommitSha??null}:{state:"ready",message:e.catalog.stale?"Profile source is clean; action catalog needs inspect/build.":"Profile source is clean.",agentCount:e.agents.length,actionCount:e.actionCatalog.length,defaultAction:t,checkFresh:n,checkStaleReason:o,localHead:e.git.head,hostedHead:e.hosted?.sourceCommitSha??null}:{state:"pending_commit",message:"Profile source is ready for its first commit.",agentCount:e.agents.length,actionCount:e.actionCatalog.length,defaultAction:t,checkFresh:!1,checkStaleReason:"Profile source has no committed head.",localHead:null,hostedHead:e.hosted?.sourceCommitSha??null}:{state:"error",message:"Profile source is not Git-backed.",agentCount:e.agents.length,actionCount:e.actionCatalog.length,defaultAction:t,checkFresh:!1,checkStaleReason:"Profile source is not Git-backed.",localHead:null,hostedHead:e.hosted?.sourceCommitSha??null}}s(Ln,"summarizeProfileState");function Mn(e){return e.catalog.error?`Catalog error: ${e.catalog.error}`:e.catalog.stale?"Action catalog artifacts are missing or stale.":e.lastCheck?e.lastCheck.status!=="passed"?`Last ${e.lastCheck.command} check failed.`:e.lastCheck.sourceHead?e.git.head&&e.lastCheck.sourceHead!==e.git.head?"Profile source changed since the last check.":e.git.dirty?"Profile has uncommitted source changes.":null:"Last check did not record a source head.":"Profile checks have not run."}s(Mn,"profileCheckStaleReason");function $n(e){let t=[];return e.changedAgents.length>0&&t.push(`${e.changedAgents.length} changed agent(s)`),e.newAgents.length>0&&t.push(`${e.newAgents.length} new agent(s)`),e.deletedAgents.length>0&&t.push(`${e.deletedAgents.length} deleted agent(s)`),e.changedSkills.length>0&&t.push(`${e.changedSkills.length} changed skill(s)`),e.changedActions.length>0&&t.push(`${e.changedActions.length} changed action(s)`),e.changedExtensions.length>0&&t.push(`${e.changedExtensions.length} changed extension(s)`),e.setupChanges.length>0&&t.push(`${e.setupChanges.length} setup change(s)`),e.envRequirementChanges.length>0&&t.push(`${e.envRequirementChanges.length} env requirement change(s)`),t.length>0?`Profile has ${t.join(", ")}.`:"Profile has uncommitted source changes."}s($n,"profileDirtyMessage");function qn(e,t){let n=K();n.files=e.files;let o=`profiles/${t}/`;for(let r of e.files){let i=r.path.replace(/\\/g,"/");if(i===F||i===".gitignore"){v(n.setupChanges,i);continue}if(!i.startsWith(o))continue;let a=i.slice(o.length);jn(n,r,a)}return n}s(qn,"summarizeProfileDiff");function jn(e,t,n){let o=n.split("/")[0]??"";if(o==="agent")ot(e,A,t.category);else if(o==="agents"){let r=n.split("/")[1];r&&ot(e,r,t.category)}else o==="skills"?v(e.changedSkills,n.split("/")[1]??n):o==="actions"?v(e.changedActions,n.split("/")[1]??n):o==="extensions"?v(e.changedExtensions,n.split("/")[1]??n):(o==="settings"||n==="package.json"||n==="openpond.yaml"||n==="openpond.lock")&&v(e.setupChanges,n);n.toLowerCase().includes("env")&&v(e.envRequirementChanges,n),n.startsWith(".openpond/")&&v(e.changedActions,"catalog")}s(jn,"classifyProfileFileChange");function ot(e,t,n){if(n==="added"||n==="untracked"){v(e.newAgents,t);return}if(n==="deleted"){v(e.deletedAgents,t);return}v(e.changedAgents,t)}s(ot,"addAgentChange");function v(e,t){!t||e.includes(t)||e.push(t)}s(v,"addUnique");function Se(e){let t=e?.trim();if(!t)return lt;if(!/^[a-zA-Z0-9._-]+$/.test(t))throw new Error("profile name may only contain letters, numbers, dots, underscores, and hyphens");return t}s(Se,"normalizeProfileName");function Fn(e){let t=e.trim().replace(/\s+/g," ");if(!t)throw new Error("Agent name is required.");if(t.length>80)throw new Error("Agent name must be 80 characters or fewer.");if(/[\u0000-\u001f\u007f]/.test(t))throw new Error("Agent name cannot contain control characters.");return t}s(Fn,"normalizeAgentDisplayName");function Tn(e,t){return{schema:"openpond.profileRepo.v1",defaultProfile:e,profiles:{[e]:{path:t,defaultAgent:A,enabledAgents:[A]}}}}s(Tn,"defaultProfileManifest");async function T(e){let t=u.join(e,F),n=await st(t,"utf8"),o=JSON.parse(n);if(o.schema!=="openpond.profileRepo.v1"||!o.profiles||typeof o.profiles!="object")throw new Error(`${t} is not an OpenPond profile repo manifest.`);return o}s(T,"readProfileManifest");async function Z(e,t){await D(u.join(e,F),`${JSON.stringify(t,null,2)}
|
|
14
|
-
`,"utf8")}s(Z,"writeProfileManifest");function ke(e,t,n){let o=e.profiles[n];if(!o)throw new Error(`Profile "${n}" was not found in ${u.join(t,F)}.`);let r=u.resolve(t,o.path);if(!k(r))throw new Error(`Profile source path does not exist: ${r}`);return r}s(ke,"profileSourcePath");function Hn(e){let t=0,n=new Set;for(let l of e.source.files){let c=ht(l.path);if(n.has(c))throw new Error(`Agent package contains duplicate source path ${c}.`);n.add(c);let d=Buffer.from(l.contentsBase64,"base64");if(d.byteLength!==l.sizeBytes||Qe("sha256").update(d).digest("hex")!==l.sha256)throw new Error(`Agent package source checksum failed for ${c}.`);t+=d.byteLength}if(t!==e.source.totalSizeBytes)throw new Error("Agent package source size does not match its manifest.");let{digest:o,versionId:r,...i}=e,a=Qe("sha256").update(Nn(i)).digest("hex");if(a!==e.digest||e.versionId!==`agent-${a.slice(0,20)}`)throw new Error("Agent package content digest does not match its version.")}s(Hn,"verifyAgentPackageIntegrity");async function Gn(e,t){await E(e,{recursive:!0,mode:448});for(let o of t.source.files){let r=ht(o.path),i=u.resolve(e,r);if(!i.startsWith(`${u.resolve(e)}${u.sep}`))throw new Error("Agent package source path escapes its install root.");await E(u.dirname(i),{recursive:!0,mode:448});let a=Buffer.from(o.contentsBase64,"base64");if(r==="package.json"){let l=JSON.parse(a.toString("utf8"));l.dependencies={...l.dependencies??{},"openpond-agent-sdk":`file:${z()}`},a=Buffer.from(`${JSON.stringify(l,null,2)}
|
|
15
|
-
`,"utf8")}await D(i,a,{mode:384,flag:"wx"})}let n=u.join(e,".openpond","agent-package-origin.json");await E(u.dirname(n),{recursive:!0,mode:448}),await D(n,`${JSON.stringify({schema:"openpond.agent-package-origin.v1",agentId:t.agentId,versionId:t.versionId,digest:t.digest,validationReceiptIds:t.receipts.filter(o=>o.kind==="sdk_validation").map(o=>o.id),evalReceiptIds:t.receipts.filter(o=>o.kind==="sdk_eval").map(o=>o.id)},null,2)}
|
|
16
|
-
`,{mode:384,flag:"wx"})}s(Gn,"materializeAgentPackage");function ht(e){let t=e.trim().replaceAll("\\","/"),n=u.posix.normalize(t);if(!n||n==="."||n===".."||n.startsWith("/")||n.startsWith("../")||n.split("/").some(o=>o===".."))throw new Error(`Agent package contains an invalid source path: ${e}.`);return n}s(ht,"normalizeAgentPackagePath");function Nn(e){return JSON.stringify(we(e))}s(Nn,"stableAgentPackageJson");function we(e){return Array.isArray(e)?e.map(we):!e||typeof e!="object"?e:Object.fromEntries(Object.entries(e).sort(([t],[n])=>t.localeCompare(n)).map(([t,n])=>[t,we(n)]))}s(we,"sortAgentPackageJson");function z(){let e=Cn.resolve("openpond-agent-sdk/package.json");return u.dirname(e)}s(z,"resolveAgentSdkRoot");async function Wo(){let e=z();return await gt(e),e}s(Wo,"prepareAgentSdkRuntimePackage");function Un(){let e=z(),t=u.join(e,"dist","cli.js");if(k(t))return{command:process.execPath,args:[t]};let n=u.join(e,"src","cli.ts");if(k(n))return{command:process.execPath,args:[yt(e),n]};throw new Error(`openpond-agent CLI was not found under ${e}`)}s(Un,"resolveAgentSdkCliLaunch");function yt(e){return it(u.join(e,"package.json")).resolve("tsx/cli")}s(yt,"resolveTsxCli");async function wt(e,t,n={}){return new Promise((o,r)=>{let i=hn(e,t,{cwd:n.cwd,stdio:n.inherit?"inherit":"pipe"}),a="",l="",c=!1,d=!1,g=!1,P=n.timeoutMs??600*1e3,x=n.maxOutputBytes??2*1024*1024,S=P>0?setTimeout(()=>{g=!0,i.kill("SIGTERM")},P):null,M=P>0?setTimeout(()=>{g&&i.exitCode===null&&i.kill("SIGKILL")},P+5e3):null;n.inherit||(i.stdout?.on("data",_=>{let m=rt(a,String(_),x,c);a=m.text,c=m.truncated}),i.stderr?.on("data",_=>{let m=rt(l,String(_),x,d);l=m.text,d=m.truncated}));let H=s(()=>{S&&clearTimeout(S),M&&clearTimeout(M)},"clearTimers");i.on("error",_=>{H(),r(_)}),i.on("close",_=>{H(),o({code:_,stdout:a,stderr:l,timedOut:g,stdoutTruncated:c,stderrTruncated:d})})})}s(wt,"spawnCommand");function rt(e,t,n,o){if(o)return{text:e,truncated:!0};let r=`${e}${t}`;return Buffer.byteLength(r,"utf8")<=n?{text:r,truncated:!1}:{text:`${Buffer.from(r).subarray(0,Math.max(0,n)).toString("utf8")}
|
|
17
|
-
[truncated after ${n} bytes]
|
|
18
|
-
`,truncated:!0}}s(rt,"appendBoundedOutput");function St(e,t){let n=e.stderr.trim()||e.stdout.trim(),o=[e.timedOut?`${t} timed out`:"",e.stdoutTruncated?"stdout truncated":"",e.stderrTruncated?"stderr truncated":""].filter(Boolean);return[n,...o].filter(Boolean).join(`
|
|
19
|
-
`)}s(St,"commandFailureDetail");export{cn as a,J as b,W as c,oe as d,Rt as e,Tt as f,Gt as g,Nt as h,Ut as i,Dt as j,F as k,Sn as l,lt as m,A as n,kn as o,Q as p,On as q,ct as r,qo as s,jo as t,Fo as u,To as v,Ho as w,j as x,ye as y,Rn as z,bn as A,Go as B,No as C,Uo as D,te as E,Do as F,dt as G,Bo as H,zo as I,Jo as J,Wo as K};
|