@tangle-network/sandbox-cli 0.23.304 → 0.23.305
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/README.md +11 -0
- package/dist/graph-campaign-child.mjs +1 -1
- package/dist/graph-profile-learning-Bz3Of4GY.mjs +1 -0
- package/dist/graph-qyNRgpKU.mjs +49 -0
- package/dist/{graph-workflow-dataset-CiYYzMTf.mjs → graph-workflow-dataset-524ZeLpH.mjs} +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +11 -11
- package/dist/graph-BL-kHmUJ.mjs +0 -48
- package/dist/graph-learning-l4SxwBc9.mjs +0 -2
- package/dist/graph-profile-learning-D7p4XCLh.mjs +0 -1
- /package/dist/{graph-view-BOXGsEQC.mjs → graph-view-XzT3ULwI.mjs} +0 -0
package/README.md
CHANGED
|
@@ -395,6 +395,14 @@ Candidate admission uses Runtime's loader to bind each admitted task's parameter
|
|
|
395
395
|
|
|
396
396
|
`--probe` limits the admitted train cases before task assets are opened. The suite owns repetitions and total campaign bounds. The native author and its verifier use the existing single-graph mutation policy. With `--unseal <reason>`, confirmation freezes the selected CodeSurface before loading the test cohort and compares the baseline and candidate under the same parent budget. Eval retains the paired evidence and the candidate stays held for review. The probe limit also applies to the test cohort when confirmation is requested.
|
|
397
397
|
|
|
398
|
+
To run named profile optimizers against Harbor, set `optimizer.kind` to
|
|
399
|
+
`sequence` in the suite. Alongside `--harbor`, pass `--suite <suite>`,
|
|
400
|
+
`--campaign <directory>`, and `--policy <policy>`.
|
|
401
|
+
Omit `--author`. Admit at least four independent development
|
|
402
|
+
units for fitting, selection, and comparison. Each stage runs the complete
|
|
403
|
+
graph, and Harbor grades the exact patch. The test cohort stays sealed until
|
|
404
|
+
the candidate is frozen for confirmation.
|
|
405
|
+
|
|
398
406
|
The native Harbor author can use Eval's DSPy trace analyst before proposing
|
|
399
407
|
each generation. Set `traceAnalysis` in the suite and point
|
|
400
408
|
`AGENT_EVAL_RUNNER_PYTHON` at the matching
|
|
@@ -529,6 +537,9 @@ together. Set `childrenPerProposal` for how many alternatives it proposes and
|
|
|
529
537
|
concurrently. The native stages share the suite's proposal budget through
|
|
530
538
|
their `maxGenerations`. The suite's `maps` scopes every stage to the same
|
|
531
539
|
nested node. The independent assessment manifest stays outside all stages.
|
|
540
|
+
The selected text is written to its original YAML location. Each case uses its
|
|
541
|
+
own compiled profile, including its parameters and opaque secret references.
|
|
542
|
+
The text itself must be authored inline and belong to the selected node.
|
|
532
543
|
|
|
533
544
|
`--cloud` saves the same source through Hub Workflows and returns its run ID
|
|
534
545
|
immediately. Later runs reuse that named deployment without changing its triggers.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./errors-DrYiP5_c.mjs";import{
|
|
1
|
+
import{t as e}from"./errors-DrYiP5_c.mjs";import{A as t,M as n,N as r,j as i,k as a,n as o,r as s}from"./graph-qyNRgpKU.mjs";import{canonicalCandidateDigest as c}from"@tangle-network/agent-interface";import{z as l}from"zod";import{readFile as u}from"node:fs/promises";import{redactText as d}from"@tangle-network/agent-eval/traces";if(!process.send)throw Error(`Campaign execution requires its parent IPC channel`);const f=new AbortController,p=()=>f.abort();process.on(`SIGTERM`,p),process.on(`SIGINT`,p),process.on(`disconnect`,p);const m=l.strictObject({type:l.literal(`run`),request:t,launchId:l.uuid(),seatSource:i});let h=!1;process.on(`message`,e=>{if(typeof e==`object`&&e&&`type`in e&&e.type===`cancel`){p();return}h||(h=!0,g(e).finally(()=>process.disconnect?.()))});async function g(t){let i=m.safeParse(t);if(!i.success||Buffer.byteLength(JSON.stringify(t))>4*1024*1024){process.exitCode=1;return}let{request:p,launchId:h}=i.data,g=a(p),_=!1,v,y=`uncertain`;try{let e=n(i.data.seatSource);if(c(e)!==p.seatSourceDigest)throw Error(`Campaign seat source commitment mismatch`);if(o(await u(p.file))!==p.sourceDigest)throw Error(`Campaign subprocess source changed`);await s(p.file,{param:p.param,json:!0,...e,...p.resume&&{resume:p.runId},...p.seat&&{seat:p.seat},...p.mcpPolicy&&{mcpPolicy:p.mcpPolicy}},{runId:p.runId,cwd:p.cwd,defaultSeat:p.defaultSeat,graphDigest:p.graphDigest,purpose:`evaluation`,signal:f.signal,...p.trigger&&{trigger:p.trigger},...p.taskWorkspace&&{taskWorkspace:p.taskWorkspace},onHostAdmitted:()=>new Promise((e,t)=>{let n=()=>{i(),t(f.signal.reason)},r=t=>{l.strictObject({type:l.literal(`admitted`),requestDigest:l.literal(g),launchId:l.literal(h)}).safeParse(t).success&&(_=!0,i(),e())},i=()=>{process.off(`message`,r),f.signal.removeEventListener(`abort`,n)};if(process.on(`message`,r),f.signal.addEventListener(`abort`,n,{once:!0}),f.signal.aborted)return n();process.send?.({type:`host-admitted`,launchId:h,runId:p.runId,requestDigest:g})})}),y=`completed`}catch(t){if(_)t.code===`GRAPH_RUN_FAILED`&&(y=`work-failed`);else{y=`not-started`;let n=Object.entries(process.env).filter(([e])=>/(?:token|secret|pass(?:word)?|credential|api.?key|bearer)/iu.test(e)).flatMap(([,e])=>e?[e]:[]);i.data.seatSource.seatCredential&&n.push(i.data.seatSource.seatCredential),v=d(t instanceof e?`${t.code}: ${t.message}: ${t.cause}`:t instanceof Error?t.message:`Campaign child refused execution before admission`,{knownSecrets:n}).slice(0,1200)}process.exitCode=1}finally{await r(p.receipt,{version:1,runId:p.runId,requestDigest:g,launchId:h,status:y,...v&&{refusal:v}})}}export{};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./errors-DrYiP5_c.mjs";import{C as t,D as n,N as r,O as i,S as a,_ as o,a as s,b as c,c as l,d as u,f as d,g as f,h as p,l as m,m as h,n as g,o as _,u as v,v as y,w as b,x}from"./graph-qyNRgpKU.mjs";import{u as S}from"./graph-run-input-Brwt5CE1.mjs";import{t as C}from"./graph-native-DdZwRWuP.mjs";import{basename as w,dirname as T,join as E}from"node:path";import{agentCandidateResolvedModelSchema as D,agentProfileSchema as O,canonicalAgentProfileDigest as k,canonicalCandidateDigest as A}from"@tangle-network/agent-interface";import{homedir as j}from"node:os";import{readFile as M,realpath as N,writeFile as P}from"node:fs/promises";import{campaignScenarioIdentity as ee}from"@tangle-network/agent-eval/campaign";import{FileCoordinationLog as F,FileResultBlobStore as I,FileSpawnJournal as L,canonicalObservedModelParts as R,createPrivateCasArtifactPort as te,graphFlowSpawnProfile as z,graphFromStored as B,graphRegistry as V,loadGraph as H,loadSpawnForest as ne,observedModelHasSnapshot as U,observedModelMatchesDeclared as W,validateStoredGraph as G}from"@tangle-network/agent-runtime/kernel";import{discoverDurableSupervisionRun as K,readSettleRecord as q,readSpawnJournal as J}from"@tangle-network/agent-runtime/durable";import{AnalystRegistry as re}from"@tangle-network/agent-eval/analyst";import{proposeAgentProfileImprovement as ie}from"@tangle-network/agent-runtime/intelligence";const Y=import.meta.url;function X(e,t,n){let r=e.trees.filter(({root:t})=>t===e.root);for(let{from:i,join:a}of t){let t=`maps:${i}->graph->${a}`,o=n.filter(e=>e.edge===t&&e.phase===`item`&&e.workerId);r=r.flatMap(({root:t,view:n})=>{let r=new Set(n.nodes.filter(e=>e.parent===n.root&&e.label===i).map(({id:e})=>e));return[...new Set(o.flatMap(({sourceWorker:e,workerId:t})=>t&&r.has(e)?[t]:[]))].map(n=>{let r=e.trees.find(e=>e.parentTreeRoot===t&&e.ownerNodeId===n);if(!r)throw Error(`Mapped graph item has no complete owned tree`);return r})})}return r}async function ae(e,n,r,i=[]){let o=E(j(),`.tangle`,`runs`,e),s=await S(e),c=await H(V(E(j(),`.tangle`,`graph-registry`)),s.graphDigest);if(!c)throw Error(`Measured graph registry snapshot is unavailable`);let l=G(c);if(l.digest!==s.graphDigest)throw Error(`Measured compiled graph identity changed`);a(l,{node:n,profileMaps:i},r);let[u,d,f]=await Promise.all([q(o),K(o),J(o)]);if(!u||u.tree.root!==e||!f.cursor||f.truncated||f.remainingBytes)throw Error(`Exact completed graph settlement or full journal is unavailable`);let p=new I(E(o,`blobs`)),m=t(B(l,{trigger:s.trigger??{}}),i);if(!m.entry)throw Error(`Canonical profile measurement currently requires a retained native flow graph`);let h=await ne(new L(d.spawnJournalPath),e),g=new F(d.coordinationLogPath),_=[],v=[];for(let e of d.coordinationStreams){if(e.unscopedRecords||!e.ownerIds.length)throw Error(`Flow execution has no exact coordination owner binding`);for(let t of e.ownerIds){let n=await g.load(e.runId,t);for(let{event:e}of n.records)e.type===`route`&&e.route.kind===`traversal`&&e.route.outcome===`delivered`&&_.push(e.route),e.type===`map`&&v.push(e.map)}}let y=X(h,i,v).flatMap(({view:e,events:t})=>e.nodes.filter(t=>t.label===n&&t.parent===e.root).map(e=>({actual:e,spawn:t.find(t=>t.kind===`spawned`&&t.id===e.id)})));if(!y.length)throw Error(`Selected profile has no completed flow worker`);for(let{actual:e,spawn:t}of y){let n=_.filter(t=>t.workerId===e.id),r=new Set(n.map(e=>k(z(m,e))));if(r.size!==1||!e.identity?.profileDigest||!r.has(e.identity.profileDigest)||t?.kind!==`spawned`||!t.profileRef||k(O.parse(await p.get(t.profileRef)))!==e.identity.profileDigest)throw Error(`Executed node differs from its exact retained flow edge/profile derivation`)}let b=y.map(({actual:e})=>e.providerModel);if(b.some(e=>e?.status!==`known`||!e.attempts.length))throw Error(`Selected profile has no complete provider-served model identity`);let x=[...new Set(b.flatMap(e=>e?.models??[]))],C=r.model?.default,w=r.model?.provider,T=r.model?.reasoningEffort;if(!C||!w||!T||!x.length||x.some(e=>!U(e)||!W(e,C)))throw Error(`Missing or contradictory exact served model/snapshot/effort binding`);let A=[...new Set(x.map(e=>R(e)?.snapshot))];if(A.length!==1||!A[0])throw Error(`Provider observations changed their model snapshot`);return{resolvedModel:D.parse({requested:C,provider:w,model:C.startsWith(`${w}/`)?C.slice(w.length+1):C,snapshot:A[0],reasoningEffort:T})}}const oe=async()=>Promise.all([import.meta.url,Y,_,c,y,C,d,p].map(async e=>g(await M(new URL(e)))));async function se(e,t){let r=await N(e),a=w(r,`.json`);if(w(T(r))!==`versions`||!/^[a-f0-9]{64}$/.test(a))throw Error(`--assessment must name an existing dataset/versions/<digest>.json frozen manifest`);let s=await n(T(T(r)),a);if(await N(s.root)===await N(t.dataset.root))throw Error(`Final assessment requires a separate frozen dataset, outside all search partitions`);let c=t.dataset.cases,l=new Set,u=new Set;for(let e of s.cases){let n=o(e);if(l.has(e.unit)||u.has(n))throw Error(`Final assessment requires distinct independent task units; repeated observations cannot become extra independent cases`);if(l.add(e.unit),u.add(n),e.domain!==t.suite.domain||e.trigger===void 0||e.kind===`retained-graph`&&(e.outcome===`unavailable`||!e.sourceDigest))throw Error(`Final assessment contains unavailable or incompatible retained task inputs`);if(i(c,{...e,digest:n},o))throw Error(`Final assessment overlaps a search train/dev/test task or independent unit`)}if(!s.cases.length)throw Error(`Final assessment manifest is empty`);return s}const ce=(e,t)=>({identity:n,profile:r})=>A({sourceIdentity:n,executionContext:e,graphSource:t(r)});async function Z(t,n,r,i,a,c,d={}){return u({file:t,datasetDirectory:n,suiteFile:r,directory:i,seat:c,bindings:d},async({admission:n,reflection:i,completed:c,open:u,retain:d})=>{let{root:p,suite:_,profile:y,sourceForProfile:b,dataset:S}=n;if(_.mutation!==`agent-profile`||!_.assessment)throw Error(`Canonical full-profile learning requires mutation=agent-profile and explicit assessment policy/limits in the suite`);let C=_.assessment;if(n.calibration.some(e=>e.passed===void 0))throw Error(`Canonical assessment calibration requires an explicit evaluator passed verdict before native dispatch`);if(C.policy.deltaThreshold!==_.minimumEffect||C.policy.budgetUsd!==void 0&&C.policy.budgetUsd!==0)throw Error(`Assessment policy contradicts the selected effect or subscription-only campaign budget`);let w=await se(a,n);if(n.loaded.graph.gates?.length&&[...S.cases,...w.cases].some(e=>e.gateChoices===void 0))throw Error(`Gated replay requires retained gate choices; reingest historical inputs before canonical assessment`);let T=await oe(),D=await x(),O=A({kind:`canonical-graph-profile-learning`,learning:await l(n,i,D),sourcePath:await N(t),implementation:T,executionEnvironment:D,assessment:{root:w.root,version:w.version}}),k=await c(O);if(k)return k;let j=n.retainedBaseline;if(!j)throw Error(`Canonical baseline needs a retained local train run of the exact current source to attest its served model`);let M=await ae(j.run,_.node,y,n.profileMaps),P=v(n,i),F=await d(S);await h({domain:_.domain,root:p,identity:O,evaluatorDigest:n.evaluatorIdentity,cases:S.cases});let I=await u(O),L=await f({domain:_.domain,root:p,identity:O,evaluatorDigest:n.evaluatorIdentity,stage:`assessment`,cases:[...S.cases,...w.cases]}),R={requestId:L.requestId,claimDigest:A({identity:O,domain:_.domain,objective:_.objective,assessment:C,evaluator:n.evaluatorIdentity}),populationId:_.domain,inputDigest:A([...w.cases].sort((e,t)=>e.id.localeCompare(t.id))),unitIds:w.cases.map(e=>e.unit),sourceDigests:w.cases.map(o),developmentSourceDigests:S.cases.filter(e=>e.split!==`test`).map(o)},z=await L.ledger.reserve(R);if(!z.succeeded)throw Error(`Final assessment refused: ${z.error.message}`);let B=z.value.record,V=s(n,new Map([...F,...await d(w)]),I.invocation),{agent:H,executionRef:ne,...U}=await m(n,i,O,{...I,judge:V},P);if(!H)throw Error(`Canonical profile search has no native executor`);let W=te(E(p,`artifacts`),`graph-profile-learning`),G=Buffer.from(JSON.stringify({evaluatorIdentity:n.evaluatorIdentity,evaluator:_.evaluator})),K={name:`independent-domain-evaluator`,version:n.evaluatorIdentity,format:`tangle-grader`,artifact:await W.put({executionId:`graph-profile:${O}`,purpose:`grader-evidence`,bytes:G})},q={kind:`agent-profile-improvement-execution-ref`,identity:`graph-profile:${_.node}:${O}`,digest:O},J=n.profileMaps?A({node:_.node,maps:n.profileMaps}):_.node,Y=`graph-profile:${g(await N(t))}:${J}`,X=ce(O,b),Z={kind:`native-graph-profile`,sourceIdentity:Y,sourceRevision:n.baselineDigest,sourceDigest:X({identity:Y,profile:y})},Q=w.cases.map(e=>({kind:`agent-profile-improvement-task`,digestAlgorithm:`rfc8785-sha256`,scenario:{id:e.id,kind:e.kind,digest:ee(e).scenarioDigest},grader:K,model:M.resolvedModel,limits:C.limits})),$=async()=>{throw new e(`GRAPH_PROFILE_MEASUREMENT_UNSUPPORTED`,`Full-profile final measurement is not available in this CLI`,`Canonical full-profile learning retains a hold until native runs report complete accounting`,`tangle graph improve --help`)},ue=await ie({runId:`graph-profile:${O}`,source:Z,profile:y,stateDigest:X,allowIncomplete:!0,budgetUsd:0,maxConcurrency:1,signal:I.signal,analysis:{registry:new re,inputs:{},findingsStore:null},improvement:U,benchmark:{tasks:Q,reps:_.reps,seeds:Q.flatMap((e,t)=>Array.from({length:_.reps},(e,n)=>t*_.reps+n)),policy:C.policy},executor:{executionRef:q,optimize:H,measure:$},modelBinding:$});try{return await le({result:ue,admission:n,campaign:I,fresh:w,file:t,suiteFile:r,identity:O,implementation:T,executionEnvironment:D,finalEvidence:B})}finally{await ue.improvement.dispose()}})}async function le(t){let{result:n,admission:i,campaign:a,fresh:o,file:s,suiteFile:c,identity:l,implementation:u,executionEnvironment:d,finalEvidence:f}=t,{root:p,suite:m,dataset:h,sourceForProfile:_}=i,v=_(n.improvement.candidate.profile),y=g(v),x=E(p,`${y}.graph.yaml`);await P(x,v,{mode:384,flush:!0});let{dispose:S,...C}=n.improvement,w={version:1,kind:`canonical-graph-profile-learning`,identity:l,implementation:u,executionEnvironment:d,sourcePath:await N(s),candidate:x,candidateDigest:y,baselineDigest:i.baselineDigest,node:m.node,...i.profileMaps&&{maps:i.profileMaps},dataset:{root:o.root,version:o.version},searchDataset:{root:h.root,version:h.version},finalEvidence:f,suite:await N(c),evaluatorIdentity:i.evaluatorIdentity,...i.evaluatorFunding&&{evaluatorFunding:i.evaluatorFunding},canonical:{...n,improvement:C}},T=async e=>{let t={...w,...e,campaignBudget:{limits:m.budget,readout:a.pool.readout()}},n=await b(p,t);return await r(E(p,`result.json`),{record:n}),{...t,record:n}};if(`status`in n&&n.status===`held`)return T({decision:`hold`,operational:{admissible:!1,reasons:n.reasons}});throw new e(`GRAPH_PROFILE_MEASUREMENT_UNSUPPORTED`,`Full-profile final measurement is not available in this CLI`,`Canonical full-profile learning retains a hold until native runs report complete accounting`,`tangle graph improve --help`)}export{Z as learnGraphProfile};
|