@aaac/runtime 0.1.52 → 0.1.53
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/dist/{chunk-4OMCAGNY.js → chunk-KNYJV2Q6.js} +60 -1
- package/dist/chunk-KNYJV2Q6.js.map +1 -0
- package/dist/{chunk-C6XCN33A.js → chunk-M3GJAHLX.js} +3 -2
- package/dist/{chunk-C6XCN33A.js.map → chunk-M3GJAHLX.js.map} +1 -1
- package/dist/claude-bundles/full.js +162 -162
- package/dist/claude-bundles/lean.js +6 -6
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/lib/claude-native/hooks-lite.d.ts +25 -6
- package/dist/lib/claude-native/hooks-lite.js +1 -1
- package/dist/lib/claude-native/index.d.ts +1 -1
- package/dist/lib/claude-native/index.js +11 -2
- package/dist/lib/claude-native/index.js.map +1 -1
- package/dist/{navigation-context-BE1KHJ_8.d.ts → navigation-context-xrReMkTn.d.ts} +11 -0
- package/package.json +2 -1
- package/dist/chunk-4OMCAGNY.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";var __aaac_runtime=(()=>{var
|
|
2
|
-
`);return{permission:"deny",user_message:
|
|
3
|
-
`)}:{}}function n(o){let s=o.tool_input?.file_path??o.tool_input?.path??"";if(!s)return{};let
|
|
4
|
-
`);return{permission:"deny",user_message:
|
|
5
|
-
`);return{permission:"deny",user_message:
|
|
6
|
-
`)}function
|
|
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(`
|
|
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);})();
|
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { OperationIR, ComponentIR } from '@aaac/contracts';
|
|
|
7
7
|
import { OtelEmitter } from '@aaac/observability';
|
|
8
8
|
export { ExecutionEnvelope } from '@aaac/observability';
|
|
9
9
|
import { ResolvedConfig } from './generator/index.js';
|
|
10
|
-
export { a as NavigationContext, N as NavigationContextOptions, b as buildNavigationContext } from './navigation-context-
|
|
10
|
+
export { a as NavigationContext, N as NavigationContextOptions, b as buildNavigationContext } from './navigation-context-xrReMkTn.js';
|
|
11
11
|
import './context-DKkamYX_.js';
|
|
12
12
|
|
|
13
13
|
/**
|
package/dist/index.js
CHANGED
|
@@ -35,7 +35,7 @@ import {
|
|
|
35
35
|
shouldInjectAnalyzerExplorationMandate,
|
|
36
36
|
zodSchemaToPromptDescription,
|
|
37
37
|
zodSchemaToYamlExample
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-M3GJAHLX.js";
|
|
39
39
|
import {
|
|
40
40
|
jsonSchemaToZod
|
|
41
41
|
} from "./chunk-ET6TGQRT.js";
|
|
@@ -8443,11 +8443,13 @@ function resolveWorkspaceMembers(ws) {
|
|
|
8443
8443
|
return ws.members.map((m) => {
|
|
8444
8444
|
const name = basename2(m.path.replace(/\/+$/, "")) || m.path;
|
|
8445
8445
|
const configPath = m.config_path ?? "./agent-contracts.yaml";
|
|
8446
|
+
const cacheKey2 = `navigation-index.${name}`;
|
|
8446
8447
|
return {
|
|
8447
8448
|
name,
|
|
8448
8449
|
path: m.path,
|
|
8449
8450
|
configPath,
|
|
8450
|
-
cacheKey:
|
|
8451
|
+
cacheKey: cacheKey2,
|
|
8452
|
+
guardrailCacheKey: `${cacheKey2}.guardrails`
|
|
8451
8453
|
};
|
|
8452
8454
|
});
|
|
8453
8455
|
}
|