@vpxa/aikit 0.1.305 → 0.1.306

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.
Files changed (60) hide show
  1. package/package.json +1 -1
  2. package/packages/analyzers/dist/index.js +7 -7
  3. package/packages/blocks-core/dist/index.mjs +3 -2
  4. package/packages/cli/dist/index.js +19 -19
  5. package/packages/indexer/dist/index.js +1 -1
  6. package/packages/present/dist/index.html +3 -2
  7. package/packages/server/dist/auth-7LFAZQBu.js +1 -0
  8. package/packages/server/dist/auth-bEP-6uqy.js +2 -0
  9. package/packages/server/dist/bin.js +6 -6
  10. package/packages/server/dist/config-B-wvmMyo.js +1 -0
  11. package/packages/server/dist/config-Bx85fwRX.js +2 -0
  12. package/packages/server/dist/{curated-manager-i5QA4c79.js → curated-manager-BrgM_znO.js} +4 -4
  13. package/packages/server/dist/dashboard-static-Dw7Nsq4f.js +1 -0
  14. package/packages/server/dist/dashboard-static-dPnij4uF.js +2 -0
  15. package/packages/server/dist/index.d.ts +97 -88
  16. package/packages/server/dist/index.js +1 -1
  17. package/packages/server/dist/{promotion-DmwIVl0c.js → promotion-BGWhzk_I.js} +2 -2
  18. package/packages/server/dist/{promotion-bQutAIz-.js → promotion-RbjKfC88.js} +2 -2
  19. package/packages/server/dist/proxy.js +1 -1
  20. package/packages/server/dist/resolve-sibling-BmZ7AxaA.js +1 -0
  21. package/packages/server/dist/resolve-sibling-DrGKPpb0.js +2 -0
  22. package/packages/server/dist/{routes-1wkXLxXe.js → routes-C7bDyCOW.js} +2 -2
  23. package/packages/server/dist/{routes-KC-D2U8n.js → routes-CfG5gdSR.js} +2 -2
  24. package/packages/server/dist/{server-0bgaP0Re.js → server-B_KbLM43.js} +177 -175
  25. package/packages/server/dist/server-http-B-TDT3t-.js +2 -0
  26. package/packages/server/dist/server-http-BbuuthEP.js +1 -0
  27. package/packages/server/dist/server-stdio-BUb39kqq.js +2 -0
  28. package/packages/server/dist/server-stdio-Ch7yAxNk.js +1 -0
  29. package/packages/server/dist/{server-DQvOpYNO.js → server-utMi-Qu3.js} +177 -175
  30. package/packages/server/dist/server-utils-De-aZNQa.js +1 -0
  31. package/packages/server/dist/settings-static-BpQgaMRs.js +1 -0
  32. package/packages/server/dist/settings-static-MepJZjer.js +2 -0
  33. package/packages/server/dist/startup-maintenance-D0Uhpi3k.js +1 -0
  34. package/packages/server/dist/startup-maintenance-L9NUOBVy.js +2 -0
  35. package/packages/server/dist/version-check-6qDKknz4.js +1 -0
  36. package/packages/server/dist/version-check-DSWaugPC.js +2 -0
  37. package/packages/server/dist/workspace-bootstrap-BPWA6BVf.js +1 -0
  38. package/packages/server/viewers/canvas.html +3 -2
  39. package/packages/server/viewers/report-template.html +3 -2
  40. package/packages/server/viewers/tour-viewer.html +3 -2
  41. package/packages/store/dist/index.d.ts +3 -1
  42. package/packages/store/dist/index.js +24 -24
  43. package/scaffold/dist/adapters/hermes-agent.mjs +56 -0
  44. package/scaffold/dist/definitions/models.mjs +1 -1
  45. package/scaffold/dist/definitions/skills/c4-architecture.mjs +1 -1
  46. package/scaffold/dist/definitions/skills/docs.mjs +1 -1
  47. package/scaffold/dist/definitions/skills/present.mjs +1 -1
  48. package/scaffold/dist/generated/block-docs.mjs +13 -2
  49. package/packages/server/dist/auth-Bz5dmZgR.js +0 -1
  50. package/packages/server/dist/auth-lzZKfxlV.js +0 -2
  51. package/packages/server/dist/config-CaJwUDXI.js +0 -2
  52. package/packages/server/dist/config-_gMeJYrz.js +0 -1
  53. package/packages/server/dist/dashboard-static-CRfR1yKU.js +0 -2
  54. package/packages/server/dist/dashboard-static-FmfoS46e.js +0 -1
  55. package/packages/server/dist/resolve-sibling-1oDoO-Re.js +0 -1
  56. package/packages/server/dist/resolve-sibling-ByoHo7Tp.js +0 -2
  57. package/packages/server/dist/settings-static-B3lnYvcb.js +0 -2
  58. package/packages/server/dist/settings-static-BtvyIrza.js +0 -1
  59. package/packages/server/dist/version-check-CJK1Fwmy.js +0 -2
  60. package/packages/server/dist/version-check-yzdUDXHC.js +0 -1
