@aaac/runtime 0.1.53 → 0.1.54

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.
Files changed (36) hide show
  1. package/dist/adapters/adk-sdk.d.ts +1 -1
  2. package/dist/adapters/adk-sdk.js +1 -1
  3. package/dist/adapters/claude-agent-sdk.d.ts +1 -1
  4. package/dist/adapters/mock.d.ts +1 -1
  5. package/dist/adapters/openai-agents-sdk.d.ts +1 -1
  6. package/dist/{chunk-YZQRSVDZ.js → chunk-3H3PVPPF.js} +198 -4
  7. package/dist/chunk-3H3PVPPF.js.map +1 -0
  8. package/dist/chunk-LDCQZPDG.js +11 -0
  9. package/dist/chunk-LDCQZPDG.js.map +1 -0
  10. package/dist/{chunk-M3GJAHLX.js → chunk-N4KNGDYY.js} +343 -28
  11. package/dist/chunk-N4KNGDYY.js.map +1 -0
  12. package/dist/{chunk-EH5VFZYJ.js → chunk-NMX4C6LC.js} +6 -2
  13. package/dist/chunk-NMX4C6LC.js.map +1 -0
  14. package/dist/{chunk-KNYJV2Q6.js → chunk-QVH5KKBR.js} +5 -9
  15. package/dist/chunk-QVH5KKBR.js.map +1 -0
  16. package/dist/claude-bundles/full.js +223 -217
  17. package/dist/claude-bundles/lean.js +5 -5
  18. package/dist/generator/index.d.ts +2 -286
  19. package/dist/generator/index.js +1 -1
  20. package/dist/index-LqEvaRk-.d.ts +299 -0
  21. package/dist/index.d.ts +29 -17
  22. package/dist/index.js +75 -414
  23. package/dist/index.js.map +1 -1
  24. package/dist/lib/claude-native/hooks-lite.d.ts +18 -325
  25. package/dist/lib/claude-native/hooks-lite.js +8 -2
  26. package/dist/lib/claude-native/index.d.ts +153 -20
  27. package/dist/lib/claude-native/index.js +162 -37
  28. package/dist/lib/claude-native/index.js.map +1 -1
  29. package/dist/{navigation-context-xrReMkTn.d.ts → navigation-context-D_E1NIUf.d.ts} +11 -3
  30. package/dist/{task-runner-Sez_CXcD.d.ts → task-runner-CLc8iTzy.d.ts} +5 -8
  31. package/dist/workspace-pre-tool-use-C6nidc0q.d.ts +333 -0
  32. package/package.json +1 -1
  33. package/dist/chunk-EH5VFZYJ.js.map +0 -1
  34. package/dist/chunk-KNYJV2Q6.js.map +0 -1
  35. package/dist/chunk-M3GJAHLX.js.map +0 -1
  36. package/dist/chunk-YZQRSVDZ.js.map +0 -1
