@vpxa/aikit 0.1.269 → 0.1.271

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vpxa/aikit",
3
- "version": "0.1.269",
3
+ "version": "0.1.271",
4
4
  "type": "module",
5
5
  "description": "Local-first AI developer toolkit — knowledge base, code analysis, context management, and developer tools for LLM agents",
6
6
  "license": "MIT",
@@ -118,7 +118,7 @@
118
118
  "verify-publish": "node scripts/verify-publish.mjs",
119
119
  "release": "node scripts/release.mjs",
120
120
  "release:dry": "node scripts/release.mjs --dry-run",
121
- "nodeprune": "pnpm clean && pnpm store prune && pnpm -s dlx npkill -D -y",
121
+ "nodeprune": "pnpm -s dlx npkill -D -y && pnpm store prune && pnpm clean",
122
122
  "test:watch": "vitest",
123
123
  "validate": "pnpm build && pnpm test && pnpm lint:fix && pnpm typecheck"
124
124
  }
@@ -1457,10 +1457,10 @@ ${tt}
1457
1457
  `)].join(`
1458
1458
 
1459
1459
  `)}const j={header:`aikit-header`,brand:`aikit-header-brand`,title:`aikit-header-title`,titleText:`aikit-header-title-text`,subtitle:`aikit-header-subtitle`,actions:`aikit-header-actions`,themeToggle:`aikit-theme-toggle`,themeToggleIcon:`aikit-theme-toggle-icon`,themeToggleIconSun:`aikit-theme-toggle-icon--sun`,themeToggleIconMoon:`aikit-theme-toggle-icon--moon`,toolbox:`aikit-toolbox`,toolboxToggle:`aikit-toolbox-toggle`,toolboxMenu:`aikit-toolbox-menu`,toolboxItem:`aikit-toolbox-item`,footer:`aikit-footer`,footerMeta:`aikit-footer-meta`,footerText:`aikit-footer-text`,footerBrand:`aikit-footer-brand`,footerTimestamp:`aikit-footer-timestamp`,footerSlot:`aikit-footer-slot`,footerBadge:`aikit-footer-badge`},Jt=[{kind:`shared-chrome-action`,id:`copy-image`,label:`Copy as Image`,icon:`<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z"/><circle cx="12" cy="13" r="4"/></svg>`,onclick:`screenshotPage()`}];function Yt(e){let t=e.onclick?` onclick="${n(e.onclick)}"`:``;return[` <button type="button" class="${j.toolboxItem}" role="menuitem" data-shared-chrome-action="${n(e.id)}" aria-label="${n(e.label)}"${t}>`,` <span aria-hidden="true">${e.icon}</span>`,` <span>${n(e.label)}</span>`,` </button>`].join(`
1460
- `)}function Xt(e){if(e!==`browser`&&e!==`mcp-app`)return``;let t=Jt.filter(e=>e.kind===`shared-chrome-action`);return[` <div class="${j.toolbox}">`,` <button type="button" class="${j.toolboxToggle}" aria-label="Open tools menu" aria-haspopup="menu" aria-expanded="false" aria-controls="aikit-toolbox-menu" onclick="toggleToolbox()">`,` <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"/></svg>`,` </button>`,` <div id="aikit-toolbox-menu" class="${j.toolboxMenu}" role="menu" hidden>`,...t.map(e=>Yt(e)),` </div>`,` </div>`].join(`
1461
- `)}function M(e){return e?.trim()?e.trim():``}function Zt(e){if(!e)return null;let t=new Date(e);return Number.isNaN(t.getTime())?{display:e}:{dateTime:t.toISOString(),display:new Intl.DateTimeFormat(void 0,{month:`long`,day:`numeric`,year:`numeric`,hour:`numeric`,minute:`2-digit`}).format(t)}}function N(e){let t=e.brand??`AI KIT`,r=[M(e.actionsHtml),Xt(e.transport),e.showThemeToggle===!1?``:[` <button type="button" class="${j.themeToggle}" aria-label="Switch to dark theme" aria-pressed="false" onclick="toggleTheme()">`,` <span class="${j.themeToggleIcon} ${j.themeToggleIconSun}" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="5"/><line x1="12" y1="1" x2="12" y2="3"/><line x1="12" y1="21" x2="12" y2="23"/><line x1="4.22" y1="4.22" x2="5.64" y2="5.64"/><line x1="18.36" y1="18.36" x2="19.78" y2="19.78"/><line x1="1" y1="12" x2="3" y2="12"/><line x1="21" y1="12" x2="23" y2="12"/><line x1="4.22" y1="19.78" x2="5.64" y2="18.36"/><line x1="18.36" y1="5.64" x2="19.78" y2="4.22"/></svg></span>`,` <span class="${j.themeToggleIcon} ${j.themeToggleIconMoon}" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/></svg></span>`,` </button>`].join(`
1460
+ `)}function Xt(e,t=[]){if(e!==`browser`&&e!==`mcp-app`)return``;let n=t.filter(e=>e.kind===`shared-chrome-action`);return n.length===0?``:[` <div class="${j.toolbox}">`,` <button type="button" class="${j.toolboxToggle}" aria-label="Open tools menu" aria-haspopup="menu" aria-expanded="false" aria-controls="aikit-toolbox-menu" onclick="toggleToolbox()">`,` <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"/></svg>`,` </button>`,` <div id="aikit-toolbox-menu" class="${j.toolboxMenu}" role="menu" hidden>`,...n.map(e=>Yt(e)),` </div>`,` </div>`].join(`
1461
+ `)}function M(e){return e?.trim()?e.trim():``}function Zt(e){if(!e)return null;let t=new Date(e);return Number.isNaN(t.getTime())?{display:e}:{dateTime:t.toISOString(),display:new Intl.DateTimeFormat(void 0,{month:`long`,day:`numeric`,year:`numeric`,hour:`numeric`,minute:`2-digit`}).format(t)}}function N(e){let t=e.brand??`AI KIT`,r=e.sharedChromeActions??(e.transport===`browser`?Jt:[]),i=[M(e.actionsHtml),Xt(e.transport,r),e.showThemeToggle===!1?``:[` <button type="button" class="${j.themeToggle}" aria-label="Switch to dark theme" aria-pressed="false" onclick="toggleTheme()">`,` <span class="${j.themeToggleIcon} ${j.themeToggleIconSun}" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="5"/><line x1="12" y1="1" x2="12" y2="3"/><line x1="12" y1="21" x2="12" y2="23"/><line x1="4.22" y1="4.22" x2="5.64" y2="5.64"/><line x1="18.36" y1="18.36" x2="19.78" y2="19.78"/><line x1="1" y1="12" x2="3" y2="12"/><line x1="21" y1="12" x2="23" y2="12"/><line x1="4.22" y1="19.78" x2="5.64" y2="18.36"/><line x1="18.36" y1="5.64" x2="19.78" y2="4.22"/></svg></span>`,` <span class="${j.themeToggleIcon} ${j.themeToggleIconMoon}" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/></svg></span>`,` </button>`].join(`
1462
1462
  `)].filter(Boolean).join(`
1463
- `);return[` <header class="${j.header}">`,` <div class="${j.brand}">${n(t)}</div>`,` <div class="${j.title}">`,` <span class="${j.titleText}">${n(e.title)}</span>`,...e.subtitle?[` <span class="${j.subtitle}">${n(e.subtitle)}</span>`]:[],` </div>`,` <div class="${j.actions}">`,r,` </div>`,` </header>`].join(`
1463
+ `);return[` <header class="${j.header}">`,` <div class="${j.brand}">${n(t)}</div>`,` <div class="${j.title}">`,` <span class="${j.titleText}">${n(e.title)}</span>`,...e.subtitle?[` <span class="${j.subtitle}">${n(e.subtitle)}</span>`]:[],` </div>`,` <div class="${j.actions}">`,i,` </div>`,` </header>`].join(`
1464
1464
  `)}function P(e={}){let t=Zt(e.generatedAt),r=t?[`Generated by `,`<span class="${j.footerBrand}">AI KIT</span>`,` at `,t.dateTime?`<time class="${j.footerTimestamp}" datetime="${n(t.dateTime)}">${n(t.display)}</time>`:`<span class="${j.footerTimestamp}">${n(t.display)}</span>`].join(``):`Generated by <span class="${j.footerBrand}">AI KIT</span>`,i=M(e.contentHtml);return[` <footer class="${j.footer}">`,` <div class="${j.footerMeta}">`,` <span class="${j.footerText}">${r}</span>`,...i?[` <span class="${j.footerSlot}">${i}</span>`]:[],` </div>`,` </footer>`].join(`
1465
1465
  `)}const F=`
1466
1466
  .aikit-header,
@@ -1784,8 +1784,8 @@ html[data-theme='dark'] .aikit-theme-toggle-icon--moon {
1784
1784
  }
1785
1785
  }
1786
1786
  `,Qt={actions:m,cards:ee,chart:ne,checklist:Ee,code:De,comparison:ke,diff:We,"component-detail":Ie,"data-table-schema":Ve,"docs-browser":Ke,"docs-hub":Xe,finding:Qe,graph:et,heading:nt,kv:it,"lifecycle-flow":ft,list:pt,markdown:vt,mermaid:yt,metrics:xt,paragraph:St,progress:wt,prompt:Et,separator:Dt,"status-board":kt,table:Nt,tags:Ft,text:It,timeline:Lt,tree:Rt};function I(e,t){let r={...e,value:o(e.value)},i=Qt[r.type],a=i?i(r,t):$t(r);return r.title&&![`heading`,`finding`].includes(r.type)?`<section class="bk-section bk-section--${n(r.type)}"><h3 class="bk-section-title">${n(r.title)}</h3>${a}</section>`:a}function L(e,t){return e.map(e=>I(e,t)).join(`
