@vpxa/aikit 0.1.384 → 0.1.386
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 +1 -1
- package/packages/blocks-core/dist/index.mjs +107 -4
- package/packages/claude-desktop/dist/manifest.json +1 -1
- package/packages/present/dist/index.html +22 -0
- package/packages/server/dist/bin.js +1 -1
- package/packages/server/dist/index.js +1 -1
- package/packages/server/dist/{register-tools-CCDtIMgE.js → register-tools-UK5us8_p.js} +141 -140
- package/packages/server/dist/{register-tools-DLj1eMq3.js → register-tools-W0FlaHc5.js} +141 -140
- package/packages/server/dist/{server-B6YroA9y.js → server-27qvW6G0.js} +1 -1
- package/packages/server/dist/{server-QCZQCfjf.js → server-cj8g5_Ga.js} +1 -1
- package/packages/server/dist/{server-http-tJ-qTrTX.js → server-http-B1iOYD9-.js} +1 -1
- package/packages/server/dist/{server-http-agZcmQoQ.js → server-http-CoPnhJ2c.js} +1 -1
- package/packages/server/dist/{server-stdio-B0CPUULy.js → server-stdio-DSADqshO.js} +1 -1
- package/packages/server/dist/{server-stdio-BpzUm6FP.js → server-stdio-DaepLjg4.js} +1 -1
- package/packages/tools/dist/index.d.ts +60 -24
- package/packages/tools/dist/index.js +81 -76
- package/scaffold/dist/definitions/bodies.mjs +2 -1
- package/scaffold/dist/definitions/skills/aikit.mjs +121 -1
- package/scaffold/dist/definitions/skills/orchestrator.mjs +12 -1
package/package.json
CHANGED
|
@@ -3134,6 +3134,28 @@ html[data-theme='dark'] .aikit-theme-toggle-icon--moon {
|
|
|
3134
3134
|
box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.2);
|
|
3135
3135
|
}
|
|
3136
3136
|
}
|
|
3137
|
+
|
|
3138
|
+
/* ── Large desktop: more generous header padding ── */
|
|
3139
|
+
@media (min-width: 1200px) {
|
|
3140
|
+
.aikit-header {
|
|
3141
|
+
--aikit-header-padding-x: var(--dt-space-8);
|
|
3142
|
+
}
|
|
3143
|
+
|
|
3144
|
+
.aikit-footer {
|
|
3145
|
+
--aikit-footer-padding: var(--dt-space-8) var(--dt-space-8) var(--dt-space-10);
|
|
3146
|
+
}
|
|
3147
|
+
}
|
|
3148
|
+
|
|
3149
|
+
@media (min-width: 1600px) {
|
|
3150
|
+
.aikit-header {
|
|
3151
|
+
--aikit-header-padding-x: var(--dt-space-10);
|
|
3152
|
+
--aikit-header-min-height: 4rem;
|
|
3153
|
+
}
|
|
3154
|
+
|
|
3155
|
+
.aikit-footer {
|
|
3156
|
+
--aikit-footer-padding: var(--dt-space-10) var(--dt-space-10) var(--dt-space-12);
|
|
3157
|
+
}
|
|
3158
|
+
}
|
|
3137
3159
|
`;function jn(e){let t={COMMENT:[],DELETION:[],GLOBAL_COMMENT:[]};for(let n of e)t[n.type in t?n.type:`COMMENT`].push(n);return t}function Mn(e){let t=i(e.id),r=[];return e.author&&r.push(`<span class="bk-annotation-author">${n(e.author)}</span>`),e.createdAt&&r.push(`<time class="bk-annotation-time">${n(e.createdAt)}</time>`),`<li class="bk-annotation-item" data-block-id="${t}" data-annotation-type="${e.type}">
|
|
3138
3160
|
<p class="bk-annotation-body">${n(e.body)}</p>
|
|
3139
3161
|
${r.length>0?`<div class="bk-annotation-meta">${r.join(``)}</div>`:``}
|
|
@@ -3175,11 +3197,38 @@ body {
|
|
|
3175
3197
|
font-family: var(--dt-font-sans);
|
|
3176
3198
|
-webkit-font-smoothing: antialiased;
|
|
3177
3199
|
-moz-osx-font-smoothing: grayscale;
|
|
3178
|
-
/* Smooth theme transitions */
|
|
3200
|
+
/* Smooth theme transitions + layout reflow */
|
|
3179
3201
|
transition: background var(--dt-transition-normal),
|
|
3180
3202
|
color var(--dt-transition-normal);
|
|
3181
3203
|
}
|
|
3182
3204
|
|
|
3205
|
+
/* ── Responsive media — scale with container ── */
|
|
3206
|
+
/* NOTE: iframe excluded — no intrinsic aspect ratio; height: auto collapses it */
|
|
3207
|
+
img, video, svg, canvas {
|
|
3208
|
+
max-width: 100%;
|
|
3209
|
+
height: auto;
|
|
3210
|
+
}
|
|
3211
|
+
|
|
3212
|
+
/* ── Large desktop: slightly larger base font for readability ── */
|
|
3213
|
+
@media (min-width: 1600px) {
|
|
3214
|
+
html {
|
|
3215
|
+
font-size: 17px;
|
|
3216
|
+
}
|
|
3217
|
+
}
|
|
3218
|
+
|
|
3219
|
+
@media (min-width: 2000px) {
|
|
3220
|
+
html {
|
|
3221
|
+
font-size: 18px;
|
|
3222
|
+
}
|
|
3223
|
+
}
|
|
3224
|
+
|
|
3225
|
+
/* ── Very large: cap font growth ── */
|
|
3226
|
+
@media (min-width: 2800px) {
|
|
3227
|
+
html {
|
|
3228
|
+
font-size: 19px;
|
|
3229
|
+
}
|
|
3230
|
+
}
|
|
3231
|
+
|
|
3183
3232
|
/* ── Reduced motion ── */
|
|
3184
3233
|
@media (prefers-reduced-motion: reduce) {
|
|
3185
3234
|
html { scroll-behavior: auto; }
|
|
@@ -3249,6 +3298,40 @@ body {
|
|
|
3249
3298
|
background: var(--dt-border-muted);
|
|
3250
3299
|
}
|
|
3251
3300
|
|
|
3301
|
+
/* ── Print-friendly: clean, no sticky/glow/scrollbar chrome ── */
|
|
3302
|
+
@media print {
|
|
3303
|
+
.aikit-header,
|
|
3304
|
+
.aikit-footer,
|
|
3305
|
+
.aikit-glow-primary,
|
|
3306
|
+
.aikit-glow-secondary,
|
|
3307
|
+
.aikit-copy-status {
|
|
3308
|
+
display: none !important;
|
|
3309
|
+
}
|
|
3310
|
+
body {
|
|
3311
|
+
background: #fff !important;
|
|
3312
|
+
color: #000 !important;
|
|
3313
|
+
min-height: auto !important;
|
|
3314
|
+
height: auto !important;
|
|
3315
|
+
}
|
|
3316
|
+
main {
|
|
3317
|
+
max-width: none !important;
|
|
3318
|
+
padding: 0 !important;
|
|
3319
|
+
margin: 0 !important;
|
|
3320
|
+
}
|
|
3321
|
+
}
|
|
3322
|
+
}
|
|
3323
|
+
|
|
3324
|
+
/* @page is a top-level at-rule per CSS spec — separate from @media print */
|
|
3325
|
+
@page {
|
|
3326
|
+
margin: 2cm;
|
|
3327
|
+
}
|
|
3328
|
+
|
|
3329
|
+
/* ── Gentle fade-in on page load ── */
|
|
3330
|
+
@keyframes aikit-fade-in {
|
|
3331
|
+
from { opacity: 0; transform: translateY(4px); }
|
|
3332
|
+
to { opacity: 1; transform: translateY(0); }
|
|
3333
|
+
}
|
|
3334
|
+
|
|
3252
3335
|
/* ── Content visibility for below-fold cards ── */
|
|
3253
3336
|
/* NOTE: Only apply to blocks with predictable heights. Content with
|
|
3254
3337
|
variable height (mermaid, code, timelines) gets layout shift if
|
|
@@ -3269,12 +3352,15 @@ main {
|
|
|
3269
3352
|
display: flex;
|
|
3270
3353
|
flex-direction: column;
|
|
3271
3354
|
gap: var(--aikit-main-gap, 1.5rem);
|
|
3355
|
+
animation: aikit-fade-in 0.3s ease-out;
|
|
3272
3356
|
}
|
|
3273
3357
|
|
|
3274
3358
|
main > * {
|
|
3275
3359
|
flex-shrink: 0;
|
|
3276
3360
|
}
|
|
3277
3361
|
|
|
3362
|
+
/* ── Responsive: nested breakpoints (mobile-first) ── */
|
|
3363
|
+
|
|
3278
3364
|
@media (max-width: 640px) {
|
|
3279
3365
|
main {
|
|
3280
3366
|
padding: var(--aikit-main-padding-mobile, 1rem 1rem);
|
|
@@ -3282,6 +3368,13 @@ main > * {
|
|
|
3282
3368
|
}
|
|
3283
3369
|
}
|
|
3284
3370
|
|
|
3371
|
+
@media (max-width: 480px) {
|
|
3372
|
+
main {
|
|
3373
|
+
padding: var(--aikit-main-padding-mobile-sm, 0.75rem 0.75rem);
|
|
3374
|
+
gap: var(--aikit-main-gap-mobile-sm, 0.75rem);
|
|
3375
|
+
}
|
|
3376
|
+
}
|
|
3377
|
+
|
|
3285
3378
|
@media (max-width: 360px) {
|
|
3286
3379
|
main {
|
|
3287
3380
|
padding: var(--aikit-main-padding-mobile-xs, 0.5rem 0.5rem);
|
|
@@ -3297,18 +3390,28 @@ main > * {
|
|
|
3297
3390
|
}
|
|
3298
3391
|
}
|
|
3299
3392
|
|
|
3300
|
-
|
|
3393
|
+
/* ── 768px–1199px: tablet — moderate widening ── */
|
|
3394
|
+
@media (min-width: 768px) {
|
|
3301
3395
|
main {
|
|
3302
|
-
|
|
3303
|
-
gap: var(--aikit-main-gap-mobile-sm, 0.75rem);
|
|
3396
|
+
max-width: var(--aikit-max-width-tablet, 90%);
|
|
3304
3397
|
}
|
|
3305
3398
|
}
|
|
3306
3399
|
|
|
3400
|
+
/* ── 1200px–1599px: desktop — standard content width ── */
|
|
3307
3401
|
@media (min-width: 1200px) {
|
|
3308
3402
|
main {
|
|
3309
3403
|
max-width: var(--aikit-max-width-wide, 1040px);
|
|
3310
3404
|
}
|
|
3311
3405
|
}
|
|
3406
|
+
|
|
3407
|
+
/* ── 1600px+: large desktop — wider layout ── */
|
|
3408
|
+
@media (min-width: 1600px) {
|
|
3409
|
+
main {
|
|
3410
|
+
max-width: var(--aikit-max-width-xlarge, 1200px);
|
|
3411
|
+
padding: var(--aikit-main-padding-xlarge, 2.5rem 2rem);
|
|
3412
|
+
gap: var(--aikit-main-gap-xlarge, 2rem);
|
|
3413
|
+
}
|
|
3414
|
+
}
|
|
3312
3415
|
`,An,...(Array.isArray(t)?t:typeof t==`string`?[t]:[]).filter(e=>e.trim().length>0)].join(`
|
|
3313
3416
|
`);return[` <style>${e}</style>`,` <style>${n}</style>`].join(`
|
|
3314
3417
|
`)}function Ci(e){let t=Object.entries(L).map(([e,t])=>` ${e}: ${t};`).join(`
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"manifest_version": "0.3",
|
|
3
3
|
"name": "aikit",
|
|
4
4
|
"display_name": "AI Kit",
|
|
5
|
-
"version": "0.1.
|
|
5
|
+
"version": "0.1.386",
|
|
6
6
|
"description": "Local-first AI developer toolkit — knowledge base, code analysis, context management, and developer tools for LLM agents",
|
|
7
7
|
"author": {
|
|
8
8
|
"name": "AnVPX",
|
|
@@ -3522,6 +3522,28 @@ html[data-theme='dark'] .aikit-theme-toggle-icon--moon {
|
|
|
3522
3522
|
box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.2);
|
|
3523
3523
|
}
|
|
3524
3524
|
}
|
|
3525
|
+
|
|
3526
|
+
/* ── Large desktop: more generous header padding ── */
|
|
3527
|
+
@media (min-width: 1200px) {
|
|
3528
|
+
.aikit-header {
|
|
3529
|
+
--aikit-header-padding-x: var(--dt-space-8);
|
|
3530
|
+
}
|
|
3531
|
+
|
|
3532
|
+
.aikit-footer {
|
|
3533
|
+
--aikit-footer-padding: var(--dt-space-8) var(--dt-space-8) var(--dt-space-10);
|
|
3534
|
+
}
|
|
3535
|
+
}
|
|
3536
|
+
|
|
3537
|
+
@media (min-width: 1600px) {
|
|
3538
|
+
.aikit-header {
|
|
3539
|
+
--aikit-header-padding-x: var(--dt-space-10);
|
|
3540
|
+
--aikit-header-min-height: 4rem;
|
|
3541
|
+
}
|
|
3542
|
+
|
|
3543
|
+
.aikit-footer {
|
|
3544
|
+
--aikit-footer-padding: var(--dt-space-10) var(--dt-space-10) var(--dt-space-12);
|
|
3545
|
+
}
|
|
3546
|
+
}
|
|
3525
3547
|
`;function Ar(e){let t={COMMENT:[],DELETION:[],GLOBAL_COMMENT:[]};for(let n of e)t[n.type in t?n.type:`COMMENT`].push(n);return t}function jr(e){let t=o(e.id),n=[];return e.author&&n.push(`<span class="bk-annotation-author">${i(e.author)}</span>`),e.createdAt&&n.push(`<time class="bk-annotation-time">${i(e.createdAt)}</time>`),`<li class="bk-annotation-item" data-block-id="${t}" data-annotation-type="${e.type}">
|
|
3526
3548
|
<p class="bk-annotation-body">${i(e.body)}</p>
|
|
3527
3549
|
${n.length>0?`<div class="bk-annotation-meta">${n.join(``)}</div>`:``}
|
|
@@ -5,4 +5,4 @@ import{fileURLToPath as e,pathToFileURL as t}from"node:url";import{parseArgs as
|
|
|
5
5
|
`).length,fileHash:this.hash(e.content),indexedAt:t,origin:`curated`,tags:e.frontmatter.tags,category:e.frontmatter.category,version:e.frontmatter.version}});try{return await this.store.upsert(i,r),e.length}catch(t){z.error(`Failed to upsert curated batch`,{batchSize:e.length,...o(t)});for(let t of e)n.push(`${t.relativePath}: upsert failed`);return 0}}catch(r){if(e.length===1)return z.error(`Failed to embed curated item`,{relativePath:e[0].relativePath,...o(r)}),n.push(`${e[0].relativePath}: reindex failed`),0;z.warn(`Curated embed batch failed, retrying with smaller chunks`,{batchSize:e.length,...o(r)});let i=Math.ceil(e.length/2),a=e.slice(0,i),s=e.slice(i);return await this.embedAndUpsertBatch(a,t,n)+await this.embedAndUpsertBatch(s,t,n)}}gitCommitKnowledge(e,t,n){try{if(!b(this.curatedDir))return;let r=this.knowledgeRefForPath(e);if(!r)return;x(r,`entry.md`,t,n,this.curatedDir)}catch{}}gitDeleteKnowledgeRef(e){try{if(!b(this.curatedDir))return;let t=this.knowledgeRefForPath(e);if(!t)return;S([`update-ref`,`-d`,t],this.curatedDir)}catch{}}knowledgeRefForPath(e){let t=e.replace(/\.md$/,``).split(`/`).map(e=>C(e)).join(`/`);return t.split(`/`).every(e=>y.test(e))?`${R}/${t}`:null}async indexCuratedFile(e,t,n){let r=await this.embedder.embed(t),i=`.ai/curated/${e}`,a=new Date().toISOString(),o={id:this.hashId(i,0),content:t,sourcePath:i,contentType:`curated-knowledge`,headingPath:n.title,chunkIndex:0,totalChunks:1,startLine:1,endLine:t.split(`
|
|
6
6
|
`).length,fileHash:this.hash(t),indexedAt:a,origin:`curated`,tags:n.tags,category:n.category,version:n.version};await this.store.upsert([o],[r])}async indexCuratedFileBestEffort(e,t,n,i){if(r.instance().isDegraded(`embedder`)){z.debug(`Skipping vector indexing — embedder degraded`,{relativePath:e,operation:i,subsystem:`embedder`});return}try{await this.indexCuratedFile(e,t,n)}catch(t){z.warn(`Curated file persisted but vector indexing deferred`,{relativePath:e,operation:i,...o(t)})}}async discoverCategories(){return this.adapter.listDirectories()}guardPath(e){let t=e.replace(/^\.ai\/curated\//,``);if(t.endsWith(`.md`)||(t+=`.md`),t.includes(`..`)||l(t))throw Error(`Invalid path: ${t}. Must be relative within .ai/curated/ directory.`);let n=t.split(`/`)[0];return this.validateCategoryName(n),t}validateCategoryName(e){if(!/^[a-z][a-z0-9-]*$/.test(e))throw Error(`Invalid category name: "${e}". Must be lowercase kebab-case (e.g., "decisions", "api-contracts").`)}validateContentSize(e){if(Buffer.byteLength(e,`utf-8`)>L)throw Error(`Content exceeds maximum size of ${L/1024}KB`)}slugify(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-|-$/g,``).slice(0,80)}normalizeTags(e){return[...new Set(e.map(e=>e.trim()).filter(Boolean))]}sameTags(e,t){if(e.length!==t.length)return!1;let n=new Set(e);return t.every(e=>n.has(e))}ensureCategoryPath(e,t){if(!e.startsWith(`${t}/`))throw Error(`Curated path "${e}" must stay within category "${t}"`)}async uniqueRelativePath(e,t){let n=`${e}/${t}.md`;if(!await this.adapter.exists(n))return n;for(let n=2;n<=100;n++){let r=`${e}/${t}-${n}.md`;if(!await this.adapter.exists(r))return r}throw Error(`Too many entries with slug "${t}" in category "${e}"`)}hash(e){return v(`sha256`).update(e).digest(`hex`).slice(0,16)}hashId(e,t){return this.hash(`${e}::${t}`)}serializeFile(e,t){return`${[`---`,`title: "${t.title.replace(/"/g,`\\"`)}"`,`category: ${t.category}`,`tags: [${t.tags.map(e=>`"${e}"`).join(`, `)}]`,`created: ${t.created}`,`updated: ${t.updated}`,`version: ${t.version}`,`origin: ${t.origin}`,`changelog:`,...t.changelog.map(e=>` - version: ${e.version}\n date: ${e.date}\n reason: "${e.reason.replace(/"/g,`\\"`)}"`),`---`].join(`
|
|
7
7
|
`)}\n\n${e}\n`}parseFile(e){let t=e.match(/^---\n([\s\S]*?)\n---\n\n?([\s\S]*)$/);if(!t)return{frontmatter:{title:`Untitled`,category:`notes`,tags:[],created:``,updated:``,version:1,origin:`curated`,changelog:[]},content:e};let n=t[1],r=t[2].trim(),i={},a=[],o=n.split(`
|
|
8
|
-
`),s=!1,c={};for(let e of o){if(/^changelog:\s*$/.test(e)){s=!0;continue}if(s){let t=e.match(/^\s+-\s+version:\s*(\d+)$/);if(t){c.version!=null&&a.push(c),c={version:parseInt(t[1],10)};continue}let n=e.match(/^\s+date:\s*(.+)$/);if(n){c.date=n[1].trim();continue}let r=e.match(/^\s+reason:\s*"?(.*?)"?\s*$/);if(r){c.reason=r[1];continue}/^\w/.test(e)&&(s=!1,c.version!=null&&a.push(c),c={});continue}let t=e.match(/^(\w+):\s*(.*)$/);if(t){let e=t[1],n=t[2];typeof n==`string`&&n.startsWith(`[`)&&n.endsWith(`]`)?n=n.slice(1,-1).split(`,`).map(e=>e.trim().replace(/^"|"$/g,``)).filter(e=>e.length>0):typeof n==`string`&&/^\d+$/.test(n)?n=parseInt(n,10):typeof n==`string`&&n.startsWith(`"`)&&n.endsWith(`"`)&&(n=n.slice(1,-1)),i[e]=n}}return c.version!=null&&a.push(c),{frontmatter:{title:i.title??`Untitled`,category:i.category??`notes`,tags:i.tags??[],created:i.created??``,updated:i.updated??``,version:i.version??1,origin:`curated`,changelog:a},content:r}}};const V=i(`server`);function H(e,t){return t?{version:e,...o(t)}:{version:e}}function U(){return process.env.AIKIT_TRANSPORT?process.env.AIKIT_TRANSPORT:process.stdin.isTTY?`http`:`stdio`}function W(){let e=process.argv[1];if(!e)return!1;try{return import.meta.url===t(e).href}catch{return!1}}function G(){return W()?n({allowPositionals:!0,options:{transport:{type:`string`,default:U()},port:{type:`string`,default:process.env.AIKIT_PORT??`3210`}}}).values:{transport:U(),port:process.env.AIKIT_PORT??`3210`}}async function K(){let e=t=>{t.name===`ExperimentalWarning`&&t.message.includes(`SQLite`)||(process.off(`warning`,e),process.emitWarning(t),process.on(`warning`,e))};process.on(`warning`,e);let t=w(),n=G();if(process.on(`unhandledRejection`,e=>{V.error(`Unhandled rejection`,H(t,e))}),process.on(`uncaughtException`,e=>{V.error(`Uncaught exception — exiting`,H(t,e)),process.exit(1)}),V.info(`Starting MCP AI Kit server`,{version:t}),n.transport===`http`){let{startHttpMode:e}=await import(`./server-http-
|
|
8
|
+
`),s=!1,c={};for(let e of o){if(/^changelog:\s*$/.test(e)){s=!0;continue}if(s){let t=e.match(/^\s+-\s+version:\s*(\d+)$/);if(t){c.version!=null&&a.push(c),c={version:parseInt(t[1],10)};continue}let n=e.match(/^\s+date:\s*(.+)$/);if(n){c.date=n[1].trim();continue}let r=e.match(/^\s+reason:\s*"?(.*?)"?\s*$/);if(r){c.reason=r[1];continue}/^\w/.test(e)&&(s=!1,c.version!=null&&a.push(c),c={});continue}let t=e.match(/^(\w+):\s*(.*)$/);if(t){let e=t[1],n=t[2];typeof n==`string`&&n.startsWith(`[`)&&n.endsWith(`]`)?n=n.slice(1,-1).split(`,`).map(e=>e.trim().replace(/^"|"$/g,``)).filter(e=>e.length>0):typeof n==`string`&&/^\d+$/.test(n)?n=parseInt(n,10):typeof n==`string`&&n.startsWith(`"`)&&n.endsWith(`"`)&&(n=n.slice(1,-1)),i[e]=n}}return c.version!=null&&a.push(c),{frontmatter:{title:i.title??`Untitled`,category:i.category??`notes`,tags:i.tags??[],created:i.created??``,updated:i.updated??``,version:i.version??1,origin:`curated`,changelog:a},content:r}}};const V=i(`server`);function H(e,t){return t?{version:e,...o(t)}:{version:e}}function U(){return process.env.AIKIT_TRANSPORT?process.env.AIKIT_TRANSPORT:process.stdin.isTTY?`http`:`stdio`}function W(){let e=process.argv[1];if(!e)return!1;try{return import.meta.url===t(e).href}catch{return!1}}function G(){return W()?n({allowPositionals:!0,options:{transport:{type:`string`,default:U()},port:{type:`string`,default:process.env.AIKIT_PORT??`3210`}}}).values:{transport:U(),port:process.env.AIKIT_PORT??`3210`}}async function K(){let e=t=>{t.name===`ExperimentalWarning`&&t.message.includes(`SQLite`)||(process.off(`warning`,e),process.emitWarning(t),process.on(`warning`,e))};process.on(`warning`,e);let t=w(),n=G();if(process.on(`unhandledRejection`,e=>{V.error(`Unhandled rejection`,H(t,e))}),process.on(`uncaughtException`,e=>{V.error(`Uncaught exception — exiting`,H(t,e)),process.exit(1)}),V.info(`Starting MCP AI Kit server`,{version:t}),n.transport===`http`){let{startHttpMode:e}=await import(`./server-http-B1iOYD9-.js`);await e(t,n.port)}else{let{startStdioMode:e}=await import(`./server-stdio-DSADqshO.js`);await e(t)}}K();export{T as a,k as i,I as n,E as o,F as r,O as s,B as t};
|
|
@@ -351,4 +351,4 @@ svg text{fill:var(--body);font-family:var(--sans);font-size:12px}
|
|
|
351
351
|
<\/script>
|
|
352
352
|
</body>
|
|
353
353
|
</html>`}const U=`<!-- DIAGRAM:SVG -->`;function W(e){let t=e.indexOf(U);if(t===-1)return null;let n=t+20,r=e.indexOf(U,n);if(r===-1)return null;let i=e.slice(n,r).trim();if(i.startsWith(`<svg`))return i;let a=e.slice(Math.max(0,t),r+20),o=a.match(/viewBox="([^"]+)"/),s=o?o[1]:`0 0 1200 800`,c=a.match(/width="(\d+)"/),l=c?c[1]:`1200`,u=a.match(/height="(\d+)"/);return[`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${s}" width="${l}" height="${u?u[1]:`800`}">`,` <defs>`,` <style>`,` text { font-family: system-ui, -apple-system, sans-serif; }`,` .title { font-size: 20px; font-weight: 600; fill: #fff; }`,` .subtitle { font-size: 14px; fill: #94a3b8; }`,` </style>`,` </defs>`,i,`</svg>`].join(`
|
|
354
|
-
`)}function he(e){let t=e.match(/<title>([^<]+)<\/title>/);return t?t[1]:`diagram`}async function ge(e,t,n){let r=m(n);await h(r,{recursive:!0});let i=he(e).replace(/[^a-zA-Z0-9\s-]/g,``).replace(/\s+/g,`-`).replace(/-+/g,`-`).replace(/^-|-$/g,``).toLowerCase().slice(0,80)||`diagram`,a=p(r,`${i}.html`);await g(a,e,`utf-8`);let o=null,s=W(e);s&&(o=p(r,`${i}.svg`),await g(o,s,`utf-8`));let c=null;return t&&(c=p(r,`${i}.md`),await g(c,t,`utf-8`)),{htmlPath:a,svgPath:o,mdPath:c}}const G=10*1024*1024,K=2e3;function _e(e){try{return JSON.stringify(e)}catch{return``}}function ve(e){switch(e.diagram_type){case`architecture`:return ae(e);case`workflow`:return H(e);case`sequence`:return R(e);case`dataflow`:return ce(e);case`lifecycle`:return P(e)}}function q(e,t={}){Y(e);let n=J(e);if(n.length>0)throw Error(`Diagram validation failed: ${n.join(`; `)}`);let r=t.title??e.meta.title,i=t.subtitle??e.meta.subtitle,a=t.dualOutput??!0,{svg:o,cardsHtml:s,detailData:c}=ve(e),l=c&&Object.keys(c).length>0?`\n<script id="diagram-node-data" type="application/json">${_e(c)}<\/script>`:``,u=e.meta?.palette===`warm`?`warm`:`technical`;return{html:me().replaceAll(`[TITLE]`,X(r)).replaceAll(`[SUBTITLE]`,X(i??``)).replaceAll(`[PALETTE]`,u===`warm`?` data-palette="warm"`:``).replaceAll(`<!-- DIAGRAM:SVG -->`,o).replaceAll(`<!-- DIAGRAM:CARDS -->`,s).replace(`</body>`,`${l}\n</body>`),markdown:a?_(e):void 0}}function ye(e,t={}){return q(e,{...t,dualOutput:!1}).html}function be(e){return _(e)}function xe(e){try{return Y(e),J(e)}catch(e){return[e.message]}}function J(e){if(!e||typeof e!=`object`)return[`Input must be an object`];if(!e.diagram_type)return[`Missing diagram_type`];if(!e.meta?.title)return[`meta.title is required`];if(e.schema_version!==1)return[`schema_version must be 1`];let t=e.diagram_type,n=e,r=n.components??n.nodes??n.participants??n.states??[],i=n.connections??n.edges??n.messages??n.flows??n.transitions??[],a=new Set(r.map(e=>e.id));if(a.size!==r.length)return[`${t}: Node/component IDs must be unique`];for(let e of i){if(e.from&&!a.has(e.from))return[`${t}: Edge references unknown source "${e.from}"`];if(e.to&&!a.has(e.to))return[`${t}: Edge references unknown target "${e.to}"`]}return[]}function Y(e){let t=JSON.stringify(e),n=Buffer.byteLength(t,`utf-8`);if(n>G)throw Error(`Input too large: ${(n/1024/1024).toFixed(1)}MB (max ${G/1024/1024}MB)`);let r=e,i=r.components??r.nodes??r.participants??[];if(i.length>500)throw Error(`Too many components/nodes: ${i.length} (max 500)`);let a=r.connections??r.edges??r.messages??r.flows??r.transitions??[];if(a.length>K)throw Error(`Too many edges/connections: ${a.length} (max ${K})`)}function Se(e){return e.replace(/[^a-zA-Z0-9-_]/g,`_`).toLowerCase().slice(0,120)}function X(e){let t={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`};return String(e??``).replace(/[&<>"']/g,e=>t[e]??e)}const Z=d(`server`);function Q(e,t){return t?{version:e,...f(t)}:{version:e}}function $(){return process.env.AIKIT_TRANSPORT?process.env.AIKIT_TRANSPORT:process.stdin.isTTY?`http`:`stdio`}function Ce(){let e=process.argv[1];if(!e)return!1;try{return import.meta.url===l(e).href}catch{return!1}}function we(){return Ce()?u({allowPositionals:!0,options:{transport:{type:`string`,default:$()},port:{type:`string`,default:process.env.AIKIT_PORT??`3210`}}}).values:{transport:$(),port:process.env.AIKIT_PORT??`3210`}}async function Te(){let e=t=>{t.name===`ExperimentalWarning`&&t.message.includes(`SQLite`)||(process.off(`warning`,e),process.emitWarning(t),process.on(`warning`,e))};process.on(`warning`,e);let n=t(),r=we();if(process.on(`unhandledRejection`,e=>{Z.error(`Unhandled rejection`,Q(n,e))}),process.on(`uncaughtException`,e=>{Z.error(`Uncaught exception — exiting`,Q(n,e)),process.exit(1)}),Z.info(`Starting MCP AI Kit server`,{version:n}),r.transport===`http`){let{startHttpMode:e}=await import(`./server-http-
|
|
354
|
+
`)}function he(e){let t=e.match(/<title>([^<]+)<\/title>/);return t?t[1]:`diagram`}async function ge(e,t,n){let r=m(n);await h(r,{recursive:!0});let i=he(e).replace(/[^a-zA-Z0-9\s-]/g,``).replace(/\s+/g,`-`).replace(/-+/g,`-`).replace(/^-|-$/g,``).toLowerCase().slice(0,80)||`diagram`,a=p(r,`${i}.html`);await g(a,e,`utf-8`);let o=null,s=W(e);s&&(o=p(r,`${i}.svg`),await g(o,s,`utf-8`));let c=null;return t&&(c=p(r,`${i}.md`),await g(c,t,`utf-8`)),{htmlPath:a,svgPath:o,mdPath:c}}const G=10*1024*1024,K=2e3;function _e(e){try{return JSON.stringify(e)}catch{return``}}function ve(e){switch(e.diagram_type){case`architecture`:return ae(e);case`workflow`:return H(e);case`sequence`:return R(e);case`dataflow`:return ce(e);case`lifecycle`:return P(e)}}function q(e,t={}){Y(e);let n=J(e);if(n.length>0)throw Error(`Diagram validation failed: ${n.join(`; `)}`);let r=t.title??e.meta.title,i=t.subtitle??e.meta.subtitle,a=t.dualOutput??!0,{svg:o,cardsHtml:s,detailData:c}=ve(e),l=c&&Object.keys(c).length>0?`\n<script id="diagram-node-data" type="application/json">${_e(c)}<\/script>`:``,u=e.meta?.palette===`warm`?`warm`:`technical`;return{html:me().replaceAll(`[TITLE]`,X(r)).replaceAll(`[SUBTITLE]`,X(i??``)).replaceAll(`[PALETTE]`,u===`warm`?` data-palette="warm"`:``).replaceAll(`<!-- DIAGRAM:SVG -->`,o).replaceAll(`<!-- DIAGRAM:CARDS -->`,s).replace(`</body>`,`${l}\n</body>`),markdown:a?_(e):void 0}}function ye(e,t={}){return q(e,{...t,dualOutput:!1}).html}function be(e){return _(e)}function xe(e){try{return Y(e),J(e)}catch(e){return[e.message]}}function J(e){if(!e||typeof e!=`object`)return[`Input must be an object`];if(!e.diagram_type)return[`Missing diagram_type`];if(!e.meta?.title)return[`meta.title is required`];if(e.schema_version!==1)return[`schema_version must be 1`];let t=e.diagram_type,n=e,r=n.components??n.nodes??n.participants??n.states??[],i=n.connections??n.edges??n.messages??n.flows??n.transitions??[],a=new Set(r.map(e=>e.id));if(a.size!==r.length)return[`${t}: Node/component IDs must be unique`];for(let e of i){if(e.from&&!a.has(e.from))return[`${t}: Edge references unknown source "${e.from}"`];if(e.to&&!a.has(e.to))return[`${t}: Edge references unknown target "${e.to}"`]}return[]}function Y(e){let t=JSON.stringify(e),n=Buffer.byteLength(t,`utf-8`);if(n>G)throw Error(`Input too large: ${(n/1024/1024).toFixed(1)}MB (max ${G/1024/1024}MB)`);let r=e,i=r.components??r.nodes??r.participants??[];if(i.length>500)throw Error(`Too many components/nodes: ${i.length} (max 500)`);let a=r.connections??r.edges??r.messages??r.flows??r.transitions??[];if(a.length>K)throw Error(`Too many edges/connections: ${a.length} (max ${K})`)}function Se(e){return e.replace(/[^a-zA-Z0-9-_]/g,`_`).toLowerCase().slice(0,120)}function X(e){let t={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`};return String(e??``).replace(/[&<>"']/g,e=>t[e]??e)}const Z=d(`server`);function Q(e,t){return t?{version:e,...f(t)}:{version:e}}function $(){return process.env.AIKIT_TRANSPORT?process.env.AIKIT_TRANSPORT:process.stdin.isTTY?`http`:`stdio`}function Ce(){let e=process.argv[1];if(!e)return!1;try{return import.meta.url===l(e).href}catch{return!1}}function we(){return Ce()?u({allowPositionals:!0,options:{transport:{type:`string`,default:$()},port:{type:`string`,default:process.env.AIKIT_PORT??`3210`}}}).values:{transport:$(),port:process.env.AIKIT_PORT??`3210`}}async function Te(){let e=t=>{t.name===`ExperimentalWarning`&&t.message.includes(`SQLite`)||(process.off(`warning`,e),process.emitWarning(t),process.on(`warning`,e))};process.on(`warning`,e);let n=t(),r=we();if(process.on(`unhandledRejection`,e=>{Z.error(`Unhandled rejection`,Q(n,e))}),process.on(`uncaughtException`,e=>{Z.error(`Uncaught exception — exiting`,Q(n,e)),process.exit(1)}),Z.info(`Starting MCP AI Kit server`,{version:n}),r.transport===`http`){let{startHttpMode:e}=await import(`./server-http-CoPnhJ2c.js`);await e(n,r.port)}else{let{startStdioMode:e}=await import(`./server-stdio-DaepLjg4.js`);await e(n)}}export{c as CuratedKnowledgeManager,s as applyWorkspaceRoots,a as bootstrapWorkspaceRoots,i as createSlidingWindowRateLimiter,ge as exportDiagram,W as extractSvg,n as getSessionIdHeader,Te as main,r as readPositiveIntEnv,t as readVersion,ye as renderHtml,be as renderMd,q as renderToResult,e as resolveCorsOrigin,Se as sanitizeTitle,o as selectWorkspaceRoot,xe as validate};
|