@aaac/runtime 0.1.43 → 0.1.49
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/adapters/adk-sdk.js +3 -3
- package/dist/{chunk-IGSKPSU3.js → chunk-C6XCN33A.js} +5 -5
- package/dist/chunk-VMJPJ7B7.js +316 -0
- package/dist/chunk-VMJPJ7B7.js.map +1 -0
- package/dist/{chunk-735UA5HV.js → chunk-YZQRSVDZ.js} +41 -4
- package/dist/chunk-YZQRSVDZ.js.map +1 -0
- package/dist/claude-bundles/full.js +1154 -0
- package/dist/claude-bundles/lean.js +6 -0
- package/dist/generator/index.d.ts +13 -0
- package/dist/generator/index.js +1 -1
- package/dist/index.d.ts +10 -0
- package/dist/index.js +741 -19
- package/dist/index.js.map +1 -1
- package/dist/lib/claude-native/hooks-lite.d.ts +314 -0
- package/dist/lib/claude-native/hooks-lite.js +44 -0
- package/dist/lib/claude-native/hooks-lite.js.map +1 -0
- package/dist/lib/claude-native/index.d.ts +51 -207
- package/dist/lib/claude-native/index.js +71 -229
- package/dist/lib/claude-native/index.js.map +1 -1
- package/package.json +8 -3
- package/dist/chunk-735UA5HV.js.map +0 -1
- /package/dist/{chunk-IGSKPSU3.js.map → chunk-C6XCN33A.js.map} +0 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";var __aaac_runtime=(()=>{var _=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var J=Object.getOwnPropertyNames;var V=Object.prototype.hasOwnProperty;var g=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof require<"u"?require:t)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var K=(e,t)=>{for(var n in t)_(e,n,{get:t[n],enumerable:!0})},q=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of J(t))!V.call(e,i)&&i!==n&&_(e,i,{get:()=>t[i],enumerable:!(r=M(t,i))||r.enumerable});return e};var z=e=>q(_({},"__esModule",{value:!0}),e);var re={};K(re,{TimeoutError:()=>k,buildAllowResponse:()=>m,buildContextResponse:()=>W,buildDenyResponse:()=>p,computeSourceHash:()=>D,createCacheStore:()=>E,createExclusiveLock:()=>I,createPreToolUseHandler:()=>U,createWorkspacePreToolUseHandler:()=>L,emitHookOutput:()=>O,isProtectedArtifact:()=>b,listArtifacts:()=>N,parseHookInput:()=>v,readHookInput:()=>H,resolvePathToArtifacts:()=>w,routePathToMember:()=>S,stripMemberPrefix:()=>x,withDegrade:()=>j,withTimeout:()=>C});var Q=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 n=t;for(let r of this.plugins)!r.beforeTask||n===null||(n=await r.beforeTask(e,n));return n}async runAfterTask(e,t){let n=t;for(let r of this.plugins)r.afterTask&&(n=await r.afterTask(e,n));return n}applyContextEnhancers(e,t){let n=t;for(let r of this.plugins)r.contextEnhancer&&(n=r.contextEnhancer(e,n));return n}applyPromptBuilder(e){for(let t of this.plugins){if(!t.promptBuilder)continue;let n=t.promptBuilder(e);if(n!==null)return n}return null}applyPromptEnhancers(e,t,n){let r=t;for(let i of this.plugins)i.promptEnhancer&&(r=i.promptEnhancer(e,r,n));return r}evaluateCommandGuardrails(e){let t=[];for(let n of this.plugins)n.customGuardrails?.evaluateCommand&&t.push(...n.customGuardrails.evaluateCommand(e));return t}evaluateFilePathGuardrails(e){let t=[];for(let n of this.plugins)n.customGuardrails?.evaluateFilePath&&t.push(...n.customGuardrails.evaluateFilePath(e));return t}evaluateFileContentGuardrails(e,t){let n=[];for(let r of this.plugins)r.customGuardrails?.evaluateFileContent&&n.push(...r.customGuardrails.evaluateFileContent(e,t));return n}async runBeforeWorkflow(e,t){for(let n of this.plugins)n.beforeWorkflow&&await n.beforeWorkflow(e,t)}async runAfterWorkflow(e,t){for(let n of this.plugins)n.afterWorkflow&&await n.afterWorkflow(e,t)}},y=new Q;function X(e){let t="";for(let n of e)n==="*"?t+="[^/]*":n==="?"?t+="[^/]":".+^$|()[]\\".includes(n)?t+="\\"+n:t+=n;return t}function h(e,t){let n="",r=0;for(;r<e.length;)if(e[r]==="*"&&e[r+1]==="*"&&e[r+2]==="/")n+="(?:.+/)?",r+=3;else if(e[r]==="*"&&e[r+1]==="*")n+=".*",r+=2;else if(e[r]==="*")n+="[^/]*",r+=1;else if(e[r]==="?")n+="[^/]",r+=1;else if(e[r]==="{"){let i=e.indexOf("}",r);if(i!==-1){let o=e.slice(r+1,i).split(",").map(X);n+="(?:"+o.join("|")+")",r=i+1}else n+="\\{",r+=1}else".+^$|()[]\\".includes(e[r])?(n+="\\"+e[r],r+=1):(n+=e[r],r+=1);return new RegExp("^"+n+"$").test(t)}function P(e){return e.filter(t=>!t.passed&&t.action==="block")}function Y(e){return e.filter(t=>!t.passed&&t.action==="warn")}function T(e){return{guardrail_id:e.guardrail_id,passed:!e.matched,action:e.action,message:e.matched?e.message:""}}function Z(e){function t(o){let s=[];return o.command&&(s.push(...e.checkCommand(o.command)),s.push(...y.evaluateCommandGuardrails(o.command).map(T))),o.filePath&&(s.push(...e.checkFilePath(o.filePath)),s.push(...y.evaluateFilePathGuardrails(o.filePath).map(T))),o.filePath&&o.content&&(s.push(...e.checkContent(o.filePath,o.content)),s.push(...y.evaluateFileContentGuardrails(o.filePath,o.content).map(T))),s}function n(o){let s=o.command??"";if(!s)return{};let a=t({command:s}),c=P(a),l=Y(a);if(c.length>0){let u=c.map(d=>`[${d.guardrail_id}] ${d.message}`).join(`
|
|
2
|
+
`);return{permission:"deny",user_message:u,agent_message:u}}return l.length>0?{additionalContext:l.map(u=>`[${u.guardrail_id}] ${u.message}`).join(`
|
|
3
|
+
`)}:{}}function r(o){let s=o.tool_input?.file_path??o.tool_input?.path??"";if(!s)return{};let a=t({filePath:s}),c=P(a);if(c.length>0){let l=c.map(u=>`[${u.guardrail_id}] ${u.message}`).join(`
|
|
4
|
+
`);return{permission:"deny",user_message:l,agent_message:l}}return{}}function i(o){let s=o.file_path??"",a=o.content??"";if(!s)return{};let c=t({filePath:s,content:a}),l=P(c);if(l.length>0){let u=l.map(d=>`[${d.guardrail_id}] ${d.message}`).join(`
|
|
5
|
+
`);return{permission:"deny",user_message:u,agent_message:u}}return{}}return{beforeShellExecution:n,preToolUse:r,afterFileEdit:i,runChecks:t}}function $(e){return e.startsWith("(?i)")?new RegExp(e.slice(4),"i"):new RegExp(e)}function G(e){let t=e.commandRules.map(i=>({guardrail_id:i.guardrail_id,pattern:$(i.pattern),action:i.action,message:i.message})),n=e.fileRules,r=e.contentRules.map(i=>({guardrail_id:i.guardrail_id,pattern:$(i.pattern),action:i.action,message:i.message,file_glob:i.file_glob,exclude_glob:i.exclude_glob}));return Z({checkCommand(i){let o=[];for(let s of t){let a=!s.pattern.test(i);o.push({guardrail_id:s.guardrail_id,passed:a,action:s.action,message:a?"":s.message})}return o},checkFilePath(i){let o=[];for(let s of n){if(s.exclude_glob&&h(s.exclude_glob,i))continue;let a=h(s.pattern,i);o.push({guardrail_id:s.guardrail_id,passed:!a,action:s.action,message:a?s.message:""})}return o},checkContent(i,o){let s=[];for(let a of r){if(a.file_glob&&!h(a.file_glob,i)||a.exclude_glob&&h(a.exclude_glob,i))continue;let c=a.pattern.test(o);s.push({guardrail_id:a.guardrail_id,passed:!c,action:a.action,message:c?a.message:""})}return s}})}var f=g("fs/promises"),A=g("path"),B=g("crypto"),R=g("path");function v(e){return JSON.parse(e)}async function H(){let e=[];for await(let n of process.stdin)e.push(Buffer.isBuffer(n)?n:Buffer.from(n));let t=Buffer.concat(e).toString("utf-8").trim();if(!t)throw new Error("Empty stdin \u2014 no hook input received");return v(t)}function O(e){process.stdout.write(JSON.stringify(e)+`
|
|
6
|
+
`)}function W(e,t){return{hookSpecificOutput:{hookEventName:e,additionalContext:t}}}function p(e){return{hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:e}}}function m(){return{}}function E(e){let{cacheDir:t}=e;function n(o){return(0,A.join)(t,`${o}.json`)}async function r(){await(0,f.mkdir)(t,{recursive:!0})}let i={async read(o){try{let s=await(0,f.readFile)(n(o),"utf-8");return JSON.parse(s)}catch{return null}},async write(o,s,a){await r();let c={data:s,writtenAt:new Date().toISOString(),sourceHash:a},l=JSON.stringify(c,null,2),u=n(o),d=`${u}.${(0,B.randomBytes)(4).toString("hex")}.tmp`;await(0,f.writeFile)(d,l,"utf-8");try{await(0,f.rename)(d,u)}catch{await(0,f.writeFile)(u,l,"utf-8")}},async readIfFresh(o,s){let a=await i.read(o);return!a||a.sourceHash!==s?null:a.data},async getFileMtime(o){try{return(await(0,f.stat)(o)).mtimeMs}catch{return null}}};return i}function D(e){return e.map(String).join(":")}var k=class extends Error{constructor(e){super(`Operation timed out after ${e}ms`),this.name="TimeoutError"}};async function C(e,t){if(t<=0)return e;let n,r=new Promise((i,o)=>{n=setTimeout(()=>o(new k(t)),t)});try{return await Promise.race([e,r])}finally{clearTimeout(n)}}function I(){let e=null;return{async run(t){return e||(e=t().finally(()=>{e=null}),e)}}}async function j(e,t,n){try{return{value:await C(e(),n),degraded:!1}}catch(r){let i=r instanceof k||r instanceof Error?r.message:String(r);return{value:t,degraded:!0,reason:i}}}function w(e,t){let n=t.artifacts??{},r=[];for(let[i,o]of Object.entries(n)){let s=o?.files?.path_patterns;if(Array.isArray(s)){for(let a of s)if(typeof a=="string"&&h(a,e)){r.push({artifactId:i,artifact:o,matchedPattern:a});break}}}return r}function b(e){let t=e.artifact.properties??{};if(t.authority==="generated"){let n=e.artifact.routes?.regenerate,r=n?` Run '${n}' 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.${r}`}}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 N(e){let t=e.artifacts??{};return Object.entries(t).map(([n,r])=>({id:n,artifact:r}))}var ee=new Set(["Edit","Write","MultiEdit","edit","write"]),te=new Set(["Bash","bash","Terminal","terminal"]);function U(e){let t=e.guardrailRules?G(e.guardrailRules):null;return async function(r){let i=r.tool_name??"",o=r.tool_input??{};if(ee.has(i)){let s=o.file_path??o.path??"";if(s){let a=w(s,e.navigationIndex);for(let c of a){let l=b(c);if(l.protected)return p(l.reason)}}}if(te.has(i)&&t){let s=o.command??"";if(s){let a=t.beforeShellExecution({command:s});if(a.permission==="deny")return p(a.user_message??"Command blocked by guardrail")}}return m()}}function S(e,t,n){if(!e)return null;let r=e.startsWith("/")?e:(0,R.resolve)(n,e),i=null,o=0;for(let s of t){let a=s.root,c=a.endsWith("/")?a:a+"/";r.startsWith(c)&&c.length>o&&(i=s,o=c.length)}return i}function x(e,t,n){let r=e.startsWith("/")?e:(0,R.resolve)(n,e),i=t.endsWith("/")?t:t+"/";return r.startsWith(i)?r.slice(i.length):e}var ne=new Set(["Edit","Write","MultiEdit","edit","write"]);function L(e){let t=E({cacheDir:e.cacheDir});return async function(r){let i=r.tool_name??"",o=r.tool_input??{};if(!ne.has(i))return m();let s=o.file_path??o.path??"";if(!s)return m();let a=S(s,e.members,e.workspaceRoot);if(!a)return m();let c=await t.read(a.cacheKey);if(!c)return m();let l=x(s,a.root,e.workspaceRoot),u=w(l,c.data);for(let d of u){let F=b(d);if(F.protected)return p(F.reason)}return m()}}return z(re);})();
|
|
@@ -215,6 +215,19 @@ declare const ProjectConfigSchema: z.ZodObject<{
|
|
|
215
215
|
}, z.core.$strip>>;
|
|
216
216
|
}, z.core.$strip>>;
|
|
217
217
|
}, z.core.$strict>>>;
|
|
218
|
+
workspace: z.ZodOptional<z.ZodObject<{
|
|
219
|
+
members: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
220
|
+
path: z.ZodString;
|
|
221
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
222
|
+
glob: z.ZodString;
|
|
223
|
+
}, z.core.$strip>]>>;
|
|
224
|
+
runtime: z.ZodOptional<z.ZodObject<{
|
|
225
|
+
resolve_from: z.ZodOptional<z.ZodString>;
|
|
226
|
+
}, z.core.$strip>>;
|
|
227
|
+
discovery: z.ZodDefault<z.ZodObject<{
|
|
228
|
+
max_depth: z.ZodDefault<z.ZodNumber>;
|
|
229
|
+
}, z.core.$strip>>;
|
|
230
|
+
}, z.core.$strip>>;
|
|
218
231
|
}, z.core.$strip>;
|
|
219
232
|
type ProjectConfig = z.infer<typeof ProjectConfigSchema>;
|
|
220
233
|
interface ResolvedProgressLog {
|
package/dist/generator/index.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -852,8 +852,18 @@ declare function guardStatus(opts?: GuardStatusOptions): Promise<GuardStatusResu
|
|
|
852
852
|
declare const ClaudeConfigSchema: z.ZodObject<{
|
|
853
853
|
output_dir: z.ZodDefault<z.ZodString>;
|
|
854
854
|
config_path: z.ZodDefault<z.ZodString>;
|
|
855
|
+
emit: z.ZodDefault<z.ZodObject<{
|
|
856
|
+
workflows: z.ZodDefault<z.ZodBoolean>;
|
|
857
|
+
}, z.core.$strip>>;
|
|
855
858
|
guard_command: z.ZodOptional<z.ZodString>;
|
|
856
859
|
component_id: z.ZodOptional<z.ZodString>;
|
|
860
|
+
workspace: z.ZodOptional<z.ZodObject<{
|
|
861
|
+
members: z.ZodArray<z.ZodObject<{
|
|
862
|
+
path: z.ZodString;
|
|
863
|
+
config_path: z.ZodOptional<z.ZodString>;
|
|
864
|
+
}, z.core.$strip>>;
|
|
865
|
+
resolve_from: z.ZodOptional<z.ZodString>;
|
|
866
|
+
}, z.core.$strip>>;
|
|
857
867
|
}, z.core.$strip>;
|
|
858
868
|
type ClaudeConfig = z.infer<typeof ClaudeConfigSchema>;
|
|
859
869
|
/** Parse and default-fill an opaque config payload from component.yaml. */
|