@vpxa/aikit 0.1.131 → 0.1.132
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 +1 @@
|
|
|
1
|
-
import{t as e}from"./curated-manager-BkSgtNC2.js";import{readFileSync as t}from"node:fs";import{dirname as n,resolve as r}from"node:path";import{fileURLToPath as i,pathToFileURL as a}from"node:url";import{parseArgs as o}from"node:util";import{createLogger as s,serializeError as c}from"../../core/dist/index.js";const l=n(i(import.meta.url)),u=(()=>{try{let e=r(l,`..`,`..`,`..`,`package.json`);return JSON.parse(t(e,`utf-8`)).version??`0.0.0`}catch{return`0.0.0`}})(),d=s(`server`);function f(){return process.env.AIKIT_TRANSPORT?process.env.AIKIT_TRANSPORT:process.stdin.isTTY?`http`:`stdio`}const{values:p}=(()=>{let e=process.argv[1];if(!e)return!1;try{return import.meta.url===a(e).href}catch{return!1}})()?o({allowPositionals:!0,options:{transport:{type:`string`,default:f()},port:{type:`string`,default:process.env.AIKIT_PORT??`3210`}}}):{values:{transport:f(),port:process.env.AIKIT_PORT??`3210`}};async function m(){if(process.on(`unhandledRejection`,e=>{d.error(`Unhandled rejection`,c(e))}),d.info(`Starting MCP AI Kit server`,{version:u}),p.transport===`http`){let[{default:e},{loadConfig:t,resolveIndexMode:n},{registerDashboardRoutes:r,resolveDashboardDir:i},{registerSettingsRoutes:a,resolveSettingsDir:o},{createSettingsRouter:s}]=await Promise.all([import(`express`),import(`./config-D4z6-EcI.js`),import(`./dashboard-static-BfIe0Si1.js`),import(`./settings-static-BosGZSPf.js`),import(`./routes-OaSHcA6x.js`)]),l=t();d.info(`Config loaded`,{sourceCount:l.sources.length,storePath:l.store.path});let u=e();u.use(e.json());let f=Number(p.port);u.use((e,t,n)=>{if(t.setHeader(`Access-Control-Allow-Origin`,process.env.AIKIT_CORS_ORIGIN??`http://localhost:${f}`),t.setHeader(`Access-Control-Allow-Methods`,`GET, POST, PUT, PATCH, DELETE, OPTIONS`),t.setHeader(`Access-Control-Allow-Headers`,`Content-Type, Authorization`),e.method===`OPTIONS`){t.status(204).end();return}n()}),r(u,i(),d);let m=new Date().toISOString();u.use(`/settings/api`,s({log:d,mcpInfo:()=>({transport:`http`,port:f,pid:process.pid,startedAt:m})})),a(u,o(),d),u.get(`/health`,(e,t)=>{t.json({status:`ok`})});let h=!1,g=null,_=null,v=null,y=Promise.resolve();u.post(`/mcp`,async(e,t)=>{if(!h||!_||!v){t.status(503).json({jsonrpc:`2.0`,error:{code:-32603,message:`Server initializing — please retry in a few seconds`},id:null});return}let n=y,r;y=new Promise(e=>{r=e}),await n;try{let n=new v({sessionIdGenerator:void 0});await _.connect(n),await n.handleRequest(e,t,e.body),n.close()}catch(e){if(d.error(`MCP handler error`,c(e)),!t.headersSent){let n=e instanceof Error?e.message:String(e),r=n.includes(`Not Acceptable`);t.status(r?406:500).json({jsonrpc:`2.0`,error:{code:r?-32e3:-32603,message:r?n:`Internal server error`},id:null})}}finally{r()}}),u.get(`/mcp`,(e,t)=>{t.writeHead(405).end(JSON.stringify({jsonrpc:`2.0`,error:{code:-32e3,message:`Method not allowed.`},id:null}))}),u.delete(`/mcp`,(e,t)=>{t.writeHead(405).end(JSON.stringify({jsonrpc:`2.0`,error:{code:-32e3,message:`Method not allowed.`},id:null}))});let b=u.listen(f,`127.0.0.1`,()=>{d.info(`MCP server listening`,{url:`http://127.0.0.1:${f}/mcp`,port:f}),setTimeout(async()=>{try{let[{createLazyServer:e,ALL_TOOL_NAMES:t},{StreamableHTTPServerTransport:r},{checkForUpdates:i,autoUpgradeScaffold:a}]=await Promise.all([import(`./server-
|
|
1
|
+
import{t as e}from"./curated-manager-BkSgtNC2.js";import{readFileSync as t}from"node:fs";import{dirname as n,resolve as r}from"node:path";import{fileURLToPath as i,pathToFileURL as a}from"node:url";import{parseArgs as o}from"node:util";import{createLogger as s,serializeError as c}from"../../core/dist/index.js";const l=n(i(import.meta.url)),u=(()=>{try{let e=r(l,`..`,`..`,`..`,`package.json`);return JSON.parse(t(e,`utf-8`)).version??`0.0.0`}catch{return`0.0.0`}})(),d=s(`server`);function f(){return process.env.AIKIT_TRANSPORT?process.env.AIKIT_TRANSPORT:process.stdin.isTTY?`http`:`stdio`}const{values:p}=(()=>{let e=process.argv[1];if(!e)return!1;try{return import.meta.url===a(e).href}catch{return!1}})()?o({allowPositionals:!0,options:{transport:{type:`string`,default:f()},port:{type:`string`,default:process.env.AIKIT_PORT??`3210`}}}):{values:{transport:f(),port:process.env.AIKIT_PORT??`3210`}};async function m(){if(process.on(`unhandledRejection`,e=>{d.error(`Unhandled rejection`,c(e))}),d.info(`Starting MCP AI Kit server`,{version:u}),p.transport===`http`){let[{default:e},{loadConfig:t,resolveIndexMode:n},{registerDashboardRoutes:r,resolveDashboardDir:i},{registerSettingsRoutes:a,resolveSettingsDir:o},{createSettingsRouter:s}]=await Promise.all([import(`express`),import(`./config-D4z6-EcI.js`),import(`./dashboard-static-BfIe0Si1.js`),import(`./settings-static-BosGZSPf.js`),import(`./routes-OaSHcA6x.js`)]),l=t();d.info(`Config loaded`,{sourceCount:l.sources.length,storePath:l.store.path});let u=e();u.use(e.json());let f=Number(p.port);u.use((e,t,n)=>{if(t.setHeader(`Access-Control-Allow-Origin`,process.env.AIKIT_CORS_ORIGIN??`http://localhost:${f}`),t.setHeader(`Access-Control-Allow-Methods`,`GET, POST, PUT, PATCH, DELETE, OPTIONS`),t.setHeader(`Access-Control-Allow-Headers`,`Content-Type, Authorization`),e.method===`OPTIONS`){t.status(204).end();return}n()}),r(u,i(),d);let m=new Date().toISOString();u.use(`/settings/api`,s({log:d,mcpInfo:()=>({transport:`http`,port:f,pid:process.pid,startedAt:m})})),a(u,o(),d),u.get(`/health`,(e,t)=>{t.json({status:`ok`})});let h=!1,g=null,_=null,v=null,y=Promise.resolve();u.post(`/mcp`,async(e,t)=>{if(!h||!_||!v){t.status(503).json({jsonrpc:`2.0`,error:{code:-32603,message:`Server initializing — please retry in a few seconds`},id:null});return}let n=y,r;y=new Promise(e=>{r=e}),await n;try{let n=new v({sessionIdGenerator:void 0});await _.connect(n),await n.handleRequest(e,t,e.body),n.close()}catch(e){if(d.error(`MCP handler error`,c(e)),!t.headersSent){let n=e instanceof Error?e.message:String(e),r=n.includes(`Not Acceptable`);t.status(r?406:500).json({jsonrpc:`2.0`,error:{code:r?-32e3:-32603,message:r?n:`Internal server error`},id:null})}}finally{r()}}),u.get(`/mcp`,(e,t)=>{t.writeHead(405).end(JSON.stringify({jsonrpc:`2.0`,error:{code:-32e3,message:`Method not allowed.`},id:null}))}),u.delete(`/mcp`,(e,t)=>{t.writeHead(405).end(JSON.stringify({jsonrpc:`2.0`,error:{code:-32e3,message:`Method not allowed.`},id:null}))});let b=u.listen(f,`127.0.0.1`,()=>{d.info(`MCP server listening`,{url:`http://127.0.0.1:${f}/mcp`,port:f}),setTimeout(async()=>{try{let[{createLazyServer:e,ALL_TOOL_NAMES:t},{StreamableHTTPServerTransport:r},{checkForUpdates:i,autoUpgradeScaffold:a}]=await Promise.all([import(`./server-zA3SovxH.js`),import(`@modelcontextprotocol/sdk/server/streamableHttp.js`),import(`./version-check-Bj07vc5x.js`)]);i(),a();let o=n(l),s=e(l,o);_=s.server,v=r,h=!0,d.info(`MCP server configured (lazy — AI Kit initializing in background)`,{toolCount:t.length,resourceCount:2}),s.startInit(),o===`auto`?s.ready.then(async()=>{try{let e=l.sources.map(e=>e.path).join(`, `);d.info(`Running initial index`,{sourcePaths:e}),await s.runInitialIndex(),d.info(`Initial index complete`)}catch(e){d.error(`Initial index failed; will retry on aikit_reindex`,c(e))}}).catch(e=>d.error(`AI Kit init or indexing failed`,c(e))):o===`smart`?s.ready.then(async()=>{try{if(!s.aikit)throw Error(`AI Kit components are not available after initialization`);let{SmartIndexScheduler:e}=await import(`../../indexer/dist/index.js`),t=new e(s.aikit.indexer,l,s.aikit.store),n=s.aikit.store;g=t,t.start(),n.onBeforeClose&&n.onBeforeClose(()=>t.stop()),s.setSmartScheduler(t),d.info(`Smart index scheduler started (HTTP mode)`)}catch(e){d.error(`Failed to start smart index scheduler`,c(e))}}).catch(e=>d.error(`AI Kit initialization failed`,c(e))):(s.ready.catch(e=>d.error(`AI Kit initialization failed`,c(e))),d.info(`Initial full indexing skipped in HTTP mode`,{indexMode:o}))}catch(e){d.error(`Failed to load server modules`,c(e))}},100)}),x=async e=>{d.info(`Shutdown signal received`,{signal:e}),g?.stop(),b.close(),_&&await _.close(),process.exit(0)};process.on(`SIGINT`,()=>x(`SIGINT`)),process.on(`SIGTERM`,()=>x(`SIGTERM`))}else{let[{loadConfig:e,reconfigureForWorkspace:t,resolveIndexMode:n},{createLazyServer:r},{checkForUpdates:a,autoUpgradeScaffold:o},{RootsListChangedNotificationSchema:s}]=await Promise.all([import(`./config-D4z6-EcI.js`),import(`./server-zA3SovxH.js`),import(`./version-check-Bj07vc5x.js`),import(`@modelcontextprotocol/sdk/types.js`)]),l=e();d.info(`Config loaded`,{sourceCount:l.sources.length,storePath:l.store.path}),a(),o();let u=n(l),f=r(l,u),{server:p,startInit:m,ready:h,runInitialIndex:g}=f,{StdioServerTransport:_}=await import(`@modelcontextprotocol/sdk/server/stdio.js`),v=new _;await p.connect(v),d.info(`MCP server started`,{transport:`stdio`});let y=e=>{if(e.length===0)return!1;let n=e[0].uri,r=n.startsWith(`file://`)?i(n):n;return d.info(`MCP roots resolved`,{rootUri:n,rootPath:r,rootCount:e.length}),t(l,r),l.allRoots=e.map(e=>{let t=e.uri;return t.startsWith(`file://`)?i(t):t}),!0},b=!1;try{b=y((await p.server.listRoots()).roots),b||d.info(`No MCP roots yet; waiting for roots/list_changed notification`)}catch(e){d.warn(`MCP roots/list not supported by client; using cwd fallback`,{cwd:process.cwd(),...c(e)}),b=!0}b||=await new Promise(e=>{let t=setTimeout(()=>{d.warn(`Timed out waiting for MCP roots/list_changed; using cwd fallback`,{cwd:process.cwd()}),e(!1)},5e3);p.server.setNotificationHandler(s,async()=>{clearTimeout(t);try{e(y((await p.server.listRoots()).roots))}catch(t){d.warn(`roots/list retry failed after notification`,c(t)),e(!1)}})}),m();let x=null,S=()=>{x&&clearTimeout(x),x=setTimeout(()=>{d.info(`Auto-shutdown: no activity for 30 minutes — exiting`),process.exit(0)},18e5),x.unref&&x.unref()};S(),process.stdin.on(`data`,()=>S()),h.catch(e=>{d.error(`Initialization failed — server will continue with limited tools`,c(e))}),u===`auto`?g().catch(e=>d.error(`Initial index failed`,c(e))):u===`smart`?h.then(async()=>{try{if(!f.aikit)throw Error(`AI Kit components are not available after initialization`);let{SmartIndexScheduler:e}=await import(`../../indexer/dist/index.js`),t=new e(f.aikit.indexer,l,f.aikit.store),n=f.aikit.store;t.start(),n.onBeforeClose&&n.onBeforeClose(()=>t.stop()),f.setSmartScheduler(t),d.info(`Smart index scheduler started (stdio mode)`)}catch(e){d.error(`Failed to start smart index scheduler`,c(e))}}).catch(e=>d.error(`AI Kit init failed for smart scheduler`,c(e))):d.warn(`Initial full indexing skipped; use aikit_reindex to index manually`,{indexMode:u})}}m().catch(e=>{d.error(`Fatal error`,c(e)),process.exit(1)});export{e as CuratedKnowledgeManager};
|
|
@@ -254,7 +254,7 @@ Complements: \`symbol\` (single lookup), \`trace\` (call-chain AST), \`blast_rad
|
|
|
254
254
|
`)}`}).filter(e=>typeof e==`string`);if(r.length>0)return{type:`markdown`,title:t,value:r.join(`
|
|
255
255
|
|
|
256
256
|
`)}}let r=new Set;for(let e of n)for(let t of Object.keys(e))r.add(t);let i=Array.from(r);return{type:`table`,title:t,value:{headers:i,rows:n.map(e=>i.map(t=>{if(!(t in e)||e[t]===void 0||e[t]===null)return``;let n=e[t];if(typeof n==`object`)try{let e=JSON.stringify(n);return typeof e==`string`?e:``}catch{return String(n)}return String(n)}))}}}}if(typeof e==`object`){let r=e;if(Array.isArray(r.items))return Ac(r.items,t);let i=Object.entries(r).map(([e,t])=>`**${e}**: ${n(t)}`);return i.length>0?{type:`markdown`,title:t,value:i.join(`
|
|
257
|
-
`)}:null}return null}function jc(e){return e.type!==`table`||typeof e.value!=`string`?null:{type:`markdown`,title:e.title,value:e.value}}const Mc=new Set([`markdown`,`table`,`code`,`chart`,`metrics`,`tree`,`graph`,`mermaid`]);function Nc(e){return jc(e)||(Mc.has(e.type)?null:Ac(e.value,e.title)||{type:`code`,title:e.title,value:typeof e.value==`string`?e.value:JSON.stringify(e.value,null,2)})}function Pc(e){if(e.type!==`progress`||!e.value||typeof e.value!=`object`||!Array.isArray(e.value.items))return null;let t=e.value.items.map(e=>{if(!e||typeof e!=`object`)return null;let t=e;if(typeof t.label!=`string`||typeof t.value!=`number`)return null;let n=typeof t.max==`number`?t.max:100,r=Number.isFinite(n)&&n>0?n:100,i=Math.round(t.value/r*100);return[t.label,`${i}%`,`${t.value} / ${r}`]}).filter(e=>Array.isArray(e));return t.length>0?{type:`table`,title:e.title,value:{headers:[`Item`,`Progress`,`Value`],rows:t}}:null}function Fc(e){if(e.type!==`prompt`||!e.value||typeof e.value!=`object`)return null;let t=e.value;if(typeof t.question!=`string`)return null;let n=[`**${t.question}**`];return typeof t.context==`string`&&t.context.length>0&&n.push(t.context),typeof t.placeholder==`string`&&t.placeholder.length>0&&n.push(`*${t.placeholder}*`),{type:`markdown`,title:e.title,value:n.join(`
|
|
257
|
+
`)}:null}return null}function jc(e){return e.type!==`table`||typeof e.value!=`string`?null:{type:`markdown`,title:e.title,value:e.value}}const Mc=new Set([`markdown`,`table`,`code`,`chart`,`metrics`,`tree`,`graph`,`mermaid`,`cards`,`timeline`,`checklist`,`comparison`,`status-board`,`prompt`,`progress`,`viewer-link`,`docs-browser`,`text`,`heading`,`paragraph`,`separator`,`actions`]);function Nc(e){return jc(e)||(Mc.has(e.type)?null:Ac(e.value,e.title)||{type:`code`,title:e.title,value:typeof e.value==`string`?e.value:JSON.stringify(e.value,null,2)})}function Pc(e){if(e.type!==`progress`||!e.value||typeof e.value!=`object`||!Array.isArray(e.value.items))return null;let t=e.value.items.map(e=>{if(!e||typeof e!=`object`)return null;let t=e;if(typeof t.label!=`string`||typeof t.value!=`number`)return null;let n=typeof t.max==`number`?t.max:100,r=Number.isFinite(n)&&n>0?n:100,i=Math.round(t.value/r*100);return[t.label,`${i}%`,`${t.value} / ${r}`]}).filter(e=>Array.isArray(e));return t.length>0?{type:`table`,title:e.title,value:{headers:[`Item`,`Progress`,`Value`],rows:t}}:null}function Fc(e){if(e.type!==`prompt`||!e.value||typeof e.value!=`object`)return null;let t=e.value;if(typeof t.question!=`string`)return null;let n=[`**${t.question}**`];return typeof t.context==`string`&&t.context.length>0&&n.push(t.context),typeof t.placeholder==`string`&&t.placeholder.length>0&&n.push(`*${t.placeholder}*`),{type:`markdown`,title:e.title,value:n.join(`
|
|
258
258
|
|
|
259
259
|
`)}}function Ic(e){return e.type===`separator`?{type:`markdown`,title:e.title,value:`---`}:null}const Lc={success:`✅`,done:`✅`,warning:`⚠️`,"at-risk":`⚠️`,error:`❌`,info:`ℹ️`,pending:`⏳`};function Rc(e){if(e.type!==`status-board`)return null;let t=e.value,n=Array.isArray(t)?t:t&&typeof t==`object`&&Array.isArray(t.items)?t.items:null;if(!n||n.length===0)return null;let r=n[0];if(r&&typeof r==`object`&&`category`in r){let t=n.map(e=>{if(!e||typeof e!=`object`)return null;let t=e;if(typeof t.category!=`string`||!Array.isArray(t.items))return null;let n=t.items.map(e=>{if(!e||typeof e!=`object`)return null;let t=e;if(typeof t.label!=`string`)return null;let n=typeof t.status==`string`?`${Lc[t.status.toLowerCase()]??`●`} `:``,r=typeof t.detail==`string`&&t.detail.length>0?` — ${t.detail}`:``;return`- ${n}${t.label}${r}`}).filter(e=>typeof e==`string`);return`### ${t.category}\n${n.join(`
|
|
260
260
|
`)}`}).filter(e=>typeof e==`string`);if(t.length>0)return{type:`markdown`,title:e.title,value:t.join(`
|
|
@@ -368,7 +368,7 @@ $3`),n.push(t);break}case`code`:n.push(`\`\`\`${e.language??``}\n${String(e.valu
|
|
|
368
368
|
</svg>`}function Vl(e){if(e.length===0)return`<p><em>empty table</em></p>`;let t=Object.keys(e[0]);return`<div class="table-wrap"><table><thead><tr>${t.map(e=>`<th>${U(e)}</th>`).join(``)}</tr></thead><tbody>${e.map(e=>`<tr>${t.map(t=>`<td>${U(String(e[t]??``))}</td>`).join(``)}</tr>`).join(`
|
|
369
369
|
`)}</tbody></table></div>`}function Hl(e){return`<div class="metric-grid">${e.map(e=>`<div class="metric"><div class="metric-value">${U(String(e.value))}</div><div class="metric-label">${U(e.label)}</div></div>`).join(``)}</div>`}function Ul(e){return`<div class="card-grid">${e.map(e=>{let t=[`<div class="card">`];return e.title&&t.push(`<div class="card-title">${U(String(e.title))}</div>`),(e.body||e.description)&&t.push(`<div class="card-body">${U(String(e.body??e.description))}</div>`),(e.badge||e.status)&&t.push(`<span class="badge">${U(String(e.badge??e.status))}</span>`),t.push(`</div>`),t.join(``)}).join(``)}</div>`}function Wl(e){if(`name`in e&&`children`in e&&Array.isArray(e.children))return Gl(e);if(`name`in e&&!(`children`in e))return`<div class="tree-node"><span class="tree-key">${U(String(e.name))}</span></div>`;let t=[];for(let[n,r]of Object.entries(e))typeof r==`object`&&r&&!Array.isArray(r)?t.push(`<div class="tree-node"><span class="tree-key">${U(n)}:</span><div class="tree-children">${Wl(r)}</div></div>`):t.push(`<div class="tree-node"><span class="tree-key">${U(n)}:</span> ${U(Fa(r))}</div>`);return t.join(``)}function Gl(e){let t=U(String(e.name));return!e.children||e.children.length===0?`<div class="tree-node"><span class="tree-key">${t}</span></div>`:`<div class="tree-node"><span class="tree-key">${t}</span><div class="tree-children">${e.children.map(e=>typeof e==`object`&&e?Gl(e):`<div class="tree-node"><span class="tree-key">${U(String(e))}</span></div>`).join(``)}</div></div>`}function Kl(e){let t=[`graph LR`];for(let n of e.nodes){let e=Ia(String(n.id??n.name??``)),r=String(n.label??n.name??e);t.push(` ${e}["${r}"]`)}for(let n of e.edges){let e=Ia(String(n.source??n.from??``)),r=Ia(String(n.target??n.to??``)),i=n.label?`|${String(n.label)}|`:``;t.push(` ${e} -->${i} ${r}`)}return t.join(`
|
|
370
370
|
`)}function ql(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Jl(e){return e.replace(/<table\b/g,`<div class="table-wrap"><table`).replace(/<\/table>/g,`</table></div>`)}function Yl(e,t){if(typeof e!=`object`||!e)return`<p>${U(String(e))}</p>`;let n=e;return typeof n.type==`string`?gu(Jc(n),t):`<pre>${U(JSON.stringify(e,null,2))}</pre>`}function Xl(e,t,n=`inline`){let r=[];if(e&&r.push(`<h1>${U(e)}</h1>`),typeof t==`string`)r.push(`<div class="md-content">${Jl(An.parse(t))}</div>`);else if(Array.isArray(t))if(t.length===0)r.push(`<p><em>empty</em></p>`);else if(Xc(t[0]))for(let e of t)r.push(Yl(e,n));else typeof t[0]==`object`&&t[0]!==null?r.push(Vl(t)):r.push(`<ul>${t.map(e=>`<li>${U(String(e))}</li>`).join(``)}</ul>`);else if(typeof t==`object`&&t){let e=t;if(Array.isArray(e.blocks)&&e.blocks.length>0)for(let t of e.blocks)r.push(Yl(t,n));else Array.isArray(e.metrics)?r.push(Hl(e.metrics)):Array.isArray(e.nodes)&&Array.isArray(e.edges)?(r.push(`<pre class="mermaid">${U(Kl(e))}</pre>`),r.push(`<script src="https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.min.js"><\/script>`),r.push(`<script>mermaid.run();<\/script>`)):r.push(Wl(e))}else r.push(`<p>${U(String(t))}</p>`);return r.join(`
|
|
371
|
-
`)}function Zl(e){return
|
|
371
|
+
`)}function Zl(e){let t=String(e.value??``);return/^\s*</.test(t)?`<div class="md-content">${t}</div>`:`<div class="md-content">${Jl(An.parse(t))}</div>`}function Ql(e){return`<pre><code>${U(String(e.value??``))}</code></pre>`}function $l(e){return`<pre class="mermaid">${U(String(e.value??``))}</pre>`}function eu(e){if(Array.isArray(e.value)){let t=e.value;if(t.length>0&&Array.isArray(t[0])){let e=t,n=e[0].map(String);return Vl(e.slice(1).map(e=>Object.fromEntries(n.map((t,n)=>[t,e[n]]))))}return Vl(t)}if(e.value&&typeof e.value==`object`&&`headers`in e.value&&`rows`in e.value){let{headers:t,rows:n}=e.value;return Vl(n.map(e=>Object.fromEntries(t.map((t,n)=>[t,e[n]]))))}return``}function tu(e){let t;return Array.isArray(e.value)?t=e.value:e.value&&typeof e.value==`object`&&(t=Object.entries(e.value).map(([e,t])=>({label:e,value:String(t)}))),t?Hl(t):``}function nu(e){return Array.isArray(e.value)?Ul(e.value):``}function ru(e){return e.value&&typeof e.value==`object`?Wl(e.value):``}function iu(e,t){return!e.value||typeof e.value!=`object`?``:`<pre class="mermaid">${U(Kl(e.value))}</pre>`}function au(e){let t=e.value;return Array.isArray(t)&&(t={items:t.map(e=>({title:String(e.event??e.title??``),phase:e.date==null?e.phase==null?void 0:String(e.phase):String(e.date),description:e.description==null?void 0:String(e.description),status:e.status??`done`}))}),t?_l(t):``}function ou(e){return e.value?vl(Array.isArray(e.value)?{items:e.value}:e.value):``}function su(e){return e.value?yl(Array.isArray(e.value)?{columns:e.value}:e.value):``}function cu(e){return e.value?bl(Array.isArray(e.value)?{items:e.value}:e.value):``}function lu(e){if(!e.value)return``;let t=e.value;return Array.isArray(t)?t={items:t}:ql(t)&&!(`items`in t)&&`label`in t&&`value`in t&&(t={items:[t]}),Sl(t)}function uu(e){return`<div class="md-content">${An.parse(String(e.value??``))}</div>`}function du(e){let t=Math.min(Math.max(Number(e.level)||2,1),6);return`<h${t}>${U(String(e.value??``))}</h${t}>`}function fu(e){return`<p>${U(String(e.value??``))}</p>`}function pu(e){return`<div class="action-bar">${(Array.isArray(e.value)?e.value:[]).map(e=>{if(e.type===`select`){let t=Array.isArray(e.options)?e.options.map(e=>`<option value="${U(String(e.value??e.label??``))}">${U(String(e.label??e.value??``))}</option>`).join(``):``;return`<select class="action-select"><option value="">${U(String(e.label??`Select...`))}</option>${t}</select>`}return`<button class="action-btn action-${String(e.variant??`secondary`)}">${U(String(e.label??``))}</button>`}).join(``)}</div>`}function mu(e){return`<pre>${U(JSON.stringify(e.value,null,2))}</pre>`}const hu=new Map([[`markdown`,e=>Zl(e)],[`code`,e=>Ql(e)],[`mermaid`,e=>$l(e)],[`table`,e=>eu(e)],[`metrics`,e=>tu(e)],[`cards`,e=>nu(e)],[`tree`,e=>ru(e)],[`graph`,(e,t)=>iu(e,t)],[`chart`,e=>Ol(e)],[`timeline`,e=>au(e)],[`checklist`,e=>ou(e)],[`comparison`,e=>su(e)],[`status-board`,e=>cu(e)],[`prompt`,e=>e.value?xl(e.value):``],[`progress`,e=>lu(e)],[`viewer-link`,e=>e.value?Cl(e.value):``],[`docs-browser`,e=>e.value?wl(e.value):``],[`text`,e=>uu(e)],[`heading`,e=>du(e)],[`paragraph`,e=>fu(e)],[`separator`,()=>`<hr class="separator">`],[`actions`,e=>pu(e)]]);function gu(e,t=`inline`){let n=[];e.title&&n.push(`<h2>${U(e.title)}</h2>`);let r=hu.get(e.type);return n.push(r?r(e,t):mu(e)),n.join(`
|
|
372
372
|
`)}const _u=import.meta.dirname??g(b(import.meta.url));function vu(e){let t=e;for(let e=0;e<10;e++){try{let e=v(t,`package.json`);if(o(e)&&JSON.parse(c(e,`utf8`)).name===`@vpxa/aikit`)return t}catch{}let e=g(t);if(e===t)break;t=e}return y(e,`..`,`..`,`..`)}const yu=`ui://aikit/present.html`;function bu(e){return Array.isArray(e)?e:[]}function xu(e){return e.length===0?``:`<section class="present-inline-actions"><div class="action-bar">${e.map(e=>{let t=U(String(e.id??``)),n=U(String(e.label??`Action`));return e.type===`select`?`<label class="action-select-wrap"><span>${n}</span><select class="action-select" data-present-action="select" data-action-id="${t}"><option value="">${n}</option>${Array.isArray(e.options)?e.options.map(e=>{if(typeof e==`string`){let t=U(e);return`<option value="${t}">${t}</option>`}return`<option value="${U(String(e.value??e.label??``))}">${U(String(e.label??e.value??``))}</option>`}).join(``):``}</select></label>`:`<button type="button" class="action-btn action-${U(String(e.variant??`default`))}" data-present-action="button" data-action-id="${t}" data-action-value="clicked">${n}</button>`}).join(``)}</div><div id="action-feedback" class="action-feedback" aria-live="polite"></div></section>`}function Su(e,t,n){return`<!DOCTYPE html>
|
|
373
373
|
<html lang="en">
|
|
374
374
|
<head>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// AUTO-GENERATED - do not edit manually.
|
|
2
2
|
// Source: packages/server/src/tools/present/block-registry.ts
|
|
3
|
-
// Generated at: 2026-05-
|
|
3
|
+
// Generated at: 2026-05-10T13:32:40.767Z
|
|
4
4
|
|
|
5
5
|
export const ALL_BLOCK_DOCS = "| Type | Description | Value Shape |\n|------|-------------|-------------|\n| `markdown` | Markdown content rendered with the marked parser. | `string` |\n| `code` | Formatted code block rendered inside pre/code tags. | `string` |\n| `mermaid` | Mermaid diagram source rendered in a mermaid pre block. | `string` |\n| `table` | Tabular data rendered from records or explicit headers and rows. | `Record<string, unknown>[] | { headers: string[]; rows: unknown[][] }` |\n| `metrics` | Metric cards showing label/value pairs with optional trend and status. | `Array<{ label: string; value: string | number; trend?: string | number; status?: string }>` |\n| `cards` | Card grid for titled items with optional body, badge, and status. | `Array<{ title: string; body?: string; badge?: string; status?: string; description?: string }>` |\n| `tree` | Hierarchical object or name/children tree rendered recursively. | `{ name: string; children?: unknown[] } | Record<string, unknown>` |\n| `graph` | Node and edge graph rendered as a Mermaid flow graph in HTML mode. | `{ nodes: Array<{ id: string; label?: string }>; edges: Array<{ from: string; to: string; label?: string }> }` |\n| `chart` | Structured chart definition rendered as SVG. | `{ chartType: string; data: Record<string, unknown>[]; xKey: string; yKeys: string[] }` |\n| `timeline` | Timeline entries rendered as a vertical sequence of events. | `Array<{ title: string; description?: string; timestamp?: string; status?: string }>` |\n| `checklist` | Checklist items with boolean checked state. | `Array<{label, checked}> | {items: Array<{label, checked}>}` |\n| `comparison` | Side-by-side comparison columns with titled item lists. | `Array<{title, items}> | {columns: Array<{title, items}>}` |\n| `status-board` | Status categories containing labeled status items. | `Array<{category, items}> | {items: Array<{category, items}>}` |\n| `prompt` | Prompt payload rendered through the prompt display helper. | `unknown` |\n| `progress` | Progress bar with current value and optional maximum. | `{label, value, max?} | {items: Array<{label, value, max?, color?}>}` |\n| `viewer-link` | Styled card linking to a standalone interactive viewer. | `{ viewerType: string; label: string; description?: string; url?: string; icon?: string }` |\n| `docs-browser` | Collapsible file tree with markdown content for documentation browsing. | `{ files: Array<{ path: string; title?: string; content?: string; status?: \"current\" | \"stale\" | \"missing\" }>; title?: string }` |\n| `text` | Plain text content rendered through the markdown parser. | `string` |\n| `heading` | Single heading with configurable level from h1 to h6. | `string` |\n| `paragraph` | Single paragraph rendered inside a p tag. | `string` |\n| `separator` | Horizontal rule used to separate adjacent blocks. | `undefined` |\n| `actions` | Action bar containing button and select action definitions. | `Array<{ type: string; id: string; label: string; variant?: string; options?: Array<string | { label: string; value: string }> }>` |\n\n### Usage Examples\n\n#### `viewer-link`\n\n```typescript\n{\n type: 'viewer-link',\n value: {\n viewerType: 'c4',\n label: 'Open Interactive C4 Diagram',\n description: 'Drag, zoom, and pan with ELK auto-layout',\n icon: '🏗️',\n },\n}\n```\n\n#### `docs-browser`\n\n```typescript\n{\n type: 'docs-browser',\n value: {\n title: 'Project Docs',\n files: [\n { path: 'docs/README.md', title: 'Overview', status: 'current' },\n { path: 'docs/api.md', title: 'API Reference', status: 'stale' },\n ],\n },\n}\n```";
|
|
6
6
|
|