agent-contracts-runtime 0.36.18 → 0.36.19
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/cli-contract.yaml
CHANGED
|
@@ -995,7 +995,7 @@ Common options for all commands:
|
|
|
995
995
|
|
|
996
996
|
info:
|
|
997
997
|
title: agent-runtime CLI
|
|
998
|
-
version: 0.36.
|
|
998
|
+
version: 0.36.19
|
|
999
999
|
description: |
|
|
1000
1000
|
Runtime bridge for executing agent-contracts workflows on Agent SDKs.
|
|
1001
1001
|
Generates typed contracts, handoff validators, and guardrail hooks from DSL,
|
|
@@ -2105,7 +2105,7 @@ components:
|
|
|
2105
2105
|
"cli_contracts": "0.1.0",
|
|
2106
2106
|
"info": {
|
|
2107
2107
|
"title": "agent-runtime CLI",
|
|
2108
|
-
"version": "0.36.
|
|
2108
|
+
"version": "0.36.19",
|
|
2109
2109
|
"description": "Runtime bridge for executing agent-contracts workflows on Agent SDKs.\\nGenerates typed contracts, handoff validators, and guardrail hooks from DSL,\\nthen runs workflows through pluggable SDK adapters.\\n",
|
|
2110
2110
|
"license": {
|
|
2111
2111
|
"name": "MIT"
|
|
@@ -5123,7 +5123,7 @@ Focus the audit on the "${e.focus}" layer only.`:"",n=["Audit the LLM command in
|
|
|
5123
5123
|
`+"=".repeat(72)+`
|
|
5124
5124
|
|
|
5125
5125
|
`;return{status:"dry_run",exitCode:0,data:{summary:v.join(y),riskLevel:"low",findings:[]}}}let a=Cr(Fn(rr)),s;try{s=await Xme(e.adapter,r,e.model,a)}catch(h){return{status:"failed",exitCode:12,error:t.adapterError(h.message)}}console.error(t.auditStarting(e.adapter));let c={workflowRegistry:ul,taskRegistry:yo,agentRegistry:vo,handoffSchemas:_o},u={workflow:"audit-implementation",user_request:n,runtime:{maxFollowUps:2,maxRetries:1},hooks:{onGate:async()=>!0},context:{cwd:r},progressOutput:e.progressOutput},l=await tr(s,u,c);if(l.status!=="completed"){let h=l.escalation_reason??l.error_message??l.status;return{status:"failed",exitCode:1,error:t.auditFailed(h)}}let p=l.steps[l.steps.length-1]?.outcome?.data??{summary:t.auditSuccess,riskLevel:"low",findings:[]};return{status:"success",exitCode:Qme(p,e.failOn)?10:0,data:p}}var e0e={critical:"\u2717",error:"\u2717",warning:"!",info:"\xB7"};function pC(e){let t=tU();if(e.status==="dry_run")return e.data?.summary??t.dryRunHeader;if(e.status==="failed")return e.error??t.auditFailed("unknown");let r=e.data;if(!r)return t.auditSuccess;let i=[r.summary,""];if(i.push(t.riskLevel(r.riskLevel)),i.push(""),r.findings.length===0)i.push(t.noFindings);else{i.push(t.findingsHeader(r.findings.length));for(let n of r.findings){let o=e0e[n.severity]??"\xB7",a=n.id?`[${n.id}] `:"",s=n.target?` (${n.target})`:"";i.push(` ${o} ${a}${n.severity.toUpperCase()}: ${n.message}${s}`),n.recommendation&&i.push(` \u2192 ${n.recommendation}`)}i.push("")}if(r.recommendedActions&&r.recommendedActions.length>0){i.push(t.recommendedActionsHeader);for(let n of r.recommendedActions){let o=n.command?` \u2014 ${n.command}`:"";i.push(` [${n.kind}] ${n.title}${o}`)}}return i.join(`
|
|
5126
|
-
`)}var fi=ir(jr(),1);i0e();var o0e="0.36.
|
|
5126
|
+
`)}var fi=ir(jr(),1);i0e();var o0e="0.36.19";async function gC(e){let r=`${(await Nn(e)).generatedDir}/index`,i;if(yC(`${r}.js`))i=`${r}.js`;else if(yC(`${r}.ts`))i=`${r}.ts`;else throw new Error(`Generated index file not found at ${r}.{js,ts}. Run \`agent-runtime generate\` first.`);let n=await import(new URL(`file://${i}`).href),o=n.resolvedDsl,a=Cr(o?Fn(o):void 0);return{agentRegistry:n.agentRegistry??n.agents?.agentRegistry??{},taskRegistry:n.taskRegistry??n.tasks?.taskRegistry??{},handoffSchemas:n.handoffSchemas??n.handoffs?.handoffSchemas??{},workflowRegistry:n.workflowRegistry??n.workflows?.workflowRegistry??{},guardrailHooks:a,resolvedDsl:o}}async function a0e(e,t,r,i){switch(e){case"mock":{let{MockAdapter:n}=await Promise.resolve().then(()=>(sl(),Ch));return new n}case"claude":{let{ClaudeAgentSdkAdapter:n}=await Promise.resolve().then(()=>(Bh(),Ih));return new n({cwd:r,guardrailHooks:t,...i?{model:i}:{}})}case"openai":{let{OpenAIAgentsSdkAdapter:n}=await Promise.resolve().then(()=>(iU(),rU));return new n({guardrailHooks:t,...i?{model:i}:{}})}default:throw new Error(`Unknown adapter: ${e}. Available: mock, claude, openai`)}}function vC(e,t){let r=e.map((s,c)=>Math.max(s.length,...t.map(u=>(u[c]??"").length))),i=r.map(s=>"-".repeat(s)).join(" "),n=(s,c)=>s.padEnd(c),o=e.map((s,c)=>n(s,r[c])).join(" "),a=t.map(s=>s.map((c,u)=>n(c??"",r[u])).join(" "));return[o,i,...a].join(`
|
|
5127
5127
|
`)}function s0e(e,t,r,i){if(e)return nr({stderr:!r,file:Oh(e),naming:"single",label:i});if(t&&t.destination!=="none"){let n=t.destination;return nr({stderr:!r&&(n==="stderr"||n==="both"),file:n==="file"||n==="both"?t.file:void 0,naming:t.naming,label:i})}if(!r)return nr({stderr:!0})}var u0e={async init(e,t){try{let r=Oh(e.output??"."),i=await Hz({adapter:e.adapter??"mock",outputDir:r,force:e.force??!1});console.log(JSON.stringify(i,null,2))}catch(r){console.error(r.message),process.exit(1)}},async generate(e,t){try{let r=t.config??"./agents.conf.yaml",i=await vz({clean:e.clean,check:e.check,templates:e.templates,configPath:r});i.check_mode?(i.has_differences&&(console.error("Generated files are out of date. Run `agent-runtime generate` to update."),process.exit(1)),console.log(JSON.stringify({...i,status:"up-to-date"},null,2))):console.log(JSON.stringify(i,null,2))}catch(r){console.error("Generate failed:",r.message),process.exit(1)}},async run(e,t,r,i){let n=e,o=t,a;if(r.file)try{let F=r0e(r.file,"utf8"),H=fi.default.parse(F);n=H.workflow,n||(console.error(`Error: invocation file "${r.file}" must contain a "workflow" field.`),process.exit(3)),a={workflow:n,user_request:H.user_request,handoff:H.handoff,runtime:H.runtime,context:H.context},o=a.user_request??""}catch(F){console.error(`Failed to read invocation file: ${F.message}`),process.exit(3)}n||(console.error("Error: workflow-id is required (provide as argument or via --file)"),process.exit(3)),!a&&!o&&(console.error("Error: user-request is required (provide as argument or via --file)"),process.exit(3));let s=i.config??"./agents.conf.yaml";await vh(s)||(console.error("Generated files are stale or missing. Run `agent-runtime generate` first."),process.exit(3));let u=await Nn(s),l=await Sh({pluginPaths:u.pluginPaths.length>0?u.pluginPaths:void 0,projectDir:u.configDir});l.loaded>0&&!i.quiet&&console.error(`Loaded ${l.loaded} plugin(s) from ${l.files.length} file(s)`);for(let F of l.errors)console.error(`Plugin load error (${F.file}): ${F.error}`);let d;try{d=await gC(s)}catch(F){console.error(`Failed to load generated contracts: ${F.message}`),process.exit(1);return}if(!d.workflowRegistry[n]){console.error(`Unknown workflow: ${n}`),console.error(`Available workflows: ${Object.keys(d.workflowRegistry).join(", ")}`),process.exit(3);return}let f=u.artifactBinding||u.bindingPaths.length>0,p={workflowRegistry:d.workflowRegistry,taskRegistry:d.taskRegistry,agentRegistry:d.agentRegistry,handoffSchemas:d.handoffSchemas},m=d.guardrailHooks;if(f){let{BoundResolver:F,getGuardrailRulesForComponent:H}=await Promise.resolve().then(()=>(il(),uz)),ie=d.resolvedDsl??rr,ue=await new F().resolve({id:u.configDir,embeddedDsl:ie,bindingPaths:u.bindingPaths.length>0?u.bindingPaths:void 0,activeGuardrailPolicy:u.active_guardrail_policy,artifactBinding:u.artifactBinding,paths:u.paths});p=ue.registries,m=Cr(H(ue,ue.dsl))}if(r.showPrompt){let{workflowRegistry:F,taskRegistry:H,agentRegistry:ie,handoffSchemas:ue}=p,se={user_request:o??""};return F[n].steps.flatMap(me=>me.type==="delegate"?[H[me.task]]:[]).map(me=>er(ie[me.target_agent],me,se,{handoffSchemas:ue})).join(`
|
|
5128
5128
|
|
|
5129
5129
|
`+"=".repeat(72)+`
|