@xeno-corporation/xeno-agent-sdk 0.6.3 → 0.6.5

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.
@@ -20,13 +20,19 @@ interface AgentToolPolicy {
20
20
  allow?: string[];
21
21
  deny?: string[];
22
22
  }
23
+ type AgentDefinitionIsolation = "none" | "worktree";
23
24
  interface AgentDefinitionMetadata {
24
25
  name: string;
25
26
  scope: AgentDefinitionScope;
26
27
  path: string;
27
28
  description?: string;
28
29
  model?: string;
30
+ color?: string;
31
+ memory?: string;
32
+ isolation?: AgentDefinitionIsolation;
29
33
  tags: string[];
34
+ skills: string[];
35
+ hooks: string[];
30
36
  active: boolean;
31
37
  shadowedBy?: AgentDefinitionShadowRef;
32
38
  toolPolicy?: AgentToolPolicy;
@@ -95,6 +101,14 @@ declare function createAgentDefinitionFile(input: {
95
101
  cwd?: string;
96
102
  agentHome?: string;
97
103
  description?: string;
104
+ model?: string;
105
+ color?: string;
106
+ memory?: string;
107
+ isolation?: AgentDefinitionIsolation;
108
+ skills?: string[];
109
+ hooks?: string[];
110
+ toolPolicy?: AgentToolPolicy;
111
+ prompt?: string;
98
112
  force?: boolean;
99
113
  }): string;
100
- export { type AgentDefinition, type AgentDefinitionIssue, AgentDefinitionLoader, type AgentDefinitionLoaderOptions, type AgentDefinitionMetadata, AgentDefinitionResolver, type AgentDefinitionScanResult, type AgentDefinitionScope, type AgentDefinitionShadowRef, type AgentToolPolicy, createAgentDefinitionFile, createAgentDefinitionPromptSection, getProjectAgentDefinitionDirs, getProjectAgentDefinitionsDir, getUserAgentDefinitionsDir, isValidAgentDefinitionName, renderAgentDefinition, renderAgentDefinitions, resolveAgentDefinition, resolveAgentToolPolicy, scanAgentDefinitions, toAgentDefinitionMetadata, validateAgentDefinition };
114
+ export { type AgentDefinition, type AgentDefinitionIsolation, type AgentDefinitionIssue, AgentDefinitionLoader, type AgentDefinitionLoaderOptions, type AgentDefinitionMetadata, AgentDefinitionResolver, type AgentDefinitionScanResult, type AgentDefinitionScope, type AgentDefinitionShadowRef, type AgentToolPolicy, createAgentDefinitionFile, createAgentDefinitionPromptSection, getProjectAgentDefinitionDirs, getProjectAgentDefinitionsDir, getUserAgentDefinitionsDir, isValidAgentDefinitionName, renderAgentDefinition, renderAgentDefinitions, resolveAgentDefinition, resolveAgentToolPolicy, scanAgentDefinitions, toAgentDefinitionMetadata, validateAgentDefinition };
@@ -1,7 +1,7 @@
1
- import{existsSync as D,mkdirSync as M,readFileSync as B,readdirSync as N,writeFileSync as F}from"fs";import{homedir as C}from"os";import{basename as W,dirname as Y,join as g,parse as U,resolve as _}from"path";function $(n){let t=O(n);return{frontmatter:t.frontmatter,content:t.content.trim()}}function O(n){let t=n.replace(/^\uFEFF/,"");if(!t.startsWith("---"))return{frontmatter:{},content:n};let r=t.search(/\r?\n/);if(r<0||t.slice(0,r).trim()!=="---")return{frontmatter:{},content:n};let e=t.slice(r+(t[r]==="\r"?2:1)),i=e.match(/(?:^|\r?\n)---[ \t]*(?:\r?\n|$)/);if(!i||i.index===void 0)throw new Error("YAML frontmatter is not closed.");let o=e.slice(0,i.index),s=i[0],l=i.index+s.length;return{frontmatter:S(o),content:e.slice(l)}}function S(n){let t={},r=n.split(/\r?\n/);for(let e=0;e<r.length;e+=1){let i=r[e];if(!i.trim()||i.trimStart().startsWith("#"))continue;if(/^\s/.test(i))throw new Error(`Unexpected indentation at line ${e+1}.`);let o=L(i,e+1);if(o.key==="<<")throw new Error("YAML merge keys are not supported.");if(o.value!==""){t[o.key]=b(o.value,e+1);continue}let s=R(r,e+1);t[o.key]=s.value,e=s.nextIndex-1}return t}function R(n,t){let r=[],e=t;for(;e<n.length;e+=1){let o=n[e];if(!o.trim()){r.push(o);continue}if(!/^\s/.test(o))break;r.push(o.replace(/^ {2}/,""))}let i=r.filter(o=>o.trim()&&!o.trimStart().startsWith("#"));return i.length===0?{value:{},nextIndex:e}:i.every(o=>o.trimStart().startsWith("- "))?{value:i.map((o,s)=>b(o.trimStart().slice(2),t+s+1)),nextIndex:e}:{value:S(r.join(`
2
- `)),nextIndex:e}}function L(n,t){let r=n.indexOf(":");if(r<=0)throw new Error(`Invalid YAML line ${t}.`);let e=n.slice(0,r).trim(),i=n.slice(r+1).trim();if(!e)throw new Error(`Invalid YAML key at line ${t}.`);return{key:e,value:i}}function b(n,t){if(n==="")return"";if(n==="[]")return[];if(n==="{}")return{};if(n==="true")return!0;if(n==="false")return!1;if(n==="null"||n==="~")return null;if(/^-?\d+(?:\.\d+)?$/.test(n))return Number(n);if(n.startsWith('"'))return x(n,t);if(n.startsWith("'")){if(!n.endsWith("'"))throw new Error(`Unclosed quoted scalar at line ${t}.`);return n.slice(1,-1).replace(/''/g,"'")}if(n.startsWith("[")||n.startsWith("{"))return x(n,t);if(n.includes("[")||n.includes("]")||n.includes("{")||n.includes("}"))throw new Error(`Unsupported YAML scalar at line ${t}.`);return n}function x(n,t){try{return JSON.parse(n)}catch{throw new Error(`Invalid YAML scalar at line ${t}.`)}}var v=/^[a-z][a-z0-9_-]{0,63}$/;function z(){return process.env.XENO_AGENT_HOME?.trim()||g(C(),".xeno-agent")}function j(n=z()){return g(n,"agents")}function T(n){return _(n)}function H(n){let t=Y(n);return t===n?n:t}function J(n=process.cwd()){let t=T(n),r=[],e=t;for(;;){let i=g(e,".xeno","agents");D(i)&&r.push(i);let o=H(e);if(o===e)break;e=o}return r.reverse()}function q(n=process.cwd()){return g(T(n),".xeno","agents")}function G(n){return D(n)?N(n,{withFileTypes:!0}).filter(t=>t.isFile()&&t.name.toLowerCase().endsWith(".md")).map(t=>g(n,t.name)).sort((t,r)=>t.localeCompare(r)):[]}function w(n){if(typeof n!="string")return;let t=n.trim();return t.length>0?t:void 0}function h(n){return Array.isArray(n)?n.map(t=>String(t).trim()).filter(Boolean):typeof n=="string"?n.split(",").map(t=>t.trim()).filter(Boolean):[]}function V(n){return U(W(n)).name.toLowerCase()}function E(n){return v.test(n)}function K(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}function X(n){if(typeof n!="string")return;let t=n.trim().toLowerCase();if(t==="inherit")return"inherit";if(t==="none"||t==="off"||t==="disabled")return"none";if(t==="read"||t==="readonly"||t==="read-only")return"readOnly";if(t==="default"||t==="standard")return"default";if(t==="full"||t==="fullaccess"||t==="full-access")return"fullAccess"}function Q(n){if(n===void 0)return;if(typeof n=="string"||Array.isArray(n)){let o=h(n);return o.length>0?{allow:o}:void 0}if(!K(n))return;let t=h(n.allow),r=h(n.deny),e=X(n.mode),i={};return e&&(i.mode=e),t.length>0&&(i.allow=t),r.length>0&&(i.deny=r),Object.keys(i).length>0?i:void 0}function Z(n){let t=[];return E(n.name)||t.push(`Invalid agent name "${n.name}". Use 1-64 lowercase letters, digits, hyphens, or underscores, starting with a letter.`),n.prompt.trim().length===0&&t.push("Agent definition body is empty."),t}function nn(n,t,r){let e=B(n,"utf8"),i=$(e),o=i.frontmatter,s=V(n),l=w(o.name)?.toLowerCase()??s,u=i.content.trim(),p=Z({name:l,prompt:u});if(p.length>0)throw new Error(p.join(" "));let d=w(o.description),c=w(o.model),a=Q(o.tools);return{name:l,scope:t,path:n,...d?{description:d}:{},...c?{model:c}:{},tags:h(o.tags),prompt:u,active:!0,priority:r,...a?{toolPolicy:a}:{}}}function m(n,t,r,e,i){for(let o of G(n))try{e.push(nn(o,t,r))}catch(s){i.push({path:o,scope:t,message:s instanceof Error?s.message:String(s)})}}function tn(n){let t=new Map;for(let r of n){let e=t.get(r.name);(!e||r.priority>e.priority)&&t.set(r.name,r)}return t}function en(n,t){let r=t.get(n.name),e=r?.path===n.path;return{name:n.name,scope:n.scope,path:n.path,...n.description?{description:n.description}:{},...n.model?{model:n.model}:{},tags:n.tags,prompt:n.prompt,active:e,...n.toolPolicy?{toolPolicy:n.toolPolicy}:{},...!e&&r?{shadowedBy:{name:r.name,scope:r.scope,path:r.path}}:{}}}function I(n=process.cwd(),t={}){let r=t.cwd??n,e=t.userDir??j(t.agentHome),i=t.projectDirs??J(r),o=t.pluginDirs??[],s=t.builtInDirs??[],l=[],u=[];t.includeUser!==!1&&m(e,"user",0,l,u),t.includeProject!==!1&&i.forEach((c,a)=>m(c,"project",100+a,l,u)),t.includePlugins&&o.forEach((c,a)=>m(c,"plugin",1e3+a,l,u)),t.includeBuiltIns&&s.forEach((c,a)=>m(c,"built-in",2e3+a,l,u));let p=tn(l),d=l.map(c=>en(c,p));return d.sort((c,a)=>{if(c.active!==a.active)return c.active?-1:1;let P=c.name.localeCompare(a.name);return P!==0?P:c.path.localeCompare(a.path)}),{definitions:d,issues:u,searchPaths:{...t.includeUser!==!1?{user:e}:{},project:t.includeProject===!1?[]:i,plugin:t.includePlugins?o:[],builtIn:t.includeBuiltIns?s:[]}}}function fn(n,t=process.cwd(),r={}){let e=n.trim().toLowerCase(),i=I(t,r);return{definition:i.definitions.find(o=>o.active&&o.name===e)??null,scan:i}}var A=class{constructor(t={}){this.options=t}options;scan(t=this.options.cwd??process.cwd()){return I(t,this.options)}},k=class{constructor(t=new A){this.loader=t}loader;resolve(t,r=process.cwd()){let e=this.loader.scan(r),i=t.trim().toLowerCase();return{definition:e.definitions.find(o=>o.active&&o.name===i)??null,scan:e}}};function y(n){if(!n||n.length===0)return;let t=Array.from(new Set(n.map(r=>r.trim()).filter(Boolean)));return t.length>0?t:void 0}function rn(n,t){if(!n&&!t)return;if(!n)return y(t);if(!t)return y(n);let r=new Set(t);return y(n.filter(e=>r.has(e)))}function on(n,t){let r={none:0,readOnly:1,default:2,fullAccess:3,inherit:4},e=t??"inherit",i=n??"inherit";return r[e]<=r[i]?e:i}function gn(n,t={}){let r=n.toolPolicy??{},e={mode:on(r.mode,t.mode)},i=rn(t.allow,r.allow),o=y([...t.deny??[],...r.deny??[]]);return i&&(e.allow=i),o&&(e.deny=o),e}function dn(n){return{name:`custom-agent:${n.name}`,order:20,provide(){let t=["","","# Custom Agent",`Active agent: ${n.name}`,`Definition scope: ${n.scope}`,`Definition path: ${n.path}`];return n.description&&t.push(`Description: ${n.description}`),t.push("",n.prompt),t.join(`
3
- `)}}}function pn(n){return{name:n.name,scope:n.scope,path:n.path,...n.description?{description:n.description}:{},...n.model?{model:n.model}:{},tags:n.tags,active:n.active,...n.toolPolicy?{toolPolicy:n.toolPolicy}:{},...n.shadowedBy?{shadowedBy:n.shadowedBy}:{}}}function f(n,t){return n.length>=t?n:n+" ".repeat(t-n.length)}function mn(n,t){let r=[];if(n.length===0)r.push("No custom agent definitions found.");else{r.push(`${f("name",22)} ${f("scope",8)} ${f("status",9)} description`),r.push(`${"-".repeat(22)} ${"-".repeat(8)} ${"-".repeat(9)} ${"-".repeat(32)}`);for(let e of n){let i=e.active?"active":"shadowed";r.push(`${f(e.name,22)} ${f(e.scope,8)} ${f(i,9)} ${e.description??""}`)}}if(t.length>0){r.push("","Invalid definitions:");for(let e of t)r.push(`- ${e.path}: ${e.message}`)}return r.join(`
1
+ import{existsSync as k,mkdirSync as B,readFileSync as C,readdirSync as F,writeFileSync as J}from"fs";import{homedir as W}from"os";import{basename as Y,dirname as U,join as m,parse as _,resolve as z}from"path";function S(t){let n=L(t);return{frontmatter:n.frontmatter,content:n.content.trim()}}function L(t){let n=t.replace(/^\uFEFF/,"");if(!n.startsWith("---"))return{frontmatter:{},content:t};let e=n.search(/\r?\n/);if(e<0||n.slice(0,e).trim()!=="---")return{frontmatter:{},content:t};let o=n.slice(e+(n[e]==="\r"?2:1)),i=o.match(/(?:^|\r?\n)---[ \t]*(?:\r?\n|$)/);if(!i||i.index===void 0)throw new Error("YAML frontmatter is not closed.");let r=o.slice(0,i.index),s=i[0],a=i.index+s.length;return{frontmatter:b(r),content:o.slice(a)}}function b(t){let n={},e=t.split(/\r?\n/);for(let o=0;o<e.length;o+=1){let i=e[o];if(!i.trim()||i.trimStart().startsWith("#"))continue;if(/^\s/.test(i))throw new Error(`Unexpected indentation at line ${o+1}.`);let r=M(i,o+1);if(r.key==="<<")throw new Error("YAML merge keys are not supported.");if(r.value!==""){n[r.key]=j(r.value,o+1);continue}let s=R(e,o+1);n[r.key]=s.value,o=s.nextIndex-1}return n}function R(t,n){let e=[],o=n;for(;o<t.length;o+=1){let r=t[o];if(!r.trim()){e.push(r);continue}if(!/^\s/.test(r))break;e.push(r.replace(/^ {2}/,""))}let i=e.filter(r=>r.trim()&&!r.trimStart().startsWith("#"));return i.length===0?{value:{},nextIndex:o}:i.every(r=>r.trimStart().startsWith("- "))?{value:i.map((r,s)=>j(r.trimStart().slice(2),n+s+1)),nextIndex:o}:{value:b(e.join(`
2
+ `)),nextIndex:o}}function M(t,n){let e=t.indexOf(":");if(e<=0)throw new Error(`Invalid YAML line ${n}.`);let o=t.slice(0,e).trim(),i=t.slice(e+1).trim();if(!o)throw new Error(`Invalid YAML key at line ${n}.`);return{key:o,value:i}}function j(t,n){if(t==="")return"";if(t==="[]")return[];if(t==="{}")return{};if(t==="true")return!0;if(t==="false")return!1;if(t==="null"||t==="~")return null;if(/^-?\d+(?:\.\d+)?$/.test(t))return Number(t);if(t.startsWith('"'))return x(t,n);if(t.startsWith("'")){if(!t.endsWith("'"))throw new Error(`Unclosed quoted scalar at line ${n}.`);return t.slice(1,-1).replace(/''/g,"'")}if(t.startsWith("[")||t.startsWith("{"))return x(t,n);if(t.includes("[")||t.includes("]")||t.includes("{")||t.includes("}"))throw new Error(`Unsupported YAML scalar at line ${n}.`);return t}function x(t,n){try{return JSON.parse(t)}catch{throw new Error(`Invalid YAML scalar at line ${n}.`)}}var H=/^[a-z][a-z0-9_-]{0,63}$/;function v(){return process.env.XENO_AGENT_HOME?.trim()||m(W(),".xeno-agent")}function O(t=v()){return m(t,"agents")}function T(t){return z(t)}function q(t){let n=U(t);return n===t?t:n}function G(t=process.cwd()){let n=T(t),e=[],o=n;for(;;){let i=m(o,".xeno","agents");k(i)&&e.push(i);let r=q(o);if(r===o)break;o=r}return e.reverse()}function V(t=process.cwd()){return m(T(t),".xeno","agents")}function K(t){return k(t)?F(t,{withFileTypes:!0}).filter(n=>n.isFile()&&n.name.toLowerCase().endsWith(".md")).map(n=>m(t,n.name)).sort((n,e)=>n.localeCompare(e)):[]}function u(t){if(typeof t!="string")return;let n=t.trim();return n.length>0?n:void 0}function d(t){return Array.isArray(t)?t.map(n=>String(n).trim()).filter(Boolean):typeof t=="string"?t.split(",").map(n=>n.trim()).filter(Boolean):[]}function X(t){if(typeof t=="boolean")return t;if(typeof t!="string")return;let n=t.trim().toLowerCase();if(["1","true","yes","on"].includes(n))return!0;if(["0","false","no","off"].includes(n))return!1}function Q(t){return _(Y(t)).name.toLowerCase()}function E(t){return H.test(t)}function Z(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function tt(t){if(typeof t!="string")return;let n=t.trim().toLowerCase();if(n==="inherit")return"inherit";if(n==="none"||n==="off"||n==="disabled")return"none";if(n==="read"||n==="readonly"||n==="read-only")return"readOnly";if(n==="default"||n==="standard")return"default";if(n==="full"||n==="fullaccess"||n==="full-access")return"fullAccess"}function nt(t){if(t===void 0)return;if(typeof t=="string"||Array.isArray(t)){let r=d(t);return r.length>0?{allow:r}:void 0}if(!Z(t))return;let n=d(t.allow),e=d(t.deny),o=tt(t.mode),i={};return o&&(i.mode=o),n.length>0&&(i.allow=n),e.length>0&&(i.deny=e),Object.keys(i).length>0?i:void 0}function et(t){let n=X(t.worktree??t.defaultWorktreeIsolation);if(n===!0)return"worktree";if(n===!1)return"none";let e=u(t.isolation)?.toLowerCase();if(e==="worktree")return"worktree";if(e==="none"||e==="off"||e==="disabled")return"none"}function ot(t){let n=[];return E(t.name)||n.push(`Invalid agent name "${t.name}". Use 1-64 lowercase letters, digits, hyphens, or underscores, starting with a letter.`),t.prompt.trim().length===0&&n.push("Agent definition body is empty."),n}function rt(t,n,e){let o=C(t,"utf8"),i=S(o),r=i.frontmatter,s=Q(t),a=u(r.name)?.toLowerCase()??s,f=i.content.trim(),y=ot({name:a,prompt:f});if(y.length>0)throw new Error(y.join(" "));let p=u(r.description),c=u(r.model),l=u(r.color),h=u(r.memory??r.memoryScope),$=et(r),P=nt(r.tools);return{name:a,scope:n,path:t,...p?{description:p}:{},...c?{model:c}:{},...l?{color:l}:{},...h?{memory:h}:{},...$?{isolation:$}:{},tags:d(r.tags),skills:d(r.skills),hooks:d(r.hooks),prompt:f,active:!0,priority:e,...P?{toolPolicy:P}:{}}}function w(t,n,e,o,i){for(let r of K(t))try{o.push(rt(r,n,e))}catch(s){i.push({path:r,scope:n,message:s instanceof Error?s.message:String(s)})}}function it(t){let n=new Map;for(let e of t){let o=n.get(e.name);(!o||e.priority>o.priority)&&n.set(e.name,e)}return n}function st(t,n){let e=n.get(t.name),o=e?.path===t.path;return{name:t.name,scope:t.scope,path:t.path,...t.description?{description:t.description}:{},...t.model?{model:t.model}:{},...t.color?{color:t.color}:{},...t.memory?{memory:t.memory}:{},...t.isolation?{isolation:t.isolation}:{},tags:t.tags,skills:t.skills,hooks:t.hooks,prompt:t.prompt,active:o,...t.toolPolicy?{toolPolicy:t.toolPolicy}:{},...!o&&e?{shadowedBy:{name:e.name,scope:e.scope,path:e.path}}:{}}}function N(t=process.cwd(),n={}){let e=n.cwd??t,o=n.userDir??O(n.agentHome),i=n.projectDirs??G(e),r=n.pluginDirs??[],s=n.builtInDirs??[],a=[],f=[];n.includeUser!==!1&&w(o,"user",0,a,f),n.includeProject!==!1&&i.forEach((c,l)=>w(c,"project",100+l,a,f)),n.includePlugins&&r.forEach((c,l)=>w(c,"plugin",1e3+l,a,f)),n.includeBuiltIns&&s.forEach((c,l)=>w(c,"built-in",2e3+l,a,f));let y=it(a),p=a.map(c=>st(c,y));return p.sort((c,l)=>{if(c.active!==l.active)return c.active?-1:1;let h=c.name.localeCompare(l.name);return h!==0?h:c.path.localeCompare(l.path)}),{definitions:p,issues:f,searchPaths:{...n.includeUser!==!1?{user:o}:{},project:n.includeProject===!1?[]:i,plugin:n.includePlugins?r:[],builtIn:n.includeBuiltIns?s:[]}}}function mt(t,n=process.cwd(),e={}){let o=t.trim().toLowerCase(),i=N(n,e);return{definition:i.definitions.find(r=>r.active&&r.name===o)??null,scan:i}}var D=class{constructor(n={}){this.options=n}options;scan(n=this.options.cwd??process.cwd()){return N(n,this.options)}},I=class{constructor(n=new D){this.loader=n}loader;resolve(n,e=process.cwd()){let o=this.loader.scan(e),i=n.trim().toLowerCase();return{definition:o.definitions.find(r=>r.active&&r.name===i)??null,scan:o}}};function A(t){if(!t||t.length===0)return;let n=Array.from(new Set(t.map(e=>e.trim()).filter(Boolean)));return n.length>0?n:void 0}function ct(t,n){if(!t&&!n)return;if(!t)return A(n);if(!n)return A(t);let e=new Set(n);return A(t.filter(o=>e.has(o)))}function at(t,n){let e={none:0,readOnly:1,default:2,fullAccess:3,inherit:4},o=n??"inherit",i=t??"inherit";return e[o]<=e[i]?o:i}function pt(t,n={}){let e=t.toolPolicy??{},o={mode:at(e.mode,n.mode)},i=ct(n.allow,e.allow),r=A([...n.deny??[],...e.deny??[]]);return i&&(o.allow=i),r&&(o.deny=r),o}function ht(t){return{name:`custom-agent:${t.name}`,order:20,provide(){let n=["","","# Custom Agent",`Active agent: ${t.name}`,`Definition scope: ${t.scope}`,`Definition path: ${t.path}`];return t.description&&n.push(`Description: ${t.description}`),n.push("",t.prompt),n.join(`
3
+ `)}}}function yt(t){return{name:t.name,scope:t.scope,path:t.path,...t.description?{description:t.description}:{},...t.model?{model:t.model}:{},...t.color?{color:t.color}:{},...t.memory?{memory:t.memory}:{},...t.isolation?{isolation:t.isolation}:{},tags:t.tags,skills:t.skills,hooks:t.hooks,active:t.active,...t.toolPolicy?{toolPolicy:t.toolPolicy}:{},...t.shadowedBy?{shadowedBy:t.shadowedBy}:{}}}function g(t,n){return t.length>=n?t:t+" ".repeat(n-t.length)}function wt(t,n){let e=[];if(t.length===0)e.push("No custom agent definitions found.");else{e.push(`${g("name",22)} ${g("scope",8)} ${g("status",9)} description`),e.push(`${"-".repeat(22)} ${"-".repeat(8)} ${"-".repeat(9)} ${"-".repeat(32)}`);for(let o of t){let i=o.active?"active":"shadowed";e.push(`${g(o.name,22)} ${g(o.scope,8)} ${g(i,9)} ${o.description??""}`)}}if(n.length>0){e.push("","Invalid definitions:");for(let o of n)e.push(`- ${o.path}: ${o.message}`)}return e.join(`
4
4
  `)+`
5
- `}function hn(n){let t=[`Agent: ${n.name}`,`Scope: ${n.scope}`,`Path: ${n.path}`,`Status: ${n.active?"active":"shadowed"}`];return n.description&&t.push(`Description: ${n.description}`),n.model&&t.push(`Model: ${n.model}`),n.tags.length>0&&t.push(`Tags: ${n.tags.join(", ")}`),n.toolPolicy&&t.push(`Tools: ${JSON.stringify(n.toolPolicy)}`),n.shadowedBy&&t.push(`Shadowed by: ${n.shadowedBy.scope} ${n.shadowedBy.path}`),t.push("",n.prompt,""),t.join(`
6
- `)}function yn(n){let t=n.name.trim().toLowerCase();if(!E(t))throw new Error(`Invalid agent name "${n.name}". Use 1-64 lowercase letters, digits, hyphens, or underscores, starting with a letter.`);let r=n.scope==="user"?j(n.agentHome):q(n.cwd??process.cwd());M(r,{recursive:!0});let e=g(r,`${t}.md`);if(D(e)&&!n.force)throw new Error(`Agent definition already exists: ${e}`);let i=n.description?.trim()||`${t} custom agent`,o=["---",`name: ${t}`,`description: ${JSON.stringify(i)}`,"tags: []","---","",`You are ${t}. Replace this paragraph with precise operating instructions, constraints, tools policy, verification expectations, and the kind of work this agent should own.`,""].join(`
7
- `);return F(e,o,"utf8"),e}export{A as AgentDefinitionLoader,k as AgentDefinitionResolver,yn as createAgentDefinitionFile,dn as createAgentDefinitionPromptSection,J as getProjectAgentDefinitionDirs,q as getProjectAgentDefinitionsDir,j as getUserAgentDefinitionsDir,E as isValidAgentDefinitionName,hn as renderAgentDefinition,mn as renderAgentDefinitions,fn as resolveAgentDefinition,gn as resolveAgentToolPolicy,I as scanAgentDefinitions,pn as toAgentDefinitionMetadata,Z as validateAgentDefinition};
5
+ `}function At(t){let n=[`Agent: ${t.name}`,`Scope: ${t.scope}`,`Path: ${t.path}`,`Status: ${t.active?"active":"shadowed"}`];return t.description&&n.push(`Description: ${t.description}`),t.model&&n.push(`Model: ${t.model}`),t.color&&n.push(`Color: ${t.color}`),t.memory&&n.push(`Memory: ${t.memory}`),t.isolation&&n.push(`Isolation: ${t.isolation}`),t.tags.length>0&&n.push(`Tags: ${t.tags.join(", ")}`),t.skills.length>0&&n.push(`Skills: ${t.skills.join(", ")}`),t.hooks.length>0&&n.push(`Hooks: ${t.hooks.join(", ")}`),t.toolPolicy&&n.push(`Tools: ${JSON.stringify(t.toolPolicy)}`),t.shadowedBy&&n.push(`Shadowed by: ${t.shadowedBy.scope} ${t.shadowedBy.path}`),n.push("",t.prompt,""),n.join(`
6
+ `)}function Dt(t){let n=t.name.trim().toLowerCase();if(!E(n))throw new Error(`Invalid agent name "${t.name}". Use 1-64 lowercase letters, digits, hyphens, or underscores, starting with a letter.`);let e=t.scope==="user"?O(t.agentHome):V(t.cwd??process.cwd());B(e,{recursive:!0});let o=m(e,`${n}.md`);if(k(o)&&!t.force)throw new Error(`Agent definition already exists: ${o}`);let i=t.description?.trim()||`${n} custom agent`,r=t.prompt?.trim()||`You are ${n}. Replace this paragraph with precise operating instructions, constraints, tools policy, verification expectations, and the kind of work this agent should own.`,a=[...["---",`name: ${n}`,`description: ${JSON.stringify(i)}`,...t.model?.trim()?[`model: ${JSON.stringify(t.model.trim())}`]:[],...t.color?.trim()?[`color: ${JSON.stringify(t.color.trim())}`]:[],...t.memory?.trim()?[`memory: ${JSON.stringify(t.memory.trim())}`]:[],...t.isolation?[`isolation: ${t.isolation}`]:[],"tags: []",...t.skills&&t.skills.length>0?[`skills: ${JSON.stringify(t.skills)}`]:[],...t.hooks&&t.hooks.length>0?[`hooks: ${JSON.stringify(t.hooks)}`]:[],...t.toolPolicy?["tools:",...t.toolPolicy.mode?[` mode: ${t.toolPolicy.mode}`]:[],...t.toolPolicy.allow&&t.toolPolicy.allow.length>0?[` allow: ${JSON.stringify(t.toolPolicy.allow)}`]:[],...t.toolPolicy.deny&&t.toolPolicy.deny.length>0?[` deny: ${JSON.stringify(t.toolPolicy.deny)}`]:[]]:[],"---"],"",r,""].join(`
7
+ `);return J(o,a,"utf8"),o}export{D as AgentDefinitionLoader,I as AgentDefinitionResolver,Dt as createAgentDefinitionFile,ht as createAgentDefinitionPromptSection,G as getProjectAgentDefinitionDirs,V as getProjectAgentDefinitionsDir,O as getUserAgentDefinitionsDir,E as isValidAgentDefinitionName,At as renderAgentDefinition,wt as renderAgentDefinitions,mt as resolveAgentDefinition,pt as resolveAgentToolPolicy,N as scanAgentDefinitions,yt as toAgentDefinitionMetadata,ot as validateAgentDefinition};
@@ -1,4 +1,4 @@
1
- import{randomUUID as J}from"crypto";import{appendFileSync as M,existsSync as y,mkdirSync as d,readFileSync as x,readdirSync as U,renameSync as z,rmSync as j,writeFileSync as l}from"fs";import{homedir as q}from"os";import{basename as P,dirname as L,join as u,resolve as B}from"path";var f="0.6.3";import{mkdirSync as O,readFileSync as V,rmSync as v,writeFileSync as _}from"fs";import{hostname as k}from"os";import{dirname as N}from"path";function b(){return new Date().toISOString()}function I(){return new Date(Date.now()-Math.floor(process.uptime()*1e3)).toISOString()}function w(r){try{return JSON.parse(V(r,"utf8"))}catch{return null}}function T(r){if(!r||r<=0)return!1;try{return process.kill(r,0),!0}catch{return!1}}function F(r){return r.hostname!==k()?!0:T(r.pid)}function h(r,t){O(N(r),{recursive:!0}),_(r,JSON.stringify(t,null,2)+`
2
- `,{encoding:"utf8",flag:"wx"})}function $(r,t){let e=w(r);e?.pid!==t.pid||e.hostname!==t.hostname||v(r,{force:!0})}function S(r,t,e){let n=b(),s={schemaVersion:1,name:t,pid:process.pid,hostname:k(),processStartedAt:I(),version:e,acquiredAt:n,updatedAt:n};try{h(r,s)}catch(a){if(a.code!=="EEXIST")throw a;let c=w(r);if(c&&F(c))throw new Error(`${t} is already locked by PID ${c.pid} on ${c.hostname}.`);v(r,{force:!0}),h(r,s)}return{record:s,release:()=>{$(r,s)}}}var D=1,H=u(q(),".xeno-agent"),W=u(process.env.XENO_AGENT_HOME??H,"daemon"),A=u(W,"runs");function i(){return new Date().toISOString()}function G(r=new Date){return r.toISOString().replace(/[^0-9]/g,"").slice(0,14)}function R(r){return r.replace(/[^A-Za-z0-9_.-]/g,"_").slice(0,80)}function p(r){return B(r)}function g(r){return p(r).toLowerCase()}function C(r,t){let e=g(r),n=g(t);return e===n||e.startsWith(`${n}\\`)||e.startsWith(`${n}/`)}function K(r,t){return!!(g(r.cwd)===g(t)||r.git?.root&&C(t,r.git.root)||r.git?.worktree&&C(t,r.git.worktree))}function X(r){return R(Buffer.from(p(r)).toString("base64url"))}function Z(){return{input:0,output:0,total:0}}function m(r){try{return JSON.parse(x(r,"utf8"))}catch{return null}}function Q(r,t){d(L(r),{recursive:!0});let e=`${r}.${process.pid}.${Date.now()}.tmp`;l(e,JSON.stringify(t,null,2)+`
3
- `,"utf8"),z(e,r)}function Y(r){if(!r||r<=0)return!1;try{return process.kill(r,0),!0}catch{return!1}}function tt(r){return r==="completed"||r==="failed"||r==="cancelled"||r==="interrupted"}function et(r,t){return r.pinned!==t.pinned?r.pinned?-1:1:Date.parse(t.updatedAt)-Date.parse(r.updatedAt)}function mt(){return A}function Rt(r){return u(A,r)}function rt(r=new Date){return`run_${G(r)}_${J().slice(0,8)}`}var E=class{constructor(t=A){this.runsDir=t;d(this.runsDir,{recursive:!0})}runsDir;create(t){let e=rt(),n=u(this.runsDir,e);d(n,{recursive:!0});let s=i(),a=u(n,"events.jsonl"),o={schemaVersion:D,runId:e,sessionId:e,rootRunId:e,cwd:p(t.cwd),workspaceId:X(t.cwd),prompt:t.prompt,...t.title?{title:t.title}:{},status:"starting",model:t.model,...t.effort?{effort:t.effort}:{},...t.agent?{agent:t.agent}:{},...t.git?{git:t.git}:{},permissionMode:t.permissionMode,...t.cliVersion?{createdByCliVersion:t.cliVersion}:{},createdBySdkVersion:t.sdkVersion??f,createdAt:s,updatedAt:s,lastActivityAt:s,pinned:!!t.pinned,attachedClients:0,...t.cliVersion?{cliVersion:t.cliVersion}:{},...t.sdkVersion?{sdkVersion:t.sdkVersion}:{},stdoutPath:u(n,"stdout.log"),stderrPath:u(n,"stderr.log"),eventsPath:a,usage:Z(),children:[],tags:[]};return l(o.stdoutPath,"","utf8"),l(o.stderrPath,"","utf8"),l(o.eventsPath,"","utf8"),this.write(o),this.appendEvent(e,"run_created",{cwd:o.cwd,model:o.model,...o.agent?{agent:o.agent}:{},...o.git?{git:o.git}:{},permissionMode:o.permissionMode,pinned:o.pinned}),o}get(t){let e=m(this.recordPath(t));return e?this.refreshRecordStatus(e):null}list(t={}){if(!y(this.runsDir))return[];let e=U(this.runsDir,{withFileTypes:!0}).filter(n=>n.isDirectory()).map(n=>this.get(n.name)).filter(n=>n!==null).filter(n=>t.all||!t.cwd||K(n,t.cwd)).filter(n=>!t.status||t.status.includes(n.status)).sort(et);return typeof t.limit=="number"&&t.limit>0?e.slice(0,t.limit):e}markSpawned(t,e,n){return this.update(t,s=>({...s,status:"running",workerPid:e,...n?{workerVersion:n}:{},startedAt:s.startedAt??i(),lastActivityAt:i()}))}markStarted(t,e){return this.update(t,n=>({...n,status:"running",workerPid:e.pid,...e.workerVersion?{workerVersion:e.workerVersion}:{},...e.model?{model:e.model}:{},...e.effort?{effort:e.effort}:{},startedAt:n.startedAt??i(),lastActivityAt:i()}))}markCompleted(t,e){return this.update(t,n=>({...n,status:e.status,...e.statusReason?{statusReason:e.statusReason}:{},exitCode:e.exitCode??null,usage:e.usage??n.usage,endedAt:i(),lastActivityAt:i()}))}markCancelled(t,e){return this.update(t,n=>({...n,status:"cancelled",statusReason:e,endedAt:i(),lastActivityAt:i()}))}markPaused(t,e="Paused by user."){let n=this.update(t,s=>({...s,status:"paused",statusReason:e,lastActivityAt:i()}));return n&&this.appendEvent(t,"run_paused",{reason:e}),n}markResumed(t,e="Resumed by user."){let n=this.update(t,s=>{let a={...s,status:"running",statusReason:e,lastActivityAt:i()};return delete a.endedAt,delete a.exitCode,a});return n&&this.appendEvent(t,"run_resumed",{reason:e}),n}setPinned(t,e){let n=this.update(t,s=>({...s,pinned:e,lastActivityAt:i()}));return n&&this.appendEvent(t,e?"run_pinned":"run_unpinned",{pinned:e}),n}appendEvent(t,e,n={}){let s=m(this.recordPath(t)),a=s?.eventsPath??u(this.runsDir,t,"events.jsonl");d(L(a),{recursive:!0});let o={schemaVersion:D,runId:t,type:e,timestamp:i(),payload:n};M(a,JSON.stringify(o)+`
4
- `,"utf8"),s&&this.update(t,c=>({...c,lastActivityAt:o.timestamp}))}readEvents(t){let e=this.get(t);return!e||!y(e.eventsPath)?[]:x(e.eventsPath,"utf8").split(/\r?\n/).map(n=>n.trim()).filter(Boolean).map(n=>{try{return JSON.parse(n)}catch{return null}}).filter(n=>n!==null)}delete(t){j(u(this.runsDir,t),{recursive:!0,force:!0})}refreshRecordStatus(t){if(tt(t.status))return t;if(t.workerPid&&!Y(t.workerPid)){let e={...t,status:"failed",statusReason:"Worker process is no longer running and did not record a terminal status.",endedAt:t.endedAt??i(),updatedAt:i()};return this.write(e),e}return t}update(t,e){let n=m(this.recordPath(t));if(!n)return null;let s=e(n);return s.updatedAt=i(),this.write(s),s}write(t){let e=S(u(this.runDir(t.runId),"run.lock"),`run:${t.runId}`,f);try{Q(this.recordPath(t.runId),t)}finally{e.release()}}recordPath(t){return u(this.runsDir,R(P(t)),"run.json")}runDir(t){return u(this.runsDir,R(P(t)))}};export{E as AgentRunStore,S as acquireControlPlaneLock,rt as createAgentRunId,Rt as getAgentRunDir,mt as getAgentRunStoreDir};
1
+ import{randomUUID as J}from"crypto";import{appendFileSync as M,existsSync as y,mkdirSync as l,readFileSync as L,readdirSync as U,renameSync as z,rmSync as j,writeFileSync as g}from"fs";import{homedir as q}from"os";import{basename as P,dirname as b,join as u,resolve as B}from"path";var m="0.6.4";import{mkdirSync as x,readFileSync as O,rmSync as v,writeFileSync as V}from"fs";import{hostname as k}from"os";import{dirname as _}from"path";function I(){return new Date().toISOString()}function N(){return new Date(Date.now()-Math.floor(process.uptime()*1e3)).toISOString()}function w(e){try{return JSON.parse(O(e,"utf8"))}catch{return null}}function T(e){if(!e||e<=0)return!1;try{return process.kill(e,0),!0}catch{return!1}}function F(e){return e.hostname!==k()?!0:T(e.pid)}function h(e,t){x(_(e),{recursive:!0}),V(e,JSON.stringify(t,null,2)+`
2
+ `,{encoding:"utf8",flag:"wx"})}function $(e,t){let r=w(e);r?.pid!==t.pid||r.hostname!==t.hostname||v(e,{force:!0})}function S(e,t,r){let n=I(),s={schemaVersion:1,name:t,pid:process.pid,hostname:k(),processStartedAt:N(),version:r,acquiredAt:n,updatedAt:n};try{h(e,s)}catch(a){if(a.code!=="EEXIST")throw a;let c=w(e);if(c&&F(c))throw new Error(`${t} is already locked by PID ${c.pid} on ${c.hostname}.`);v(e,{force:!0}),h(e,s)}return{record:s,release:()=>{$(e,s)}}}var D=1,H=u(q(),".xeno-agent"),W=u(process.env.XENO_AGENT_HOME??H,"daemon"),A=u(W,"runs");function i(){return new Date().toISOString()}function G(e=new Date){return e.toISOString().replace(/[^0-9]/g,"").slice(0,14)}function R(e){return e.replace(/[^A-Za-z0-9_.-]/g,"_").slice(0,80)}function p(e){return B(e)}function f(e){return p(e).toLowerCase()}function C(e,t){let r=f(e),n=f(t);return r===n||r.startsWith(`${n}\\`)||r.startsWith(`${n}/`)}function K(e,t){return!!(f(e.cwd)===f(t)||e.git?.root&&C(t,e.git.root)||e.git?.worktree&&C(t,e.git.worktree))}function X(e){return R(Buffer.from(p(e)).toString("base64url"))}function Z(){return{input:0,output:0,total:0}}function d(e){try{return JSON.parse(L(e,"utf8"))}catch{return null}}function Q(e){return e instanceof Error&&/\balready locked by PID\b/.test(e.message)}function Y(e,t){l(b(e),{recursive:!0});let r=`${e}.${process.pid}.${Date.now()}.tmp`;g(r,JSON.stringify(t,null,2)+`
3
+ `,"utf8"),z(r,e)}function tt(e){if(!e||e<=0)return!1;try{return process.kill(e,0),!0}catch{return!1}}function et(e){return e==="completed"||e==="failed"||e==="cancelled"||e==="interrupted"}function rt(e,t){return e.pinned!==t.pinned?e.pinned?-1:1:Date.parse(t.updatedAt)-Date.parse(e.updatedAt)}function Rt(){return A}function At(e){return u(A,e)}function nt(e=new Date){return`run_${G(e)}_${J().slice(0,8)}`}var E=class{constructor(t=A){this.runsDir=t;l(this.runsDir,{recursive:!0})}runsDir;create(t){let r=nt(),n=u(this.runsDir,r);l(n,{recursive:!0});let s=i(),a=u(n,"events.jsonl"),o={schemaVersion:D,runId:r,sessionId:r,rootRunId:r,cwd:p(t.cwd),workspaceId:X(t.cwd),prompt:t.prompt,...t.title?{title:t.title}:{},status:"starting",model:t.model,...t.effort?{effort:t.effort}:{},...t.agent?{agent:t.agent}:{},...t.git?{git:t.git}:{},permissionMode:t.permissionMode,...t.cliVersion?{createdByCliVersion:t.cliVersion}:{},createdBySdkVersion:t.sdkVersion??m,createdAt:s,updatedAt:s,lastActivityAt:s,pinned:!!t.pinned,attachedClients:0,...t.cliVersion?{cliVersion:t.cliVersion}:{},...t.sdkVersion?{sdkVersion:t.sdkVersion}:{},stdoutPath:u(n,"stdout.log"),stderrPath:u(n,"stderr.log"),eventsPath:a,usage:Z(),children:[],tags:[]};return g(o.stdoutPath,"","utf8"),g(o.stderrPath,"","utf8"),g(o.eventsPath,"","utf8"),this.write(o),this.appendEvent(r,"run_created",{cwd:o.cwd,model:o.model,...o.agent?{agent:o.agent}:{},...o.git?{git:o.git}:{},permissionMode:o.permissionMode,pinned:o.pinned}),o}get(t){let r=d(this.recordPath(t));return r?this.refreshRecordStatus(r):null}list(t={}){if(!y(this.runsDir))return[];let r=U(this.runsDir,{withFileTypes:!0}).filter(n=>n.isDirectory()).map(n=>{try{return this.get(n.name)}catch(s){if(Q(s))return d(this.recordPath(n.name));throw s}}).filter(n=>n!==null).filter(n=>t.all||!t.cwd||K(n,t.cwd)).filter(n=>!t.status||t.status.includes(n.status)).sort(rt);return typeof t.limit=="number"&&t.limit>0?r.slice(0,t.limit):r}markSpawned(t,r,n){return this.update(t,s=>({...s,status:"running",workerPid:r,...n?{workerVersion:n}:{},startedAt:s.startedAt??i(),lastActivityAt:i()}))}markStarted(t,r){return this.update(t,n=>({...n,status:"running",workerPid:r.pid,...r.workerVersion?{workerVersion:r.workerVersion}:{},...r.model?{model:r.model}:{},...r.effort?{effort:r.effort}:{},startedAt:n.startedAt??i(),lastActivityAt:i()}))}markCompleted(t,r){return this.update(t,n=>({...n,status:r.status,...r.statusReason?{statusReason:r.statusReason}:{},exitCode:r.exitCode??null,usage:r.usage??n.usage,endedAt:i(),lastActivityAt:i()}))}markCancelled(t,r){return this.update(t,n=>({...n,status:"cancelled",statusReason:r,endedAt:i(),lastActivityAt:i()}))}markPaused(t,r="Paused by user."){let n=this.update(t,s=>({...s,status:"paused",statusReason:r,lastActivityAt:i()}));return n&&this.appendEvent(t,"run_paused",{reason:r}),n}markResumed(t,r="Resumed by user."){let n=this.update(t,s=>{let a={...s,status:"running",statusReason:r,lastActivityAt:i()};return delete a.endedAt,delete a.exitCode,a});return n&&this.appendEvent(t,"run_resumed",{reason:r}),n}setPinned(t,r){let n=this.update(t,s=>({...s,pinned:r,lastActivityAt:i()}));return n&&this.appendEvent(t,r?"run_pinned":"run_unpinned",{pinned:r}),n}appendEvent(t,r,n={}){let s=d(this.recordPath(t)),a=s?.eventsPath??u(this.runsDir,t,"events.jsonl");l(b(a),{recursive:!0});let o={schemaVersion:D,runId:t,type:r,timestamp:i(),payload:n};M(a,JSON.stringify(o)+`
4
+ `,"utf8"),s&&this.update(t,c=>({...c,lastActivityAt:o.timestamp}))}readEvents(t){let r=this.get(t);return!r||!y(r.eventsPath)?[]:L(r.eventsPath,"utf8").split(/\r?\n/).map(n=>n.trim()).filter(Boolean).map(n=>{try{return JSON.parse(n)}catch{return null}}).filter(n=>n!==null)}delete(t){j(u(this.runsDir,t),{recursive:!0,force:!0})}refreshRecordStatus(t){if(et(t.status))return t;if(t.workerPid&&!tt(t.workerPid)){let r={...t,status:"failed",statusReason:"Worker process is no longer running and did not record a terminal status.",endedAt:t.endedAt??i(),updatedAt:i()};return this.write(r),r}return t}update(t,r){let n=d(this.recordPath(t));if(!n)return null;let s=r(n);return s.updatedAt=i(),this.write(s),s}write(t){let r=S(u(this.runDir(t.runId),"run.lock"),`run:${t.runId}`,m);try{Y(this.recordPath(t.runId),t)}finally{r.release()}}recordPath(t){return u(this.runsDir,R(P(t)),"run.json")}runDir(t){return u(this.runsDir,R(P(t)))}};export{E as AgentRunStore,S as acquireControlPlaneLock,nt as createAgentRunId,At as getAgentRunDir,Rt as getAgentRunStoreDir};
@@ -1,3 +1,41 @@
1
+ type PermissionProfileName = "default" | "read-only" | "trusted-dev";
2
+ type PermissionProfileDecision = "allow" | "ask" | "deny";
3
+ type PermissionProfileMode = "default" | "acceptEdits" | "bypassPermissions" | "auto";
4
+ interface PermissionProfile {
5
+ schemaVersion: 1;
6
+ name: PermissionProfileName;
7
+ displayName: string;
8
+ description: string;
9
+ permissionMode: PermissionProfileMode;
10
+ filesystem: {
11
+ scope: "workspace" | "workspace-readonly" | "unrestricted";
12
+ read: PermissionProfileDecision;
13
+ write: PermissionProfileDecision;
14
+ allowedPaths: string[];
15
+ deniedPaths: string[];
16
+ };
17
+ shell: {
18
+ default: PermissionProfileDecision;
19
+ allowedCommands: string[];
20
+ deniedCommands: string[];
21
+ };
22
+ network: {
23
+ default: PermissionProfileDecision;
24
+ allowDomains: string[];
25
+ denyDomains: string[];
26
+ };
27
+ mcp: {
28
+ remoteServers: PermissionProfileDecision;
29
+ allowedServers: string[];
30
+ deniedServers: string[];
31
+ };
32
+ lsp: {
33
+ enabled: boolean;
34
+ diagnostics: PermissionProfileDecision;
35
+ navigation: PermissionProfileDecision;
36
+ startProcesses: PermissionProfileDecision;
37
+ };
38
+ }
1
39
  interface ToolDefinition {
2
40
  name: string;
3
41
  description: string;
@@ -69,6 +107,7 @@ interface PermissionRule {
69
107
  interface PermissionConfig {
70
108
  mode: "default" | "acceptEdits" | "bypassPermissions" | "plan" | "auto";
71
109
  rules: PermissionRule[];
110
+ profile?: PermissionProfile;
72
111
  }
73
112
  type PermissionPromptOperation = "generic" | "filesystem" | "write" | "edit" | "bash";
74
113
  interface PermissionPromptPreviewLine {
@@ -418,6 +457,12 @@ interface AuditEvent {
418
457
  timestamp: string;
419
458
  trace_id: string;
420
459
  session_id?: string;
460
+ run_id?: string;
461
+ agent_id?: string;
462
+ parent_agent_id?: string;
463
+ workspace?: string;
464
+ model?: string;
465
+ provider?: string;
421
466
  event_type: string;
422
467
  actor: "user" | "assistant" | "system";
423
468
  risk_level: AuditRiskLevel;
@@ -430,10 +475,17 @@ interface AuditEvent {
430
475
  interface AuditLoggerOptions {
431
476
  filePath: string;
432
477
  sessionId?: string;
478
+ runId?: string;
479
+ agentId?: string;
480
+ parentAgentId?: string;
481
+ workspace?: string;
482
+ model?: string;
483
+ provider?: string;
433
484
  }
434
485
  declare class AuditLogger {
435
486
  private filePath;
436
487
  private sessionId?;
488
+ private labels;
437
489
  private sequence;
438
490
  private writeQueue;
439
491
  constructor(options: AuditLoggerOptions);