@aaac/runtime 0.2.9 → 0.3.0

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 (48) 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/claude-agent-sdk.js +5 -4
  5. package/dist/adapters/claude-agent-sdk.js.map +1 -1
  6. package/dist/adapters/openai-agents-sdk.d.ts +1 -1
  7. package/dist/adapters/openai-agents-sdk.js +1 -1
  8. package/dist/{chunk-D2UXESPT.js → chunk-2SG3TBI3.js} +4 -51
  9. package/dist/chunk-2SG3TBI3.js.map +1 -0
  10. package/dist/{chunk-Y7NORFFM.js → chunk-5ZDW4RP7.js} +2 -2
  11. package/dist/{chunk-GWNXNSGL.js → chunk-BHTHXGA3.js} +12 -9
  12. package/dist/chunk-BHTHXGA3.js.map +1 -0
  13. package/dist/{chunk-HR2Q64AO.js → chunk-EA4V5DVD.js} +29 -4
  14. package/dist/chunk-EA4V5DVD.js.map +1 -0
  15. package/dist/chunk-EBMQHLXY.js +61 -0
  16. package/dist/chunk-EBMQHLXY.js.map +1 -0
  17. package/dist/{chunk-QVMLALPF.js → chunk-GGBNVCPV.js} +5 -3
  18. package/dist/{chunk-QVMLALPF.js.map → chunk-GGBNVCPV.js.map} +1 -1
  19. package/dist/{chunk-CJLKKDKN.js → chunk-N2EA3TGS.js} +12 -12
  20. package/dist/{chunk-CJLKKDKN.js.map → chunk-N2EA3TGS.js.map} +1 -1
  21. package/dist/{chunk-MG7WSWJU.js → chunk-RTYJNZGT.js} +1 -1
  22. package/dist/chunk-RTYJNZGT.js.map +1 -0
  23. package/dist/claude-bundles/full.js +148 -148
  24. package/dist/claude-bundles/lean.js +5 -5
  25. package/dist/claude-bundles/prompt.js +2 -2
  26. package/dist/generator/index.d.ts +2 -2
  27. package/dist/generator/index.js +2 -2
  28. package/dist/{guardrail-hooks-B-qe4ebW.d.ts → guardrail-hooks-BgHe8PrP.d.ts} +6 -3
  29. package/dist/{hooks-lite-DvZu9Jhx.d.ts → hooks-lite-BtOGc2F_.d.ts} +12 -1
  30. package/dist/{index-C2DHitGz.d.ts → index-DeZsmlij.d.ts} +4 -1
  31. package/dist/index.d.ts +24 -5
  32. package/dist/index.js +144 -45
  33. package/dist/index.js.map +1 -1
  34. package/dist/lib/claude-native/hooks-lite.d.ts +2 -2
  35. package/dist/lib/claude-native/hooks-lite.js +6 -4
  36. package/dist/lib/claude-native/hooks-prompt.d.ts +3 -3
  37. package/dist/lib/claude-native/hooks-prompt.js +4 -3
  38. package/dist/lib/claude-native/index.d.ts +5 -5
  39. package/dist/lib/claude-native/index.js +11 -9
  40. package/dist/lib/claude-native/index.js.map +1 -1
  41. package/dist/{navigation-context-D1NbiipT.d.ts → navigation-context-DJjCkrcj.d.ts} +1 -1
  42. package/dist/{workspace-user-prompt-submit-aErGPoX4.d.ts → workspace-user-prompt-submit-GZwUKUHi.d.ts} +1 -1
  43. package/package.json +4 -4
  44. package/dist/chunk-D2UXESPT.js.map +0 -1
  45. package/dist/chunk-GWNXNSGL.js.map +0 -1
  46. package/dist/chunk-HR2Q64AO.js.map +0 -1
  47. package/dist/chunk-MG7WSWJU.js.map +0 -1
  48. /package/dist/{chunk-Y7NORFFM.js.map → chunk-5ZDW4RP7.js.map} +0 -0
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __aaacCreateRequire } from 'node:module';
2
2
  const require = __aaacCreateRequire(import.meta.url);
