openpond 0.2.47 → 0.2.49
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 +61 -0
- package/dist/app-server.js +1 -1
- package/dist/chunks/{app-server-runtime-3KFJJUJH.js → app-server-runtime-RWO4KGPU.js} +1 -1
- package/dist/chunks/{chunk-LL4QP2IM.js → chunk-2ZJJFBIA.js} +1 -1
- package/dist/chunks/{chunk-CNTGL5IX.js → chunk-42GOV5ZU.js} +3 -3
- package/dist/chunks/{chunk-PGKEDR3S.js → chunk-5CMKGD43.js} +1 -1
- package/dist/chunks/{chunk-K6S4TY5W.js → chunk-7K72KS5C.js} +5 -5
- package/dist/chunks/{chunk-36YNUUZL.js → chunk-7MXZJQS7.js} +1 -1
- package/dist/chunks/chunk-DFM5JTS2.js +2 -0
- package/dist/chunks/chunk-EPY7M5XS.js +2 -0
- package/dist/chunks/{chunk-D7DA5G2U.js → chunk-HEPLG5FY.js} +2 -2
- package/dist/chunks/{chunk-3HBCQNRN.js → chunk-IOQUF34U.js} +1 -1
- package/dist/chunks/chunk-JCCU3VFK.js +2 -0
- package/dist/chunks/chunk-NHJ26KXF.js +518 -0
- package/dist/chunks/{chunk-6MH55NGW.js → chunk-O7VGFMDO.js} +1 -1
- package/dist/chunks/chunk-PNE3IETM.js +190 -0
- package/dist/chunks/{chunk-A2GVVXFV.js → chunk-QJRXTIOC.js} +1 -1
- package/dist/chunks/{chunk-YBVIFIXN.js → chunk-TIUSKRBP.js} +4 -4
- package/dist/chunks/chunk-VOIH2BQA.js +2162 -0
- package/dist/chunks/{cli-WPAYXAJX.js → cli-ZLDLOKPL.js} +1 -1
- package/dist/chunks/{dist-VDVI7KIO.js → dist-BLBZENVB.js} +1 -1
- package/dist/chunks/{hosted-experiment-improvement-T6Q7ASMI.js → hosted-experiment-improvement-MGMZWTZY.js} +1 -1
- package/dist/chunks/{hosted-harness-runtime-2R5QRZCG.js → hosted-harness-runtime-FZZLWLBR.js} +1 -1
- package/dist/chunks/{hosted-profile-candidate-TKOY3M4S.js → hosted-profile-candidate-LVNKOTKJ.js} +1 -1
- package/dist/chunks/{hosted-profile-compiler-VLBFIEWK.js → hosted-profile-compiler-SI3EWWUM.js} +1 -1
- package/dist/chunks/{hosted-profile-evaluation-inspection-3MB6MWO6.js → hosted-profile-evaluation-inspection-FPCV42DD.js} +1 -1
- package/dist/chunks/hosted-profile-evaluation-preparation-QHARNR4M.js +3 -0
- package/dist/chunks/{src-R4TSYNTK.js → src-GKWEQK2T.js} +115 -115
- package/dist/chunks/{workspaces-WTPFRJMS.js → workspaces-XIQNPAP7.js} +1 -1
- package/dist/cli.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/chunk-4UTBLHFC.js +0 -2
- package/dist/chunks/chunk-526PVA3V.js +0 -2678
- package/dist/chunks/chunk-BM7TU6NX.js +0 -190
- package/dist/chunks/chunk-F7RCOLZD.js +0 -2
- package/dist/chunks/chunk-TT46OISU.js +0 -2
- package/dist/chunks/chunk-XON44M6V.js +0 -2
- package/dist/chunks/hosted-profile-evaluation-preparation-C7WEABZ5.js +0 -3
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{g as J}from"./chunk-A2GVVXFV.js";import{U,ba as G,ca as F,ga as N}from"./chunk-36YNUUZL.js";import{L as O,da as H}from"./chunk-XDMUD4FW.js";import{Ca as R,Ta as $,pc as L}from"./chunk-QRWPEW3Z.js";import{s as _,t as q,u as E}from"./chunk-WV2APYWG.js";import{na as V,oa as P,qa as z,wa as W}from"./chunk-PJM2G7SG.js";import{Fa as j}from"./chunk-SDEDAHV6.js";import{b as g,c as h,d as b,l as M,m as s,o as B,r as A}from"./chunk-NNF6KCHD.js";import{b as c}from"./chunk-ES2ISFJC.js";import{a as u}from"./chunk-FTQLQJQV.js";import{promises as Y}from"node:fs";import Z from"node:path";async function ue(e){let i=e.definition.tasksetRelease,r=await J(e.store,e.harnessRelease);if(!r)throw new Error("Evaluation Profile Harness release is unavailable.");let t=await te({...e,runtime:r});if(t)return t;let a=await e.store.listTasksetRevisions(e.profileId);for(let o of a){if(i.id!==o.id&&i.id!==`taskset-release-${o.id}-r${o.revision}`)continue;let l=await ee(e.storeDir,o);if(l.taskset.id===i.id&&l.taskset.contentHash===i.contentHash)return l}throw new Error(`Released Taskset ${i.id} is unavailable in Profile ${e.profileId}.`)}u(ue,"loadLocalProfileEvaluationTaskset");async function ee(e,i){let r=i.metadata.importedPackageHash;if(typeof r=="string"){let o=await F(e,r);if(o.taskset.id!==i.id||o.taskset.revision!==i.revision)throw new Error("Imported evaluation Taskset differs from its local Profile revision.");return o}if($(i)!==i.contentHash)throw new Error("Authored evaluation Taskset differs from its immutable revision.");let t=L({taskset:i,adapterId:U(i)}),a=await N({storeDir:e,taskset:i,content:{schemaVersion:"openpond.tasksetPackage.v1",taskset:t.tasksetRelease,environment:t.environmentRelease,verifierSet:t.verifierSetRelease}});return await G(e,a),a}u(ee,"loadCandidate");async function te(e){let i=e.definition.tasksetRelease,r=e.runtime;if(r.release.harnessRelease.id!==e.harnessRelease.id||r.release.harnessRelease.contentHash!==e.harnessRelease.contentHash)throw new Error("Evaluation Taskset runtime differs from its requested release.");let t=`evals/tasksets/${i.contentHash}.json`,a=r.release.harnessRelease.files.find(o=>o.path===t);if(a){if(a.visibility!=="verifier")throw new Error("Evaluation Taskset package is not verifier-private.");let o=await Y.readFile(Z.join(r.release.bundlePath,"source",...t.split("/")));if(M(o)!==a.contentHash)throw new Error("Released evaluation Taskset package bytes differ from their source receipt.");let l=R(JSON.parse(o.toString("utf8")));if(l.taskset.id!==i.id||l.taskset.contentHash!==i.contentHash)throw new Error("Released evaluation Taskset package differs from its definition.");return l}return null}u(te,"loadReleasedProfileEvaluationTaskset");function y(e){return{id:z(e),label:"Selected Dataset evaluation",description:"Explicit sealed external Dataset evaluation recipe.",target:e.target,tasksetRelease:{id:e.dataset.id,contentHash:e.dataset.contentHash},split:e.split,taskIds:[...new Set(e.population.map(i=>i.taskId))],seeds:[...new Set(e.population.map(i=>i.seed))],criterion:e.criterion}}u(y,"externalProfileEvaluationDefinition");async function we(e){let i=e.manifest.profileEvaluation,r=i?.externalDatasetBinding?P(i.externalDatasetBinding):null;if(!r)return null;if(!e.resolveExternalDataset)throw new Error("This owner has no authorized external Dataset resolver.");let t=await e.resolveExternalDataset(r,e.selected);await t.authorize();let a=R(t.packageValue),o=await e.loadCatalog({ref:e.selected.profileRef,sourceRevision:e.selected.sourceRevision,harnessRelease:e.selected.harnessRelease});if(s(t.binding)!==s(r)||r.profileId!==e.selected.profileRef.profileId||r.declaredProfileCatalogHash!==o.catalogHash||a.contentHash!==r.packageHash||s(a.taskset)!==s(e.taskset)||r.environmentHash!==s(a.taskset.environment)||r.privateDatasetClosureHash!==s(a.files.filter(d=>d.asset.visibility!=="policy").map(d=>d.asset)))throw new Error("External Dataset admission changed its actual Profile, package or private closure.");let l=y(r),m={schemaVersion:"openpond.profileEvaluations.v1",definitions:[l],suites:[]};if(E(e.manifest,e.taskset,m),!i||i.catalogHash!==s(m)||i.definitionHash!==s(l)||s(i.target)!==s(r.target))throw new Error("External Dataset manifest changed its derived definition.");return await t.authorize(),{...t,packageValue:a,definition:l,catalog:m}}u(we,"admitProfileExternalDataset");var ae=c.object({id:g,createdAt:b,definitionId:g,externalDatasetBinding:V.optional(),profileRef:O.optional(),profileSource:c.object({sourceRevision:c.string().min(1).max(500),harnessRelease:c.object({id:g,contentHash:h}).strict()}).strict().optional(),modelRef:A,hostModelConfigurationHash:h.optional(),hostArtifactHash:h.optional(),maximumSpendUsd:c.number().positive().max(1e4).optional(),expectedManifestHash:h.optional(),hostExperiment:c.object({definition:c.object({id:g,revision:c.number().int().positive(),contentHash:h}).strict().nullable(),configurationHash:h,project:c.object({id:g,revision:c.number().int().positive(),contentHash:h,targetId:g.nullable()}).strict().optional()}).strict().optional()}).strict();function Se(e){return async(i,r)=>{let t=ae.parse(i);if(r?.requireExpectedManifestHash&&!t.expectedManifestHash)throw new Error("Profile evaluation execution requires the reviewed manifest hash.");if(t.profileSource&&!t.profileRef)throw new Error("An exact Profile source requires its accepted Profile reference.");let a=r?.selectedWorkflows??await e.selectedWorkflows(t.profileRef,t.profileSource);if(t.profileRef&&s(t.profileRef)!==s(a.profileRef))throw new Error("Profile preparation did not resolve the explicitly selected Profile.");if(t.profileSource&&(a.sourceRevision!==t.profileSource.sourceRevision||s(a.harnessRelease)!==s(t.profileSource.harnessRelease)))throw new Error("Profile preparation changed its explicitly pinned source.");let o=t.externalDatasetBinding?P(t.externalDatasetBinding):null,l=o?await(e.resolveExternalDataset?e.resolveExternalDataset(o,a):Promise.reject(new Error("This host has not qualified external Dataset Profile execution."))):null;if(l&&(await l.authorize(),s(P(l.binding))!==s(o)))throw new Error("External Dataset admission differs from the actual authorized recipe.");let m=await e.loadCatalog({ref:a.profileRef,sourceRevision:a.sourceRevision,harnessRelease:a.harnessRelease});if(o&&o.declaredProfileCatalogHash!==m.catalogHash)throw new Error("The original Profile verifier catalog changed.");let d=o?y(o):null;if(d&&t.definitionId!==d.id)throw new Error("Use the external recipe's own definition identity.");let T={schemaVersion:"openpond.profileEvaluations.v1",definitions:d?[d]:m.definitions,suites:d?[]:m.suites},p=d??m.definitions.find(n=>n.id===t.definitionId);if(!p)throw new Error(`Evaluation ${t.definitionId} is absent from the selected Profile release.`);let v=p.target,D=v.kind==="workflow"?a.workflows.find(n=>n.binding.workflowId===v.workflowId)?.binding:j.parse({schemaVersion:"openpond.profileComponentBinding.v1",profileId:a.profileRef.profileId,sourceRevision:a.sourceRevision,harnessRelease:a.harnessRelease,target:v});if(!D)throw new Error(`Evaluation workflow ${v.kind==="workflow"?v.workflowId:""} is absent from the selected Profile release.`);let k=R(l?.packageValue??await e.loadTasksetPackage(p,a.profileRef.profileId,a.harnessRelease)),f=k.taskset;if(f.id!==p.tasksetRelease.id||f.contentHash!==p.tasksetRelease.contentHash)throw new Error("Evaluation Taskset package differs from its released definition.");let S=f.environment.kind==="text"&&f.tools.length===0,K=f.environment.kind==="work"&&f.environment.entrypoint==="openpond-work-v1"&&f.tools.every(n=>["work_exec","work_save_output"].includes(n.name));if(!S&&!K)throw new Error("Profile evaluation supports text cases or Work cases with the built-in execution and output tools.");if(t.maximumSpendUsd!==void 0&&!S)throw new Error("Bounded hosted Profile evaluation currently qualifies text cases without external compute.");if(f.tasks.some(n=>n.artifactRefs.length>H.maxAttachments||n.artifactRefs.some(w=>w.visibility!=="policy"||w.mediaType!=="application/pdf"||w.sizeBytes>H.maxAttachmentBytes)))throw new Error("Profile evaluation accepts only bounded policy-visible PDF task attachments.");if(!o&&!e.privateGradingPreflight&&(f.graders.some(n=>n.kind==="model_judge"||n.kind==="custom_verifier")||f.metrics?.aggregation==="custom"))throw new Error("Profile evaluation cannot run this Taskset's model judge, custom verifier, or custom metric in the current app-server runtime.");await e.privateGradingPreflight?.(k);let I={adapterId:v.kind==="workflow"?"openpond.profile-workflow":"openpond.profile-component",placement:e.placement,runtimeVersion:"app-server-v1",capabilityReceipt:s({adapterId:v.kind==="workflow"?"openpond.profile-workflow":"openpond.profile-component",packageHash:k.contentHash,connectedAppScopes:f.policy.connectedAppScopes})},Q={...W({catalog:T,definitionId:p.id,profileId:a.profileRef.profileId,sourceRevision:a.sourceRevision,harnessRelease:a.harnessRelease,environmentHash:s({packageHash:k.contentHash,runtimeTarget:I})}),...o?{externalDatasetBinding:o}:{},...e.sourceCandidate?{sourceCandidate:e.sourceCandidate}:{}};if(o&&(o.packageHash!==k.contentHash||o.environmentHash!==s(f.environment)||o.privateDatasetClosureHash!==s(k.files.filter(n=>n.asset.visibility!=="policy").map(n=>n.asset))))throw new Error("External Dataset package/environment/private closure changed.");let X=B.parse({provider:t.modelRef.providerId,model:t.modelRef.modelId,revision:null,artifactHash:t.hostArtifactHash??null,tokenizerRevision:null,chatTemplateHash:null}),C=await e.modelConfigurationHash(t.modelRef,t),x=_({schemaVersion:"openpond.tasksetRunManifest.v1",id:t.id,tasksetRelease:p.tasksetRelease,packageHash:k.contentHash,execution:{kind:"harness",harnessRelease:a.harnessRelease},profileEvaluation:Q,policy:{kind:"model",model:X,configurationHash:C},gradingRole:"evaluation",metricPolicy:q(f),population:o?o.population.map(n=>({...n,receiptId:`evaluation-${s([t.id,n.taskId,n.seed,n.fixtureId]).slice(0,32)}`})):p.taskIds.flatMap(n=>p.seeds.map(w=>({receiptId:`evaluation-${s([t.id,n,w]).slice(0,32)}`,taskId:n,seed:w,fixtureId:null}))),runtimeTarget:I,limits:{maxTurns:128,timeoutMs:f.environment.defaultTimeoutMs,maxOutputBytes:25e7,maximumSpendUsd:t.maximumSpendUsd??null},createdAt:t.createdAt,metadata:{sourceTasksetId:f.metadata.sourceTasksetId??f.id,...a.profileRef.source==="openpond_git"?{profileRepositoryId:a.profileRef.repositoryId}:{},...t.hostExperiment?{experimentDefinition:t.hostExperiment.definition,experimentConfigurationHash:t.hostExperiment.configurationHash,...t.hostExperiment.project?{project:t.hostExperiment.project}:{}}:{}}});if(E(x,f,T),l&&await l.authorize(),t.expectedManifestHash&&x.contentHash!==t.expectedManifestHash)throw new Error("Profile evaluation setup changed since preview; prepare the run again.");return{manifest:x,taskset:f,profileRef:a.profileRef,binding:D,modelRef:t.modelRef,modelConfigurationHash:C}}}u(Se,"createProfileEvaluationRunPreparationService");export{ue as a,te as b,we as c,Se as d};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{b as H}from"./chunk-6MH55NGW.js";import{F as g,K as B,L}from"./chunk-K6S4TY5W.js";import{a as N}from"./chunk-T5LE6R5S.js";import{qa as _}from"./chunk-36YNUUZL.js";import{O as x,R as V,S as F,Y as R}from"./chunk-XDMUD4FW.js";import{ta as I}from"./chunk-IKWDL3RB.js";import{Ca as b}from"./chunk-QRWPEW3Z.js";import{ma as E,na as C,oa as y}from"./chunk-PJM2G7SG.js";import{Ga as A}from"./chunk-SDEDAHV6.js";import{c as D,e as v,f as U,g as M,i as O,qa as T}from"./chunk-DALJMSJG.js";import{m as p}from"./chunk-NNF6KCHD.js";import{b as o}from"./chunk-ES2ISFJC.js";import{a as w,c as P,f as j,h as c}from"./chunk-H7IWJN7L.js";import{a as i}from"./chunk-FTQLQJQV.js";import h from"node:path";import{AsyncLocalStorage as ee}from"node:async_hooks";import{promises as z}from"node:fs";var J=new ee;function fe(r,e=!1){let t=J.getStore();t&&(e&&(t.length=0),t.push(r))}i(fe,"onStartupFailure");async function ge(r,e){await T(r);let t;try{t=await M(h.join(c(r).runtime,"server-owner"),100)}catch(n){if(n instanceof P&&n.issue.code==="STORAGE_BUSY"){let a=await O(h.join(c(r).runtime,"endpoint.json"),()=>null);throw new P({code:"RUNTIME_ALREADY_RUNNING",path:r,message:"An OpenPond runtime already owns this home.",action:a?.url?`Connect to the existing runtime at ${a.url}, or stop it before starting another.`:"Stop the existing runtime before starting another with this home."})}throw n}let s=[];try{let n=await w(r,()=>J.run(s,e)),a=n.close.bind(n);s.length=0;let d;return{...n,close:i(()=>d??=(async()=>{try{await w(r,a)}finally{await z.rm(h.join(c(r).runtime,"endpoint.json"),{force:!0}),await t()}})(),"close")}}catch(n){try{for(let a of s.reverse())await Promise.resolve().then(()=>w(r,a)).catch(()=>{});await z.rm(h.join(c(r).runtime,"endpoint.json"),{force:!0})}finally{await t()}throw n}}i(ge,"ownHomeRuntime");async function he(r,e,t){await v(h.join(c(r).runtime,"endpoint.json"),JSON.stringify({schemaVersion:"openpond.runtimeEndpoint.v1",pid:process.pid,url:e,serverId:t}))}i(he,"publishRuntimeEndpoint");function ye(r){return te({runtime:L(r.ports),close:r.close})}i(ye,"createAppServer");function te(r){let e=!1;return{runtime:r.runtime,close:i(async()=>{e||(e=!0,await r.close?.())},"close")}}i(te,"attachAppServer");async function Pe(r){let e=typeof r.appServer=="function"?null:r.appServer;try{await B({host:e?.runtime??(async()=>(e=await r.appServer(),e.runtime)),readable:r.readable,writable:r.writable,hostStorageClient:r.hostStorageClient})}finally{await e?.close()}}i(Pe,"runAppServerJsonl");import S from"node:path";import{lstat as re,readFile as oe,realpath as $}from"node:fs/promises";import{randomUUID as se}from"node:crypto";var ne=o.object({id:o.string(),version:o.string(),contentHash:o.string().regex(/^[a-f0-9]{64}$/),feedbackKey:o.string(),release:o.object({id:o.string(),revision:o.union([o.string(),o.number()]),contentHash:o.string().regex(/^[a-f0-9]{64}$/)}).strict().nullable()}).strict(),G=o.object({binding:C,packageValue:o.unknown(),graders:o.array(ne).max(100),actualGrading:o.object({pass:o.unknown(),evidence:o.unknown()}).strict().optional(),sourceCandidate:E.optional()}).strict();async function Me(r,e){let t=await $(e),s=S.resolve(r);if(S.dirname(s)!==t||await $(s)!==s)throw new Error("External Dataset package escaped its private owner home.");let n=await re(s);if(!n.isFile()||n.isSymbolicLink()||n.size>32*1024*1024)throw new Error("External Dataset package is not a bounded regular file.");let a=G.parse(JSON.parse(new TextDecoder("utf8",{fatal:!0}).decode(await oe(s))));return a.binding=y(a.binding),a.packageValue=I({...a,packageValue:b(a.packageValue)}),a}i(Me,"readHostProfileExternalDataset");async function Oe(r){let e=G.parse(r.value),t=y(e.binding),s=r.release,n={id:s.harnessRelease.id,contentHash:s.harnessRelease.contentHash};if(t.protectedProfileClosureHash!==p(s.harnessRelease.files.filter(l=>l.visibility!=="policy").map(l=>({path:l.path,asset:l}))))throw new Error("The external Dataset protected Profile closure changed.");if(e.sourceCandidate){let l=await _({workspaceId:typeof s.agentSnapshot.metadata.workspaceId=="string"?s.agentSnapshot.metadata.workspaceId:s.workspaceId,sourceDir:S.join(s.bundlePath,"source")});if(p(e.sourceCandidate.harnessRelease)!==p(n)||N(l).protectedClosureHash!==e.sourceCandidate.protectedClosureHash)throw new Error("The external Dataset candidate differs from its retained frozen compiled source.")}let a=i(async l=>{if(o.object({authorized:o.literal(!0),bindingHash:o.string().regex(/^[a-f0-9]{64}$/)}).strict().parse(await r.client.request({contractVersion:1,requestId:se(),operation:"profile.externalDataset.authorize",params:{...l,bindingHash:t.contentHash}})).bindingHash!==t.contentHash)throw new Error("The host authorized another external Dataset binding.")},"authorize");return{authorize:a,resolveExternalDataset:i(async(l,m)=>{if(await a(),p(l)!==p(t)||m.profileRef.profileId!==t.profileId||m.sourceRevision!==r.sourceRevision||p(m.harnessRelease)!==p(n))throw new Error("External Dataset requested another actual Profile source or recipe.");let f=I({...e,binding:l,packageValue:b(e.packageValue)});return{binding:t,packageValue:f,authorize:a}},"resolveExternalDataset"),sourceCandidate:e.sourceCandidate}}i(Oe,"createHostProfileExternalDataset");import{randomBytes as ae}from"node:crypto";function Ne(){return j()}i(Ne,"appDataDir");function Be(r){return c(r).config}i(Be,"providersConfigPath");function Le(r){return c(r).credentials}i(Le,"providerSecretsConfigPath");function ze(r){return c(r).key}i(ze,"providerSecretsKeyPath");async function Je(r){let e=c(r).token;return U(e,async()=>{let t=(await D(e))?.trim(),s=process.env.OPENPOND_APP_TOKEN||t||ae(32).toString("base64url");return s!==t&&await v(e,s),{token:s,tokenFile:e}})}i(Je,"ensureCapabilityToken");import u from"node:path";import{readFile as W}from"node:fs/promises";var q=o.object({profileId:o.string().min(1),sourceRevision:o.string().min(1),repositoryId:o.string().min(1),harnessRelease:o.object({id:o.string().min(1),contentHash:o.string().regex(/^[a-f0-9]{64}$/)}).strict(),hostExecution:o.object({conversationId:o.string().min(1),turnId:o.string().min(1)}).strict().optional(),workspaceId:o.string().min(1),assetsPath:o.string().min(1).refine(u.isAbsolute)}).strict();async function Ze(r,e){let t=q.parse(e),s=await H(r,t.harnessRelease);if(!s||u.resolve(s.release.bundlePath)!==u.resolve(t.assetsPath))throw new Error("Hosted Profile release changed after admission.");let n=s.release.harnessRelease.metadata.profile;if(!n||typeof n!="object"||n.id!==t.profileId||n.sourceRevision!==t.sourceRevision||n.repositoryId!==void 0&&n.repositoryId!==t.repositoryId)throw new Error("Hosted Profile provenance differs from admitted release.");return{profile:F(),profileLibrary:V()}}i(Ze,"loadHostedProfileStateAndLibrary");async function et(r,e){let t=q.parse(e),s=await H(r,t.harnessRelease);if(!s||u.resolve(s.release.bundlePath)!==u.resolve(t.assetsPath))throw new Error("Hosted Profile workflow release is unavailable.");let n=s.release.harnessRelease.metadata.profile;if(n?.id!==t.profileId||n.sourceRevision!==t.sourceRevision||n.repositoryId!==void 0&&n.repositoryId!==t.repositoryId)throw new Error("Hosted Profile workflow provenance changed.");let a=t.harnessRelease,d={source:"openpond_git",repositoryId:t.repositoryId,profileId:t.profileId};if(!s.release.harnessRelease.files.some(f=>f.path==="workflows/catalog.json"))return{profileRef:d,sourceRevision:t.sourceRevision,harnessRelease:a,workflows:[]};let l=u.join(s.release.bundlePath,"source","workflows"),m=A({agentSnapshot:s.release.agentSnapshot,harnessRelease:s.release.harnessRelease,catalogBytes:await W(u.join(l,"catalog.json")),actionBytes:await W(u.join(l,"actions.json"))});return{profileRef:d,sourceRevision:t.sourceRevision,harnessRelease:a,workflows:m.catalog.workflows.map(f=>({workflow:f,binding:{schemaVersion:"openpond.profileWorkflowBinding.v1",profileId:t.profileId,sourceRevision:t.sourceRevision,harnessRelease:a,catalogHash:m.catalogHash,workflowId:f.id}}))}}i(et,"listHostedProfileWorkflows");import{createHash as ie,randomUUID as k}from"node:crypto";var K=o.object({approval:x,revision:o.number().int().positive()}).strict(),Q=o.object({record:R}).strict(),le=o.object({startedAt:o.string().min(1),requestOrdinal:o.number().int().nonnegative(),id:o.string().min(1)}).strict(),ce=o.object({records:o.array(R).max(200),nextBefore:le.nullable()}).strict(),Y=1e4,X=class{constructor(e){this.client=e}client;static{i(this,"HostedApprovalStorage")}async readApproval(e){let t=await this.client.request({contractVersion:g,requestId:k(),operation:"approval/get",params:{approvalId:e}});return t===null?null:K.parse(t)}async getApproval(e){return(await this.readApproval(e))?.approval??null}async putApproval(e){let t=x.parse(e.approval);if(!e.requestId.trim())throw new Error("Approval mutation requires a stable request ID.");return K.parse(await this.client.request({contractVersion:g,requestId:e.requestId,operation:"approval/upsert",params:{approval:t,expectedRevision:e.expectedRevision}}))}},Z=class{constructor(e){this.client=e}client;static{i(this,"HostedModelUsageStorage")}async upsertModelUsageRecord(e){let t=R.parse(e),s=ie("sha256").update(JSON.stringify(t)).digest("hex"),n=await this.client.request({contractVersion:g,requestId:`usage:${s}`,operation:"usage/upsert",params:{record:t}}),a=Q.parse(n).record;if(a.requestId!==t.requestId)throw new Error("Host usage upsert changed request identity.");return a}async getModelUsageRecordByRequestId(e){let t=await this.client.request({contractVersion:g,requestId:k(),operation:"usage/getByRequestId",params:{requestId:e}});return t===null?null:Q.parse(t).record}async listModelUsageRecords(e={}){let t=e.limit===void 0||e.limit>=Y,s=e.limit===void 0?Y:Math.max(1,Math.min(1e4,Math.trunc(e.limit))),n={...e.sessionId?{sessionId:e.sessionId}:{},...e.turnId?{turnId:e.turnId}:{},...e.provider?{provider:e.provider}:{},...e.model?{model:e.model}:{},...e.startedAtFrom?{startedAtFrom:e.startedAtFrom}:{},...e.startedAtTo?{startedAtTo:e.startedAtTo}:{},...e.visibility&&e.visibility!=="all"?{visibility:e.visibility}:{},...e.status&&e.status!=="all"?{status:e.status}:{}},a=[],d=null;for(;a.length<s+(t?1:0);){let l=ce.parse(await this.client.request({contractVersion:g,requestId:k(),operation:"usage/page",params:{query:n,before:d,limit:Math.min(200,s+(t?1:0)-a.length)}}));if(a.push(...l.records),a.length>s)throw new Error(`Hosted usage query exceeds ${s} rows; narrow its filters or use a streamed aggregation.`);if(l.nextBefore===null)break;if(l.records.length===0||JSON.stringify(l.nextBefore)===JSON.stringify(d))throw new Error("Host usage cursor did not advance.");d=l.nextBefore}return a}async listModelUsageRecordsComplete(e={}){return this.listModelUsageRecords(e)}};export{fe as a,ge as b,he as c,ye as d,Pe as e,Me as f,Oe as g,Ne as h,Be as i,Le as j,ze as k,Je as l,q as m,Ze as n,et as o,X as p,Z as q};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{g as c}from"./chunk-A2GVVXFV.js";import{xa as f}from"./chunk-PJM2G7SG.js";import{a as n}from"./chunk-FTQLQJQV.js";import{promises as v}from"node:fs";import u from"node:path";async function j(e){let s=await c(e.store,e.harnessRelease);if(!s)throw new Error("Profile evaluation Harness release is unavailable.");return w({...e,runtime:s})}n(j,"profileEvaluationsForRelease");async function w(e){let s=e.runtime,o=s.release.harnessRelease;if(o.id!==e.harnessRelease.id||o.contentHash!==e.harnessRelease.contentHash)throw new Error("Profile evaluation runtime differs from its requested release.");let r=o.metadata.profile;if(!r||typeof r!="object"||r.id!==e.ref.profileId||r.sourceRevision!==e.sourceRevision)throw new Error("Profile evaluation release differs from its accepted source.");let i={profileRef:e.ref,sourceRevision:e.sourceRevision,harnessRelease:e.harnessRelease};if(!o.files.some(a=>a.path==="evals/catalog.json"))return{...i,catalogHash:null,definitions:[],suites:[]};let d=u.join(s.release.bundlePath,"source"),t=n(async a=>o.files.some(g=>g.path===a)?v.readFile(u.join(d,...a.split("/"))):void 0,"read"),[R,p,m]=await Promise.all([t("evals/catalog.json"),t("workflows/catalog.json"),t("workflows/actions.json")]),{catalog:l,catalogHash:h}=f({agentSnapshot:s.release.agentSnapshot,harnessRelease:o,catalogBytes:R,workflowBytes:p,actionBytes:m});return{...i,catalogHash:h,definitions:l.definitions,suites:l.suites}}n(w,"profileEvaluationsForRuntime");export{j as a,w as b};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{a as D}from"./chunk-D7DA5G2U.js";import{b as x,d as j}from"./chunk-F7RCOLZD.js";import{b}from"./chunk-XON44M6V.js";import{a as E}from"./chunk-T5LE6R5S.js";import"./chunk-A2GVVXFV.js";import{ha as I,qa as C}from"./chunk-36YNUUZL.js";import"./chunk-7YR6CBNU.js";import"./chunk-PGKEDR3S.js";import"./chunk-HA7EFTPF.js";import"./chunk-L3KS6MOV.js";import"./chunk-7QEE4PBI.js";import"./chunk-XDMUD4FW.js";import{ta as m}from"./chunk-IKWDL3RB.js";import"./chunk-6MI4KKWF.js";import{Ca as S}from"./chunk-QRWPEW3Z.js";import"./chunk-6FA3GG5B.js";import"./chunk-Z3D4C7BG.js";import"./chunk-WV2APYWG.js";import{ma as H}from"./chunk-PJM2G7SG.js";import{Ga as y,j as P,m as R}from"./chunk-SDEDAHV6.js";import"./chunk-DALJMSJG.js";import"./chunk-TGIB24K4.js";import{m as d}from"./chunk-NNF6KCHD.js";import{b as e}from"./chunk-ES2ISFJC.js";import"./chunk-H7IWJN7L.js";import{a as s}from"./chunk-FTQLQJQV.js";import{readFile as h,realpath as V,lstat as T}from"node:fs/promises";import c from"node:path";var A=e.object({compile:e.object({repoPath:e.string(),profileId:e.string(),repositoryId:e.string(),sourceRevision:e.string(),workspaceId:e.string(),outputDir:e.string()}).strict(),externalDatasetPackage:e.string().regex(/^external-dataset-[a-f0-9-]+\.json$/).optional(),sourceCandidate:H.optional(),action:e.enum(["catalog","prepare"]),request:e.unknown().optional()}).strict();async function B(t){let a=await D(t.compile);if(t.sourceCandidate){let o=await C({workspaceId:typeof a.agentSnapshot.metadata.workspaceId=="string"?a.agentSnapshot.metadata.workspaceId:a.workspaceId,sourceDir:c.join(a.bundlePath,"source")});if(d(t.sourceCandidate.harnessRelease)!==d({id:a.harnessRelease.id,contentHash:a.harnessRelease.contentHash})||E(o).protectedClosureHash!==t.sourceCandidate.protectedClosureHash)throw new Error("Private candidate source differs from its actual frozen compiled release.")}let g={release:I.parse({schemaVersion:"openpond.localHarnessReleaseRecord.v1",workspaceId:a.workspaceId,sourceRevision:a.sourceRevision,agentSnapshot:P.parse(a.agentSnapshot),harnessRelease:R.parse(a.harnessRelease),bundlePath:a.bundlePath,createdAt:new Date().toISOString()})},p={source:"openpond_git",profileId:t.compile.profileId,repositoryId:t.compile.repositoryId},f=t.compile.sourceRevision,l={id:a.harnessRelease.id,contentHash:a.harnessRelease.contentHash},w=s(async o=>b({...o,runtime:g}),"loadCatalog"),z=await w({ref:p,sourceRevision:f,harnessRelease:l}),k=c.join(a.bundlePath,"source"),v=a.harnessRelease.files.some(o=>o.path==="workflows/catalog.json")?await(async()=>{let o=y({agentSnapshot:a.agentSnapshot,harnessRelease:a.harnessRelease,catalogBytes:await h(c.join(k,"workflows/catalog.json")),actionBytes:await h(c.join(k,"workflows/actions.json"))});return o.catalog.workflows.map(r=>({workflow:r,binding:{schemaVersion:"openpond.profileWorkflowBinding.v1",profileId:p.profileId,sourceRevision:f,harnessRelease:l,catalogHash:o.catalogHash,workflowId:r.id}}))})():[],q={profileRef:p,sourceRevision:f,harnessRelease:l,workflows:v};if(t.action==="catalog")return{...z,workflows:v};let u=t.externalDatasetPackage?await(async()=>{let o=await V(t.compile.outputDir),r=c.join(o,t.externalDatasetPackage),i=await T(r);if(!i.isFile()||i.isSymbolicLink()||i.size>32*1024*1024||await V(r)!==r)throw new Error("External Dataset cache is outside its bounded verifier storage.");let n=e.object({packageValue:e.unknown(),graders:e.array(e.object({id:e.string(),version:e.string(),contentHash:e.string(),feedbackKey:e.string(),release:e.object({id:e.string(),revision:e.union([e.string(),e.number()]),contentHash:e.string()}).strict().nullable()}).strict()).max(100)}).strict().parse(JSON.parse(await h(r,"utf8")));return{packageValue:S(n.packageValue),graders:n.graders}})():null;return j({sourceCandidate:t.sourceCandidate,resolveExternalDataset:u?async o=>{let r=m({binding:o,...u}),i=d(a.harnessRelease.files.filter(n=>n.visibility!=="policy").map(n=>({path:n.path,asset:n})));if(o.protectedProfileClosureHash!==i)throw new Error("The selected Profile's protected evaluator closure changed.");return{binding:o,packageValue:r,authorize:s(async()=>{m({binding:o,...u})},"authorize")}}:void 0,loadCatalog:w,selectedWorkflows:s(async()=>q,"selectedWorkflows"),placement:"remote",loadTasksetPackage:s(async o=>{let r=await x({runtime:g,definition:o,harnessRelease:l});if(!r)throw new Error("Hosted evaluation Taskset is absent from its published Profile release.");return r},"loadTasksetPackage"),modelConfigurationHash:s(async(o,r)=>{if(o.providerId!=="openpond"||!r.hostModelConfigurationHash)throw new Error("Hosted evaluation preparation requires a trusted model configuration receipt.");return r.hostModelConfigurationHash},"modelConfigurationHash")})(t.request)}s(B,"prepareHostedProfileEvaluation");async function Y(t){if(t.length!==1||t[0].length>48e3||!/^[A-Za-z0-9_-]+$/.test(t[0]))throw new Error("Hosted Profile evaluation preparation argument is invalid.");let a=A.parse(JSON.parse(Buffer.from(t[0],"base64url").toString("utf8")));process.stdout.write(`${JSON.stringify(await B(a))}
|
|
3
|
-
`)}s(Y,"runHostedProfileEvaluationCli");export{B as prepareHostedProfileEvaluation,Y as runHostedProfileEvaluationCli};
|