@vpxa/aikit 0.1.135 → 0.1.137

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.
@@ -3,6 +3,6 @@
3
3
  "command": "node",
4
4
  "args": [
5
5
  "-e",
6
- "const{execSync:x}=require('child_process');const{readdirSync:r,renameSync:m}=require('fs');const{join:j}=require('path');const c=j(process.env.LOCALAPPDATA||process.env.HOME||'','npm-cache');const s={stdio:'inherit'};try{x('npx -y @vpxa/aikit serve',s)}catch{try{x('npx --prefer-online -y @vpxa/aikit serve',s)}catch{try{r(c).filter(d=>d.startsWith('_npx')).forEach(d=>m(j(c,d),j(c,d+'_'+Date.now())))}catch{};x('npx -y @vpxa/aikit serve',s)}}"
6
+ "const{execSync:x}=require('child_process');const{readdirSync:r,renameSync:m}=require('fs');const{join:j}=require('path');const c=j(process.env.LOCALAPPDATA||process.env.HOME||'','npm-cache');const s={stdio:'inherit'};try{x('npx --prefer-online -y @vpxa/aikit serve',s)}catch{try{x('npx -y @vpxa/aikit serve',s)}catch{try{r(c).filter(d=>d.startsWith('_npx')).forEach(d=>m(j(c,d),j(c,d+'_'+Date.now())))}catch{};x('npx -y @vpxa/aikit serve',s)}}"
7
7
  ]
8
8
  }