@@ -1 +1 @@
1
- function e(){return[{file:`SKILL.md`,content:'---\nname: present\ndescription: "Use the AI Kit `present` tool to display rich interactive dashboards, charts, timelines, status boards, and data visualizations in the browser or in-chat. Covers all block types, chart types, actions, composition patterns, and MCP Apps templates (list-sort, data-table, picker, flame-graph, form, checklist, document, report, error, timeline, kanban, tree, diff-view, dashboard, status-board). Load this skill before calling the present tool to ensure professional output."\nmetadata:\n category: cross-cutting\n domain: general\n applicability: always\n inputs: [data, analysis]\n outputs: [dashboards, charts, reports]\n requires: [aikit]\nargument-hint: "Content to present — data, analysis results, status report, comparison, or interactive MCP App"\n---\n\n# Present Tool — Rich Interactive Dashboards\n\n> **Three-tier authoring model:** (1) Free-form `blocks[]`, (2) Named presets with structured data, (3) Viewer templates for custom HTML/iframes. Use `aikit://schemas/channel-surface` for block catalog, `aikit://present/presets` for preset contracts, `aikit://present/templates` for viewer schemas.\n\nThe tool normalizes all three input tiers into a validated `ChannelSurface` before rendering. Pipeline: **Input -> Normalizer -> ChannelSurface -> Transport Registry -> Render**. Validation errors return `{ code, reason, hint? }` (typed errors) -- not full schema dumps.\n\n## 0. Presets (Tier 2)\n\nPresets are named data contracts that expand `blocks[]` from structured input. 8 presets registered at runtime via `aikit://present/presets`:\n\n| Preset | Input shape | Expands to |\n|--------|------------|------------|\n| `summary` | `{ title, summary, passed?: number, failed?: number }` | heading, markdown, metrics |\n| `plan` | `{ title, steps: [{ label, checked }] }` | heading, checklist |\n| `understanding` | `{ title, explanation, details?: string }` | heading, markdown, kv |\n| `bug-analyze` | `{ title, severity, status, code?: string, analysis?: string }` | heading, kv, code, markdown |\n| `task-done` | `{ title, items: [{ label, checked }], completed?, total? }` | heading, checklist, metrics |\n| `review` | `{ title, criteria: [{ label, checked }] }` | heading, checklist + actions |\n| `explore` | `{ title, findings: [{ heading, code }] }` | heading, code (per finding) |\n| `decision` | `{ title, recommendation, options?: [{ title, items }] }` | heading, kv, comparison |\n\nEach preset supplies `inputSchema` (JSON Schema), `example` (JSON), and `expandsTo` (block description).\n\nUsage: pass `["preset-name", { title, ...fields }]` tuple directly, or `{ template: "preset-name", data: { ... } }` in a ChannelSurface.\n\nFull contracts available at runtime resource `aikit://present/presets`.\n\n## 0b. Shorthand Blocks (Tier 3)\n\nFor token-efficient ad-hoc surfaces, pass a `ShorthandInput` instead of a full ChannelSurface:\n\n```json\n{ "title": "Status", "blocks": ["# Results", ["M", [{ "label": "Pass", "value": 12 }]], "All good."] }\n```\n\n`blocks[]` elements can be:\n- **String**: auto-detected as heading (`# `), fenced code (```), pipe table (`|`), or markdown fallback.\n- **Tuple `[key, value]`**: key maps to block type via shortcut map below.\n- **Full object `{ type, value }`**: passes through as a standard TypedBlock.\nYou can also pass a bare string -- it expands to a single markdown block.\n\n### Shortcut Map\n\n| Key | Block type | Key | Block type |\n|-----|-----------|-----|-----------|\n| `h` | heading | `C` | chart |\n| `m` | markdown | `T` | timeline |\n| `t` | table | `g` | graph |\n| `p` | paragraph | `tr` | tree |\n| `c` | code | `cl` | checklist |\n| `s` | separator | `pr` | progress |\n| `M` | metrics | `sb` | status-board |\n| `kv` | kv | `ac` | actions |\n| `di` | mermaid | `tl` | timeline (alt) |\n\n## 1. API Shape\n\n- `schemaVersion: 1` is always required.\n- `title: string` is always required; do not use unicode escapes like `\\u2014`, use the actual character.\n- Optional layout fields: `layout?: { maxWidth?: string, padding?: string, columns?: number }`.\n- Optional appearance field: `colorScheme?: z.enum([\'light\', \'dark\', \'auto\'])`.\n- Interactive surfaces can also include `response?: { timeout?: number, required?: boolean }`.\n- Mode 1: block surface with `blocks: [{ type, title?, value }]`.\n- Mode 2: MCP App template with `template` + `data`.\n- Mode 3: viewer template with `template` + `data` for richer diagrams or flows.\n- No `actions` array means inline MCP App transport in the host client (except browser-only templates which auto-route to browser).\n- Inline transport is cross-host: AI Kit returns standard MCP Apps metadata, OpenAI compatibility metadata, and `ChannelSurface` structured content for hosts such as Codex, ChatGPT, and Copilot VS Code.\n- Any `actions` array means browser transport and opens the system browser. Valid action types: `button | select | multi-select | form-submit | text-submit | confirm | custom`.\n- CLI has no inline host; add a minimal action if you need the browser to open.\n\n```json\n{ "schemaVersion": 1, "title": "Release Review", "blocks": [{ "type": "metrics", "value": [] }] }\n```\n\n## 2. Content Blocks\n\nPass content as a `blocks` array of `{ type, title?, value }` objects.\n\n| Type | Value shape | Use for |\n|------|-------------|---------|\n| `prompt` | string | Prompt or callout text |\n| `text` | string | Plain text without markdown parsing |\n| `heading` | string | Standalone section headings |\n| `paragraph` | string | Standalone paragraph copy |\n| `markdown` | string | Prose, headings, code snippets |\n| `table` | `Record[]` or `{ headers, rows }` | Tabular data |\n| `chart` | `{ chartType, data, xKey?, yKeys? }` | `line | area | bar | horizontal-bar | pie | donut | sparkline | heatmap` |\n| `metrics` | `[{ label, value, trend?, status? }]` | KPI cards |\n| `cards` | `[{ title, body?, badge?, status? }]` | Summary cards |\n| `mermaid` | string | Diagrams (works in both mcp-app and browser) |\n| `tree` | `{ name, children? }` | Hierarchies |\n| `timeline` | `[{ title, description?, timestamp?, status? }]` | Event sequences |\n| `checklist` | `[{ label, checked }]` | Task lists |\n| `code` | string | Code or diff excerpts |\n| `comparison` | `[{title, items}]` or `{columns: [{title, items}]}` | Side-by-side option comparisons |\n| `status-board` | `[{category, items}]` or `{items: [{category, items}]}` | Service health boards |\n| `progress` | `{label, value, max?}` or `{items: [{label, value, max?, color?}]}` | Progress bars |\n| `graph` | `{ nodes: [{id, label?}], edges: [{from, to, label?}] }` | Network graphs |\n| `docs-browser` | `{ files: [{path, title?, content?, status?}], title? }` | Documentation indexes |\n| `actions` | `[{ type, id, label, variant?, options? }]` | Inline action group using the same action enum as top-level `actions` |\n| `separator` | none | Visual divider between block groups |\n\n> Anti-patterns:\n> - Prefer `table` blocks for tabular data (pipe tables in `markdown` are auto-normalized, but explicit table blocks are clearer and more efficient).\n> - Use `{ chartType, data, xKey, yKeys }`, not Chart.js `{ labels, datasets }`.\n> - Keep `markdown` for prose, headings, and code, not UI structure.\n> - **NEVER use `code` block for structured data** (arrays, objects, decisions, lists). Use `table`, `checklist`, or `markdown` instead.\n> - **NEVER JSON.stringify() data into a `code` or `markdown` block** — use the typed block that matches your data shape.\n\n### Data → Block Type Quick Reference\n\n| Your data looks like... | Use this block type | NOT this |\n|---|---|---|\n| Array of strings (decisions, findings, steps) | `markdown` (bullet list) | ~~`code` with JSON array~~ |\n| Key-value pairs (status, config, metadata) | `table` (two columns) | ~~`code` with JSON object~~ |\n| Rows × columns (comparisons, components) | `table` | ~~`markdown` with pipe table~~ |\n| Items with done/not-done state | `checklist` | ~~`markdown` with checkmark prefixes~~ |\n| Hierarchical items (file tree, org chart) | `tree` | ~~`code` with indentation~~ |\n| Numeric KPIs with labels | `metrics` | ~~`markdown`~~ |\n| Before/after or option A vs B | `comparison` | ~~two `code` blocks~~ |\n\n## 3. Actions\n\nAction shape: `{ type, id, label, variant?, options? }`\n\nValid action types: `button | select | multi-select | form-submit | text-submit | confirm | custom`\n\n\n```json\n{ "actions": [{ "type": "button", "id": "ack", "label": "Acknowledge", "variant": "primary" }] }\n```\n\n## 4. MCP App Templates\n\nUse templates for structured interactive widgets. They take `template` + `data`; returns depend on the widget.\n\n| Template | Purpose | Data shape | Returns |\n|----------|---------|------------|---------|\n| `list-sort` | Reorder a ranked list | `{ items: [{ id, label }] }` | Reordered items or IDs |\n| `data-table` | Inspect structured rows | `{ columns, rows, stats? }` | Current selection or filtered rows |\n| `picker` | Choose items from categories | `{ categories, items }` | Selected item IDs |\n| `flame-graph` | Explore hierarchical totals | `{ profile }` | Clicked node |\n| `form` | Collect field values | `{ fields }` | Submitted field map |\n| `checklist` | Run an interactive checklist | `{ items, title? }` | Checked state or submission payload |\n| `document` | Present structured long-form content | `{ sections, title? }` | Display only |\n| `report` | Present synthesized report content | `{ title, sections, metrics?, tables? }` | Display only |\n| `error` | Show structured error states and recovery actions | `{ code, message, details?, stack? }` | Display only |\n| `kanban` | Move cards across columns | `{ columns, cards }` | Card move payload |\n| `timeline` | Show ordered milestones | `{ events }` | Display only |\n| `tree` | Browse nested nodes | `{ root }` | Display only |\n| `diff-view` | Show file diffs | `{ files, stats? }` | Display only |\n| `dashboard` | Show metric cards | `{ metrics }` | Display only |\n| `status-board` | Show grouped status or health views | `{ categories }` | Display only |\n\n> **Auto-routing:** Browser-only templates (form, kanban, flame-graph, picker, list-sort) auto-route to browser transport even without explicit `actions`. No need to add a dummy action — the tool handles it.\n\n### `list-sort`\n`data`: `{ "items": [{ "id": "task-1", "label": "Fix auth bug" }] }`\n\n### `data-table`\n`data`: `{ "columns": [{ "key": "file", "label": "File" }], "rows": [{ "file": "auth.ts" }], "stats": [{ "label": "Files", "value": "1" }] }`\n\n### `picker`\n`data`: `{ "categories": [{ "id": "core", "label": "Core" }], "items": [{ "id": "auth", "label": "Auth", "category": "core", "tags": ["security"] }] }`\n\n### `flame-graph`\n`data`: `{ "profile": { "name": "root", "total": 100, "children": [{ "name": "packages/server", "total": 60 }] } }`\n\n### `form`\n`data`: `{ "fields": [{ "name": "projectName", "label": "Project Name", "type": "text", "value": "my-app" }] }`\n\n### `checklist`\n`data`: `{ "items": [{ "label": "Write tests", "checked": true }, { "label": "Update docs", "checked": false }], "title": "Sprint Tasks" }`\n\nTransports: mcp-app, browser (interactive — checkboxes toggle). NOT export.\n\n### `document`\n`data`: `{ "title": "Architecture Overview", "sections": [{ "heading": "Introduction", "content": "System overview text" }, { "heading": "Components", "content": [{ "type": "markdown", "value": "- API Gateway\\n- Auth Service" }] }] }`\n\nSections `content` can be a plain string OR an array of TypedBlock objects.\n\n### `report`\n`data`: `{ "title": "Weekly Status", "metrics": [{ "label": "Coverage", "value": "94%", "trend": "+2%", "status": "success" }], "sections": [{ "heading": "Summary", "content": "All systems operational" }], "tables": [{ "title": "Services", "headers": ["Name", "Status"], "rows": [["API", "healthy"], ["DB", "degraded"]] }] }`\n\nAll fields except `title` and `sections` are optional. `metrics` renders as metric cards; `tables` renders after sections.\n\n### `error`\n`data`: `{ "code": "AUTH_EXPIRED", "message": "Session token has expired", "details": "Token issued at 2026-01-01T00:00:00Z exceeded 24h TTL", "stack": "Error: AUTH_EXPIRED\\n at validateToken (auth.ts:42)" }`\n\nOnly `code` and `message` are required. `details` adds context below the message; `stack` renders as a separate code block.\n\n### `kanban`\n`data`: `{ "columns": [{ "id": "todo", "label": "To Do" }], "cards": [{ "id": "c1", "title": "Fix auth bug", "column": "todo" }] }`\n\n### `timeline`\n`data`: `{ "events": [{ "title": "v1.0 Release", "timestamp": "2026-05", "status": "complete" }] }`\n\nThe timeline template also accepts `entries` or `items` as the array field name (all three are equivalent).\n\n### `tree`\n`data`: `{ "root": { "label": "packages/", "children": [{ "label": "server/" }] } }`\n\n### `diff-view`\n`data`: `{ "files": [{ "path": "auth.ts", "status": "modified", "hunks": [{ "header": "@@ -1 +1 @@", "changes": [{ "type": "add", "content": "const ok = true;" }] }] }], "stats": { "filesChanged": 1 } }`\n\n### `dashboard`\n`data`: `{ "metrics": [{ "label": "Uptime", "value": "99.9%", "status": "success" }] }`\n\n### `status-board`\n`data`: `{ "categories": [{ "category": "Production", "items": [{ "label": "API Gateway", "status": "healthy" }, { "label": "Auth Service", "status": "degraded" }] }] }`\n\nNote: The template requires `{ categories: [...] }` (object with a `categories` key). This differs from the **block type** `status-board` which accepts a bare array as its value.\n\n⚠️ **WARNING:** Do NOT confuse template format with block format. When using `type: "status-board"` (block), value must be `[{category, items}]` (bare array) or `{items: [{category, items}]}`. The `{categories: [{category, items}]}` shape is ONLY for `template: "status-board"`.\n\n## 5. Viewer Templates\n\nViewer templates render richer visual surfaces from `template` + `data`.\n\n| Template | Transport | Purpose |\n|----------|-----------|---------|\n| `c4-static@1` | mcp-app | Static architecture diagram |\n| `c4@1` | browser | Interactive architecture diagram |\n| `process-flow-static@1` | mcp-app | Static process flow |\n| `process-flow@1` | browser | Interactive process flow |\n| `tour@1` | browser | Guided walkthrough or code tour |\n| `task-plan-static@1` | mcp-app | Static task execution plan with phases, batches, agent assignments |\n| `task-plan@1` | browser | Interactive task plan with ReactFlow — drag/zoom/pan, dependency edges, ELK layout |\n\n`c4`: `{ "nodes": [{ "id": "web", "type": "container", "label": "Web App", "technology?": "React" }], "edges": [{ "source": "web", "target": "api", "label": "HTTPS" }] }`\n\n`process-flow`: `{ "nodes": [{ "id": "start", "label": "Start", "type": "start-end" }], "edges": [{ "source": "start", "target": "review", "type?": "standard" }] }`\n\nNode types: `start-end` | `manual` | `automated` | `integration` | `decision` | `prerequisite`. Default: `manual`.\nEdge types: `standard` | `loop-back` | `exception`. Default: `standard`. `loop-back` and `exception` edges animate.\n\n`tour`: `{ "steps": [{ "id": "overview", "title": "Overview", "file": "src/index.ts", "explanation": "Entry point", "code?": "...", "line?": 1 }] }`\n\n`task-plan`: `{ "title": "Feature Name", "description?": "Optional", "phases": [{ "id": "p1", "label": "Phase 1", "outcome?": "...", "batches": [{ "id": "b1", "order": 1, "parallel": true, "label?": "Parallel Research", "tasks": [{ "id": "t1", "title": "Research auth", "agent": "Researcher-Alpha", "files?": ["src/auth/"], "status?": "done", "description?": "...", "dependsOn?": [] }] }] }] }`\n\nTask status values: `pending` | `in-progress` | `done` | `blocked`. Default: `pending`.\n\nGotcha: edges use `source` and `target`, not `from` and `to`.\n\nDecision tree:\n- Architecture, systems, containers, deployments: load the `c4-architecture` skill and use `c4@1` or `c4-static@1`.\n- Stateful workflows, approvals, or branching processes: use `process-flow@1` or `process-flow-static@1`.\n- Agent task decomposition, execution plans, or parallel batch visualization: use `task-plan@1` or `task-plan-static@1`.\n- Ordered walkthroughs, onboarding, or narrated analysis: use `tour@1`.\n\n## 6. Rules\n\n- Pick transport once: no `actions` for inline, any `actions` for browser.\n- Combine block types in one `blocks` array; metrics + chart + table + markdown is the normal composition pattern.\n- Use concise schemas in docs; do not expand to full `present()` calls unless behavior depends on them.\n- Use `table`, `comparison`, and `status-board` for structured data instead of formatting it inside markdown.\n- Architecture requests are delegated: load the `c4-architecture` skill for diagram guidance and data contracts.\n- If inline rendering only shows a title, raw JSON, or fallback text, first assume the host lacks or has disabled MCP Apps rendering. Switch to browser transport with a minimal action only when you need a deterministic fallback.\n- For large or mixed-content surfaces, browser transport is usually easier to review and more reliable.\n- For custom HTML demos or visual prototypes, do NOT use the "html" block type (renders as raw text inline). Instead, write an HTML file, serve it locally (e.g. "npx -y serve" or "python -m http.server"), then open with the AI Kit "browser" tool: browser({ action: "open", url: "http://localhost:PORT/file.html", mode: "ui" }). This gives a controlled Chromium instance the LLM can read/interact with. Avoid "Start-Process" (opens uncontrolled system browser).\n'}]}export{e as default};
1
+ function e(){return[{file:`SKILL.md`,content:'---\nname: present\ndescription: "Use the AI Kit `present` tool to display rich interactive dashboards, charts, timelines, status boards, and data visualizations in the browser or in-chat. Covers all 32 block types, chart types, actions, annotation system, and template contracts. Load this skill before calling the present tool to ensure professional output."\nmetadata:\n category: cross-cutting\n domain: general\n applicability: always\n inputs: [data, analysis]\n outputs: [dashboards, charts, reports]\n requires: [aikit]\nargument-hint: "Content to present — data, analysis results, status report, comparison, or interactive MCP App"\n---\n\n# Present Tool — Rich Interactive Dashboards\n\n> **Three-tier authoring model:** (1) Free-form `blocks[]`, (2) Named presets with structured data, (3) Viewer templates for custom HTML/iframes. Use `aikit://schemas/channel-surface` for block catalog, `aikit://present/presets` for preset contracts, `aikit://present/templates` for viewer schemas.\n\nThe tool normalizes all three input tiers into a validated `ChannelSurface` before rendering. Pipeline: **Input -> Normalizer -> ChannelSurface -> Transport Registry -> Render**. Validation errors return structured feedback with fix suggestions — not raw schema dumps.\n\n## 0. Auto-Activation & Feedback\n\n**When you include `actions` or set `response.required: true`, the present tool automatically activates browser transport.** You don\'t need to manually set `preferBrowser`.\n\n**A `💬 Feedback` action is automatically appended to every action array** so users can always provide input. It appears as a text-submit field at the end of the action list. This is added automatically — you do NOT need to include it in your `actions` array.\n\nFor surfaces without actions, the inline MCP App transport is used (renders inside the chat if supported).\n\n## 0b. Error Recovery\n\nWhen the present tool returns an error:\n- **`VALIDATION` errors**: Field-level fix suggestions are returned. Common issues:\n - `unknown block type`: Check the block type name — a list of closest matches is returned\n - `schemaVersion !== 1`: Always set `schemaVersion: 1`\n - `title missing`: Title is always required\n - `invalid field type`: The fix suggestion tells you the expected type\n- **`RENDER_FAILED` errors**: The block data is valid but rendering failed. Try simplifying the surface or switching to browser transport.\n- **Use `raw` field** for complex payloads (mermaid, code, many blocks) — the `raw` JSON string auto-repair handles common LLM JSON errors (unescaped newlines, trailing commas).\n\n## 1. Presets (Tier 2)\n\nPresets are named data contracts that expand `blocks[]` from structured input. 8 presets registered at runtime via `aikit://present/presets`:\n\n| Preset | Input shape | Expands to |\n|--------|------------|------------|\n| `summary` | `{ title, summary, passed?: number, failed?: number }` | heading, markdown, metrics |\n| `plan` | `{ title, steps: [{ label, checked }] }` | heading, checklist |\n| `understanding` | `{ title, explanation, details?: string }` | heading, markdown, kv |\n| `bug-analyze` | `{ title, severity, status, code?: string, analysis?: string }` | heading, kv, code, markdown |\n| `task-done` | `{ title, items: [{ label, checked }], completed?, total? }` | heading, checklist, metrics |\n| `review` | `{ title, criteria: [{ label, checked }] }` | heading, checklist + actions |\n| `explore` | `{ title, findings: [{ heading, code }] }` | heading, code (per finding) |\n| `decision` | `{ title, recommendation, options?: [{ title, items }] }` | heading, kv, comparison |\n\nEach preset supplies `inputSchema` (JSON Schema), `example` (JSON), and `expandsTo` (block description).\n\n## 2. All 32 Content Blocks\n\nPass content as a `blocks` array of `{ type, title?, value }` objects.\n\n| Category | Type | Value shape | Use for |\n|----------|------|-------------|---------|\n| **Content** | `prompt` | string | Prompt or callout text |\n| | `text` | string | Plain text without markdown parsing |\n| | `heading` | string | Standalone section headings |\n| | `paragraph` | string | Standalone paragraph copy |\n| | `markdown` | string | Prose, headings, code snippets |\n| | `code` | string | Code or diff excerpts |\n| | `list` | string[] | Bullet list items |\n| | `separator` | none | Visual divider |\n| | `diff` | `{ files: [{ path, hunks: [{ header, changes: [{ type, content }] }] }] }` | File diffs with +/- highlights |\n| | `finding` | `{ label: string; description?: string; severity?: string }` | Finding with severity pill (critical/high/medium/low) |\n| **Data** | `table` | `Record[]` or `{ headers, rows }` | Tabular data |\n| | `metrics` | `[{ label, value, trend?, status? }]` | KPI cards |\n| | `kv` | `Record<string, string>` | Key-value pairs |\n| | `tags` | string[] | Tag pills |\n| | `data-table-schema` | `{ fields: [{ name, type, required?, description?, constraints?, indexes? }] }` | Schema table with indexes |\n| | `chart` | `{ chartType, data, xKey?, yKeys? }` | `line | area | bar | horizontal-bar | pie | donut | sparkline | heatmap` |\n| **Visualization** | `cards` | `[{ title, body?, badge?, status? }]` | Summary cards |\n| | `tree` | `{ name, children? }` | Hierarchies |\n| | `timeline` | `[{ title, description?, timestamp?, status? }]` | Event sequences |\n| | `mermaid` | string | Diagrams |\n| | `graph` | `{ nodes: [{id, label?}], edges: [{from, to, label?}] }` | Network graphs |\n| | `comparison` | `[{title, items}]` or `{columns: [{title, items}]}` | Side-by-side comparisons |\n| | `lifecycle-flow` | `{ nodes: [{ id, label, type? }], edges: [{ source, target, label? }] }` | SVG flow diagram |\n| | `component-detail` | `{ name, type?, description?, responsibilities?, interfaces?, dependencies?, metrics?, codeLinks? }` | Component detail view |\n| **Interactive** | `checklist` | `[{ label, checked }]` | Task lists |\n| | `status-board` | `[{category, items}]` or `{items: [{category, items}]}` | Service health boards |\n| | `progress` | `{label, value, max?}` or `{items: [{label, value, max?, color?}]}` | Progress bars |\n| | `docs-browser` | `{ files: [{path, title?, content?, status?}], title? }` | Documentation indexes |\n| | `annotation` | `{ items: [{ label, description?, severity? }] }` | Annotation groups |\n| | `approval` | `{ options: [{ label, value }], comment?: string }` | Approval with options/textarea |\n| | `docs-hub` | `{ title, items: [{ title, description?, status? }] }` | Doc hub card grid |\n| **Layout** | `actions` | `[{ type, id, label, variant?, options? }]` | Inline action group |\n| | `separator` | none | Visual divider |\n\n> **Rules:**\n> - Prefer `table` blocks for tabular data (pipe tables in `markdown` are auto-normalized).\n> - Use `{ chartType, data, xKey, yKeys }`, not Chart.js `{ labels, datasets }`.\n> - Keep `markdown` for prose, headings, and code, not UI structure.\n> - **NEVER use `code` block for structured data** — use `table`, `checklist`, `kv`, or `markdown`.\n> - **NEVER JSON.stringify() data into a `code` or `markdown` block** — use the typed block.\n> - Block `title` is rendered as a section heading above the block (except for `heading` and `finding` types).\n\n### Data → Block Type Quick Reference\n\n| Your data looks like... | Use this block type | NOT this |\n|---|---|---|\n| Array of strings (decisions, findings, steps) | `list` or `markdown` (bullet list) | ~~`code` with JSON array~~ |\n| Key-value pairs (status, config, metadata) | `kv` or `table` (two columns) | ~~`code` with JSON object~~ |\n| Rows × columns (comparisons, components) | `table` | ~~`markdown` with pipe table~~ |\n| Items with done/not-done state | `checklist` | ~~`markdown` with checkmarks~~ |\n| Hierarchical items (file tree, org chart) | `tree` | ~~`code` with indentation~~ |\n| Numeric KPIs with labels | `metrics` | ~~`markdown`~~ |\n| Before/after or option A vs B | `comparison` | ~~two `code` blocks~~ |\n| Findings with severity | `finding` | ~~`markdown`~~ |\n| Approval or decision required | `approval` + `actions` | ~~`markdown` with options~~ |\n\n## 3. Actions & Annotation\n\nAction shape: `{ type, id, label, variant?, options? }`\n\nValid action types: `button | select | multi-select | form-submit | text-submit | confirm | custom`\n\n**Auto-activation:** Any `actions` array triggers browser transport automatically. The `response.required` flag also triggers browser transport.\n\n**Feedback action:** A "💬 Feedback" text-submit action is automatically appended to every action array. This lets users provide input without you having to add it manually.\n\n```json\n{ "actions": [{ "type": "button", "id": "ack", "label": "Acknowledge", "variant": "primary" }] }\n```\n\n## 4. MCP App Templates\n\n| Template | Purpose | Data shape | Returns |\n|----------|---------|------------|---------|\n| `list-sort` | Reorder a ranked list | `{ items: [{ id, label }] }` | Reordered items |\n| `data-table` | Inspect structured rows | `{ columns, rows, stats? }` | Selection/filter |\n| `picker` | Choose items from categories | `{ categories, items }` | Selected IDs |\n| `flame-graph` | Explore hierarchical totals | `{ profile }` | Clicked node |\n| `form` | Collect field values | `{ fields }` | Field map |\n| `checklist` | Interactive checklist | `{ items, title? }` | Checked state |\n| `document` | Structured long-form content | `{ sections, title? }` | Display only |\n| `report` | Synthesized report content | `{ title, sections, metrics?, tables? }` | Display only |\n| `error` | Structured error states | `{ code, message, details?, stack? }` | Display only |\n| `kanban` | Move cards across columns | `{ columns, cards }` | Card move |\n| `timeline` | Ordered milestones | `{ events }` | Display only |\n| `tree` | Browse nested nodes | `{ root }` | Display only |\n| `diff-view` | Show file diffs | `{ files, stats? }` | Display only |\n| `dashboard` | Show metric cards | `{ metrics }` | Display only |\n| `status-board` | Grouped status views | `{ categories }` | Display only |\n\n## 5. Viewer Templates\n\n| Template | Transport | Purpose |\n|----------|-----------|---------|\n| `c4-static@1` | mcp-app | Static architecture diagram |\n| `c4@1` | browser | Interactive architecture diagram |\n| `process-flow-static@1` | mcp-app | Static process flow |\n| `process-flow@1` | browser | Interactive process flow |\n| `tour@1` | browser | Guided walkthrough |\n| `task-plan-static@1` | mcp-app | Static task execution plan |\n| `task-plan@1` | browser | Interactive task plan with ReactFlow |\n\n## 6. Rules\n\n- **Auto-activation**: `actions` or `response.required` → browser transport. No `actions` → inline MCP App.\n- **Feedback**: A Feedback action is auto-appended. You do NOT need to add it.\n- **Error recovery**: Read the `fixSuggestion` field in validation errors — it tells you exactly what to change.\n- Use `raw` field for complex payloads to leverage auto-repair.\n- For custom HTML demos, write an HTML file, serve locally, open with `browser({ action: "open", url, mode: "ui" })`.\n- For surfaces with mixed content types (metrics + chart + table + markdown), combine them in one `blocks` array.\n- For structured data, prefer `table`, `kv`, `checklist`, `metrics` over reformatting in markdown.\n'}]}export{e as default};
@@ -1,4 +1,4 @@
1
- const e="| 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| `docs-browser` | Documentation file list with inline content previews for chat-safe rendering. | `{ 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#### `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```",t=` - type:"markdown" → value: string
1
+ const e='| 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| `docs-browser` | Documentation file list with inline content previews for chat-safe rendering. | `{ 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| `diff` | Diff view with +/- lines for showing changes between text. | `string | { content: string } | { before: string; after: string }` |\n| `finding` | Finding with severity pill showing title, severity, and detail. | `{ title?: string; severity?: string; detail?: unknown }` |\n| `kv` | Key-value pairs rendered as labeled entries. | `Array<{ key: string; value: unknown }> | Record<string, unknown>` |\n| `tags` | Tag pills rendered with optional tone/color. | `Array<string | { text?: string; label?: string; status?: string; tone?: string; color?: string }> | { items: Array<...> }` |\n| `list` | Bullet list items rendered as an unordered list. | `string[]` |\n| `lifecycle-flow` | SVG flow diagram with labeled steps, edges, and status colors. | `{ title?: string; steps: Array<{ id: string; label: string; type?: string; status?: string; description?: string }>; edges?: Array<{ from: string; to: string; label?: string }> }` |\n| `component-detail` | Component detail view with name, type, technology, responsibilities, interfaces, dependencies, metrics, and code links. | `{ name: string; description?: string; type?: string; technology?: string; responsibilities?: string[]; interfaces?: Array<{ name: string; type: string; description?: string }>; dependencies?: Array<{ name: string; relationship?: string }>; metrics?: Record<string, string | number>; codeLinks?: Array<{ href: string; label: string }> }` |\n| `data-table-schema` | Schema table with field names, types, constraints, and indexes. | `{ name: string; description?: string; fields: Array<{ name: string; type: string; required?: boolean; default?: unknown; constraints?: string[]; description?: string }>; indexes?: Array<{ name: string; columns: string[]; unique?: boolean }> }` |\n| `annotation` | Annotation groups with COMMENT, DELETION, and GLOBAL_COMMENT types. | `Array<{ id: string; type: "COMMENT" | "DELETION" | "GLOBAL_COMMENT"; body: string; author?: string; createdAt?: string }>` |\n| `approval` | Approval widget with radio options and optional comment textarea. | `{ prompt: string; options: Array<{ id: string; label: string; description?: string }>; requireComment?: boolean }` |\n| `docs-hub` | Doc hub card grid with titled pages, descriptions, categories, and statuses. | `{ title?: string; description?: string; pages?: Array<{ title: string; description?: string; href?: string; icon?: string; category?: string; status?: "draft" | "published" | "deprecated" }> }` |\n\n### Usage Examples\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```',t=` - type:"markdown" → value: string
2
2
  - type:"code" → value: string
3
3
  - type:"mermaid" → value: string
4
4
  - type:"table" → value: Record<string, unknown>[] | { headers: string[]; rows: unknown[][] }
@@ -18,4 +18,15 @@ const e="| Type | Description | Value Shape |\n|------|-------------|-----------
18
18
  - type:"heading" → value: string
19
19
  - type:"paragraph" → value: string
20
20
  - type:"separator" → value: undefined
21
- - type:"actions" → value: Array<{ type: string; id: string; label: string; variant?: string; options?: Array<string | { label: string; value: string }> }>`,n={present:"| 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| `docs-browser` | Documentation file list with inline content previews for chat-safe rendering. | `{ files: Array<{ path: string; title?: string; content?: string; status?: \"current\" | \"stale\" | \"missing\" }>; title?: string }` |\n\n### Usage Examples\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```",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| `cards` | Card grid for titled items with optional body, badge, and status. | `Array<{ title: string; body?: string; badge?: string; status?: string; description?: string }>` |\n| `docs-browser` | Documentation file list with inline content previews for chat-safe rendering. | `{ files: Array<{ path: string; title?: string; content?: string; status?: \"current\" | \"stale\" | \"missing\" }>; title?: string }` |\n\n### Usage Examples\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```","c4-architecture":"| Type | Description | Value Shape |\n|------|-------------|-------------|\n| `mermaid` | Mermaid diagram source rendered in a mermaid pre block. | `string` |\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 }> }` |"};export{e as ALL_BLOCK_DOCS,n as BLOCK_DOCS_BY_SKILL,t as BLOCK_TYPE_LIST};
21
+ - type:"actions" → value: Array<{ type: string; id: string; label: string; variant?: string; options?: Array<string | { label: string; value: string }> }>
22
+ - type:"diff" → value: string | { content: string } | { before: string; after: string }
23
+ - type:"finding" → value: { title?: string; severity?: string; detail?: unknown }
24
+ - type:"kv" → value: Array<{ key: string; value: unknown }> | Record<string, unknown>
25
+ - type:"tags" → value: Array<string | { text?: string; label?: string; status?: string; tone?: string; color?: string }> | { items: Array<...> }
26
+ - type:"list" → value: string[]
27
+ - type:"lifecycle-flow" → value: { title?: string; steps: Array<{ id: string; label: string; type?: string; status?: string; description?: string }>; edges?: Array<{ from: string; to: string; label?: string }> }
28
+ - type:"component-detail" → value: { name: string; description?: string; type?: string; technology?: string; responsibilities?: string[]; interfaces?: Array<{ name: string; type: string; description?: string }>; dependencies?: Array<{ name: string; relationship?: string }>; metrics?: Record<string, string | number>; codeLinks?: Array<{ href: string; label: string }> }
29
+ - type:"data-table-schema" → value: { name: string; description?: string; fields: Array<{ name: string; type: string; required?: boolean; default?: unknown; constraints?: string[]; description?: string }>; indexes?: Array<{ name: string; columns: string[]; unique?: boolean }> }
30
+ - type:"annotation" → value: Array<{ id: string; type: "COMMENT" | "DELETION" | "GLOBAL_COMMENT"; body: string; author?: string; createdAt?: string }>
31
+ - type:"approval" → value: { prompt: string; options: Array<{ id: string; label: string; description?: string }>; requireComment?: boolean }
32
+ - type:"docs-hub" → value: { title?: string; description?: string; pages?: Array<{ title: string; description?: string; href?: string; icon?: string; category?: string; status?: "draft" | "published" | "deprecated" }> }`,n={present:"| 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| `docs-browser` | Documentation file list with inline content previews for chat-safe rendering. | `{ files: Array<{ path: string; title?: string; content?: string; status?: \"current\" | \"stale\" | \"missing\" }>; title?: string }` |\n\n### Usage Examples\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```",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| `cards` | Card grid for titled items with optional body, badge, and status. | `Array<{ title: string; body?: string; badge?: string; status?: string; description?: string }>` |\n| `docs-browser` | Documentation file list with inline content previews for chat-safe rendering. | `{ files: Array<{ path: string; title?: string; content?: string; status?: \"current\" | \"stale\" | \"missing\" }>; title?: string }` |\n\n### Usage Examples\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```","c4-architecture":"| Type | Description | Value Shape |\n|------|-------------|-------------|\n| `mermaid` | Mermaid diagram source rendered in a mermaid pre block. | `string` |\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 }> }` |"};export{e as ALL_BLOCK_DOCS,n as BLOCK_DOCS_BY_SKILL,t as BLOCK_TYPE_LIST};
@@ -1 +0,0 @@
1
- import{t as e}from"./rolldown-runtime-DT7IzrpZ.js";import{randomBytes as t,timingSafeEqual as n}from"node:crypto";import*as r from"node:fs";import{join as i}from"node:path";import{homedir as a}from"node:os";var o=e({authMiddleware:()=>d,getOrCreateToken:()=>u,readToken:()=>f});const s=i(a(),`.aikit`);function c(e){let t=e?.tokenDir??s;return{tokenDir:t,tokenFile:i(t,`token`)}}function l(e,t){let r=Buffer.from(e),i=Buffer.from(t);return r.length===i.length?n(r,i):!1}function u(e){let{tokenDir:n,tokenFile:i}=c(e);if(r.existsSync(i)){let e=r.readFileSync(i,`utf-8`).trim();if(e.length>0)return e}r.existsSync(n)||r.mkdirSync(n,{recursive:!0,mode:448});let a=t(32).toString(`hex`);return r.writeFileSync(i,a,{mode:384}),a}function d(e){return(t,n,r)=>{if(t.path===`/health`||t.path===`/healthz`){r();return}let i=t.headers.authorization;if(!i?.startsWith(`Bearer `)){n.status(401).json({error:`Unauthorized: Bearer token required`});return}if(!l(i.slice(7).trim(),e)){n.status(401).json({error:`Unauthorized: Invalid token`});return}r()}}function f(e){try{let{tokenFile:t}=c(e);return r.readFileSync(t,`utf-8`).trim()}catch{return}}export{f as n,o as t};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{randomBytes as e,timingSafeEqual as t}from"node:crypto";import*as n from"node:fs";import{join as r}from"node:path";import{homedir as i}from"node:os";const a=r(i(),`.aikit`);function o(e){let t=e?.tokenDir??a;return{tokenDir:t,tokenFile:r(t,`token`)}}function s(e,n){let r=Buffer.from(e),i=Buffer.from(n);return r.length===i.length?t(r,i):!1}function c(t){let{tokenDir:r,tokenFile:i}=o(t);if(n.existsSync(i)){let e=n.readFileSync(i,`utf-8`).trim();if(e.length>0)return e}n.existsSync(r)||n.mkdirSync(r,{recursive:!0,mode:448});let a=e(32).toString(`hex`);return n.writeFileSync(i,a,{mode:384}),a}function l(e){return(t,n,r)=>{if(t.path===`/health`||t.path===`/healthz`){r();return}let i=t.headers.authorization;if(!i?.startsWith(`Bearer `)){n.status(401).json({error:`Unauthorized: Bearer token required`});return}if(!s(i.slice(7).trim(),e)){n.status(401).json({error:`Unauthorized: Invalid token`});return}r()}}function u(e){try{let{tokenFile:t}=o(e);return n.readFileSync(t,`utf-8`).trim()}catch{return}}export{l as authMiddleware,c as getOrCreateToken,u as readToken};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{o as e,t}from"./supersession-DO_ZROFl.js";import{existsSync as n,mkdirSync as r,readFileSync as i,writeFileSync as a}from"node:fs";import{dirname as o,isAbsolute as s,relative as c,resolve as l}from"node:path";import{fileURLToPath as u}from"node:url";import{AIKIT_RUNTIME_PATHS as d,EMBEDDING_DEFAULTS as f,computePartitionKey as p,createLogger as m,getPartitionDir as h,migrateLegacyWorkspaceLayout as g,serializeError as _}from"../../core/dist/index.js";const v={workingToEpisodicAccesses:2,episodicToSemanticReferences:3,semanticToProceduralVerifications:5},y={working:1,episodic:2,semantic:4,procedural:12};function b(e,t=v){switch(e.tier){case`working`:if(e.accessCount>=t.workingToEpisodicAccesses)return`episodic`;break;case`episodic`:if(e.accessCount>=t.workingToEpisodicAccesses+t.episodicToSemanticReferences)return`semantic`;break;case`semantic`:if(e.accessCount>=t.workingToEpisodicAccesses+t.episodicToSemanticReferences+t.semanticToProceduralVerifications)return`procedural`;break;case`procedural`:break;default:break}}function x(e,t,n){e.memoryMetaUpdateTier(t,n)}const S={stabilityHours:168,accessMultiplier:1.5,flagThreshold:.1,maxStabilityHours:8760};function C(e){return{...S,...e}}function w(e,t){if(!e)return t;let n=Date.parse(e);return Number.isNaN(n)?t:n}function T(e){return e&&e in y?e:`working`}function E(e,t,n,r=S,i){let a=typeof r==`string`?T(r):`working`,o=C(typeof r==`string`?i:r),s=w(e,w(n,Date.now())),c=Math.max(0,Date.now()-s)/(1e3*60*60),l=Math.min(o.stabilityHours*y[a]*o.accessMultiplier**Math.max(0,t),o.maxStabilityHours);return Math.exp(-c/l)}function D(e,t,n){let r=e.memoryMetaGet(t);if(!r)return;let i=E(r.lastAccessedAt,r.accessCount,r.createdAt,r.tier,n);return r.retentionScore!==i&&e.memoryMetaUpdateScore(t,i),e.memoryMetaGet(t)??{...r,retentionScore:i}}function O(e,t,n){e.memoryMetaGet(t)||e.memoryMetaCreate(t),e.memoryMetaTouch(t);let r=e.memoryMetaGet(t);if(!r)return 1;let i=E(r.lastAccessedAt,r.accessCount,r.createdAt,r.tier,n);return e.memoryMetaUpdateScore(t,i),i}function k(e,t){let n=C(t);return e.memoryMetaList().map(t=>D(e,t.entryId,n)??t).filter(e=>e.retentionScore<n.flagThreshold).sort((e,t)=>e.retentionScore-t.retentionScore)}const A=o(u(import.meta.url)),j=m(`server`),M=[`auto`,`manual`,`smart`],N={model:f.model,dimensions:f.dimensions,childProcess:!0,idleTimeoutMs:3e5};function P(e){return typeof e==`string`&&M.includes(e)}function F(e,t,n){let r=l(e),i=c(l(t),r);if(i.startsWith(`..`)||s(i))throw Error(`Config ${n} path escapes allowed root: ${e} is not under ${t}`);return r}function I(e,t){let n=l(e),r=c(l(t),n);return!(r.startsWith(`..`)||s(r))}function L(e){return h(p(e))}function R(e,t,n,r,i){let a=r?l(t,r):t;if(!n)return F(a,t,i);let o=l(e,n);return I(o,t)?r&&l(o)===l(t)?F(a,t,i):F(o,t,i):F(a,t,i)}function z(e){let t=[e.store?.path,e.curated?.path,e.onboardDir,e.stateDir];for(let e of t)e&&r(e,{recursive:!0})}function B(e,t){g(t);let n=L(t);e.store={...e.store,path:R(t,n,e.store?.path,d.data,`store`)},e.curated={...e.curated,path:R(t,n,e.curated?.path,d.curated,`curated`)},e.onboardDir=R(t,n,e.onboardDir,d.onboard,`onboard`),e.stateDir=R(t,n,e.stateDir,d.state,`state`)}function V(e){let t=process.env.AIKIT_INDEX_MODE;if(P(t))return t;if(e.indexMode)return e.indexMode;let n=process.env.AIKIT_AUTO_INDEX;return n===void 0?e.autoIndex===void 0?`smart`:e.autoIndex?`auto`:`manual`:n===`true`?`auto`:`manual`}function H(){let r=process.env.AIKIT_CONFIG_PATH??(n(l(process.cwd(),`aikit.config.json`))?l(process.cwd(),`aikit.config.json`):l(A,`..`,`..`,`..`,`aikit.config.json`));try{if(!n(r))return j.info(`No config file found, using defaults`,{configPath:r}),W();let a=i(r,`utf-8`),s=JSON.parse(a),c={...N,...s.embedding};if(s.embedding=c,s.memory={retention:{...S,...s.memory?.retention},lessons:{...e,...s.memory?.lessons},consolidation:{...v,...s.memory?.consolidation},supersession:{...t,...s.memory?.supersession}},s.logging?.errorDetails!==void 0&&typeof s.logging.errorDetails!=`boolean`)throw Error(`Config logging.errorDetails must be a boolean`);if(s.logging={errorDetails:s.logging?.errorDetails===!0},!s.sources||!Array.isArray(s.sources)||s.sources.length===0)throw Error(`Config must have at least one source`);if(!s.store?.path)throw Error(`Config must specify store.path`);if(s.autoIndex!==void 0&&typeof s.autoIndex!=`boolean`)throw Error(`Config autoIndex must be a boolean`);if(s.indexMode!==void 0&&!P(s.indexMode))throw Error(`Config indexMode must be one of: ${M.join(`, `)}`);if(typeof c.model!=`string`||c.model.trim()===``)throw Error(`Config embedding.model must be a non-empty string`);if(c.nativeDim!==void 0&&(!Number.isInteger(c.nativeDim)||c.nativeDim<=0))throw Error(`Config embedding.nativeDim must be a positive integer`);if(c.dimensions!==void 0&&(!Number.isInteger(c.dimensions)||c.dimensions<=0))throw Error(`Config embedding.dimensions must be a positive integer`);if(c.dimensions!==void 0&&c.nativeDim!==void 0&&c.dimensions>c.nativeDim)throw Error(`Config embedding.dimensions must not exceed embedding.nativeDim`);if(c.queryPrefix!==void 0&&typeof c.queryPrefix!=`string`)throw Error(`Config embedding.queryPrefix must be a string`);let u=o(r);return s.sources=s.sources.map(e=>({...e,path:F(l(u,e.path),u,`source`)})),G(s,r),B(s,u),s.indexMode=V(s),s}catch(e){let t=`Failed to load config from ${r}. ${e instanceof Error?e.message:String(e)}`;console.error(`\n ⚠ CONFIG ERROR — ${t}\n Check that the file exists, is valid JSON, and all required fields are present.\n`),j.error(`Failed to load config`,{configPath:r,..._(e)}),j.warn(`Falling back to default configuration`,{configPath:r});let n=W();return n.configError=t,n}}const U=[`.git/**`,`**/node_modules/**`,`*.lock`,`pnpm-lock.yaml`,`package-lock.json`,`**/dist/**`,`**/build/**`,`**/out/**`,`**/.output/**`,`**/cdk.out/**`,`**/.next/**`,`**/.nuxt/**`,`**/.vercel/**`,`**/.serverless/**`,`**/.turbo/**`,`**/.cache/**`,`**/.parcel-cache/**`,`**/coverage/**`,`**/.terraform/**`,`**/__pycache__/**`,`**/.venv/**`,`**/.docusaurus/**`,`**/.temp/**`,`**/tmp/**`];function W(){let n=process.env.AIKIT_WORKSPACE_ROOT??process.cwd(),r=L(n),i={sources:[{path:n,excludePatterns:[...U]}],serverName:`aikit`,indexing:{chunkSize:800,chunkOverlap:150,minChunkSize:100},embedding:{...N},store:{backend:`sqlite-vec`,path:l(r,d.data)},curated:{path:l(r,d.curated)},memory:{retention:{...S},lessons:{...e},consolidation:{...v},supersession:{...t}},logging:{errorDetails:!1},onboardDir:l(r,d.onboard),stateDir:l(r,d.state)};return i.indexMode=V(i),i}function G(e,t){let n=e.configVersion??0;if(n>=1)return e;if(n<1)for(let t of e.sources){t.excludePatterns=t.excludePatterns??[];let e=new Set(t.excludePatterns);for(let n of U)e.has(n)||t.excludePatterns.push(n)}e.configVersion=1;try{a(t,`${JSON.stringify(e,null,2)}\n`,`utf-8`),j.info(`Config auto-upgraded`,{from:n,to:1,configPath:t})}catch(e){j.warn(`Failed to write upgraded config`,{configPath:t,..._(e)})}return e}function K(e,t){if(!n(t))throw Error(`Workspace root does not exist: ${t}`);g(t),j.debug(`Reconfiguring for workspace root`,{workspaceRoot:t});try{process.chdir(t),j.debug(`Changed process cwd to workspace root`,{cwd:process.cwd()})}catch(e){j.warn(`Failed to chdir to workspace root`,{workspaceRoot:t,..._(e)})}e.sources=[{path:t,excludePatterns:e.sources[0]?.excludePatterns??[`node_modules/**`,`dist/**`,`.git/**`,`coverage/**`,`*.lock`,`pnpm-lock.yaml`]}],B(e,t),z(e)}export{U as DEFAULT_EXCLUDE_PATTERNS,b as a,v as i,H as loadConfig,D as n,x as o,O as r,K as reconfigureForWorkspace,V as resolveIndexMode,k as t};
@@ -1 +0,0 @@
1
- import{o as e,t}from"./supersession-CWEne3av.js";import{existsSync as n,mkdirSync as r,readFileSync as i,writeFileSync as a}from"node:fs";import{dirname as o,isAbsolute as s,relative as c,resolve as l}from"node:path";import{fileURLToPath as u}from"node:url";import{AIKIT_RUNTIME_PATHS as d,EMBEDDING_DEFAULTS as f,computePartitionKey as p,createLogger as m,getPartitionDir as h,migrateLegacyWorkspaceLayout as g,serializeError as _}from"../../core/dist/index.js";const v={workingToEpisodicAccesses:2,episodicToSemanticReferences:3,semanticToProceduralVerifications:5},y={working:1,episodic:2,semantic:4,procedural:12};function b(e,t=v){switch(e.tier){case`working`:if(e.accessCount>=t.workingToEpisodicAccesses)return`episodic`;break;case`episodic`:if(e.accessCount>=t.workingToEpisodicAccesses+t.episodicToSemanticReferences)return`semantic`;break;case`semantic`:if(e.accessCount>=t.workingToEpisodicAccesses+t.episodicToSemanticReferences+t.semanticToProceduralVerifications)return`procedural`;break;case`procedural`:break;default:break}}function x(e,t,n){e.memoryMetaUpdateTier(t,n)}const S={stabilityHours:168,accessMultiplier:1.5,flagThreshold:.1,maxStabilityHours:8760};function C(e){return{...S,...e}}function w(e,t){if(!e)return t;let n=Date.parse(e);return Number.isNaN(n)?t:n}function T(e){return e&&e in y?e:`working`}function E(e,t,n,r=S,i){let a=typeof r==`string`?T(r):`working`,o=C(typeof r==`string`?i:r),s=w(e,w(n,Date.now())),c=Math.max(0,Date.now()-s)/(1e3*60*60),l=Math.min(o.stabilityHours*y[a]*o.accessMultiplier**Math.max(0,t),o.maxStabilityHours);return Math.exp(-c/l)}function D(e,t,n){let r=e.memoryMetaGet(t);if(!r)return;let i=E(r.lastAccessedAt,r.accessCount,r.createdAt,r.tier,n);return r.retentionScore!==i&&e.memoryMetaUpdateScore(t,i),e.memoryMetaGet(t)??{...r,retentionScore:i}}function O(e,t,n){e.memoryMetaGet(t)||e.memoryMetaCreate(t),e.memoryMetaTouch(t);let r=e.memoryMetaGet(t);if(!r)return 1;let i=E(r.lastAccessedAt,r.accessCount,r.createdAt,r.tier,n);return e.memoryMetaUpdateScore(t,i),i}function k(e,t){let n=C(t);return e.memoryMetaList().map(t=>D(e,t.entryId,n)??t).filter(e=>e.retentionScore<n.flagThreshold).sort((e,t)=>e.retentionScore-t.retentionScore)}const A=o(u(import.meta.url)),j=m(`server`),M=[`auto`,`manual`,`smart`],N={model:f.model,dimensions:f.dimensions,childProcess:!0,idleTimeoutMs:3e5};function P(e){return typeof e==`string`&&M.includes(e)}function F(e,t,n){let r=l(e),i=c(l(t),r);if(i.startsWith(`..`)||s(i))throw Error(`Config ${n} path escapes allowed root: ${e} is not under ${t}`);return r}function I(e,t){let n=l(e),r=c(l(t),n);return!(r.startsWith(`..`)||s(r))}function L(e){return h(p(e))}function R(e,t,n,r,i){let a=r?l(t,r):t;if(!n)return F(a,t,i);let o=l(e,n);return I(o,t)?r&&l(o)===l(t)?F(a,t,i):F(o,t,i):F(a,t,i)}function z(e){let t=[e.store?.path,e.curated?.path,e.onboardDir,e.stateDir];for(let e of t)e&&r(e,{recursive:!0})}function B(e,t){g(t);let n=L(t);e.store={...e.store,path:R(t,n,e.store?.path,d.data,`store`)},e.curated={...e.curated,path:R(t,n,e.curated?.path,d.curated,`curated`)},e.onboardDir=R(t,n,e.onboardDir,d.onboard,`onboard`),e.stateDir=R(t,n,e.stateDir,d.state,`state`)}function V(e){let t=process.env.AIKIT_INDEX_MODE;if(P(t))return t;if(e.indexMode)return e.indexMode;let n=process.env.AIKIT_AUTO_INDEX;return n===void 0?e.autoIndex===void 0?`smart`:e.autoIndex?`auto`:`manual`:n===`true`?`auto`:`manual`}function H(){let r=process.env.AIKIT_CONFIG_PATH??(n(l(process.cwd(),`aikit.config.json`))?l(process.cwd(),`aikit.config.json`):l(A,`..`,`..`,`..`,`aikit.config.json`));try{if(!n(r))return j.info(`No config file found, using defaults`,{configPath:r}),W();let a=i(r,`utf-8`),s=JSON.parse(a),c={...N,...s.embedding};if(s.embedding=c,s.memory={retention:{...S,...s.memory?.retention},lessons:{...e,...s.memory?.lessons},consolidation:{...v,...s.memory?.consolidation},supersession:{...t,...s.memory?.supersession}},s.logging?.errorDetails!==void 0&&typeof s.logging.errorDetails!=`boolean`)throw Error(`Config logging.errorDetails must be a boolean`);if(s.logging={errorDetails:s.logging?.errorDetails===!0},!s.sources||!Array.isArray(s.sources)||s.sources.length===0)throw Error(`Config must have at least one source`);if(!s.store?.path)throw Error(`Config must specify store.path`);if(s.autoIndex!==void 0&&typeof s.autoIndex!=`boolean`)throw Error(`Config autoIndex must be a boolean`);if(s.indexMode!==void 0&&!P(s.indexMode))throw Error(`Config indexMode must be one of: ${M.join(`, `)}`);if(typeof c.model!=`string`||c.model.trim()===``)throw Error(`Config embedding.model must be a non-empty string`);if(c.nativeDim!==void 0&&(!Number.isInteger(c.nativeDim)||c.nativeDim<=0))throw Error(`Config embedding.nativeDim must be a positive integer`);if(c.dimensions!==void 0&&(!Number.isInteger(c.dimensions)||c.dimensions<=0))throw Error(`Config embedding.dimensions must be a positive integer`);if(c.dimensions!==void 0&&c.nativeDim!==void 0&&c.dimensions>c.nativeDim)throw Error(`Config embedding.dimensions must not exceed embedding.nativeDim`);if(c.queryPrefix!==void 0&&typeof c.queryPrefix!=`string`)throw Error(`Config embedding.queryPrefix must be a string`);let u=o(r);return s.sources=s.sources.map(e=>({...e,path:F(l(u,e.path),u,`source`)})),G(s,r),B(s,u),s.indexMode=V(s),s}catch(e){let t=`Failed to load config from ${r}. ${e instanceof Error?e.message:String(e)}`;console.error(`\n ⚠ CONFIG ERROR — ${t}\n Check that the file exists, is valid JSON, and all required fields are present.\n`),j.error(`Failed to load config`,{configPath:r,..._(e)}),j.warn(`Falling back to default configuration`,{configPath:r});let n=W();return n.configError=t,n}}const U=[`.git/**`,`**/node_modules/**`,`*.lock`,`pnpm-lock.yaml`,`package-lock.json`,`**/dist/**`,`**/build/**`,`**/out/**`,`**/.output/**`,`**/cdk.out/**`,`**/.next/**`,`**/.nuxt/**`,`**/.vercel/**`,`**/.serverless/**`,`**/.turbo/**`,`**/.cache/**`,`**/.parcel-cache/**`,`**/coverage/**`,`**/.terraform/**`,`**/__pycache__/**`,`**/.venv/**`,`**/.docusaurus/**`,`**/.temp/**`,`**/tmp/**`];function W(){let n=process.env.AIKIT_WORKSPACE_ROOT??process.cwd(),r=L(n),i={sources:[{path:n,excludePatterns:[...U]}],serverName:`aikit`,indexing:{chunkSize:800,chunkOverlap:150,minChunkSize:100},embedding:{...N},store:{backend:`sqlite-vec`,path:l(r,d.data)},curated:{path:l(r,d.curated)},memory:{retention:{...S},lessons:{...e},consolidation:{...v},supersession:{...t}},logging:{errorDetails:!1},onboardDir:l(r,d.onboard),stateDir:l(r,d.state)};return i.indexMode=V(i),i}function G(e,t){let n=e.configVersion??0;if(n>=1)return e;if(n<1)for(let t of e.sources){t.excludePatterns=t.excludePatterns??[];let e=new Set(t.excludePatterns);for(let n of U)e.has(n)||t.excludePatterns.push(n)}e.configVersion=1;try{a(t,`${JSON.stringify(e,null,2)}\n`,`utf-8`),j.info(`Config auto-upgraded`,{from:n,to:1,configPath:t})}catch(e){j.warn(`Failed to write upgraded config`,{configPath:t,..._(e)})}return e}function K(e,t){if(!n(t))throw Error(`Workspace root does not exist: ${t}`);g(t),j.debug(`Reconfiguring for workspace root`,{workspaceRoot:t});try{process.chdir(t),j.debug(`Changed process cwd to workspace root`,{cwd:process.cwd()})}catch(e){j.warn(`Failed to chdir to workspace root`,{workspaceRoot:t,..._(e)})}e.sources=[{path:t,excludePatterns:e.sources[0]?.excludePatterns??[`node_modules/**`,`dist/**`,`.git/**`,`coverage/**`,`*.lock`,`pnpm-lock.yaml`]}],B(e,t),z(e)}export{U as DEFAULT_EXCLUDE_PATTERNS,b as a,v as i,H as loadConfig,D as n,x as o,O as r,K as reconfigureForWorkspace,V as resolveIndexMode,k as t};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{t as e}from"./resolve-sibling-ByoHo7Tp.js";import{createReadStream as t,existsSync as n,statSync as r}from"node:fs";import{dirname as i,extname as a,join as o,resolve as s,sep as c}from"node:path";import{fileURLToPath as l}from"node:url";const u=import.meta.dirname??i(l(import.meta.url)),d={".html":`text/html`,".js":`application/javascript`,".css":`text/css`,".json":`application/json`,".png":`image/png`,".svg":`image/svg+xml`,".ico":`image/x-icon`,".woff":`font/woff`,".woff2":`font/woff2`};function f(t){return t?o(t,`..`,`..`,`dashboard`,`dist`):e(`dashboard`)??o(u,`..`,`..`,`dashboard`,`dist`)}function p(e,t){let i=t.replace(/^\/_dashboard\/?/,``)||`index.html`;try{i=decodeURIComponent(i)}catch{}let l=s(e,i);if(!(l===e||l.startsWith(`${e}${c}`)))return{kind:`forbidden`};try{if(r(l).isFile())return{kind:`file`,path:l,contentType:d[a(l)]??`application/octet-stream`}}catch{}let u=o(e,`index.html`);return n(u)?{kind:`spa`,path:u,contentType:`text/html`}:{kind:`not-found`}}function m(e,r,i){return n(r)?(e.get(`/_dashboard{/*path}`,(e,n)=>{let i=p(r,e.path);if(i.kind===`forbidden`){n.status(403).end(`Forbidden`);return}if(i.kind===`not-found`){n.status(404).end(`Not found`);return}n.setHeader(`Content-Type`,i.contentType),i.kind===`file`&&/\.[a-f0-9]{8,}\.(js|css)$/i.test(i.path)?n.setHeader(`Cache-Control`,`public, max-age=31536000, immutable`):n.setHeader(`Cache-Control`,`no-cache`),t(i.path).pipe(n)}),i.info(`Dashboard available`,{url:`/_dashboard/`,dir:r}),!0):!1}export{m as registerDashboardRoutes,f as resolveDashboardDir,p as resolveDashboardRequest};
@@ -1 +0,0 @@
1
- import{t as e}from"./resolve-sibling-1oDoO-Re.js";import{createReadStream as t,existsSync as n,statSync as r}from"node:fs";import{dirname as i,extname as a,join as o,resolve as s,sep as c}from"node:path";import{fileURLToPath as l}from"node:url";const u=import.meta.dirname??i(l(import.meta.url)),d={".html":`text/html`,".js":`application/javascript`,".css":`text/css`,".json":`application/json`,".png":`image/png`,".svg":`image/svg+xml`,".ico":`image/x-icon`,".woff":`font/woff`,".woff2":`font/woff2`};function f(t){return t?o(t,`..`,`..`,`dashboard`,`dist`):e(`dashboard`)??o(u,`..`,`..`,`dashboard`,`dist`)}function p(e,t){let i=t.replace(/^\/_dashboard\/?/,``)||`index.html`;try{i=decodeURIComponent(i)}catch{}let l=s(e,i);if(!(l===e||l.startsWith(`${e}${c}`)))return{kind:`forbidden`};try{if(r(l).isFile())return{kind:`file`,path:l,contentType:d[a(l)]??`application/octet-stream`}}catch{}let u=o(e,`index.html`);return n(u)?{kind:`spa`,path:u,contentType:`text/html`}:{kind:`not-found`}}function m(e,r,i){return n(r)?(e.get(`/_dashboard{/*path}`,(e,n)=>{let i=p(r,e.path);if(i.kind===`forbidden`){n.status(403).end(`Forbidden`);return}if(i.kind===`not-found`){n.status(404).end(`Not found`);return}n.setHeader(`Content-Type`,i.contentType),i.kind===`file`&&/\.[a-f0-9]{8,}\.(js|css)$/i.test(i.path)?n.setHeader(`Cache-Control`,`public, max-age=31536000, immutable`):n.setHeader(`Cache-Control`,`no-cache`),t(i.path).pipe(n)}),i.info(`Dashboard available`,{url:`/_dashboard/`,dir:r}),!0):!1}export{m as registerDashboardRoutes,f as resolveDashboardDir,p as resolveDashboardRequest};
@@ -1 +0,0 @@
1
- import{createRequire as e}from"node:module";import{existsSync as t}from"node:fs";import{dirname as n,join as r}from"node:path";import{fileURLToPath as i}from"node:url";const a=e(import.meta.url),o=import.meta.dirname??n(i(import.meta.url)),s=new Map;function c(e){let i=s.get(e);if(i!==void 0)return i;let c=r(o,`..`,`..`,e);if(t(r(c,`package.json`)))return s.set(e,c),c;try{let t=n(a.resolve(`@aikit/${e}/package.json`));return s.set(e,t),t}catch{}let l=o;for(let i=0;i<6;i++){let i=r(l,`packages`,e);if(t(r(i,`package.json`)))return s.set(e,i),i;let a=n(l);if(a===l)break;l=a}return s.set(e,null),null}function l(e,n=`dist`){let i=c(e);if(!i)return null;let a=r(i,n);return t(a)?a:null}function u(e,n){let i=c(e);if(!i)return null;for(let e of n){let n=r(i,e);if(t(n))return n}return null}export{u as n,c as r,l as t};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{createRequire as e}from"node:module";import{existsSync as t}from"node:fs";import{dirname as n,join as r}from"node:path";import{fileURLToPath as i}from"node:url";const a=e(import.meta.url),o=import.meta.dirname??n(i(import.meta.url)),s=new Map;function c(e){let i=s.get(e);if(i!==void 0)return i;let c=r(o,`..`,`..`,e);if(t(r(c,`package.json`)))return s.set(e,c),c;try{let t=n(a.resolve(`@aikit/${e}/package.json`));return s.set(e,t),t}catch{}let l=o;for(let i=0;i<6;i++){let i=r(l,`packages`,e);if(t(r(i,`package.json`)))return s.set(e,i),i;let a=n(l);if(a===l)break;l=a}return s.set(e,null),null}function l(e,n=`dist`){let i=c(e);if(!i)return null;let a=r(i,n);return t(a)?a:null}function u(e,n){let i=c(e);if(!i)return null;for(let e of n){let n=r(i,e);if(t(n))return n}return null}export{u as n,c as r,l as t};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{t as e}from"./resolve-sibling-ByoHo7Tp.js";import{createReadStream as t,existsSync as n,statSync as r}from"node:fs";import{dirname as i,extname as a,join as o,resolve as s,sep as c}from"node:path";import{fileURLToPath as l}from"node:url";const u=import.meta.dirname??i(l(import.meta.url)),d={".html":`text/html`,".js":`application/javascript`,".css":`text/css`,".json":`application/json`,".png":`image/png`,".svg":`image/svg+xml`,".ico":`image/x-icon`,".woff":`font/woff`,".woff2":`font/woff2`};function f(t){return t?o(t,`..`,`..`,`settings-ui`,`dist`):e(`settings-ui`)??o(u,`..`,`..`,`settings-ui`,`dist`)}function p(e,t){let i=t.replace(/^\/settings\/?/,``)||`index.html`;if(i.startsWith(`api/`)||i===`api`)return{kind:`not-found`};try{i=decodeURIComponent(i)}catch{}let l=s(e,i);if(!(l===e||l.startsWith(`${e}${c}`)))return{kind:`forbidden`};try{if(r(l).isFile())return{kind:`file`,path:l,contentType:d[a(l)]??`application/octet-stream`}}catch{}let u=o(e,`index.html`);return n(u)?{kind:`spa`,path:u,contentType:`text/html`}:{kind:`not-found`}}function m(e,r,i){return n(r)?(e.get(`/settings{/*path}`,(e,n)=>{let i=p(r,e.path);if(i.kind===`forbidden`){n.status(403).end(`Forbidden`);return}if(i.kind===`not-found`){n.status(404).end(`Not found`);return}n.setHeader(`Content-Type`,i.contentType),i.kind===`file`&&/\.[a-f0-9]{8,}\.(js|css)$/i.test(i.path)?n.setHeader(`Cache-Control`,`public, max-age=31536000, immutable`):n.setHeader(`Cache-Control`,`no-cache`),t(i.path).pipe(n)}),i.info(`Settings UI available`,{url:`/settings/`,dir:r}),!0):!1}export{m as registerSettingsRoutes,f as resolveSettingsDir,p as resolveSettingsRequest};
@@ -1 +0,0 @@
1
- import{t as e}from"./resolve-sibling-1oDoO-Re.js";import{createReadStream as t,existsSync as n,statSync as r}from"node:fs";import{dirname as i,extname as a,join as o,resolve as s,sep as c}from"node:path";import{fileURLToPath as l}from"node:url";const u=import.meta.dirname??i(l(import.meta.url)),d={".html":`text/html`,".js":`application/javascript`,".css":`text/css`,".json":`application/json`,".png":`image/png`,".svg":`image/svg+xml`,".ico":`image/x-icon`,".woff":`font/woff`,".woff2":`font/woff2`};function f(t){return t?o(t,`..`,`..`,`settings-ui`,`dist`):e(`settings-ui`)??o(u,`..`,`..`,`settings-ui`,`dist`)}function p(e,t){let i=t.replace(/^\/settings\/?/,``)||`index.html`;if(i.startsWith(`api/`)||i===`api`)return{kind:`not-found`};try{i=decodeURIComponent(i)}catch{}let l=s(e,i);if(!(l===e||l.startsWith(`${e}${c}`)))return{kind:`forbidden`};try{if(r(l).isFile())return{kind:`file`,path:l,contentType:d[a(l)]??`application/octet-stream`}}catch{}let u=o(e,`index.html`);return n(u)?{kind:`spa`,path:u,contentType:`text/html`}:{kind:`not-found`}}function m(e,r,i){return n(r)?(e.get(`/settings{/*path}`,(e,n)=>{let i=p(r,e.path);if(i.kind===`forbidden`){n.status(403).end(`Forbidden`);return}if(i.kind===`not-found`){n.status(404).end(`Not found`);return}n.setHeader(`Content-Type`,i.contentType),i.kind===`file`&&/\.[a-f0-9]{8,}\.(js|css)$/i.test(i.path)?n.setHeader(`Cache-Control`,`public, max-age=31536000, immutable`):n.setHeader(`Cache-Control`,`no-cache`),t(i.path).pipe(n)}),i.info(`Settings UI available`,{url:`/settings/`,dir:r}),!0):!1}export{m as registerSettingsRoutes,f as resolveSettingsDir,p as resolveSettingsRequest};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{existsSync as e,mkdirSync as t,readFileSync as n,renameSync as r,rmSync as i,writeFileSync as a}from"node:fs";import{dirname as o,join as s,resolve as c}from"node:path";import{fileURLToPath as l}from"node:url";import{createLogger as u}from"../../core/dist/index.js";import{homedir as d}from"node:os";import{execFile as f,execSync as p}from"node:child_process";const m=`@vpxa/aikit`,h=`https://registry.npmjs.org/${m}/latest`,g=u(`server`),_=s(d(),`.aikit`),v=s(_,`current-version.json`),y=s(_,`versions`),b=/^\d+\.\d+\.\d+(-[\w.+]+)?(\+[\w.]+)?$/;function x(e){if(!b.test(e))throw Error(`Invalid semver version: ${JSON.stringify(e)}`)}function S(){let e=c(o(l(import.meta.url)),`..`,`..`,`..`,`package.json`);try{return JSON.parse(n(e,`utf-8`)).version??`0.0.0`}catch{return`0.0.0`}}function C(e,t){let n=e.split(`.`).map(Number),r=t.split(`.`).map(Number);for(let e=0;e<3;e++){let t=(n[e]??0)-(r[e]??0);if(t!==0)return t>0?1:-1}return 0}function w(e,t){let n=e.split(`.`).map(Number),r=t.split(`.`).map(Number);for(let e=0;e<3;e++){if((n[e]??0)>(r[e]??0))return!0;if((n[e]??0)<(r[e]??0))return!1}return!1}async function T(n){x(n);let o=`v${n}`,c=s(y,`${o}-staging`),l=s(y,o);try{e(c)&&i(c,{recursive:!0,force:!0}),t(c,{recursive:!0}),p(`tar -xzf "${p(`npm pack ${m}@${n}`,{cwd:c,encoding:`utf-8`,timeout:6e4,windowsHide:!0}).trim()}"`,{cwd:c,encoding:`utf-8`,timeout:3e4,windowsHide:!0});let u=s(c,`package`);p(`npm install --production --install-strategy=nested --no-audit --no-fund`,{cwd:u,encoding:`utf-8`,timeout:12e4,windowsHide:!0});let d=s(u,`packages`,`server`,`dist`,`bin.js`);if(!e(d))throw Error(`Server entry not found at ${d}`);if(!e(s(u,`node_modules`)))throw Error(`node_modules not found — npm install may have failed`);let f=`${v}.tmp`;a(f,JSON.stringify({version:n,installedAt:new Date().toISOString()},null,2)),r(f,v),e(l)&&i(l,{recursive:!0,force:!0}),r(u,l),g.info(`Installed version ${o}`,{targetDir:l})}finally{e(c)&&i(c,{recursive:!0,force:!0})}}async function E(){try{let t=n(v,`utf-8`),{version:i}=JSON.parse(t),o=await fetch(h,{signal:AbortSignal.timeout(1e4)});if(!o.ok)return;let c=(await o.json()).version;if(!c||c===i||!w(c,i))return;if(e(s(y,`v${c}`))){let e=`${v}.tmp`;a(e,JSON.stringify({version:c,installedAt:new Date().toISOString()},null,2)),r(e,v),g.info(`Re-activated existing version v${c} — no download needed`);return}g.info(`New version available: ${c}. Installing...`),await T(c),g.info(`Updated to v${c}. Restart to use.`)}catch(e){g.error(`Background update check failed: ${e instanceof Error?e.message:String(e)}`)}}function D(){if(e(v)){E();return}let t=S();fetch(h,{signal:AbortSignal.timeout(1e4)}).then(e=>{if(e.ok)return e.json()}).then(async e=>{if(!e||typeof e!=`object`)return;let n=e.version;if(n&&C(t,n)<0){g.info(`Newer version available — installing`,{currentVersion:t,latestVersion:n});try{await T(n),g.info(`Installed v${n}. Restart MCP to use.`)}catch(e){g.warn(`Auto-install failed`,{error:e instanceof Error?e.message:String(e),latestVersion:n})}}}).catch(()=>{})}function O(){try{let t=c(d(),`.copilot`,`.aikit-scaffold.json`);return e(t)?JSON.parse(n(t,`utf-8`)).version??null:null}catch{return null}}function k(){try{let t=c(process.cwd(),`.github`,`.aikit-scaffold.json`);return e(t)?JSON.parse(n(t,`utf-8`)).version??null:null}catch{return null}}let A=`idle`,j=null,M=null;function N(){return{state:A,error:j}}function P(){A=`idle`,j=null}function F(){try{let t=S(),n=O(),r=k(),i=n!=null&&n!==t,a=r!=null&&r!==t;if(D(),!i&&!a||(M!==t&&(P(),M=t),A!==`idle`))return;A=`pending`,j=null,g.info(`Scaffold version mismatch — auto-upgrading`,{serverVersion:t,userScaffoldVersion:n,workspaceScaffoldVersion:r});let s=o(l(import.meta.url)),u=[c(s,`..`,`..`,`..`,`bin`,`aikit.mjs`),c(s,`..`,`bin`,`aikit.mjs`),...process.argv[1]?[c(o(process.argv[1]),`aikit.mjs`)]:[]],d=u.find(t=>e(t));if(!d){A=`failed`,j=`aikit CLI binary not found. Tried: ${u.join(`, `)}`,g.warn(`Cannot auto-upgrade: aikit CLI binary not found`,{candidates:u,platform:process.platform});return}f(process.execPath,[d,`upgrade`],{timeout:3e4,windowsHide:!0},(e,n,r)=>{e?(A=`failed`,j=e.message,g.warn(`Auto-upgrade failed`,{error:e.message,stderr:r?.slice(0,500),binPath:d,platform:process.platform})):(A=`success`,j=null,g.info(`Auto-upgrade completed to version ${t}`))}).unref()}catch(e){A=`failed`,j=e instanceof Error?e.message:String(e),g.warn(`Auto-upgrade check failed`,{error:j})}}export{F as autoUpgradeScaffold,D as checkForUpdates,S as getCurrentVersion,N as getUpgradeState};
@@ -1 +0,0 @@
1
- import{existsSync as e,mkdirSync as t,readFileSync as n,renameSync as r,rmSync as i,writeFileSync as a}from"node:fs";import{dirname as o,join as s,resolve as c}from"node:path";import{fileURLToPath as l}from"node:url";import{createLogger as u}from"../../core/dist/index.js";import{execFile as d,execSync as f}from"node:child_process";import{homedir as p}from"node:os";const m=`@vpxa/aikit`,h=`https://registry.npmjs.org/${m}/latest`,g=u(`server`),_=s(p(),`.aikit`),v=s(_,`current-version.json`),y=s(_,`versions`),b=/^\d+\.\d+\.\d+(-[\w.+]+)?(\+[\w.]+)?$/;function x(e){if(!b.test(e))throw Error(`Invalid semver version: ${JSON.stringify(e)}`)}function S(){let e=c(o(l(import.meta.url)),`..`,`..`,`..`,`package.json`);try{return JSON.parse(n(e,`utf-8`)).version??`0.0.0`}catch{return`0.0.0`}}function C(e,t){let n=e.split(`.`).map(Number),r=t.split(`.`).map(Number);for(let e=0;e<3;e++){let t=(n[e]??0)-(r[e]??0);if(t!==0)return t>0?1:-1}return 0}function w(e,t){let n=e.split(`.`).map(Number),r=t.split(`.`).map(Number);for(let e=0;e<3;e++){if((n[e]??0)>(r[e]??0))return!0;if((n[e]??0)<(r[e]??0))return!1}return!1}async function T(n){x(n);let o=`v${n}`,c=s(y,`${o}-staging`),l=s(y,o);try{e(c)&&i(c,{recursive:!0,force:!0}),t(c,{recursive:!0}),f(`tar -xzf "${f(`npm pack ${m}@${n}`,{cwd:c,encoding:`utf-8`,timeout:6e4,windowsHide:!0}).trim()}"`,{cwd:c,encoding:`utf-8`,timeout:3e4,windowsHide:!0});let u=s(c,`package`);f(`npm install --production --install-strategy=nested --no-audit --no-fund`,{cwd:u,encoding:`utf-8`,timeout:12e4,windowsHide:!0});let d=s(u,`packages`,`server`,`dist`,`bin.js`);if(!e(d))throw Error(`Server entry not found at ${d}`);if(!e(s(u,`node_modules`)))throw Error(`node_modules not found — npm install may have failed`);let p=`${v}.tmp`;a(p,JSON.stringify({version:n,installedAt:new Date().toISOString()},null,2)),r(p,v),e(l)&&i(l,{recursive:!0,force:!0}),r(u,l),g.info(`Installed version ${o}`,{targetDir:l})}finally{e(c)&&i(c,{recursive:!0,force:!0})}}async function E(){try{let t=n(v,`utf-8`),{version:i}=JSON.parse(t),o=await fetch(h,{signal:AbortSignal.timeout(1e4)});if(!o.ok)return;let c=(await o.json()).version;if(!c||c===i||!w(c,i))return;if(e(s(y,`v${c}`))){let e=`${v}.tmp`;a(e,JSON.stringify({version:c,installedAt:new Date().toISOString()},null,2)),r(e,v),g.info(`Re-activated existing version v${c} — no download needed`);return}g.info(`New version available: ${c}. Installing...`),await T(c),g.info(`Updated to v${c}. Restart to use.`)}catch(e){g.error(`Background update check failed: ${e instanceof Error?e.message:String(e)}`)}}function D(){if(e(v)){E();return}let t=S();fetch(h,{signal:AbortSignal.timeout(1e4)}).then(e=>{if(e.ok)return e.json()}).then(async e=>{if(!e||typeof e!=`object`)return;let n=e.version;if(n&&C(t,n)<0){g.info(`Newer version available — installing`,{currentVersion:t,latestVersion:n});try{await T(n),g.info(`Installed v${n}. Restart MCP to use.`)}catch(e){g.warn(`Auto-install failed`,{error:e instanceof Error?e.message:String(e),latestVersion:n})}}}).catch(()=>{})}function O(){try{let t=c(p(),`.copilot`,`.aikit-scaffold.json`);return e(t)?JSON.parse(n(t,`utf-8`)).version??null:null}catch{return null}}function k(){try{let t=c(process.cwd(),`.github`,`.aikit-scaffold.json`);return e(t)?JSON.parse(n(t,`utf-8`)).version??null:null}catch{return null}}let A=`idle`,j=null,M=null;function N(){return{state:A,error:j}}function P(){A=`idle`,j=null}function F(){try{let t=S(),n=O(),r=k(),i=n!=null&&n!==t,a=r!=null&&r!==t;if(D(),!i&&!a||(M!==t&&(P(),M=t),A!==`idle`))return;A=`pending`,j=null,g.info(`Scaffold version mismatch — auto-upgrading`,{serverVersion:t,userScaffoldVersion:n,workspaceScaffoldVersion:r});let s=o(l(import.meta.url)),u=[c(s,`..`,`..`,`..`,`bin`,`aikit.mjs`),c(s,`..`,`bin`,`aikit.mjs`),...process.argv[1]?[c(o(process.argv[1]),`aikit.mjs`)]:[]],f=u.find(t=>e(t));if(!f){A=`failed`,j=`aikit CLI binary not found. Tried: ${u.join(`, `)}`,g.warn(`Cannot auto-upgrade: aikit CLI binary not found`,{candidates:u,platform:process.platform});return}d(process.execPath,[f,`upgrade`],{timeout:3e4,windowsHide:!0},(e,n,r)=>{e?(A=`failed`,j=e.message,g.warn(`Auto-upgrade failed`,{error:e.message,stderr:r?.slice(0,500),binPath:f,platform:process.platform})):(A=`success`,j=null,g.info(`Auto-upgrade completed to version ${t}`))}).unref()}catch(e){A=`failed`,j=e instanceof Error?e.message:String(e),g.warn(`Auto-upgrade check failed`,{error:j})}}export{F as autoUpgradeScaffold,D as checkForUpdates,S as getCurrentVersion,N as getUpgradeState};