@@ -1,6 +1,6 @@
1
- "use strict";var __aaac_runtime=(()=>{var v=Object.defineProperty;var X=Object.getOwnPropertyDescriptor;var z=Object.getOwnPropertyNames;var Q=Object.prototype.hasOwnProperty;var k=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var Y=(e,t)=>{for(var r in t)v(e,r,{get:t[r],enumerable:!0})},Z=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of z(t))!Q.call(e,a)&&a!==r&&v(e,a,{get:()=>t[a],enumerable:!(n=X(t,a))||n.enumerable});return e};var ee=e=>Z(v({},"__esModule",{value:!0}),e);var de={};Y(de,{TimeoutError:()=>w,buildAllowResponse:()=>p,buildContextResponse:()=>j,buildDenyResponse:()=>h,computeSourceHash:()=>N,createCacheStore:()=>S,createExclusiveLock:()=>M,createPreToolUseHandler:()=>L,createWorkspacePreToolUseHandler:()=>J,emitHookOutput:()=>D,isProtectedArtifact:()=>P,listArtifacts:()=>q,parseHookInput:()=>R,readHookInput:()=>W,resolvePathToArtifacts:()=>b,routePathToMember:()=>y,stripMemberPrefix:()=>H,withDegrade:()=>U,withTimeout:()=>x});var te=class{plugins=[];register(e){if(this.plugins.some(t=>t.id===e.id))throw new Error(`Plugin "${e.id}" is already registered`);this.plugins.push(e)}getAll(){return this.plugins}async runBeforeTask(e,t){let r=t;for(let n of this.plugins)!n.beforeTask||r===null||(r=await n.beforeTask(e,r));return r}async runAfterTask(e,t){let r=t;for(let n of this.plugins)n.afterTask&&(r=await n.afterTask(e,r));return r}applyContextEnhancers(e,t){let r=t;for(let n of this.plugins)n.contextEnhancer&&(r=n.contextEnhancer(e,r));return r}applyPromptBuilder(e){for(let t of this.plugins){if(!t.promptBuilder)continue;let r=t.promptBuilder(e);if(r!==null)return r}return null}applyPromptEnhancers(e,t,r){let n=t;for(let a of this.plugins)a.promptEnhancer&&(n=a.promptEnhancer(e,n,r));return n}evaluateCommandGuardrails(e){let t=[];for(let r of this.plugins)r.customGuardrails?.evaluateCommand&&t.push(...r.customGuardrails.evaluateCommand(e));return t}evaluateFilePathGuardrails(e){let t=[];for(let r of this.plugins)r.customGuardrails?.evaluateFilePath&&t.push(...r.customGuardrails.evaluateFilePath(e));return t}evaluateFileContentGuardrails(e,t){let r=[];for(let n of this.plugins)n.customGuardrails?.evaluateFileContent&&r.push(...n.customGuardrails.evaluateFileContent(e,t));return r}async runBeforeWorkflow(e,t){for(let r of this.plugins)r.beforeWorkflow&&await r.beforeWorkflow(e,t)}async runAfterWorkflow(e,t){for(let r of this.plugins)r.afterWorkflow&&await r.afterWorkflow(e,t)}},E=new te;function re(e){let t="";for(let r of e)r==="*"?t+="[^/]*":r==="?"?t+="[^/]":".+^$|()[]\\".includes(r)?t+="\\"+r:t+=r;return t}function m(e,t){let r="",n=0;for(;n<e.length;)if(e[n]==="*"&&e[n+1]==="*"&&e[n+2]==="/")r+="(?:.+/)?",n+=3;else if(e[n]==="*"&&e[n+1]==="*")r+=".*",n+=2;else if(e[n]==="*")r+="[^/]*",n+=1;else if(e[n]==="?")r+="[^/]",n+=1;else if(e[n]==="{"){let a=e.indexOf("}",n);if(a!==-1){let o=e.slice(n+1,a).split(",").map(re);r+="(?:"+o.join("|")+")",n=a+1}else r+="\\{",n+=1}else".+^$|()[]\\".includes(e[n])?(r+="\\"+e[n],n+=1):(r+=e[n],n+=1);return new RegExp("^"+r+"$").test(t)}function T(e){return e.filter(t=>!t.passed&&t.action==="block")}function ne(e){return e.filter(t=>!t.passed&&t.action==="warn")}function C(e){return{guardrail_id:e.guardrail_id,passed:!e.matched,action:e.action,message:e.matched?e.message:""}}function oe(e){function t(o){let s=[];return o.command&&(s.push(...e.checkCommand(o.command)),s.push(...E.evaluateCommandGuardrails(o.command).map(C))),o.filePath&&(s.push(...e.checkFilePath(o.filePath)),s.push(...E.evaluateFilePathGuardrails(o.filePath).map(C))),o.filePath&&o.content&&(s.push(...e.checkContent(o.filePath,o.content)),s.push(...E.evaluateFileContentGuardrails(o.filePath,o.content).map(C))),s}function r(o){let s=o.command??"";if(!s)return{};let i=t({command:s}),u=T(i),c=ne(i);if(u.length>0){let l=u.map(f=>`[${f.guardrail_id}] ${f.message}`).join(`
1
+ "use strict";var __aaac_runtime=(()=>{var C=Object.defineProperty;var Q=Object.getOwnPropertyDescriptor;var Y=Object.getOwnPropertyNames;var Z=Object.prototype.hasOwnProperty;var k=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var ee=(e,t)=>{for(var r in t)C(e,r,{get:t[r],enumerable:!0})},te=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Y(t))!Z.call(e,n)&&n!==r&&C(e,n,{get:()=>t[n],enumerable:!(o=Q(t,n))||o.enumerable});return e};var re=e=>te(C({},"__esModule",{value:!0}),e);var pe={};ee(pe,{GUARDRAIL_CACHE_SUFFIX:()=>E,TimeoutError:()=>b,buildAllowResponse:()=>p,buildContextResponse:()=>I,buildDenyResponse:()=>h,computeSourceHash:()=>M,createCacheStore:()=>F,createExclusiveLock:()=>q,createPreToolUseHandler:()=>J,createWorkspacePreToolUseHandler:()=>V,emitHookOutput:()=>B,guardrailCacheKey:()=>y,isProtectedArtifact:()=>v,listArtifacts:()=>K,parseHookInput:()=>S,readHookInput:()=>j,resolvePathToArtifacts:()=>P,routePathToMember:()=>w,stripMemberPrefix:()=>A,withDegrade:()=>L,withTimeout:()=>H});var E=".guardrails";function y(e){return`${e}${E}`}var ne=class{plugins=[];register(e){if(this.plugins.some(t=>t.id===e.id))throw new Error(`Plugin "${e.id}" is already registered`);this.plugins.push(e)}getAll(){return this.plugins}async runBeforeTask(e,t){let r=t;for(let o of this.plugins)!o.beforeTask||r===null||(r=await o.beforeTask(e,r));return r}async runAfterTask(e,t){let r=t;for(let o of this.plugins)o.afterTask&&(r=await o.afterTask(e,r));return r}applyContextEnhancers(e,t){let r=t;for(let o of this.plugins)o.contextEnhancer&&(r=o.contextEnhancer(e,r));return r}applyPromptBuilder(e){for(let t of this.plugins){if(!t.promptBuilder)continue;let r=t.promptBuilder(e);if(r!==null)return r}return null}applyPromptEnhancers(e,t,r){let o=t;for(let n of this.plugins)n.promptEnhancer&&(o=n.promptEnhancer(e,o,r));return o}evaluateCommandGuardrails(e){let t=[];for(let r of this.plugins)r.customGuardrails?.evaluateCommand&&t.push(...r.customGuardrails.evaluateCommand(e));return t}evaluateFilePathGuardrails(e){let t=[];for(let r of this.plugins)r.customGuardrails?.evaluateFilePath&&t.push(...r.customGuardrails.evaluateFilePath(e));return t}evaluateFileContentGuardrails(e,t){let r=[];for(let o of this.plugins)o.customGuardrails?.evaluateFileContent&&r.push(...o.customGuardrails.evaluateFileContent(e,t));return r}async runBeforeWorkflow(e,t){for(let r of this.plugins)r.beforeWorkflow&&await r.beforeWorkflow(e,t)}async runAfterWorkflow(e,t){for(let r of this.plugins)r.afterWorkflow&&await r.afterWorkflow(e,t)}},T=new ne;function oe(e){let t="";for(let r of e)r==="*"?t+="[^/]*":r==="?"?t+="[^/]":".+^$|()[]\\".includes(r)?t+="\\"+r:t+=r;return t}function ae(e){return e.endsWith("/")?`${e}**`:e}function m(e,t){let r=ae(e),o="",n=0;for(;n<r.length;)if(r[n]==="*"&&r[n+1]==="*"&&r[n+2]==="/")o+="(?:.+/)?",n+=3;else if(r[n]==="*"&&r[n+1]==="*")o+=".*",n+=2;else if(r[n]==="*")o+="[^/]*",n+=1;else if(r[n]==="?")o+="[^/]",n+=1;else if(r[n]==="{"){let a=r.indexOf("}",n);if(a!==-1){let s=r.slice(n+1,a).split(",").map(oe);o+="(?:"+s.join("|")+")",n=a+1}else o+="\\{",n+=1}else".+^$|()[]\\".includes(r[n])?(o+="\\"+r[n],n+=1):(o+=r[n],n+=1);return new RegExp("^"+o+"$").test(t)}function O(e){return e.filter(t=>!t.passed&&t.action==="block")}function se(e){return e.filter(t=>!t.passed&&t.action==="warn")}function R(e){return{guardrail_id:e.guardrail_id,passed:!e.matched,action:e.action,message:e.matched?e.message:""}}function ie(e){function t(a){let s=[];return a.command&&(s.push(...e.checkCommand(a.command)),s.push(...T.evaluateCommandGuardrails(a.command).map(R))),a.filePath&&(s.push(...e.checkFilePath(a.filePath)),s.push(...T.evaluateFilePathGuardrails(a.filePath).map(R))),a.filePath&&a.content&&(s.push(...e.checkContent(a.filePath,a.content)),s.push(...T.evaluateFileContentGuardrails(a.filePath,a.content).map(R))),s}function r(a){let s=a.command??"";if(!s)return{};let i=t({command:s}),u=O(i),c=se(i);if(u.length>0){let l=u.map(f=>`[${f.guardrail_id}] ${f.message}`).join(`
2
2
  `);return{permission:"deny",user_message:l,agent_message:l}}return c.length>0?{additionalContext:c.map(l=>`[${l.guardrail_id}] ${l.message}`).join(`
3
- `)}:{}}function n(o){let s=o.tool_input?.file_path??o.tool_input?.path??"";if(!s)return{};let i=t({filePath:s}),u=T(i);if(u.length>0){let c=u.map(l=>`[${l.guardrail_id}] ${l.message}`).join(`
4
- `);return{permission:"deny",user_message:c,agent_message:c}}return{}}function a(o){let s=o.file_path??"",i=o.content??"";if(!s)return{};let u=t({filePath:s,content:i}),c=T(u);if(c.length>0){let l=c.map(f=>`[${f.guardrail_id}] ${f.message}`).join(`
5
- `);return{permission:"deny",user_message:l,agent_message:l}}return{}}return{beforeShellExecution:r,preToolUse:n,afterFileEdit:a,runChecks:t}}function A(e){return e.startsWith("(?i)")?new RegExp(e.slice(4),"i"):new RegExp(e)}function O(e){let t=e.commandRules.map(a=>({guardrail_id:a.guardrail_id,pattern:A(a.pattern),action:a.action,message:a.message})),r=e.fileRules,n=e.contentRules.map(a=>({guardrail_id:a.guardrail_id,pattern:A(a.pattern),action:a.action,message:a.message,file_glob:a.file_glob,exclude_glob:a.exclude_glob}));return oe({checkCommand(a){let o=[];for(let s of t){let i=!s.pattern.test(a);o.push({guardrail_id:s.guardrail_id,passed:i,action:s.action,message:i?"":s.message})}return o},checkFilePath(a){let o=[];for(let s of r){if(s.exclude_glob&&m(s.exclude_glob,a))continue;let i=m(s.pattern,a);o.push({guardrail_id:s.guardrail_id,passed:!i,action:s.action,message:i?s.message:""})}return o},checkContent(a,o){let s=[];for(let i of n){if(i.file_glob&&!m(i.file_glob,a)||i.exclude_glob&&m(i.exclude_glob,a))continue;let u=i.pattern.test(o);s.push({guardrail_id:i.guardrail_id,passed:!u,action:i.action,message:u?i.message:""})}return s}})}var d=k("fs/promises"),B=k("path"),I=k("crypto"),F=k("path");function R(e){let t=JSON.parse(e);return typeof t.hook_event_name=="string"&&t.hookEventName===void 0&&(t.hookEventName=t.hook_event_name),t}async function W(){let e=[];for await(let r of process.stdin)e.push(Buffer.isBuffer(r)?r:Buffer.from(r));let t=Buffer.concat(e).toString("utf-8").trim();if(!t)throw new Error("Empty stdin \u2014 no hook input received");return R(t)}function D(e){process.stdout.write(JSON.stringify(e)+`
6
- `)}function j(e,t){return{hookSpecificOutput:{hookEventName:e,additionalContext:t}}}function h(e){return{hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:e}}}function p(){return{}}function S(e){let{cacheDir:t}=e;function r(o){return(0,B.join)(t,`${o}.json`)}async function n(){await(0,d.mkdir)(t,{recursive:!0})}let a={async read(o){try{let s=await(0,d.readFile)(r(o),"utf-8");return JSON.parse(s)}catch{return null}},async write(o,s,i){await n();let u={data:s,writtenAt:new Date().toISOString(),sourceHash:i},c=JSON.stringify(u,null,2),l=r(o),f=`${l}.${(0,I.randomBytes)(4).toString("hex")}.tmp`;await(0,d.writeFile)(f,c,"utf-8");try{await(0,d.rename)(f,l)}catch{await(0,d.writeFile)(l,c,"utf-8")}},async readIfFresh(o,s){let i=await a.read(o);return!i||i.sourceHash!==s?null:i.data},async getFileMtime(o){try{return(await(0,d.stat)(o)).mtimeMs}catch{return null}}};return a}function N(e){return e.map(String).join(":")}var w=class extends Error{constructor(e){super(`Operation timed out after ${e}ms`),this.name="TimeoutError"}};async function x(e,t){if(t<=0)return e;let r,n=new Promise((a,o)=>{r=setTimeout(()=>o(new w(t)),t)});try{return await Promise.race([e,n])}finally{clearTimeout(r)}}function M(){let e=null;return{async run(t){return e||(e=t().finally(()=>{e=null}),e)}}}async function U(e,t,r){try{return{value:await x(e(),r),degraded:!1}}catch(n){let a=n instanceof w||n instanceof Error?n.message:String(n);return{value:t,degraded:!0,reason:a}}}function b(e,t){let r=t.artifacts??{},n=[];for(let[a,o]of Object.entries(r)){let s=o?.files?.path_patterns;if(Array.isArray(s)){for(let i of s)if(typeof i=="string"&&m(i,e)){n.push({artifactId:a,artifact:o,matchedPattern:i});break}}}return n}function P(e){let t=e.artifact.properties??{};if(t.authority==="generated"){let r=e.artifact.routes?.regenerate,n=r?` Run '${r}' to regenerate.`:" Edit the source artifact and regenerate instead.";return{protected:!0,reason:`File belongs to generated artifact '${e.artifactId}'. Direct editing is not allowed.${n}`}}return t.manual_edit==="forbidden"?{protected:!0,reason:`File belongs to artifact '${e.artifactId}' which has manual_edit: forbidden. This artifact must not be edited directly.`}:{protected:!1,reason:""}}function q(e){let t=e.artifacts??{};return Object.entries(t).map(([r,n])=>({id:r,artifact:n}))}var se=new Set(["Edit","Write","MultiEdit","edit","write"]),ae=new Set(["Bash","bash","Terminal","terminal"]);function L(e){let t=e.guardrailRules?O(e.guardrailRules):null;return async function(n){let a=n.tool_name??"",o=n.tool_input??{};if(se.has(a)){let s=o.file_path??o.path??"";if(s){let i=b(s,e.navigationIndex);for(let u of i){let c=P(u);if(c.protected)return h(c.reason)}}}if(ae.has(a)&&t){let s=o.command??"";if(s){let i=t.beforeShellExecution({command:s});if(i.permission==="deny")return h(i.user_message??"Command blocked by guardrail")}}return p()}}function y(e,t,r){if(!e)return null;let n=e.startsWith("/")?e:(0,F.resolve)(r,e),a=null,o=0;for(let s of t){let i=s.root,u=i.endsWith("/")?i:i+"/";n.startsWith(u)&&u.length>o&&(a=s,o=u.length)}return a}function H(e,t,r){let n=e.startsWith("/")?e:(0,F.resolve)(r,e),a=t.endsWith("/")?t:t+"/";return n.startsWith(a)?n.slice(a.length):e}var ie=".guardrails";function ce(e){return`${e}${ie}`}var ue=new Set(["Edit","Write","MultiEdit","edit","write"]),le=new Set(["Bash","bash","Terminal","terminal"]);function fe(e){let t=[];for(let r of e.split(/\s+/)){let n=r.replace(/^['"]+|['"]+$/g,"");n&&(n.includes("/")||n.includes("\\"))&&t.push(n)}return t}function J(e){let t=S({cacheDir:e.cacheDir}),r=new Map;async function n(o){let s=o.name;if(r.has(s))return r.get(s)??null;let i=o.guardrailCacheKey??ce(o.cacheKey),c=(await t.read(i))?.data,l=c&&(c.commandRules.length>0||c.fileRules.length>0||c.contentRules.length>0)?O(c):null;return r.set(s,l),l}function a(o){for(let s of fe(o)){let i=y(s,e.members,e.workspaceRoot);if(i)return[i]}return e.members}return async function(s){let i=s.tool_name??"",u=s.tool_input??{};if(le.has(i)){let g=u.command??"";if(!g)return p();for(let _ of a(g)){let $=await n(_);if(!$)continue;let G=$.beforeShellExecution({command:g});if(G.permission==="deny")return h(G.user_message??"Command blocked by guardrail")}return p()}if(!ue.has(i))return p();let c=u.file_path??u.path??"";if(!c)return p();let l=y(c,e.members,e.workspaceRoot);if(!l)return p();let f=await t.read(l.cacheKey);if(!f)return p();let K=H(c,l.root,e.workspaceRoot),V=b(K,f.data);for(let g of V){let _=P(g);if(_.protected)return h(_.reason)}return p()}}return ee(de);})();
3
+ `)}:{}}function o(a){let s=a.tool_input?.file_path??a.tool_input?.path??"";if(!s)return{};let i=t({filePath:s}),u=O(i);if(u.length>0){let c=u.map(l=>`[${l.guardrail_id}] ${l.message}`).join(`
4
+ `);return{permission:"deny",user_message:c,agent_message:c}}return{}}function n(a){let s=a.file_path??"",i=a.content??"";if(!s)return{};let u=t({filePath:s,content:i}),c=O(u);if(c.length>0){let l=c.map(f=>`[${f.guardrail_id}] ${f.message}`).join(`
5
+ `);return{permission:"deny",user_message:l,agent_message:l}}return{}}return{beforeShellExecution:r,preToolUse:o,afterFileEdit:n,runChecks:t}}function W(e){return e.startsWith("(?i)")?new RegExp(e.slice(4),"i"):new RegExp(e)}function x(e){let t=e.commandRules.map(n=>({guardrail_id:n.guardrail_id,pattern:W(n.pattern),action:n.action,message:n.message})),r=e.fileRules,o=e.contentRules.map(n=>({guardrail_id:n.guardrail_id,pattern:W(n.pattern),action:n.action,message:n.message,file_glob:n.file_glob,exclude_glob:n.exclude_glob}));return ie({checkCommand(n){let a=[];for(let s of t){let i=!s.pattern.test(n);a.push({guardrail_id:s.guardrail_id,passed:i,action:s.action,message:i?"":s.message})}return a},checkFilePath(n){let a=[];for(let s of r){if(s.exclude_glob&&m(s.exclude_glob,n))continue;let i=m(s.pattern,n);a.push({guardrail_id:s.guardrail_id,passed:!i,action:s.action,message:i?s.message:""})}return a},checkContent(n,a){let s=[];for(let i of o){if(i.file_glob&&!m(i.file_glob,n)||i.exclude_glob&&m(i.exclude_glob,n))continue;let u=i.pattern.test(a);s.push({guardrail_id:i.guardrail_id,passed:!u,action:i.action,message:u?i.message:""})}return s}})}var d=k("fs/promises"),N=k("path"),U=k("crypto"),$=k("path");function S(e){let t=JSON.parse(e);return typeof t.hook_event_name=="string"&&t.hookEventName===void 0&&(t.hookEventName=t.hook_event_name),t}async function j(){let e=[];for await(let r of process.stdin)e.push(Buffer.isBuffer(r)?r:Buffer.from(r));let t=Buffer.concat(e).toString("utf-8").trim();if(!t)throw new Error("Empty stdin \u2014 no hook input received");return S(t)}function B(e){process.stdout.write(JSON.stringify(e)+`
6
+ `)}function I(e,t){return{hookSpecificOutput:{hookEventName:e,additionalContext:t}}}function h(e){return{hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:e}}}function p(){return{}}function F(e){let{cacheDir:t}=e;function r(a){return(0,N.join)(t,`${a}.json`)}async function o(){await(0,d.mkdir)(t,{recursive:!0})}let n={async read(a){try{let s=await(0,d.readFile)(r(a),"utf-8");return JSON.parse(s)}catch{return null}},async write(a,s,i){await o();let u={data:s,writtenAt:new Date().toISOString(),sourceHash:i},c=JSON.stringify(u,null,2),l=r(a),f=`${l}.${(0,U.randomBytes)(4).toString("hex")}.tmp`;await(0,d.writeFile)(f,c,"utf-8");try{await(0,d.rename)(f,l)}catch{await(0,d.writeFile)(l,c,"utf-8")}},async readIfFresh(a,s){let i=await n.read(a);return!i||i.sourceHash!==s?null:i.data},async getFileMtime(a){try{return(await(0,d.stat)(a)).mtimeMs}catch{return null}}};return n}function M(e){return e.map(String).join(":")}var b=class extends Error{constructor(e){super(`Operation timed out after ${e}ms`),this.name="TimeoutError"}};async function H(e,t){if(t<=0)return e;let r,o=new Promise((n,a)=>{r=setTimeout(()=>a(new b(t)),t)});try{return await Promise.race([e,o])}finally{clearTimeout(r)}}function q(){let e=null;return{async run(t){return e||(e=t().finally(()=>{e=null}),e)}}}async function L(e,t,r){try{return{value:await H(e(),r),degraded:!1}}catch(o){let n=o instanceof b||o instanceof Error?o.message:String(o);return{value:t,degraded:!0,reason:n}}}function P(e,t){let r=t.artifacts??{},o=[];for(let[n,a]of Object.entries(r)){let s=a?.files?.path_patterns;if(Array.isArray(s)){for(let i of s)if(typeof i=="string"&&m(i,e)){o.push({artifactId:n,artifact:a,matchedPattern:i});break}}}return o}function v(e){let t=e.artifact.properties??{};if(t.authority==="generated"){let r=e.artifact.routes?.regenerate,o=r?` Run '${r}' to regenerate.`:" Edit the source artifact and regenerate instead.";return{protected:!0,reason:`File belongs to generated artifact '${e.artifactId}'. Direct editing is not allowed.${o}`}}return t.manual_edit==="forbidden"?{protected:!0,reason:`File belongs to artifact '${e.artifactId}' which has manual_edit: forbidden. This artifact must not be edited directly.`}:{protected:!1,reason:""}}function K(e){let t=e.artifacts??{};return Object.entries(t).map(([r,o])=>({id:r,artifact:o}))}var ce=new Set(["Edit","Write","MultiEdit","edit","write"]),ue=new Set(["Bash","bash","Terminal","terminal"]);function J(e){let t=e.guardrailRules?x(e.guardrailRules):null;return async function(o){let n=o.tool_name??"",a=o.tool_input??{};if(ce.has(n)){let s=a.file_path??a.path??"";if(s){let i=P(s,e.navigationIndex);for(let u of i){let c=v(u);if(c.protected)return h(c.reason)}}}if(ue.has(n)&&t){let s=a.command??"";if(s){let i=t.beforeShellExecution({command:s});if(i.permission==="deny")return h(i.user_message??"Command blocked by guardrail")}}return p()}}function w(e,t,r){if(!e)return null;let o=e.startsWith("/")?e:(0,$.resolve)(r,e),n=null,a=0;for(let s of t){let i=s.root,u=i.endsWith("/")?i:i+"/";o.startsWith(u)&&u.length>a&&(n=s,a=u.length)}return n}function A(e,t,r){let o=e.startsWith("/")?e:(0,$.resolve)(r,e),n=t.endsWith("/")?t:t+"/";return o.startsWith(n)?o.slice(n.length):e}var le=new Set(["Edit","Write","MultiEdit","edit","write"]),fe=new Set(["Bash","bash","Terminal","terminal"]);function de(e){let t=[];for(let r of e.split(/\s+/)){let o=r.replace(/^['"]+|['"]+$/g,"");o&&(o.includes("/")||o.includes("\\"))&&t.push(o)}return t}function V(e){let t=F({cacheDir:e.cacheDir}),r=new Map;async function o(a){let s=a.name;if(r.has(s))return r.get(s)??null;let i=a.guardrailCacheKey??y(a.cacheKey),c=(await t.read(i))?.data,l=c&&(c.commandRules.length>0||c.fileRules.length>0||c.contentRules.length>0)?x(c):null;return r.set(s,l),l}function n(a){for(let s of de(a)){let i=w(s,e.members,e.workspaceRoot);if(i)return[i]}return e.members}return async function(s){let i=s.tool_name??"",u=s.tool_input??{};if(fe.has(i)){let g=u.command??"";if(!g)return p();for(let _ of n(g)){let G=await o(_);if(!G)continue;let D=G.beforeShellExecution({command:g});if(D.permission==="deny")return h(D.user_message??"Command blocked by guardrail")}return p()}if(!le.has(i))return p();let c=u.file_path??u.path??"";if(!c)return p();let l=w(c,e.members,e.workspaceRoot);if(!l)return p();let f=await t.read(l.cacheKey);if(!f)return p();let X=A(c,l.root,e.workspaceRoot),z=P(X,f.data);for(let g of z){let _=v(g);if(_.protected)return h(_.reason)}return p()}}return re(pe);})();
@@ -1,287 +1,3 @@
1
- import { z } from 'zod';
1
+ export { C as ComponentOverride, a as ComponentOverrideSchema, D as DEFAULT_CONFIG_PATH, b as ProjectConfig, c as ProjectConfigSchema, R as ResolvedConfig, d as ResolvedEnvironments, l as loadProjectConfig } from '../index-LqEvaRk-.js';
2
2
  export { b as buildGuardrailContext } from '../context-DKkamYX_.js';
3
-
4
- /**
5
- * Generator configuration — loads and validates agents.conf.yaml
6
- */
7
-
8
- declare const DEFAULT_CONFIG_PATH = "./agents.conf.yaml";
9
- declare const RuntimeConfigSchema: z.ZodObject<{
10
- dsl: z.ZodDefault<z.ZodString>;
11
- generated_dir: z.ZodDefault<z.ZodString>;
12
- bindings: z.ZodDefault<z.ZodArray<z.ZodString>>;
13
- active_guardrail_policy: z.ZodOptional<z.ZodString>;
14
- templates_dir: z.ZodOptional<z.ZodString>;
15
- plugins: z.ZodDefault<z.ZodArray<z.ZodString>>;
16
- recovery: z.ZodDefault<z.ZodObject<{
17
- max_follow_ups: z.ZodDefault<z.ZodNumber>;
18
- max_retries: z.ZodDefault<z.ZodNumber>;
19
- }, z.core.$strip>>;
20
- model_mapping: z.ZodDefault<z.ZodObject<{
21
- fast: z.ZodOptional<z.ZodObject<{
22
- adapter: z.ZodString;
23
- model: z.ZodOptional<z.ZodString>;
24
- }, z.core.$strip>>;
25
- standard: z.ZodOptional<z.ZodObject<{
26
- adapter: z.ZodString;
27
- model: z.ZodOptional<z.ZodString>;
28
- }, z.core.$strip>>;
29
- thinking: z.ZodOptional<z.ZodObject<{
30
- adapter: z.ZodString;
31
- model: z.ZodOptional<z.ZodString>;
32
- }, z.core.$strip>>;
33
- }, z.core.$strip>>;
34
- logging: z.ZodDefault<z.ZodObject<{
35
- progress_log: z.ZodDefault<z.ZodObject<{
36
- destination: z.ZodDefault<z.ZodEnum<{
37
- file: "file";
38
- both: "both";
39
- stderr: "stderr";
40
- none: "none";
41
- }>>;
42
- file: z.ZodOptional<z.ZodString>;
43
- naming: z.ZodDefault<z.ZodEnum<{
44
- single: "single";
45
- "per-invocation": "per-invocation";
46
- daily: "daily";
47
- }>>;
48
- }, z.core.$strip>>;
49
- }, z.core.$strip>>;
50
- }, z.core.$strip>;
51
- type RuntimeConfig = z.infer<typeof RuntimeConfigSchema>;
52
- declare const ComponentOverrideSchema: z.ZodObject<{
53
- agents: z.ZodOptional<z.ZodString>;
54
- dsl: z.ZodOptional<z.ZodString>;
55
- component_contract: z.ZodOptional<z.ZodString>;
56
- generated_dir: z.ZodOptional<z.ZodString>;
57
- bindings: z.ZodOptional<z.ZodObject<{
58
- guardrail: z.ZodOptional<z.ZodArray<z.ZodString>>;
59
- hooks: z.ZodOptional<z.ZodArray<z.ZodString>>;
60
- observability: z.ZodOptional<z.ZodObject<{
61
- event_mapping: z.ZodOptional<z.ZodString>;
62
- recorder: z.ZodOptional<z.ZodString>;
63
- enabled: z.ZodOptional<z.ZodBoolean>;
64
- db_path: z.ZodOptional<z.ZodString>;
65
- otel: z.ZodOptional<z.ZodObject<{
66
- endpoint: z.ZodString;
67
- }, z.core.$strip>>;
68
- }, z.core.$strip>>;
69
- }, z.core.$strip>>;
70
- plugins: z.ZodOptional<z.ZodArray<z.ZodString>>;
71
- model_mapping: z.ZodOptional<z.ZodDefault<z.ZodObject<{
72
- fast: z.ZodOptional<z.ZodObject<{
73
- adapter: z.ZodString;
74
- model: z.ZodOptional<z.ZodString>;
75
- }, z.core.$strip>>;
76
- standard: z.ZodOptional<z.ZodObject<{
77
- adapter: z.ZodString;
78
- model: z.ZodOptional<z.ZodString>;
79
- }, z.core.$strip>>;
80
- thinking: z.ZodOptional<z.ZodObject<{
81
- adapter: z.ZodString;
82
- model: z.ZodOptional<z.ZodString>;
83
- }, z.core.$strip>>;
84
- }, z.core.$strip>>>;
85
- recovery: z.ZodOptional<z.ZodDefault<z.ZodObject<{
86
- max_follow_ups: z.ZodDefault<z.ZodNumber>;
87
- max_retries: z.ZodDefault<z.ZodNumber>;
88
- }, z.core.$strip>>>;
89
- templates_dir: z.ZodOptional<z.ZodString>;
90
- }, z.core.$strict>;
91
- type ComponentOverride = z.infer<typeof ComponentOverrideSchema>;
92
- declare const ProjectConfigSchema: z.ZodObject<{
93
- schema: z.ZodOptional<z.ZodString>;
94
- agents: z.ZodOptional<z.ZodString>;
95
- dsl: z.ZodOptional<z.ZodString>;
96
- generated_dir: z.ZodOptional<z.ZodString>;
97
- bindings: z.ZodOptional<z.ZodObject<{
98
- guardrail: z.ZodOptional<z.ZodArray<z.ZodString>>;
99
- hooks: z.ZodOptional<z.ZodArray<z.ZodString>>;
100
- observability: z.ZodOptional<z.ZodObject<{
101
- event_mapping: z.ZodOptional<z.ZodString>;
102
- recorder: z.ZodOptional<z.ZodString>;
103
- enabled: z.ZodOptional<z.ZodBoolean>;
104
- db_path: z.ZodOptional<z.ZodString>;
105
- otel: z.ZodOptional<z.ZodObject<{
106
- endpoint: z.ZodString;
107
- }, z.core.$strip>>;
108
- }, z.core.$strip>>;
109
- }, z.core.$strip>>;
110
- active_guardrail_policy: z.ZodOptional<z.ZodString>;
111
- templates_dir: z.ZodOptional<z.ZodString>;
112
- plugins: z.ZodOptional<z.ZodArray<z.ZodString>>;
113
- recovery: z.ZodDefault<z.ZodObject<{
114
- max_follow_ups: z.ZodDefault<z.ZodNumber>;
115
- max_retries: z.ZodDefault<z.ZodNumber>;
116
- }, z.core.$strip>>;
117
- model_mapping: z.ZodDefault<z.ZodObject<{
118
- fast: z.ZodOptional<z.ZodObject<{
119
- adapter: z.ZodString;
120
- model: z.ZodOptional<z.ZodString>;
121
- }, z.core.$strip>>;
122
- standard: z.ZodOptional<z.ZodObject<{
123
- adapter: z.ZodString;
124
- model: z.ZodOptional<z.ZodString>;
125
- }, z.core.$strip>>;
126
- thinking: z.ZodOptional<z.ZodObject<{
127
- adapter: z.ZodString;
128
- model: z.ZodOptional<z.ZodString>;
129
- }, z.core.$strip>>;
130
- }, z.core.$strip>>;
131
- logging: z.ZodDefault<z.ZodObject<{
132
- progress_log: z.ZodDefault<z.ZodObject<{
133
- destination: z.ZodDefault<z.ZodEnum<{
134
- file: "file";
135
- both: "both";
136
- stderr: "stderr";
137
- none: "none";
138
- }>>;
139
- file: z.ZodOptional<z.ZodString>;
140
- naming: z.ZodDefault<z.ZodEnum<{
141
- single: "single";
142
- "per-invocation": "per-invocation";
143
- daily: "daily";
144
- }>>;
145
- }, z.core.$strip>>;
146
- }, z.core.$strip>>;
147
- artifacts: z.ZodOptional<z.ZodString>;
148
- toolchains: z.ZodOptional<z.ZodString>;
149
- components: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
150
- agents: z.ZodOptional<z.ZodString>;
151
- dsl: z.ZodOptional<z.ZodString>;
152
- component_contract: z.ZodOptional<z.ZodString>;
153
- generated_dir: z.ZodOptional<z.ZodString>;
154
- bindings: z.ZodOptional<z.ZodObject<{
155
- guardrail: z.ZodOptional<z.ZodArray<z.ZodString>>;
156
- hooks: z.ZodOptional<z.ZodArray<z.ZodString>>;
157
- observability: z.ZodOptional<z.ZodObject<{
158
- event_mapping: z.ZodOptional<z.ZodString>;
159
- recorder: z.ZodOptional<z.ZodString>;
160
- enabled: z.ZodOptional<z.ZodBoolean>;
161
- db_path: z.ZodOptional<z.ZodString>;
162
- otel: z.ZodOptional<z.ZodObject<{
163
- endpoint: z.ZodString;
164
- }, z.core.$strip>>;
165
- }, z.core.$strip>>;
166
- }, z.core.$strip>>;
167
- plugins: z.ZodOptional<z.ZodArray<z.ZodString>>;
168
- model_mapping: z.ZodOptional<z.ZodDefault<z.ZodObject<{
169
- fast: z.ZodOptional<z.ZodObject<{
170
- adapter: z.ZodString;
171
- model: z.ZodOptional<z.ZodString>;
172
- }, z.core.$strip>>;
173
- standard: z.ZodOptional<z.ZodObject<{
174
- adapter: z.ZodString;
175
- model: z.ZodOptional<z.ZodString>;
176
- }, z.core.$strip>>;
177
- thinking: z.ZodOptional<z.ZodObject<{
178
- adapter: z.ZodString;
179
- model: z.ZodOptional<z.ZodString>;
180
- }, z.core.$strip>>;
181
- }, z.core.$strip>>>;
182
- recovery: z.ZodOptional<z.ZodDefault<z.ZodObject<{
183
- max_follow_ups: z.ZodDefault<z.ZodNumber>;
184
- max_retries: z.ZodDefault<z.ZodNumber>;
185
- }, z.core.$strip>>>;
186
- templates_dir: z.ZodOptional<z.ZodString>;
187
- }, z.core.$strict>>>;
188
- environments: z.ZodOptional<z.ZodObject<{
189
- git: z.ZodOptional<z.ZodObject<{
190
- hooks: z.ZodOptional<z.ZodArray<z.ZodString>>;
191
- }, z.core.$strip>>;
192
- cursor: z.ZodOptional<z.ZodObject<{
193
- hooks_json: z.ZodOptional<z.ZodString>;
194
- }, z.core.$strip>>;
195
- ci: z.ZodOptional<z.ZodObject<{
196
- provider: z.ZodOptional<z.ZodString>;
197
- }, z.core.$strip>>;
198
- }, z.core.$strip>>;
199
- cli: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
200
- agents: z.ZodOptional<z.ZodString>;
201
- dsl: z.ZodOptional<z.ZodString>;
202
- generated_dir: z.ZodOptional<z.ZodString>;
203
- plugins: z.ZodOptional<z.ZodArray<z.ZodString>>;
204
- bindings: z.ZodOptional<z.ZodObject<{
205
- guardrail: z.ZodOptional<z.ZodArray<z.ZodString>>;
206
- hooks: z.ZodOptional<z.ZodArray<z.ZodString>>;
207
- observability: z.ZodOptional<z.ZodObject<{
208
- event_mapping: z.ZodOptional<z.ZodString>;
209
- recorder: z.ZodOptional<z.ZodString>;
210
- enabled: z.ZodOptional<z.ZodBoolean>;
211
- db_path: z.ZodOptional<z.ZodString>;
212
- otel: z.ZodOptional<z.ZodObject<{
213
- endpoint: z.ZodString;
214
- }, z.core.$strip>>;
215
- }, z.core.$strip>>;
216
- }, z.core.$strip>>;
217
- }, z.core.$strict>>>;
218
- workspace: z.ZodOptional<z.ZodObject<{
219
- members: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
220
- path: z.ZodString;
221
- }, z.core.$strip>, z.ZodObject<{
222
- glob: z.ZodString;
223
- }, z.core.$strip>]>>;
224
- runtime: z.ZodOptional<z.ZodObject<{
225
- resolve_from: z.ZodOptional<z.ZodString>;
226
- }, z.core.$strip>>;
227
- discovery: z.ZodDefault<z.ZodObject<{
228
- max_depth: z.ZodDefault<z.ZodNumber>;
229
- }, z.core.$strip>>;
230
- }, z.core.$strip>>;
231
- }, z.core.$strip>;
232
- type ProjectConfig = z.infer<typeof ProjectConfigSchema>;
233
- interface ResolvedProgressLog {
234
- destination: "stderr" | "file" | "both" | "none";
235
- file: string | undefined;
236
- naming: "single" | "per-invocation" | "daily";
237
- }
238
- interface ResolvedEnvironments {
239
- git?: {
240
- hooks: string[];
241
- };
242
- cursor?: {
243
- hooks_json: string;
244
- };
245
- ci?: {
246
- provider: string;
247
- };
248
- }
249
- interface ResolvedObservability {
250
- eventMappingPath?: string;
251
- recorder?: string;
252
- /** Whether in-process agent-axis recording is enabled (default true when binding present). */
253
- enabled?: boolean;
254
- /** Resolved override for the SQLite DB path (undefined → DEFAULT_DB_PATH). */
255
- dbPath?: string;
256
- /**
257
- * OTel Collector endpoint configuration.
258
- * When present, OtelEmitter is configured with this endpoint at pipeline creation.
259
- * Falls back to OTEL_EXPORTER_OTLP_ENDPOINT env var when absent.
260
- */
261
- otel?: {
262
- endpoint: string;
263
- };
264
- }
265
- interface ResolvedConfig extends RuntimeConfig {
266
- configDir: string;
267
- dslPath: string;
268
- generatedDir: string;
269
- /** Resolved guardrail_impl matcher files (machine enforcement). */
270
- bindingPaths: string[];
271
- /** Resolved git-hook binding files (governance materialize, #68). */
272
- hookBindingPaths: string[];
273
- /** Observability event mapping + recorder, if configured. */
274
- observability?: ResolvedObservability;
275
- templatesDir: string | undefined;
276
- pluginPaths: string[];
277
- resolvedLogging: {
278
- progressLog: ResolvedProgressLog;
279
- };
280
- artifactsPath?: string;
281
- toolchainsPath?: string;
282
- environments?: ResolvedEnvironments;
283
- componentOverrides?: Record<string, ComponentOverride>;
284
- }
285
- declare function loadProjectConfig(configPath: string, target?: string): Promise<ResolvedConfig>;
286
-
287
- export { type ComponentOverride, ComponentOverrideSchema, DEFAULT_CONFIG_PATH, type ProjectConfig, ProjectConfigSchema, type ResolvedConfig, type ResolvedEnvironments, loadProjectConfig };
3
+ import 'zod';
@@ -4,7 +4,7 @@ import {
4
4
  ProjectConfigSchema,
5
5
  buildGuardrailContext,
6
6
  loadProjectConfig
7
- } from "../chunk-YZQRSVDZ.js";
7
+ } from "../chunk-3H3PVPPF.js";
8
8
  import "../chunk-BJ7B4R26.js";
9
9
  export {
10
10
  ComponentOverrideSchema,