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,5 +1,5 @@
|
|
|
1
1
|
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{ka as P,la as V,ma as M,qa as E,ra as q}from"./chunk-36YNUUZL.js";import{b as x}from"./chunk-L3KS6MOV.js";import{kd as T}from"./chunk-XDMUD4FW.js";import{r as _,s as A,t as C,y as W}from"./chunk-SDEDAHV6.js";import{l as D,m as L,n as b}from"./chunk-NNF6KCHD.js";import{a as w}from"./chunk-FTQLQJQV.js";import{randomUUID as I}from"node:crypto";import{promises as p}from"node:fs";import{stripTypeScriptTypes as X}from"node:module";import R from"node:path";async function le(e){let r=_.parse(e.overlay),t=A.parse(e.proposal),o=e.validations.map(v=>C.parse(v));if((t.route==="agent"?t.edits.filter(v=>v.target!=="harness.json"&&v.operation!=="delete"):[]).length>0){let v=t.validationPlan.find(s=>s.kind==="component_activation"&&s.required);if(!v)throw new Error("Desktop Work Agent proposals require component-activation validation before review.");if(o.find(s=>s.validationId===v.id)?.status==="passed")throw new Error("Desktop Work cannot accept a passed Agent activation receipt until an Agent source executor exists.")}if(t.overlay.id!==r.id||t.overlay.revision!==r.revision||t.overlay.contentHash!==r.contentHash)throw new Error("Refiner proposal is not bound to the supplied run overlay.");if(r.status!=="frozen")throw new Error("Only a frozen run overlay can advance a Harness workspace.");let n=await e.store.getHarnessWorkspace(t.expectedWorkspace.workspaceId);if(!n)throw new Error(`Harness workspace ${t.expectedWorkspace.workspaceId} does not exist.`);if(n.location!==e.store.harnessStoragePlacement)throw new Error("Refiner workspace does not match the admitted storage placement.");let c=P(e.storeDir,n.id),d=await E({workspaceId:n.id,sourceDir:c.source});if(d.sourceRevision!==n.sourceRevision)throw new Error(`Harness source is ${d.sourceRevision}; workspace expects ${n.sourceRevision}. Record or revert the source change before refinement.`);let h=R.join(c.root,`.source-candidate-${I()}`);await p.cp(c.source,h,{recursive:!0,force:!1,errorOnExist:!0,verbatimSymlinks:!1});try{await K(h,t);let v=await E({workspaceId:n.id,sourceDir:h}),m=(e.now??(()=>new Date().toISOString()))(),s=await q({storeDir:e.storeDir,workspaceId:n.id,compiled:v,createdAt:m});await e.store.saveHarnessReleaseRecord(s),await e.store.saveHarnessImprovementArtifact(n.id,"run_overlay",r),await e.store.saveHarnessImprovementArtifact(n.id,"proposal",t);for(let i of o)await e.store.saveHarnessImprovementArtifact(n.id,"targeted_validation",i);if(!T({workspace:n,proposal:t}).eligible&&!e.reviewAuthority)return e.store.advanceHarnessWorkspaceAtomically({receiptId:e.receiptId,workspaceId:n.id,proposal:t,validations:o,nextRelease:{id:s.harnessRelease.id,contentHash:s.harnessRelease.contentHash},nextSourceRevision:s.sourceRevision,now:m});let u=R.join(c.root,`.source-backup-${I()}`),l=R.join(c.root,"source-swap.json");await J(l,{schemaVersion:"openpond.localHarnessSourceSwap.v1",workspaceId:n.id,expectedWorkspaceRevision:n.revision,previousSourceRevision:n.sourceRevision,nextSourceRevision:s.sourceRevision,backupSource:u,candidateSource:h,createdAt:m}),await p.rename(c.source,u),await p.rename(h,c.source);try{let i=e.reviewAuthority?await e.store.advanceReviewedHarnessWorkspaceAtomically({receiptId:e.receiptId,workspaceId:n.id,proposal:t,validations:o,nextRelease:{id:s.harnessRelease.id,contentHash:s.harnessRelease.contentHash},nextSourceRevision:s.sourceRevision,reviewer:e.reviewAuthority.reviewer,now:m}):await e.store.advanceHarnessWorkspaceAtomically({receiptId:e.receiptId,workspaceId:n.id,proposal:t,validations:o,nextRelease:{id:s.harnessRelease.id,contentHash:s.harnessRelease.contentHash},nextSourceRevision:s.sourceRevision,now:m});return i.receipt.decision!=="advanced"?await $(c.source,u):await p.rm(u,{recursive:!0,force:!0}),await p.rm(l,{force:!0}),i}catch(i){throw await $(c.source,u).catch(()=>{}),await p.rm(l,{force:!0}).catch(()=>{}),i}}finally{await p.rm(h,{recursive:!0,force:!0}).catch(()=>{})}}w(le,"applyLocalHarnessRefinerProposal");async function de(e){let r=await e.store.getHarnessWorkspace(e.workspaceId);if(!r||r.location!==e.store.harnessStoragePlacement)throw new Error(`Local Harness workspace ${e.workspaceId} does not exist.`);if(r.currentChannel.release?.id!==e.rollbackOf.id||r.currentChannel.release.contentHash!==e.rollbackOf.contentHash)throw new Error("Harness rollback source is no longer the current release.");let t=await e.store.getHarnessReleaseRecord(e.targetRelease.contentHash);if(!t||t.workspaceId!==r.id||t.harnessRelease.id!==e.targetRelease.id)throw new Error("Harness rollback target is unavailable in this workspace.");let o=P(e.storeDir,r.id);if((await E({workspaceId:r.id,sourceDir:o.source})).sourceRevision!==r.sourceRevision)throw new Error("Harness source changed before rollback.");let n=R.join(o.root,`.source-rollback-${I()}`);await p.cp(R.join(t.bundlePath,"source"),n,{recursive:!0,force:!1,errorOnExist:!0,verbatimSymlinks:!1});try{if((await E({workspaceId:r.id,sourceDir:n})).sourceRevision!==t.sourceRevision)throw new Error("Harness rollback bundle does not reproduce its registered source revision.");let d=(e.now??(()=>new Date().toISOString()))(),h=R.join(o.root,`.source-backup-${I()}`),v=R.join(o.root,"source-swap.json");await J(v,{schemaVersion:"openpond.localHarnessSourceSwap.v1",workspaceId:r.id,expectedWorkspaceRevision:r.revision,previousSourceRevision:r.sourceRevision,nextSourceRevision:t.sourceRevision,backupSource:h,candidateSource:n,createdAt:d}),await p.rename(o.source,h),await p.rename(n,o.source);try{let m=await e.store.rollbackHarnessWorkspaceAtomically({receiptId:e.receiptId,workspaceId:r.id,expectedWorkspaceRevision:r.revision,expectedChannelRevision:r.currentChannel.revision,targetRelease:e.targetRelease,targetSourceRevision:t.sourceRevision,rollbackOf:e.rollbackOf,now:d});return m.receipt.decision!=="rolled_back"?await $(o.source,h):await p.rm(h,{recursive:!0,force:!0}),await p.rm(v,{force:!0}),m}catch(m){throw await $(o.source,h).catch(()=>{}),await p.rm(v,{force:!0}).catch(()=>{}),m}}finally{await p.rm(n,{recursive:!0,force:!0}).catch(()=>{})}}w(de,"rollbackLocalHarnessWorkspaceRelease");async function pe(e){let r=A.parse(e.proposal);if(r.expectedWorkspace.workspaceId!==e.workspace.id)throw new Error("Refiner proposal targets a different Harness workspace.");if(r.route==="memory")return Y({proposal:r,now:e.now});let t=P(e.storeDir,e.workspace.id),o=await E({workspaceId:e.workspace.id,sourceDir:t.source});if(o.sourceRevision!==r.expectedWorkspace.sourceRevision)throw new Error("Refiner proposal source revision no longer matches the Local Harness workspace.");let a=R.join(t.root,`.validation-candidate-${I()}`);await p.cp(t.source,a,{recursive:!0,force:!1,errorOnExist:!0,verbatimSymlinks:!1});let n=(e.now??(()=>new Date().toISOString()))();try{await K(a,r);let c=await E({workspaceId:e.workspace.id,sourceDir:a}),d=new Map(c.manifest.files.map(s=>[s.path,s])),h=new Map(r.edits.map(s=>[s.target,s])),v=N(o),m=N(c);return Promise.all(r.validationPlan.map(async s=>{let f="passed",u="The candidate Harness source compiles and preserves its manifest contract.";try{if(s.kind==="observed_recovery"){let l=r.evidence.filter(i=>i.kind==="recovery");if(l.length===0)throw new Error("Observed-recovery validation requires recorded recovery evidence.");u=`Validated ${l.length} immutable recovery evidence reference(s) before candidate advancement.`}else if(s.kind==="prompt"){let l=r.edits.filter(i=>i.route==="prompt"&&i.target!=="harness.json");if(l.length===0)throw new Error("Prompt validation requires an instruction-file edit.");for(let i of l){let g=d.get(i.target);if(i.operation==="delete"){if(g)throw new Error(`Deleted instruction ${i.target} remains declared.`)}else if(g?.kind!=="instruction")throw new Error(`Instruction ${i.target} is not declared in the candidate Harness.`);if(i.content!==null&&/\b(?:api[_-]?key|access[_-]?token|password|secret)\s*[:=]/i.test(i.content))throw new Error(`Instruction ${i.target} appears to contain credential material.`)}u=`Validated ${l.length} textual instruction edit(s) and compiled candidate ${c.harnessRelease.id}.`}else if(s.kind==="skill"){let l=r.edits.filter(i=>i.route==="skill"&&i.target!=="harness.json");if(l.length===0)throw new Error("Skill validation requires a declared Skill-file edit.");for(let i of l){let g=d.get(i.target);if(i.operation==="delete"){if(g)throw new Error(`Deleted Skill ${i.target} remains declared.`);continue}if(g?.kind!=="skill")throw new Error(`Skill ${i.target} is not declared in the candidate Harness.`);let k=h.get(i.target)?.content;if(!k)throw new Error(`Skill edit ${i.target} has no content.`);let H=x(k);if(!H.name||!H.description||H.messages.length>0)throw new Error(`Skill ${i.target} is invalid: ${H.messages.join(" ")}`)}u=`Validated ${l.length} Skill edit(s), Skill frontmatter, and compiled candidate ${c.harnessRelease.id}.`}else if(s.kind==="dependency"){let l=c.manifest.files.find(i=>i.kind==="dependency_lock");if(!l)throw new Error("Candidate Harness has no dependency lock.");JSON.parse(await p.readFile(z(a,l.path),"utf8")),u=`Validated dependency lock ${l.path} and compiled candidate ${c.harnessRelease.id}.`}else if(s.kind==="schema")A.parse(r),u=`Validated proposal, manifest, and candidate release schemas for ${c.harnessRelease.id}.`;else if(s.kind==="package"){let l=r.edits.filter(i=>i.route==="agent"&&i.operation!=="delete"&&i.target!=="harness.json");for(let i of l){if(!i.content)throw new Error(`Agent edit ${i.target} has no source.`);X(i.content,{mode:"transform",sourceUrl:i.target,sourceMap:!1})}u=l.length>0?`Syntax-checked ${l.length} Agent source edit(s) and compiled candidate ${c.harnessRelease.id}.`:`Compiled candidate package ${c.harnessRelease.id} and preserved the Harness source manifest contract.`}else if(s.kind==="component_activation"){let l=r.edits.filter(i=>i.target!=="harness.json");if(l.length===0)throw new Error("Component activation requires a concrete Harness component edit.");if(r.route==="agent"){if(l.filter(g=>g.operation!=="delete").length>0)throw new Error("Desktop Work does not compile or execute released Agent source; use an active instruction or standalone Skill, or add an Agent executor before release.");u=`Confirmed ${l.length} deleted Agent component(s) were inactive in Desktop Work.`}else{if(!["prompt","skill"].includes(r.route))throw new Error(`Desktop Work has no activation policy for ${r.route} proposals.`);let i=r.route==="prompt"?"instruction":"skill";for(let g of l){let k=m.components.find(H=>H.path===g.target&&H.kind===i);if(g.operation==="delete"?k:!k)throw new Error(`${i} ${g.target} is not reflected in the candidate Desktop Work runtime surface.`)}if(v.contentHash===m.contentHash)throw new Error("The candidate does not change the effective Desktop Work runtime surface.");u=`Activated ${l.length} ${i} edit(s) in the candidate Desktop Work runtime surface.`}}else s.kind==="business_formula"?(f="blocked",u="Business or financial logic is retained for review until an approved deterministic fixture supplies inputs and expected outputs."):s.kind==="targeted_evaluation"?(f="blocked",u="This sensitive change requires an explicit authority-preserving targeted Evaluation before release."):s.kind==="file_render"?(f="blocked",u="File-render validation requires an exact produced artifact reference; no artifact was attached to this Harness-source proposal."):(f="blocked",u=`Local targeted validation does not yet own ${s.kind}; it requires its dedicated validator.`)}catch(l){f="failed",u=l instanceof Error?l.message:String(l)}return W({schemaVersion:"openpond.harnessTargetedValidationReceipt.v1",id:`validation-${r.id}-${s.id}`,proposal:{id:r.id,contentHash:r.contentHash},validationId:s.id,kind:s.kind,status:f,summary:u,evidenceRefs:r.evidence,createdAt:n,metadata:{candidateHarnessRelease:{id:c.harnessRelease.id,contentHash:c.harnessRelease.contentHash},sourceRevision:c.sourceRevision,...s.kind==="component_activation"?{targetRuntime:"desktop_work",beforeEffectiveRuntimeHash:v.contentHash,afterEffectiveRuntimeHash:m.contentHash,activatedComponentRefs:m.components,inactiveAgentRefs:m.inactiveAgents}:{}}})}))}catch(c){let d=c instanceof Error?c.message:String(c);return r.validationPlan.map(h=>W({schemaVersion:"openpond.harnessTargetedValidationReceipt.v1",id:`validation-${r.id}-${h.id}`,proposal:{id:r.id,contentHash:r.contentHash},validationId:h.id,kind:h.kind,status:"failed",summary:d,evidenceRefs:r.evidence,createdAt:n,metadata:{}}))}finally{await p.rm(a,{recursive:!0,force:!0}).catch(()=>{})}}w(pe,"validateLocalHarnessRefinerProposal");function N(e){let r=[...e.agentSnapshot.instructions.map(o=>({kind:"instruction",path:o.path,contentHash:o.contentHash})),...e.agentSnapshot.skills.map(o=>({kind:"skill",path:o.path,contentHash:o.contentHash}))].sort((o,a)=>o.path.localeCompare(a.path)),t=e.agentSnapshot.agents.map(o=>({path:o.path,contentHash:o.contentHash})).sort((o,a)=>o.path.localeCompare(a.path));return{contentHash:L({schemaVersion:"openpond.desktopWorkHarnessSurface.v1",components:r}),components:r,inactiveAgents:t}}w(N,"desktopWorkRuntimeSurface");function Y(e){let r=(e.now??(()=>new Date().toISOString()))(),t=e.proposal.edits.find(o=>o.route==="memory");return e.proposal.validationPlan.map(o=>{let a="passed",n="Memory candidate is bounded, scoped, and contains no obvious credential material.";try{if(o.kind==="observed_recovery"){if(!e.proposal.evidence.some(c=>c.kind==="recovery"))throw new Error("Observed-recovery validation requires recorded recovery evidence.");n="Memory proposal is grounded in immutable recovery evidence."}else if(o.kind==="memory"){if(!t||!/^memory\/[a-z0-9][a-z0-9-]{0,119}$/.test(t.target))throw new Error("Memory proposal requires one safe memory/<slug> target.");let c=e.proposal.metadata.expectedMemory;if(!c||typeof c!="object"||Array.isArray(c))throw new Error("Memory proposal requires an expected revision snapshot.");let d=c;if(d.key!==Z(t.target))throw new Error("Memory proposal expected revision targets a different key.");if(d.revision!==null&&(!Number.isInteger(d.revision)||Number(d.revision)<1))throw new Error("Memory proposal expected revision is invalid.");if(d.contentHash!==null&&typeof d.contentHash!="string")throw new Error("Memory proposal expected content hash is invalid.");if(d.status!==null&&d.status!=="active"&&d.status!=="deleted")throw new Error("Memory proposal expected status is invalid.");if(d.revision===null&&(d.contentHash!==null||d.status!==null))throw new Error("New memory snapshot must not claim existing content or status.");if(d.revision!==null&&(typeof d.contentHash!="string"||d.status===null))throw new Error("Existing memory snapshot requires its content hash and status.");if(t.operation==="delete"&&d.status!=="active")throw new Error("Memory deletion requires an active expected revision.");if(t.operation!=="delete"){if(!t.content?.trim()||t.content.length>24e3)throw new Error("Memory content must contain 1-24,000 characters.");if(/\b(?:api[_-]?key|access[_-]?token|password|secret)\s*[:=]/i.test(t.content))throw new Error("Memory content appears to contain credential material.")}}else a="blocked",n=`Memory validation cannot satisfy ${o.kind}.`}catch(c){a="failed",n=c instanceof Error?c.message:String(c)}return W({schemaVersion:"openpond.harnessTargetedValidationReceipt.v1",id:`validation-${e.proposal.id}-${o.id}`,proposal:{id:e.proposal.id,contentHash:e.proposal.contentHash},validationId:o.id,kind:o.kind,status:a,summary:n,evidenceRefs:e.proposal.evidence,createdAt:r,metadata:{externalState:"harness_memory"}})})}w(Y,"validateMemoryProposal");function Z(e){let r=e.replaceAll("\\","/"),t=/^memory\/([a-z0-9][a-z0-9-]{0,119})$/.exec(r);if(!t)throw new Error(`Invalid Harness memory target: ${e}.`);return t[1]}w(Z,"memoryKeyFromTarget");async function F(e){let r=await e.store.getHarnessWorkspace(e.workspaceId);if(!r)throw new Error(`Harness workspace ${e.workspaceId} does not exist.`);let t=P(e.storeDir,r.id),o=R.join(t.root,"source-swap.json"),a=await p.readFile(o,"utf8").then(JSON.parse).catch(d=>{if(d.code==="ENOENT")return null;throw d});if(!a)return"none";let n=await E({workspaceId:r.id,sourceDir:t.source});if(r.sourceRevision===a.nextSourceRevision&&n.sourceRevision===a.nextSourceRevision)return await p.rm(a.backupSource,{recursive:!0,force:!0}),await p.rm(o,{force:!0}),"completed";let c=await E({workspaceId:r.id,sourceDir:a.backupSource});if(r.sourceRevision===a.previousSourceRevision&&c.sourceRevision===a.previousSourceRevision)return await $(t.source,a.backupSource),await p.rm(o,{force:!0}),"restored";throw new Error("Harness source-swap recovery cannot reconcile filesystem and workspace revisions.")}w(F,"recoverLocalHarnessSourceSwap");async function K(e,r){for(let t of r.edits){let o=z(e,t.target);if(t.operation==="delete"){await p.rm(o,{force:!1});continue}if(t.content===null)throw new Error(`Refiner edit ${t.id} has no content.`);if(t.operation==="create")await p.mkdir(R.dirname(o),{recursive:!0}),await p.writeFile(o,t.content,{flag:"wx"});else{let a=await p.lstat(o);if(!a.isFile()||a.isSymbolicLink())throw new Error(`Refiner update target must be a regular file: ${t.target}`);await p.writeFile(o,t.content,{flag:"w"})}}}w(K,"applyOverlayEdits");function z(e,r){let t=R.resolve(e),o=R.resolve(t,...r.replaceAll("\\","/").split("/")),a=R.relative(t,o);if(!a||a.startsWith("..")||R.isAbsolute(a))throw new Error(`Refiner edit target escapes the Harness source: ${r}`);return o}w(z,"containedPath");async function J(e,r){let t=`${e}.${I()}.tmp`;await p.writeFile(t,`${JSON.stringify(r,null,2)}
|
|
2
|
+
import{ka as P,la as V,ma as M,qa as E,ra as q}from"./chunk-7MXZJQS7.js";import{b as x}from"./chunk-L3KS6MOV.js";import{kd as T}from"./chunk-XDMUD4FW.js";import{r as _,s as A,t as C,y as W}from"./chunk-SDEDAHV6.js";import{l as D,m as L,n as b}from"./chunk-NNF6KCHD.js";import{a as w}from"./chunk-FTQLQJQV.js";import{randomUUID as I}from"node:crypto";import{promises as p}from"node:fs";import{stripTypeScriptTypes as X}from"node:module";import R from"node:path";async function le(e){let r=_.parse(e.overlay),t=A.parse(e.proposal),o=e.validations.map(v=>C.parse(v));if((t.route==="agent"?t.edits.filter(v=>v.target!=="harness.json"&&v.operation!=="delete"):[]).length>0){let v=t.validationPlan.find(s=>s.kind==="component_activation"&&s.required);if(!v)throw new Error("Desktop Work Agent proposals require component-activation validation before review.");if(o.find(s=>s.validationId===v.id)?.status==="passed")throw new Error("Desktop Work cannot accept a passed Agent activation receipt until an Agent source executor exists.")}if(t.overlay.id!==r.id||t.overlay.revision!==r.revision||t.overlay.contentHash!==r.contentHash)throw new Error("Refiner proposal is not bound to the supplied run overlay.");if(r.status!=="frozen")throw new Error("Only a frozen run overlay can advance a Harness workspace.");let n=await e.store.getHarnessWorkspace(t.expectedWorkspace.workspaceId);if(!n)throw new Error(`Harness workspace ${t.expectedWorkspace.workspaceId} does not exist.`);if(n.location!==e.store.harnessStoragePlacement)throw new Error("Refiner workspace does not match the admitted storage placement.");let c=P(e.storeDir,n.id),d=await E({workspaceId:n.id,sourceDir:c.source});if(d.sourceRevision!==n.sourceRevision)throw new Error(`Harness source is ${d.sourceRevision}; workspace expects ${n.sourceRevision}. Record or revert the source change before refinement.`);let h=R.join(c.root,`.source-candidate-${I()}`);await p.cp(c.source,h,{recursive:!0,force:!1,errorOnExist:!0,verbatimSymlinks:!1});try{await K(h,t);let v=await E({workspaceId:n.id,sourceDir:h}),m=(e.now??(()=>new Date().toISOString()))(),s=await q({storeDir:e.storeDir,workspaceId:n.id,compiled:v,createdAt:m});await e.store.saveHarnessReleaseRecord(s),await e.store.saveHarnessImprovementArtifact(n.id,"run_overlay",r),await e.store.saveHarnessImprovementArtifact(n.id,"proposal",t);for(let i of o)await e.store.saveHarnessImprovementArtifact(n.id,"targeted_validation",i);if(!T({workspace:n,proposal:t}).eligible&&!e.reviewAuthority)return e.store.advanceHarnessWorkspaceAtomically({receiptId:e.receiptId,workspaceId:n.id,proposal:t,validations:o,nextRelease:{id:s.harnessRelease.id,contentHash:s.harnessRelease.contentHash},nextSourceRevision:s.sourceRevision,now:m});let u=R.join(c.root,`.source-backup-${I()}`),l=R.join(c.root,"source-swap.json");await J(l,{schemaVersion:"openpond.localHarnessSourceSwap.v1",workspaceId:n.id,expectedWorkspaceRevision:n.revision,previousSourceRevision:n.sourceRevision,nextSourceRevision:s.sourceRevision,backupSource:u,candidateSource:h,createdAt:m}),await p.rename(c.source,u),await p.rename(h,c.source);try{let i=e.reviewAuthority?await e.store.advanceReviewedHarnessWorkspaceAtomically({receiptId:e.receiptId,workspaceId:n.id,proposal:t,validations:o,nextRelease:{id:s.harnessRelease.id,contentHash:s.harnessRelease.contentHash},nextSourceRevision:s.sourceRevision,reviewer:e.reviewAuthority.reviewer,now:m}):await e.store.advanceHarnessWorkspaceAtomically({receiptId:e.receiptId,workspaceId:n.id,proposal:t,validations:o,nextRelease:{id:s.harnessRelease.id,contentHash:s.harnessRelease.contentHash},nextSourceRevision:s.sourceRevision,now:m});return i.receipt.decision!=="advanced"?await $(c.source,u):await p.rm(u,{recursive:!0,force:!0}),await p.rm(l,{force:!0}),i}catch(i){throw await $(c.source,u).catch(()=>{}),await p.rm(l,{force:!0}).catch(()=>{}),i}}finally{await p.rm(h,{recursive:!0,force:!0}).catch(()=>{})}}w(le,"applyLocalHarnessRefinerProposal");async function de(e){let r=await e.store.getHarnessWorkspace(e.workspaceId);if(!r||r.location!==e.store.harnessStoragePlacement)throw new Error(`Local Harness workspace ${e.workspaceId} does not exist.`);if(r.currentChannel.release?.id!==e.rollbackOf.id||r.currentChannel.release.contentHash!==e.rollbackOf.contentHash)throw new Error("Harness rollback source is no longer the current release.");let t=await e.store.getHarnessReleaseRecord(e.targetRelease.contentHash);if(!t||t.workspaceId!==r.id||t.harnessRelease.id!==e.targetRelease.id)throw new Error("Harness rollback target is unavailable in this workspace.");let o=P(e.storeDir,r.id);if((await E({workspaceId:r.id,sourceDir:o.source})).sourceRevision!==r.sourceRevision)throw new Error("Harness source changed before rollback.");let n=R.join(o.root,`.source-rollback-${I()}`);await p.cp(R.join(t.bundlePath,"source"),n,{recursive:!0,force:!1,errorOnExist:!0,verbatimSymlinks:!1});try{if((await E({workspaceId:r.id,sourceDir:n})).sourceRevision!==t.sourceRevision)throw new Error("Harness rollback bundle does not reproduce its registered source revision.");let d=(e.now??(()=>new Date().toISOString()))(),h=R.join(o.root,`.source-backup-${I()}`),v=R.join(o.root,"source-swap.json");await J(v,{schemaVersion:"openpond.localHarnessSourceSwap.v1",workspaceId:r.id,expectedWorkspaceRevision:r.revision,previousSourceRevision:r.sourceRevision,nextSourceRevision:t.sourceRevision,backupSource:h,candidateSource:n,createdAt:d}),await p.rename(o.source,h),await p.rename(n,o.source);try{let m=await e.store.rollbackHarnessWorkspaceAtomically({receiptId:e.receiptId,workspaceId:r.id,expectedWorkspaceRevision:r.revision,expectedChannelRevision:r.currentChannel.revision,targetRelease:e.targetRelease,targetSourceRevision:t.sourceRevision,rollbackOf:e.rollbackOf,now:d});return m.receipt.decision!=="rolled_back"?await $(o.source,h):await p.rm(h,{recursive:!0,force:!0}),await p.rm(v,{force:!0}),m}catch(m){throw await $(o.source,h).catch(()=>{}),await p.rm(v,{force:!0}).catch(()=>{}),m}}finally{await p.rm(n,{recursive:!0,force:!0}).catch(()=>{})}}w(de,"rollbackLocalHarnessWorkspaceRelease");async function pe(e){let r=A.parse(e.proposal);if(r.expectedWorkspace.workspaceId!==e.workspace.id)throw new Error("Refiner proposal targets a different Harness workspace.");if(r.route==="memory")return Y({proposal:r,now:e.now});let t=P(e.storeDir,e.workspace.id),o=await E({workspaceId:e.workspace.id,sourceDir:t.source});if(o.sourceRevision!==r.expectedWorkspace.sourceRevision)throw new Error("Refiner proposal source revision no longer matches the Local Harness workspace.");let a=R.join(t.root,`.validation-candidate-${I()}`);await p.cp(t.source,a,{recursive:!0,force:!1,errorOnExist:!0,verbatimSymlinks:!1});let n=(e.now??(()=>new Date().toISOString()))();try{await K(a,r);let c=await E({workspaceId:e.workspace.id,sourceDir:a}),d=new Map(c.manifest.files.map(s=>[s.path,s])),h=new Map(r.edits.map(s=>[s.target,s])),v=N(o),m=N(c);return Promise.all(r.validationPlan.map(async s=>{let f="passed",u="The candidate Harness source compiles and preserves its manifest contract.";try{if(s.kind==="observed_recovery"){let l=r.evidence.filter(i=>i.kind==="recovery");if(l.length===0)throw new Error("Observed-recovery validation requires recorded recovery evidence.");u=`Validated ${l.length} immutable recovery evidence reference(s) before candidate advancement.`}else if(s.kind==="prompt"){let l=r.edits.filter(i=>i.route==="prompt"&&i.target!=="harness.json");if(l.length===0)throw new Error("Prompt validation requires an instruction-file edit.");for(let i of l){let g=d.get(i.target);if(i.operation==="delete"){if(g)throw new Error(`Deleted instruction ${i.target} remains declared.`)}else if(g?.kind!=="instruction")throw new Error(`Instruction ${i.target} is not declared in the candidate Harness.`);if(i.content!==null&&/\b(?:api[_-]?key|access[_-]?token|password|secret)\s*[:=]/i.test(i.content))throw new Error(`Instruction ${i.target} appears to contain credential material.`)}u=`Validated ${l.length} textual instruction edit(s) and compiled candidate ${c.harnessRelease.id}.`}else if(s.kind==="skill"){let l=r.edits.filter(i=>i.route==="skill"&&i.target!=="harness.json");if(l.length===0)throw new Error("Skill validation requires a declared Skill-file edit.");for(let i of l){let g=d.get(i.target);if(i.operation==="delete"){if(g)throw new Error(`Deleted Skill ${i.target} remains declared.`);continue}if(g?.kind!=="skill")throw new Error(`Skill ${i.target} is not declared in the candidate Harness.`);let k=h.get(i.target)?.content;if(!k)throw new Error(`Skill edit ${i.target} has no content.`);let H=x(k);if(!H.name||!H.description||H.messages.length>0)throw new Error(`Skill ${i.target} is invalid: ${H.messages.join(" ")}`)}u=`Validated ${l.length} Skill edit(s), Skill frontmatter, and compiled candidate ${c.harnessRelease.id}.`}else if(s.kind==="dependency"){let l=c.manifest.files.find(i=>i.kind==="dependency_lock");if(!l)throw new Error("Candidate Harness has no dependency lock.");JSON.parse(await p.readFile(z(a,l.path),"utf8")),u=`Validated dependency lock ${l.path} and compiled candidate ${c.harnessRelease.id}.`}else if(s.kind==="schema")A.parse(r),u=`Validated proposal, manifest, and candidate release schemas for ${c.harnessRelease.id}.`;else if(s.kind==="package"){let l=r.edits.filter(i=>i.route==="agent"&&i.operation!=="delete"&&i.target!=="harness.json");for(let i of l){if(!i.content)throw new Error(`Agent edit ${i.target} has no source.`);X(i.content,{mode:"transform",sourceUrl:i.target,sourceMap:!1})}u=l.length>0?`Syntax-checked ${l.length} Agent source edit(s) and compiled candidate ${c.harnessRelease.id}.`:`Compiled candidate package ${c.harnessRelease.id} and preserved the Harness source manifest contract.`}else if(s.kind==="component_activation"){let l=r.edits.filter(i=>i.target!=="harness.json");if(l.length===0)throw new Error("Component activation requires a concrete Harness component edit.");if(r.route==="agent"){if(l.filter(g=>g.operation!=="delete").length>0)throw new Error("Desktop Work does not compile or execute released Agent source; use an active instruction or standalone Skill, or add an Agent executor before release.");u=`Confirmed ${l.length} deleted Agent component(s) were inactive in Desktop Work.`}else{if(!["prompt","skill"].includes(r.route))throw new Error(`Desktop Work has no activation policy for ${r.route} proposals.`);let i=r.route==="prompt"?"instruction":"skill";for(let g of l){let k=m.components.find(H=>H.path===g.target&&H.kind===i);if(g.operation==="delete"?k:!k)throw new Error(`${i} ${g.target} is not reflected in the candidate Desktop Work runtime surface.`)}if(v.contentHash===m.contentHash)throw new Error("The candidate does not change the effective Desktop Work runtime surface.");u=`Activated ${l.length} ${i} edit(s) in the candidate Desktop Work runtime surface.`}}else s.kind==="business_formula"?(f="blocked",u="Business or financial logic is retained for review until an approved deterministic fixture supplies inputs and expected outputs."):s.kind==="targeted_evaluation"?(f="blocked",u="This sensitive change requires an explicit authority-preserving targeted Evaluation before release."):s.kind==="file_render"?(f="blocked",u="File-render validation requires an exact produced artifact reference; no artifact was attached to this Harness-source proposal."):(f="blocked",u=`Local targeted validation does not yet own ${s.kind}; it requires its dedicated validator.`)}catch(l){f="failed",u=l instanceof Error?l.message:String(l)}return W({schemaVersion:"openpond.harnessTargetedValidationReceipt.v1",id:`validation-${r.id}-${s.id}`,proposal:{id:r.id,contentHash:r.contentHash},validationId:s.id,kind:s.kind,status:f,summary:u,evidenceRefs:r.evidence,createdAt:n,metadata:{candidateHarnessRelease:{id:c.harnessRelease.id,contentHash:c.harnessRelease.contentHash},sourceRevision:c.sourceRevision,...s.kind==="component_activation"?{targetRuntime:"desktop_work",beforeEffectiveRuntimeHash:v.contentHash,afterEffectiveRuntimeHash:m.contentHash,activatedComponentRefs:m.components,inactiveAgentRefs:m.inactiveAgents}:{}}})}))}catch(c){let d=c instanceof Error?c.message:String(c);return r.validationPlan.map(h=>W({schemaVersion:"openpond.harnessTargetedValidationReceipt.v1",id:`validation-${r.id}-${h.id}`,proposal:{id:r.id,contentHash:r.contentHash},validationId:h.id,kind:h.kind,status:"failed",summary:d,evidenceRefs:r.evidence,createdAt:n,metadata:{}}))}finally{await p.rm(a,{recursive:!0,force:!0}).catch(()=>{})}}w(pe,"validateLocalHarnessRefinerProposal");function N(e){let r=[...e.agentSnapshot.instructions.map(o=>({kind:"instruction",path:o.path,contentHash:o.contentHash})),...e.agentSnapshot.skills.map(o=>({kind:"skill",path:o.path,contentHash:o.contentHash}))].sort((o,a)=>o.path.localeCompare(a.path)),t=e.agentSnapshot.agents.map(o=>({path:o.path,contentHash:o.contentHash})).sort((o,a)=>o.path.localeCompare(a.path));return{contentHash:L({schemaVersion:"openpond.desktopWorkHarnessSurface.v1",components:r}),components:r,inactiveAgents:t}}w(N,"desktopWorkRuntimeSurface");function Y(e){let r=(e.now??(()=>new Date().toISOString()))(),t=e.proposal.edits.find(o=>o.route==="memory");return e.proposal.validationPlan.map(o=>{let a="passed",n="Memory candidate is bounded, scoped, and contains no obvious credential material.";try{if(o.kind==="observed_recovery"){if(!e.proposal.evidence.some(c=>c.kind==="recovery"))throw new Error("Observed-recovery validation requires recorded recovery evidence.");n="Memory proposal is grounded in immutable recovery evidence."}else if(o.kind==="memory"){if(!t||!/^memory\/[a-z0-9][a-z0-9-]{0,119}$/.test(t.target))throw new Error("Memory proposal requires one safe memory/<slug> target.");let c=e.proposal.metadata.expectedMemory;if(!c||typeof c!="object"||Array.isArray(c))throw new Error("Memory proposal requires an expected revision snapshot.");let d=c;if(d.key!==Z(t.target))throw new Error("Memory proposal expected revision targets a different key.");if(d.revision!==null&&(!Number.isInteger(d.revision)||Number(d.revision)<1))throw new Error("Memory proposal expected revision is invalid.");if(d.contentHash!==null&&typeof d.contentHash!="string")throw new Error("Memory proposal expected content hash is invalid.");if(d.status!==null&&d.status!=="active"&&d.status!=="deleted")throw new Error("Memory proposal expected status is invalid.");if(d.revision===null&&(d.contentHash!==null||d.status!==null))throw new Error("New memory snapshot must not claim existing content or status.");if(d.revision!==null&&(typeof d.contentHash!="string"||d.status===null))throw new Error("Existing memory snapshot requires its content hash and status.");if(t.operation==="delete"&&d.status!=="active")throw new Error("Memory deletion requires an active expected revision.");if(t.operation!=="delete"){if(!t.content?.trim()||t.content.length>24e3)throw new Error("Memory content must contain 1-24,000 characters.");if(/\b(?:api[_-]?key|access[_-]?token|password|secret)\s*[:=]/i.test(t.content))throw new Error("Memory content appears to contain credential material.")}}else a="blocked",n=`Memory validation cannot satisfy ${o.kind}.`}catch(c){a="failed",n=c instanceof Error?c.message:String(c)}return W({schemaVersion:"openpond.harnessTargetedValidationReceipt.v1",id:`validation-${e.proposal.id}-${o.id}`,proposal:{id:e.proposal.id,contentHash:e.proposal.contentHash},validationId:o.id,kind:o.kind,status:a,summary:n,evidenceRefs:e.proposal.evidence,createdAt:r,metadata:{externalState:"harness_memory"}})})}w(Y,"validateMemoryProposal");function Z(e){let r=e.replaceAll("\\","/"),t=/^memory\/([a-z0-9][a-z0-9-]{0,119})$/.exec(r);if(!t)throw new Error(`Invalid Harness memory target: ${e}.`);return t[1]}w(Z,"memoryKeyFromTarget");async function F(e){let r=await e.store.getHarnessWorkspace(e.workspaceId);if(!r)throw new Error(`Harness workspace ${e.workspaceId} does not exist.`);let t=P(e.storeDir,r.id),o=R.join(t.root,"source-swap.json"),a=await p.readFile(o,"utf8").then(JSON.parse).catch(d=>{if(d.code==="ENOENT")return null;throw d});if(!a)return"none";let n=await E({workspaceId:r.id,sourceDir:t.source});if(r.sourceRevision===a.nextSourceRevision&&n.sourceRevision===a.nextSourceRevision)return await p.rm(a.backupSource,{recursive:!0,force:!0}),await p.rm(o,{force:!0}),"completed";let c=await E({workspaceId:r.id,sourceDir:a.backupSource});if(r.sourceRevision===a.previousSourceRevision&&c.sourceRevision===a.previousSourceRevision)return await $(t.source,a.backupSource),await p.rm(o,{force:!0}),"restored";throw new Error("Harness source-swap recovery cannot reconcile filesystem and workspace revisions.")}w(F,"recoverLocalHarnessSourceSwap");async function K(e,r){for(let t of r.edits){let o=z(e,t.target);if(t.operation==="delete"){await p.rm(o,{force:!1});continue}if(t.content===null)throw new Error(`Refiner edit ${t.id} has no content.`);if(t.operation==="create")await p.mkdir(R.dirname(o),{recursive:!0}),await p.writeFile(o,t.content,{flag:"wx"});else{let a=await p.lstat(o);if(!a.isFile()||a.isSymbolicLink())throw new Error(`Refiner update target must be a regular file: ${t.target}`);await p.writeFile(o,t.content,{flag:"w"})}}}w(K,"applyOverlayEdits");function z(e,r){let t=R.resolve(e),o=R.resolve(t,...r.replaceAll("\\","/").split("/")),a=R.relative(t,o);if(!a||a.startsWith("..")||R.isAbsolute(a))throw new Error(`Refiner edit target escapes the Harness source: ${r}`);return o}w(z,"containedPath");async function J(e,r){let t=`${e}.${I()}.tmp`;await p.writeFile(t,`${JSON.stringify(r,null,2)}
|
|
3
3
|
`,{flag:"wx"}),await p.rename(t,e)}w(J,"writeSwapJournal");async function $(e,r){await p.rm(e,{recursive:!0,force:!0}),await p.rename(r,e)}w($,"restoreSource");var y="desktop-personal",U="personal-default";async function ve(e){let r=await e.store.getSelectedHarnessWorkspace({ownerKind:"personal",ownerId:y});if(r&&r.metadata.selectionEligible!==!1)return await F({store:e.store,storeDir:e.storeDir,workspaceId:r.id}),O(e.store,r.id,r.currentChannel.release?.contentHash??null);let t=(await e.store.listHarnessWorkspaces({ownerKind:"personal",ownerId:y})).find(n=>n.metadata.selectionEligible!==!1);if(t)return await e.store.selectHarnessWorkspace({ownerKind:"personal",ownerId:y,workspaceId:t.id,updatedAt:(e.now??(()=>new Date().toISOString()))()}),O(e.store,t.id,t.currentChannel.release?.contentHash??null);let o=await e.loadProfileState(),a=o.mode==="local"&&o.sourcePath&&!o.error?await M({store:e.store,storeDir:e.storeDir,id:U,ownerId:y,name:o.activeProfile?.trim()||"Personal Harness",profile:o,now:e.now}):await V({store:e.store,storeDir:e.storeDir,id:U,ownerId:y,name:"Personal Harness",now:e.now});return await e.store.selectHarnessWorkspace({ownerKind:"personal",ownerId:y,workspaceId:a.workspace.id,updatedAt:(e.now??(()=>new Date().toISOString()))()}),a.release}w(ve,"ensureSelectedLocalHarnessWorkspace");async function B(e){let r=await e.getSelectedHarnessWorkspace({ownerKind:"personal",ownerId:y});return r?O(e,r.id,r.currentChannel.release?.contentHash??null):null}w(B,"resolveSelectedLocalHarnessRelease");async function O(e,r,t){if(!t)throw new Error(`Selected Harness workspace ${r} has no current release.`);let o=await e.getHarnessReleaseRecord(t);if(!o||o.workspaceId!==r)throw new Error(`Selected Harness workspace ${r} points to a missing release ${t}.`);return b(o.agentSnapshot,"Selected Agent snapshot"),b(o.harnessRelease,"Selected Harness release"),o}w(O,"requireCurrentRelease");import{promises as Q}from"node:fs";import S from"node:path";async function be(e,r){if(r){let a=await e.getHarnessReleaseRecord(r.contentHash);if(!a||a.harnessRelease.id!==r.id)throw new Error("The selected immutable Harness release is unavailable.");let n=await e.getHarnessWorkspace(a.workspaceId);if(!n||n.ownerScope.kind!=="personal"||n.ownerScope.id!==y)throw new Error("The selected Harness release is not available to this local owner.");return b(a.agentSnapshot,"Selected Agent snapshot"),b(a.harnessRelease,"Selected Harness release"),G({workspace:n,release:a})}let t=await B(e);if(!t)return null;let o=await e.getSelectedHarnessWorkspace({ownerKind:"personal",ownerId:y});if(!o||o.id!==t.workspaceId)throw new Error("Selected Harness workspace changed while its release was being admitted.");return G({workspace:o,release:t})}w(be,"loadSelectedLocalHarnessRuntime");async function G(e){let{workspace:r,release:t}=e;if(t.workspaceId!==r.id)throw new Error("Harness release does not belong to the requested workspace.");let o=S.join(t.bundlePath,"source");await Promise.all(t.harnessRelease.files.map(s=>ee(o,s.path,s.contentHash)));let a=await Promise.all(t.agentSnapshot.instructions.map(async s=>({path:s.path,content:await j(o,s.path,s.contentHash)}))),n=[],c=new Map;for(let s of t.agentSnapshot.skills){let f=await j(o,s.path,s.contentHash),u=x(f);if(!u.name||!u.description||u.messages.length>0)throw new Error(`Released Harness Skill ${s.path} is invalid: ${u.messages.join(" ")||"missing name or description"}`);if(c.has(u.name))throw new Error(`Released Harness has duplicate Skill ${u.name}.`);let l=`${S.posix.dirname(s.path)}/`,i=t.harnessRelease.files.filter(k=>k.visibility==="policy"&&k.path.startsWith(l)&&k.path!==s.path).map(k=>k.path.slice(l.length)).sort(),g={name:u.name,description:u.description,path:s.path,scope:"profile",enabled:!0,sourcePath:o,charCount:f.length,sourceHash:s.contentHash,validationStatus:"valid",validationMessages:[],resourceFiles:i};n.push(g),c.set(g.name,async()=>{let k=await j(o,s.path,s.contentHash),H=x(k);if(!H.name||!H.description||H.messages.length>0)throw new Error(`Released Harness Skill ${s.path} failed validation while loading.`);return{name:H.name,description:H.description,body:H.body,path:s.path,sourceHash:s.contentHash,charCount:k.length,packagePath:S.join(o,...S.posix.dirname(s.path).split("/")),resourceFiles:i}})}n.sort((s,f)=>s.name.localeCompare(f.name));let d={profileSourcePath:o,skills:n,readSkill:c.size>0?async s=>{let f=c.get(s);if(!f)throw new Error(`Released Harness Skill not found: ${s}`);return f()}:null},h=a.sort((s,f)=>s.path.localeCompare(f.path)).map(({path:s,content:f})=>[`Active Harness instruction (${s}):`,f.trim()].join(`
|
|
4
4
|
`)).filter(s=>s.trim().length>0),m=[["Harness capability receipt:",JSON.stringify({harnessRelease:{id:t.harnessRelease.id,contentHash:t.harnessRelease.contentHash},agentSnapshot:{id:t.agentSnapshot.id,contentHash:t.agentSnapshot.contentHash},files:t.harnessRelease.files.filter(s=>s.visibility==="policy").map(s=>({path:s.path,contentHash:s.contentHash})),skills:t.agentSnapshot.skills.map(s=>s.path),agents:t.agentSnapshot.agents.map(s=>s.path),tools:t.agentSnapshot.toolDeclarations.map(s=>s.name),capabilityRequirements:t.agentSnapshot.capabilityRequirements})].join(`
|
|
5
5
|
`),h.length>0?["Active Harness preflight:","Apply the following released instructions when planning work and immediately before every tool call.","Preflight each call: (1) identify any active instruction that matches the planned operation, (2) inspect the exact tool arguments for a forbidden pattern, and (3) rewrite the call before sending it when a pattern matches. Compliance is required even when the prohibited call might still succeed.",...h].join(`
|