1787
- `)}function $t(e){if(e.value===void 0||e.value===null)return``;if(typeof e.value==`string`)return`<p class="bk-paragraph">${n(e.value)}</p>`;try{return`<pre class="bk-fallback">${n(JSON.stringify(e.value,null,2))}</pre>`}catch{return`<pre class="bk-fallback">${n(String(e.value))}</pre>`}}var R=class{templates=new Map;register(e){this.templates.set(e.id,e)}get(e){let t=this.templates.get(e);if(t)return t;let n=e.includes(`@`)?e:`${e}@`,r,i=-1;for(let[e,t]of this.templates){if(!e.startsWith(n))continue;let a=Number.parseInt(e.split(`@`)[1]??`0`,10);a>i&&(i=a,r=t)}return r}has(e){return this.get(e)!==void 0}list(){return[...this.templates.values()]}};const en=[`mcp-app`,`browser`];function z(e){return typeof e==`object`&&!!e}function tn(e){return Array.isArray(e)?e.flatMap(e=>!z(e)||typeof e.label!=`string`?[]:[{label:e.label,checked:!!e.checked}]):[]}const nn={id:`checklist@1`,label:`Checklist`,description:`Checklist with optional title and checklist hydration metadata.`,inputSchema:{type:`object`,properties:{title:{type:`string`},items:{type:`array`,items:{type:`object`,required:[`label`,`checked`],properties:{label:{type:`string`},checked:{type:`boolean`}},additionalProperties:!1}}},required:[`items`],additionalProperties:!1},defaultLayout:{},blocksFromData:e=>{let t=[],n=z(e)&&typeof e.title==`string`?e.title:void 0,r=z(e)?tn(e.items):[];return n&&t.push({type:`heading`,value:n}),t.push({type:`checklist`,value:r}),t},hydration:[`checklist`],supportedTransports:en},rn=[`mcp-app`,`browser`,`export`];function B(e){return typeof e==`object`&&!!e}function an(e){return B(e)&&typeof e.label==`string`&&(typeof e.value==`string`||typeof e.value==`number`)}function on(e){return B(e)&&typeof e.key==`string`&&typeof e.label==`string`}function sn(e){return Array.isArray(e)?e.filter(B):[]}function cn(e,t){if(Array.isArray(e)){let t=e.filter(on);if(t.length>0)return t}return Object.keys(t[0]??{}).map(e=>({key:e,label:e}))}const V={id:`data-table@1`,label:`Data Table`,description:`Static data table with optional metrics and sortable table hydration.`,inputSchema:{type:`object`,properties:{columns:{type:`array`,items:{type:`object`,required:[`key`,`label`],properties:{key:{type:`string`},label:{type:`string`}},additionalProperties:!1}},rows:{type:`array`,items:{type:`object`}},stats:{type:`array`,items:{type:`object`,required:[`label`,`value`],properties:{label:{type:`string`},value:{type:[`string`,`number`]},trend:{type:[`string`,`number`]},status:{type:`string`}},additionalProperties:!1}}},required:[`rows`],additionalProperties:!1},defaultLayout:{},blocksFromData:e=>{let t=B(e)?sn(e.rows):[],n=B(e)?cn(e.columns,t):[],r=n.map(e=>e.label),i=t.map(e=>n.map(t=>e[t.key])),a=[];if(B(e)&&Array.isArray(e.stats)){let t=e.stats.filter(an);t.length>0&&a.push({type:`metrics`,value:t})}return a.push({type:`table`,columns:n,headers:r,rows:i,value:{headers:r,rows:i}}),a},hydration:[`table`],supportedTransports:rn},ln=[`mcp-app`,`browser`,`export`];function H(e){return typeof e==`object`&&!!e}function un(e){return Array.isArray(e)?e.flatMap(e=>!H(e)||typeof e.type!=`string`||typeof e.content!=`string`?[]:[{type:e.type,content:e.content}]):[]}function dn(e){return Array.isArray(e)?e.flatMap(e=>!H(e)||typeof e.header!=`string`?[]:[{header:e.header,changes:un(e.changes)}]):[]}function fn(e){return!H(e)||!Array.isArray(e.files)?[]:e.files.flatMap(e=>!H(e)||typeof e.path!=`string`||typeof e.status!=`string`?[]:[{path:e.path,status:e.status,additions:typeof e.additions==`number`?e.additions:0,deletions:typeof e.deletions==`number`?e.deletions:0,hunks:dn(e.hunks)}])}function pn(e){return e===`add`?`+`:e===`delete`?`-`:` `}function mn(e){let t=e.hunks.flatMap(e=>[e.header,...e.changes.map(e=>`${pn(e.type)}${e.content}`)]).join(`
1788
- `);return[{type:`heading`,value:e.path},{type:`paragraph`,value:`${e.status} | +${e.additions} / -${e.deletions}`},{type:`code`,language:`diff`,value:t}]}const hn={id:`diff-view@1`,label:`Diff View`,description:`Static diff summary rendered as per-file diff code blocks.`,inputSchema:{type:`object`,properties:{files:{type:`array`,items:{type:`object`,required:[`path`,`status`,`additions`,`deletions`,`hunks`],properties:{path:{type:`string`},status:{type:`string`},additions:{type:`number`},deletions:{type:`number`},hunks:{type:`array`,items:{type:`object`,required:[`header`,`changes`],properties:{header:{type:`string`},changes:{type:`array`,items:{type:`object`,required:[`type`,`content`],properties:{type:{type:`string`},content:{type:`string`}},additionalProperties:!1}}},additionalProperties:!1}}},additionalProperties:!1}}},required:[`files`],additionalProperties:!1},defaultLayout:{},blocksFromData:e=>fn(e).flatMap(mn),hydration:[],supportedTransports:ln},gn=[`mcp-app`,`browser`,`export`];function U(e){return typeof e==`object`&&!!e}function _n(e){return U(e)&&typeof e.type==`string`}function vn(e){return Array.isArray(e)&&e.every(_n)}function yn(e){if(!U(e))return{sections:[]};let t=Array.isArray(e.sections)?e.sections.flatMap(e=>{if(!U(e)||typeof e.heading!=`string`)return[];let t=typeof e.content==`string`||vn(e.content)?e.content:``;return[{heading:e.heading,content:t}]}):[];return{title:typeof e.title==`string`?e.title:void 0,sections:t}}function bn(e){let t=[{type:`heading`,value:e.heading}];return typeof e.content==`string`?(t.push({type:`paragraph`,value:e.content}),t):(t.push(...e.content),t)}const xn={id:`document@1`,label:`Document`,description:`Structured document with optional title and section content blocks.`,inputSchema:{type:`object`,properties:{title:{type:`string`},sections:{type:`array`,items:{type:`object`,additionalProperties:!1,required:[`heading`,`content`],properties:{heading:{type:`string`},content:{oneOf:[{type:`string`},{type:`array`,items:{type:`object`}}]}}}}},required:[`sections`],additionalProperties:!1},defaultLayout:{},blocksFromData:e=>{let t=yn(e),n=[];t.title&&n.push({type:`heading`,value:t.title});for(let e of t.sections)n.push(...bn(e));return n},hydration:[],supportedTransports:gn},Sn=[`mcp-app`,`browser`,`export`];function Cn(e){return typeof e==`object`&&!!e}function wn(e){return Cn(e)?{code:typeof e.code==`string`?e.code:`ERROR`,message:typeof e.message==`string`?e.message:`Unknown error`,details:typeof e.details==`string`?e.details:void 0,stack:typeof e.stack==`string`?e.stack:void 0}:{code:`ERROR`,message:`Unknown error`}}const W={id:`error@1`,label:`Error`,description:`Static error view with message and optional stack trace.`,inputSchema:{type:`object`,properties:{code:{type:`string`},message:{type:`string`},details:{type:`string`},stack:{type:`string`}},required:[`code`,`message`],additionalProperties:!1},defaultLayout:{},blocksFromData:e=>{let t=wn(e),n=[{type:`heading`,value:`Error`},{type:`code`,title:t.code,language:`text`,value:t.details?`${t.message}\n\n${t.details}`:t.message}];return t.stack&&n.push({type:`code`,title:`Stack Trace`,language:`text`,value:t.stack}),n},hydration:[],supportedTransports:Sn};function G(e){return typeof e==`object`&&!!e}function Tn(e){return Array.isArray(e)?e.flatMap(e=>!G(e)||typeof e.name!=`string`||typeof e.label!=`string`?[]:[{name:e.name,label:e.label,type:typeof e.type==`string`?e.type:void 0,required:typeof e.required==`boolean`?e.required:void 0,placeholder:typeof e.placeholder==`string`?e.placeholder:void 0,default:typeof e.default==`string`?e.default:void 0,options:Array.isArray(e.options)?e.options.filter(e=>typeof e==`string`||G(e)&&typeof e.label==`string`&&typeof e.value==`string`):void 0,value:typeof e.value==`string`||typeof e.value==`boolean`?e.value:void 0}]):[]}const En={id:`form@1`,label:`Form`,description:`Browser-only form template rendered as a heading and table of field metadata.`,inputSchema:{type:`object`,properties:{title:{type:`string`},fields:{type:`array`,items:{type:`object`,required:[`name`,`label`],properties:{name:{type:`string`},label:{type:`string`},type:{type:`string`},required:{type:`boolean`},placeholder:{type:`string`},default:{type:`string`},options:{type:`array`,items:{anyOf:[{type:`string`},{type:`object`,required:[`label`,`value`],properties:{label:{type:`string`},value:{type:`string`}},additionalProperties:!1}]}},value:{type:[`string`,`boolean`]}},additionalProperties:!1}}},required:[`fields`],additionalProperties:!1},defaultLayout:{},blocksFromData:e=>{let t={title:G(e)&&typeof e.title==`string`?e.title:`Form`,fields:G(e)?Tn(e.fields):[]};return[{type:`heading`,value:t.title},{type:`table`,value:{headers:[`Label`,`Name`,`Type`,`Required`,`Default/Placeholder`],rows:t.fields.map(e=>[e.label||e.name,e.name,e.type||`text`,e.required?`Yes`:`No`,e.placeholder||e.default||``])}}]},hydration:[`form`],supportedTransports:[`browser`]},Dn=[`mcp-app`,`browser`];function K(e){return typeof e==`object`&&!!e}function On(e){if(!Array.isArray(e))return;let t=e.flatMap(e=>!K(e)||typeof e.id!=`string`||typeof e.label!=`string`?[]:[{id:e.id,label:e.label}]);return t.length>0?t:void 0}function kn(e){return Array.isArray(e)?e.flatMap(e=>!K(e)||typeof e.id!=`string`||typeof e.label!=`string`?[]:[{id:e.id,label:e.label,category:typeof e.category==`string`?e.category:void 0,tags:Array.isArray(e.tags)?e.tags.filter(e=>typeof e==`string`):void 0}]):[]}function An(e){return K(e)?{categories:On(e.categories),items:kn(e.items)}:{items:[]}}function jn(e){return{title:e.label,body:e.id,description:e.tags&&e.tags.length>0?e.tags.join(`, `):void 0}}function Mn(e,t){return t.length===0?[]:[{type:`heading`,value:e},{type:`cards`,value:t.map(jn)}]}const Nn={id:`picker@1`,label:`Picker`,description:`Grouped item picker rendered as cards with picker hydration metadata.`,inputSchema:{type:`object`,properties:{categories:{type:`array`,items:{type:`object`,required:[`id`,`label`],properties:{id:{type:`string`},label:{type:`string`}},additionalProperties:!1}},items:{type:`array`,items:{type:`object`,required:[`id`,`label`],properties:{id:{type:`string`},label:{type:`string`},category:{type:`string`},tags:{type:`array`,items:{type:`string`}}},additionalProperties:!1}}},required:[`items`],additionalProperties:!1},defaultLayout:{},blocksFromData:e=>{let t=An(e),n=[];if(t.categories&&t.categories.length>0){let e=new Set(t.categories.map(e=>e.id)),r=[];for(let e of t.categories){let n=Mn(e.label,t.items.filter(t=>t.category===e.id));n.length>0&&r.push(n)}let i=Mn(`Other`,t.items.filter(t=>!t.category||!e.has(t.category)));return i.length>0&&r.push(i),n.push(...r.flatMap((e,t)=>t>0?[{type:`separator`},...e]:e)),n}return t.items.length>0&&n.push({type:`cards`,value:t.items.map(jn)}),n},hydration:[`picker`],supportedTransports:Dn},Pn=[`mcp-app`,`browser`,`export`];function q(e){return typeof e==`object`&&!!e}function Fn(e){return q(e)&&typeof e.type==`string`}function In(e){return Array.isArray(e)&&e.every(Fn)}function Ln(e){return q(e)&&typeof e.label==`string`&&(typeof e.value==`string`||typeof e.value==`number`)}function Rn(e){return Array.isArray(e)?e.flatMap(e=>{if(!q(e)||typeof e.heading!=`string`)return[];let t=typeof e.content==`string`||In(e.content)?e.content:``;return[{heading:e.heading,content:t}]}):[]}function zn(e){return Array.isArray(e)?e.flatMap(e=>q(e)?[{title:typeof e.title==`string`?e.title:void 0,value:e.value,headers:Array.isArray(e.headers)?e.headers.filter(e=>typeof e==`string`):void 0,rows:Array.isArray(e.rows)?e.rows.filter(e=>Array.isArray(e)):void 0}]:[]):[]}function Bn(e){let t=[{type:`heading`,value:e.heading}];return typeof e.content==`string`?(t.push({type:`paragraph`,value:e.content}),t):(t.push(...e.content),t)}function Vn(e){let t={type:`table`};return e.title&&(t.title=e.title),e.value!==void 0&&(t.value=e.value),e.headers&&(t.headers=e.headers),e.rows&&(t.rows=e.rows),t}const Hn={id:`report@1`,label:`Report`,description:`Static report with title, optional metrics, narrative sections, and tables.`,inputSchema:{type:`object`,properties:{title:{type:`string`},metrics:{type:`array`,items:{type:`object`,required:[`label`,`value`],properties:{label:{type:`string`},value:{type:[`string`,`number`]},trend:{type:[`string`,`number`]},status:{type:`string`}},additionalProperties:!1}},sections:{type:`array`,items:{type:`object`,required:[`heading`,`content`],properties:{heading:{type:`string`},content:{oneOf:[{type:`string`},{type:`array`,items:{type:`object`}}]}},additionalProperties:!1}},tables:{type:`array`,items:{type:`object`,properties:{title:{type:`string`},value:{},headers:{type:`array`,items:{type:`string`}},rows:{type:`array`,items:{type:`array`,items:{}}}},additionalProperties:!1}}},required:[`title`,`sections`],additionalProperties:!1},defaultLayout:{},blocksFromData:e=>{let t={title:q(e)&&typeof e.title==`string`?e.title:`Report`,metrics:q(e)&&Array.isArray(e.metrics)?e.metrics.filter(Ln):void 0,sections:q(e)?Rn(e.sections):[],tables:q(e)?zn(e.tables):void 0},n=[{type:`heading`,value:t.title}];t.metrics&&t.metrics.length>0&&n.push({type:`metrics`,value:t.metrics});for(let e of t.sections)n.push(...Bn(e));for(let e of t.tables??[])n.push(Vn(e));return n},hydration:[],supportedTransports:Pn},Un=[`mcp-app`,`browser`,`export`];function J(e){return typeof e==`object`&&!!e}function Wn(e){return Array.isArray(e)?e.flatMap(e=>{if(!J(e)||typeof e.category!=`string`||!Array.isArray(e.items))return[];let t=e.items.flatMap(e=>!J(e)||typeof e.label!=`string`||typeof e.status!=`string`?[]:[{label:e.label,status:e.status,badge:typeof e.badge==`string`?e.badge:void 0}]);return[{category:e.category,items:t}]}):[]}function Gn(e){return e.map(e=>({title:e.label,status:e.status,badge:e.badge}))}const Kn={id:`status-board@1`,label:`Status Board`,description:`Static status board grouped into category headings and card collections.`,inputSchema:{type:`object`,properties:{categories:{type:`array`,items:{type:`object`,required:[`category`,`items`],properties:{category:{type:`string`},items:{type:`array`,items:{type:`object`,required:[`label`,`status`],properties:{label:{type:`string`},status:{type:`string`},badge:{type:`string`}},additionalProperties:!1}}},additionalProperties:!1}}},required:[`categories`],additionalProperties:!1},defaultLayout:{},blocksFromData:e=>{let t=J(e)?Wn(e.categories):[],n=[];for(let e of t)n.push({type:`heading`,value:e.category}),n.push({type:`cards`,value:Gn(e.items)});return n},hydration:[],supportedTransports:Un},qn=[`mcp-app`,`browser`,`export`];function Jn(e){return typeof e==`object`&&!!e}function Yn(e){return Array.isArray(e)?e.flatMap(e=>!Jn(e)||typeof e.title!=`string`?[]:[{title:e.title,description:typeof e.description==`string`?e.description:void 0,timestamp:typeof e.timestamp==`string`?e.timestamp:void 0,status:typeof e.status==`string`?e.status:void 0}]):[]}function Xn(e){return Array.isArray(e)?{entries:Yn(e)}:Jn(e)?{entries:Yn(e.entries??e.events??e.items),title:typeof e.title==`string`?e.title:void 0}:{entries:[]}}const Y={type:`array`,items:{type:`object`,required:[`title`],properties:{title:{type:`string`},description:{type:`string`},timestamp:{type:`string`},status:{type:`string`}},additionalProperties:!1}},Zn={id:`timeline@1`,label:`Timeline`,description:`Static timeline events rendered as a timeline block.`,inputSchema:{oneOf:[Y,{type:`object`,properties:{title:{type:`string`},entries:Y,events:Y,items:Y},anyOf:[{required:[`entries`]},{required:[`events`]},{required:[`items`]}],additionalProperties:!1}]},defaultLayout:{},blocksFromData:e=>{let{entries:t,title:n}=Xn(e),r=[];return n&&r.push({type:`heading`,value:n}),r.push({type:`timeline`,value:t}),r},hydration:[],supportedTransports:qn},Qn=[`mcp-app`,`browser`,`export`];function X(e){return typeof e==`object`&&!!e}function $n(e){return X(e)&&typeof e.label==`string`}function er(e){return{name:e.label,children:Array.isArray(e.children)?e.children.filter($n).map(er):[]}}function tr(e){if(!X(e))return{};let t=e.root;return $n(t)?er(t):X(t)?t:e}const nr={id:`tree@1`,label:`Tree`,description:`Static tree view data with optional tree hydration metadata.`,inputSchema:{oneOf:[{type:`object`,properties:{root:{type:`object`}},required:[`root`],additionalProperties:!0},{type:`object`,additionalProperties:!0}]},defaultLayout:{},blocksFromData:e=>[{type:`tree`,value:tr(e)}],hydration:[`tree`],supportedTransports:Qn},Z=new R;Z.register(nn),Z.register(hn),Z.register(xn),Z.register(Nn),Z.register(Hn),Z.register(Zn),Z.register(nr),Z.register(V),Z.register(W),Z.register(En),Z.register(Kn);let Q=0;function rr(){return Q=(Q+1)%(2**53-1),`${Date.now().toString(16).padStart(12,`0`).slice(-12)}${Q.toString(16).padStart(4,`0`).slice(-4)}${Array.from({length:8},()=>Math.floor(Math.random()*256).toString(16).padStart(2,`0`)).join(``)}`}function ir(e){return{id:e,version:1,entry:`@aikit/blocks-interactive/dist/islands/${e}.mjs`,selector:`[data-island="${e}"]`,needsData:!0}}function ar(e,t){let n=new TextEncoder;return n.encode(e).byteLength+t.reduce((e,t)=>e+n.encode(t).byteLength,0)}function or(e,t){let n=[],r=t.registry??Z,i={colorScheme:e.colorScheme??t.colorScheme??`auto`,transport:t.transport,lang:e.lang,dir:e.dir},a=[...e.blocks??[]],o=[...a],s=[],c=[...e.actions??[]];if(e.template){let t=r.get(e.template);if(t)try{o=t.blocksFromData(e.data,i),o.length===0&&e.data!==void 0&&(n.push({level:`warn`,message:`Template "${e.template}" produced no blocks from provided data`}),o=[{type:`markdown`,value:`> ⚠️ Template \`${e.template}\` received data but produced no content. Verify the data structure matches the template schema.`}]),t.actionsFromData&&(c=[...c,...t.actionsFromData(e.data)]),s=t.hydration.map(e=>ir(e))}catch(t){let r=t instanceof Error?t.message:String(t);n.push({level:`error`,message:`Template ${e.template} failed: ${r}`}),o=a.length===0?W.blocksFromData({code:`TEMPLATE_RENDER_ERROR`,message:`Failed to render template ${e.template}`,details:r},i):[...a]}else n.push({level:`warn`,message:`Template not found: ${e.template}`})}let l=L(o,i),u=[A(o.map(e=>e.type))],d=t.nonce??rr(),f=e.metadata?.surfaceId??`surface-${d}`,p=s.length>0?JSON.stringify({data:e.data,blocks:o}):void 0,m=t.blockVendorScripts?[...new Set(o.flatMap(e=>t.blockVendorScripts?.[e.type]??[]))]:void 0;return{surfaceId:f,nonce:d,html:l,css:u,vendorScripts:m&&m.length>0?m:void 0,islands:s,actions:c,payload:p,estimatedBytes:ar(l,u),exportPolicy:s.length>0?`local-interactive`:`static-only`,diagnostics:n.length>0?n:void 0}}function sr(e){return e===`up`||e===`down`||e===`neutral`}function $(e){return typeof e==`object`&&!!e}function cr(e){return!$(e)||!Array.isArray(e.metrics)?{metrics:[]}:{metrics:e.metrics.flatMap(e=>{if(!$(e)||typeof e.label!=`string`||typeof e.value!=`string`&&typeof e.value!=`number`)return[];let t=$(e.trend)&&typeof e.trend.value==`string`&&sr(e.trend.direction)?{value:e.trend.value,direction:e.trend.direction}:void 0,n=Array.isArray(e.items)?e.items.flatMap(e=>!$(e)||typeof e.label!=`string`||typeof e.value!=`string`?[]:[{label:e.label,value:e.value}]):void 0;return[{id:typeof e.id==`string`?e.id:void 0,label:e.label,value:e.value,trend:t,status:e.status===`success`||e.status===`warning`||e.status===`error`||e.status===`info`?e.status:void 0,type:e.type===`progress`||e.type===`list`||e.type===`stat`?e.type:void 0,progress:typeof e.progress==`number`?gr(e.progress):void 0,items:n}]})}}function lr(e){let t=e.type===`progress`&&typeof e.progress==`number`?`${e.progress}%`:void 0;return{label:e.label,value:e.value,trend:e.trend?.value??t,status:e.status}}function ur(e){return e.type!==`progress`||typeof e.progress!=`number`?null:{label:e.label,value:gr(e.progress),max:100}}function dr(e){return $(e)?{columns:Array.isArray(e.columns)?e.columns.flatMap(e=>!$(e)||typeof e.id!=`string`||typeof e.label!=`string`?[]:[{id:e.id,label:e.label}]):[],cards:Array.isArray(e.cards)?e.cards.flatMap(e=>!$(e)||typeof e.id!=`string`||typeof e.title!=`string`||typeof e.column!=`string`?[]:[{id:e.id,title:e.title,description:typeof e.description==`string`?e.description:void 0,column:e.column,tags:Array.isArray(e.tags)?e.tags.filter(e=>typeof e==`string`):void 0,priority:e.priority===`high`||e.priority===`medium`||e.priority===`low`?e.priority:void 0}]):[]}:{columns:[],cards:[]}}function fr(e){return{title:e.title,description:e.description,badge:e.priority,body:e.tags?.join(`, `),status:e.priority}}function pr(e){return!$(e)||!Array.isArray(e.items)?[]:e.items.flatMap(e=>!$(e)||typeof e.id!=`string`||typeof e.label!=`string`?[]:[{id:e.id,label:e.label}])}function mr(e){return $(e)?{name:typeof e.name==`string`?e.name:``,total:typeof e.total==`number`?e.total:typeof e.value==`number`?e.value:0,self:typeof e.self==`number`?e.self:void 0,children:Array.isArray(e.children)?e.children.map(e=>mr(e)):[]}:{name:``,total:0,children:[]}}function hr(e){return{name:e.self==null?`${e.name} (${e.total})`:`${e.name} (${e.total} total / ${e.self} self)`,children:(e.children??[]).map(hr)}}function gr(e){return Math.max(0,Math.min(100,e))}function _r(e){let t=cr(e),n=[];t.metrics.length>0&&n.push({type:`metrics`,value:t.metrics.map(lr)});let r=t.metrics.map(ur).filter(e=>e!==null);r.length>0&&n.push({type:`progress`,value:r});for(let e of t.metrics)e.type===`list`&&e.items&&e.items.length>0&&(n.push({type:`heading`,value:e.label}),n.push({type:`table`,value:e.items}));return n}function vr(e){let t=dr(e),n=[];return t.columns.forEach((e,r)=>{r>0&&n.push({type:`separator`,value:``});let i=t.cards.filter(t=>t.column===e.id);n.push({type:`heading`,value:e.label}),n.push({type:`cards`,value:i.map(fr)})}),n}function yr(e){let t=pr(e);return t.length===0?[]:[{type:`cards`,value:t.map((e,t)=>({title:e.label,body:e.id,badge:`#${t+1}`}))}]}function br(e){return!$(e)||!$(e.profile)?[]:[{type:`tree`,value:hr(mr(e.profile))}]}const xr={id:`dashboard@1`,label:`Dashboard`,description:`Metric cards grid with optional charts.`,inputSchema:{type:`object`,properties:{metrics:{type:`array`,items:{type:`object`,required:[`label`,`value`],properties:{id:{type:`string`},label:{type:`string`},value:{type:[`string`,`number`]},trend:{type:`object`,properties:{value:{type:`string`},direction:{enum:[`up`,`down`,`neutral`]}},required:[`value`,`direction`],additionalProperties:!1},status:{enum:[`success`,`warning`,`error`,`info`]},type:{enum:[`stat`,`progress`,`list`]},progress:{type:`number`},items:{type:`array`,items:{type:`object`,required:[`label`,`value`],properties:{label:{type:`string`},value:{type:`string`}},additionalProperties:!1}}},additionalProperties:!1}}},required:[`metrics`],additionalProperties:!1},defaultLayout:{maxWidth:`1200px`},blocksFromData:e=>_r(e),hydration:[],supportedTransports:[`mcp-app`,`browser`]},Sr={id:`kanban@1`,label:`Kanban`,description:`Drag-and-drop task board grouped by columns.`,inputSchema:{type:`object`,properties:{columns:{type:`array`,items:{type:`object`,required:[`id`,`label`],properties:{id:{type:`string`},label:{type:`string`},color:{type:`string`}},additionalProperties:!1}},cards:{type:`array`,items:{type:`object`,required:[`id`,`title`,`column`],properties:{id:{type:`string`},title:{type:`string`},description:{type:`string`},column:{type:`string`},tags:{type:`array`,items:{type:`string`}},priority:{enum:[`high`,`medium`,`low`]}},additionalProperties:!1}}},required:[`columns`,`cards`],additionalProperties:!1},defaultLayout:{maxWidth:`1400px`},blocksFromData:e=>vr(e),hydration:[],supportedTransports:[`browser`]},Cr={id:`list-sort@1`,label:`Sortable List`,description:`Reorderable list of items with browser drag-and-drop interactions.`,inputSchema:{type:`object`,properties:{items:{type:`array`,items:{type:`object`,required:[`id`,`label`],properties:{id:{type:`string`},label:{type:`string`}},additionalProperties:!1}}},required:[`items`],additionalProperties:!1},defaultLayout:{maxWidth:`720px`},blocksFromData:e=>yr(e),hydration:[],supportedTransports:[`browser`]},wr={id:`flame-graph@1`,label:`Flame Graph`,description:`Hierarchical performance profile with interactive zoom state.`,inputSchema:{type:`object`,properties:{profile:{type:`object`}},required:[`profile`],additionalProperties:!1},defaultLayout:{maxWidth:`1200px`},blocksFromData:e=>br(e),hydration:[`flame-graph`],supportedTransports:[`browser`]};function Tr(e){return e.replace(/</g,`\\u003c`).replace(/>/g,`\\u003e`).replace(/&/g,`\\u0026`).replace(/\u2028/g,`\\u2028`).replace(/\u2029/g,`\\u2029`)}function Er(e,t){let n=[`
1787
+ `)}function $t(e){if(e.value===void 0||e.value===null)return``;if(typeof e.value==`string`)return`<p class="bk-paragraph">${n(e.value)}</p>`;try{return`<pre class="bk-fallback">${n(JSON.stringify(e.value,null,2))}</pre>`}catch{return`<pre class="bk-fallback">${n(String(e.value))}</pre>`}}var R=class{templates=new Map;register(e){this.templates.set(e.id,e)}get(e){let t=this.templates.get(e);if(t)return t;let n=e.includes(`@`)?e:`${e}@`,r,i=-1;for(let[e,t]of this.templates){if(!e.startsWith(n))continue;let a=Number.parseInt(e.split(`@`)[1]??`0`,10);a>i&&(i=a,r=t)}return r}has(e){return this.get(e)!==void 0}list(){return[...this.templates.values()]}};const en=[`mcp-app`,`browser`];function z(e){return typeof e==`object`&&!!e}function tn(e){return Array.isArray(e)?e.flatMap(e=>!z(e)||typeof e.label!=`string`?[]:[{label:e.label,checked:!!e.checked}]):[]}const nn={id:`checklist@1`,label:`Checklist`,description:`Checklist with optional title and checklist hydration metadata.`,inputSchema:{type:`object`,properties:{title:{type:`string`},items:{type:`array`,items:{type:`object`,required:[`label`,`checked`],properties:{label:{type:`string`},checked:{type:`boolean`}},additionalProperties:!1}}},required:[`items`],additionalProperties:!1},defaultLayout:{},blocksFromData:e=>{let t=[],n=z(e)&&typeof e.title==`string`?e.title:void 0,r=z(e)?tn(e.items):[];return n&&t.push({type:`heading`,value:n}),t.push({type:`checklist`,value:r}),t},hydration:[`checklist`],supportedTransports:en},rn=[`mcp-app`,`browser`,`export`];function B(e){return typeof e==`object`&&!!e}function an(e){return B(e)&&typeof e.label==`string`&&(typeof e.value==`string`||typeof e.value==`number`)}function on(e){return B(e)&&typeof e.key==`string`&&typeof e.label==`string`}function sn(e){return Array.isArray(e)?e.filter(B):[]}function cn(e,t){if(Array.isArray(e)){let t=e.filter(on);if(t.length>0)return t}return Object.keys(t[0]??{}).map(e=>({key:e,label:e}))}const ln={id:`data-table@1`,label:`Data Table`,description:`Static data table with optional metrics and sortable table hydration.`,inputSchema:{type:`object`,properties:{columns:{type:`array`,items:{type:`object`,required:[`key`,`label`],properties:{key:{type:`string`},label:{type:`string`}},additionalProperties:!1}},rows:{type:`array`,items:{type:`object`}},stats:{type:`array`,items:{type:`object`,required:[`label`,`value`],properties:{label:{type:`string`},value:{type:[`string`,`number`]},trend:{type:[`string`,`number`]},status:{type:`string`}},additionalProperties:!1}}},required:[`rows`],additionalProperties:!1},defaultLayout:{},blocksFromData:e=>{let t=B(e)?sn(e.rows):[],n=B(e)?cn(e.columns,t):[],r=n.map(e=>e.label),i=t.map(e=>n.map(t=>e[t.key])),a=[];if(B(e)&&Array.isArray(e.stats)){let t=e.stats.filter(an);t.length>0&&a.push({type:`metrics`,value:t})}return a.push({type:`table`,columns:n,headers:r,rows:i,value:{headers:r,rows:i}}),a},hydration:[`table`],supportedTransports:rn},un=[`mcp-app`,`browser`,`export`];function V(e){return typeof e==`object`&&!!e}function dn(e){return Array.isArray(e)?e.flatMap(e=>!V(e)||typeof e.type!=`string`||typeof e.content!=`string`?[]:[{type:e.type,content:e.content}]):[]}function fn(e){return Array.isArray(e)?e.flatMap(e=>!V(e)||typeof e.header!=`string`?[]:[{header:e.header,changes:dn(e.changes)}]):[]}function pn(e){return!V(e)||!Array.isArray(e.files)?[]:e.files.flatMap(e=>!V(e)||typeof e.path!=`string`||typeof e.status!=`string`?[]:[{path:e.path,status:e.status,additions:typeof e.additions==`number`?e.additions:0,deletions:typeof e.deletions==`number`?e.deletions:0,hunks:fn(e.hunks)}])}function mn(e){return e===`add`?`+`:e===`delete`?`-`:` `}function hn(e){let t=e.hunks.flatMap(e=>[e.header,...e.changes.map(e=>`${mn(e.type)}${e.content}`)]).join(`
1788
+ `);return[{type:`heading`,value:e.path},{type:`paragraph`,value:`${e.status} | +${e.additions} / -${e.deletions}`},{type:`code`,language:`diff`,value:t}]}const gn={id:`diff-view@1`,label:`Diff View`,description:`Static diff summary rendered as per-file diff code blocks.`,inputSchema:{type:`object`,properties:{files:{type:`array`,items:{type:`object`,required:[`path`,`status`,`additions`,`deletions`,`hunks`],properties:{path:{type:`string`},status:{type:`string`},additions:{type:`number`},deletions:{type:`number`},hunks:{type:`array`,items:{type:`object`,required:[`header`,`changes`],properties:{header:{type:`string`},changes:{type:`array`,items:{type:`object`,required:[`type`,`content`],properties:{type:{type:`string`},content:{type:`string`}},additionalProperties:!1}}},additionalProperties:!1}}},additionalProperties:!1}}},required:[`files`],additionalProperties:!1},defaultLayout:{},blocksFromData:e=>pn(e).flatMap(hn),hydration:[],supportedTransports:un},_n=[`mcp-app`,`browser`,`export`];function H(e){return typeof e==`object`&&!!e}function vn(e){return H(e)&&typeof e.type==`string`}function yn(e){return Array.isArray(e)&&e.every(vn)}function bn(e){if(!H(e))return{sections:[]};let t=Array.isArray(e.sections)?e.sections.flatMap(e=>{if(!H(e)||typeof e.heading!=`string`)return[];let t=typeof e.content==`string`||yn(e.content)?e.content:``;return[{heading:e.heading,content:t}]}):[];return{title:typeof e.title==`string`?e.title:void 0,sections:t}}function xn(e){let t=[{type:`heading`,value:e.heading}];return typeof e.content==`string`?(t.push({type:`paragraph`,value:e.content}),t):(t.push(...e.content),t)}const U={id:`document@1`,label:`Document`,description:`Structured document with optional title and section content blocks.`,inputSchema:{type:`object`,properties:{title:{type:`string`},sections:{type:`array`,items:{type:`object`,additionalProperties:!1,required:[`heading`,`content`],properties:{heading:{type:`string`},content:{oneOf:[{type:`string`},{type:`array`,items:{type:`object`}}]}}}}},required:[`sections`],additionalProperties:!1},defaultLayout:{},blocksFromData:e=>{let t=bn(e),n=[];t.title&&n.push({type:`heading`,value:t.title});for(let e of t.sections)n.push(...xn(e));return n},hydration:[],supportedTransports:_n},Sn=[`mcp-app`,`browser`,`export`];function Cn(e){return typeof e==`object`&&!!e}function wn(e){return Cn(e)?{code:typeof e.code==`string`?e.code:`ERROR`,message:typeof e.message==`string`?e.message:`Unknown error`,details:typeof e.details==`string`?e.details:void 0,stack:typeof e.stack==`string`?e.stack:void 0}:{code:`ERROR`,message:`Unknown error`}}const W={id:`error@1`,label:`Error`,description:`Static error view with message and optional stack trace.`,inputSchema:{type:`object`,properties:{code:{type:`string`},message:{type:`string`},details:{type:`string`},stack:{type:`string`}},required:[`code`,`message`],additionalProperties:!1},defaultLayout:{},blocksFromData:e=>{let t=wn(e),n=[{type:`heading`,value:`Error`},{type:`code`,title:t.code,language:`text`,value:t.details?`${t.message}\n\n${t.details}`:t.message}];return t.stack&&n.push({type:`code`,title:`Stack Trace`,language:`text`,value:t.stack}),n},hydration:[],supportedTransports:Sn};function G(e){return typeof e==`object`&&!!e}function Tn(e){return Array.isArray(e)?e.flatMap(e=>!G(e)||typeof e.name!=`string`||typeof e.label!=`string`?[]:[{name:e.name,label:e.label,type:typeof e.type==`string`?e.type:void 0,required:typeof e.required==`boolean`?e.required:void 0,placeholder:typeof e.placeholder==`string`?e.placeholder:void 0,default:typeof e.default==`string`?e.default:void 0,options:Array.isArray(e.options)?e.options.filter(e=>typeof e==`string`||G(e)&&typeof e.label==`string`&&typeof e.value==`string`):void 0,value:typeof e.value==`string`||typeof e.value==`boolean`?e.value:void 0}]):[]}const En={id:`form@1`,label:`Form`,description:`Browser-only form template rendered as a heading and table of field metadata.`,inputSchema:{type:`object`,properties:{title:{type:`string`},fields:{type:`array`,items:{type:`object`,required:[`name`,`label`],properties:{name:{type:`string`},label:{type:`string`},type:{type:`string`},required:{type:`boolean`},placeholder:{type:`string`},default:{type:`string`},options:{type:`array`,items:{anyOf:[{type:`string`},{type:`object`,required:[`label`,`value`],properties:{label:{type:`string`},value:{type:`string`}},additionalProperties:!1}]}},value:{type:[`string`,`boolean`]}},additionalProperties:!1}}},required:[`fields`],additionalProperties:!1},defaultLayout:{},blocksFromData:e=>{let t={title:G(e)&&typeof e.title==`string`?e.title:`Form`,fields:G(e)?Tn(e.fields):[]};return[{type:`heading`,value:t.title},{type:`table`,value:{headers:[`Label`,`Name`,`Type`,`Required`,`Default/Placeholder`],rows:t.fields.map(e=>[e.label||e.name,e.name,e.type||`text`,e.required?`Yes`:`No`,e.placeholder||e.default||``])}}]},hydration:[`form`],supportedTransports:[`browser`]},Dn=[`mcp-app`,`browser`];function K(e){return typeof e==`object`&&!!e}function On(e){if(!Array.isArray(e))return;let t=e.flatMap(e=>!K(e)||typeof e.id!=`string`||typeof e.label!=`string`?[]:[{id:e.id,label:e.label}]);return t.length>0?t:void 0}function kn(e){return Array.isArray(e)?e.flatMap(e=>!K(e)||typeof e.id!=`string`||typeof e.label!=`string`?[]:[{id:e.id,label:e.label,category:typeof e.category==`string`?e.category:void 0,tags:Array.isArray(e.tags)?e.tags.filter(e=>typeof e==`string`):void 0}]):[]}function An(e){return K(e)?{categories:On(e.categories),items:kn(e.items)}:{items:[]}}function jn(e){return{title:e.label,body:e.id,description:e.tags&&e.tags.length>0?e.tags.join(`, `):void 0}}function Mn(e,t){return t.length===0?[]:[{type:`heading`,value:e},{type:`cards`,value:t.map(jn)}]}const Nn={id:`picker@1`,label:`Picker`,description:`Grouped item picker rendered as cards with picker hydration metadata.`,inputSchema:{type:`object`,properties:{categories:{type:`array`,items:{type:`object`,required:[`id`,`label`],properties:{id:{type:`string`},label:{type:`string`}},additionalProperties:!1}},items:{type:`array`,items:{type:`object`,required:[`id`,`label`],properties:{id:{type:`string`},label:{type:`string`},category:{type:`string`},tags:{type:`array`,items:{type:`string`}}},additionalProperties:!1}}},required:[`items`],additionalProperties:!1},defaultLayout:{},blocksFromData:e=>{let t=An(e),n=[];if(t.categories&&t.categories.length>0){let e=new Set(t.categories.map(e=>e.id)),r=[];for(let e of t.categories){let n=Mn(e.label,t.items.filter(t=>t.category===e.id));n.length>0&&r.push(n)}let i=Mn(`Other`,t.items.filter(t=>!t.category||!e.has(t.category)));return i.length>0&&r.push(i),n.push(...r.flatMap((e,t)=>t>0?[{type:`separator`},...e]:e)),n}return t.items.length>0&&n.push({type:`cards`,value:t.items.map(jn)}),n},hydration:[`picker`],supportedTransports:Dn},Pn=[`mcp-app`,`browser`,`export`];function q(e){return typeof e==`object`&&!!e}function Fn(e){return q(e)&&typeof e.type==`string`}function In(e){return Array.isArray(e)&&e.every(Fn)}function Ln(e){return q(e)&&typeof e.label==`string`&&(typeof e.value==`string`||typeof e.value==`number`)}function Rn(e){return Array.isArray(e)?e.flatMap(e=>{if(!q(e)||typeof e.heading!=`string`)return[];let t=typeof e.content==`string`||In(e.content)?e.content:``;return[{heading:e.heading,content:t}]}):[]}function zn(e){return Array.isArray(e)?e.flatMap(e=>q(e)?[{title:typeof e.title==`string`?e.title:void 0,value:e.value,headers:Array.isArray(e.headers)?e.headers.filter(e=>typeof e==`string`):void 0,rows:Array.isArray(e.rows)?e.rows.filter(e=>Array.isArray(e)):void 0}]:[]):[]}function Bn(e){let t=[{type:`heading`,value:e.heading}];return typeof e.content==`string`?(t.push({type:`paragraph`,value:e.content}),t):(t.push(...e.content),t)}function Vn(e){let t={type:`table`};return e.title&&(t.title=e.title),e.value!==void 0&&(t.value=e.value),e.headers&&(t.headers=e.headers),e.rows&&(t.rows=e.rows),t}const Hn={id:`report@1`,label:`Report`,description:`Static report with title, optional metrics, narrative sections, and tables.`,inputSchema:{type:`object`,properties:{title:{type:`string`},metrics:{type:`array`,items:{type:`object`,required:[`label`,`value`],properties:{label:{type:`string`},value:{type:[`string`,`number`]},trend:{type:[`string`,`number`]},status:{type:`string`}},additionalProperties:!1}},sections:{type:`array`,items:{type:`object`,required:[`heading`,`content`],properties:{heading:{type:`string`},content:{oneOf:[{type:`string`},{type:`array`,items:{type:`object`}}]}},additionalProperties:!1}},tables:{type:`array`,items:{type:`object`,properties:{title:{type:`string`},value:{},headers:{type:`array`,items:{type:`string`}},rows:{type:`array`,items:{type:`array`,items:{}}}},additionalProperties:!1}}},required:[`title`,`sections`],additionalProperties:!1},defaultLayout:{},blocksFromData:e=>{let t={title:q(e)&&typeof e.title==`string`?e.title:`Report`,metrics:q(e)&&Array.isArray(e.metrics)?e.metrics.filter(Ln):void 0,sections:q(e)?Rn(e.sections):[],tables:q(e)?zn(e.tables):void 0},n=[{type:`heading`,value:t.title}];t.metrics&&t.metrics.length>0&&n.push({type:`metrics`,value:t.metrics});for(let e of t.sections)n.push(...Bn(e));for(let e of t.tables??[])n.push(Vn(e));return n},hydration:[],supportedTransports:Pn},Un=[`mcp-app`,`browser`,`export`];function J(e){return typeof e==`object`&&!!e}function Wn(e){return Array.isArray(e)?e.flatMap(e=>{if(!J(e)||typeof e.category!=`string`||!Array.isArray(e.items))return[];let t=e.items.flatMap(e=>!J(e)||typeof e.label!=`string`||typeof e.status!=`string`?[]:[{label:e.label,status:e.status,badge:typeof e.badge==`string`?e.badge:void 0}]);return[{category:e.category,items:t}]}):[]}function Gn(e){return e.map(e=>({title:e.label,status:e.status,badge:e.badge}))}const Kn={id:`status-board@1`,label:`Status Board`,description:`Static status board grouped into category headings and card collections.`,inputSchema:{type:`object`,properties:{categories:{type:`array`,items:{type:`object`,required:[`category`,`items`],properties:{category:{type:`string`},items:{type:`array`,items:{type:`object`,required:[`label`,`status`],properties:{label:{type:`string`},status:{type:`string`},badge:{type:`string`}},additionalProperties:!1}}},additionalProperties:!1}}},required:[`categories`],additionalProperties:!1},defaultLayout:{},blocksFromData:e=>{let t=J(e)?Wn(e.categories):[],n=[];for(let e of t)n.push({type:`heading`,value:e.category}),n.push({type:`cards`,value:Gn(e.items)});return n},hydration:[],supportedTransports:Un},qn=[`mcp-app`,`browser`,`export`];function Jn(e){return typeof e==`object`&&!!e}function Yn(e){return Array.isArray(e)?e.flatMap(e=>!Jn(e)||typeof e.title!=`string`?[]:[{title:e.title,description:typeof e.description==`string`?e.description:void 0,timestamp:typeof e.timestamp==`string`?e.timestamp:void 0,status:typeof e.status==`string`?e.status:void 0}]):[]}function Xn(e){return Array.isArray(e)?{entries:Yn(e)}:Jn(e)?{entries:Yn(e.entries??e.events??e.items),title:typeof e.title==`string`?e.title:void 0}:{entries:[]}}const Y={type:`array`,items:{type:`object`,required:[`title`],properties:{title:{type:`string`},description:{type:`string`},timestamp:{type:`string`},status:{type:`string`}},additionalProperties:!1}},Zn={id:`timeline@1`,label:`Timeline`,description:`Static timeline events rendered as a timeline block.`,inputSchema:{oneOf:[Y,{type:`object`,properties:{title:{type:`string`},entries:Y,events:Y,items:Y},anyOf:[{required:[`entries`]},{required:[`events`]},{required:[`items`]}],additionalProperties:!1}]},defaultLayout:{},blocksFromData:e=>{let{entries:t,title:n}=Xn(e),r=[];return n&&r.push({type:`heading`,value:n}),r.push({type:`timeline`,value:t}),r},hydration:[],supportedTransports:qn},Qn=[`mcp-app`,`browser`,`export`];function X(e){return typeof e==`object`&&!!e}function $n(e){return X(e)&&typeof e.label==`string`}function er(e){return{name:e.label,children:Array.isArray(e.children)?e.children.filter($n).map(er):[]}}function tr(e){if(!X(e))return{};let t=e.root;return $n(t)?er(t):X(t)?t:e}const nr={id:`tree@1`,label:`Tree`,description:`Static tree view data with optional tree hydration metadata.`,inputSchema:{oneOf:[{type:`object`,properties:{root:{type:`object`}},required:[`root`],additionalProperties:!0},{type:`object`,additionalProperties:!0}]},defaultLayout:{},blocksFromData:e=>[{type:`tree`,value:tr(e)}],hydration:[`tree`],supportedTransports:Qn},Z=new R;Z.register(nn),Z.register(gn),Z.register(U),Z.register(Nn),Z.register(Hn),Z.register(Zn),Z.register(nr),Z.register(ln),Z.register(W),Z.register(En),Z.register(Kn);let Q=0;function rr(){return Q=(Q+1)%(2**53-1),`${Date.now().toString(16).padStart(12,`0`).slice(-12)}${Q.toString(16).padStart(4,`0`).slice(-4)}${Array.from({length:8},()=>Math.floor(Math.random()*256).toString(16).padStart(2,`0`)).join(``)}`}function ir(e){return{id:e,version:1,entry:`@aikit/blocks-interactive/dist/islands/${e}.mjs`,selector:`[data-island="${e}"]`,needsData:!0}}function ar(e,t){let n=new TextEncoder;return n.encode(e).byteLength+t.reduce((e,t)=>e+n.encode(t).byteLength,0)}function or(e,t){let n=[],r=t.registry??Z,i={colorScheme:e.colorScheme??t.colorScheme??`auto`,transport:t.transport,lang:e.lang,dir:e.dir},a=[...e.blocks??[]],o=[...a],s=[],c=[...e.actions??[]];if(e.template){let t=r.get(e.template);if(t)try{o=t.blocksFromData(e.data,i),o.length===0&&e.data!==void 0&&(n.push({level:`warn`,message:`Template "${e.template}" produced no blocks from provided data`}),o=[{type:`markdown`,value:`> ⚠️ Template \`${e.template}\` received data but produced no content. Verify the data structure matches the template schema.`}]),t.actionsFromData&&(c=[...c,...t.actionsFromData(e.data)]),s=t.hydration.map(e=>ir(e))}catch(t){let r=t instanceof Error?t.message:String(t);n.push({level:`error`,message:`Template ${e.template} failed: ${r}`}),o=a.length===0?W.blocksFromData({code:`TEMPLATE_RENDER_ERROR`,message:`Failed to render template ${e.template}`,details:r},i):[...a]}else n.push({level:`warn`,message:`Template not found: ${e.template}`})}let l=L(o,i),u=[A(o.map(e=>e.type))],d=t.nonce??rr(),f=e.metadata?.surfaceId??`surface-${d}`,p=s.length>0?JSON.stringify({data:e.data,blocks:o}):void 0,m=t.blockVendorScripts?[...new Set(o.flatMap(e=>t.blockVendorScripts?.[e.type]??[]))]:void 0;return{surfaceId:f,nonce:d,html:l,css:u,vendorScripts:m&&m.length>0?m:void 0,islands:s,actions:c,payload:p,estimatedBytes:ar(l,u),exportPolicy:s.length>0?`local-interactive`:`static-only`,diagnostics:n.length>0?n:void 0}}function sr(e){return e===`up`||e===`down`||e===`neutral`}function $(e){return typeof e==`object`&&!!e}function cr(e){return!$(e)||!Array.isArray(e.metrics)?{metrics:[]}:{metrics:e.metrics.flatMap(e=>{if(!$(e)||typeof e.label!=`string`||typeof e.value!=`string`&&typeof e.value!=`number`)return[];let t=$(e.trend)&&typeof e.trend.value==`string`&&sr(e.trend.direction)?{value:e.trend.value,direction:e.trend.direction}:void 0,n=Array.isArray(e.items)?e.items.flatMap(e=>!$(e)||typeof e.label!=`string`||typeof e.value!=`string`?[]:[{label:e.label,value:e.value}]):void 0;return[{id:typeof e.id==`string`?e.id:void 0,label:e.label,value:e.value,trend:t,status:e.status===`success`||e.status===`warning`||e.status===`error`||e.status===`info`?e.status:void 0,type:e.type===`progress`||e.type===`list`||e.type===`stat`?e.type:void 0,progress:typeof e.progress==`number`?gr(e.progress):void 0,items:n}]})}}function lr(e){let t=e.type===`progress`&&typeof e.progress==`number`?`${e.progress}%`:void 0;return{label:e.label,value:e.value,trend:e.trend?.value??t,status:e.status}}function ur(e){return e.type!==`progress`||typeof e.progress!=`number`?null:{label:e.label,value:gr(e.progress),max:100}}function dr(e){return $(e)?{columns:Array.isArray(e.columns)?e.columns.flatMap(e=>!$(e)||typeof e.id!=`string`||typeof e.label!=`string`?[]:[{id:e.id,label:e.label}]):[],cards:Array.isArray(e.cards)?e.cards.flatMap(e=>!$(e)||typeof e.id!=`string`||typeof e.title!=`string`||typeof e.column!=`string`?[]:[{id:e.id,title:e.title,description:typeof e.description==`string`?e.description:void 0,column:e.column,tags:Array.isArray(e.tags)?e.tags.filter(e=>typeof e==`string`):void 0,priority:e.priority===`high`||e.priority===`medium`||e.priority===`low`?e.priority:void 0}]):[]}:{columns:[],cards:[]}}function fr(e){return{title:e.title,description:e.description,badge:e.priority,body:e.tags?.join(`, `),status:e.priority}}function pr(e){return!$(e)||!Array.isArray(e.items)?[]:e.items.flatMap(e=>!$(e)||typeof e.id!=`string`||typeof e.label!=`string`?[]:[{id:e.id,label:e.label}])}function mr(e){return $(e)?{name:typeof e.name==`string`?e.name:``,total:typeof e.total==`number`?e.total:typeof e.value==`number`?e.value:0,self:typeof e.self==`number`?e.self:void 0,children:Array.isArray(e.children)?e.children.map(e=>mr(e)):[]}:{name:``,total:0,children:[]}}function hr(e){return{name:e.self==null?`${e.name} (${e.total})`:`${e.name} (${e.total} total / ${e.self} self)`,children:(e.children??[]).map(hr)}}function gr(e){return Math.max(0,Math.min(100,e))}function _r(e){let t=cr(e),n=[];t.metrics.length>0&&n.push({type:`metrics`,value:t.metrics.map(lr)});let r=t.metrics.map(ur).filter(e=>e!==null);r.length>0&&n.push({type:`progress`,value:r});for(let e of t.metrics)e.type===`list`&&e.items&&e.items.length>0&&(n.push({type:`heading`,value:e.label}),n.push({type:`table`,value:e.items}));return n}function vr(e){let t=dr(e),n=[];return t.columns.forEach((e,r)=>{r>0&&n.push({type:`separator`,value:``});let i=t.cards.filter(t=>t.column===e.id);n.push({type:`heading`,value:e.label}),n.push({type:`cards`,value:i.map(fr)})}),n}function yr(e){let t=pr(e);return t.length===0?[]:[{type:`cards`,value:t.map((e,t)=>({title:e.label,body:e.id,badge:`#${t+1}`}))}]}function br(e){return!$(e)||!$(e.profile)?[]:[{type:`tree`,value:hr(mr(e.profile))}]}const xr={id:`dashboard@1`,label:`Dashboard`,description:`Metric cards grid with optional charts.`,inputSchema:{type:`object`,properties:{metrics:{type:`array`,items:{type:`object`,required:[`label`,`value`],properties:{id:{type:`string`},label:{type:`string`},value:{type:[`string`,`number`]},trend:{type:`object`,properties:{value:{type:`string`},direction:{enum:[`up`,`down`,`neutral`]}},required:[`value`,`direction`],additionalProperties:!1},status:{enum:[`success`,`warning`,`error`,`info`]},type:{enum:[`stat`,`progress`,`list`]},progress:{type:`number`},items:{type:`array`,items:{type:`object`,required:[`label`,`value`],properties:{label:{type:`string`},value:{type:`string`}},additionalProperties:!1}}},additionalProperties:!1}}},required:[`metrics`],additionalProperties:!1},defaultLayout:{maxWidth:`1200px`},blocksFromData:e=>_r(e),hydration:[],supportedTransports:[`mcp-app`,`browser`]},Sr={id:`kanban@1`,label:`Kanban`,description:`Drag-and-drop task board grouped by columns.`,inputSchema:{type:`object`,properties:{columns:{type:`array`,items:{type:`object`,required:[`id`,`label`],properties:{id:{type:`string`},label:{type:`string`},color:{type:`string`}},additionalProperties:!1}},cards:{type:`array`,items:{type:`object`,required:[`id`,`title`,`column`],properties:{id:{type:`string`},title:{type:`string`},description:{type:`string`},column:{type:`string`},tags:{type:`array`,items:{type:`string`}},priority:{enum:[`high`,`medium`,`low`]}},additionalProperties:!1}}},required:[`columns`,`cards`],additionalProperties:!1},defaultLayout:{maxWidth:`1400px`},blocksFromData:e=>vr(e),hydration:[],supportedTransports:[`browser`]},Cr={id:`list-sort@1`,label:`Sortable List`,description:`Reorderable list of items with browser drag-and-drop interactions.`,inputSchema:{type:`object`,properties:{items:{type:`array`,items:{type:`object`,required:[`id`,`label`],properties:{id:{type:`string`},label:{type:`string`}},additionalProperties:!1}}},required:[`items`],additionalProperties:!1},defaultLayout:{maxWidth:`720px`},blocksFromData:e=>yr(e),hydration:[],supportedTransports:[`browser`]},wr={id:`flame-graph@1`,label:`Flame Graph`,description:`Hierarchical performance profile with interactive zoom state.`,inputSchema:{type:`object`,properties:{profile:{type:`object`}},required:[`profile`],additionalProperties:!1},defaultLayout:{maxWidth:`1200px`},blocksFromData:e=>br(e),hydration:[`flame-graph`],supportedTransports:[`browser`]},Tr={blockedClipboardMessage:`Image clipboard is blocked by this host or browser. Open in a browser that allows clipboard-write, then try again.`,clipboardSuccessMessage:`Copied image to clipboard.`,fallbackToServerCaptureMessage:`Client Copy as Image capture failed`};function Er(){return Tr}function Dr(e){return e.replace(/</g,`\\u003c`).replace(/>/g,`\\u003e`).replace(/&/g,`\\u0026`).replace(/\u2028/g,`\\u2028`).replace(/\u2029/g,`\\u2029`)}function Or(e,t){let n=[`
1789
1789
  * {
1790
1790
  box-sizing: border-box;
1791
1791
  }
@@ -1821,16 +1821,16 @@ main > * {
1821
1821
  }
1822
1822
  `,F,...(Array.isArray(t)?t:typeof t==`string`?[t]:[]).filter(e=>e.trim().length>0)].join(`
1823
1823
  `);return[` <style>${e}</style>`,` <style>${n}</style>`].join(`
1824
- `)}function Dr(e){let t=Object.entries(O).map(([e,t])=>` ${e}: ${t};`).join(`
1824
+ `)}function kr(e){let t=Object.entries(O).map(([e,t])=>` ${e}: ${t};`).join(`
1825
1825
  `);return[e,`html[data-theme="light"] {
1826
1826
  color-scheme: light;
1827
1827
  }`,`html[data-theme="dark"] {\n color-scheme: dark;\n${t}\n}`,`@media (prefers-color-scheme: dark) {\n html:not([data-theme]) {\n color-scheme: dark;\n${t}\n }\n}`].join(`
1828
1828
 
1829
- `)}function Or(e){return e.length===0?``:e.map(e=>{let t=e.initScript?` <script>\n${e.initScript}\n <\/script>\n`:``;if(e.inlineSource)return`${t} <script>${e.inlineSource.replace(/<\/script/gi,`<\\/script`)}${e.onload?`\n;${e.onload}`:``}<\/script>`;if(!e.src)return t.trimEnd();let r=e.onload?` onload="${e.onload}"`:``;if(!e.fallback)return`${t} <script src="${n(e.src)}"${r}><\/script>`;let i=e.onload?`f.onload=function(){${e.onload}};`:``;return`${t} <script src="${n(e.src)}"${r} onerror="(function(el){var f=document.createElement('script');f.src='${n(e.fallback)}';${i}document.head.appendChild(f);el.remove()})(this)"><\/script>`}).join(`
1830
- `)}function kr(e){let t=JSON.stringify(e),n=Ar(),r=jr();return[` <script>`,` (() => {`,` const preferredTheme = ${t};`,` const storageKey = "aikit-theme-mode";`,` const html = document.documentElement;`,` const toolbox = {`,` container: () => document.querySelector(".aikit-toolbox"),`,` button: () => document.querySelector(".aikit-toolbox-toggle"),`,` menu: () => document.querySelector(".aikit-toolbox-menu"),`,` firstItem: () => document.querySelector(".aikit-toolbox-item"),`,` };`,` const systemTheme = () =>`,` window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches`,` ? "dark"`,` : "light";`,` const readStoredTheme = () => {`,` try {`,` const stored = localStorage.getItem("aikit-theme-mode");`,` return stored === "light" || stored === "dark" ? stored : null;`,` } catch (_error) {`,` return null;`,` }`,` };`,` const resolvedTheme = () => html.getAttribute("data-theme") || readStoredTheme() || systemTheme();`,` const setToolboxOpen = (open, options = {}) => {`,` const button = toolbox.button();`,` const menu = toolbox.menu();`,` if (!button || !menu) return;`,` menu.hidden = !open;`,` button.setAttribute("aria-expanded", String(open));`,` if (open) {`,` if (options.focusItem) toolbox.firstItem()?.focus();`,` } else if (options.restoreFocus) {`,` button.focus();`,` }`,` };`,` const inlineComputedStyles = (source, clone) => {`,` if (!(source instanceof Element) || !(clone instanceof Element)) return;`,` const computed = window.getComputedStyle(source);`,` const cssText = Array.from(computed)`,` .map((name) => {`,` const value = computed.getPropertyValue(name);`,` const priority = computed.getPropertyPriority(name);`,' return `${name}:${value}${priority ? " !important" : ""};`;',` })`,` .join("");`,` clone.setAttribute("style", cssText);`,` for (let index = 0; index < source.children.length; index += 1) {`,` inlineComputedStyles(source.children[index], clone.children[index]);`,` }`,` };`,n,` const updateToggle = (theme) => {`,` const button = document.querySelector(".aikit-theme-toggle");`,` const nextTheme = theme === "dark" ? "light" : "dark";`,` if (button) {`,` button.setAttribute("aria-label", "Switch to " + nextTheme + " theme");`,` button.setAttribute("aria-pressed", String(theme === "dark"));`,` }`,` };`,` const applyTheme = (theme, persist = true) => {`,` html.setAttribute("data-theme", theme);`,` if (persist) {`,` try {`,` localStorage.setItem("aikit-theme-mode", theme);`,` } catch (_error) {`,` // Ignore storage failures.`,` }`,` }`,` updateToggle(theme);`,` };`,` if (preferredTheme === "light" || preferredTheme === "dark") {`,` applyTheme(preferredTheme, false);`,` } else {`,` applyTheme(readStoredTheme() || systemTheme(), false);`,` }`,` window.toggleTheme = () => {`,` applyTheme(resolvedTheme() === "dark" ? "light" : "dark");`,` };`,r,` document.addEventListener("click", (event) => {`,` const container = toolbox.container();`,` if (!container) return;`,` const target = event.target;`,` if (target instanceof Node && container.contains(target)) return;`,` setToolboxOpen(false);`,` });`,` document.addEventListener("keydown", (event) => {`,` if (event.key === "Escape") {`,` setToolboxOpen(false, { restoreFocus: true });`,` return;`,` }`,` if ((event.key === "ArrowDown" || event.key === "Enter" || event.key === " ") && event.target === toolbox.button()) {`,` event.preventDefault();`,` setToolboxOpen(true, { focusItem: true });`,` }`,` });`,` if (preferredTheme === "auto" && window.matchMedia) {`,` const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");`,` mediaQuery.addEventListener("change", () => {`,` if (readStoredTheme()) return;`,` applyTheme(systemTheme(), false);`,` });`,` }`,` })();`,` <\/script>`].join(`
1831
- `)}function Ar(){return[` const captureDocumentAsPng = async () => {`,` const width = Math.max(`,` document.documentElement.scrollWidth,`,` document.documentElement.clientWidth,`,` document.body ? document.body.scrollWidth : 0,`,` );`,` const height = Math.max(`,` document.documentElement.scrollHeight,`,` document.documentElement.clientHeight,`,` document.body ? document.body.scrollHeight : 0,`,` );`,` const scale = window.devicePixelRatio || 1;`,` const canvas = document.createElement("canvas");`,` canvas.width = Math.max(1, Math.ceil(width * scale));`,` canvas.height = Math.max(1, Math.ceil(height * scale));`,` const context = canvas.getContext("2d");`,` if (!context) throw new Error("Canvas context unavailable");`,` context.scale(scale, scale);`,` const clone = document.documentElement.cloneNode(true);`,` if (!(clone instanceof Element)) throw new Error("Document clone failed");`,` clone.setAttribute("xmlns", "http://www.w3.org/1999/xhtml");`,` clone.querySelectorAll("script").forEach((node) => node.remove());`,` inlineComputedStyles(document.documentElement, clone);`,' const svgMarkup = [`<svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="${height}" viewBox="0 0 ${width} ${height}">`, `<foreignObject width="100%" height="100%">${new XMLSerializer().serializeToString(clone)}</foreignObject>`, "</svg>"].join("");',` const svgBlob = new Blob([svgMarkup], { type: "image/svg+xml;charset=utf-8" });`,` const objectUrl = URL.createObjectURL(svgBlob);`,` try {`,` await new Promise((resolve, reject) => {`,` const image = new Image();`,` image.onload = () => {`,` context.drawImage(image, 0, 0, width, height);`,` resolve(undefined);`,` };`,` image.onerror = () => reject(new Error("ForeignObject render failed"));`,` image.src = objectUrl;`,` });`,` } finally {`,` URL.revokeObjectURL(objectUrl);`,` }`,` const blob = await new Promise((resolve) => canvas.toBlob(resolve, "image/png"));`,` if (!blob || blob.type !== "image/png") throw new Error("PNG export failed");`,` return blob;`,` };`,` const captureServerPng = async () => {`,` const response = await fetch("/__aikit_screenshot.png", { cache: "no-store" });`,` if (!response.ok) throw new Error("Server PNG capture unavailable");`,` const blob = await response.blob();`,` if (!blob || blob.type !== "image/png") throw new Error("Server PNG capture failed");`,` return blob;`,` };`,` const showCopyStatus = (message, tone = "info") => {`,` let status = document.querySelector(".aikit-copy-status");`,` if (!status) {`,` status = document.createElement("div");`,` status.className = "aikit-copy-status";`,` status.setAttribute("role", "status");`,` status.setAttribute("aria-live", "polite");`,` document.body.appendChild(status);`,` }`,` status.dataset.tone = tone;`,` status.textContent = message;`,` window.clearTimeout(status.__aikitCopyTimer);`,` status.__aikitCopyTimer = window.setTimeout(() => { status.remove(); }, 4000);`,` };`,` const blobToDataUrl = (blob) =>`,` new Promise((resolve, reject) => {`,` const reader = new FileReader();`,` reader.onload = () => resolve(String(reader.result));`,` reader.onerror = () => reject(reader.error || new Error("Image conversion failed"));`,` reader.readAsDataURL(blob);`,` });`,` const copyImageWithLegacyClipboard = async (blob) => {`,` const dataUrl = await blobToDataUrl(blob);`,` let copied = false;`,` const onCopy = (event) => {`,` const data = event.clipboardData;`,` if (!data) return;`,` event.preventDefault();`,` try {`,` if (data.items && typeof File !== "undefined") {`,` data.items.add(new File([blob], "aikit-present.png", { type: "image/png" }));`,` copied = true;`,` }`,` } catch (_error) {`,` // Some hosts reject binary clipboard items in copy events; keep the HTML fallback below.`,` }`,' data.setData("text/html", `<img alt="AI Kit Present" src="${dataUrl}">`);',` data.setData("text/plain", "AI Kit Present image");`,` copied = true;`,` };`,` document.addEventListener("copy", onCopy, { once: true });`,` try {`,` copied = document.execCommand("copy") || copied;`,` } finally {`,` document.removeEventListener("copy", onCopy);`,` }`,` if (!copied) throw new Error("Legacy clipboard copy unavailable");`,` };`,` const writeImageToClipboard = async (blob) => {`,` try {`,` if (!navigator.clipboard?.write || typeof ClipboardItem === "undefined") {`,` throw new Error("Async image clipboard is unavailable in this host.");`,` }`,` await navigator.clipboard.write([new ClipboardItem({ "image/png": blob })]);`,` } catch (clipboardError) {`,` console.warn("Async Clipboard image write failed", clipboardError);`,` await copyImageWithLegacyClipboard(blob);`,` }`,` };`].join(`
1832
- `)}function jr(){return[` window.toggleToolbox = () => {`,` const menu = toolbox.menu();`,` setToolboxOpen(Boolean(menu?.hidden), { focusItem: Boolean(menu?.hidden) });`,` };`,` window.screenshotPage = async () => {`,` const scrollX = window.scrollX;`,` const scrollY = window.scrollY;`,` setToolboxOpen(false);`,` window.scrollTo(0, 0);`,` await new Promise((resolve) => window.requestAnimationFrame(() => resolve(undefined)));`,` try {`,` let blob;`,` try {`,` blob = await captureDocumentAsPng();`,` } catch (captureError) {`,` console.warn("Client Copy as Image capture failed", captureError);`,` blob = await captureServerPng();`,` }`,` await writeImageToClipboard(blob);`,` showCopyStatus("Copied image to clipboard.");`,` } catch (_error) {`,` console.warn("Copy as Image failed", _error);`,` showCopyStatus("Image clipboard is blocked by this host or browser. Open in a browser that allows clipboard-write, then try again.", "error");`,` } finally {`,` window.scrollTo(scrollX, scrollY);`,` }`,` };`].join(`
1833
- `)}function Mr(e,t){if(t!==`local-interactive`)return``;let r=new Set,i=[];for(let t of e)r.has(t.entry)||(r.add(t.entry),i.push(` <script type="module" src="${n(t.entry)}"><\/script>`));return i.length>0&&i.push(` <script type="module">`,` import { hydrateAsync } from "/@aikit/blocks-interactive/dist/index.mjs";`,` const boot = () => {`,` void hydrateAsync();`,` };`,` if (document.readyState === "loading") {`,` document.addEventListener("DOMContentLoaded", boot, { once: true });`,` } else {`,` boot();`,` }`,` <\/script>`),i.join(`
1834
- `)}function Nr(e){let t=n(e.lang??`en`),r=n(e.dir??`ltr`),i=e.colorScheme??`auto`,a=e.generatedAt??new Date().toISOString(),o=[`lang="${t}"`,`dir="${r}"`];i!==`auto`&&o.push(`data-theme="${i}"`);let s=Dr(e.tokenCss??qt(`light`)),c=Or(e.headScripts??[]),l=e.islands.length>0&&e.payload?` <script type="application/json" id="surface-payload">${Tr(e.payload)}<\/script>`:``,u=Mr(e.islands,e.exportPolicy),d=[kr(i),l,u].filter(Boolean).join(`
1835
- `);return[`<!DOCTYPE html>`,`<html ${o.join(` `)}>`,`<head>`,` <meta charset="utf-8">`,` <meta name="viewport" content="width=device-width, initial-scale=1">`,` <title>${n(e.title)}</title>`,Er(s,e.css),c,`</head>`,`<body data-surface-nonce="${n(e.nonce)}">`,N({title:e.title,subtitle:e.subtitle,transport:e.transport,actionsHtml:e.headerActionsHtml}),` <main>${e.html}</main>`,P({generatedAt:a,contentHtml:e.footerContentHtml}),d,`</body>`,`</html>`].filter(Boolean).join(`
1836
- `)}export{j as HEADER_CLASS_NAMES,F as HEADER_CSS,R as TemplateRegistry,Ht as allCss,Vt as baseCss,f as blockItems,P as buildFooter,N as buildHeader,Nr as buildShell,nn as checklistTemplate,A as collectCss,Bt as darkTokenNames,O as darkTokens,xr as dashboardTemplateDefinition,V as dataTableTemplate,Z as defaultRegistry,hn as diffViewTemplate,xn as documentTemplate,W as errorTemplate,n as escapeHtml,wr as flameGraphTemplateDefinition,En as formTemplate,a as formatValue,Kt as generateDarkTokenCss,qt as generateTokenCss,s as inlineMarkdown,t as isError,e as isResult,Sr as kanbanTemplateDefinition,Cr as listSortTemplateDefinition,Nn as pickerTemplate,I as renderBlock,L as renderBlocks,or as renderSurface,Hn as reportTemplate,i as sanitizeId,r as sanitizeUrl,Kn as statusBoardTemplate,Zn as timelineTemplate,zt as tokenNames,D as tokens,u as toneName,d as toneVar,nr as treeTemplate,o as tryParseJson};
1829
+ `)}function Ar(e){return e.length===0?``:e.map(e=>{let t=e.initScript?` <script>\n${e.initScript}\n <\/script>\n`:``;if(e.inlineSource)return`${t} <script>${e.inlineSource.replace(/<\/script/gi,`<\\/script`)}${e.onload?`\n;${e.onload}`:``}<\/script>`;if(!e.src)return t.trimEnd();let r=e.onload?` onload="${e.onload}"`:``;if(!e.fallback)return`${t} <script src="${n(e.src)}"${r}><\/script>`;let i=e.onload?`f.onload=function(){${e.onload}};`:``;return`${t} <script src="${n(e.src)}"${r} onerror="(function(el){var f=document.createElement('script');f.src='${n(e.fallback)}';${i}document.head.appendChild(f);el.remove()})(this)"><\/script>`}).join(`
1830
+ `)}function jr(e){let t=JSON.stringify(e),n=Mr(),r=Nr(Er());return[` <script>`,` (() => {`,` const preferredTheme = ${t};`,` const storageKey = "aikit-theme-mode";`,` const html = document.documentElement;`,` const toolbox = {`,` container: () => document.querySelector(".aikit-toolbox"),`,` button: () => document.querySelector(".aikit-toolbox-toggle"),`,` menu: () => document.querySelector(".aikit-toolbox-menu"),`,` firstItem: () => document.querySelector(".aikit-toolbox-item"),`,` };`,` const systemTheme = () =>`,` window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches`,` ? "dark"`,` : "light";`,` const readStoredTheme = () => {`,` try {`,` const stored = localStorage.getItem("aikit-theme-mode");`,` return stored === "light" || stored === "dark" ? stored : null;`,` } catch (_error) {`,` return null;`,` }`,` };`,` const resolvedTheme = () => html.getAttribute("data-theme") || readStoredTheme() || systemTheme();`,` const setToolboxOpen = (open, options = {}) => {`,` const button = toolbox.button();`,` const menu = toolbox.menu();`,` if (!button || !menu) return;`,` menu.hidden = !open;`,` button.setAttribute("aria-expanded", String(open));`,` if (open) {`,` if (options.focusItem) toolbox.firstItem()?.focus();`,` } else if (options.restoreFocus) {`,` button.focus();`,` }`,` };`,` const inlineComputedStyles = (source, clone) => {`,` if (!(source instanceof Element) || !(clone instanceof Element)) return;`,` const computed = window.getComputedStyle(source);`,` const cssText = Array.from(computed)`,` .map((name) => {`,` const value = computed.getPropertyValue(name);`,` const priority = computed.getPropertyPriority(name);`,' return `${name}:${value}${priority ? " !important" : ""};`;',` })`,` .join("");`,` clone.setAttribute("style", cssText);`,` for (let index = 0; index < source.children.length; index += 1) {`,` inlineComputedStyles(source.children[index], clone.children[index]);`,` }`,` };`,n,` const updateToggle = (theme) => {`,` const button = document.querySelector(".aikit-theme-toggle");`,` const nextTheme = theme === "dark" ? "light" : "dark";`,` if (button) {`,` button.setAttribute("aria-label", "Switch to " + nextTheme + " theme");`,` button.setAttribute("aria-pressed", String(theme === "dark"));`,` }`,` };`,` const applyTheme = (theme, persist = true) => {`,` html.setAttribute("data-theme", theme);`,` if (persist) {`,` try {`,` localStorage.setItem("aikit-theme-mode", theme);`,` } catch (_error) {`,` // Ignore storage failures.`,` }`,` }`,` updateToggle(theme);`,` };`,` if (preferredTheme === "light" || preferredTheme === "dark") {`,` applyTheme(preferredTheme, false);`,` } else {`,` applyTheme(readStoredTheme() || systemTheme(), false);`,` }`,` window.toggleTheme = () => {`,` applyTheme(resolvedTheme() === "dark" ? "light" : "dark");`,` };`,r,` document.addEventListener("click", (event) => {`,` const container = toolbox.container();`,` if (!container) return;`,` const target = event.target;`,` if (target instanceof Node && container.contains(target)) return;`,` setToolboxOpen(false);`,` });`,` document.addEventListener("keydown", (event) => {`,` if (event.key === "Escape") {`,` setToolboxOpen(false, { restoreFocus: true });`,` return;`,` }`,` if ((event.key === "ArrowDown" || event.key === "Enter" || event.key === " ") && event.target === toolbox.button()) {`,` event.preventDefault();`,` setToolboxOpen(true, { focusItem: true });`,` }`,` });`,` if (preferredTheme === "auto" && window.matchMedia) {`,` const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");`,` mediaQuery.addEventListener("change", () => {`,` if (readStoredTheme()) return;`,` applyTheme(systemTheme(), false);`,` });`,` }`,` })();`,` <\/script>`].join(`
1831
+ `)}function Mr(){return[` const captureDocumentAsPng = async () => {`,` const width = Math.max(`,` document.documentElement.scrollWidth,`,` document.documentElement.clientWidth,`,` document.body ? document.body.scrollWidth : 0,`,` );`,` const height = Math.max(`,` document.documentElement.scrollHeight,`,` document.documentElement.clientHeight,`,` document.body ? document.body.scrollHeight : 0,`,` );`,` const scale = window.devicePixelRatio || 1;`,` const canvas = document.createElement("canvas");`,` canvas.width = Math.max(1, Math.ceil(width * scale));`,` canvas.height = Math.max(1, Math.ceil(height * scale));`,` const context = canvas.getContext("2d");`,` if (!context) throw new Error("Canvas context unavailable");`,` context.scale(scale, scale);`,` const clone = document.documentElement.cloneNode(true);`,` if (!(clone instanceof Element)) throw new Error("Document clone failed");`,` clone.setAttribute("xmlns", "http://www.w3.org/1999/xhtml");`,` clone.querySelectorAll("script").forEach((node) => node.remove());`,` inlineComputedStyles(document.documentElement, clone);`,' const svgMarkup = [`<svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="${height}" viewBox="0 0 ${width} ${height}">`, `<foreignObject width="100%" height="100%">${new XMLSerializer().serializeToString(clone)}</foreignObject>`, "</svg>"].join("");',` const svgBlob = new Blob([svgMarkup], { type: "image/svg+xml;charset=utf-8" });`,` const objectUrl = URL.createObjectURL(svgBlob);`,` try {`,` await new Promise((resolve, reject) => {`,` const image = new Image();`,` image.onload = () => {`,` context.drawImage(image, 0, 0, width, height);`,` resolve(undefined);`,` };`,` image.onerror = () => reject(new Error("ForeignObject render failed"));`,` image.src = objectUrl;`,` });`,` } finally {`,` URL.revokeObjectURL(objectUrl);`,` }`,` const blob = await new Promise((resolve) => canvas.toBlob(resolve, "image/png"));`,` if (!blob || blob.type !== "image/png") throw new Error("PNG export failed");`,` return blob;`,` };`,` const captureServerPng = async () => {`,` const response = await fetch("/__aikit_screenshot.png", { cache: "no-store" });`,` if (!response.ok) throw new Error("Server PNG capture unavailable");`,` const blob = await response.blob();`,` if (!blob || blob.type !== "image/png") throw new Error("Server PNG capture failed");`,` return blob;`,` };`,` const showCopyStatus = (message, tone = "info") => {`,` let status = document.querySelector(".aikit-copy-status");`,` if (!status) {`,` status = document.createElement("div");`,` status.className = "aikit-copy-status";`,` status.setAttribute("role", "status");`,` status.setAttribute("aria-live", "polite");`,` document.body.appendChild(status);`,` }`,` status.dataset.tone = tone;`,` status.textContent = message;`,` window.clearTimeout(status.__aikitCopyTimer);`,` status.__aikitCopyTimer = window.setTimeout(() => { status.remove(); }, 4000);`,` };`,` const blobToDataUrl = (blob) =>`,` new Promise((resolve, reject) => {`,` const reader = new FileReader();`,` reader.onload = () => resolve(String(reader.result));`,` reader.onerror = () => reject(reader.error || new Error("Image conversion failed"));`,` reader.readAsDataURL(blob);`,` });`,` const copyImageWithLegacyClipboard = async (blob) => {`,` const dataUrl = await blobToDataUrl(blob);`,` let copied = false;`,` const onCopy = (event) => {`,` const data = event.clipboardData;`,` if (!data) return;`,` event.preventDefault();`,` try {`,` if (data.items && typeof File !== "undefined") {`,` data.items.add(new File([blob], "aikit-present.png", { type: "image/png" }));`,` copied = true;`,` }`,` } catch (_error) {`,` // Some hosts reject binary clipboard items in copy events; keep the HTML fallback below.`,` }`,' data.setData("text/html", `<img alt="AI Kit Present" src="${dataUrl}">`);',` data.setData("text/plain", "AI Kit Present image");`,` copied = true;`,` };`,` document.addEventListener("copy", onCopy, { once: true });`,` try {`,` copied = document.execCommand("copy") || copied;`,` } finally {`,` document.removeEventListener("copy", onCopy);`,` }`,` if (!copied) throw new Error("Legacy clipboard copy unavailable");`,` };`,` const writeImageToClipboard = async (blob) => {`,` try {`,` if (!navigator.clipboard?.write || typeof ClipboardItem === "undefined") {`,` throw new Error("Async image clipboard is unavailable in this host.");`,` }`,` await navigator.clipboard.write([new ClipboardItem({ "image/png": blob })]);`,` } catch (clipboardError) {`,` console.warn("Async Clipboard image write failed", clipboardError);`,` await copyImageWithLegacyClipboard(blob);`,` }`,` };`].join(`
1832
+ `)}function Nr(e){return[` window.toggleToolbox = () => {`,` const menu = toolbox.menu();`,` setToolboxOpen(Boolean(menu?.hidden), { focusItem: Boolean(menu?.hidden) });`,` };`,` window.screenshotPage = async () => {`,` const scrollX = window.scrollX;`,` const scrollY = window.scrollY;`,` setToolboxOpen(false);`,` window.scrollTo(0, 0);`,` await new Promise((resolve) => window.requestAnimationFrame(() => resolve(undefined)));`,` try {`,` let blob;`,` try {`,` blob = await captureDocumentAsPng();`,` } catch (captureError) {`,` console.warn(${JSON.stringify(e.fallbackToServerCaptureMessage)}, captureError);`,` blob = await captureServerPng();`,` }`,` await writeImageToClipboard(blob);`,` showCopyStatus(${JSON.stringify(e.clipboardSuccessMessage)});`,` } catch (_error) {`,` console.warn("Copy as Image failed", _error);`,` showCopyStatus(${JSON.stringify(e.blockedClipboardMessage)}, "error");`,` } finally {`,` window.scrollTo(scrollX, scrollY);`,` }`,` };`].join(`
1833
+ `)}function Pr(e,t){if(t!==`local-interactive`)return``;let r=new Set,i=[];for(let t of e)r.has(t.entry)||(r.add(t.entry),i.push(` <script type="module" src="${n(t.entry)}"><\/script>`));return i.length>0&&i.push(` <script type="module">`,` import { hydrateAsync } from "/@aikit/blocks-interactive/dist/index.mjs";`,` const boot = () => {`,` void hydrateAsync();`,` };`,` if (document.readyState === "loading") {`,` document.addEventListener("DOMContentLoaded", boot, { once: true });`,` } else {`,` boot();`,` }`,` <\/script>`),i.join(`
1834
+ `)}function Fr(e){let t=n(e.lang??`en`),r=n(e.dir??`ltr`),i=e.colorScheme??`auto`,a=e.generatedAt??new Date().toISOString(),o=[`lang="${t}"`,`dir="${r}"`];i!==`auto`&&o.push(`data-theme="${i}"`);let s=kr(e.tokenCss??qt(`light`)),c=Ar(e.headScripts??[]),l=e.islands.length>0&&e.payload?` <script type="application/json" id="surface-payload">${Dr(e.payload)}<\/script>`:``,u=Pr(e.islands,e.exportPolicy),d=[jr(i),l,u].filter(Boolean).join(`
1835
+ `);return[`<!DOCTYPE html>`,`<html ${o.join(` `)}>`,`<head>`,` <meta charset="utf-8">`,` <meta name="viewport" content="width=device-width, initial-scale=1">`,` <title>${n(e.title)}</title>`,Or(s,e.css),c,`</head>`,`<body data-surface-nonce="${n(e.nonce)}">`,N({title:e.title,subtitle:e.subtitle,transport:e.transport,actionsHtml:e.headerActionsHtml}),` <main>${e.html}</main>`,P({generatedAt:a,contentHtml:e.footerContentHtml}),d,`</body>`,`</html>`].filter(Boolean).join(`
1836
+ `)}export{j as HEADER_CLASS_NAMES,F as HEADER_CSS,R as TemplateRegistry,Ht as allCss,Vt as baseCss,f as blockItems,Er as buildCopyImageExportFallback,P as buildFooter,N as buildHeader,Fr as buildShell,nn as checklistTemplate,A as collectCss,Bt as darkTokenNames,O as darkTokens,xr as dashboardTemplateDefinition,ln as dataTableTemplate,Z as defaultRegistry,gn as diffViewTemplate,U as documentTemplate,W as errorTemplate,n as escapeHtml,wr as flameGraphTemplateDefinition,En as formTemplate,a as formatValue,Kt as generateDarkTokenCss,qt as generateTokenCss,s as inlineMarkdown,t as isError,e as isResult,Sr as kanbanTemplateDefinition,Cr as listSortTemplateDefinition,Nn as pickerTemplate,I as renderBlock,L as renderBlocks,or as renderSurface,Hn as reportTemplate,i as sanitizeId,r as sanitizeUrl,Kn as statusBoardTemplate,Zn as timelineTemplate,zt as tokenNames,D as tokens,u as toneName,d as toneVar,nr as treeTemplate,o as tryParseJson};
@@ -1,4 +1,4 @@
1
- import{d as e,f as t,i as n,m as r,p as i,s as a,u as o}from"./scaffold-BnhmnBfn.js";import{A as s,C as c,D as l,E as u,M as d,N as f,O as p,S as ee,T as m,_ as h,a as g,b as _,c as v,d as y,f as b,g as te,h as ne,i as x,j as S,k as C,l as w,m as T,n as re,o as ie,p as ae,r as oe,s as se,t as ce,u as E,v as D,w as O,x as le,y as ue}from"./templates-guQ2153Z.js";import{copyFileSync as de,existsSync as k,mkdirSync as A,readFileSync as j,readdirSync as M,rmSync as fe,unlinkSync as pe,writeFileSync as N}from"node:fs";import{basename as me,dirname as P,join as F,posix as I,relative as he,resolve as L,win32 as R}from"node:path";import{fileURLToPath as ge}from"node:url";import{addToWorkset as _e,audit as ve,check as ye,checkpointLatest as be,checkpointList as xe,checkpointLoad as Se,checkpointSave as Ce,codemod as we,compact as Te,dataTransform as Ee,delegate as De,delegateListModels as Oe,deleteWorkset as ke,diffParse as Ae,evaluate as je,fileSummary as Me,find as Ne,findDeadSymbols as Pe,findExamples as Fe,getWorkset as Ie,gitContext as Le,graphQuery as Re,guide as ze,health as Be,laneCreate as Ve,laneDiff as He,laneDiscard as Ue,laneList as We,laneMerge as Ge,laneStatus as Ke,listWorksets as qe,parseOutput as Je,processList as Ye,processLogs as Xe,processStart as Ze,processStatus as Qe,processStop as $e,queueClear as et,queueCreate as tt,queueDelete as nt,queueDone as rt,queueFail as it,queueGet as at,queueList as ot,queueNext as st,queuePush as ct,removeFromWorkset as lt,rename as ut,replayClear as dt,replayList as ft,replayTrim as pt,saveWorkset as mt,scopeMap as ht,stashClear as gt,stashDelete as _t,stashGet as vt,stashList as yt,stashSet as bt,symbol as xt,testRun as St,trace as Ct,watchList as wt,watchStart as Tt,watchStop as Et}from"../../tools/dist/index.js";import{mkdir as Dt,readFile as z,rename as Ot,unlink as kt,writeFile as At}from"node:fs/promises";import{SqliteGraphStore as jt,createSqliteAdapter as Mt,createStore as Nt}from"../../store/dist/index.js";import{randomUUID as Pt}from"node:crypto";import{homedir as B}from"node:os";import{execFileSync as Ft,fork as It}from"node:child_process";import{AIKIT_PATHS as V,EMBEDDING_DEFAULTS as Lt,getGlobalDataDir as Rt,getPartitionDir as H,isUserInstalled as zt,registerWorkspace as Bt,saveRegistry as Vt}from"../../core/dist/index.js";import{initializeWasm as Ht}from"../../chunker/dist/index.js";import{OnnxEmbedder as Ut}from"../../embeddings/dist/index.js";import{IncrementalIndexer as Wt}from"../../indexer/dist/index.js";const Gt=[{name:`analyze`,description:`Run analyzer output for a path`,usage:`aikit analyze <type> <path>`,run:async e=>{let t=e.shift()?.trim()??``,n=e.shift()?.trim()??``;(!t||!n)&&(console.error(`Usage: aikit analyze <type> <path>`),console.error(`Types: structure, deps, symbols, patterns, entry-points, blast-radius, diagram`),process.exit(1));let{BlastRadiusAnalyzer:r,DependencyAnalyzer:i,DiagramGenerator:a,EntryPointAnalyzer:o,PatternAnalyzer:s,StructureAnalyzer:c,SymbolAnalyzer:l}=await import(`../../analyzers/dist/index.js`),u=L(n),d;switch(t){case`structure`:d=await new c().analyze(u,{format:`markdown`});break;case`deps`:case`dependencies`:d=await new i().analyze(u,{format:`markdown`});break;case`symbols`:d=await new l().analyze(u,{format:`markdown`});break;case`patterns`:d=await new s().analyze(u,{format:`markdown`});break;case`entry-points`:d=await new o().analyze(u,{format:`markdown`});break;case`blast-radius`:d=await new r().analyze(process.cwd(),{files:[n],format:`markdown`});break;case`diagram`:d=await new a().analyze(u,{diagramType:`architecture`});break;default:console.error(`Unknown analyze type: ${t}`),console.error(`Types: structure, deps, symbols, patterns, entry-points, blast-radius, diagram`),process.exit(1)}console.log(d.output)}},{name:`onboard`,description:`Run all analyses for first-time codebase onboarding`,usage:`aikit onboard <path> [--generate] [--out-dir <dir>]`,run:async e=>{let{onboard:t}=await import(`../../tools/dist/index.js`),{loadConfig:n}=await Promise.resolve().then(()=>Kn),r=``,i=`memory`,a;for(let t=0;t<e.length;t++){let n=e[t].trim();n===`--generate`?i=`generate`:n===`--out-dir`&&t+1<e.length?a=e[++t].trim():n.startsWith(`--`)||(r=n)}r||=process.cwd();let o=L(r),s=n();console.log(`Onboarding: ${o} (mode: ${i})`),console.log(`Running analyses...
1
+ import{d as e,f as t,i as n,m as r,p as i,s as a,u as o}from"./scaffold-BnhmnBfn.js";import{A as s,C as c,D as l,E as u,M as d,N as f,O as p,S as ee,T as m,_ as h,a as g,b as _,c as v,d as y,f as b,g as te,h as ne,i as x,j as S,k as C,l as w,m as T,n as re,o as ie,p as ae,r as oe,s as se,t as ce,u as E,v as D,w as O,x as le,y as ue}from"./templates-CdHbXhGF.js";import{copyFileSync as de,existsSync as k,mkdirSync as A,readFileSync as j,readdirSync as M,rmSync as fe,unlinkSync as pe,writeFileSync as N}from"node:fs";import{basename as me,dirname as P,join as F,posix as I,relative as he,resolve as L,win32 as R}from"node:path";import{fileURLToPath as ge}from"node:url";import{addToWorkset as _e,audit as ve,check as ye,checkpointLatest as be,checkpointList as xe,checkpointLoad as Se,checkpointSave as Ce,codemod as we,compact as Te,dataTransform as Ee,delegate as De,delegateListModels as Oe,deleteWorkset as ke,diffParse as Ae,evaluate as je,fileSummary as Me,find as Ne,findDeadSymbols as Pe,findExamples as Fe,getWorkset as Ie,gitContext as Le,graphQuery as Re,guide as ze,health as Be,laneCreate as Ve,laneDiff as He,laneDiscard as Ue,laneList as We,laneMerge as Ge,laneStatus as Ke,listWorksets as qe,parseOutput as Je,processList as Ye,processLogs as Xe,processStart as Ze,processStatus as Qe,processStop as $e,queueClear as et,queueCreate as tt,queueDelete as nt,queueDone as rt,queueFail as it,queueGet as at,queueList as ot,queueNext as st,queuePush as ct,removeFromWorkset as lt,rename as ut,replayClear as dt,replayList as ft,replayTrim as pt,saveWorkset as mt,scopeMap as ht,stashClear as gt,stashDelete as _t,stashGet as vt,stashList as yt,stashSet as bt,symbol as xt,testRun as St,trace as Ct,watchList as wt,watchStart as Tt,watchStop as Et}from"../../tools/dist/index.js";import{mkdir as Dt,readFile as z,rename as Ot,unlink as kt,writeFile as At}from"node:fs/promises";import{SqliteGraphStore as jt,createSqliteAdapter as Mt,createStore as Nt}from"../../store/dist/index.js";import{randomUUID as Pt}from"node:crypto";import{homedir as B}from"node:os";import{execFileSync as Ft,fork as It}from"node:child_process";import{AIKIT_PATHS as V,EMBEDDING_DEFAULTS as Lt,getGlobalDataDir as Rt,getPartitionDir as H,isUserInstalled as zt,registerWorkspace as Bt,saveRegistry as Vt}from"../../core/dist/index.js";import{initializeWasm as Ht}from"../../chunker/dist/index.js";import{OnnxEmbedder as Ut}from"../../embeddings/dist/index.js";import{IncrementalIndexer as Wt}from"../../indexer/dist/index.js";const Gt=[{name:`analyze`,description:`Run analyzer output for a path`,usage:`aikit analyze <type> <path>`,run:async e=>{let t=e.shift()?.trim()??``,n=e.shift()?.trim()??``;(!t||!n)&&(console.error(`Usage: aikit analyze <type> <path>`),console.error(`Types: structure, deps, symbols, patterns, entry-points, blast-radius, diagram`),process.exit(1));let{BlastRadiusAnalyzer:r,DependencyAnalyzer:i,DiagramGenerator:a,EntryPointAnalyzer:o,PatternAnalyzer:s,StructureAnalyzer:c,SymbolAnalyzer:l}=await import(`../../analyzers/dist/index.js`),u=L(n),d;switch(t){case`structure`:d=await new c().analyze(u,{format:`markdown`});break;case`deps`:case`dependencies`:d=await new i().analyze(u,{format:`markdown`});break;case`symbols`:d=await new l().analyze(u,{format:`markdown`});break;case`patterns`:d=await new s().analyze(u,{format:`markdown`});break;case`entry-points`:d=await new o().analyze(u,{format:`markdown`});break;case`blast-radius`:d=await new r().analyze(process.cwd(),{files:[n],format:`markdown`});break;case`diagram`:d=await new a().analyze(u,{diagramType:`architecture`});break;default:console.error(`Unknown analyze type: ${t}`),console.error(`Types: structure, deps, symbols, patterns, entry-points, blast-radius, diagram`),process.exit(1)}console.log(d.output)}},{name:`onboard`,description:`Run all analyses for first-time codebase onboarding`,usage:`aikit onboard <path> [--generate] [--out-dir <dir>]`,run:async e=>{let{onboard:t}=await import(`../../tools/dist/index.js`),{loadConfig:n}=await Promise.resolve().then(()=>Kn),r=``,i=`memory`,a;for(let t=0;t<e.length;t++){let n=e[t].trim();n===`--generate`?i=`generate`:n===`--out-dir`&&t+1<e.length?a=e[++t].trim():n.startsWith(`--`)||(r=n)}r||=process.cwd();let o=L(r),s=n();console.log(`Onboarding: ${o} (mode: ${i})`),console.log(`Running analyses...
2
2
  `);let c=await t({path:o,mode:i,outDir:a??s.onboardDir});for(let e of c.steps){let t=e.status===`success`?`✓`:`✗`,n=e.status===`success`?`${e.durationMs}ms, ${e.output.length} chars`:e.error;console.log(` ${t} ${e.name} — ${n}`)}console.log(`\nTotal: ${c.totalDurationMs}ms`),c.outDir&&console.log(`Output written to: ${c.outDir}`)}}],Kt=[{name:`parse-output`,description:`Parse build or tool output from stdin`,usage:`aikit parse-output [--tool tsc|vitest|biome|git-status]`,run:async e=>{let t=y(e,`--tool`,``).trim()||void 0,n=await s();n.trim()||(console.error(`Usage: aikit parse-output [--tool tsc|vitest|biome|git-status]`),process.exit(1)),m(Je(n,t))}},{name:`git`,description:`Show git branch, status, recent commits, and optional diff stats`,usage:`aikit git [--cwd path] [--commit-count N] [--diff]`,run:async e=>{c(await Le({cwd:y(e,`--cwd`,``).trim()||void 0,commitCount:E(e,`--commit-count`,5),includeDiff:w(e,`--diff`)}))}},{name:`diff`,description:`Parse unified diff text from stdin into structured file changes`,usage:`git diff | aikit diff`,run:async()=>{let e=await s();e.trim()||(console.error(`Usage: git diff | aikit diff`),process.exit(1)),_(Ae({diff:e}))}},{name:`summarize`,description:`Show a structural summary of a file`,usage:`aikit summarize <path>`,run:async e=>{let t=e.shift()?.trim();t||(console.error(`Usage: aikit summarize <path>`),process.exit(1)),ee(await Me({path:L(t)}))}},{name:`checkpoint`,description:`Save and restore lightweight session checkpoints`,usage:`aikit checkpoint <save|load|list|latest> [label-or-id] [--data json] [--notes text]`,run:async e=>{let t=e.shift()?.trim();t||(console.error(`Usage: aikit checkpoint <save|load|list|latest> [label-or-id] [--data json] [--notes text]`),process.exit(1));let n=await v();switch(t){case`save`:{let t=e.shift()?.trim(),r=y(e,`--data`,``),i=y(e,`--notes`,``).trim()||void 0,a=r.trim()?``:await s();t||(console.error(`Usage: aikit checkpoint save <label> [--data json] [--notes text]`),process.exit(1)),D(Ce(n,t,te(r||a),{notes:i}));return}case`load`:{let t=e.shift()?.trim();t||(console.error(`Usage: aikit checkpoint load <id>`),process.exit(1));let r=Se(n,t);if(!r){console.log(`No checkpoint found: ${t}`);return}D(r);return}case`list`:{let e=xe(n);if(e.length===0){console.log(`No checkpoints saved.`);return}console.log(`Checkpoints (${e.length})`),console.log(`─`.repeat(60));for(let t of e)console.log(`${t.id}`),console.log(` Label: ${t.label}`),console.log(` Created: ${t.createdAt}`);return}case`latest`:{let e=be(n);if(!e){console.log(`No checkpoints saved.`);return}D(e);return}default:console.error(`Unknown checkpoint action: ${t}`),console.error(`Actions: save, load, list, latest`),process.exit(1)}}}];function qt(e){let t=``,n=0,r=e.length;for(;n<r;)if(e[n]===`"`){for(t+=`"`,n++;n<r&&e[n]!==`"`;)e[n]===`\\`&&(t+=e[n++]),n<r&&(t+=e[n++]);n<r&&(t+=e[n++])}else if(e[n]===`/`&&n+1<r&&e[n+1]===`/`)for(n+=2;n<r&&e[n]!==`
3
3
  `;)n++;else if(e[n]===`/`&&n+1<r&&e[n+1]===`*`){for(n+=2;n+1<r&&!(e[n]===`*`&&e[n+1]===`/`);)n++;n+=2}else t+=e[n++];return t.replace(/,(\s*[}\]])/g,`$1`)}var U=class{isPlatformSupported(){return this.platforms.includes(process.platform)}async readConfig(e){let t=this.getConfigPath(e);if(!k(t))return{};let n=await z(t,`utf-8`);try{return JSON.parse(qt(n))}catch{throw Error(`Invalid JSON in ${t}. Please fix or remove the file before retrying.`)}}async writeConfig(e,t){let n=this.getConfigPath(t),r=P(n),i=F(r,`.aikit-tmp-${Pt()}.json`);await Dt(r,{recursive:!0});try{await At(i,`${JSON.stringify(e,null,2)}\n`,`utf-8`),await Ot(i,n)}catch(e){try{await kt(i)}catch{}throw e}}async registerMcp(e,t,n){let r=await this.readConfig(n);r[this.configKey]||(r[this.configKey]={}),r[this.configKey][e]=t,await this.writeConfig(r,n)}async unregisterMcp(e,t){let n=await this.readConfig(t);n[this.configKey]&&(delete n[this.configKey][e],await this.writeConfig(n,t))}getScaffoldRoot(e){return null}getInstructionsRoot(e){return null}getScaffoldPaths(e){return{agents:null,skills:null,prompts:null,flows:null,commands:null,instructions:null,manifest:null,hooks:null}}buildInstructionContent(e,t){return`${e}\n---\n\n${t}`}},Jt=class extends U{id=`claude-code`;name=`Claude Code`;family=`claude`;platforms=[`win32`,`darwin`,`linux`];scope=`user`;configKey=`mcpServers`;async detect(){return this.isPlatformSupported()?k(this.getPathModule().resolve(B(),`.claude`)):!1}getConfigPath(){return this.getPathModule().resolve(B(),`.claude`,`mcp.json`)}getScaffoldRoot(){return this.getPathModule().resolve(B(),`.claude`)}getScaffoldPaths(){let e=this.getPathModule(),t=e.resolve(B(),`.claude`);return{agents:e.resolve(t,`agents`),skills:e.resolve(t,`skills`),prompts:null,flows:e.resolve(t,`flows`),commands:e.resolve(t,`commands`),instructions:e.resolve(t,`CLAUDE.md`),manifest:e.resolve(t,`.aikit-scaffold.json`),hooks:null}}buildInstructionContent(e,t){return`${e}\n---\n\n${t}`}getPathModule(){return process.platform===`win32`?R:I}},Yt=class extends U{id=`codex-cli`;name=`Codex CLI`;family=`codex`;platforms=[`win32`,`darwin`,`linux`];scope=`user`;configKey=`mcpServers`;async detect(){return this.isPlatformSupported()?k(this.getPathModule().resolve(B(),`.codex`)):!1}getConfigPath(){return this.getPathModule().resolve(B(),`.codex`,`config.json`)}getScaffoldRoot(){return this.getPathModule().resolve(B(),`.codex`)}getScaffoldPaths(){let e=this.getPathModule(),t=e.resolve(B(),`.codex`);return{agents:e.resolve(t,`agents`),skills:e.resolve(t,`skills`),prompts:null,flows:e.resolve(t,`flows`),commands:null,instructions:e.resolve(t,`AGENTS.md`),manifest:e.resolve(t,`.aikit-scaffold.json`),hooks:null}}getPathModule(){return process.platform===`win32`?R:I}},W=class extends U{family=`copilot`;platforms=[`win32`,`darwin`,`linux`];scope=`user`;hasInstructions=!1;async detect(){if(!this.isPlatformSupported())return!1;let e=this.getConfigDir();if(process.platform===`darwin`){let t=this.getMacAppPath();return k(e)||t!==null&&k(t)}return k(e)}getConfigPath(){return this.getPathModule().resolve(this.getConfigDir(),`mcp.json`)}getScaffoldRoot(){return this.getPathModule().resolve(B(),this.scaffoldBase)}getInstructionsRoot(){let e=this.getInstructionFilePath();return e?this.getPathModule().dirname(e):null}getScaffoldPaths(){let e=this.getPathModule(),t=e.resolve(B(),this.scaffoldBase);return{agents:e.resolve(t,`agents`),skills:e.resolve(t,`skills`),prompts:e.resolve(this.getConfigDir(),`prompts`),flows:e.resolve(t,`flows`),hooks:e.resolve(t,`hooks`),commands:null,instructions:this.getInstructionFilePath(),manifest:e.resolve(t,`.aikit-scaffold.json`)}}getConfigDir(){let e=this.getPathModule(),t=B();if(process.platform===`win32`){let n=process.env.APPDATA??e.resolve(t,`AppData`,`Roaming`);return e.resolve(n,this.configDirName,`User`)}if(process.platform===`darwin`)return e.resolve(t,`Library`,`Application Support`,this.configDirName,`User`);let n=process.env.XDG_CONFIG_HOME??e.resolve(t,`.config`);return e.resolve(n,this.configDirName,`User`)}getMacAppPath(){return null}getInstructionFilePath(){return null}getPathModule(){return process.platform===`win32`?R:I}},Xt=class extends U{id=`copilot-cli`;name=`Copilot CLI`;family=`copilot`;platforms=[`win32`,`darwin`,`linux`];scope=`user`;configKey=`mcpServers`;async detect(){return this.isPlatformSupported()?k(L(B(),`.copilot`)):!1}getConfigPath(){return L(B(),`.copilot`,`mcp-config.json`)}async registerMcp(e,t,n){let r={...t,tools:[`*`]},i=await this.readConfig(n);i[this.configKey]||(i[this.configKey]={}),i[this.configKey][e]=r,await this.writeConfig(i,n)}getScaffoldRoot(){return L(B(),`.copilot`)}getInstructionsRoot(){return null}getScaffoldPaths(){let e=L(B(),`.copilot`);return{agents:L(e,`agents`),skills:L(e,`skills`),prompts:null,flows:L(e,`flows`),hooks:L(e,`hooks`),commands:null,instructions:L(B(),`.github`,`copilot-instructions.md`),manifest:L(e,`.aikit-scaffold.json`)}}},Zt=class extends W{id=`cursor`;name=`Cursor`;configKey=`mcpServers`;configDirName=`Cursor`;scaffoldBase=`.cursor`;getMacAppPath(){return`/Applications/Cursor.app`}getInstructionFilePath(){return this.getPathModule().resolve(B(),this.scaffoldBase,`rules`,`aikit.mdc`)}},Qt=class extends W{id=`cursor-nightly`;name=`Cursor Nightly`;configKey=`mcpServers`;configDirName=`Cursor Nightly`;scaffoldBase=`.cursor`;getMacAppPath(){return`/Applications/Cursor Nightly.app`}getInstructionFilePath(){return this.getPathModule().resolve(B(),this.scaffoldBase,`rules`,`aikit.mdc`)}},$t=class e extends U{id=`intellij`;name=`IntelliJ IDEA`;family=`copilot`;platforms=[`win32`,`darwin`,`linux`];scope=`user`;configKey=`servers`;static PRODUCTS=[`IntelliJIdea`,`IdeaIC`,`WebStorm`,`PyCharm`,`PyCharmCE`,`GoLand`,`PhpStorm`,`CLion`,`Rider`,`RubyMine`,`RustRover`,`DataGrip`];async detect(){if(!this.isPlatformSupported())return!1;if(k(this.getCopilotConfigDir()))return!0;let t=this.getJetBrainsBaseDir();if(!k(t))return!1;try{return M(t,{withFileTypes:!0}).some(t=>t.isDirectory()&&e.PRODUCTS.some(e=>t.name.startsWith(e)))}catch{return!1}}getConfigPath(){return L(this.getCopilotConfigDir(),`mcp.json`)}async registerMcp(e,t,n){let r=this.getCopilotConfigDir();await Dt(r,{recursive:!0});let i=t.args??[],a=i.indexOf(`-e`),o;if(a!==-1&&a+1<i.length){let t=i[a+1],n=L(r,`${e}-launcher.js`);await At(n,t,`utf-8`),o=[...i.slice(0,a),n,...i.slice(a+2)]}else o=[...i];let s={type:`stdio`,...t,args:o};await super.registerMcp(e,s,n)}getScaffoldRoot(e){return null}getInstructionsRoot(e){return null}getScaffoldPaths(e){return{agents:null,skills:null,prompts:null,flows:null,commands:null,instructions:null,manifest:null,hooks:null}}buildInstructionContent(e,t){return t}getCopilotConfigDir(){let e=B();return process.platform===`win32`?L(process.env.LOCALAPPDATA??L(e,`AppData`,`Local`),`github-copilot`,`intellij`):process.platform===`darwin`?L(e,`Library`,`Application Support`,`github-copilot`,`intellij`):L(process.env.XDG_CONFIG_HOME??L(e,`.config`),`github-copilot`,`intellij`)}getJetBrainsBaseDir(){let e=B();return process.platform===`win32`?L(process.env.APPDATA??L(e,`AppData`,`Roaming`),`JetBrains`):process.platform===`darwin`?L(e,`Library`,`Application Support`,`JetBrains`):L(process.env.XDG_CONFIG_HOME??L(e,`.config`),`JetBrains`)}},en=class extends W{id=`trae`;name=`Trae`;configKey=`servers`;configDirName=`Trae`;scaffoldBase=`.trae`;getMacAppPath(){return`/Applications/Trae.app`}getInstructionFilePath(){return this.getPathModule().resolve(B(),this.scaffoldBase,`rules`,`aikit.md`)}},tn=class extends W{id=`vscode`;name=`VS Code`;configKey=`servers`;configDirName=`Code`;scaffoldBase=`.copilot`;hasInstructions=!0;getMacAppPath(){return`/Applications/Visual Studio Code.app`}getInstructionFilePath(){return this.hasInstructions?this.getPathModule().resolve(B(),this.scaffoldBase,`instructions`,`copilot-instructions.md`):null}buildInstructionContent(e,t){return`---\napplyTo: "**"\n---\n\n${e}\n---\n\n${t}`}},nn=class extends W{id=`vscode-insiders`;name=`VS Code Insiders`;configKey=`servers`;configDirName=`Code - Insiders`;scaffoldBase=`.copilot`;hasInstructions=!0;getMacAppPath(){return`/Applications/Visual Studio Code - Insiders.app`}getInstructionFilePath(){return this.hasInstructions?this.getPathModule().resolve(B(),this.scaffoldBase,`instructions`,`copilot-instructions.md`):null}buildInstructionContent(e,t){return`---\napplyTo: "**"\n---\n\n${e}\n---\n\n${t}`}},rn=class extends W{id=`vscodium`;name=`VSCodium`;configKey=`servers`;configDirName=`VSCodium`;scaffoldBase=`.copilot`;hasInstructions=!0;getMacAppPath(){return`/Applications/VSCodium.app`}getInstructionFilePath(){return this.hasInstructions?this.getPathModule().resolve(B(),this.scaffoldBase,`instructions`,`copilot-instructions.md`):null}buildInstructionContent(e,t){return`---\napplyTo: "**"\n---\n\n${e}\n---\n\n${t}`}},an=class extends W{id=`windsurf`;name=`Windsurf`;configKey=`servers`;configDirName=`Windsurf`;scaffoldBase=`.windsurf`;getMacAppPath(){return`/Applications/Windsurf.app`}getInstructionFilePath(){return this.getPathModule().resolve(B(),this.scaffoldBase,`rules`,`aikit.md`)}},on=class extends U{id=`gemini-cli`;name=`Gemini CLI`;family=`gemini`;platforms=[`win32`,`darwin`,`linux`];scope=`user`;configKey=`mcpServers`;async detect(){return this.isPlatformSupported()?k(this.getPathModule().resolve(B(),`.gemini`)):!1}getConfigPath(){return this.getPathModule().resolve(B(),`.gemini`,`settings.json`)}getScaffoldRoot(){return this.getPathModule().resolve(B(),`.gemini`)}getScaffoldPaths(){let e=this.getPathModule(),t=e.resolve(B(),`.gemini`);return{agents:e.resolve(t,`agents`),skills:e.resolve(t,`skills`),prompts:null,flows:e.resolve(t,`flows`),commands:null,instructions:e.resolve(t,`AGENTS.md`),manifest:e.resolve(t,`.aikit-scaffold.json`),hooks:null}}getPathModule(){return process.platform===`win32`?R:I}},sn=class extends U{id=`zed`;name=`Zed`;family=`zed`;platforms=[`win32`,`darwin`,`linux`];scope=`user`;configKey=`context_servers`;async detect(){return this.isPlatformSupported()?k(this.getConfigDir()):!1}getConfigPath(){return this.getPathModule().resolve(this.getConfigDir(),`settings.json`)}async registerMcp(e,t){let{type:n,...r}=t,i={...r,env:r.env??{}};await super.registerMcp(e,i)}getScaffoldRoot(){return this.getConfigDir()}getScaffoldPaths(){let e=this.getPathModule(),t=this.getConfigDir();return{agents:e.resolve(t,`prompts`),skills:null,prompts:e.resolve(t,`prompts`),flows:null,commands:null,instructions:null,manifest:e.resolve(t,`.aikit-scaffold.json`),hooks:null}}getConfigDir(){let e=this.getPathModule();return process.platform===`win32`?e.resolve(process.env.APPDATA||B(),`Zed`):e.resolve(B(),`.config`,`zed`)}getPathModule(){return process.platform===`win32`?R:I}};const cn=[new tn,new nn,new rn,new Zt,new Qt,new an,new en,new Xt,new $t,new Jt,new on,new Yt,new sn];async function ln(e){let t=e?.scope?cn.filter(t=>t.scope===e.scope):cn;return(await Promise.allSettled(t.map(async e=>await e.detect()?e:null))).flatMap(e=>e.status!==`fulfilled`||e.value===null?[]:[e.value])}const un={SessionStart:{copilot:`SessionStart`,claude:`PreToolCall`,copilotCli:`sessionStart`},PreToolUse:{copilot:`PreToolUse`,claude:`PreToolCall`,copilotCli:`preToolUse`},PostToolUse:{copilot:`PostToolUse`,claude:`PostToolCall`,copilotCli:`postToolUse`},SubagentStart:{copilot:`SubagentStart`,claude:`PreToolCall`,copilotCli:`subagentStart`},PreCompact:{copilot:`PreCompact`,claude:`PreToolCall`,copilotCli:`preCompact`},Stop:{copilot:`Stop`,claude:`PostToolCall`,copilotCli:`stop`}},dn={fileRead:{copilot:[`read_file`,`readFile`],claude:[`Read`],copilotCli:[`read_file`]},fileWrite:{copilot:[`editFiles`,`replace_string_in_file`,`create_file`],claude:[`Write`,`Edit`],copilotCli:[`editFiles`,`replace_string_in_file`]},fileSearch:{copilot:[`grep_search`,`semantic_search`,`find`],claude:[`Bash`],copilotCli:[`grep_search`]}},G={"privacy-guard":{id:`privacy-guard`,event:`PreToolUse`,tier:`safety`,description:`Blocks reads of secret-bearing env files, key material, SSH paths, and credential artifacts.`,script:`privacy-guard.mjs`,matcher:[`fileRead`],scope:`user`,patterns:[`.env`,`*.pem`,`*.key`,`id_rsa*`,`.ssh/*`,`*credentials*`,`*.secret`]},"scout-guard":{id:`scout-guard`,event:`PreToolUse`,tier:`safety`,description:`Blocks reads and searches inside generated, dependency, and git object directories.`,script:`scout-guard.mjs`,matcher:[`fileRead`,`fileSearch`],scope:`user`,patterns:[`node_modules/`,`dist/`,`.git/objects/`,`vendor/`,`build/`]},"subagent-context":{id:`subagent-context`,event:`SubagentStart`,tier:`efficiency`,description:`Injects compact project context into each subagent spawn to reduce repeated discovery.`,script:`subagent-context.mjs`,scope:`user`},"pre-compact-save":{id:`pre-compact-save`,event:`PreCompact`,tier:`efficiency`,description:`Persists critical state before context compaction truncates recent session history.`,script:`pre-compact-save.mjs`,scope:`user`},"post-edit-check":{id:`post-edit-check`,event:`PostToolUse`,tier:`nudge`,description:`After repeated file edits, injects a validation reminder so checks are not skipped.`,script:`post-edit-check.mjs`,matcher:[`fileWrite`],scope:`user`},"session-init":{id:`session-init`,event:`SessionStart`,tier:`nudge`,description:`Detects project stack and injects workspace metadata and environment context at startup.`,script:`session-init.mjs`,scope:`user`},"session-observer":{id:`session-observer`,event:`PostToolUse`,tier:`efficiency`,description:`Captures tool usage patterns for autonomous lesson extraction. Writes to session buffer.`,script:`session-observer.mjs`,scope:`user`},"session-learn":{id:`session-learn`,event:`Stop`,tier:`efficiency`,description:`Nudges final pattern analysis on buffered observations at session end.`,script:`session-learn.mjs`,scope:`user`}},fn={PreCompact:3e3,PostToolUse:3e3},pn={copilot:`hooks.json`,claude:`hooks-settings.json`,copilotCli:`hooks.json`};function mn(e,t){return(e.matcher||[]).flatMap(e=>{let n=dn[e];if(!n)throw Error(`Unknown hook matcher: ${e}`);return n[t]||[]})}function hn(e,t,n,r){let i=`${n}/${e.script}`;return mn(e,r),r===`copilot`?{event:t,steps:[{type:`command`,command:`node`,args:[i],timeout:fn[e.event]||5e3}]}:r===`claude`?{type:`command`,command:`node ${i}`}:{command:`node`,args:[i]}}function gn(e,t){if(e===`copilot`){let n=Object.values(G).map(n=>{let r=un[n.event]?.[e];if(!r)throw Error(`Unsupported hook event ${n.event} for ${e}`);return hn(n,r,t,e)});return[{path:pn[e],content:JSON.stringify({hooks:n},null,2)}]}let n={};for(let r of Object.values(G)){let i=un[r.event]?.[e];if(!i)throw Error(`Unsupported hook event ${r.event} for ${e}`);n[i]||=[],n[i].push(hn(r,i,t,e))}return[{path:pn[e],content:JSON.stringify({hooks:n},null,2)}]}function _n(){return[`_runtime.mjs`,...Object.values(G).map(e=>e.script)]}function vn(){let e={command:x.command,args:x.args?[...x.args]:void 0,type:x.type};if(process.platform!==`win32`){let t=process.env.PATH;t&&(e.env={PATH:t});try{let t=Ft(`which`,[`node`],{encoding:`utf-8`,timeout:3e3}).trim();t&&k(t)&&(e.command=t)}catch{}}return e}const yn=new Set([`VS Code`,`VS Code Insiders`,`VSCodium`]);function bn(e,t,n){let r=L(B(),`.copilot`,`instructions`,`copilot-instructions.md`);!k(r)||n.has(r)||(A(P(r),{recursive:!0}),N(r,`---\napplyTo: "**"\n---\n\n${e}\n---\n\n${t}`,`utf-8`),n.add(r))}function xn(e,t=!1){if(!yn.has(e.name))return;let n=L(P(e.getConfigPath()),`settings.json`),r={};if(k(n))try{let e=j(n,`utf-8`);r=JSON.parse(e)}catch{console.log(` ${e.name}: skipped settings.json (invalid JSON)`);return}let i=!1;for(let[e,n]of Object.entries(se))if(typeof n==`object`&&n){let t=typeof r[e]==`object`&&r[e]!==null?r[e]:{},a={...t,...n};JSON.stringify(a)!==JSON.stringify(t)&&(r[e]=a,i=!0)}else (t||!(e in r))&&(r[e]=n,i=!0);i&&(N(n,`${JSON.stringify(r,null,2)}\n`,`utf-8`),console.log(` ${e.name}: updated settings.json`))}async function Sn(r,i,s,c,l=!1){let u=new Map,d=new Set,f=re(`aikit`,s),p=ce(`aikit`,s);for(let e of i)e.getScaffoldRoot()!==null&&u.set(e.id,e);if(bn(f,p,d),u.size===0){d.size>0?console.log(` Instruction files: ${[...d].join(`, `)}`):console.log(` No IDEs with global scaffold support detected.`);return}let ee=await n(r,`copilot`),m=new Map;for(let e of ee){let t=e.path.indexOf(`/`);if(t===-1)continue;let n=e.path.substring(0,t);if(n!==`agents`&&n!==`prompts`)continue;let r=m.get(n)??[];r.push({path:e.path.substring(t+1),content:e.content}),m.set(n,r)}let h=await n(r,`skills`),g=new Set;for(let e of h){let t=e.path.indexOf(`/`);t!==-1&&g.add(e.path.substring(0,t))}let _=await n(r,`flows`),v=new Set;for(let e of _){let t=e.path.indexOf(`/`);t!==-1&&v.add(e.path.substring(0,t))}let y=await n(r,`claude-code`),b=L(r,`scaffold`,`general`,`hooks`,`scripts`),te=k(b)?b:L(import.meta.dirname,`../../../../../scaffold/general/hooks/scripts`),ne=_n(),x=new Set,S=new Set,C=new Set,w=(n,r,i)=>{let s=m.get(i);if(!n||!r||!s||s.length===0)return;let u=`${i}:${r}:${n}`;if(x.has(u))return;x.add(u);let d=e(r)??o(c);d.version=c,a(s,n,d,i,l),t(r,d),C.add(P(r))},T=(n,r,i,s)=>{if(!n||!r||s.length===0)return;let u=`${i}:${r}:${n}`;if(x.has(u))return;if(x.add(u),i===`flows`&&!S.has(n)){for(let e of v){let t=L(n,e,`skills`);k(t)&&(fe(t,{recursive:!0,force:!0}),console.log(` ${P(r)}: migrated ${e} flow to steps/ layout`))}S.add(n)}let d=e(r)??o(c);d.version=c,a(s,n,d,i,l),t(r,d),C.add(P(r))},ie=(e,t,n)=>{!e||!t||T(e,t,`hooks`,[...gn(n,L(e,`scripts`).replace(/\\/g,`/`)),...ne.map(e=>({path:`scripts/${e}`,content:j(L(te,e),`utf-8`)}))])};for(let e of u.values()){let t=e.getScaffoldPaths();w(t.agents,t.manifest,`agents`),w(t.prompts,t.manifest,`prompts`),T(t.skills,t.manifest,`skills`,h),T(t.flows,t.manifest,`flows`,_),T(t.commands,t.manifest,`commands`,y),ie(t.hooks,t.manifest,e.family===`claude`?`claude`:`copilot`)}for(let e of C)console.log(` ${e}: scaffold updated (${g.size} skills)`);for(let e of u.values()){let t=e.getScaffoldPaths().instructions;!t||d.has(t)||(A(P(t),{recursive:!0}),N(t,e.buildInstructionContent(f,p),`utf-8`),d.add(t))}d.size>0&&console.log(` Instruction files: ${[...d].join(`, `)}`)}function Cn(e){let t=[];for(let n of e){let e=n.getScaffoldRoot();if(e)if(yn.has(n.name)){let r=n.getInstructionsRoot()??e;t.push(L(r,`kb.instructions.md`)),t.push(L(r,`aikit.instructions.md`))}else n.name===`Cursor`||n.name===`Cursor Nightly`?t.push(L(e,`rules`,`kb.mdc`)):n.name===`Windsurf`&&t.push(L(e,`rules`,`kb.md`))}for(let e of t)k(e)&&(pe(e),console.log(` Removed legacy file: ${e}`))}async function K(e){let t=g,n=ae(),r=JSON.parse(j(L(n,`package.json`),`utf-8`)).version;console.log(`Initializing @vpxa/aikit v${r}...\n`);let i=Rt();A(i,{recursive:!0}),console.log(` Global data store: ${i}`),Vt({version:1,workspaces:{}}),console.log(` Created registry.json`);let a=await ln({scope:`user`});if(a.length===0)console.log(`
4
4
  No supported IDEs detected. You can manually add the MCP server config.`);else{console.log(`\n Detected ${a.length} IDE(s):`);let n=vn();for(let e of a)try{await e.registerMcp(t,n),console.log(` ${e.name}: configured ${t}`)}catch(t){console.log(` ${e.name}: failed to configure (${t.message})`)}for(let t of a)xn(t,e.force)}console.log(`
@@ -13,10 +13,10 @@ Issues found:`);for(let e of n.issues)console.log(` - ${e}`)}}}],Wn=[{name:`pro
13
13
  Actions: stats, find-nodes, find-edges, neighbors, traverse, delete, clear`),process.exit(1));let{graphStore:n}=await Q(),r=y(e,`--type`,``),i=y(e,`--name`,``),a=y(e,`--node-id`,``),o=y(e,`--edge-type`,``),s=y(e,`--direction`,`both`),c=E(e,`--depth`,2),l=E(e,`--limit`,50),u=y(e,`--source-path`,``),d={stats:`stats`,"find-nodes":`find_nodes`,"find-edges":`find_edges`,neighbors:`neighbors`,traverse:`traverse`,delete:`delete`,clear:`clear`}[t];d||(console.error(`Unknown graph action: ${t}`),console.error(`Actions: stats, find-nodes, find-edges, neighbors, traverse, delete, clear`),process.exit(1));let f=await Re(n,{action:d,nodeType:r||void 0,namePattern:i||void 0,sourcePath:u||void 0,nodeId:a||void 0,edgeType:o||void 0,direction:s,maxDepth:c,limit:l});if(console.log(f.summary),f.nodes&&f.nodes.length>0){console.log(`
14
14
  Nodes:`);for(let e of f.nodes){let t=Object.keys(e.properties).length>0?` ${JSON.stringify(e.properties)}`:``;console.log(` ${e.name} (${e.type}, id: ${e.id})${t}`)}}if(f.edges&&f.edges.length>0){console.log(`
15
15
  Edges:`);for(let e of f.edges){let t=e.weight===1?``:` (weight: ${e.weight})`;console.log(` ${e.fromId} --[${e.type}]--> ${e.toId}${t}`)}}f.stats&&(console.log(`\nNode types: ${JSON.stringify(f.stats.nodeTypes)}`),console.log(`Edge types: ${JSON.stringify(f.stats.edgeTypes)}`)),f.deleted!==void 0&&console.log(`Deleted: ${f.deleted}`)}}],nr=[{name:`remember`,description:`Store curated knowledge`,usage:`aikit remember <title> --category <cat> [--tags tag1,tag2]`,run:async e=>{let t=y(e,`--category`,``).trim(),n=f(y(e,`--tags`,``)),r=e.shift()?.trim()??``,i=await s(),a=i.trim().length>0?i:e.join(` `).trim();(!r||!t||!a.trim())&&(console.error(`Usage: aikit remember <title> --category <cat> [--tags tag1,tag2]`),process.exit(1));let{curated:o}=await Q(),c=await o.remember(r,a,t,n);console.log(`Stored curated entry`),console.log(` Path: ${c.path}`),console.log(` Category: ${t}`),n.length>0&&console.log(` Tags: ${n.join(`, `)}`)}},{name:`forget`,description:`Remove a curated entry`,usage:`aikit forget <path> --reason <reason>`,run:async e=>{let t=y(e,`--reason`,``).trim(),n=e.shift()?.trim()??``;(!n||!t)&&(console.error(`Usage: aikit forget <path> --reason <reason>`),process.exit(1));let{curated:r}=await Q(),i=await r.forget(n,t);console.log(`Removed curated entry: ${i.path}`)}},{name:`read`,description:`Read a curated entry`,usage:`aikit read <path>`,run:async e=>{let t=e.shift()?.trim()??``;t||(console.error(`Usage: aikit read <path>`),process.exit(1));let{curated:n}=await Q(),r=await n.read(t);console.log(r.title),console.log(`─`.repeat(60)),console.log(`Path: ${r.path}`),console.log(`Category: ${r.category}`),console.log(`Version: ${r.version}`),console.log(`Tags: ${r.tags.length>0?r.tags.join(`, `):`None`}`),console.log(``),console.log(r.content)}},{name:`list`,description:`List curated entries`,usage:`aikit list [--category <cat>] [--tag <tag>]`,run:async e=>{let t=y(e,`--category`,``).trim()||void 0,n=y(e,`--tag`,``).trim()||void 0,{curated:r}=await Q(),i=await r.list({category:t,tag:n});if(i.length===0){console.log(`No curated entries found.`);return}console.log(`Curated entries (${i.length})`),console.log(`─`.repeat(60));for(let e of i){console.log(e.path),console.log(` ${e.title}`),console.log(` Category: ${e.category} | Version: ${e.version}`),console.log(` Tags: ${e.tags.length>0?e.tags.join(`, `):`None`}`);let t=e.contentPreview.replace(/\s+/g,` `).trim();t&&console.log(` Preview: ${t}`),console.log(``)}}},{name:`update`,description:`Update a curated entry`,usage:`aikit update <path> --reason <reason>`,run:async e=>{let t=y(e,`--reason`,``).trim(),n=e.shift()?.trim()??``,r=await s();(!n||!t||!r.trim())&&(console.error(`Usage: aikit update <path> --reason <reason>`),process.exit(1));let{curated:i}=await Q(),a=await i.update(n,r,t);console.log(`Updated curated entry`),console.log(` Path: ${a.path}`),console.log(` Version: ${a.version}`)}},{name:`compact`,description:`Compress text for context`,usage:`aikit compact <query> [--path <file>] [--max-chars N] [--segmentation paragraph|sentence|line]`,run:async e=>{let t=E(e,`--max-chars`,3e3),n=y(e,`--path`,``).trim()||void 0,r=y(e,`--segmentation`,`paragraph`),i=e.join(` `).trim(),a=n?void 0:await s();(!i||!n&&!a?.trim())&&(console.error(`Usage: aikit compact <query> --path <file> OR cat file | aikit compact <query>`),process.exit(1));let{embedder:o}=await Q(),c=n?await Te(o,{path:n,query:i,maxChars:t,segmentation:r}):await Te(o,{text:a??``,query:i,maxChars:t,segmentation:r});console.log(`Compressed ${c.originalChars} chars to ${c.compressedChars} chars`),console.log(`Ratio: ${(c.ratio*100).toFixed(1)}% | Segments: ${c.segmentsKept}/${c.segmentsTotal}`),console.log(``),console.log(c.text)}}],rr=[{name:`search`,description:`Search the AI Kit index`,usage:`aikit search <query> [--limit N] [--mode hybrid|semantic|keyword] [--graph-hops 0-3]`,run:async e=>{let t=E(e,`--limit`,5),n=y(e,`--mode`,`hybrid`),r=E(e,`--graph-hops`,0),i=e.join(` `).trim();i||(console.error(`Usage: aikit search <query>`),process.exit(1));let{embedder:a,store:o,graphStore:s}=await Q(),c=await a.embedQuery(i),l;if(n===`keyword`)l=await o.ftsSearch(i,{limit:t});else if(n===`semantic`)l=await o.search(c,{limit:t});else{let[e,n]=await Promise.all([o.search(c,{limit:t*2}),o.ftsSearch(i,{limit:t*2}).catch(()=>[])]);l=d(e,n).slice(0,t)}if(l.length===0){console.log(`No results found.`);return}for(let{record:e,score:t}of l){console.log(`\n${`─`.repeat(60)}`),console.log(`[${(t*100).toFixed(1)}%] ${e.sourcePath}:${e.startLine}-${e.endLine}`),console.log(` Type: ${e.contentType} | Origin: ${e.origin}`),e.tags.length>0&&console.log(` Tags: ${e.tags.join(`, `)}`),console.log(``);let n=e.content.length>500?`${e.content.slice(0,500)}...`:e.content;console.log(n)}if(console.log(`\n${`─`.repeat(60)}`),console.log(`${l.length} result(s) found.`),r>0&&l.length>0)try{let{graphAugmentSearch:e}=await import(`../../tools/dist/index.js`),t=(await e(s,l.map(e=>({recordId:e.record.id,score:e.score,sourcePath:e.record.sourcePath})),{hops:r,maxPerHit:5})).filter(e=>e.graphContext.nodes.length>0);if(t.length>0){console.log(`\nGraph context (${r} hop${r>1?`s`:``}):\n`);for(let e of t){console.log(` ${e.sourcePath}:`);for(let t of e.graphContext.nodes.slice(0,5))console.log(` → ${t.name} (${t.type})`);for(let t of e.graphContext.edges.slice(0,5))console.log(` → ${t.fromId} --[${t.type}]--> ${t.toId}`)}}}catch(e){console.error(`[graph] augmentation failed: ${e.message}`)}}},{name:`find`,description:`Run federated search across indexed content and files`,usage:`aikit find [query] [--glob <pattern>] [--pattern <regex>] [--limit N]`,run:async e=>{let t=E(e,`--limit`,10),n=y(e,`--glob`,``).trim()||void 0,r=y(e,`--pattern`,``).trim()||void 0,i=e.join(` `).trim()||void 0;!i&&!n&&!r&&(console.error(`Usage: aikit find [query] [--glob <pattern>] [--pattern <regex>] [--limit N]`),process.exit(1));let{embedder:a,store:o}=await Q(),s=await Ne(a,o,{query:i,glob:n,pattern:r,limit:t});if(s.results.length===0){console.log(`No matches found.`);return}console.log(`Strategies: ${s.strategies.join(`, `)}`),console.log(`Results: ${s.results.length} shown (${s.totalFound} total)`);for(let e of s.results){let t=e.lineRange?`:${e.lineRange.start}-${e.lineRange.end}`:``;console.log(`\n[${e.source}] ${e.path}${t}`),console.log(` Score: ${(e.score*100).toFixed(1)}%`),e.preview&&console.log(` ${e.preview.replace(/\s+/g,` `).trim()}`)}}},{name:`scope-map`,description:`Generate a reading plan for a task`,usage:`aikit scope-map <task> [--max-files N]`,run:async e=>{let t=E(e,`--max-files`,15),n=e.join(` `).trim();n||(console.error(`Usage: aikit scope-map <task> [--max-files N]`),process.exit(1));let{embedder:r,store:i}=await Q(),a=await ht(r,i,{task:n,maxFiles:t});console.log(`Task: ${a.task}`),console.log(`Files: ${a.files.length}`),console.log(`Estimated tokens: ${a.totalEstimatedTokens}`),console.log(``),console.log(`Reading order:`);for(let e of a.readingOrder)console.log(` ${e}`);for(let[e,t]of a.files.entries())console.log(`\n${e+1}. ${t.path}`),console.log(` Relevance: ${(t.relevance*100).toFixed(1)}% | Tokens: ${t.estimatedTokens}`),console.log(` Why: ${t.reason}`),t.focusRanges.length>0&&console.log(` Focus: ${b(t.focusRanges)}`)}},{name:`symbol`,description:`Resolve a symbol definition, imports, and references`,usage:`aikit symbol <name> [--limit N]`,run:async e=>{let t=E(e,`--limit`,20),n=e.join(` `).trim();n||(console.error(`Usage: aikit symbol <name> [--limit N]`),process.exit(1));let{embedder:r,store:i}=await Q();u(await xt(r,i,{name:n,limit:t}))}},{name:`trace`,description:`Trace forward/backward flow for a symbol or file location`,usage:`aikit trace <start> [--direction forward|backward|both] [--max-depth N]`,run:async e=>{let t=y(e,`--direction`,`both`).trim()||`both`,n=E(e,`--max-depth`,3),r=e.join(` `).trim();(!r||![`forward`,`backward`,`both`].includes(t))&&(console.error(`Usage: aikit trace <start> [--direction forward|backward|both] [--max-depth N]`),process.exit(1));let{embedder:i,store:a}=await Q();p(await Ct(i,a,{start:r,direction:t,maxDepth:n}))}},{name:`examples`,description:`Find real code examples of a symbol or pattern`,usage:`aikit examples <query> [--limit N] [--content-type type]`,run:async e=>{let t=E(e,`--limit`,5),n=y(e,`--content-type`,``).trim()||void 0,r=e.join(` `).trim();r||(console.error(`Usage: aikit examples <query> [--limit N] [--content-type type]`),process.exit(1));let{embedder:i,store:a}=await Q();le(await Fe(i,a,{query:r,limit:t,contentType:n}))}},{name:`dead-symbols`,description:`Find exported symbols that appear to be unused`,usage:`aikit dead-symbols [--limit N]`,run:async e=>{let t=E(e,`--limit`,100),{embedder:n,store:r}=await Q();ue(await Pe(n,r,{limit:t}))}},{name:`lookup`,description:`Look up indexed content by record ID or source path`,usage:`aikit lookup <id>`,run:async e=>{let t=e.join(` `).trim();t||(console.error(`Usage: aikit lookup <id>`),process.exit(1));let{store:n}=await Q(),r=await n.getById(t);if(r){console.log(r.id),console.log(`─`.repeat(60)),console.log(`Path: ${r.sourcePath}`),console.log(`Chunk: ${r.chunkIndex+1}/${r.totalChunks}`),console.log(`Lines: ${r.startLine}-${r.endLine}`),console.log(`Type: ${r.contentType} | Origin: ${r.origin}`),r.tags.length>0&&console.log(`Tags: ${r.tags.join(`, `)}`),console.log(``),console.log(r.content);return}let i=await n.getBySourcePath(t);if(i.length===0){console.log(`No indexed content found for: ${t}`);return}i.sort((e,t)=>e.chunkIndex-t.chunkIndex),console.log(t),console.log(`─`.repeat(60)),console.log(`Chunks: ${i.length} | Type: ${i[0].contentType}`);for(let e of i){let t=e.startLine?` (lines ${e.startLine}-${e.endLine})`:``;console.log(`\nChunk ${e.chunkIndex+1}/${e.totalChunks}${t}`),console.log(e.content)}}}],ir=[{name:`status`,description:`Show AI Kit index status and statistics`,run:async()=>{let{isUserInstalled:e,getGlobalDataDir:t,computePartitionKey:n,listWorkspaces:r}=await import(`../../core/dist/index.js`),{existsSync:i}=await import(`node:fs`),a=process.cwd(),o=e(),s=i(L(a,`.vscode`,`mcp.json`)),c,l;if(o&&s)c=`workspace (overrides user-level for this workspace)`,l=L(a,`.aikit-data`);else if(o){let e=n(a);c=i(L(a,`AGENTS.md`))?`user (workspace scaffolded)`:`user (workspace not scaffolded)`,l=L(t(),e)}else c=`workspace`,l=L(a,`.aikit-data`);if(console.log(`AI Kit Status`),console.log(`─`.repeat(40)),console.log(` Mode: ${c}`),console.log(` Data: ${l}`),o&&!s){let e=r();console.log(` Registry: ${e.length} workspace(s) enrolled`)}try{let{store:e}=await Q(),t=await e.getStats(),n=await e.listSourcePaths();console.log(` Records: ${t.totalRecords}`),console.log(` Files: ${t.totalFiles}`),console.log(` Indexed: ${t.lastIndexedAt??`Never`}`),console.log(` Backend: ${t.storeBackend}`),console.log(` Model: ${t.embeddingModel}`),console.log(``),console.log(`Content Types:`);for(let[e,n]of Object.entries(t.contentTypeBreakdown))console.log(` ${e}: ${n}`);if(n.length>0){console.log(``),console.log(`Files (${n.length} total):`);for(let e of n.slice(0,20))console.log(` ${e}`);n.length>20&&console.log(` ... and ${n.length-20} more`)}}catch{console.log(``),console.log(" Index not available — run `aikit reindex` to index this workspace.")}o&&!s&&!i(L(a,`AGENTS.md`))&&(console.log(``),console.log(" Action: Run `npx @vpxa/aikit init` to add AGENTS.md and copilot-instructions.md"))}},{name:`reindex`,description:`Re-index the AI Kit index from configured sources`,usage:`aikit reindex [--full]`,run:async e=>{let t=e.includes(`--full`),{store:n,indexer:r,curated:i,config:a}=await Q();console.log(`Indexing sources...`);let o=e=>{e.phase===`chunking`&&e.currentFile&&process.stdout.write(`\r [${e.filesProcessed+1}/${e.filesTotal}] ${e.currentFile}`),e.phase===`done`&&process.stdout.write(`
16
- `)},s;t?(console.log(`Dropping existing index for full reindex...`),s=await r.reindexAll(a,o)):s=await r.index(a,o),console.log(`Done: ${s.filesProcessed} files, ${s.chunksCreated} chunks in ${(s.durationMs/1e3).toFixed(1)}s`),console.log(`Building FTS index...`),await n.createFtsIndex(),console.log(`Re-indexing curated entries...`);let c=await i.reindexAll();console.log(`Curated: ${c.indexed} entries restored`)}},{name:`serve`,description:`Start the MCP server (stdio or HTTP)`,usage:`aikit serve [--transport stdio|http] [--port N]`,run:async e=>{let t=S(),n=y(e,`--transport`,`stdio`),r=y(e,`--port`,`3210`);try{await Hn({silent:!0})}catch{}let i=It(t,[],{stdio:n===`stdio`?[`pipe`,`pipe`,`inherit`,`ipc`]:`inherit`,env:{...process.env,AIKIT_TRANSPORT:n,AIKIT_PORT:r}});n===`stdio`&&i.stdin&&i.stdout&&(process.stdin.pipe(i.stdin),i.stdout.pipe(process.stdout)),i.on(`exit`,e=>process.exit(e??0)),process.on(`SIGINT`,()=>i.kill(`SIGINT`)),process.on(`SIGTERM`,()=>i.kill(`SIGTERM`)),await new Promise(()=>{})}},{name:`init`,description:`Initialize AI Kit in the current directory`,usage:`aikit init [--workspace] [--smart] [--force] [--guide]`,run:async e=>{let t=e.includes(`--user`),n=e.includes(`--workspace`),r=e.includes(`--smart`),i=e.includes(`--guide`),a=e.includes(`--force`);if(t&&n&&(console.error(`Cannot use --user and --workspace together.`),process.exit(1)),i){let{guideProject:e}=await import(`./init-o6szsZIP.js`);await e();return}if(r){let{initSmart:e}=await import(`./init-o6szsZIP.js`);await e({force:a})}else if(t)await K({force:a});else if(n){let{initProject:e}=await import(`./init-o6szsZIP.js`);await e({force:a})}else await K({force:a})}},{name:`check`,description:`Run incremental typecheck and lint`,usage:`aikit check [--cwd <dir>] [--files f1,f2] [--skip-types] [--skip-lint] [--detail efficient|normal|full]`,run:async e=>{let t=y(e,`--cwd`,``).trim()||void 0,n=y(e,`--files`,``),r=y(e,`--detail`,`full`)||`full`,i=n.split(`,`).map(e=>e.trim()).filter(Boolean),a=!1;e.includes(`--skip-types`)&&(e.splice(e.indexOf(`--skip-types`),1),a=!0);let o=!1;e.includes(`--skip-lint`)&&(e.splice(e.indexOf(`--skip-lint`),1),o=!0);let s=await ye({cwd:t,files:i.length>0?i:void 0,skipTypes:a,skipLint:o,detail:r});h(s),s.passed||(process.exitCode=1)}},{name:`health`,description:`Run project health checks on the current directory`,usage:`aikit health [path]`,run:async e=>{let t=Be(e.shift());console.log(`Project Health: ${t.path}`),console.log(`─`.repeat(50));for(let e of t.checks){let t=e.status===`pass`?`+`:e.status===`warn`?`~`:`X`;console.log(` [${t}] ${e.name}: ${e.message}`)}console.log(`─`.repeat(50)),console.log(`Score: ${t.score}% — ${t.summary}`)}},{name:`prune`,description:`Clean up orphaned storage, legacy data, and stale partitions`,usage:`aikit prune [--dry-run] [--max-age-days=90] [--force]`,run:async e=>{let{prune:t,formatBytes:n,markPruneRun:r}=await import(`../../tools/dist/index.js`),i=e.includes(`--dry-run`),a=e.includes(`--force`),o=e.find(e=>e.startsWith(`--max-age-days=`)),s=o?Number.parseInt(o.split(`=`)[1]??``,10):90;if(!i&&!a){console.log(`⚠️ This will permanently delete data. Use --dry-run to preview, or --force to execute.`);return}console.log(i?`🔍 Dry run — no files will be deleted
16
+ `)},s;t?(console.log(`Dropping existing index for full reindex...`),s=await r.reindexAll(a,o)):s=await r.index(a,o),console.log(`Done: ${s.filesProcessed} files, ${s.chunksCreated} chunks in ${(s.durationMs/1e3).toFixed(1)}s`),console.log(`Building FTS index...`),await n.createFtsIndex(),console.log(`Re-indexing curated entries...`);let c=await i.reindexAll();console.log(`Curated: ${c.indexed} entries restored`)}},{name:`serve`,description:`Start the MCP server (stdio or HTTP)`,usage:`aikit serve [--transport stdio|http] [--port N]`,run:async e=>{let t=S(),n=y(e,`--transport`,`stdio`),r=y(e,`--port`,`3210`);try{await Hn({silent:!0})}catch{}let i=It(t,[],{stdio:n===`stdio`?[`pipe`,`pipe`,`inherit`,`ipc`]:`inherit`,env:{...process.env,AIKIT_TRANSPORT:n,AIKIT_PORT:r}});n===`stdio`&&i.stdin&&i.stdout&&(process.stdin.pipe(i.stdin),i.stdout.pipe(process.stdout)),i.on(`exit`,e=>process.exit(e??0)),process.on(`SIGINT`,()=>i.kill(`SIGINT`)),process.on(`SIGTERM`,()=>i.kill(`SIGTERM`)),await new Promise(()=>{})}},{name:`init`,description:`Initialize AI Kit in the current directory`,usage:`aikit init [--workspace] [--smart] [--force] [--guide]`,run:async e=>{let t=e.includes(`--user`),n=e.includes(`--workspace`),r=e.includes(`--smart`),i=e.includes(`--guide`),a=e.includes(`--force`);if(t&&n&&(console.error(`Cannot use --user and --workspace together.`),process.exit(1)),i){let{guideProject:e}=await import(`./init-fd-21aSJ.js`);await e();return}if(r){let{initSmart:e}=await import(`./init-fd-21aSJ.js`);await e({force:a})}else if(t)await K({force:a});else if(n){let{initProject:e}=await import(`./init-fd-21aSJ.js`);await e({force:a})}else await K({force:a})}},{name:`check`,description:`Run incremental typecheck and lint`,usage:`aikit check [--cwd <dir>] [--files f1,f2] [--skip-types] [--skip-lint] [--detail efficient|normal|full]`,run:async e=>{let t=y(e,`--cwd`,``).trim()||void 0,n=y(e,`--files`,``),r=y(e,`--detail`,`full`)||`full`,i=n.split(`,`).map(e=>e.trim()).filter(Boolean),a=!1;e.includes(`--skip-types`)&&(e.splice(e.indexOf(`--skip-types`),1),a=!0);let o=!1;e.includes(`--skip-lint`)&&(e.splice(e.indexOf(`--skip-lint`),1),o=!0);let s=await ye({cwd:t,files:i.length>0?i:void 0,skipTypes:a,skipLint:o,detail:r});h(s),s.passed||(process.exitCode=1)}},{name:`health`,description:`Run project health checks on the current directory`,usage:`aikit health [path]`,run:async e=>{let t=Be(e.shift());console.log(`Project Health: ${t.path}`),console.log(`─`.repeat(50));for(let e of t.checks){let t=e.status===`pass`?`+`:e.status===`warn`?`~`:`X`;console.log(` [${t}] ${e.name}: ${e.message}`)}console.log(`─`.repeat(50)),console.log(`Score: ${t.score}% — ${t.summary}`)}},{name:`prune`,description:`Clean up orphaned storage, legacy data, and stale partitions`,usage:`aikit prune [--dry-run] [--max-age-days=90] [--force]`,run:async e=>{let{prune:t,formatBytes:n,markPruneRun:r}=await import(`../../tools/dist/index.js`),i=e.includes(`--dry-run`),a=e.includes(`--force`),o=e.find(e=>e.startsWith(`--max-age-days=`)),s=o?Number.parseInt(o.split(`=`)[1]??``,10):90;if(!i&&!a){console.log(`⚠️ This will permanently delete data. Use --dry-run to preview, or --force to execute.`);return}console.log(i?`🔍 Dry run — no files will be deleted
17
17
  `:`🧹 Pruning storage...
18
18
  `);let c=await t({dryRun:i,maxAgeDays:s});console.log(`Results:`),console.log(` Forge-ground orphans: ${c.forgeGroundOrphans.count} dirs (${n(c.forgeGroundOrphans.bytesFreed)})`),console.log(` Legacy LanceDB: ${c.legacyLance.count} dirs (${n(c.legacyLance.bytesFreed)})`),console.log(` Empty ephemeral dirs: ${c.emptyEphemeral.count} dirs`),console.log(` Stale partitions: ${c.stalePartitions.count} dirs (${n(c.stalePartitions.bytesFreed)})`),console.log(` Browser profiles: ${c.browserProfiles.count} dirs (${n(c.browserProfiles.bytesFreed)})`),console.log(`\n Total freed: ${n(c.totalBytesFreed)}`),i||(r(),console.log(`
19
19
  ✅ Cleanup complete.`))}},{name:`audit`,description:`Run a unified project audit (structure, deps, patterns, health, dead symbols, check)`,usage:`aikit audit [path] [--checks structure,dependencies,patterns,health,dead_symbols,check,entry_points] [--detail efficient|normal|full]`,run:async e=>{let{store:t,embedder:n}=await Q(),r=y(e,`--detail`,`efficient`)||`efficient`,i=y(e,`--checks`,``),a=i?i.split(`,`).map(e=>e.trim()):void 0,o=await ve(t,n,{path:e.shift()||`.`,checks:a,detail:r});if(o.ok){if(console.log(o.summary),o.next&&o.next.length>0){console.log(`
20
- Suggested next steps:`);for(let e of o.next)console.log(` → ${e.tool}: ${e.reason}`)}}else console.error(o.error?.message??`Audit failed`),process.exitCode=1}},{name:`guide`,description:`Tool discovery — recommend AI Kit tools for a given goal`,usage:`aikit guide <goal> [--max N]`,run:async e=>{let t=e.indexOf(`--max`),n=5;t!==-1&&t+1<e.length&&(n=Number.parseInt(e.splice(t,2)[1],10)||5);let r=e.join(` `).trim();r||(console.error(`Usage: aikit guide <goal> [--max N]`),console.error(`Example: aikit guide "audit this project"`),process.exit(1));let i=ze(r,n);console.log(`Workflow: ${i.workflow}`),console.log(` ${i.description}\n`),console.log(`Recommended tools:`);for(let e of i.tools){let t=e.suggestedArgs?` ${JSON.stringify(e.suggestedArgs)}`:``;console.log(` ${e.order}. ${e.tool} — ${e.reason}${t}`)}i.alternativeWorkflows.length>0&&console.log(`\nAlternatives: ${i.alternativeWorkflows.join(`, `)}`)}},{name:`replay`,description:`Show recent tool invocation audit trail`,usage:`aikit replay [--last N] [--tool <name>] [--source mcp|cli]`,run:async e=>{let t=ft({last:Number.parseInt(e[e.indexOf(`--last`)+1],10)||20,tool:e.includes(`--tool`)?e[e.indexOf(`--tool`)+1]:void 0,source:e.includes(`--source`)?e[e.indexOf(`--source`)+1]:void 0});if(t.length===0){console.log(`No replay entries. Activity is logged when tools are invoked.`);return}console.log(`Replay Log (${t.length} entries)\n`);for(let e of t){let t=e.ts.split(`T`)[1]?.split(`.`)[0]??e.ts,n=e.status===`ok`?`✓`:`✗`;console.log(`${t} ${n} ${e.tool} (${e.durationMs}ms) [${e.source}]`),console.log(` in: ${e.input}`),console.log(` out: ${e.output}`)}pt().catch(()=>{})}},{name:`replay-clear`,description:`Clear the replay audit trail`,run:async()=>{dt(),console.log(`Replay log cleared.`)}},{name:`dashboard`,description:`Launch web dashboard for knowledge graph visualization`,usage:`aikit dashboard [--port <port>] [--no-open]`,run:async e=>{let t=e.indexOf(`--port`),n=t!==-1&&e[t+1]?Number.parseInt(e[t+1],10):3210,r=Number.isFinite(n)?n:3210,i=e.includes(`--no-open`);console.log(`Starting AI Kit server on port ${r}...`);let{spawn:a}=await import(`node:child_process`),{platform:o}=await import(`node:os`),s=S(),c=a(process.execPath,[s,`--transport`,`http`,`--port`,String(r)],{stdio:[`ignore`,`pipe`,`pipe`],env:{...process.env,AIKIT_TRANSPORT:`http`,AIKIT_PORT:String(r)}}),l=`http://localhost:${r}/_dashboard/`,u=`http://localhost:${r}/health`,d=!1;for(let e=0;e<30;e+=1){try{if((await fetch(u)).ok){d=!0;break}}catch{}await new Promise(e=>setTimeout(e,1e3))}if(d||(console.error(`Server failed to start within 30 seconds.`),c.kill(),process.exit(1)),console.log(`AI Kit Dashboard: ${l}`),console.log(`Press Ctrl+C to stop.`),!i){let e=o();e===`win32`?a(`cmd`,[`/c`,`start`,``,l],{stdio:`ignore`,detached:!0}).unref():a(e===`darwin`?`open`:`xdg-open`,[l],{stdio:`ignore`,detached:!0}).unref()}let f=()=>{c.kill(),process.exit(0)};process.on(`SIGINT`,f),process.on(`SIGTERM`,f),await new Promise(e=>{c.on(`exit`,()=>e())})}},{name:`settings`,description:`Launch web UI to manage AI Kit configuration and environment variables`,usage:`aikit settings [--port <port>] [--no-open]`,run:async e=>{let t=e.indexOf(`--port`),n=t!==-1&&e[t+1]?Number.parseInt(e[t+1],10):3210,r=Number.isFinite(n)?n:3210,i=e.includes(`--no-open`);console.log(`Starting AI Kit server on port ${r}...`);let{spawn:a}=await import(`node:child_process`),{platform:o}=await import(`node:os`),s=S(),c=a(process.execPath,[s,`--transport`,`http`,`--port`,String(r)],{stdio:[`ignore`,`pipe`,`pipe`],env:{...process.env,AIKIT_TRANSPORT:`http`,AIKIT_PORT:String(r)}}),l=`http://localhost:${r}/settings/`,u=`http://localhost:${r}/health`,d=!1;for(let e=0;e<30;e+=1){try{if((await fetch(u)).ok){d=!0;break}}catch{}await new Promise(e=>setTimeout(e,1e3))}if(d||(console.error(`Server failed to start within 30 seconds.`),c.kill(),process.exit(1)),console.log(`AI Kit Settings: ${l}`),console.log(`Press Ctrl+C to stop.`),!i){let e=o();e===`win32`?a(`cmd`,[`/c`,`start`,``,l],{stdio:`ignore`,detached:!0}).unref():a(e===`darwin`?`open`:`xdg-open`,[l],{stdio:`ignore`,detached:!0}).unref()}let f=()=>{c.kill(),process.exit(0)};process.on(`SIGINT`,f),process.on(`SIGTERM`,f),await new Promise(e=>{c.on(`exit`,()=>e())})}}],ar=[{name:`upgrade`,description:`Upgrade AI Kit agents, prompts, and skills to the latest version (user-level and workspace-level)`,usage:`aikit upgrade`,run:async()=>{await K({force:!0});let e=process.cwd();if(k(L(e,`.github`,`.aikit-scaffold.json`))){let{initScaffoldOnly:e}=await import(`./init-o6szsZIP.js`);await e({force:!0})}if(k(L(e,`.github`,`skills`))){let{smartCopySkills:t}=await import(`./scaffold-BnhmnBfn.js`).then(e=>e.a),n=ae(),r=T();await t(e,n,[...ie],r,!0);let{smartCopyFlows:i}=await import(`./scaffold-BnhmnBfn.js`).then(e=>e.a);await i(e,n,[...oe],r,!0)}let{homedir:t}=await import(`node:os`),{rmSync:n}=await import(`node:fs`),r=F(t(),`.aikit`,`cache`,`wasm`);if(k(r))try{n(r,{recursive:!0,force:!0}),console.log(`✓ WASM cache cleared (will re-resolve on next start)`)}catch{console.warn(`⚠ Could not clear WASM cache at`,r)}}}],or=[{name:`workset`,description:`Manage saved file sets`,usage:`aikit workset <action> [name] [--files f1,f2] [--description desc]`,run:async e=>{let t=e.shift()?.trim(),n=f(y(e,`--files`,``)),r=y(e,`--description`,``).trim()||void 0,i=e.shift()?.trim();switch(t||(console.error(`Usage: aikit workset <action> [name] [--files f1,f2] [--description desc]`),console.error(`Actions: save, get, list, delete, add, remove`),process.exit(1)),t){case`save`:{(!i||n.length===0)&&(console.error(`Usage: aikit workset save <name> --files f1,f2 [--description desc]`),process.exit(1));let e=mt(i,n,{description:r});console.log(`Saved workset: ${e.name}`),C(e);return}case`get`:{i||(console.error(`Usage: aikit workset get <name>`),process.exit(1));let e=Ie(i);if(!e){console.log(`No workset found: ${i}`);return}C(e);return}case`list`:{let e=qe();if(e.length===0){console.log(`No worksets saved.`);return}console.log(`Worksets (${e.length})`),console.log(`─`.repeat(60));for(let t of e)C(t),console.log(``);return}case`delete`:{i||(console.error(`Usage: aikit workset delete <name>`),process.exit(1));let e=ke(i);console.log(e?`Deleted workset: ${i}`:`No workset found: ${i}`);return}case`add`:{(!i||n.length===0)&&(console.error(`Usage: aikit workset add <name> --files f1,f2`),process.exit(1));let e=_e(i,n);console.log(`Updated workset: ${e.name}`),C(e);return}case`remove`:{(!i||n.length===0)&&(console.error(`Usage: aikit workset remove <name> --files f1,f2`),process.exit(1));let e=lt(i,n);if(!e){console.log(`No workset found: ${i}`);return}console.log(`Updated workset: ${e.name}`),C(e);return}default:console.error(`Unknown workset action: ${t}`),console.error(`Actions: save, get, list, delete, add, remove`),process.exit(1)}}},{name:`stash`,description:`Persist and retrieve named intermediate values`,usage:`aikit stash <set|get|list|delete|clear> [key] [value]`,run:async e=>{let t=e.shift()?.trim(),n=e.shift()?.trim();t||(console.error(`Usage: aikit stash <set|get|list|delete|clear> [key] [value]`),process.exit(1));let r=await v();switch(t){case`set`:{n||(console.error(`Usage: aikit stash set <key> <value>`),process.exit(1));let t=e.join(` `),i=t.trim()?``:await s(),a=bt(r,n,ne(t||i));console.log(`Stored stash entry: ${a.key}`),console.log(` Type: ${a.type}`),console.log(` Stored: ${a.storedAt}`);return}case`get`:{n||(console.error(`Usage: aikit stash get <key>`),process.exit(1));let e=vt(r,n);if(!e){console.log(`No stash entry found: ${n}`);return}console.log(JSON.stringify(e,null,2));return}case`list`:{let e=yt(r);if(e.length===0){console.log(`No stash entries saved.`);return}console.log(`Stash entries (${e.length})`),console.log(`─`.repeat(60));for(let t of e)console.log(`${t.key} (${t.type})`),console.log(` Stored: ${t.storedAt}`);return}case`delete`:{n||(console.error(`Usage: aikit stash delete <key>`),process.exit(1));let e=_t(r,n);console.log(e?`Deleted stash entry: ${n}`:`No stash entry found: ${n}`);return}case`clear`:{let e=gt(r);console.log(`Cleared ${e} stash entr${e===1?`y`:`ies`}.`);return}default:console.error(`Unknown stash action: ${t}`),console.error(`Actions: set, get, list, delete, clear`),process.exit(1)}}},{name:`lane`,description:`Manage verified lanes — isolated file copies for parallel exploration`,usage:`aikit lane <create|list|status|diff|merge|discard> [name] [--files f1,f2]`,run:async e=>{let t=e.shift();if((!t||![`create`,`list`,`status`,`diff`,`merge`,`discard`].includes(t))&&(console.error(`Usage: aikit lane <create|list|status|diff|merge|discard> [name] [--files f1,f2]`),process.exit(1)),t===`list`){let e=We();if(e.length===0){console.log(`No active lanes.`);return}for(let t of e)console.log(`${t.name} (${t.sourceFiles.length} files, created ${t.createdAt})`);return}let n=e.shift();switch(n||(console.error(`Lane name is required for "${t}".`),process.exit(1)),t){case`create`:{let t=y(e,`--files`,``);t||(console.error(`Usage: aikit lane create <name> --files file1.ts,file2.ts`),process.exit(1));let r=Ve(n,t.split(`,`).map(e=>e.trim()));console.log(`Lane "${r.name}" created with ${r.sourceFiles.length} files.`);break}case`status`:{let e=Ke(n);console.log(`Lane: ${e.name}`),console.log(`Modified: ${e.modified} | Added: ${e.added} | Deleted: ${e.deleted}`);for(let t of e.entries)console.log(` ${t.status.padEnd(10)} ${t.file}`);break}case`diff`:{let e=He(n);console.log(`Lane: ${e.name} — ${e.modified} modified, ${e.added} added, ${e.deleted} deleted`);for(let t of e.entries)t.diff&&(console.log(`\n--- ${t.file} (${t.status})`),console.log(t.diff));break}case`merge`:{let e=Ge(n);console.log(`Merged ${e.filesMerged} files from lane "${e.name}".`);for(let t of e.files)console.log(` ${t}`);break}case`discard`:{let e=Ue(n);console.log(e?`Lane "${n}" discarded.`:`Lane "${n}" not found.`);break}}}},{name:`queue`,description:`Manage task queues for sequential agent operations`,usage:`aikit queue <create|push|next|done|fail|get|list|clear|delete> [name] [args]`,run:async e=>{let t=e.shift();if((!t||![`create`,`push`,`next`,`done`,`fail`,`get`,`list`,`clear`,`delete`].includes(t))&&(console.error(`Usage: aikit queue <create|push|next|done|fail|get|list|clear|delete> [name] [args]`),process.exit(1)),t===`list`){let e=ot();if(e.length===0){console.log(`No queues.`);return}for(let t of e)console.log(`${t.name} pending:${t.pending} done:${t.done} failed:${t.failed} total:${t.total}`);return}let n=e.shift();switch(n||(console.error(`Queue name is required for "${t}".`),process.exit(1)),t){case`create`:{let e=tt(n);console.log(`Queue "${e.name}" created.`);break}case`push`:{let t=ct(n,e.join(` `)||`Untitled task`);console.log(`Pushed "${t.title}" (${t.id}) to queue "${n}".`);break}case`next`:{let e=st(n);console.log(e?`Next: ${e.title} (${e.id})`:`No pending items in queue "${n}".`);break}case`done`:{let t=e.shift();t||(console.error(`Usage: aikit queue done <name> <id>`),process.exit(1));let r=rt(n,t);console.log(`Marked "${r.item.title}" as done.`);break}case`fail`:{let t=e.shift(),r=e.join(` `)||`Unknown error`;t||(console.error(`Usage: aikit queue fail <name> <id> [error message]`),process.exit(1));let i=it(n,t,r);console.log(`Marked "${i.title}" as failed: ${r}`);break}case`get`:{let e=at(n);if(!e){console.log(`Queue "${n}" not found.`);return}console.log(`Queue: ${e.name} (${e.items.length} items)`);for(let t of e.items){let e=t.error?` — ${t.error}`:``;console.log(` ${t.status.padEnd(12)} ${t.id} ${t.title}${e}`)}break}case`clear`:{let e=et(n);console.log(`Cleared ${e} completed/failed items from queue "${n}".`);break}case`delete`:{let e=nt(n);console.log(e?`Queue "${n}" deleted.`:`Queue "${n}" not found.`);break}}}}],$=[...rr,...nr,...Gt,...tr,...ir,...Gn,...Kt,...or,...Wn,...ar,...$n,...Un];$.push({name:`help`,description:`Show available commands`,run:async()=>{cr()}});async function sr(e){let t=[...e],n=t.shift();if(!n||n===`--help`||n===`-h`){cr();return}if(n===`--version`||n===`-v`){let e=L(P(ge(import.meta.url)),`..`,`..`,`..`,`package.json`),t=JSON.parse(j(e,`utf-8`));console.log(t.version);return}if(n&&new Set([`--user`,`--workspace`,`--guide`,`--smart`]).has(n)){let e=$.find(e=>e.name===`init`);if(e){await e.run([n,...t]);return}}let r=$.find(e=>e.name===n);r||(console.error(`Unknown command: ${n}`),cr(),process.exit(1));try{await r.run(t)}finally{let e=er();e&&await e.store.close()}}function cr(){console.log(`@vpxa/aikit — Local-first AI developer toolkit
20
+ Suggested next steps:`);for(let e of o.next)console.log(` → ${e.tool}: ${e.reason}`)}}else console.error(o.error?.message??`Audit failed`),process.exitCode=1}},{name:`guide`,description:`Tool discovery — recommend AI Kit tools for a given goal`,usage:`aikit guide <goal> [--max N]`,run:async e=>{let t=e.indexOf(`--max`),n=5;t!==-1&&t+1<e.length&&(n=Number.parseInt(e.splice(t,2)[1],10)||5);let r=e.join(` `).trim();r||(console.error(`Usage: aikit guide <goal> [--max N]`),console.error(`Example: aikit guide "audit this project"`),process.exit(1));let i=ze(r,n);console.log(`Workflow: ${i.workflow}`),console.log(` ${i.description}\n`),console.log(`Recommended tools:`);for(let e of i.tools){let t=e.suggestedArgs?` ${JSON.stringify(e.suggestedArgs)}`:``;console.log(` ${e.order}. ${e.tool} — ${e.reason}${t}`)}i.alternativeWorkflows.length>0&&console.log(`\nAlternatives: ${i.alternativeWorkflows.join(`, `)}`)}},{name:`replay`,description:`Show recent tool invocation audit trail`,usage:`aikit replay [--last N] [--tool <name>] [--source mcp|cli]`,run:async e=>{let t=ft({last:Number.parseInt(e[e.indexOf(`--last`)+1],10)||20,tool:e.includes(`--tool`)?e[e.indexOf(`--tool`)+1]:void 0,source:e.includes(`--source`)?e[e.indexOf(`--source`)+1]:void 0});if(t.length===0){console.log(`No replay entries. Activity is logged when tools are invoked.`);return}console.log(`Replay Log (${t.length} entries)\n`);for(let e of t){let t=e.ts.split(`T`)[1]?.split(`.`)[0]??e.ts,n=e.status===`ok`?`✓`:`✗`;console.log(`${t} ${n} ${e.tool} (${e.durationMs}ms) [${e.source}]`),console.log(` in: ${e.input}`),console.log(` out: ${e.output}`)}pt().catch(()=>{})}},{name:`replay-clear`,description:`Clear the replay audit trail`,run:async()=>{dt(),console.log(`Replay log cleared.`)}},{name:`dashboard`,description:`Launch web dashboard for knowledge graph visualization`,usage:`aikit dashboard [--port <port>] [--no-open]`,run:async e=>{let t=e.indexOf(`--port`),n=t!==-1&&e[t+1]?Number.parseInt(e[t+1],10):3210,r=Number.isFinite(n)?n:3210,i=e.includes(`--no-open`);console.log(`Starting AI Kit server on port ${r}...`);let{spawn:a}=await import(`node:child_process`),{platform:o}=await import(`node:os`),s=S(),c=a(process.execPath,[s,`--transport`,`http`,`--port`,String(r)],{stdio:[`ignore`,`pipe`,`pipe`],env:{...process.env,AIKIT_TRANSPORT:`http`,AIKIT_PORT:String(r)}}),l=`http://localhost:${r}/_dashboard/`,u=`http://localhost:${r}/health`,d=!1;for(let e=0;e<30;e+=1){try{if((await fetch(u)).ok){d=!0;break}}catch{}await new Promise(e=>setTimeout(e,1e3))}if(d||(console.error(`Server failed to start within 30 seconds.`),c.kill(),process.exit(1)),console.log(`AI Kit Dashboard: ${l}`),console.log(`Press Ctrl+C to stop.`),!i){let e=o();e===`win32`?a(`cmd`,[`/c`,`start`,``,l],{stdio:`ignore`,detached:!0}).unref():a(e===`darwin`?`open`:`xdg-open`,[l],{stdio:`ignore`,detached:!0}).unref()}let f=()=>{c.kill(),process.exit(0)};process.on(`SIGINT`,f),process.on(`SIGTERM`,f),await new Promise(e=>{c.on(`exit`,()=>e())})}},{name:`settings`,description:`Launch web UI to manage AI Kit configuration and environment variables`,usage:`aikit settings [--port <port>] [--no-open]`,run:async e=>{let t=e.indexOf(`--port`),n=t!==-1&&e[t+1]?Number.parseInt(e[t+1],10):3210,r=Number.isFinite(n)?n:3210,i=e.includes(`--no-open`);console.log(`Starting AI Kit server on port ${r}...`);let{spawn:a}=await import(`node:child_process`),{platform:o}=await import(`node:os`),s=S(),c=a(process.execPath,[s,`--transport`,`http`,`--port`,String(r)],{stdio:[`ignore`,`pipe`,`pipe`],env:{...process.env,AIKIT_TRANSPORT:`http`,AIKIT_PORT:String(r)}}),l=`http://localhost:${r}/settings/`,u=`http://localhost:${r}/health`,d=!1;for(let e=0;e<30;e+=1){try{if((await fetch(u)).ok){d=!0;break}}catch{}await new Promise(e=>setTimeout(e,1e3))}if(d||(console.error(`Server failed to start within 30 seconds.`),c.kill(),process.exit(1)),console.log(`AI Kit Settings: ${l}`),console.log(`Press Ctrl+C to stop.`),!i){let e=o();e===`win32`?a(`cmd`,[`/c`,`start`,``,l],{stdio:`ignore`,detached:!0}).unref():a(e===`darwin`?`open`:`xdg-open`,[l],{stdio:`ignore`,detached:!0}).unref()}let f=()=>{c.kill(),process.exit(0)};process.on(`SIGINT`,f),process.on(`SIGTERM`,f),await new Promise(e=>{c.on(`exit`,()=>e())})}}],ar=[{name:`upgrade`,description:`Upgrade AI Kit agents, prompts, and skills to the latest version (user-level and workspace-level)`,usage:`aikit upgrade`,run:async()=>{await K({force:!0});let e=process.cwd();if(k(L(e,`.github`,`.aikit-scaffold.json`))){let{initScaffoldOnly:e}=await import(`./init-fd-21aSJ.js`);await e({force:!0})}if(k(L(e,`.github`,`skills`))){let{smartCopySkills:t}=await import(`./scaffold-BnhmnBfn.js`).then(e=>e.a),n=ae(),r=T();await t(e,n,[...ie],r,!0);let{smartCopyFlows:i}=await import(`./scaffold-BnhmnBfn.js`).then(e=>e.a);await i(e,n,[...oe],r,!0)}let{homedir:t}=await import(`node:os`),{rmSync:n}=await import(`node:fs`),r=F(t(),`.aikit`,`cache`,`wasm`);if(k(r))try{n(r,{recursive:!0,force:!0}),console.log(`✓ WASM cache cleared (will re-resolve on next start)`)}catch{console.warn(`⚠ Could not clear WASM cache at`,r)}}}],or=[{name:`workset`,description:`Manage saved file sets`,usage:`aikit workset <action> [name] [--files f1,f2] [--description desc]`,run:async e=>{let t=e.shift()?.trim(),n=f(y(e,`--files`,``)),r=y(e,`--description`,``).trim()||void 0,i=e.shift()?.trim();switch(t||(console.error(`Usage: aikit workset <action> [name] [--files f1,f2] [--description desc]`),console.error(`Actions: save, get, list, delete, add, remove`),process.exit(1)),t){case`save`:{(!i||n.length===0)&&(console.error(`Usage: aikit workset save <name> --files f1,f2 [--description desc]`),process.exit(1));let e=mt(i,n,{description:r});console.log(`Saved workset: ${e.name}`),C(e);return}case`get`:{i||(console.error(`Usage: aikit workset get <name>`),process.exit(1));let e=Ie(i);if(!e){console.log(`No workset found: ${i}`);return}C(e);return}case`list`:{let e=qe();if(e.length===0){console.log(`No worksets saved.`);return}console.log(`Worksets (${e.length})`),console.log(`─`.repeat(60));for(let t of e)C(t),console.log(``);return}case`delete`:{i||(console.error(`Usage: aikit workset delete <name>`),process.exit(1));let e=ke(i);console.log(e?`Deleted workset: ${i}`:`No workset found: ${i}`);return}case`add`:{(!i||n.length===0)&&(console.error(`Usage: aikit workset add <name> --files f1,f2`),process.exit(1));let e=_e(i,n);console.log(`Updated workset: ${e.name}`),C(e);return}case`remove`:{(!i||n.length===0)&&(console.error(`Usage: aikit workset remove <name> --files f1,f2`),process.exit(1));let e=lt(i,n);if(!e){console.log(`No workset found: ${i}`);return}console.log(`Updated workset: ${e.name}`),C(e);return}default:console.error(`Unknown workset action: ${t}`),console.error(`Actions: save, get, list, delete, add, remove`),process.exit(1)}}},{name:`stash`,description:`Persist and retrieve named intermediate values`,usage:`aikit stash <set|get|list|delete|clear> [key] [value]`,run:async e=>{let t=e.shift()?.trim(),n=e.shift()?.trim();t||(console.error(`Usage: aikit stash <set|get|list|delete|clear> [key] [value]`),process.exit(1));let r=await v();switch(t){case`set`:{n||(console.error(`Usage: aikit stash set <key> <value>`),process.exit(1));let t=e.join(` `),i=t.trim()?``:await s(),a=bt(r,n,ne(t||i));console.log(`Stored stash entry: ${a.key}`),console.log(` Type: ${a.type}`),console.log(` Stored: ${a.storedAt}`);return}case`get`:{n||(console.error(`Usage: aikit stash get <key>`),process.exit(1));let e=vt(r,n);if(!e){console.log(`No stash entry found: ${n}`);return}console.log(JSON.stringify(e,null,2));return}case`list`:{let e=yt(r);if(e.length===0){console.log(`No stash entries saved.`);return}console.log(`Stash entries (${e.length})`),console.log(`─`.repeat(60));for(let t of e)console.log(`${t.key} (${t.type})`),console.log(` Stored: ${t.storedAt}`);return}case`delete`:{n||(console.error(`Usage: aikit stash delete <key>`),process.exit(1));let e=_t(r,n);console.log(e?`Deleted stash entry: ${n}`:`No stash entry found: ${n}`);return}case`clear`:{let e=gt(r);console.log(`Cleared ${e} stash entr${e===1?`y`:`ies`}.`);return}default:console.error(`Unknown stash action: ${t}`),console.error(`Actions: set, get, list, delete, clear`),process.exit(1)}}},{name:`lane`,description:`Manage verified lanes — isolated file copies for parallel exploration`,usage:`aikit lane <create|list|status|diff|merge|discard> [name] [--files f1,f2]`,run:async e=>{let t=e.shift();if((!t||![`create`,`list`,`status`,`diff`,`merge`,`discard`].includes(t))&&(console.error(`Usage: aikit lane <create|list|status|diff|merge|discard> [name] [--files f1,f2]`),process.exit(1)),t===`list`){let e=We();if(e.length===0){console.log(`No active lanes.`);return}for(let t of e)console.log(`${t.name} (${t.sourceFiles.length} files, created ${t.createdAt})`);return}let n=e.shift();switch(n||(console.error(`Lane name is required for "${t}".`),process.exit(1)),t){case`create`:{let t=y(e,`--files`,``);t||(console.error(`Usage: aikit lane create <name> --files file1.ts,file2.ts`),process.exit(1));let r=Ve(n,t.split(`,`).map(e=>e.trim()));console.log(`Lane "${r.name}" created with ${r.sourceFiles.length} files.`);break}case`status`:{let e=Ke(n);console.log(`Lane: ${e.name}`),console.log(`Modified: ${e.modified} | Added: ${e.added} | Deleted: ${e.deleted}`);for(let t of e.entries)console.log(` ${t.status.padEnd(10)} ${t.file}`);break}case`diff`:{let e=He(n);console.log(`Lane: ${e.name} — ${e.modified} modified, ${e.added} added, ${e.deleted} deleted`);for(let t of e.entries)t.diff&&(console.log(`\n--- ${t.file} (${t.status})`),console.log(t.diff));break}case`merge`:{let e=Ge(n);console.log(`Merged ${e.filesMerged} files from lane "${e.name}".`);for(let t of e.files)console.log(` ${t}`);break}case`discard`:{let e=Ue(n);console.log(e?`Lane "${n}" discarded.`:`Lane "${n}" not found.`);break}}}},{name:`queue`,description:`Manage task queues for sequential agent operations`,usage:`aikit queue <create|push|next|done|fail|get|list|clear|delete> [name] [args]`,run:async e=>{let t=e.shift();if((!t||![`create`,`push`,`next`,`done`,`fail`,`get`,`list`,`clear`,`delete`].includes(t))&&(console.error(`Usage: aikit queue <create|push|next|done|fail|get|list|clear|delete> [name] [args]`),process.exit(1)),t===`list`){let e=ot();if(e.length===0){console.log(`No queues.`);return}for(let t of e)console.log(`${t.name} pending:${t.pending} done:${t.done} failed:${t.failed} total:${t.total}`);return}let n=e.shift();switch(n||(console.error(`Queue name is required for "${t}".`),process.exit(1)),t){case`create`:{let e=tt(n);console.log(`Queue "${e.name}" created.`);break}case`push`:{let t=ct(n,e.join(` `)||`Untitled task`);console.log(`Pushed "${t.title}" (${t.id}) to queue "${n}".`);break}case`next`:{let e=st(n);console.log(e?`Next: ${e.title} (${e.id})`:`No pending items in queue "${n}".`);break}case`done`:{let t=e.shift();t||(console.error(`Usage: aikit queue done <name> <id>`),process.exit(1));let r=rt(n,t);console.log(`Marked "${r.item.title}" as done.`);break}case`fail`:{let t=e.shift(),r=e.join(` `)||`Unknown error`;t||(console.error(`Usage: aikit queue fail <name> <id> [error message]`),process.exit(1));let i=it(n,t,r);console.log(`Marked "${i.title}" as failed: ${r}`);break}case`get`:{let e=at(n);if(!e){console.log(`Queue "${n}" not found.`);return}console.log(`Queue: ${e.name} (${e.items.length} items)`);for(let t of e.items){let e=t.error?` — ${t.error}`:``;console.log(` ${t.status.padEnd(12)} ${t.id} ${t.title}${e}`)}break}case`clear`:{let e=et(n);console.log(`Cleared ${e} completed/failed items from queue "${n}".`);break}case`delete`:{let e=nt(n);console.log(e?`Queue "${n}" deleted.`:`Queue "${n}" not found.`);break}}}}],$=[...rr,...nr,...Gt,...tr,...ir,...Gn,...Kt,...or,...Wn,...ar,...$n,...Un];$.push({name:`help`,description:`Show available commands`,run:async()=>{cr()}});async function sr(e){let t=[...e],n=t.shift();if(!n||n===`--help`||n===`-h`){cr();return}if(n===`--version`||n===`-v`){let e=L(P(ge(import.meta.url)),`..`,`..`,`..`,`package.json`),t=JSON.parse(j(e,`utf-8`));console.log(t.version);return}if(n&&new Set([`--user`,`--workspace`,`--guide`,`--smart`]).has(n)){let e=$.find(e=>e.name===`init`);if(e){await e.run([n,...t]);return}}let r=$.find(e=>e.name===n);r||(console.error(`Unknown command: ${n}`),cr(),process.exit(1));try{await r.run(t)}finally{let e=er();e&&await e.store.close()}}function cr(){console.log(`@vpxa/aikit — Local-first AI developer toolkit
21
21
  `),console.log(`Usage: aikit <command> [options]
22
22
  `),console.log(`Commands:`);let e=Math.max(...$.map(e=>e.name.length));for(let t of $)console.log(` ${t.name.padEnd(e+2)}${t.description}`);console.log(``),console.log(`Options:`),console.log(` --help, -h Show this help`),console.log(` --version, -v Show version`)}export{sr as run};