3
- import{readFileSync as V,statSync as K}from"fs";import{resolve as J}from"path";var Y=/(?:^|\s)(?:--body-file|--notes-file|--file|-F)(?:=|\s+)(?:'([^']*)'|"([^"]*)"|([^\s;|&]+))/g;function z(e,t){let r=[];for(let n of e.matchAll(Y)){let a=n[1]??n[2]??n[3];if(!a||a==="-")continue;let o=J(t??process.cwd(),a);try{if(!K(o).isFile())continue;r.push(V(o,"utf8"))}catch{continue}}return r.length===0?e:[e,...r].join(`
4
- `)}var X=["block","warn","shadow","info","unresolved"],Q="unresolved";function w(e){if(typeof e!="object"||e===null)return!1;let t=e;return typeof t.guardrail_id=="string"&&typeof t.pattern=="string"&&X.includes(t.action)&&typeof t.message=="string"&&(t.file_glob===void 0||typeof t.file_glob=="string")&&(t.exclude_glob===void 0||typeof t.exclude_glob=="string")}function I(e){if(typeof e!="object"||e===null)return!1;let t=e;return Array.isArray(t.commandRules)&&t.commandRules.every(w)&&Array.isArray(t.fileRules)&&t.fileRules.every(w)&&Array.isArray(t.contentRules)&&t.contentRules.every(w)}function Z(e){let t="";for(let r of e)r==="*"?t+="[^/]*":r==="?"?t+="[^/]":".+^$|()[]\\".includes(r)?t+="\\"+r:t+=r;return t}function ee(e){return e.endsWith("/")?`${e}**`:e}function h(e,t){let r=ee(e),n="",a=0;for(;a<r.length;)if(r[a]==="*"&&r[a+1]==="*"&&r[a+2]==="/")n+="(?:.+/)?",a+=3;else if(r[a]==="*"&&r[a+1]==="*")n+=".*",a+=2;else if(r[a]==="*")n+="[^/]*",a+=1;else if(r[a]==="?")n+="[^/]",a+=1;else if(r[a]==="{"){let o=r.indexOf("}",a);if(o!==-1){let c=r.slice(a+1,o).split(",").map(Z);n+="(?:"+c.join("|")+")",a=o+1}else n+="\\{",a+=1}else".+^$|()[]\\".includes(r[a])?(n+="\\"+r[a],a+=1):(n+=r[a],a+=1);return new RegExp("^"+n+"$").test(t)}function te(e){return e==="path"||e==="file"||e==="filename"||e.endsWith("_path")}function re(e){return e==="content"||e.startsWith("new_")}function $(e,t){if(!e)return"";for(let r of Object.keys(e).sort()){if(!t(r))continue;let n=e[r];if(typeof n=="string"&&n)return n}return""}function ne(e){return $(e,te)}var oe=new Set(["Read","Glob","Grep","LSP","Task","Agent","Skill","WebFetch","WebSearch","TodoWrite","AskUserQuestion","ToolSearch","EnterPlanMode","ExitPlanMode"]);function k(e,t){return oe.has(e??"")?"":ne(t)}function v(e){return $(e,re)}function ie(e){return e==="block"||e===Q}function O(e){return e.filter(t=>!t.passed&&ie(t.action))}function ae(e){return e.filter(t=>!t.passed&&t.action==="warn")}function j(e){return e.map(t=>`[${t.guardrail_id}] ${t.message}`).join(`
5
- `)}function D(e){let t=j(e);return{permission:"deny",user_message:t,agent_message:t}}function se(...e){function t(i){let s=[];if(i.command)for(let u of e)s.push(...u.checkCommand(i.command));if(i.filePath)for(let u of e)s.push(...u.checkFilePath(i.filePath));if(i.filePath&&i.content)for(let u of e)s.push(...u.checkContent(i.filePath,i.content));return s}function r(i){let s=i.command??"";return s?t({command:z(s,i.cwd)}):[]}function n(i){let s=r(i);if(s.length===0)return{};let u=O(s),f=ae(s);return u.length>0?D(u):f.length>0?{additionalContext:j(f)}:{}}function a(i,s){if(!i)return{};let u=O(t({filePath:i,content:s}));return u.length>0?D(u):{}}function o(i){return a(k(i.tool_name,i.tool_input),v(i.tool_input))}function c(i){return a(i.file_path??"",i.content??"")}return{beforeShellExecution:n,checkShellCommand:r,preToolUse:o,afterFileEdit:c,runChecks:t}}function N(e){return e.startsWith("(?i)")?new RegExp(e.slice(4),"i"):new RegExp(e)}function P(e,...t){let r=e.commandRules.map(o=>({guardrail_id:o.guardrail_id,pattern:N(o.pattern),action:o.action,message:o.message})),n=e.fileRules,a=e.contentRules.map(o=>({guardrail_id:o.guardrail_id,pattern:N(o.pattern),action:o.action,message:o.message,file_glob:o.file_glob,exclude_glob:o.exclude_glob}));return se({checkCommand(o){let c=[];for(let i of r){let s=!i.pattern.test(o);c.push({guardrail_id:i.guardrail_id,passed:s,action:i.action,message:s?"":i.message})}return c},checkFilePath(o){let c=[];for(let i of n){if(i.exclude_glob&&h(i.exclude_glob,o))continue;let s=h(i.pattern,o);c.push({guardrail_id:i.guardrail_id,passed:!s,action:i.action,message:s?i.message:""})}return c},checkContent(o,c){let i=[];for(let s of a){if(s.file_glob&&!h(s.file_glob,o)||s.exclude_glob&&h(s.exclude_glob,o))continue;let u=s.pattern.test(c);i.push({guardrail_id:s.guardrail_id,passed:!u,action:s.action,message:u?s.message:""})}return i}},...t)}import{readFile as he,writeFile as U,rename as ge,stat as ye,mkdir as _e}from"fs/promises";import{join as be}from"path";import{randomBytes as we}from"crypto";import{stat as Pe}from"fs/promises";var ce=["SessionStart","UserPromptSubmit","PreToolUse"],S=e=>new Error(`Not a hook payload: ${e.slice(0,100)}`),m=e=>e===void 0||typeof e=="string";function ue(e){if(e===void 0)return!0;if(typeof e!="object"||e===null||Array.isArray(e))return!1;let t=e;return m(t.file_path)&&m(t.path)&&m(t.command)&&m(t.content)}function le(e){if(!m(e.session_id))return!1;switch(e.hookEventName){case"SessionStart":return e.type===void 0||typeof e.type=="string"&&["new","resume","clear","compact"].includes(e.type);case"UserPromptSubmit":return m(e.prompt);case"PreToolUse":return m(e.tool_name)&&ue(e.tool_input);default:return!1}}function fe(e){let t=JSON.parse(e);if(typeof t!="object"||t===null||Array.isArray(t))throw S(e);let r=t;if(typeof r.hook_event_name=="string"&&r.hookEventName===void 0&&(r.hookEventName=r.hook_event_name),!ce.includes(r.hookEventName)){if(typeof r.hookEventName=="string")return;throw S(e)}if(!le(r))throw S(e);return r}async function de(){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 fe(t)}function pe(e){process.stdout.write(JSON.stringify(e)+`
6
- `)}function me(e,t){return{hookSpecificOutput:{hookEventName:e,additionalContext:t}}}function p(e){return{hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:e}}}function g(){return{}}var y=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function ke(e,t){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let r=e;return typeof r.writtenAt=="string"&&typeof r.sourceHash=="string"&&(r.sourceFiles===void 0||Array.isArray(r.sourceFiles)&&r.sourceFiles.every(n=>typeof n=="string"))&&t(r.data)}function _(e){let{cacheDir:t}=e;function r(o){return be(t,`${o}.json`)}async function n(){await _e(t,{recursive:!0})}return{async read(o,c){let i;try{i=JSON.parse(await he(r(o),"utf-8"))}catch{return null}return ke(i,c)?i:null},async write(o,c,i,s){await n();let u={data:c,writtenAt:new Date().toISOString(),sourceHash:i,...s?{sourceFiles:s}:{}},f=JSON.stringify(u,null,2),d=r(o),l=`${d}.${we(4).toString("hex")}.tmp`;await U(l,f,"utf-8");try{await ge(l,d)}catch{await U(d,f,"utf-8")}},async getFileMtime(o){try{return(await ye(o)).mtimeMs}catch{return null}}}}function ve(e){return e.map(String).join(":")}var Se=".guardrails";function Ae(e){return`${e}${Se}`}var H="navigation-index";async function Ce(e){let t=[];for(let r of e)try{let n=await Pe(r);t.push(n.mtimeMs)}catch{t.push(`missing:${r}`)}return ve(t)}async function A(e){let t=e.cacheKey??H,r=_({cacheDir:e.cacheDir}),n=await r.read(t,y);if(!n?.sourceFiles||await Ce(n.sourceFiles)!==n.sourceHash)return;let o=await r.read(Ae(t),I);if(o?.sourceHash===n.sourceHash)return{navigationIndex:n.data,guardrailRules:o.data}}function C(e,t){let r=t.artifacts??{},n=[];for(let[a,o]of Object.entries(r)){let c=o?.files?.path_patterns;if(Array.isArray(c)){for(let i of c)if(typeof i=="string"&&h(i,e)){n.push({artifactId:a,artifact:o,matchedPattern:i});break}}}return n}function R(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 x(e){let t=e.artifacts??{};return Object.entries(t).map(([r,n])=>({id:r,artifact:n}))}import{resolve as q}from"path";function E(e){return e.tool_input?.command!==void 0}function L(e){return k(e.tool_name,e.tool_input)}var Re={"navigation-index":"the artifact edit guard","guardrail-rules":"the DSL guardrails"};function b(e,t){let r=t?` for ${t}`:"";return`[guard-unavailable] ${Re[e]} cannot run: the \`${e}\` cache entry${r} is absent or was built from sources that have since changed, so this operation gets no verdict and is refused rather than judged by superseded rules or silently allowed. Run \`.claude/bin/ensure-navigation-index\` (SessionStart and every prompt submission do this automatically \u2014 if it keeps failing, that failure is the bug).`}function xe(e){let t=e.guardrailRules?P(e.guardrailRules):null;return async function(n){let a=L(n);if(!t&&(E(n)||a))return p(b("guardrail-rules"));if(t){if(E(n)){let c=t.beforeShellExecution({command:n.tool_input?.command,cwd:n.cwd});if(c.permission==="deny")return p(c.user_message)}let o=t.preToolUse({tool_name:n.tool_name,tool_input:n.tool_input});if(o.permission==="deny")return p(o.user_message)}if(a){if(!e.navigationIndex)return p(b("navigation-index"));for(let o of C(a,e.navigationIndex)){let c=R(o);if(c.protected)return p(c.reason)}}return g()}}var G=100;function M(e,t){let{navigationIndex:r,maxCandidates:n=G}=t,a=x(r),o=[],c=e.toLowerCase(),i=s=>Ee(t.pathPrefix,s);for(let{id:s,artifact:u}of a){let f=u.properties??{},d=u.files?.path_patterns??[];(!e||s.toLowerCase().includes(c))&&o.push({label:s,path:i(d.length>0?String(d[0]):s),kind:"artifact",authority:f.authority,manual_edit:f.manual_edit,score:Te(s,u,e)});for(let l of d)typeof l=="string"&&(l.includes("*")||l.includes("?")||(!e||l.toLowerCase().includes(c))&&o.push({label:l,path:i(l),kind:"file",artifact:s,authority:f.authority,manual_edit:f.manual_edit,score:Fe(l,e)}))}return o.sort((s,u)=>u.score!==s.score?u.score-s.score:s.label.localeCompare(u.label)),o.slice(0,n)}function Ee(e,t){if(!e)return t;let r=e.replace(/^\.\//,"").replace(/\/+$/,"");return r?`${r}/${t}`:t}function B(e){return e.map(t=>JSON.stringify(t)).join(`
7
- `)}function Te(e,t,r){let n=50,a=t.properties??{};return a.authority==="canonical"&&(n+=20),a.manual_edit==="allowed"&&(n+=10),a.type==="source"&&(n+=15),a.authority==="generated"&&(n-=20),a.manual_edit==="forbidden"&&(n-=10),r&&e.toLowerCase().startsWith(r.toLowerCase())&&(n+=20),n}function Fe(e,t){let r=40;return t&&e.toLowerCase().startsWith(t.toLowerCase())&&(r+=30),r+=Math.max(0,20-e.split("/").length*2),r}async function Oe(e,t){let r=t.trim(),n=M(r,{navigationIndex:e});return B(n)}async function De(e,t,r,n=G){let a=r.trim(),o=_({cacheDir:e}),c=[];for(let i of t){let s=await o.read(i.cacheKey,y);s&&c.push(...M(a,{navigationIndex:s.data,pathPrefix:i.memberPath,maxCandidates:Number.POSITIVE_INFINITY}))}return c.sort((i,s)=>s.score!==i.score?s.score-i.score:i.label.localeCompare(s.label)),B(c.slice(0,n))}function W(e,t,r){if(!e)return null;let n=e.startsWith("/")?e:q(r,e),a=null,o=0;for(let c of t){let i=c.root,s=i.endsWith("/")?i:i+"/";n.startsWith(s)&&s.length>o&&(a=c,o=s.length)}return a}function Ne(e,t,r){let n=e.startsWith("/")?e:q(r,e),a=t.endsWith("/")?t:t+"/";return n.startsWith(a)?n.slice(a.length):e}function Ie(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 $e(e){let t=new Map;async function r(a){if(t.has(a.name))return t.get(a.name);let o=await A({cacheDir:e.cacheDir,cacheKey:a.cacheKey}),c=o?{...o,hooks:P(o.guardrailRules)}:void 0;return t.set(a.name,c),c}function n(a){for(let o of Ie(a)){let c=W(o,e.members,e.workspaceRoot);if(c)return[c]}return e.members}return async function(o){if(E(o)){let d=o.tool_input?.command??"";for(let l of n(d)){let T=await r(l);if(!T)return p(b("guardrail-rules",`member "${l.name}"`));let F=T.hooks.beforeShellExecution({command:d,cwd:o.cwd});if(F.permission==="deny")return p(F.user_message)}}let c=L(o);if(!c)return g();let i=W(c,e.members,e.workspaceRoot);if(!i)return g();let s=await r(i);if(!s)return p(b("navigation-index",`member "${i.name}"`));let u=Ne(c,i.root,e.workspaceRoot),f=s.hooks.afterFileEdit({file_path:u,content:v(o.tool_input)});if(f.permission==="deny")return p(f.user_message);for(let d of C(u,s.navigationIndex)){let l=R(d);if(l.protected)return p(l.reason)}return g()}}export{H as DEFAULT_CACHE_KEY,me as buildContextResponse,_ as createCacheStore,xe as createPreToolUseHandler,$e as createWorkspacePreToolUseHandler,pe as emitHookOutput,Oe as handleFileSuggestion,De as handleWorkspaceFileSuggestion,y as isCachedRecord,x as listArtifacts,A as readFreshNavigationBuild,de as readHookInput};
3
+ import{realpathSync as J}from"fs";import{basename as Y,dirname as z,isAbsolute as X,join as Q,relative as Z,resolve as ee,sep as O}from"path";import{readFileSync as te,statSync as re}from"fs";import{resolve as ne}from"path";var oe=/(?:^|\s)(?:--body-file|--notes-file|--file|-F)(?:=|\s+)(?:'([^']*)'|"([^"]*)"|([^\s;|&]+))/g;function ie(e,t){let r=[];for(let n of e.matchAll(oe)){let s=n[1]??n[2]??n[3];if(!s||s==="-")continue;let o=ne(t??process.cwd(),s);try{if(!re(o).isFile())continue;r.push(te(o,"utf8"))}catch{continue}}return r.length===0?e:[e,...r].join(`
4
+ `)}var se=["block","warn","shadow","info","unresolved"],ae="unresolved";function w(e){if(typeof e!="object"||e===null)return!1;let t=e;return typeof t.guardrail_id=="string"&&typeof t.pattern=="string"&&se.includes(t.action)&&typeof t.message=="string"&&(t.file_glob===void 0||typeof t.file_glob=="string")&&(t.exclude_glob===void 0||typeof t.exclude_glob=="string")}function $(e){if(typeof e!="object"||e===null)return!1;let t=e;return Array.isArray(t.commandRules)&&t.commandRules.every(w)&&Array.isArray(t.fileRules)&&t.fileRules.every(w)&&Array.isArray(t.contentRules)&&t.contentRules.every(w)}function ce(e){let t="";for(let r of e)r==="*"?t+="[^/]*":r==="?"?t+="[^/]":".+^$|()[]\\".includes(r)?t+="\\"+r:t+=r;return t}function ue(e){return e.endsWith("/")?`${e}**`:e}function h(e,t){let r=ue(e),n="",s=0;for(;s<r.length;)if(r[s]==="*"&&r[s+1]==="*"&&r[s+2]==="/")n+="(?:.+/)?",s+=3;else if(r[s]==="*"&&r[s+1]==="*")n+=".*",s+=2;else if(r[s]==="*")n+="[^/]*",s+=1;else if(r[s]==="?")n+="[^/]",s+=1;else if(r[s]==="{"){let o=r.indexOf("}",s);if(o!==-1){let c=r.slice(s+1,o).split(",").map(ce);n+="(?:"+c.join("|")+")",s=o+1}else n+="\\{",s+=1}else".+^$|()[]\\".includes(r[s])?(n+="\\"+r[s],s+=1):(n+=r[s],s+=1);return new RegExp("^"+n+"$").test(t)}function le(e){return e==="path"||e==="file"||e==="filename"||e.endsWith("_path")}function fe(e){return e==="content"||e.startsWith("new_")}function U(e,t){if(!e)return"";for(let r of Object.keys(e).sort()){if(!t(r))continue;let n=e[r];if(typeof n=="string"&&n)return n}return""}function de(e){return U(e,le)}var me=new Set(["Read","Glob","Grep","LSP","Task","Agent","Skill","WebFetch","WebSearch","TodoWrite","AskUserQuestion","ToolSearch","EnterPlanMode","ExitPlanMode"]);function D(e){let t=[],r=e;for(;;)try{return Q(J(r),...t)}catch{let n=z(r);if(n===r)return e;t.unshift(Y(r)),r=n}}function pe(e,t){let r=ee(t,e),n=Z(D(t),D(r));return n===""||X(n)||n.split(O)[0]===".."?r:n.split(O).join("/")}function k(e,t,r){if(me.has(e??""))return"";let n=de(t);return n&&pe(n,r??process.cwd())}function v(e){return U(e,fe)}function he(e){return e==="block"||e===ae}function N(e){return e.filter(t=>!t.passed&&he(t.action))}function ge(e){return e.filter(t=>!t.passed&&t.action==="warn")}function H(e){return e.map(t=>`[${t.guardrail_id}] ${t.message}`).join(`
5
+ `)}function I(e){let t=H(e);return{permission:"deny",user_message:t,agent_message:t}}function ye(...e){function t(i){let a=[];if(i.command)for(let u of e)a.push(...u.checkCommand(i.command));if(i.filePath)for(let u of e)a.push(...u.checkFilePath(i.filePath));if(i.filePath&&i.content)for(let u of e)a.push(...u.checkContent(i.filePath,i.content));return a}function r(i){let a=i.command??"";return a?t({command:ie(a,i.cwd)}):[]}function n(i){let a=r(i);if(a.length===0)return{};let u=N(a),f=ge(a);return u.length>0?I(u):f.length>0?{additionalContext:H(f)}:{}}function s(i,a){if(!i)return{};let u=N(t({filePath:i,content:a}));return u.length>0?I(u):{}}function o(i){return s(k(i.tool_name,i.tool_input,i.root),v(i.tool_input))}function c(i){return s(i.file_path??"",i.content??"")}return{beforeShellExecution:n,checkShellCommand:r,preToolUse:o,afterFileEdit:c,runChecks:t}}function j(e){return e.startsWith("(?i)")?new RegExp(e.slice(4),"i"):new RegExp(e)}function A(e,...t){let r=e.commandRules.map(o=>({guardrail_id:o.guardrail_id,pattern:j(o.pattern),action:o.action,message:o.message})),n=e.fileRules,s=e.contentRules.map(o=>({guardrail_id:o.guardrail_id,pattern:j(o.pattern),action:o.action,message:o.message,file_glob:o.file_glob,exclude_glob:o.exclude_glob}));return ye({checkCommand(o){let c=[];for(let i of r){let a=!i.pattern.test(o);c.push({guardrail_id:i.guardrail_id,passed:a,action:i.action,message:a?"":i.message})}return c},checkFilePath(o){let c=[];for(let i of n){if(i.exclude_glob&&h(i.exclude_glob,o))continue;let a=h(i.pattern,o);c.push({guardrail_id:i.guardrail_id,passed:!a,action:i.action,message:a?i.message:""})}return c},checkContent(o,c){let i=[];for(let a of s){if(a.file_glob&&!h(a.file_glob,o)||a.exclude_glob&&h(a.exclude_glob,o))continue;let u=a.pattern.test(c);i.push({guardrail_id:a.guardrail_id,passed:!u,action:a.action,message:u?a.message:""})}return i}},...t)}import{readFile as Se,writeFile as W,rename as Re,stat as Ce,mkdir as xe}from"fs/promises";import{join as Ee}from"path";import{randomBytes as Te}from"crypto";import{stat as De}from"fs/promises";var _e=["SessionStart","UserPromptSubmit","PreToolUse"],P=e=>new Error(`Not a hook payload: ${e.slice(0,100)}`),p=e=>e===void 0||typeof e=="string";function be(e){if(e===void 0)return!0;if(typeof e!="object"||e===null||Array.isArray(e))return!1;let t=e;return p(t.file_path)&&p(t.path)&&p(t.command)&&p(t.content)}function we(e){if(!p(e.session_id))return!1;switch(e.hookEventName){case"SessionStart":return e.type===void 0||typeof e.type=="string"&&["new","resume","clear","compact"].includes(e.type);case"UserPromptSubmit":return p(e.prompt);case"PreToolUse":return p(e.tool_name)&&be(e.tool_input);default:return!1}}function ke(e){let t=JSON.parse(e);if(typeof t!="object"||t===null||Array.isArray(t))throw P(e);let r=t;if(typeof r.hook_event_name=="string"&&r.hookEventName===void 0&&(r.hookEventName=r.hook_event_name),!_e.includes(r.hookEventName)){if(typeof r.hookEventName=="string")return;throw P(e)}if(!we(r))throw P(e);return r}async function ve(){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 ke(t)}function Ae(e){process.stdout.write(JSON.stringify(e)+`
6
+ `)}function Pe(e,t){return{hookSpecificOutput:{hookEventName:e,additionalContext:t}}}function m(e){return{hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:e}}}function g(){return{}}var y=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function Fe(e,t){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let r=e;return typeof r.writtenAt=="string"&&typeof r.sourceHash=="string"&&(r.sourceFiles===void 0||Array.isArray(r.sourceFiles)&&r.sourceFiles.every(n=>typeof n=="string"))&&t(r.data)}function _(e){let{cacheDir:t}=e;function r(o){return Ee(t,`${o}.json`)}async function n(){await xe(t,{recursive:!0})}return{async read(o,c){let i;try{i=JSON.parse(await Se(r(o),"utf-8"))}catch{return null}return Fe(i,c)?i:null},async write(o,c,i,a){await n();let u={data:c,writtenAt:new Date().toISOString(),sourceHash:i,...a?{sourceFiles:a}:{}},f=JSON.stringify(u,null,2),d=r(o),l=`${d}.${Te(4).toString("hex")}.tmp`;await W(l,f,"utf-8");try{await Re(l,d)}catch{await W(d,f,"utf-8")}},async getFileMtime(o){try{return(await Ce(o)).mtimeMs}catch{return null}}}}function Oe(e){return e.map(String).join(":")}var Ne=".guardrails";function Ie(e){return`${e}${Ne}`}var L="navigation-index";async function je(e){let t=[];for(let r of e)try{let n=await De(r);t.push(n.mtimeMs)}catch{t.push(`missing:${r}`)}return Oe(t)}async function S(e){let t=e.cacheKey??L,r=_({cacheDir:e.cacheDir}),n=await r.read(t,y);if(!n?.sourceFiles||await je(n.sourceFiles)!==n.sourceHash)return;let o=await r.read(Ie(t),$);if(o?.sourceHash===n.sourceHash)return{navigationIndex:n.data,guardrailRules:o.data}}import{isAbsolute as $e}from"path";function R(e,t){if($e(e))return[];let r=t.artifacts??{},n=[];for(let[s,o]of Object.entries(r)){let c=o?.files?.path_patterns;if(Array.isArray(c)){for(let i of c)if(typeof i=="string"&&h(i,e)){n.push({artifactId:s,artifact:o,matchedPattern:i});break}}}return n}function Ue(e){if(e.authority==="generated")return"generated";if(e.manual_edit==="forbidden")return"forbidden"}function C(e){let t=Ue(e.artifact.properties??{});if(t==="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==="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 x(e){let t=e.artifacts??{};return Object.entries(t).map(([r,n])=>({id:r,artifact:n}))}import{resolve as K}from"path";function E(e){return e.tool_input?.command!==void 0}function M(e,t){return k(e.tool_name,e.tool_input,t)}var He={"navigation-index":"the artifact edit guard","guardrail-rules":"the DSL guardrails"};function b(e,t){let r=t?` for ${t}`:"";return`[guard-unavailable] ${He[e]} cannot run: the \`${e}\` cache entry${r} is absent or was built from sources that have since changed, so this operation gets no verdict and is refused rather than judged by superseded rules or silently allowed. Run \`.claude/bin/ensure-navigation-index\` (SessionStart and every prompt submission do this automatically \u2014 if it keeps failing, that failure is the bug).`}function We(e){let t=e.guardrailRules?A(e.guardrailRules):null;return async function(n){let s=M(n,e.projectRoot);if(!t&&(E(n)||s))return m(b("guardrail-rules"));if(t){if(E(n)){let c=t.beforeShellExecution({command:n.tool_input?.command,cwd:n.cwd});if(c.permission==="deny")return m(c.user_message)}let o=t.preToolUse({tool_name:n.tool_name,tool_input:n.tool_input,root:e.projectRoot});if(o.permission==="deny")return m(o.user_message)}if(s){if(!e.navigationIndex)return m(b("navigation-index"));for(let o of R(s,e.navigationIndex)){let c=C(o);if(c.protected)return m(c.reason)}}return g()}}var B=100;function q(e,t){let{navigationIndex:r,maxCandidates:n=B}=t,s=x(r),o=[],c=e.toLowerCase(),i=a=>Le(t.pathPrefix,a);for(let{id:a,artifact:u}of s){let f=u.properties??{},d=u.files?.path_patterns??[];(!e||a.toLowerCase().includes(c))&&o.push({label:a,path:i(d.length>0?String(d[0]):a),kind:"artifact",authority:f.authority,manual_edit:f.manual_edit,score:Ge(a,u,e)});for(let l of d)typeof l=="string"&&(l.includes("*")||l.includes("?")||(!e||l.toLowerCase().includes(c))&&o.push({label:l,path:i(l),kind:"file",artifact:a,authority:f.authority,manual_edit:f.manual_edit,score:Me(l,e)}))}return o.sort((a,u)=>u.score!==a.score?u.score-a.score:a.label.localeCompare(u.label)),o.slice(0,n)}function Le(e,t){if(!e)return t;let r=e.replace(/^\.\//,"").replace(/\/+$/,"");return r?`${r}/${t}`:t}function V(e){return e.map(t=>JSON.stringify(t)).join(`
7
+ `)}function Ge(e,t,r){let n=50,s=t.properties??{};return s.authority==="canonical"&&(n+=20),s.manual_edit==="allowed"&&(n+=10),s.type==="source"&&(n+=15),s.authority==="generated"&&(n-=20),s.manual_edit==="forbidden"&&(n-=10),r&&e.toLowerCase().startsWith(r.toLowerCase())&&(n+=20),n}function Me(e,t){let r=40;return t&&e.toLowerCase().startsWith(t.toLowerCase())&&(r+=30),r+=Math.max(0,20-e.split("/").length*2),r}async function Be(e,t){let r=t.trim(),n=q(r,{navigationIndex:e});return V(n)}async function qe(e,t,r,n=B){let s=r.trim(),o=_({cacheDir:e}),c=[];for(let i of t){let a=await o.read(i.cacheKey,y);a&&c.push(...q(s,{navigationIndex:a.data,pathPrefix:i.memberPath,maxCandidates:Number.POSITIVE_INFINITY}))}return c.sort((i,a)=>a.score!==i.score?a.score-i.score:i.label.localeCompare(a.label)),V(c.slice(0,n))}function G(e,t,r){if(!e)return null;let n=e.startsWith("/")?e:K(r,e),s=null,o=0;for(let c of t){let i=c.root,a=i.endsWith("/")?i:i+"/";n.startsWith(a)&&a.length>o&&(s=c,o=a.length)}return s}function Ve(e,t,r){let n=e.startsWith("/")?e:K(r,e),s=t.endsWith("/")?t:t+"/";return n.startsWith(s)?n.slice(s.length):e}function Ke(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 Je(e){let t=new Map;async function r(s){if(t.has(s.name))return t.get(s.name);let o=await S({cacheDir:e.cacheDir,cacheKey:s.cacheKey}),c=o?{...o,hooks:A(o.guardrailRules)}:void 0;return t.set(s.name,c),c}function n(s){for(let o of Ke(s)){let c=G(o,e.members,e.workspaceRoot);if(c)return[c]}return e.members}return async function(o){if(E(o)){let d=o.tool_input?.command??"";for(let l of n(d)){let T=await r(l);if(!T)return m(b("guardrail-rules",`member "${l.name}"`));let F=T.hooks.beforeShellExecution({command:d,cwd:o.cwd});if(F.permission==="deny")return m(F.user_message)}}let c=M(o,e.workspaceRoot);if(!c)return g();let i=G(c,e.members,e.workspaceRoot);if(!i)return g();let a=await r(i);if(!a)return m(b("navigation-index",`member "${i.name}"`));let u=Ve(c,i.root,e.workspaceRoot),f=a.hooks.afterFileEdit({file_path:u,content:v(o.tool_input)});if(f.permission==="deny")return m(f.user_message);for(let d of R(u,a.navigationIndex)){let l=C(d);if(l.protected)return m(l.reason)}return g()}}export{L as DEFAULT_CACHE_KEY,Pe as buildContextResponse,_ as createCacheStore,We as createPreToolUseHandler,Je as createWorkspacePreToolUseHandler,Ae as emitHookOutput,Be as handleFileSuggestion,qe as handleWorkspaceFileSuggestion,y as isCachedRecord,x as listArtifacts,S as readFreshNavigationBuild,ve as readHookInput};
@@ -4,7 +4,7 @@ function N(t){if(typeof t!="object"||t===null)return!1;let e=t;return typeof e.s
4
4
  Artifacts: ${i.length}`),i.length>0){let n=[];for(let c of i){let s=a[c]??{},d=s.properties??{},u=[d.type,d.authority].filter(v=>typeof v=="string"&&v.length>0).join(", "),x=typeof d.manual_edit=="string"?`, edit:${d.manual_edit}`:"";n.push(`- ${c}${u||x?` [${u}${x}]`:""}`);let p=s.files?.path_patterns;Array.isArray(p)&&p.length>0&&n.push(` files: ${p.join(", ")}`);let m=s.relations?.derived_artifacts;Array.isArray(m)&&m.length>0&&n.push(` derived \u2192 ${m.join(", ")}`);let l=s.agents?.owners;Array.isArray(l)&&l.length>0&&n.push(` owners: ${l.join(", ")}`)}r.push(n.join(`
5
5
  `))}return r.join(`
6
6
 
7
- `)}import{DEFAULT_CACHE_KEY as C,buildContextResponse as w,listArtifacts as E,readFreshNavigationBuild as $}from"./_aaac-runtime-lean.mjs";import{spawn as P}from"child_process";var S=20;function h(t,e="navigation-index"){if(!t||t.length===0)return;let a=t.slice(0,S).map(r=>` - [${r.severity}] ${r.path}: ${r.message}`),i=t.length-a.length;return i>0&&a.push(` - \u2026 ${i} more`),[`${e} diagnostics (${t.length}):`,...a].join(`
7
+ `)}import{DEFAULT_CACHE_KEY as C,buildContextResponse as w,readFreshNavigationBuild as $}from"./_aaac-runtime-lean.mjs";import{listArtifacts as E}from"./_aaac-runtime-lean.mjs";import{spawn as P}from"child_process";var S=20;function h(t,e="navigation-index"){if(!t||t.length===0)return;let a=t.slice(0,S).map(r=>` - [${r.severity}] ${r.path}: ${r.message}`),i=t.length-a.length;return i>0&&a.push(` - \u2026 ${i} more`),[`${e} diagnostics (${t.length}):`,...a].join(`
8
8
  `)}var U=3e4;function _(t){if(typeof t!="object"||t===null)return!1;let e=t;return typeof e.path=="string"&&typeof e.message=="string"&&typeof e.severity=="string"}function I(t){return t.diagnostics===void 0||Array.isArray(t.diagnostics)&&t.diagnostics.every(_)}function D(t){if(typeof t!="object"||t===null)return!1;let e=t;return typeof e.member=="string"&&typeof e.status=="string"&&I(e)}function M(t){if(typeof t!="object"||t===null)return!1;let e=t;return typeof e.component!="string"?!1:e.results!==void 0?Array.isArray(e.results)&&e.results.every(D):typeof e.status=="string"&&Array.isArray(e.sources)&&e.sources.every(a=>typeof a=="string")&&I(e)}async function y(t){return new Promise((e,a)=>{let i=P(process.execPath,[t],{stdio:["ignore","pipe","pipe"],timeout:U}),r="",o="";i.stdout.setEncoding("utf8"),i.stderr.setEncoding("utf8"),i.stdout.on("data",n=>r+=n),i.stderr.on("data",n=>o+=n),i.on("error",n=>a(n)),i.on("close",n=>{if(n!==0){a(new Error(`ensure-navigation-index exited ${n}: ${o.trim()}`));return}let c;try{c=JSON.parse(r.trim())}catch{}e(M(c)?c:void 0)})})}function A(t){return new Error(`navigation-index cache \`${t}\` is still unreadable after ensure-navigation-index reported success \u2014 the rebuild did not write it, or wrote it against a different source list. Run \`.claude/bin/ensure-navigation-index\` directly to see why.`)}function k(t){return async function(a){let i=a.prompt??"",r=async()=>(await $({cacheDir:t.cacheDir}))?.navigationIndex,o=await r(),n;if(!o){let d=await y(t.ensureBin);d&&"diagnostics"in d&&(n=h(d.diagnostics)),o=await r()}if(!o)throw A(C);let c=[f(o),"","> Use `analyzer.getContextMap` with candidate paths/artifacts from the index","> when you need structured dependency and read-target guidance."],s=b(i,o);return s&&c.push(s),n&&c.push("",n),w("UserPromptSubmit",c.join(`
9
9
  `))}}function b(t,e,a="## Candidate Artifacts (from prompt keywords)"){let i=B(t,e);if(i.length===0)return;let r=i.map(o=>{let n=o.artifact.properties??{},c=[n.type,n.authority,n.manual_edit?`edit:${n.manual_edit}`:""].filter(Boolean).join(", ");return`- ${o.artifactId} [${c}]`});return`${a}
10
10
  ${r.join(`
@@ -14,4 +14,4 @@ ${a}`+(r?`
14
14
  ${r}`:"")}async function g(t,e){return Promise.all(e.map(async a=>({member:a,navigationIndex:(await $({cacheDir:t,cacheKey:a.cacheKey}))?.navigationIndex})))}function H(t){return async function(a){let i=a.prompt??"",r=await g(t.cacheDir,t.members),o=new Map;if(r.some(s=>!s.navigationIndex)){let s=await y(t.ensureBin);if(s&&"results"in s)for(let d of s.results)d.diagnostics&&o.set(d.member,d.diagnostics);r=await g(t.cacheDir,t.members)}let n=[];for(let s of r){if(!s.navigationIndex)throw A(s.member.cacheKey);n.push(j({member:s.member,result:{navigationIndex:s.navigationIndex,fromCache:!0,...o.has(s.member.name)?{diagnostics:o.get(s.member.name)}:{}}}));let d=b(i,s.navigationIndex,`#### Candidate Artifacts in ${s.member.name} (from prompt keywords)`);d&&n.push(d)}if(n.length===0)return{};let c=[n.join(`
15
15
 
16
16
  `),"","> Use `analyzer.getContextMap` with candidate paths/artifacts from a member's index","> when you need structured dependency and read-target guidance."].join(`
17
- `);return w("UserPromptSubmit",c)}}import{emitHookOutput as G,readHookInput as J}from"./_aaac-runtime-lean.mjs";import"./_aaac-runtime-lean.mjs";import"./_aaac-runtime-lean.mjs";export{k as createUserPromptSubmitHandler,H as createWorkspaceUserPromptSubmitHandler,G as emitHookOutput,N as isNavigationIndex,g as readFreshMemberIndices,J as readHookInput,b as renderCandidateArtifacts,j as renderMemberSection,h as renderNavigationDiagnostics,f as renderNavigationIndexPrompt,y as runEnsureNavigationIndexBin};
17
+ `);return w("UserPromptSubmit",c)}}import{emitHookOutput as J,readHookInput as X}from"./_aaac-runtime-lean.mjs";import"./_aaac-runtime-lean.mjs";import"./_aaac-runtime-lean.mjs";import"./_aaac-runtime-lean.mjs";export{k as createUserPromptSubmitHandler,H as createWorkspaceUserPromptSubmitHandler,J as emitHookOutput,N as isNavigationIndex,g as readFreshMemberIndices,X as readHookInput,b as renderCandidateArtifacts,j as renderMemberSection,h as renderNavigationDiagnostics,f as renderNavigationIndexPrompt,y as runEnsureNavigationIndexBin};
@@ -1,3 +1,3 @@
1
- export { c as GuardrailCheckEntry, G as GuardrailContext, a as GuardrailDiagnostic, d as ProjectConfig, e as ProjectConfigSchema, R as ResolvedConfig, f as buildGuardrailContext, l as loadProjectConfig, p as parseProjectManifest, r as readProjectManifest } from '../index-C2DHitGz.js';
1
+ export { c as GuardrailCheckEntry, G as GuardrailContext, a as GuardrailDiagnostic, d as ProjectConfig, e as ProjectConfigSchema, R as ResolvedConfig, f as buildGuardrailContext, l as loadProjectConfig, p as parseProjectManifest, r as readProjectManifest } from '../index-DeZsmlij.js';
2
2
  import 'zod';