@@ -276,6 +276,8 @@ For maximum token efficiency, instruct subagents to use the **meta-tool discover
276
276
  - \`digest\` between phases, \`stash\`/\`remember\` analysis results
277
277
  - Provide subagents \`scope_map\` + relevant files only — not full history
278
278
  - One-shot delegation preferred for isolated sub-tasks
279
+ - Estimate context per subagent: \`stratum_card({tier:'T1'})\` ~100 tokens/file, \`compact\` ~300 tokens/file, \`digest\` for multi-file compression
280
+ - **Receipt consumption:** After \`evidence_map({ action: "gate" })\`, review all receipts. If any claim lacks a tool-verified receipt, add one before declaring YIELD.
279
281
 
280
282
  ## Output Rules
281
283
 
@@ -500,7 +502,62 @@ When subagents complete, their visual outputs (from \`present\`) are NOT visible
500
502
  | \`adr-skill\` | When the plan involves non-trivial technical decisions — create executable ADRs |
501
503
  | \`session-handoff\` | When context window is filling up, planning session ending, or major milestone completed |
502
504
  | \`repo-access\` | When the plan involves accessing private, enterprise, or self-hosted repositories |
503
- | \`browser-use\` | When the plan involves browser-based auth recovery, web scraping, or interacting with web applications that require login |`,Implementer:"**Read `AGENTS.md`** in the workspace root for project conventions and AI Kit protocol.\n\nLoad the `aikit` skill for full tool documentation, workflow chains, and session protocol.\n\n## Implementation Protocol\n\n1. **Understand scope** — Read the phase objective, identify target files\n2. **Write test first** (Red) — Create failing tests that define expected behavior\n3. **Implement** (Green) — Write minimal code to make tests pass\n4. **Refactor** — Clean up while keeping tests green\n5. **Validate** — `check`, `test_run`, `blast_radius`\n6. **Persist** — `remember` any decisions or patterns discovered\n\n## Rules\n\n- **Test-first always** — No implementation without a failing test\n- **Minimal code** — Don't build what isn't asked for\n- **Follow existing patterns** — Search AI Kit for conventions before creating new ones (`search(\"convention\")`, `knowledge({ action: \"list\", category: \"conventions\" })`)\n- **Never modify tests to make them pass** — Fix the implementation instead\n- **Run `check` after every change** — Catch errors early\n- **Loop-break** — If the same test fails 3 times with the same error after your fixes, STOP. Re-read the error from scratch, check your assumptions with `trace` or `symbol`, and try a fundamentally different approach. Do not attempt a 4th fix in the same direction\n- **Think-first for complex tasks** — If a task involves 3+ files or non-obvious logic, outline your approach before writing code. Check existing patterns with `search` first. Design, then implement\n\n## Pre-Edit Checklist (before modifying any file)\n\n1. **Understand consumers** — `graph({action:'find_nodes', name_pattern:'<target>'})` → `graph({action:'neighbors', node_id, direction:'incoming'})`. See who calls/imports before changing a contract.\n2. **Compress, don't raw-read** — `file_summary` then `compact({path, query})` for the specific area. Only `read_file` when you need exact lines for `replace_string_in_file`.\n3. **Snapshot risky edits** — `checkpoint({action:'save', label:'pre-<scope>'})` before cross-cutting changes. `checkpoint({action:'restore', ...})` if `check`/`test_run` fails.\n4. **Estimate blast radius** — `blast_radius({changed_files:[...]})` BEFORE editing when changing a public/shared symbol; re-run AFTER to confirm actual impact matches.\n5. **TDD when tests exist** — write/extend the failing test first, then minimum code to pass.\n\n## Post-Edit Checklist\n\n1. `check({})` — typecheck + lint must pass clean\n2. `test_run({})` — full suite or targeted pattern\n3. If Orchestrator passed a `task_id`: `evidence_map({action:'add', task_id, claim, status:'V', receipt:'file.ts#Lxx'})` for each verified contract/acceptance claim. Do NOT run the gate — Orchestrator owns it.",Frontend:"**Read `AGENTS.md`** in the workspace root for project conventions and AI Kit protocol.\n\nLoad the `aikit` skill for full tool documentation, workflow chains, and session protocol.\n\n## Frontend Protocol\n\n1. **Search AI Kit** for existing component patterns and design tokens\n2. **Write component tests first** — Accessibility, rendering, interaction\n3. **Implement** — Follow existing component patterns, use design system tokens\n4. **Validate** — `check`, `test_run`, visual review\n5. **Persist** — `remember` new component patterns\n\n## Rules\n\n- **Accessibility first** — ARIA attributes, keyboard navigation, screen reader support\n- **Follow design system** — Use existing tokens, don't create one-off values\n- **Responsive by default** — Mobile-first, test all breakpoints\n- **Test-first** — Component tests before implementation\n\n## Frontend Exploration Mode\n\n| Need | Tool |\n|------|------|\n| Component dependency graph | `graph({action:'neighbors', node_id:'src/components/X.tsx', direction:'incoming'})` |\n| Stale / unused components | `dead_symbols({ path:'src/components' })` |\n| React / a11y / library API research | `web_search({ query })`, `web_fetch({ urls })` |\n| Component complexity hotspots | `measure({ path:'src/components' })` |\n| Verify a component's callers | `graph({action:'find_nodes', name_pattern})` → `neighbors` |\n\n## Visual Validation Protocol (post `test_run`)\n\n**Pre-flight (MANDATORY before any browser step):**\n1. Read `package.json` scripts — identify dev command (e.g. `dev`, `start`, `vite`)\n2. Determine default port (check script args, `vite.config.*`, or env)\n3. Check if dev server already running on port (attempt `http({ url:'http://localhost:<port>' })`)\n4. If NOT running, delegate to a helper or use `createAndRunTask` to start `npm run dev`\n in the background; wait for ready signal\n5. Capture the base URL\n\n**Validation:**\n6. `open_browser_page({ url })` — render target component page\n7. `screenshot_page` + `read_page` — capture visual + DOM\n8. Keyboard-only navigation check: simulate Tab/Enter/Escape via `type_in_page` —\n verify focus ring, activation, dismiss\n9. Compare against design tokens / Figma URL if supplied\n10. Fail fast if color contrast < 4.5:1 (WCAG AA) or focus indicator missing\n\nIf the pre-flight dev server cannot be started (e.g. sandbox), fall back to\n`compact` inspection of the component source + describe expected visual behavior.",Debugger:`**Read \`AGENTS.md\`** in the workspace root for project conventions and AI Kit protocol.
505
+ | \`browser-use\` | When the plan involves browser-based auth recovery, web scraping, or interacting with web applications that require login |`,Implementer:`**Read \`AGENTS.md\`** in the workspace root for project conventions and AI Kit protocol.
506
+
507
+ Load the \`aikit\` skill for full tool documentation, workflow chains, and session protocol.
508
+
509
+ ## Implementation Protocol
510
+
511
+ 1. **Understand scope** — Read the phase objective, identify target files
512
+ 2. **Write test first** (Red) — Create failing tests that define expected behavior
513
+ 3. **Implement** (Green) — Write minimal code to make tests pass
514
+ 4. **Refactor** — Clean up while keeping tests green
515
+ 5. **Validate** — \`check\`, \`test_run\`, \`blast_radius\`
516
+ 6. **Persist** — \`remember\` any decisions or patterns discovered
517
+
518
+ ## Rules
519
+
520
+ - **Test-first always** — No implementation without a failing test
521
+ - **Minimal code** — Don't build what isn't asked for
522
+ - **Follow existing patterns** — Search AI Kit for conventions before creating new ones (\`search("convention")\`, \`knowledge({ action: "list", category: "conventions" })\`)
523
+ - **Never modify tests to make them pass** — Fix the implementation instead
524
+ - **Run \`check\` after every change** — Catch errors early
525
+ - **Loop-break** — If the same test fails 3 times with the same error after your fixes, STOP. Re-read the error from scratch, check your assumptions with \`trace\` or \`symbol\`, and try a fundamentally different approach. Do not attempt a 4th fix in the same direction
526
+ - **Think-first for complex tasks** — If a task involves 3+ files or non-obvious logic, outline your approach before writing code. Check existing patterns with \`search\` first. Design, then implement
527
+
528
+ ## Pre-Edit Checklist (before modifying any file)
529
+
530
+ 1. **Understand consumers** — \`graph({action:'find_nodes', name_pattern:'<target>'})\` → \`graph({action:'neighbors', node_id, direction:'incoming'})\`. See who calls/imports before changing a contract.
531
+ 2. **Compress, don't raw-read** — \`file_summary\` then \`compact({path, query})\` for the specific area. Only \`read_file\` when you need exact lines for \`replace_string_in_file\`.
532
+ 3. **Snapshot risky edits** — \`checkpoint({action:'save', label:'pre-<scope>'})\` before cross-cutting changes. \`checkpoint({action:'restore', ...})\` if \`check\`/\`test_run\` fails.
533
+ 4. **Estimate blast radius** — \`blast_radius({changed_files:[...]})\` BEFORE editing when changing a public/shared symbol; re-run AFTER to confirm actual impact matches.
534
+ 5. **TDD when tests exist** — write/extend the failing test first, then minimum code to pass.
535
+
536
+ ## Post-Edit Checklist
537
+
538
+ 1. \`check({})\` — typecheck + lint must pass clean
539
+ 2. \`test_run({})\` — full suite or targeted pattern
540
+ 3. If Orchestrator passed a \`task_id\`: \`evidence_map({action:'add', task_id, claim, status:'V', receipt:'file.ts#Lxx'})\` for each verified contract/acceptance claim. Do NOT run the gate — Orchestrator owns it.
541
+
542
+ ## Structured Output (MANDATORY)
543
+
544
+ Every implementation response MUST end with a structured status block:
545
+
546
+ \`\`\`
547
+ ## Status: DONE | DONE_WITH_CONCERNS | NEEDS_CONTEXT | BLOCKED
548
+
549
+ ### Files Changed
550
+ - path/to/file.ts — description of change
551
+
552
+ ### Tests
553
+ - path/to/test.ts — N tests added/modified, all passing
554
+
555
+ ### Evidence
556
+ - [claim]: [receipt/verification]
557
+
558
+ ### Blockers (if any)
559
+ - Description of blocker
560
+ \`\`\``,Frontend:"**Read `AGENTS.md`** in the workspace root for project conventions and AI Kit protocol.\n\nLoad the `aikit` skill for full tool documentation, workflow chains, and session protocol.\n\n## Frontend Protocol\n\n1. **Search AI Kit** for existing component patterns and design tokens\n2. **Write component tests first** — Accessibility, rendering, interaction\n3. **Implement** — Follow existing component patterns, use design system tokens\n4. **Validate** — `check`, `test_run`, visual review\n5. **Persist** — `remember` new component patterns\n\n## Rules\n\n- **Accessibility first** — ARIA attributes, keyboard navigation, screen reader support\n- **Follow design system** — Use existing tokens, don't create one-off values\n- **Responsive by default** — Mobile-first, test all breakpoints\n- **Test-first** — Component tests before implementation\n\n## Frontend Exploration Mode\n\n| Need | Tool |\n|------|------|\n| Component dependency graph | `graph({action:'neighbors', node_id:'src/components/X.tsx', direction:'incoming'})` |\n| Stale / unused components | `dead_symbols({ path:'src/components' })` |\n| React / a11y / library API research | `web_search({ query })`, `web_fetch({ urls })` |\n| Component complexity hotspots | `measure({ path:'src/components' })` |\n| Verify a component's callers | `graph({action:'find_nodes', name_pattern})` → `neighbors` |\n\n## Visual Validation Protocol (post `test_run`)\n\n**Pre-flight (MANDATORY before any browser step):**\n1. Read `package.json` scripts — identify dev command (e.g. `dev`, `start`, `vite`)\n2. Determine default port (check script args, `vite.config.*`, or env)\n3. Check if dev server already running on port (attempt `http({ url:'http://localhost:<port>' })`)\n4. If NOT running, delegate to a helper or use `createAndRunTask` to start `npm run dev`\n in the background; wait for ready signal\n5. Capture the base URL\n\n**Validation:**\n6. `open_browser_page({ url })` — render target component page\n7. `screenshot_page` + `read_page` — capture visual + DOM\n8. Keyboard-only navigation check: simulate Tab/Enter/Escape via `type_in_page` —\n verify focus ring, activation, dismiss\n9. Compare against design tokens / Figma URL if supplied\n10. Fail fast if color contrast < 4.5:1 (WCAG AA) or focus indicator missing\n\nIf the pre-flight dev server cannot be started (e.g. sandbox), fall back to\n`compact` inspection of the component source + describe expected visual behavior.",Debugger:`**Read \`AGENTS.md\`** in the workspace root for project conventions and AI Kit protocol.
504
561
 
505
562
  Load the \`aikit\` skill for full tool documentation, workflow chains, and session protocol.
506
563
 
@@ -565,7 +622,19 @@ Choose the appropriate loop type:
565
622
  - **Loop first, hypothesis second** — Build reproduction before theorizing
566
623
  - **Minimal fix** — Fix the root cause, don't add workarounds
567
624
  - **Break debug loops** — If same error 3 times after fix: hypothesis is WRONG. STOP, discard theory, re-examine from different entry point. Return \`ESCALATE\` if fresh approach also fails
568
- - **Verify before asserting** — Don't claim a function has a certain signature without checking via \`symbol\``,Refactor:`**Read \`AGENTS.md\`** in the workspace root for project conventions and AI Kit protocol.
625
+ - **Verify before asserting** — Don't claim a function has a certain signature without checking via \`symbol\`
626
+
627
+ ## TraceId Correlation
628
+
629
+ When debugging tool invocation issues, use the replay audit trail with traceId:
630
+
631
+ 1. \`replay({ last: 20 })\` — find recent entries with the relevant tool
632
+ 2. Note the \`traceId\` field — this is the unique correlation ID for that invocation
633
+ 3. Use traceId to correlate across:
634
+ - Replay log entries (\`.aikit-state/replay.jsonl\`)
635
+ - In-memory telemetry (\`getToolTelemetry()\`)
636
+ - Server middleware context (\`ctx.requestId\`)
637
+ 4. Filter by traceId: search replay.jsonl for the specific UUID to trace the full invocation lifecycle`,Refactor:`**Read \`AGENTS.md\`** in the workspace root for project conventions and AI Kit protocol.
569
638
 
570
639
  Load the \`aikit\` skill for full tool documentation, workflow chains, and session protocol.
571
640
 
@@ -659,6 +728,15 @@ Load the \`aikit\` skill for full tool documentation, workflow chains, and sessi
659
728
  | MEDIUM | Requires specific conditions | Should fix, document if deferred |
660
729
  | LOW | Minimal impact | Fix when convenient |
661
730
 
731
+ ## Security Checklist (apply to every review)
732
+
733
+ - [ ] **Unicode normalization**: User-supplied strings normalized before comparison (NFC/NFKC)
734
+ - [ ] **SSRF protection**: URLs validated against allowlist, no open redirects, internal IPs blocked
735
+ - [ ] **eval/Function prevention**: No dynamic code execution from user input (\`eval()\`, \`new Function()\`, \`vm.runInNewContext()\`)
736
+ - [ ] **Path traversal**: File paths sanitized, no \`..\` sequences reaching outside allowed directories
737
+ - [ ] **Input size limits**: Request bodies, query params, and headers bounded to prevent DoS
738
+ - [ ] **Prototype pollution**: Object spread/assign from user input uses \`Object.create(null)\` or validated keys
739
+
662
740
  ## Output Format
663
741
 
664
742
  \`\`\`markdown
@@ -336,6 +336,18 @@ Execute all tasks from the breakdown, dispatching implementation agents in batch
336
336
  - If still blocked, escalate to user
337
337
  5. **Final validation** — After all batches: \`check({})\` + \`test_run({})\` must pass
338
338
 
339
+ ## DAG Task Decomposition
340
+
341
+ For multi-task implementations, use the queue with dependencies:
342
+
343
+ \`\`\`
344
+ queue({ action: 'create', name: 'execute-tasks' })
345
+ queue({ action: 'push', name: 'execute-tasks', title: 'Task A', id: 'a' })
346
+ queue({ action: 'push', name: 'execute-tasks', title: 'Task B', id: 'b', dependsOn: ['a'] })
347
+ \`\`\`
348
+
349
+ Tasks with \`dependsOn\` are blocked until their dependencies complete. This ensures correct execution order for dependent changes.
350
+
339
351
  ## Outputs
340
352
 
341
353
  Write \`{{artifacts_path}}/progress.md\` to disk. **You MUST create this file** using \`create_file\` or equivalent — do not just present content in chat.
@@ -853,6 +865,16 @@ Perform thorough multi-perspective validation of all changes through parallel du
853
865
  8. **FORGE gate** — \`evidence_map({ action: "gate" })\` for final quality assessment
854
866
  9. **Synthesize report** — Merge all reviewer findings into unified verdict
855
867
 
868
+ ## Evidence Map Gate Detail
869
+
870
+ After the process steps above, the FORGE gate must return YIELD:
871
+
872
+ - **YIELD** → All claims verified, proceed to completion
873
+ - **HOLD** → Fix unresolved claims, re-gate (max 2 retries)
874
+ - **HARD_BLOCK** → Contract-type unknowns detected, escalate to user
875
+
876
+ Never declare verification complete without a YIELD gate result.
877
+
856
878
  ## Outputs
857
879
 
858
880
  Write \`{{artifacts_path}}/verify-report.md\` to disk. **You MUST create this file** using \`create_file\` or equivalent — do not just present content in chat.
@@ -1220,6 +1242,20 @@ If any prerequisites are missing or incomplete:
1220
1242
  5. **Fix issues** — Iterate until \`check\` and \`test_run\` pass (max 3 rounds)
1221
1243
  6. **Document progress** — Write progress artifact with what was done and any deviations
1222
1244
 
1245
+ ## Validation Boundary (MANDATORY)
1246
+
1247
+ Before declaring implementation complete, run:
1248
+
1249
+ 1. \`check({})\` — typecheck + lint must pass
1250
+ 2. \`test_run({})\` — all tests must pass
1251
+
1252
+ If either fails:
1253
+ - Fix the issue in the same implementation cycle
1254
+ - Re-run validation
1255
+ - If stuck after 2 attempts → report as BLOCKED and escalate
1256
+
1257
+ **Never advance past implement without green check + test.**
1258
+
1223
1259
  ## Outputs
1224
1260
 
1225
1261
  Write \`{{artifacts_path}}/progress.md\` to disk. **You MUST create this file** using \`create_file\` or equivalent — do not just present content in chat.
@@ -3,6 +3,6 @@
3
3
  "command": "node",
4
4
  "args": [
5
5
  "-e",
6
- "const{execSync:x}=require('child_process');const{readdirSync:r,renameSync:m}=require('fs');const{join:j}=require('path');const c=j(process.env.LOCALAPPDATA||process.env.HOME||'','npm-cache');const s={stdio:'inherit'};try{x('npx -y @vpxa/aikit serve',s)}catch{try{x('npx --prefer-online -y @vpxa/aikit serve',s)}catch{try{r(c).filter(d=>d.startsWith('_npx')).forEach(d=>m(j(c,d),j(c,d+'_'+Date.now())))}catch{};x('npx -y @vpxa/aikit serve',s)}}"
6
+ "const{execSync:x}=require('child_process');const{readdirSync:r,renameSync:m}=require('fs');const{join:j}=require('path');const c=j(process.env.LOCALAPPDATA||process.env.HOME||'','npm-cache');const s={stdio:'inherit'};try{x('npx --prefer-online -y @vpxa/aikit serve',s)}catch{try{x('npx -y @vpxa/aikit serve',s)}catch{try{r(c).filter(d=>d.startsWith('_npx')).forEach(d=>m(j(c,d),j(c,d+'_'+Date.now())))}catch{};x('npx -y @vpxa/aikit serve',s)}}"
7
7
  ]
8
8
  }
@@ -184,6 +184,13 @@ Track repeated failures. If the same approach fails, **stop and change strategy*
184
184
 
185
185
  ---
186
186
 
187
+ ## Read-Before-Edit (MANDATORY)
188
+
189
+ Before modifying ANY file, you MUST read it first using \`file_summary\` or \`compact\` to understand its structure. Then use \`read_file\` for the exact lines you need to edit.
190
+
191
+ **Forbidden pattern:** Editing a file based on assumptions or partial context from search results alone.
192
+ **Required pattern:** \`file_summary\` → \`read_file\` (exact edit region) → \`replace_string_in_file\`
193
+
187
194
  ## Scope Guard
188
195
 
189
196
  Before making changes, establish expected scope. Flag deviations early.
@@ -1,6 +1,6 @@
1
1
  // AUTO-GENERATED - do not edit manually.
2
2
  // Source: packages/server/src/tools/present/block-registry.ts
3
- // Generated at: 2026-05-11T01:24:09.989Z
3
+ // Generated at: 2026-05-11T23:12:29.409Z
4
4
 
5
5
  export const ALL_BLOCK_DOCS = "| Type | Description | Value Shape |\n|------|-------------|-------------|\n| `markdown` | Markdown content rendered with the marked parser. | `string` |\n| `code` | Formatted code block rendered inside pre/code tags. | `string` |\n| `mermaid` | Mermaid diagram source rendered in a mermaid pre block. | `string` |\n| `table` | Tabular data rendered from records or explicit headers and rows. | `Record<string, unknown>[] | { headers: string[]; rows: unknown[][] }` |\n| `metrics` | Metric cards showing label/value pairs with optional trend and status. | `Array<{ label: string; value: string | number; trend?: string | number; status?: string }>` |\n| `cards` | Card grid for titled items with optional body, badge, and status. | `Array<{ title: string; body?: string; badge?: string; status?: string; description?: string }>` |\n| `tree` | Hierarchical object or name/children tree rendered recursively. | `{ name: string; children?: unknown[] } | Record<string, unknown>` |\n| `graph` | Node and edge graph rendered as a Mermaid flow graph in HTML mode. | `{ nodes: Array<{ id: string; label?: string }>; edges: Array<{ from: string; to: string; label?: string }> }` |\n| `chart` | Structured chart definition rendered as SVG. | `{ chartType: string; data: Record<string, unknown>[]; xKey: string; yKeys: string[] }` |\n| `timeline` | Timeline entries rendered as a vertical sequence of events. | `Array<{ title: string; description?: string; timestamp?: string; status?: string }>` |\n| `checklist` | Checklist items with boolean checked state. | `Array<{label, checked}> | {items: Array<{label, checked}>}` |\n| `comparison` | Side-by-side comparison columns with titled item lists. | `Array<{title, items}> | {columns: Array<{title, items}>}` |\n| `status-board` | Status categories containing labeled status items. | `Array<{category, items}> | {items: Array<{category, items}>}` |\n| `prompt` | Prompt payload rendered through the prompt display helper. | `unknown` |\n| `progress` | Progress bar with current value and optional maximum. | `{label, value, max?} | {items: Array<{label, value, max?, color?}>}` |\n| `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```";
6
6
 
@@ -1,2 +0,0 @@
1
- import{existsSync as e,mkdirSync as t,readFileSync as n,rmSync as r,unlinkSync as i,writeFileSync as a}from"node:fs";import{dirname as o,resolve as s}from"node:path";import{pathToFileURL as c}from"node:url";import{createHash as l}from"node:crypto";var u=Object.defineProperty,d=(e,t)=>{let n={};for(var r in e)u(n,r,{get:e[r],enumerable:!0});return t||u(n,Symbol.toStringTag,{value:`Module`}),n};function f(e){return l(`sha256`).update(e).digest(`hex`).slice(0,16)}function p(t){if(!e(t))return null;try{let e=n(t,`utf-8`),r=JSON.parse(e);return!r.version||!r.files?null:r}catch{return null}}function m(e,t){a(e,`${JSON.stringify(t,null,2)}\n`,`utf-8`)}function h(e){return e.endsWith(`.agent.md`)&&!e.startsWith(`_shared/`)&&!e.startsWith(`agents/_shared/`)&&!e.startsWith(`templates/`)||e.endsWith(`SKILL.md`)&&!e.startsWith(`_shared/`)&&!e.startsWith(`templates/`)?`merge-frontmatter`:`overwrite`}function g(e,t,n){if(!e)return`new`;let r=e.files[t];return r?r.sourceHash===f(n)?`current`:`outdated`:`new`}function _(e,t,n,r){e.files[t]={sourceHash:f(n),strategy:r??h(t),updatedAt:new Date().toISOString()}}function v(e){return{version:e,generatedAt:new Date().toISOString(),files:{}}}const y=[`inputs`,`outputs`,`requires`,`relatedSkills`],b=[`model`],x=[`category`,`domain`,`applicability`],S=new Set([`__proto__`,`constructor`,`prototype`]);function C(e,t){return e.metadata[t]??e.fields[t]}function w(e,t){let n=C(e,t);return n?E(n):[]}function T(e){let t=Object.create(null),n=Object.create(null),r=[],i=e,a=e.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/);if(!a)return{fields:t,metadata:n,tools:r,body:i};let o=a[1];i=a[2];let s=!1;for(let e of o.split(/\r?\n/)){if(s){if(e.trim()===``)continue;let t=e.match(/^\s{2,}(\S+?):\s*(.*)$/);if(t){let[,e,r]=t;if(S.has(e))continue;n[e]=r;continue}s=!1}let i=e.match(/^(\S+?):\s*(.*)$/);if(!i)continue;let[,a,o]=i;if(a===`metadata`&&o.trim()===``){s=!0;continue}S.has(a)||(t[a]=o,a===`tools`&&(r=E(o)))}return{fields:t,metadata:n,tools:r,body:i}}function E(e){let t=e.trim();if(!t.startsWith(`[`)||!t.endsWith(`]`))return[];let n=t.slice(1,-1).trim();return n?n.split(`,`).map(e=>e.trim()).filter(Boolean):[]}function D(e){return`[${e.join(`, `)}]`}function O(e,t){let n=T(e),r=T(t),i={...n.fields},a={...n.metadata};for(let[e,t]of Object.entries(r.metadata))e in a||(a[e]=t);for(let e of b)r.fields[e]&&(i[e]=r.fields[e]);for(let e of x){let t=C(r,e);t&&(a[e]=t)}for(let e of[...x,...y])delete i[e];delete i.metadata;let o=n.tools,s=r.tools,c=new Set(o),l=s.filter(e=>!c.has(e)),u=[...o,...l];u.length>0&&(i.tools=D(u));for(let e of y){let t=w(n,e),i=w(r,e),o=new Set(t),s=i.filter(e=>!o.has(e)),c=[...t,...s];c.length>0?a[e]=D(c):delete a[e]}let d=[`---`],f=[`name`,`description`,`argument-hint`,`tools`,`model`],p=[`category`,`domain`,`applicability`,`inputs`,`outputs`,`requires`,`relatedSkills`],m=new Set;for(let e of f)e in i&&(d.push(`${e}: ${i[e]}`),m.add(e));for(let[e,t]of Object.entries(i))m.has(e)||d.push(`${e}: ${t}`);let h=[],g=new Set;for(let e of p){let t=a[e];t&&(h.push(` ${e}: ${t}`),g.add(e))}for(let[e,t]of Object.entries(a))!g.has(e)&&t&&h.push(` ${e}: ${t}`);return h.length>0&&(d.push(`metadata:`),d.push(...h)),d.push(`---`),`${d.join(`
2
- `)}\n${n.body}`}var k=d({guideFlows:()=>R,guideScaffold:()=>F,guideSkills:()=>I,loadAdapter:()=>A,smartCopyFlows:()=>L,smartCopyFromMemory:()=>j,smartCopyScaffold:()=>N,smartCopySkills:()=>P});async function A(e,t){let n=await import(c(s(e,`scaffold`,`dist`,`adapters`,`${t}.mjs`)).href),r=n[`generate${t.split(`-`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(``)}`]??n.generate??n.default;if(typeof r!=`function`)throw Error(`Adapter ${t} does not export a generate function`);return r()}function j(r,i,c,l,u=!1){t(i,{recursive:!0});for(let d of r){let r=l?`${l}/${d.path}`:d.path,f=s(i,d.path);if(u){t(o(f),{recursive:!0}),a(f,d.content,`utf-8`),_(c,r,d.content);continue}let p=g(c,r,d.content);if(p!==`current`){if(p===`new`&&!e(f)){t(o(f),{recursive:!0}),a(f,d.content,`utf-8`),_(c,r,d.content);continue}if(p===`new`&&e(f)){_(c,r,d.content);continue}if(h(r)===`merge-frontmatter`&&e(f)){let e=n(f,`utf-8`);a(f,O(d.content,e),`utf-8`)}else t(o(f),{recursive:!0}),a(f,d.content,`utf-8`);_(c,r,d.content)}}u&&M(i,c,l,new Set(r.map(e=>l?`${l}/${e.path}`:e.path)))}function M(t,n,r,a){let o=[];for(let c of Object.keys(n.files)){if(!c.startsWith(`${r}/`)||a.has(c))continue;let l=s(t,c.slice(r.length+1));e(l)&&(i(l),o.push(c)),delete n.files[c]}return o}async function N(e,t,n=`copilot`,r,i=!1){let a=await A(t,n),o=a.some(e=>e.path.startsWith(`.`)),c=o?e:s(e,`.github`),l=s(c,`.aikit-scaffold.json`),u=p(l)??v(r);u.version=r;let d=new Map;for(let e of a){let t=e.path.indexOf(`/`);if(t===-1){let t=d.get(``)??[];t.push({path:e.path,content:e.content}),d.set(``,t);continue}let n=e.path.substring(0,t),r=e.path.substring(t+1),i=d.get(n)??[];i.push({path:r,content:e.content}),d.set(n,i)}for(let[e,t]of d)j(t,e?s(c,e):c,u,o?`${n}/${e||`.`}`:e||`.`,i);m(l,u)}async function P(e,t,n,r,i=!1){let a=s(e,`.github`),o=s(a,`.aikit-scaffold.json`),c=p(o)??v(r);c.version=r;let l=await A(t,`skills`),u=new Map;for(let e of l){let t=e.path.indexOf(`/`);if(t===-1)continue;let n=e.path.substring(0,t),r=e.path.substring(t+1),i=u.get(n)??[];i.push({path:r,content:e.content}),u.set(n,i)}for(let[e,t]of u)j(t,s(a,`skills`,e),c,`skills/${e}`,i);m(o,c)}async function F(t,r,i=`copilot`){let a=[],o=await A(r,i),c=o.some(e=>e.path.startsWith(`.`))?t:s(t,`.github`);for(let t of o){let r=s(c,t.path);if(!e(r))a.push({status:`new`,relativePath:t.path,sourcePath:``,content:t.content});else{let e=n(r,`utf-8`);t.content===e?a.push({status:`current`,relativePath:t.path,sourcePath:``}):a.push({status:`outdated`,relativePath:t.path,sourcePath:``,content:t.content})}}return a}async function I(t,r,i){let a=[],o=await A(r,`skills`),c=s(t,`.github`);for(let t of o){let r=`skills/${t.path}`,i=s(c,`skills`,t.path);if(!e(i))a.push({status:`new`,relativePath:r,sourcePath:``,content:t.content});else{let e=n(i,`utf-8`);t.content===e?a.push({status:`current`,relativePath:r,sourcePath:``}):a.push({status:`outdated`,relativePath:r,sourcePath:``,content:t.content})}}return a}async function L(t,n,i,a,o=!1){let c=s(t,`.github`),l=s(c,`.aikit-scaffold.json`),u=p(l)??v(a);u.version=a;let d=await A(n,`flows`),f=new Set,h=new Map;for(let e of d){let t=e.path.indexOf(`/`);if(t===-1)continue;let n=e.path.substring(0,t);f.add(n);let r=e.path.substring(t+1),i=h.get(n)??[];i.push({path:r,content:e.content}),h.set(n,i)}for(let t of f){let n=s(c,`flows`,t,`skills`);e(n)&&r(n,{recursive:!0,force:!0})}for(let[e,t]of h)j(t,s(c,`flows`,e),u,`flows/${e}`,o);m(l,u)}async function R(t,r,i){let a=[],o=await A(r,`flows`),c=s(t,`.github`);for(let t of o){let r=`flows/${t.path}`,i=s(c,`flows`,t.path);if(!e(i))a.push({status:`new`,relativePath:r,sourcePath:``,content:t.content});else{let e=n(i,`utf-8`);t.content===e?a.push({status:`current`,relativePath:r,sourcePath:``}):a.push({status:`outdated`,relativePath:r,sourcePath:``,content:t.content})}}return a}export{k as a,N as c,p as d,m as f,A as i,P as l,F as n,L as o,d as p,I as r,j as s,R as t,v as u};