@@ -1,4 +1,4 @@
1
- import{c as e,l as t,n,o as r,r as i,t as a}from"./scaffold-BnhmnBfn.js";import{a as o,i as s,n as c,o as l,p as u,r as d,t as f}from"./templates-guQ2153Z.js";import{appendFileSync as p,existsSync as m,mkdirSync as h,readFileSync as g,unlinkSync as _,writeFileSync as v}from"node:fs";import{basename as y,resolve as b}from"node:path";import{AIKIT_PATHS as x,EMBEDDING_DEFAULTS as S,isUserInstalled as C}from"../../core/dist/index.js";function w(e){return m(b(e,`.cursor`))?`cursor`:m(b(e,`.claude`))?`claude-code`:m(b(e,`.windsurf`))?`windsurf`:m(b(e,`.zed`))?`zed`:m(b(e,`.idea`))?`intellij`:`copilot`}function T(e){let t=[];return m(b(e,`.cursor`))&&t.push(`cursor`),(m(b(e,`.claude`))||m(b(e,`CLAUDE.md`)))&&t.push(`claude-code`),m(b(e,`.windsurf`))&&t.push(`windsurf`),m(b(e,`.zed`))&&t.push(`zed`),m(b(e,`.idea`))&&t.push(`intellij`),m(b(e,`.gemini`))&&t.push(`gemini-cli`),(m(b(e,`.codex`))||m(b(e,`codex.md`)))&&t.push(`codex-cli`),t.push(`copilot`),[...new Set(t)]}function E(e){return{servers:{[e]:{...s}}}}function D(e){let{type:t,...n}=s;return{mcpServers:{[e]:n}}}function O(e){let{type:t,...n}=s;return{context_servers:{[e]:{...n}}}}const k={scaffoldDir:`general`,writeMcpConfig(e,t){let n=b(e,`.vscode`),r=b(n,`mcp.json`);m(r)||(h(n,{recursive:!0}),v(r,`${JSON.stringify(E(t),null,2)}\n`,`utf-8`),console.log(` Created .vscode/mcp.json`))},writeInstructions(e,t){let n=b(e,`.github`),r=b(n,`copilot-instructions.md`);h(n,{recursive:!0}),v(r,c(y(e),t),`utf-8`),console.log(` Updated .github/copilot-instructions.md`)},writeAgentsMd(e,t){v(b(e,`AGENTS.md`),f(y(e),t),`utf-8`),console.log(` Updated AGENTS.md`)}},A={scaffoldDir:`general`,writeMcpConfig(e,t){let n=b(e,`.mcp.json`);m(n)||(v(n,`${JSON.stringify(D(t),null,2)}\n`,`utf-8`),console.log(` Created .mcp.json`))},writeInstructions(e,t){let n=b(e,`CLAUDE.md`),r=y(e);v(n,`${c(r,t)}\n---\n\n${f(r,t)}`,`utf-8`),console.log(` Updated CLAUDE.md`)},writeAgentsMd(e,t){}},j={scaffoldDir:`general`,writeMcpConfig(e,t){let n=b(e,`.cursor`),r=b(n,`mcp.json`);m(r)||(h(n,{recursive:!0}),v(r,`${JSON.stringify(D(t),null,2)}\n`,`utf-8`),console.log(` Created .cursor/mcp.json`))},writeInstructions(e,t){let n=b(e,`.cursor`,`rules`),r=b(n,`aikit.mdc`);h(n,{recursive:!0});let i=y(e);v(r,`${c(i,t)}\n---\n\n${f(i,t)}`,`utf-8`),console.log(` Updated .cursor/rules/aikit.mdc`);let a=b(n,`kb.mdc`);m(a)&&a!==r&&(_(a),console.log(` Removed legacy .cursor/rules/kb.mdc`))},writeAgentsMd(e,t){}},M={scaffoldDir:`general`,writeMcpConfig(e,t){let n=b(e,`.vscode`),r=b(n,`mcp.json`);m(r)||(h(n,{recursive:!0}),v(r,`${JSON.stringify(E(t),null,2)}\n`,`utf-8`),console.log(` Created .vscode/mcp.json (Windsurf-compatible)`))},writeInstructions(e,t){let n=b(e,`.windsurfrules`),r=y(e);v(n,`${c(r,t)}\n---\n\n${f(r,t)}`,`utf-8`),console.log(` Updated .windsurfrules`)},writeAgentsMd(e,t){}},N={scaffoldDir:`general`,writeMcpConfig(e,t){let n=b(e,`.zed`),r=b(n,`settings.json`);if(h(n,{recursive:!0}),!m(r))v(r,`${JSON.stringify(O(t),null,2)}\n`,`utf-8`),console.log(` Created .zed/settings.json`);else{let e;try{e=JSON.parse(g(r,`utf-8`))}catch{console.warn(` ⚠ .zed/settings.json contains invalid JSON — skipping MCP config merge`);return}e.context_servers?.[t]||(e.context_servers={...e.context_servers,...O(t).context_servers},v(r,`${JSON.stringify(e,null,2)}\n`,`utf-8`),console.log(` Updated .zed/settings.json with context_servers`))}},writeInstructions(e,t){let n=b(e,`.rules`),r=y(e);v(n,`${c(r,t)}\n---\n\n${f(r,t)}`,`utf-8`),console.log(` Updated .rules`)},writeAgentsMd(e,t){}},P={scaffoldDir:`general`,writeMcpConfig(e,t){let n=b(e,`mcp.json`);m(n)||(v(n,`${JSON.stringify(D(t),null,2)}\n`,`utf-8`),console.log(` Created mcp.json`))},writeInstructions(e,t){let n=b(e,`.aiassistant`,`rules`),r=b(n,`aikit.md`);h(n,{recursive:!0});let i=y(e);v(r,`${c(i,t)}\n---\n\n${f(i,t)}`,`utf-8`),console.log(` Updated .aiassistant/rules/aikit.md`)},writeAgentsMd(e,t){}};function F(e){switch(e){case`copilot`:return k;case`claude-code`:return A;case`cursor`:return j;case`windsurf`:return M;case`zed`:return N;case`intellij`:return P;case`gemini-cli`:case`codex-cli`:return k}}const I={serverName:o,sources:[{path:`.`,excludePatterns:[`**/node_modules/**`,`**/dist/**`,`**/build/**`,`**/.git/**`,`**/${x.data}/**`,`**/coverage/**`,`**/*.min.js`,`**/package-lock.json`,`**/pnpm-lock.yaml`]}],indexing:{chunkSize:1500,chunkOverlap:200,minChunkSize:100},embedding:{model:S.model,dimensions:S.dimensions},store:{backend:`sqlite-vec`,path:x.data},curated:{path:x.aiCurated}};function L(e,t){let n=b(e,`aikit.config.json`);return m(n)&&!t?(console.log(`aikit.config.json already exists. Use --force to overwrite.`),!1):(v(n,`${JSON.stringify(I,null,2)}\n`,`utf-8`),console.log(` Created aikit.config.json`),!0)}function R(e){let t=b(e,`.gitignore`),n=[{dir:`${x.data}/`,label:`AI Kit vector store`},{dir:`${x.state}/`,label:`AI Kit session state`},{dir:`${x.restorePoints}/`,label:`Restore points (codemod/rename undo snapshots)`},{dir:`${x.brainstorm}/`,label:`Brainstorming sessions`},{dir:`${x.handoffs}/`,label:`Handoff documents`}];if(m(t)){let e=g(t,`utf-8`),r=n.filter(t=>!e.includes(t.dir));r.length>0&&(p(t,`\n${r.map(e=>`# ${e.label}\n${e.dir}`).join(`
1
+ import{c as e,l as t,n,o as r,r as i,t as a}from"./scaffold-BnhmnBfn.js";import{a as o,i as s,n as c,o as l,p as u,r as d,t as f}from"./templates-CdHbXhGF.js";import{appendFileSync as p,existsSync as m,mkdirSync as h,readFileSync as g,unlinkSync as _,writeFileSync as v}from"node:fs";import{basename as y,resolve as b}from"node:path";import{AIKIT_PATHS as x,EMBEDDING_DEFAULTS as S,isUserInstalled as C}from"../../core/dist/index.js";function w(e){return m(b(e,`.cursor`))?`cursor`:m(b(e,`.claude`))?`claude-code`:m(b(e,`.windsurf`))?`windsurf`:m(b(e,`.zed`))?`zed`:m(b(e,`.idea`))?`intellij`:`copilot`}function T(e){let t=[];return m(b(e,`.cursor`))&&t.push(`cursor`),(m(b(e,`.claude`))||m(b(e,`CLAUDE.md`)))&&t.push(`claude-code`),m(b(e,`.windsurf`))&&t.push(`windsurf`),m(b(e,`.zed`))&&t.push(`zed`),m(b(e,`.idea`))&&t.push(`intellij`),m(b(e,`.gemini`))&&t.push(`gemini-cli`),(m(b(e,`.codex`))||m(b(e,`codex.md`)))&&t.push(`codex-cli`),t.push(`copilot`),[...new Set(t)]}function E(e){return{servers:{[e]:{...s}}}}function D(e){let{type:t,...n}=s;return{mcpServers:{[e]:n}}}function O(e){let{type:t,...n}=s;return{context_servers:{[e]:{...n}}}}const k={scaffoldDir:`general`,writeMcpConfig(e,t){let n=b(e,`.vscode`),r=b(n,`mcp.json`);m(r)||(h(n,{recursive:!0}),v(r,`${JSON.stringify(E(t),null,2)}\n`,`utf-8`),console.log(` Created .vscode/mcp.json`))},writeInstructions(e,t){let n=b(e,`.github`),r=b(n,`copilot-instructions.md`);h(n,{recursive:!0}),v(r,c(y(e),t),`utf-8`),console.log(` Updated .github/copilot-instructions.md`)},writeAgentsMd(e,t){v(b(e,`AGENTS.md`),f(y(e),t),`utf-8`),console.log(` Updated AGENTS.md`)}},A={scaffoldDir:`general`,writeMcpConfig(e,t){let n=b(e,`.mcp.json`);m(n)||(v(n,`${JSON.stringify(D(t),null,2)}\n`,`utf-8`),console.log(` Created .mcp.json`))},writeInstructions(e,t){let n=b(e,`CLAUDE.md`),r=y(e);v(n,`${c(r,t)}\n---\n\n${f(r,t)}`,`utf-8`),console.log(` Updated CLAUDE.md`)},writeAgentsMd(e,t){}},j={scaffoldDir:`general`,writeMcpConfig(e,t){let n=b(e,`.cursor`),r=b(n,`mcp.json`);m(r)||(h(n,{recursive:!0}),v(r,`${JSON.stringify(D(t),null,2)}\n`,`utf-8`),console.log(` Created .cursor/mcp.json`))},writeInstructions(e,t){let n=b(e,`.cursor`,`rules`),r=b(n,`aikit.mdc`);h(n,{recursive:!0});let i=y(e);v(r,`${c(i,t)}\n---\n\n${f(i,t)}`,`utf-8`),console.log(` Updated .cursor/rules/aikit.mdc`);let a=b(n,`kb.mdc`);m(a)&&a!==r&&(_(a),console.log(` Removed legacy .cursor/rules/kb.mdc`))},writeAgentsMd(e,t){}},M={scaffoldDir:`general`,writeMcpConfig(e,t){let n=b(e,`.vscode`),r=b(n,`mcp.json`);m(r)||(h(n,{recursive:!0}),v(r,`${JSON.stringify(E(t),null,2)}\n`,`utf-8`),console.log(` Created .vscode/mcp.json (Windsurf-compatible)`))},writeInstructions(e,t){let n=b(e,`.windsurfrules`),r=y(e);v(n,`${c(r,t)}\n---\n\n${f(r,t)}`,`utf-8`),console.log(` Updated .windsurfrules`)},writeAgentsMd(e,t){}},N={scaffoldDir:`general`,writeMcpConfig(e,t){let n=b(e,`.zed`),r=b(n,`settings.json`);if(h(n,{recursive:!0}),!m(r))v(r,`${JSON.stringify(O(t),null,2)}\n`,`utf-8`),console.log(` Created .zed/settings.json`);else{let e;try{e=JSON.parse(g(r,`utf-8`))}catch{console.warn(` ⚠ .zed/settings.json contains invalid JSON — skipping MCP config merge`);return}e.context_servers?.[t]||(e.context_servers={...e.context_servers,...O(t).context_servers},v(r,`${JSON.stringify(e,null,2)}\n`,`utf-8`),console.log(` Updated .zed/settings.json with context_servers`))}},writeInstructions(e,t){let n=b(e,`.rules`),r=y(e);v(n,`${c(r,t)}\n---\n\n${f(r,t)}`,`utf-8`),console.log(` Updated .rules`)},writeAgentsMd(e,t){}},P={scaffoldDir:`general`,writeMcpConfig(e,t){let n=b(e,`mcp.json`);m(n)||(v(n,`${JSON.stringify(D(t),null,2)}\n`,`utf-8`),console.log(` Created mcp.json`))},writeInstructions(e,t){let n=b(e,`.aiassistant`,`rules`),r=b(n,`aikit.md`);h(n,{recursive:!0});let i=y(e);v(r,`${c(i,t)}\n---\n\n${f(i,t)}`,`utf-8`),console.log(` Updated .aiassistant/rules/aikit.md`)},writeAgentsMd(e,t){}};function F(e){switch(e){case`copilot`:return k;case`claude-code`:return A;case`cursor`:return j;case`windsurf`:return M;case`zed`:return N;case`intellij`:return P;case`gemini-cli`:case`codex-cli`:return k}}const I={serverName:o,sources:[{path:`.`,excludePatterns:[`**/node_modules/**`,`**/dist/**`,`**/build/**`,`**/.git/**`,`**/${x.data}/**`,`**/coverage/**`,`**/*.min.js`,`**/package-lock.json`,`**/pnpm-lock.yaml`]}],indexing:{chunkSize:1500,chunkOverlap:200,minChunkSize:100},embedding:{model:S.model,dimensions:S.dimensions},store:{backend:`sqlite-vec`,path:x.data},curated:{path:x.aiCurated}};function L(e,t){let n=b(e,`aikit.config.json`);return m(n)&&!t?(console.log(`aikit.config.json already exists. Use --force to overwrite.`),!1):(v(n,`${JSON.stringify(I,null,2)}\n`,`utf-8`),console.log(` Created aikit.config.json`),!0)}function R(e){let t=b(e,`.gitignore`),n=[{dir:`${x.data}/`,label:`AI Kit vector store`},{dir:`${x.state}/`,label:`AI Kit session state`},{dir:`${x.restorePoints}/`,label:`Restore points (codemod/rename undo snapshots)`},{dir:`${x.brainstorm}/`,label:`Brainstorming sessions`},{dir:`${x.handoffs}/`,label:`Handoff documents`}];if(m(t)){let e=g(t,`utf-8`),r=n.filter(t=>!e.includes(t.dir));r.length>0&&(p(t,`\n${r.map(e=>`# ${e.label}\n${e.dir}`).join(`
2
2
  `)}\n`,`utf-8`),console.log(` Added ${r.map(e=>e.dir).join(`, `)} to .gitignore`))}else v(t,`${n.map(e=>`# ${e.label}\n${e.dir}`).join(`
3
3
  `)}\n`,`utf-8`),console.log(` Created .gitignore with AI Kit entries`)}function z(){return I.serverName}const B=[`decisions`,`patterns`,`conventions`,`troubleshooting`];function V(e){let t=b(e,`.ai`,`curated`);m(t)||(h(t,{recursive:!0}),console.log(` Created .ai/curated/`));for(let e of B){let n=b(t,e);m(n)||h(n,{recursive:!0})}console.log(` Created .ai/curated/{${B.join(`,`)}}/`)}function H(e){switch(e){case`zed`:return`zed`;case`intellij`:return`intellij`;case`claude-code`:return`claude-code`;case`gemini-cli`:return`gemini`;case`codex-cli`:return`codex`;default:return`copilot`}}async function U(n){let i=process.cwd();if(!L(i,n.force))return;R(i);let a=z(),o=F(w(i));o.writeMcpConfig(i,a),o.writeInstructions(i,a),o.writeAgentsMd(i,a);let s=u(),c=JSON.parse(g(b(s,`package.json`),`utf-8`)).version;await t(i,s,[...l],c,n.force),await r(i,s,[...d],c,n.force);let f=T(i),p=new Set;for(let t of f){let r=H(t);p.has(r)||(p.add(r),await e(i,s,r,c,n.force))}V(i),console.log(`
4
4
  AI Kit initialized! Next steps:`),console.log(` aikit reindex Index your codebase`),console.log(` aikit search Search indexed content`),console.log(` aikit serve Start MCP server for IDE integration`),C()&&console.log(`
@@ -2,7 +2,7 @@ import{createRequire as e}from"node:module";import{readFileSync as t}from"node:f
2
2
  `))console.log(` ${e}`)}}function E(e){console.log(e.id),console.log(` Command: ${e.command}${e.args.length>0?` ${e.args.join(` `)}`:``}`),console.log(` PID: ${e.pid??`unknown`}`),console.log(` Status: ${e.status}`),console.log(` Started: ${e.startedAt}`),e.exitCode!==void 0&&console.log(` Exit code: ${e.exitCode}`),console.log(` Logs: ${e.logs.length}`)}function D(e){if(console.log(`Exports scanned: ${e.totalExports}`),console.log(`Dead in source: ${e.totalDeadSource} (actionable)`),console.log(`Dead in docs: ${e.totalDeadDocs} (informational)`),e.totalDeadSource===0&&e.totalDeadDocs===0){console.log(`No dead symbols found.`);return}if(e.deadInSource.length>0){console.log(`
3
3
  Dead in source (actionable):`);for(let t of e.deadInSource)console.log(` - ${t.path}:${t.line} ${t.kind} ${t.name}`)}if(e.deadInDocs.length>0){console.log(`
4
4
  Dead in docs (informational):`);for(let t of e.deadInDocs)console.log(` - ${t.path}:${t.line} ${t.kind} ${t.name}`)}}function O(e){console.log(e.path),console.log(` Language: ${e.language}`),console.log(` Lines: ${e.lines}`),console.log(` Estimated tokens: ~${e.estimatedTokens}`),console.log(``),M(`Imports`,e.imports),M(`Exports`,e.exports),M(`Functions`,e.functions.map(e=>`${e.name} @ line ${e.line}${e.exported?` [exported]`:``}`)),M(`Classes`,e.classes.map(e=>`${e.name} @ line ${e.line}${e.exported?` [exported]`:``}`)),M(`Interfaces`,e.interfaces.map(e=>`${e.name} @ line ${e.line}`)),M(`Types`,e.types.map(e=>`${e.name} @ line ${e.line}`))}function k(e){if(console.log(`Symbol: ${e.name}`),e.definedIn?console.log(`Defined in: ${e.definedIn.path}:${e.definedIn.line} (${e.definedIn.kind})`):console.log(`Defined in: not found`),console.log(``),console.log(`Imported by:`),e.importedBy.length===0)console.log(` none`);else for(let t of e.importedBy)console.log(` - ${t.path}:${t.line} ${t.importStatement}`);if(console.log(``),console.log(`Referenced in:`),e.referencedIn.length===0)console.log(` none`);else for(let t of e.referencedIn)console.log(` - ${t.path}:${t.line} ${t.context}`)}function A(e){console.log(e.name),console.log(` Files: ${e.files.length}`),console.log(` Updated: ${e.updated}`),e.description&&console.log(` Description: ${e.description}`);for(let t of e.files)console.log(` - ${t}`)}function j(e){let t=Array.isArray(e.data.files)?e.data.files.filter(e=>typeof e==`string`):[];if(console.log(e.id),console.log(` Label: ${e.label}`),console.log(` Created: ${e.createdAt}`),e.notes&&console.log(` Notes: ${e.notes}`),t.length>0){console.log(` Files: ${t.length}`);for(let e of t)console.log(` - ${e}`)}console.log(` Data:`);for(let t of JSON.stringify(e.data,null,2).split(`
5
- `))console.log(` ${t}`)}function M(e,t){if(console.log(`${e}:`),t.length===0){console.log(` none`),console.log(``);return}for(let e of t)console.log(` - ${e}`);console.log(``)}function N(e){let t=e.trim();if(!t)return``;try{return JSON.parse(t)}catch{return e}}function P(e){let t=e.trim();if(!t)return{};let n=JSON.parse(t);if(!n||typeof n!=`object`||Array.isArray(n))throw Error(`Checkpoint data must be a JSON object.`);return n}function F(e,t,n=60){let r=new Map;for(let t=0;t<e.length;t++){let i=e[t];r.set(i.record.id,{record:i.record,score:1/(n+t+1)})}for(let e=0;e<t.length;e++){let i=t[e],a=r.get(i.record.id);a?a.score+=1/(n+e+1):r.set(i.record.id,{record:i.record,score:1/(n+e+1)})}return[...r.values()].sort((e,t)=>t.score-e.score)}const I=[`const{execSync:x}=require('child_process')`,`const{readdirSync:r,renameSync:m}=require('fs')`,`const{join:j}=require('path')`,`const c=j(process.env.LOCALAPPDATA||process.env.HOME||'','npm-cache')`,`const s={stdio:'inherit'}`,`try{x('npx -y @vpxa/aikit@latest serve',s)}catch{try{r(c).filter(d=>d.startsWith('_npx')).forEach(d=>{try{m(j(c,d),j(c,d+'_'+Date.now()))}catch{}})}catch{};try{x('npm cache verify',{stdio:'ignore',timeout:30000})}catch{};try{x('npx -y @vpxa/aikit@latest serve',s)}catch(e){process.stderr.write('aikit: all recovery attempts failed. Run: npm cache clean --force && npx -y @vpxa/aikit@latest serve');process.exit(1)}}`].join(`;`),L=`aikit`,R={type:`stdio`,command:`node`,args:[`-e`,I]},z=[`aikit`,`brainstorming`,`multi-agents-development`,`session-handoff`,`requirements-clarity`,`lesson-learned`,`c4-architecture`,`adr-skill`,`present`,`frontend-design`,`react`,`typescript`,`docs`,`repo-access`],B=[`aikit-basic`,`aikit-advanced`,`_epilogue`],V={"chat.agentFilesLocations":{"~/.claude/agents":!1},"chat.useClaudeMdFile":!1,"github.copilot.chat.copilotMemory.enabled":!0,"chat.customAgentInSubagent.enabled":!0,"chat.useNestedAgentsMdFiles":!0,"chat.useAgentSkills":!0,"github.copilot.chat.switchAgent.enabled":!0,"workbench.browser.enableChatTools":!0,"chat.mcp.apps.enabled":!0,"chat.instructionsFilesLocations":{"~/.copilot/instructions":!0,".github/instructions":!0,".claude/rules":!1,"~/.claude/rules":!1}};function H(e){return`
5
+ `))console.log(` ${t}`)}function M(e,t){if(console.log(`${e}:`),t.length===0){console.log(` none`),console.log(``);return}for(let e of t)console.log(` - ${e}`);console.log(``)}function N(e){let t=e.trim();if(!t)return``;try{return JSON.parse(t)}catch{return e}}function P(e){let t=e.trim();if(!t)return{};let n=JSON.parse(t);if(!n||typeof n!=`object`||Array.isArray(n))throw Error(`Checkpoint data must be a JSON object.`);return n}function F(e,t,n=60){let r=new Map;for(let t=0;t<e.length;t++){let i=e[t];r.set(i.record.id,{record:i.record,score:1/(n+t+1)})}for(let e=0;e<t.length;e++){let i=t[e],a=r.get(i.record.id);a?a.score+=1/(n+e+1):r.set(i.record.id,{record:i.record,score:1/(n+e+1)})}return[...r.values()].sort((e,t)=>t.score-e.score)}const I=[`const{execSync:x}=require('child_process')`,`const{existsSync:e,renameSync:m}=require('fs')`,`const{join:j}=require('path')`,`const c=j(process.env.LOCALAPPDATA||process.env.HOME||'','npm-cache')`,`const s={stdio:'inherit'}`,`try{x('npx -y @vpxa/aikit@latest serve',s)}catch{try{const d=j(c,'_npx');if(e(d))m(d,j(c,'_npx_'+Date.now()))}catch{};try{x('npm cache verify',{stdio:'ignore',timeout:30000})}catch{};try{x('npx -y @vpxa/aikit@latest serve',s)}catch(e){process.stderr.write('aikit: all recovery attempts failed. Run: npm cache clean --force && npx -y @vpxa/aikit@latest serve');process.exit(1)}}`].join(`;`),L=`aikit`,R={type:`stdio`,command:`node`,args:[`-e`,I]},z=[`aikit`,`brainstorming`,`multi-agents-development`,`session-handoff`,`requirements-clarity`,`lesson-learned`,`c4-architecture`,`adr-skill`,`present`,`frontend-design`,`react`,`typescript`,`docs`,`repo-access`],B=[`aikit-basic`,`aikit-advanced`,`_epilogue`],V={"chat.agentFilesLocations":{"~/.claude/agents":!1},"chat.useClaudeMdFile":!1,"github.copilot.chat.copilotMemory.enabled":!0,"chat.customAgentInSubagent.enabled":!0,"chat.useNestedAgentsMdFiles":!0,"chat.useAgentSkills":!0,"github.copilot.chat.switchAgent.enabled":!0,"workbench.browser.enableChatTools":!0,"chat.mcp.apps.enabled":!0,"chat.instructionsFilesLocations":{"~/.copilot/instructions":!0,".github/instructions":!0,".claude/rules":!1,"~/.claude/rules":!1}};function H(e){return`
6
6
  ## Flow Context Bootstrap
7
7
 
8
8
  When dispatched as a subagent within an active flow:
@@ -333,6 +333,10 @@ interface AikitConfig {
333
333
  };
334
334
  supersession?: Partial<SupersessionConfig>;
335
335
  };
336
+ /** Logger behavior configuration. */
337
+ logging?: {
338
+ /** Include stack traces and error causes in serialized logs. Defaults to false. */errorDetails?: boolean;
339
+ };
336
340
  /** Resolved directory for onboard/produce_knowledge output. User-level mode redirects this outside the project. */
337
341
  onboardDir?: string;
338
342
  /** Resolved state directory path. User-level mode redirects this to the partition. Defaults to `.aikit-state` in workspace root. */
@@ -587,10 +591,11 @@ declare function getLogLevel(): LogLevel;
587
591
  declare function setFileSinkEnabled(enabled: boolean): void;
588
592
  /** Reset resolved log directory (for testing). */
589
593
  declare function resetLogDir(): void;
594
+ declare function setDetailedErrorLoggingEnabled(enabled: boolean): void;
590
595
  /**
591
596
  * Serialize an unknown error into a structured record suitable for JSON logging.
592
- * Always includes stack traces for Error instances — they are essential for
593
- * root-cause analysis regardless of the active log level.
597
+ * Default output stays concise; stack traces and cause chains are opt-in via
598
+ * aikit.config.json logging.errorDetails for deeper startup/debug diagnostics.
594
599
  */
595
600
  declare function serializeError(err: unknown): Record<string, unknown>;
596
601
  /**
@@ -627,4 +632,4 @@ interface RetryOptions {
627
632
  */
628
633
  declare function withRetry<T>(fn: () => Promise<T>, options?: RetryOptions): Promise<T>;
629
634
  //#endregion
630
- export { AIKIT_GLOBAL_PATHS, AIKIT_PATHS, AikitConfig, AikitError, CATEGORY_PATTERN, CHUNK_SIZES, CONTENT_TYPES, ChunkMetadata, CircuitBreaker, CircuitBreakerOptions, CircuitOpenError, CircuitState, ConfigError, ContentType, DEFAULT_CATEGORIES, EMBEDDING_DEFAULTS, EmbeddingError, FILE_LIMITS, GlobalRegistry, HealthBus, HealthEvent, HealthStatus, INDEX_MODES, IndexError, IndexMode, IndexStats, KNOWLEDGE_ORIGINS, KnowledgeOrigin, KnowledgeRecord, LogLevel, LogListener, PermanentError, RawChunk, RegistryEntry, RetryOptions, SEARCH_DEFAULTS, SOURCE_TYPES, STORE_DEFAULTS, SearchResult, SourceType, StoreError, SubsystemHealth, SupersessionConfig, TOKEN_BUDGETS, TokenBudget, TransientError, addLogListener, computePartitionKey, contentTypeToSourceType, createLogger, detectContentType, getGlobalDataDir, getLogLevel, getPartitionDir, isPermanent, isTransient, isUserInstalled, listWorkspaces, loadRegistry, lookupWorkspace, registerWorkspace, resetLogDir, resolveStateDir, saveRegistry, serializeError, setFileSinkEnabled, setLogLevel, sourceTypeContentTypes, withRetry };
635
+ export { AIKIT_GLOBAL_PATHS, AIKIT_PATHS, AikitConfig, AikitError, CATEGORY_PATTERN, CHUNK_SIZES, CONTENT_TYPES, ChunkMetadata, CircuitBreaker, CircuitBreakerOptions, CircuitOpenError, CircuitState, ConfigError, ContentType, DEFAULT_CATEGORIES, EMBEDDING_DEFAULTS, EmbeddingError, FILE_LIMITS, GlobalRegistry, HealthBus, HealthEvent, HealthStatus, INDEX_MODES, IndexError, IndexMode, IndexStats, KNOWLEDGE_ORIGINS, KnowledgeOrigin, KnowledgeRecord, LogLevel, LogListener, PermanentError, RawChunk, RegistryEntry, RetryOptions, SEARCH_DEFAULTS, SOURCE_TYPES, STORE_DEFAULTS, SearchResult, SourceType, StoreError, SubsystemHealth, SupersessionConfig, TOKEN_BUDGETS, TokenBudget, TransientError, addLogListener, computePartitionKey, contentTypeToSourceType, createLogger, detectContentType, getGlobalDataDir, getLogLevel, getPartitionDir, isPermanent, isTransient, isUserInstalled, listWorkspaces, loadRegistry, lookupWorkspace, registerWorkspace, resetLogDir, resolveStateDir, saveRegistry, serializeError, setDetailedErrorLoggingEnabled, setFileSinkEnabled, setLogLevel, sourceTypeContentTypes, withRetry };