3
- import '../guardrail-hooks-B-qe4ebW.js';
3
+ import '../guardrail-hooks-BgHe8PrP.js';
@@ -4,8 +4,8 @@ import {
4
4
  loadProjectConfig,
5
5
  parseProjectManifest,
6
6
  readProjectManifest
7
- } from "../chunk-Y7NORFFM.js";
8
- import "../chunk-HR2Q64AO.js";
7
+ } from "../chunk-5ZDW4RP7.js";
8
+ import "../chunk-EA4V5DVD.js";
9
9
  import "../chunk-BJ7B4R26.js";
10
10
  export {
11
11
  ProjectConfigSchema,
@@ -153,13 +153,16 @@ interface GuardrailHooks {
153
153
  */
154
154
  checkShellCommand: (input: ShellCommandInput) => GuardrailCheckResult[];
155
155
  /**
156
- * A TOOL INPUT, verbatim: `toolTargetPath` reads the file out of it and
157
- * `toolPendingContent` the text about to go in. The single-component Claude
158
- * Code PreToolUse route, `guard evaluate` and the Claude SDK adapter.
156
+ * A TOOL INPUT, verbatim: `toolWriteTarget` reads the file out of it, relative
157
+ * to `root` — the directory the rules' patterns are written against, the
158
+ * working directory when absent — and `toolPendingContent` the text about to
159
+ * go in. The single-component Claude Code PreToolUse route, `guard evaluate`
160
+ * and the Claude SDK adapter.
159
161
  */
160
162
  preToolUse: (input: {
161
163
  tool_name?: string;
162
164
  tool_input?: Record<string, unknown>;
165
+ root?: string;
163
166
  }) => HookResponse;
164
167
  /**
165
168
  * A file write whose path and content the caller has ALREADY extracted —
@@ -1,5 +1,5 @@
1
1
  import { c as PreToolUseInput, H as HookOutput } from './hook-protocol-BH86kCQB.js';
2
- import { a as GuardrailRuleData } from './guardrail-hooks-B-qe4ebW.js';
2
+ import { a as GuardrailRuleData } from './guardrail-hooks-BgHe8PrP.js';
3
3
 
4
4
  /**
5
5
  * Cache Store — read/write `.claude/cache/` directory.
@@ -176,6 +176,11 @@ interface ArtifactMatch {
176
176
  /**
177
177
  * Resolve a file path to its artifact(s) in the navigation index.
178
178
  * Returns all matching artifacts (a file may belong to multiple artifacts).
179
+ *
180
+ * `filePath` is relative to the project root, the space `path_patterns` are
181
+ * written in (`toolWriteTarget` reads a call's target that way). An absolute
182
+ * path is one outside that root and belongs to no artifact, even where a
183
+ * `**`-prefixed pattern would match its text.
179
184
  */
180
185
  declare function resolvePathToArtifacts(filePath: string, navigationIndex: Record<string, unknown>): ArtifactMatch[];
181
186
  /**
@@ -230,6 +235,12 @@ interface PreToolUseHandlerConfig {
230
235
  * has no rules to consult, never that there are none.
231
236
  */
232
237
  guardrailRules?: GuardrailRuleData;
238
+ /**
239
+ * The project root — the directory `path_patterns` and the file guardrails
240
+ * are written against, and so the one a call's target is read relative to
241
+ * (`toolWriteTarget`). The working directory when absent.
242
+ */
243
+ projectRoot?: string;
233
244
  }
234
245
  /**
235
246
  * Create a PreToolUse hook handler.
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { d as GuardrailAction } from './guardrail-hooks-B-qe4ebW.js';
2
+ import { d as GuardrailAction } from './guardrail-hooks-BgHe8PrP.js';
3
3
 
4
4
  /**
5
5
  * Generator configuration — loads and validates the project manifest
@@ -112,6 +112,9 @@ declare const ProjectConfigSchema: z.ZodObject<{
112
112
  agents: z.ZodOptional<z.ZodBoolean>;
113
113
  harness: z.ZodOptional<z.ZodBoolean>;
114
114
  }, z.core.$strict>>;
115
+ sync_command: z.ZodOptional<z.ZodString>;
116
+ check_command: z.ZodOptional<z.ZodString>;
117
+ local_hook_install: z.ZodOptional<z.ZodBoolean>;
115
118
  }, z.core.$strict>>;
116
119
  }, z.core.$strict>>;
117
120
  active_guardrail_policy: z.ZodOptional<z.ZodString>;
package/dist/index.d.ts CHANGED
@@ -3,13 +3,13 @@ export { j as AdapterError, k as AdapterErrorKind, A as AdapterSendOptions, a as
3
3
  import { ProjectModelMapping, ModelClass, ComponentIR, OperationIR } from '@aaac/contracts';
4
4
  export { ModelClass } from '@aaac/contracts';
5
5
  import { z } from 'zod';
6
- import { b as GuardrailCheckFunctions, a as GuardrailRuleData, G as GuardrailHooks, H as HookResponse, c as GuardrailCheckResult } from './guardrail-hooks-B-qe4ebW.js';
7
- export { d as GuardrailAction, e as GuardrailRule, f as HookContext, U as UNRESOLVED_GUARDRAIL_ACTION, g as createGuardrailHooks, h as createGuardrailHooksFromRules, i as getBlockingViolations, j as getWarnings, k as hasBlockingViolation } from './guardrail-hooks-B-qe4ebW.js';
8
- import { G as GuardrailContext, P as ProgressLogConfig, R as ResolvedConfig, a as GuardrailDiagnostic } from './index-C2DHitGz.js';
9
- export { b as PROJECT_CONFIG_FILENAME } from './index-C2DHitGz.js';
6
+ import { b as GuardrailCheckFunctions, a as GuardrailRuleData, G as GuardrailHooks, H as HookResponse, c as GuardrailCheckResult } from './guardrail-hooks-BgHe8PrP.js';
7
+ export { d as GuardrailAction, e as GuardrailRule, f as HookContext, U as UNRESOLVED_GUARDRAIL_ACTION, g as createGuardrailHooks, h as createGuardrailHooksFromRules, i as getBlockingViolations, j as getWarnings, k as hasBlockingViolation } from './guardrail-hooks-BgHe8PrP.js';
8
+ import { G as GuardrailContext, P as ProgressLogConfig, R as ResolvedConfig, a as GuardrailDiagnostic } from './index-DeZsmlij.js';
9
+ export { b as PROJECT_CONFIG_FILENAME } from './index-DeZsmlij.js';
10
10
  import { OtelEmitter } from '@aaac/observability';
11
11
  export { ExecutionEnvelope } from '@aaac/observability';
12
- export { a as NavigationContext, N as NavigationContextOptions, b as buildNavigationContext } from './navigation-context-D1NbiipT.js';
12
+ export { a as NavigationContext, N as NavigationContextOptions, b as buildNavigationContext } from './navigation-context-DJjCkrcj.js';
13
13
  export { i as isNavigationIndex, r as renderNavigationIndexPrompt } from './navigation-index-prompt-CbrS5laO.js';
14
14
 
15
15
  /**
@@ -1460,6 +1460,12 @@ interface EvaluateGuardrailOptions {
1460
1460
  bindingPaths: string[];
1461
1461
  /** Active guardrail policy name (from project.yaml active_guardrail_policy). */
1462
1462
  activeGuardrailPolicy?: string;
1463
+ /**
1464
+ * The project root — the directory the file guardrails' patterns are written
1465
+ * against, and so the one a tool call's target is read relative to. The
1466
+ * working directory when absent.
1467
+ */
1468
+ projectRoot?: string;
1463
1469
  }
