openpond 0.2.13 → 0.2.14
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 +4 -0
- package/dist/app-server.js +1 -1
- package/dist/chunks/{app-server-runtime-GIFUDGYZ.js → app-server-runtime-BHZQNP3K.js} +1 -1
- package/dist/chunks/chunk-6C2EXO4H.js +5 -0
- package/dist/chunks/{chunk-NHBCFMAC.js → chunk-BVYAP3M6.js} +1 -1
- package/dist/chunks/{chunk-OHGSESPN.js → chunk-O7SI3RQJ.js} +1 -1
- package/dist/chunks/{chunk-MSF7ZBFG.js → chunk-Q3KAKIVM.js} +1 -1
- package/dist/chunks/{chunk-XK77GSBL.js → chunk-ZZWAUD7I.js} +320 -320
- package/dist/chunks/{cli-XJJYXKXM.js → cli-2BUMKLMW.js} +1 -1
- package/dist/chunks/{src-7NWHHROY.js → src-SKYU7PDL.js} +108 -108
- package/dist/chunks/{workspaces-I5BVMFVY.js → workspaces-MXYF6QTH.js} +1 -1
- package/dist/cli.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/chunk-MPQWFPGA.js +0 -5
|
@@ -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,Q,R,S,T,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"./chunk-
|
|
2
|
+
import{A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"./chunk-BVYAP3M6.js";import"./chunk-O7SI3RQJ.js";import"./chunk-FTQLQJQV.js";export{a as MACOS_GIT_MISSING_DEVELOPER_TOOLS_ERROR,C as appWorkspacePaths,B as assertSafeBranchName,d as checkWorkspaceGitAvailability,J as checkoutBranch,K as checkoutBranchAtPath,M as clearWorkspaceDiffCacheForTests,D as cloneWorkspace,H as createAndCheckoutBranch,I as createAndCheckoutBranchAtPath,A as expectedRemoteUrl,t as isGeneratedWorkspacePath,i as isGitRepo,c as isMacOSGitDeveloperToolsMissing,u as isVisibleGitWorkspaceFile,r as isWorkspaceDirectory,E as lastFetchAt,z as listPlainWorkspaceFiles,P as loadGitCommitDiffAtPath,N as loadWorkspaceDiff,O as loadWorkspaceDiffAtPath,Q as loadWorkspaceFile,T as loadWorkspaceFileAtPath,R as loadWorkspaceImageFile,S as loadWorkspaceImageFileAtPath,F as loadWorkspaceState,G as loadWorkspaceStateAtPath,n as localVideoContentType,L as mapWorkspaceDiffEntriesWithConcurrency,s as normalizeWorkspaceFilePath,w as parseBranchStatusLine,x as parseNumstat,v as parseStatusLine,h as pathExists,p as readLocalImageFile,q as readLocalVideoFile,l as readWorkspaceDocumentPreview,k as readWorkspaceFile,o as readWorkspaceImageFile,g as redactRemoteUrl,b as runWorkspaceCommand,f as sourceFromRemote,e as startMacOSCommandLineToolsInstall,j as truncatePatch,y as uniqueSortedPaths,m as workspaceImageContentType};
|
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
3
|
-
import{a as m,b as l}from"./chunks/chunk-ZVOO7FKM.js";import"./chunks/chunk-GLUWATL5.js";import{b as u}from"./chunks/chunk-NYPLOXEP.js";import{a as c,j as d}from"./chunks/chunk-3GLSX322.js";import{f as s}from"./chunks/chunk-3M53YXEI.js";import{a as i}from"./chunks/chunk-FTQLQJQV.js";function f(e){return!e.command&&s(e.options.version)?"version":s(e.options.checkUpdate)?"check-update":!e.command&&s(e.options.help)?"help":!e.command&&s(e.options.tui)?"tui":e.command?"command":"ui"}i(f,"resolveCliTopLevelAction");async function v(e=process.argv.slice(2)){if(await C(e))return;let{command:r,options:o,rest:t}=u(e);typeof o.home=="string"&&(process.env.OPENPOND_HOME=(await import("./chunks/dist-UA2RQUA4.js")).resolveOpenPondHome({home:o.home}));let n=f({command:r,options:o});if(n==="version"){console.log(c());return}if(n==="check-update"){await(await import("./chunks/core-commands-6GZ7T4SK.js")).runCheckUpdate();return}if(n==="help"){(await import("./chunks/help-MTWG7AXZ.js")).printHelp();return}let a=m(o),p=l(o);if(a&&(process.env.OPENPOND_ACCOUNT=a),p&&(process.env.OPENPOND_BASE_URL=p),n==="tui"){await(await import("./chunks/app-layer-S6H572UM.js")).runOpenPondTerminalCommand(o,t);return}if(n==="ui"){await(await import("./chunks/app-layer-S6H572UM.js")).runOpenPondServerCommand("web",o,t);return}await d({command:r,options:o,rest:t})||((await import("./chunks/help-MTWG7AXZ.js")).printHelp(),process.exit(1))}i(v,"runOpenPondCli");async function C(e){if(e[0]==="__app-server"){process.argv=[process.execPath,"openpond-app-server",...e.slice(1)];let[{createOpenPondAppServer:r},{runOpenPondAppServerCli:o}]=await Promise.all([import("./chunks/app-server-runtime-
|
|
3
|
+
import{a as m,b as l}from"./chunks/chunk-ZVOO7FKM.js";import"./chunks/chunk-GLUWATL5.js";import{b as u}from"./chunks/chunk-NYPLOXEP.js";import{a as c,j as d}from"./chunks/chunk-3GLSX322.js";import{f as s}from"./chunks/chunk-3M53YXEI.js";import{a as i}from"./chunks/chunk-FTQLQJQV.js";function f(e){return!e.command&&s(e.options.version)?"version":s(e.options.checkUpdate)?"check-update":!e.command&&s(e.options.help)?"help":!e.command&&s(e.options.tui)?"tui":e.command?"command":"ui"}i(f,"resolveCliTopLevelAction");async function v(e=process.argv.slice(2)){if(await C(e))return;let{command:r,options:o,rest:t}=u(e);typeof o.home=="string"&&(process.env.OPENPOND_HOME=(await import("./chunks/dist-UA2RQUA4.js")).resolveOpenPondHome({home:o.home}));let n=f({command:r,options:o});if(n==="version"){console.log(c());return}if(n==="check-update"){await(await import("./chunks/core-commands-6GZ7T4SK.js")).runCheckUpdate();return}if(n==="help"){(await import("./chunks/help-MTWG7AXZ.js")).printHelp();return}let a=m(o),p=l(o);if(a&&(process.env.OPENPOND_ACCOUNT=a),p&&(process.env.OPENPOND_BASE_URL=p),n==="tui"){await(await import("./chunks/app-layer-S6H572UM.js")).runOpenPondTerminalCommand(o,t);return}if(n==="ui"){await(await import("./chunks/app-layer-S6H572UM.js")).runOpenPondServerCommand("web",o,t);return}await d({command:r,options:o,rest:t})||((await import("./chunks/help-MTWG7AXZ.js")).printHelp(),process.exit(1))}i(v,"runOpenPondCli");async function C(e){if(e[0]==="__app-server"){process.argv=[process.execPath,"openpond-app-server",...e.slice(1)];let[{createOpenPondAppServer:r},{runOpenPondAppServerCli:o}]=await Promise.all([import("./chunks/app-server-runtime-BHZQNP3K.js"),import("./chunks/cli-2BUMKLMW.js")]);return await o(r),!0}if(e[0]==="__server"){process.argv=[process.execPath,"openpond-server",...e.slice(1)];let[{createOpenPondServer:r},{runOpenPondServerCli:o}]=await Promise.all([import("./chunks/src-SKYU7PDL.js"),import("./chunks/cli-2BUMKLMW.js")]),{createOpenPondAppServer:t}=await import("./chunks/app-server-runtime-BHZQNP3K.js");return await o({createOpenPondServer:r,createOpenPondAppServer:t}),!0}return e[0]==="__terminal"?(await(await import("./chunks/src-ZAF6VEWJ.js")).runOpenPondTerminalCli(e.slice(1)),!0):!1}i(C,"runEmbeddedCompanion");v().catch(e=>{let r=e instanceof Error?e.message:String(e),o=e.issue;if(process.argv.includes("--json")&&!(e instanceof Error&&e.name==="OpenPondChildProcessExitError"))console.log(JSON.stringify({error:o??{code:"CLI_ERROR",message:r}}));else if(o&&typeof o=="object"){let n=o;console.error(`${n.code}: ${n.message}
|
|
4
4
|
${n.path}
|
|
5
5
|
${n.action}`)}else console.error(r);let t=typeof e.exitCode=="number"?e.exitCode:1;process.exit(t)});export{v as runOpenPondCli};
|
package/package.json
CHANGED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{c as j,e as y,f as z,g as H,i as N,kb as O}from"./chunk-NNLI4OWY.js";import{b as a}from"./chunk-ES2ISFJC.js";import{a as R,c as P,f as A,h as d}from"./chunk-H7IWJN7L.js";import{a as s}from"./chunk-FTQLQJQV.js";import b from"node:path";import{AsyncLocalStorage as V}from"node:async_hooks";import{promises as M}from"node:fs";var B=new V;function pe(e,t=!1){let r=B.getStore();r&&(t&&(r.length=0),r.push(e))}s(pe,"onStartupFailure");async function me(e,t){await O(e);let r;try{r=await H(b.join(d(e).runtime,"server-owner"),100)}catch(i){if(i instanceof P&&i.issue.code==="STORAGE_BUSY"){let o=await N(b.join(d(e).runtime,"endpoint.json"),()=>null);throw new P({code:"RUNTIME_ALREADY_RUNNING",path:e,message:"An OpenPond runtime already owns this home.",action:o?.url?`Connect to the existing runtime at ${o.url}, or stop it before starting another.`:"Stop the existing runtime before starting another with this home."})}throw i}let n=[];try{let i=await R(e,()=>B.run(n,t)),o=i.close.bind(i);n.length=0;let l;return{...i,close:s(()=>l??=(async()=>{try{await R(e,o)}finally{await M.rm(b.join(d(e).runtime,"endpoint.json"),{force:!0}),await r()}})(),"close")}}catch(i){try{for(let o of n.reverse())await Promise.resolve().then(()=>R(e,o)).catch(()=>{});await M.rm(b.join(d(e).runtime,"endpoint.json"),{force:!0})}finally{await r()}throw i}}s(me,"ownHomeRuntime");async function fe(e,t,r){await y(b.join(d(e).runtime,"endpoint.json"),JSON.stringify({schemaVersion:"openpond.runtimeEndpoint.v1",pid:process.pid,url:t,serverId:r}))}s(fe,"publishRuntimeEndpoint");function ge(e){if(!e.maxContextTokens||!e.usableContextTokens)return{shouldCompact:!1,projectedTokens:e.projectedTokens,thresholdTokens:Number.MAX_SAFE_INTEGER,usableContextTokens:0,maxContextTokens:0,tokenSource:"heuristic"};let t=Math.max(.01,Math.min(1,(e.triggerPercent??85)/100)),r=Math.max(1,Math.floor(e.usableContextTokens*t));return{shouldCompact:e.projectedTokens>=r,projectedTokens:e.projectedTokens,thresholdTokens:r,usableContextTokens:e.usableContextTokens,maxContextTokens:e.maxContextTokens,tokenSource:"heuristic"}}s(ge,"agentCompactionDecision");async function be(e){await e.started();try{return await e.compact()}catch(t){throw await e.failed(t),t}}s(be,"runAgentCompaction");async function xe(e){let t=e.host.projectEvents(e.events),r=e.host.selectEvents(t,e.maxContextTokens),{summaryEvents:n,preservedEvents:i,preservedEventIds:o}=r;if(n.length===0)throw new Error("There is not enough prior context to compact.");let l=e.host.normalizeRecords(n),u=e.host.normalizeRecords(i),h=e.host.buildFileLedger(e.host.normalizeRecords(t)),c=e.host.serializeRecords(l,e.host.inputCharBudget(e.maxContextTokens));if(!c.text.trim())throw new Error("There is not enough prior context to compact.");let p=e.host.buildSummaryMessages({serializedHistory:c.text,fileLedger:h}),v=Date.now(),w=(await e.host.streamSummary({model:e.model,messages:p,signal:e.signal})).trim(),k=Date.now()-v;if(!w)throw new Error("Compaction summary was empty.");let I=e.host.estimateProjection({events:t,preservedEvents:i,summary:w}),_=e.host.createMetrics({sourceEvents:t.length,summarizedEvents:n.length,preservedEvents:i.length,sourceRecords:c.sourceRecordCount,includedRecords:c.includedRecordCount,omittedRecords:c.omittedRecordCount,preservedRecords:u.length,truncatedRecords:c.truncatedRecordCount,summaryInputTruncated:c.inputTruncated,sourceSelectionStrategy:c.selectionStrategy,summaryInputChars:c.inputChars,retainedTailTokens:r.retainedTailTokens,retainedTailBudgetTokens:r.retainedTailBudgetTokens,finalProviderContextTokens:I.inputTokensAfter,durationMs:k,fileLedgerEntries:h.length,splitTurnId:r.splitTurnId});return{summary:w,model:e.model,compactedThroughEventId:t[t.length-1]?.id??null,compactedThroughTurnId:e.host.lastTurnId(t),preservedFromEventId:i[0]?.id??null,preservedEventIds:o,preservedResourceRefs:e.host.durableResourceRefs(e.events),sourceEventCount:n.length,preservedEventCount:i.length,fileLedger:h,inputTokensBefore:I.inputTokensBefore,inputTokensAfter:I.inputTokensAfter,maxContextTokens:e.maxContextTokens,tokenSource:"heuristic",metrics:_}}s(xe,"runAgentCompactionProgram");var E="2026-09-20",Ee=["initialize","initialized","runtime/capabilities","thread/start","thread/resume","thread/read","turn/start","turn/steer","task/inbox","task/queue","task/inputUpdate","turn/interrupt","approval/resolve","userInput/resolve","profile/workflows","profile/evaluations","profile/evaluations/executeCase","profile/evaluations/executeRun","profile/evaluations/compare","harness/inspect","harness/proposalReview","harness/review","harness/acceptEvaluationReview","harness/materializeEvaluationTaskset","harness/runEvaluationBaseline","harness/validate","harness/backgroundReview","harness/diff","harness/rollback","refiner/inspect","refiner/update","refiner/activate","refiner/rollback"],U=a.object({jsonrpc:a.literal("2.0"),id:a.union([a.string(),a.number()]),method:a.string().trim().min(1),params:a.unknown().optional()}).strict(),$=a.object({jsonrpc:a.literal("2.0"),method:a.string().trim().min(1),params:a.unknown().optional()}).strict(),G=a.object({jsonrpc:a.literal("2.0"),id:a.union([a.string(),a.number()]),result:a.unknown()}).strict(),W=a.object({jsonrpc:a.literal("2.0"),id:a.union([a.string(),a.number(),a.null()]),error:a.object({code:a.number().int(),message:a.string(),data:a.unknown().optional()}).strict()}).strict(),Te=a.union([U,$,G,W]),K=a.object({protocolVersion:a.string().trim().min(1),client:a.object({name:a.string().trim().min(1),version:a.string().trim().min(1)}).strict(),capabilities:a.record(a.string(),a.unknown()).default({})}).strict(),T=class{static{s(this,"AgentJsonRpcDispatcher")}#e;#n=null;#t=!1;constructor(t){this.#e=t}get initialized(){return this.#t}async handle(t){let r=$.safeParse(t);if(r.success&&!("id"in t)){if(r.data.method==="initialized"){if(!this.#n)throw new m(-32002,"initialize must be called first");this.#t=!0}return null}let n=U.safeParse(t);if(!n.success)return q(null,-32600,"Invalid Request",n.error.flatten());let i=n.data;try{let o=await this.#r(i.method,i.params);return{jsonrpc:"2.0",id:i.id,result:o}}catch(o){let l=o instanceof m?o:new m(-32603,o instanceof Error?o.message:String(o));return q(i.id,l.code,l.message,l.data)}}async#r(t,r){if(t==="initialize"){let n=K.parse(r);if(n.protocolVersion!==E)throw new m(-32001,"Incompatible agent protocol version",{requested:n.protocolVersion,supported:E});return this.#n=n,{protocolVersion:E,server:{name:"openpond-app-server",version:"1"},capabilities:await this.#e.capabilities()}}if(!this.#t)throw new m(-32002,"initialized notification is required");switch(t){case"runtime/capabilities":return this.#e.capabilities(r);case"thread/start":return this.#e.threadStart(r);case"thread/resume":return this.#e.threadResume(r);case"thread/read":return this.#e.threadRead(r);case"turn/start":return this.#e.turnStart(r);case"turn/steer":return this.#e.turnSteer(r);case"task/inbox":return this.#e.taskInbox(r);case"task/queue":return this.#e.taskQueue(r);case"task/inputUpdate":return this.#e.taskInputUpdate(r);case"turn/interrupt":return this.#e.turnInterrupt(r);case"approval/resolve":return this.#e.approvalResolve(r);case"userInput/resolve":return this.#e.userInputResolve(r);case"profile/workflows":return this.#e.profileWorkflows(r);case"profile/evaluations":return this.#e.profileEvaluations(r);case"profile/evaluations/executeCase":return this.#e.profileEvaluationExecuteCase(r);case"profile/evaluations/executeRun":return this.#e.profileEvaluationExecuteRun(r);case"profile/evaluations/compare":return this.#e.profileEvaluationCompare(r);case"harness/inspect":return this.#e.harnessInspect(r);case"harness/proposalReview":return this.#e.harnessProposalReview(r);case"harness/review":return this.#e.harnessReview(r);case"harness/acceptEvaluationReview":return this.#e.harnessAcceptEvaluationReview(r);case"harness/materializeEvaluationTaskset":return this.#e.harnessMaterializeEvaluationTaskset(r);case"harness/runEvaluationBaseline":return this.#e.harnessRunEvaluationBaseline(r);case"harness/validate":return this.#e.harnessValidate(r);case"harness/backgroundReview":return this.#e.harnessBackgroundReview(r);case"harness/diff":return this.#e.harnessDiff(r);case"harness/rollback":return this.#e.harnessRollback(r);case"refiner/inspect":return this.#e.refinerInspect(r);case"refiner/update":return this.#e.refinerUpdate(r);case"refiner/activate":return this.#e.refinerActivate(r);case"refiner/rollback":return this.#e.refinerRollback(r);default:throw new m(-32601,`Method not found: ${t}`)}}},m=class extends Error{static{s(this,"JsonRpcDispatchError")}code;data;constructor(t,r,n){super(r),this.code=t,this.data=n}};function q(e,t,r,n){return{jsonrpc:"2.0",id:e,error:{code:t,message:r,...n===void 0?{}:{data:n}}}}s(q,"jsonRpcError");import{createHash as Q}from"node:crypto";function C(e){if(e===null||typeof e=="boolean"||typeof e=="string")return e;if(typeof e=="number"){if(!Number.isFinite(e))throw new Error("Canonical JSON cannot encode a non-finite number.");return e}if(Array.isArray(e))return e.map(C);if(typeof e=="object"){let t={};for(let r of Object.keys(e).sort()){let n=e[r];n!==void 0&&(t[r]=C(n))}return t}throw new Error(`Canonical JSON cannot encode ${typeof e}.`)}s(C,"canonicalJson");function g(e){return Q("sha256").update(JSON.stringify(C(e)),"utf8").digest("hex")}s(g,"canonicalHash");var Y=a.enum(["thread.started","thread.resumed","turn.started","turn.steered","turn.interrupted","turn.completed","turn.failed","item.started","item.delta","item.completed","assistant.reasoning.delta","assistant.delta","tool.started","tool.completed","approval.requested","approval.resolved","user_input.requested","user_input.resolved","compaction.started","compaction.completed","harness.admitted","harness.refiner.queued","harness.refiner.started","harness.refiner.completed","harness.refiner.failed","diagnostic"]),X=a.object({sequence:a.number().int().nonnegative(),name:Y,source:a.enum(["runtime","provider","tool","host","refiner"]),status:a.string().trim().min(1).nullable().default(null),threadId:a.string().trim().min(1),turnId:a.string().trim().min(1).nullable().default(null),callId:a.string().trim().min(1).nullable().default(null),output:a.string().nullable().default(null),error:a.string().nullable().default(null),data:a.record(a.string(),a.unknown()).default({})}).strict();function He(e){return g(X.parse(e))}s(He,"canonicalEventHash");import{once as Z}from"node:events";import{createInterface as ee}from"node:readline";async function D(e){let t=new T(e.host),r=Promise.resolve(),n=[],i=s(c=>(r=r.then(async()=>{e.writable.write(`${JSON.stringify(c)}
|
|
3
|
-
`)||await Z(e.writable,"drain")}),r),"write"),o=s(()=>{if(!(!t.initialized||n.length===0))for(let c of n.splice(0))i(c)},"flushPendingNotifications"),l=e.host.subscribe?.(c=>{if(!t.initialized){n.push(c);return}i(c)}),u=new Set,h=ee({input:e.readable,crlfDelay:1/0});try{for await(let c of h){if(!c.trim())continue;let p;try{p=JSON.parse(c)}catch{await i({jsonrpc:"2.0",id:null,error:{code:-32700,message:"Parse error"}});continue}let v=(async()=>{let k=await t.handle(p);k&&await i(k),o()})(),w=p&&typeof p=="object"&&"method"in p?p.method:null;if(w==="initialize"||w==="initialized"){await v;continue}u.add(v),v.finally(()=>u.delete(v))}await Promise.all(u),await r}finally{l?.()}}s(D,"runAgentJsonlServer");var S=a.object({threadId:a.string().trim().min(1)}).passthrough(),te=a.object({session:a.unknown()}).strict(),x=S.extend({input:a.unknown()}),ne=x.extend({idempotencyKey:a.string().trim().min(1).max(200)}),re=x.extend({inputId:a.string().trim().min(1)}),ae=S.extend({reason:a.string().trim().min(1).optional()}),se=a.object({approvalId:a.string().trim().min(1),input:a.unknown()}).strict();function L(e){let t=s(async(n,i,o)=>{let l=performance.now();e.telemetry?.({method:n,phase:"started",threadId:i,durationMs:null,errorClass:null});try{let u=await o();return e.telemetry?.({method:n,phase:"completed",threadId:i,durationMs:performance.now()-l,errorClass:null}),u}catch(u){throw e.telemetry?.({method:n,phase:"failed",threadId:i,durationMs:performance.now()-l,errorClass:u instanceof Error?u.name:"UnknownError"}),u}},"run"),r=s(async(n,i="thread/read")=>{let{threadId:o}=S.parse(n);return t(i,o,async()=>{let[l,u,h]=await Promise.all([e.readThread(o),e.listTurns(o),e.listEvents(o)]);return{thread:l,turns:u,events:h}})},"threadRead");return{capabilities:s(n=>t("runtime/capabilities",null,()=>e.capabilities(n)),"capabilities"),threadStart:s(async n=>t("thread/start",null,async()=>({thread:await e.createThread(te.parse(n).session)})),"threadStart"),threadResume:s(n=>r(n,"thread/resume"),"threadResume"),threadRead:r,turnStart:s(async n=>{let i=x.parse(n);return t("turn/start",i.threadId,async()=>({turn:await e.startTurn(i.threadId,i.input)}))},"turnStart"),turnSteer:s(async n=>{let i=x.parse(n);return t("turn/steer",i.threadId,async()=>({receipt:await e.steerTurn(i.threadId,i.input)}))},"turnSteer"),taskInbox:s(async n=>{let{threadId:i}=S.parse(n);return t("task/inbox",i,()=>e.readTaskInbox(i))},"taskInbox"),taskQueue:s(async n=>{let i=ne.parse(n);return t("task/queue",i.threadId,()=>e.queueTaskInput(i.threadId,i.input,i.idempotencyKey))},"taskQueue"),taskInputUpdate:s(async n=>{let i=re.parse(n);return t("task/inputUpdate",i.threadId,()=>e.updateTaskInput(i.threadId,i.inputId,i.input))},"taskInputUpdate"),turnInterrupt:s(async n=>{let i=ae.parse(n);return t("turn/interrupt",i.threadId,async()=>({turn:await e.interruptTurn(i.threadId,i.reason)}))},"turnInterrupt"),approvalResolve:s(async n=>{let i=se.parse(n);return t("approval/resolve",null,async()=>({approval:await e.resolveApproval(i.approvalId,i.input)}))},"approvalResolve"),userInputResolve:s(async n=>{let i=x.parse(n);return t("userInput/resolve",i.threadId,async()=>(e.isTurnActive(i.threadId)&&await e.waitForTurnSettlement(i.threadId),{turn:await e.startTurn(i.threadId,i.input)}))},"userInputResolve"),profileWorkflows:s(()=>t("profile/workflows",null,()=>e.listProfileWorkflows()),"profileWorkflows"),profileEvaluations:s(()=>t("profile/evaluations",null,()=>e.listProfileEvaluations()),"profileEvaluations"),profileEvaluationExecuteCase:s(n=>t("profile/evaluations/executeCase",null,()=>e.executeProfileEvaluationCase(n)),"profileEvaluationExecuteCase"),profileEvaluationExecuteRun:s(n=>t("profile/evaluations/executeRun",null,()=>e.executeProfileEvaluationRun(n)),"profileEvaluationExecuteRun"),profileEvaluationCompare:s(n=>t("profile/evaluations/compare",null,()=>e.compareProfileEvaluationRuns(n)),"profileEvaluationCompare"),harnessInspect:s(()=>t("harness/inspect",null,()=>e.inspectHarness()),"harnessInspect"),harnessProposalReview:s(n=>t("harness/proposalReview",null,()=>e.reviewHarnessProposal(n)),"harnessProposalReview"),harnessReview:s(n=>t("harness/review",null,()=>e.reviewHarness(n)),"harnessReview"),harnessAcceptEvaluationReview:s(n=>t("harness/acceptEvaluationReview",null,()=>e.acceptHarnessEvaluationReview(n)),"harnessAcceptEvaluationReview"),harnessMaterializeEvaluationTaskset:s(n=>t("harness/materializeEvaluationTaskset",null,()=>e.materializeHarnessEvaluationTaskset(n)),"harnessMaterializeEvaluationTaskset"),harnessRunEvaluationBaseline:s(n=>t("harness/runEvaluationBaseline",null,()=>e.runHarnessEvaluationBaseline(n)),"harnessRunEvaluationBaseline"),harnessValidate:s(()=>t("harness/validate",null,()=>e.validateHarness()),"harnessValidate"),harnessBackgroundReview:s(n=>t("harness/backgroundReview",null,()=>e.updateHarnessBackgroundReview(n)),"harnessBackgroundReview"),harnessDiff:s(n=>t("harness/diff",null,()=>e.diffHarness(n)),"harnessDiff"),harnessRollback:s(n=>t("harness/rollback",null,()=>e.rollbackHarness(n)),"harnessRollback"),refinerInspect:s(()=>t("refiner/inspect",null,()=>e.inspectRefiner()),"refinerInspect"),refinerUpdate:s(n=>t("refiner/update",null,()=>e.updateRefiner(n)),"refinerUpdate"),refinerActivate:s(n=>t("refiner/activate",null,()=>e.activateRefiner(n)),"refinerActivate"),refinerRollback:s(n=>t("refiner/rollback",null,()=>e.rollbackRefiner(n)),"refinerRollback"),subscribe:e.subscribeEvents&&e.eventNotification?n=>e.subscribeEvents(i=>n(e.eventNotification(i))):void 0}}s(L,"createAgentRuntimeService");var f=a.string().regex(/^[a-f0-9]{64}$/),et=a.object({harnessReleaseHash:f,instructionsHash:f,skillHashes:a.record(a.string(),f),agentAssetHashes:a.record(a.string(),f),toolCatalogHash:f,memoryRevision:a.number().int().nonnegative().nullable()}).strict(),ie=a.object({protocolVersion:a.string().trim().min(1),threadId:a.string().trim().min(1),turnId:a.string().trim().min(1),harnessReleaseHash:f,toolCatalogHash:f,context:a.record(a.string(),a.unknown()),pendingInteraction:a.record(a.string(),a.unknown()).nullable(),usage:a.record(a.string(),a.unknown())}).strict();function tt(e){return g(ie.parse(e))}s(tt,"checkpointHash");function nt(e){return[e.system,...e.harnessInstructions,...e.skillInstructions,...e.hostInstructions??[]].map(t=>t.trim()).filter(Boolean).join(`
|
|
4
|
-
|
|
5
|
-
`)}s(nt,"materializeAgentPrompt");function it(e){let t=new Set,r=[...e].map(o=>{let l=o.name.trim();if(!l)throw new Error("Agent tool names cannot be empty.");if(t.has(l))throw new Error(`Duplicate agent tool: ${l}.`);if(t.add(l),!o.unavailableReason&&!o.executorAvailable)throw new Error(`Agent tool ${l} is declared as available without an executor.`);return{...o,name:l}}).sort((o,l)=>o.name.localeCompare(l.name)),n=r.filter(o=>!o.unavailableReason).map(o=>({name:o.name,description:o.description,inputSchema:o.inputSchema})),i=r.map(o=>({name:o.name,displayLabel:o.displayLabel??o.name,placement:o.placement,available:!o.unavailableReason,unavailableReason:o.unavailableReason??null}));return{byName:new Map(r.map(o=>[o.name,o])),tools:r,modelTools:n,capabilities:i,hash:g({modelTools:n,capabilities:i})}}s(it,"createAgentToolCatalogProjection");async function ot(e,t){let r=e.byName.get(t.name);if(!r)throw new Error(`Unknown agent tool: ${t.name}.`);if(r.unavailableReason)throw new Error(`Agent tool ${t.name} is unavailable: ${r.unavailableReason}`);if(!r.execute)throw new Error(`Agent tool ${t.name} has no executor.`);let n=r.validateArguments?r.validateArguments(t.arguments):t.arguments;return r.execute(n,t.context)}s(ot,"executeProjectedAgentTool");var F=class{static{s(this,"TaskSignals")}#e=new Map;notify(t){for(let r of[...this.#e.get(t)??[]])r()}subscribe(t,r){let n=this.#e.get(t);return n||this.#e.set(t,n=new Set),n.add(r),()=>{n.delete(r),n.size===0&&this.#e.delete(t)}}async wait(t){let r=s(()=>{},"wake"),n=0,i=s(()=>{n+=1,r()},"changed"),o=[...new Set(t.taskIds)].map(u=>this.subscribe(u,i)),l=setTimeout(i,Math.max(0,t.deadline-Date.now()));t.signal.addEventListener("abort",i);try{for(;;){t.signal.throwIfAborted();let u=n,h=await t.read();if(h!==null)return h;if(Date.now()>=t.deadline)return null;n===u&&await new Promise(c=>{r=c,(n!==u||t.signal.aborted)&&c()})}}finally{clearTimeout(l),t.signal.removeEventListener("abort",i);for(let u of o)u()}}},J=class{static{s(this,"TaskSerialExecutor")}#e=new Map;async run(t,r){let i=(this.#e.get(t)??Promise.resolve()).then(r),o=i.then(()=>{},()=>{});this.#e.set(t,o);try{return await i}finally{this.#e.get(t)===o&&this.#e.delete(t)}}};function Tt(e){return oe({runtime:L(e.ports),close:e.close})}s(Tt,"createAppServer");function oe(e){let t=!1;return{runtime:e.runtime,close:s(async()=>{t||(t=!0,await e.close?.())},"close")}}s(oe,"attachAppServer");async function St(e){try{await D({host:e.appServer.runtime,readable:e.readable,writable:e.writable})}finally{await e.appServer.close()}}s(St,"runAppServerJsonl");import{randomBytes as le}from"node:crypto";function jt(){return A()}s(jt,"appDataDir");function zt(e){return d(e).config}s(zt,"providersConfigPath");function Ht(e){return d(e).credentials}s(Ht,"providerSecretsConfigPath");function Nt(e){return d(e).key}s(Nt,"providerSecretsKeyPath");async function Ot(e){let t=d(e).token;return z(t,async()=>{let r=(await j(t))?.trim(),n=process.env.OPENPOND_APP_TOKEN||r||le(32).toString("base64url");return n!==r&&await y(t,n),{token:n,tokenFile:t}})}s(Ot,"ensureCapabilityToken");export{pe as a,me as b,fe as c,g as d,ge as e,be as f,xe as g,X as h,He as i,E as j,Ee as k,ie as l,tt as m,nt as n,it as o,ot as p,F as q,J as r,Tt as s,St as t,jt as u,zt as v,Ht as w,Nt as x,Ot as y};
|