@aaac/runtime 0.1.55 → 0.2.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.
- package/README.md +6 -11
- package/dist/adapters/adk-sdk.d.ts +3 -3
- package/dist/adapters/adk-sdk.js +6 -8
- package/dist/adapters/adk-sdk.js.map +1 -1
- package/dist/adapters/claude-agent-sdk.d.ts +3 -3
- package/dist/adapters/claude-agent-sdk.js +22 -23
- package/dist/adapters/claude-agent-sdk.js.map +1 -1
- package/dist/adapters/mock.d.ts +2 -3
- package/dist/adapters/openai-agents-sdk.d.ts +3 -3
- package/dist/adapters/openai-agents-sdk.js +6 -5
- package/dist/adapters/openai-agents-sdk.js.map +1 -1
- package/dist/chunk-2INQL5TG.js +298 -0
- package/dist/chunk-2INQL5TG.js.map +1 -0
- package/dist/chunk-3CLWG72V.js +47 -0
- package/dist/chunk-3CLWG72V.js.map +1 -0
- package/dist/chunk-3DDB34BU.js +237 -0
- package/dist/chunk-3DDB34BU.js.map +1 -0
- package/dist/chunk-ABXDSTUV.js +685 -0
- package/dist/chunk-ABXDSTUV.js.map +1 -0
- package/dist/{chunk-3H3PVPPF.js → chunk-F5R46S7I.js} +151 -204
- package/dist/chunk-F5R46S7I.js.map +1 -0
- package/dist/chunk-FKAI54OM.js +234 -0
- package/dist/chunk-FKAI54OM.js.map +1 -0
- package/dist/chunk-KTVMMG33.js +1111 -0
- package/dist/chunk-KTVMMG33.js.map +1 -0
- package/dist/chunk-MSVIEEGR.js +269 -0
- package/dist/chunk-MSVIEEGR.js.map +1 -0
- package/dist/chunk-VJXGCWSZ.js +36 -0
- package/dist/chunk-VJXGCWSZ.js.map +1 -0
- package/dist/claude-bundles/full.js +311 -309
- package/dist/claude-bundles/lean.js +6 -6
- package/dist/claude-bundles/prompt.js +17 -0
- package/dist/generator/index.d.ts +2 -2
- package/dist/generator/index.js +8 -7
- package/dist/guardrail-hooks-CB23nhZV.d.ts +202 -0
- package/dist/hook-protocol-CFnNudiV.d.ts +96 -0
- package/dist/hooks-lite-CoWWnCRH.d.ts +428 -0
- package/dist/index-BlSepCSZ.d.ts +296 -0
- package/dist/index.d.ts +785 -105
- package/dist/index.js +2189 -634
- package/dist/index.js.map +1 -1
- package/dist/lib/claude-native/hooks-lite.d.ts +3 -26
- package/dist/lib/claude-native/hooks-lite.js +18 -36
- package/dist/lib/claude-native/hooks-prompt.d.ts +5 -0
- package/dist/lib/claude-native/hooks-prompt.js +33 -0
- package/dist/lib/claude-native/hooks-prompt.js.map +1 -0
- package/dist/lib/claude-native/index.d.ts +56 -214
- package/dist/lib/claude-native/index.js +79 -280
- package/dist/lib/claude-native/index.js.map +1 -1
- package/dist/{navigation-context-D_E1NIUf.d.ts → navigation-context-B-RpUg3_.d.ts} +1 -1
- package/dist/navigation-index-prompt-CbrS5laO.d.ts +43 -0
- package/dist/{task-runner-DfIEorkU.d.ts → task-runner-GWoI7_71.d.ts} +100 -493
- package/dist/workspace-user-prompt-submit-D11Iu0zO.d.ts +269 -0
- package/package.json +15 -6
- package/dist/chunk-3H3PVPPF.js.map +0 -1
- package/dist/chunk-DBM5XN67.js +0 -354
- package/dist/chunk-DBM5XN67.js.map +0 -1
- package/dist/chunk-KXGUWBGK.js +0 -370
- package/dist/chunk-KXGUWBGK.js.map +0 -1
- package/dist/chunk-LDCQZPDG.js +0 -11
- package/dist/chunk-LDCQZPDG.js.map +0 -1
- package/dist/chunk-N4KNGDYY.js +0 -1963
- package/dist/chunk-N4KNGDYY.js.map +0 -1
- package/dist/chunk-NMX4C6LC.js +0 -332
- package/dist/chunk-NMX4C6LC.js.map +0 -1
- package/dist/chunk-QVH5KKBR.js +0 -374
- package/dist/chunk-QVH5KKBR.js.map +0 -1
- package/dist/context-DKkamYX_.d.ts +0 -31
- package/dist/guardrail-hooks-slK-z0Dz.d.ts +0 -83
- package/dist/index-LqEvaRk-.d.ts +0 -299
- package/dist/workspace-pre-tool-use-C6nidc0q.d.ts +0 -333
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
`);return{permission:"deny",user_message:
|
|
5
|
-
`)
|
|
6
|
-
`)}function
|
|
1
|
+
import { createRequire as __aaacCreateRequire } from 'node:module';
|
|
2
|
+
const require = __aaacCreateRequire(import.meta.url);
|
|
3
|
+
var V=["block","warn","shadow","info","unresolved"],K="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"&&V.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 J(e){let t="";for(let r of e)r==="*"?t+="[^/]*":r==="?"?t+="[^/]":".+^$|()[]\\".includes(r)?t+="\\"+r:t+=r;return t}function Y(e){return e.endsWith("/")?`${e}**`:e}function h(e,t){let r=Y(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 i=r.slice(a+1,o).split(",").map(J);n+="(?:"+i.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 z(e){return e==="path"||e==="file"||e==="filename"||e.endsWith("_path")}function X(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 Q(e){return $(e,z)}var Z=new Set(["Read","Glob","Grep","LSP","Task","Agent","Skill","WebFetch","WebSearch","TodoWrite","AskUserQuestion","ToolSearch","EnterPlanMode","ExitPlanMode"]);function k(e,t){return Z.has(e??"")?"":Q(t)}function v(e){return $(e,X)}function ee(e){return e==="block"||e===K}function F(e){return e.filter(t=>!t.passed&&ee(t.action))}function te(e){return e.filter(t=>!t.passed&&t.action==="warn")}function j(e){return e.map(t=>`[${t.guardrail_id}] ${t.message}`).join(`
|
|
4
|
+
`)}function D(e){let t=j(e);return{permission:"deny",user_message:t,agent_message:t}}function re(...e){function t(i){let c=[];if(i.command)for(let s of e)c.push(...s.checkCommand(i.command));if(i.filePath)for(let s of e)c.push(...s.checkFilePath(i.filePath));if(i.filePath&&i.content)for(let s of e)c.push(...s.checkContent(i.filePath,i.content));return c}function r(i){let c=i.command??"";if(!c)return{};let s=t({command:c}),u=F(s),f=te(s);return u.length>0?D(u):f.length>0?{additionalContext:j(f)}:{}}function n(i,c){if(!i)return{};let s=F(t({filePath:i,content:c}));return s.length>0?D(s):{}}function a(i){return n(k(i.tool_name,i.tool_input),v(i.tool_input))}function o(i){return n(i.file_path??"",i.content??"")}return{beforeShellExecution:r,preToolUse:a,afterFileEdit:o,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 re({checkCommand(o){let i=[];for(let c of r){let s=!c.pattern.test(o);i.push({guardrail_id:c.guardrail_id,passed:s,action:c.action,message:s?"":c.message})}return i},checkFilePath(o){let i=[];for(let c of n){if(c.exclude_glob&&h(c.exclude_glob,o))continue;let s=h(c.pattern,o);i.push({guardrail_id:c.guardrail_id,passed:!s,action:c.action,message:s?c.message:""})}return i},checkContent(o,i){let c=[];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(i);c.push({guardrail_id:s.guardrail_id,passed:!u,action:s.action,message:u?s.message:""})}return c}},...t)}import{readFile as le,writeFile as U,rename as fe,stat as de,mkdir as pe}from"fs/promises";import{join as me}from"path";import{randomBytes as he}from"crypto";import{stat as _e}from"fs/promises";var ne=["SessionStart","UserPromptSubmit","PreToolUse"],A=e=>new Error(`Not a hook payload: ${e.slice(0,100)}`),m=e=>e===void 0||typeof e=="string";function oe(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 ie(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)&&oe(e.tool_input);default:return!1}}function ae(e){let t=JSON.parse(e);if(typeof t!="object"||t===null||Array.isArray(t))throw A(e);let r=t;if(typeof r.hook_event_name=="string"&&r.hookEventName===void 0&&(r.hookEventName=r.hook_event_name),!ne.includes(r.hookEventName)){if(typeof r.hookEventName=="string")return;throw A(e)}if(!ie(r))throw A(e);return r}async function se(){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 ae(t)}function ce(e){process.stdout.write(JSON.stringify(e)+`
|
|
5
|
+
`)}function ue(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 ge(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 me(t,`${o}.json`)}async function n(){await pe(t,{recursive:!0})}return{async read(o,i){let c;try{c=JSON.parse(await le(r(o),"utf-8"))}catch{return null}return ge(c,i)?c:null},async write(o,i,c,s){await n();let u={data:i,writtenAt:new Date().toISOString(),sourceHash:c,...s?{sourceFiles:s}:{}},f=JSON.stringify(u,null,2),d=r(o),l=`${d}.${he(4).toString("hex")}.tmp`;await U(l,f,"utf-8");try{await fe(l,d)}catch{await U(d,f,"utf-8")}},async getFileMtime(o){try{return(await de(o)).mtimeMs}catch{return null}}}}function ye(e){return e.map(String).join(":")}var be=".guardrails";function we(e){return`${e}${be}`}var H="navigation-index";async function ke(e){let t=[];for(let r of e)try{let n=await _e(r);t.push(n.mtimeMs)}catch{t.push(`missing:${r}`)}return ye(t)}async function S(e){let t=e.cacheKey??H,r=_({cacheDir:e.cacheDir}),n=await r.read(t,y);if(!n?.sourceFiles||await ke(n.sourceFiles)!==n.sourceHash)return;let o=await r.read(we(t),I);if(o?.sourceHash===n.sourceHash)return{navigationIndex:n.data,guardrailRules:o.data}}function R(e,t){let r=t.artifacts??{},n=[];for(let[a,o]of Object.entries(r)){let i=o?.files?.path_patterns;if(Array.isArray(i)){for(let c of i)if(typeof c=="string"&&h(c,e)){n.push({artifactId:a,artifact:o,matchedPattern:c});break}}}return n}function C(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 ve={"navigation-index":"the artifact edit guard","guardrail-rules":"the DSL guardrails"};function b(e,t){let r=t?` for ${t}`:"";return`[guard-unavailable] ${ve[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 Pe(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 i=t.beforeShellExecution({command:n.tool_input?.command});if(i.permission==="deny")return p(i.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 R(a,e.navigationIndex)){let i=C(o);if(i.protected)return p(i.reason)}}return g()}}var G=100;function M(e,t){let{navigationIndex:r,maxCandidates:n=G}=t,a=x(r),o=[],i=e.toLowerCase(),c=s=>Ae(t.pathPrefix,s);for(let{id:s,artifact:u}of a){let f=u.properties??{},d=u.files?.path_patterns??[];(!e||s.toLowerCase().includes(i))&&o.push({label:s,path:c(d.length>0?String(d[0]):s),kind:"artifact",authority:f.authority,manual_edit:f.manual_edit,score:Se(s,u,e)});for(let l of d)typeof l=="string"&&(l.includes("*")||l.includes("?")||(!e||l.toLowerCase().includes(i))&&o.push({label:l,path:c(l),kind:"file",artifact:s,authority:f.authority,manual_edit:f.manual_edit,score:Re(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 Ae(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(`
|
|
6
|
+
`)}function Se(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 Re(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 Ce(e,t){let r=t.trim(),n=M(r,{navigationIndex:e});return B(n)}async function xe(e,t,r,n=G){let a=r.trim(),o=_({cacheDir:e}),i=[];for(let c of t){let s=await o.read(c.cacheKey,y);s&&i.push(...M(a,{navigationIndex:s.data,pathPrefix:c.memberPath,maxCandidates:Number.POSITIVE_INFINITY}))}return i.sort((c,s)=>s.score!==c.score?s.score-c.score:c.label.localeCompare(s.label)),B(i.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 i of t){let c=i.root,s=c.endsWith("/")?c:c+"/";n.startsWith(s)&&s.length>o&&(a=i,o=s.length)}return a}function Ee(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 Te(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 Oe(e){let t=new Map;async function r(a){if(t.has(a.name))return t.get(a.name);let o=await S({cacheDir:e.cacheDir,cacheKey:a.cacheKey}),i=o?{...o,hooks:P(o.guardrailRules)}:void 0;return t.set(a.name,i),i}function n(a){for(let o of Te(a)){let i=W(o,e.members,e.workspaceRoot);if(i)return[i]}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 O=T.hooks.beforeShellExecution({command:d});if(O.permission==="deny")return p(O.user_message)}}let i=L(o);if(!i)return g();let c=W(i,e.members,e.workspaceRoot);if(!c)return g();let s=await r(c);if(!s)return p(b("navigation-index",`member "${c.name}"`));let u=Ee(i,c.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 R(u,s.navigationIndex)){let l=C(d);if(l.protected)return p(l.reason)}return g()}}export{H as DEFAULT_CACHE_KEY,ue as buildContextResponse,_ as createCacheStore,Pe as createPreToolUseHandler,Oe as createWorkspacePreToolUseHandler,ce as emitHookOutput,Ce as handleFileSuggestion,xe as handleWorkspaceFileSuggestion,y as isCachedRecord,x as listArtifacts,S as readFreshNavigationBuild,se as readHookInput};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createRequire as __aaacCreateRequire } from 'node:module';
|
|
2
|
+
const require = __aaacCreateRequire(import.meta.url);
|
|
3
|
+
function N(t){if(typeof t!="object"||t===null)return!1;let e=t;return typeof e.system=="object"&&e.system!==null&&typeof e.artifacts=="object"&&e.artifacts!==null}function f(t){let e=t.system,a=t.artifacts??{},i=Object.keys(a),r=["## Project Navigation Index"],o=e?.name?`${e.name}${e.id?` (${e.id})`:""}`:e?.id??"unknown";if(r.push(`System: ${o}
|
|
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
|
+
`))}return r.join(`
|
|
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(`
|
|
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
|
+
`))}}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
|
+
${r.join(`
|
|
11
|
+
`)}`}function B(t,e){if(!t.trim())return[];let a=E(e),i=t.toLowerCase(),r=[],o=new Set;for(let{id:n,artifact:c}of a){if(i.includes(n.toLowerCase())&&!o.has(n)){o.add(n),r.push({artifactId:n,artifact:c});continue}let s=c.files?.path_patterns??[];for(let d of s){if(typeof d!="string")continue;let u=d.replace(/[*?]/g,"").replace(/\{.*\}/g,"");if(u.length>3&&i.includes(u.toLowerCase())&&!o.has(n)){o.add(n),r.push({artifactId:n,artifact:c});break}}}return r}function j({member:t,result:e}){let a=f(e.navigationIndex),i=e.fromCache?"(loaded from cache)":"(freshly built)",r=h(e.diagnostics,`${t.name} navigation-index`);return`### Member: ${t.name} ${i}
|
|
12
|
+
${a}`+(r?`
|
|
13
|
+
|
|
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
|
+
|
|
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};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { b as buildGuardrailContext } from '../context-DKkamYX_.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-BlSepCSZ.js';
|
|
3
2
|
import 'zod';
|
|
3
|
+
import '../guardrail-hooks-CB23nhZV.js';
|
package/dist/generator/index.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
|
-
ComponentOverrideSchema,
|
|
3
|
-
DEFAULT_CONFIG_PATH,
|
|
4
2
|
ProjectConfigSchema,
|
|
5
3
|
buildGuardrailContext,
|
|
6
|
-
loadProjectConfig
|
|
7
|
-
|
|
4
|
+
loadProjectConfig,
|
|
5
|
+
parseProjectManifest,
|
|
6
|
+
readProjectManifest
|
|
7
|
+
} from "../chunk-F5R46S7I.js";
|
|
8
|
+
import "../chunk-MSVIEEGR.js";
|
|
8
9
|
import "../chunk-BJ7B4R26.js";
|
|
9
10
|
export {
|
|
10
|
-
ComponentOverrideSchema,
|
|
11
|
-
DEFAULT_CONFIG_PATH,
|
|
12
11
|
ProjectConfigSchema,
|
|
13
12
|
buildGuardrailContext,
|
|
14
|
-
loadProjectConfig
|
|
13
|
+
loadProjectConfig,
|
|
14
|
+
parseProjectManifest,
|
|
15
|
+
readProjectManifest
|
|
15
16
|
};
|
|
16
17
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SDK Guardrail Hook Bridge — generic adapter from guardrail check functions to
|
|
3
|
+
* SDK-compatible hook responses.
|
|
4
|
+
*
|
|
5
|
+
* Embedded guardrail rules are converted via createGuardrailHooksFromRules(),
|
|
6
|
+
* which delegates to createGuardrailHooks(). All hook logic lives here.
|
|
7
|
+
*
|
|
8
|
+
* Every check this module runs arrives as an ARGUMENT. It has no ambient
|
|
9
|
+
* source: it does not know what a plugin is, and it reaches for no registry, so
|
|
10
|
+
* what a route enforces is decided by that route and is readable at its call
|
|
11
|
+
* site. This is also what keeps the module light enough to sit on the lean
|
|
12
|
+
* hot-path graph — see `PluginRegistry.guardrailChecks` for the measurement and
|
|
13
|
+
* for which layer supplies the plugin source.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Enforcement action of a guardrail.
|
|
17
|
+
*
|
|
18
|
+
* `block` / `warn` / `shadow` / `info` are DECLARED by the active guardrail
|
|
19
|
+
* policy. `unresolved` is not an enforcement level a policy can declare: it is
|
|
20
|
+
* the state of a guardrail that has a binding implementation while the active
|
|
21
|
+
* policy declares no action for it (no `active_guardrail_policy` in the project
|
|
22
|
+
* manifest, an unknown policy name, or a policy with no rule for the guardrail).
|
|
23
|
+
*
|
|
24
|
+
* An unresolved guardrail DENIES — see `getBlockingViolations`. Substituting a
|
|
25
|
+
* permissive default here is what turned every `action: block` guardrail in a
|
|
26
|
+
* policy-less project into a no-op while the guardrail cache still listed it
|
|
27
|
+
* (#293); the action is not knowable, so the operation the guardrail covers is
|
|
28
|
+
* refused and the message says how to fix the manifest.
|
|
29
|
+
*
|
|
30
|
+
* ONE declaration for the set, so the type and the check `isGuardrailRuleData`
|
|
31
|
+
* performs cannot name different ones — a bare union has nothing a predicate
|
|
32
|
+
* can read, and the rules cross a process boundary as JSON.
|
|
33
|
+
*/
|
|
34
|
+
declare const GUARDRAIL_ACTIONS: readonly ["block", "warn", "shadow", "info", "unresolved"];
|
|
35
|
+
type GuardrailAction = (typeof GUARDRAIL_ACTIONS)[number];
|
|
36
|
+
/** The action of a guardrail whose active policy declares none (see GuardrailAction). */
|
|
37
|
+
declare const UNRESOLVED_GUARDRAIL_ACTION: "unresolved";
|
|
38
|
+
interface GuardrailCheckResult {
|
|
39
|
+
guardrail_id: string;
|
|
40
|
+
passed: boolean;
|
|
41
|
+
action: GuardrailAction;
|
|
42
|
+
message: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* What a guardrail hook answers.
|
|
46
|
+
*
|
|
47
|
+
* A refusal CARRIES ITS MESSAGE — one fact, not two independently optional
|
|
48
|
+
* ones. Declared as separate optionals, every consumer had to supply a value
|
|
49
|
+
* for a case no producer can reach (`beforeShellExecution`, `preToolUse` and
|
|
50
|
+
* `afterFileEdit` all refuse through `denyResponse`, which always writes one),
|
|
51
|
+
* and they supplied three different ones: two hand-written copies of "Command
|
|
52
|
+
* blocked by guardrail" in the PreToolUse routes and a fall-back to
|
|
53
|
+
* `agent_message` in the SDK adapter (#311). Nothing rejected a fourth, and
|
|
54
|
+
* nothing noticed when one of them drifted, because a string literal that
|
|
55
|
+
* disagrees with another string literal is not a type error.
|
|
56
|
+
*
|
|
57
|
+
* So the union states what the producer already guarantees, and the question
|
|
58
|
+
* disappears instead of being answered in more places.
|
|
59
|
+
*/
|
|
60
|
+
type HookResponse = {
|
|
61
|
+
permission: "deny";
|
|
62
|
+
/** Every blocking violation, rendered. Never empty — a refusal has a cause. */
|
|
63
|
+
user_message: string;
|
|
64
|
+
agent_message: string;
|
|
65
|
+
additionalContext?: undefined;
|
|
66
|
+
} | {
|
|
67
|
+
permission?: undefined;
|
|
68
|
+
user_message?: undefined;
|
|
69
|
+
agent_message?: undefined;
|
|
70
|
+
/** Violations to surface to the agent without refusing. */
|
|
71
|
+
additionalContext?: string;
|
|
72
|
+
};
|
|
73
|
+
interface GuardrailRule {
|
|
74
|
+
guardrail_id: string;
|
|
75
|
+
pattern: string;
|
|
76
|
+
action: GuardrailAction;
|
|
77
|
+
message: string;
|
|
78
|
+
file_glob?: string;
|
|
79
|
+
exclude_glob?: string;
|
|
80
|
+
}
|
|
81
|
+
interface GuardrailRuleData {
|
|
82
|
+
commandRules: GuardrailRule[];
|
|
83
|
+
fileRules: GuardrailRule[];
|
|
84
|
+
contentRules: GuardrailRule[];
|
|
85
|
+
}
|
|
86
|
+
interface GuardrailCheckFunctions {
|
|
87
|
+
checkCommand: (command: string) => GuardrailCheckResult[];
|
|
88
|
+
checkFilePath: (filePath: string) => GuardrailCheckResult[];
|
|
89
|
+
checkContent: (filePath: string, content: string) => GuardrailCheckResult[];
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* What one check is asked about: a command, a path, or a path and the content
|
|
93
|
+
* about to go into it. Nothing here names an AGENT.
|
|
94
|
+
*
|
|
95
|
+
* Which rules an agent is checked against is settled before an evaluator
|
|
96
|
+
* exists, by the layer that knows where rules come from — see
|
|
97
|
+
* `createAgentGuardrailHooks` in `execute.ts`, the one constructor of per-agent
|
|
98
|
+
* hooks. An agent id travelling inside the context would mean that same
|
|
99
|
+
* question could also be answered later, from in here, and it did: a second
|
|
100
|
+
* per-agent constructor exported beside that one wrote `agentId` on every
|
|
101
|
+
* context it forwarded, no gate read it, and the two disagreed on memoisation
|
|
102
|
+
* and on what an agent with no rules gets (#333).
|
|
103
|
+
*
|
|
104
|
+
* So the field is gone, and an OBJECT LITERAL naming an agent is now TS2353 —
|
|
105
|
+
* which is what makes that constructor un-pasteable verbatim.
|
|
106
|
+
* `adapter-guardrail-hooks.test.ts` pins the absence with a `@ts-expect-error`
|
|
107
|
+
* that turns into TS2578 if the field returns.
|
|
108
|
+
*
|
|
109
|
+
* That is the whole of what the type says, and it is less than it sounds.
|
|
110
|
+
* Excess-property checking reaches object literals only: an `as HookContext`
|
|
111
|
+
* cast, an interface that extends this one, a literal bound to a variable
|
|
112
|
+
* first, and a plain `Record<string, unknown>` all compile — measured, not
|
|
113
|
+
* assumed. And a second per-agent constructor that simply never writes an agent
|
|
114
|
+
* id needs none of them and compiles as it is. What is removed here is the
|
|
115
|
+
* AFFORDANCE the duplicate happened to use, not the possibility of another one.
|
|
116
|
+
* The invariant — ONE constructor of per-agent hooks — is held by the
|
|
117
|
+
* declaration on `createAgentGuardrailHooks` and by reading it, and nothing
|
|
118
|
+
* mechanical will fail if it is broken.
|
|
119
|
+
*/
|
|
120
|
+
interface HookContext {
|
|
121
|
+
command?: string;
|
|
122
|
+
filePath?: string;
|
|
123
|
+
content?: string;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* The guardrail gates, one per payload SHAPE — not one per rule kind.
|
|
127
|
+
*
|
|
128
|
+
* Which gate a caller picks is decided by what it holds, never by which rules
|
|
129
|
+
* it wants consulted: every gate runs every rule the context can answer. An
|
|
130
|
+
* object with four methods hid the opposite for as long as this existed — the
|
|
131
|
+
* Claude Code PreToolUse route called `beforeShellExecution` and nothing else,
|
|
132
|
+
* so a project's `file_glob` and `content_regex` guardrails were enforced by
|
|
133
|
+
* `guard evaluate` and by the SDK adapter while the session a person actually
|
|
134
|
+
* works in never consulted them, and no type or single-route test could say so
|
|
135
|
+
* (#316).
|
|
136
|
+
*/
|
|
137
|
+
interface GuardrailHooks {
|
|
138
|
+
/** A command about to run. Claude Code PreToolUse (both routes), `guard evaluate`. */
|
|
139
|
+
beforeShellExecution: (input: {
|
|
140
|
+
command?: string;
|
|
141
|
+
}) => HookResponse;
|
|
142
|
+
/**
|
|
143
|
+
* A TOOL INPUT, verbatim: `toolTargetPath` reads the file out of it and
|
|
144
|
+
* `toolPendingContent` the text about to go in. The single-component Claude
|
|
145
|
+
* Code PreToolUse route, `guard evaluate` and the Claude SDK adapter.
|
|
146
|
+
*/
|
|
147
|
+
preToolUse: (input: {
|
|
148
|
+
tool_name?: string;
|
|
149
|
+
tool_input?: Record<string, unknown>;
|
|
150
|
+
}) => HookResponse;
|
|
151
|
+
/**
|
|
152
|
+
* A file write whose path and content the caller has ALREADY extracted —
|
|
153
|
+
* Cursor's after-file-edit event, where both are top-level protocol fields,
|
|
154
|
+
* and the workspace Claude Code PreToolUse route, which must ask about the
|
|
155
|
+
* member-repo-relative path (`stripMemberPrefix`) rather than the one the
|
|
156
|
+
* tool named, because member guardrail patterns are written in that space.
|
|
157
|
+
*/
|
|
158
|
+
afterFileEdit: (input: {
|
|
159
|
+
file_path?: string;
|
|
160
|
+
content?: string;
|
|
161
|
+
}) => HookResponse;
|
|
162
|
+
/** The shared check runner. Not a gate: `getBlockingViolations` is what refuses. */
|
|
163
|
+
runChecks: (ctx: HookContext) => GuardrailCheckResult[];
|
|
164
|
+
}
|
|
165
|
+
declare function getBlockingViolations(results: GuardrailCheckResult[]): GuardrailCheckResult[];
|
|
166
|
+
declare function getWarnings(results: GuardrailCheckResult[]): GuardrailCheckResult[];
|
|
167
|
+
declare function hasBlockingViolation(results: GuardrailCheckResult[]): boolean;
|
|
168
|
+
/**
|
|
169
|
+
* Create SDK hook functions from guardrail check functions.
|
|
170
|
+
*
|
|
171
|
+
* Returns hook functions in the format expected by the Claude SDK, plus a
|
|
172
|
+
* generic runChecks() for programmatic use.
|
|
173
|
+
*
|
|
174
|
+
* Takes any number of check SOURCES and asks every one of them every question
|
|
175
|
+
* the context can answer — which is the same rule `GuardrailHooks` states about
|
|
176
|
+
* its gates, one level down. A source is not a rule kind and not a route: it is
|
|
177
|
+
* one supplier of checks, and the hooks it produces cannot tell which supplier a
|
|
178
|
+
* verdict came from. That is what lets a second supplier be added (the execution
|
|
179
|
+
* layer adds the process's plugin guardrails, see
|
|
180
|
+
* `PluginRegistry.guardrailChecks`) without there being a second EVALUATOR —
|
|
181
|
+
* the property #304 and #316 exist to hold.
|
|
182
|
+
*
|
|
183
|
+
* Ordering is by question, then by source, so the sources a caller lists are
|
|
184
|
+
* consulted in the order it listed them and a refusal reads the same way every
|
|
185
|
+
* time (`renderViolations` joins in result order).
|
|
186
|
+
*
|
|
187
|
+
* Zero sources is a legitimate answer, not a degenerate one: it is what an agent
|
|
188
|
+
* with no resolved rules and no plugins has, and the hooks it gets deny nothing.
|
|
189
|
+
*/
|
|
190
|
+
declare function createGuardrailHooks(...sources: GuardrailCheckFunctions[]): GuardrailHooks;
|
|
191
|
+
/**
|
|
192
|
+
* Create SDK hook functions from embedded guardrail rule data.
|
|
193
|
+
*
|
|
194
|
+
* The rules are the first check source; `extraSources` are consulted after
|
|
195
|
+
* them, on every question. This is the funnel every route reaches the evaluator
|
|
196
|
+
* through — both Claude Code PreToolUse routes, `guard evaluate` and the
|
|
197
|
+
* execution layer — so what distinguishes those routes is visible here as an
|
|
198
|
+
* argument list and nowhere else.
|
|
199
|
+
*/
|
|
200
|
+
declare function createGuardrailHooksFromRules(rules: GuardrailRuleData, ...extraSources: GuardrailCheckFunctions[]): GuardrailHooks;
|
|
201
|
+
|
|
202
|
+
export { type GuardrailHooks as G, type HookResponse as H, UNRESOLVED_GUARDRAIL_ACTION as U, type GuardrailRuleData as a, type GuardrailCheckFunctions as b, type GuardrailCheckResult as c, type GuardrailAction as d, type GuardrailRule as e, type HookContext as f, createGuardrailHooks as g, createGuardrailHooksFromRules as h, getBlockingViolations as i, getWarnings as j, hasBlockingViolation as k };
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Claude Code Hook Protocol — parse stdin JSON input and emit hook response JSON.
|
|
3
|
+
*
|
|
4
|
+
* Implements the protocol defined at https://code.claude.com/docs/en/hooks
|
|
5
|
+
* for SessionStart, UserPromptSubmit, and PreToolUse hook events.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* One declaration for the events this harness models, so the type and the check
|
|
9
|
+
* `parseHookInput` performs cannot name different sets.
|
|
10
|
+
*/
|
|
11
|
+
declare const MODELLED_EVENTS: readonly ["SessionStart", "UserPromptSubmit", "PreToolUse"];
|
|
12
|
+
type HookEventName = (typeof MODELLED_EVENTS)[number];
|
|
13
|
+
interface SessionStartInput {
|
|
14
|
+
hookEventName: "SessionStart";
|
|
15
|
+
session_id?: string;
|
|
16
|
+
type?: "new" | "resume" | "clear" | "compact";
|
|
17
|
+
}
|
|
18
|
+
interface UserPromptSubmitInput {
|
|
19
|
+
hookEventName: "UserPromptSubmit";
|
|
20
|
+
session_id?: string;
|
|
21
|
+
prompt?: string;
|
|
22
|
+
}
|
|
23
|
+
interface PreToolUseInput {
|
|
24
|
+
hookEventName: "PreToolUse";
|
|
25
|
+
session_id?: string;
|
|
26
|
+
tool_name?: string;
|
|
27
|
+
tool_input?: {
|
|
28
|
+
file_path?: string;
|
|
29
|
+
path?: string;
|
|
30
|
+
command?: string;
|
|
31
|
+
content?: string;
|
|
32
|
+
[key: string]: unknown;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
type HookInput = SessionStartInput | UserPromptSubmitInput | PreToolUseInput;
|
|
36
|
+
type PermissionDecision = "allow" | "deny" | "ask";
|
|
37
|
+
interface HookOutput {
|
|
38
|
+
/** Hook-specific output envelope. */
|
|
39
|
+
hookSpecificOutput?: {
|
|
40
|
+
hookEventName: HookEventName;
|
|
41
|
+
/** Additional context injected into the session. */
|
|
42
|
+
additionalContext?: string;
|
|
43
|
+
/** Permission decision for PreToolUse hooks. */
|
|
44
|
+
permissionDecision?: PermissionDecision;
|
|
45
|
+
/** Reason for the permission decision. */
|
|
46
|
+
permissionDecisionReason?: string;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Parse hook input from a raw JSON string (typically from stdin).
|
|
51
|
+
*
|
|
52
|
+
* Three answers, and the difference between the last two is load-bearing:
|
|
53
|
+
*
|
|
54
|
+
* • a {@link HookInput} — the payload names an event this harness models and
|
|
55
|
+
* carries the fields that member declares;
|
|
56
|
+
* • THROWS — the bytes are not a hook payload at all (not a JSON object, no
|
|
57
|
+
* event name, or a modelled event whose fields are not what it declares).
|
|
58
|
+
* `null` stdin used to reach `parsed.hook_event_name` and answer
|
|
59
|
+
* `TypeError: … reading 'hook_event_name'`;
|
|
60
|
+
* • `undefined` — a well-formed payload for an event this harness does not
|
|
61
|
+
* model. NOT a throw, and that is not a nicety. `pre-tool-use.sh` turns any
|
|
62
|
+
* non-zero bin exit into `exit 2`, which is the one code that BLOCKS a tool
|
|
63
|
+
* call — deliberately, because a guard that could not run must refuse rather
|
|
64
|
+
* than allow (#304). Refusing input we simply do not handle would spend that
|
|
65
|
+
* on every tool call after a version skew, or on a user who registered the
|
|
66
|
+
* launcher under another event, which `settings-merge.ts` explicitly
|
|
67
|
+
* contemplates. Measured end to end: `pre-tool-use.sh` exits 2 on a bin
|
|
68
|
+
* throw, `session-start.sh` and `user-prompt-submit.sh` exit 1 (non-blocking
|
|
69
|
+
* per the protocol — only exit 2 blocks).
|
|
70
|
+
*
|
|
71
|
+
* Routing between the three modelled events stays with each bin's own guard,
|
|
72
|
+
* which spends exit 0 on "not mine".
|
|
73
|
+
*/
|
|
74
|
+
declare function parseHookInput(raw: string): HookInput | undefined;
|
|
75
|
+
/**
|
|
76
|
+
* Read all of stdin and parse as hook input JSON.
|
|
77
|
+
*/
|
|
78
|
+
declare function readHookInput(): Promise<HookInput | undefined>;
|
|
79
|
+
/**
|
|
80
|
+
* Emit a hook response as JSON to stdout.
|
|
81
|
+
*/
|
|
82
|
+
declare function emitHookOutput(output: HookOutput): void;
|
|
83
|
+
/**
|
|
84
|
+
* Build a response that injects additional context into the session.
|
|
85
|
+
*/
|
|
86
|
+
declare function buildContextResponse(eventName: HookEventName, additionalContext: string): HookOutput;
|
|
87
|
+
/**
|
|
88
|
+
* Build a deny response for PreToolUse hooks.
|
|
89
|
+
*/
|
|
90
|
+
declare function buildDenyResponse(reason: string): HookOutput;
|
|
91
|
+
/**
|
|
92
|
+
* Build an allow response (empty output = allow by default).
|
|
93
|
+
*/
|
|
94
|
+
declare function buildAllowResponse(): HookOutput;
|
|
95
|
+
|
|
96
|
+
export { type HookOutput as H, type PermissionDecision as P, type SessionStartInput as S, type UserPromptSubmitInput as U, type HookEventName as a, type HookInput as b, type PreToolUseInput as c, buildAllowResponse as d, emitHookOutput as e, buildContextResponse as f, buildDenyResponse as g, parseHookInput as p, readHookInput as r };
|