1464
1470
  interface EvaluateGuardrailResult {
1465
1471
  /** HookResponse to write to stdout. */
@@ -1558,6 +1564,9 @@ declare const ClaudeConfigSchema: z.ZodObject<{
1558
1564
  harness: z.ZodDefault<z.ZodBoolean>;
1559
1565
  }, z.core.$strip>>;
1560
1566
  guard_command: z.ZodOptional<z.ZodString>;
1567
+ sync_command: z.ZodOptional<z.ZodString>;
1568
+ check_command: z.ZodOptional<z.ZodString>;
1569
+ local_hook_install: z.ZodDefault<z.ZodBoolean>;
1561
1570
  component_id: z.ZodOptional<z.ZodString>;
1562
1571
  }, z.core.$strip>;
1563
1572
  type ClaudeConfig = z.infer<typeof ClaudeConfigSchema>;
@@ -1600,6 +1609,11 @@ interface CheckResult {
1600
1609
  path: string;
1601
1610
  reason: "missing" | "changed" | "orphaned";
1602
1611
  }>;
1612
+ /**
1613
+ * Rendered files this check did not compare: the hook-install files absent
1614
+ * from disk in a project that declares `local_hook_install`. Empty otherwise.
1615
+ */
1616
+ skipped: string[];
1603
1617
  }
1604
1618
  /**
1605
1619
  * Materialize `.claude/*` and the CLAUDE.md integration block from the embedded DSL.
@@ -1612,6 +1626,11 @@ declare function syncClaude(opts: SyncOptions): Promise<SyncResult>;
1612
1626
  * Read-only drift gate. Reports files whose on-disk content differs from a
1613
1627
  * fresh render. For CLAUDE.md, drift means the aaac:claude-native block is
1614
1628
  * missing or stale (content outside the block is ignored).
1629
+ *
1630
+ * A project that keeps the hook install out of version control
1631
+ * (`local_hook_install`) has none of it in a fresh clone, so an install file
1632
+ * absent from disk is listed in `skipped` rather than compared. One that is
1633
+ * present is compared like any other, and the CLAUDE.md block is never skipped.
1615
1634
  */
1616
1635
  declare function checkClaude(opts: SyncOptions): Promise<CheckResult>;
1617
1636