@vpxa/kb 0.1.31 → 0.1.33

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 (62) hide show
  1. package/package.json +1 -1
  2. package/packages/analyzers/dist/diagram-generator.js +2 -2
  3. package/packages/analyzers/dist/pattern-analyzer.js +1 -1
  4. package/packages/analyzers/dist/regex-call-graph.js +1 -1
  5. package/packages/cli/dist/commands/init/constants.d.ts +2 -0
  6. package/packages/cli/dist/commands/init/constants.js +1 -1
  7. package/packages/cli/dist/commands/init/index.d.ts +9 -1
  8. package/packages/cli/dist/commands/init/index.js +1 -1
  9. package/packages/cli/dist/commands/upgrade.js +1 -1
  10. package/packages/present/dist/index.html +321 -22
  11. package/packages/server/dist/output-schemas.d.ts +1 -0
  12. package/packages/server/dist/output-schemas.js +1 -1
  13. package/packages/server/dist/server.js +2 -2
  14. package/packages/server/dist/tools/context.tools.d.ts +2 -2
  15. package/packages/server/dist/tools/context.tools.js +9 -9
  16. package/packages/server/dist/tools/onboard.tool.js +2 -2
  17. package/packages/server/dist/tools/present/browser.d.ts +4 -0
  18. package/packages/server/dist/tools/present/browser.js +93 -0
  19. package/packages/server/dist/tools/present/helpers.d.ts +13 -0
  20. package/packages/server/dist/tools/present/helpers.js +1 -0
  21. package/packages/server/dist/tools/present/html.d.ts +18 -0
  22. package/packages/server/dist/tools/present/html.js +5 -0
  23. package/packages/server/dist/tools/present/index.d.ts +2 -0
  24. package/packages/server/dist/tools/present/index.js +1 -0
  25. package/packages/server/dist/tools/present/markdown.d.ts +17 -0
  26. package/packages/server/dist/tools/present/markdown.js +8 -0
  27. package/packages/server/dist/tools/present/templates.d.ts +14 -0
  28. package/packages/server/dist/tools/present/templates.js +472 -0
  29. package/packages/server/dist/tools/present/tool.d.ts +23 -0
  30. package/packages/server/dist/tools/present/tool.js +19 -0
  31. package/packages/server/dist/tools/present.tool.d.ts +1 -6
  32. package/packages/server/dist/tools/present.tool.js +1 -114
  33. package/packages/server/dist/tools/status.tool.d.ts +2 -1
  34. package/packages/server/dist/tools/status.tool.js +3 -3
  35. package/packages/server/dist/version-check.d.ts +12 -1
  36. package/packages/server/dist/version-check.js +1 -1
  37. package/packages/tools/dist/compact.js +1 -1
  38. package/packages/tools/dist/file-cache.js +3 -3
  39. package/packages/tools/dist/file-summary.js +1 -1
  40. package/packages/tools/dist/guide.js +1 -1
  41. package/packages/tools/dist/onboard.d.ts +7 -0
  42. package/packages/tools/dist/onboard.js +4 -4
  43. package/scaffold/adapters/copilot.mjs +4 -3
  44. package/scaffold/definitions/tools.mjs +3 -2
  45. package/scaffold/general/agents/Architect-Reviewer-Alpha.agent.md +1 -1
  46. package/scaffold/general/agents/Architect-Reviewer-Beta.agent.md +1 -1
  47. package/scaffold/general/agents/Code-Reviewer-Alpha.agent.md +1 -1
  48. package/scaffold/general/agents/Code-Reviewer-Beta.agent.md +1 -1
  49. package/scaffold/general/agents/Debugger.agent.md +1 -1
  50. package/scaffold/general/agents/Documenter.agent.md +1 -1
  51. package/scaffold/general/agents/Explorer.agent.md +1 -1
  52. package/scaffold/general/agents/Frontend.agent.md +1 -1
  53. package/scaffold/general/agents/Implementer.agent.md +1 -1
  54. package/scaffold/general/agents/Orchestrator.agent.md +1 -1
  55. package/scaffold/general/agents/Planner.agent.md +1 -1
  56. package/scaffold/general/agents/Refactor.agent.md +1 -1
  57. package/scaffold/general/agents/Researcher-Alpha.agent.md +1 -1
  58. package/scaffold/general/agents/Researcher-Beta.agent.md +1 -1
  59. package/scaffold/general/agents/Researcher-Delta.agent.md +1 -1
  60. package/scaffold/general/agents/Researcher-Gamma.agent.md +1 -1
  61. package/scaffold/general/agents/Security.agent.md +1 -1
  62. package/skills/present/SKILL.md +283 -12
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  description: 'Research variant for multi-model decision protocol — different LLM perspective'
3
3
  argument-hint: Research question, problem statement, or subsystem to investigate
4
- tools: [execute/runInTerminal, read/problems, read/readFile, read/terminalLastCommand, agent/runSubagent, search/changes, search/codebase, search/usages, web/fetch, web/githubRepo, ms-vscode.vscode-websearchforcopilot/websearch, browser/*, knowledge-base/*]
4
+ tools: [execute/runInTerminal, read/problems, read/readFile, read/terminalLastCommand, agent/runSubagent, search/changes, search/codebase, search/usages, web/fetch, web/githubRepo, browser/openBrowserPage, browser/readPage, browser/screenshotPage, browser/navigatePage, browser/clickElement, browser/dragElement, browser/hoverElement, browser/typeInPage, browser/runPlaywrightCode, browser/handleDialog, knowledge-base/*]
5
5
  model: Claude Sonnet 4.6 (copilot)
6
6
  ---
7
7
 
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  description: 'Research variant for multi-model decision protocol — different LLM perspective'
3
3
  argument-hint: Research question, problem statement, or subsystem to investigate
4
- tools: [execute/runInTerminal, read/problems, read/readFile, read/terminalLastCommand, agent/runSubagent, search/changes, search/codebase, search/usages, web/fetch, web/githubRepo, ms-vscode.vscode-websearchforcopilot/websearch, browser/*, knowledge-base/*]
4
+ tools: [execute/runInTerminal, read/problems, read/readFile, read/terminalLastCommand, agent/runSubagent, search/changes, search/codebase, search/usages, web/fetch, web/githubRepo, browser/openBrowserPage, browser/readPage, browser/screenshotPage, browser/navigatePage, browser/clickElement, browser/dragElement, browser/hoverElement, browser/typeInPage, browser/runPlaywrightCode, browser/handleDialog, knowledge-base/*]
5
5
  model: Gemini 3.1 Pro (Preview) (copilot)
6
6
  ---
7
7
 
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  description: 'Research variant for multi-model decision protocol — different LLM perspective'
3
3
  argument-hint: Research question, problem statement, or subsystem to investigate
4
- tools: [execute/runInTerminal, read/problems, read/readFile, read/terminalLastCommand, agent/runSubagent, search/changes, search/codebase, search/usages, web/fetch, web/githubRepo, ms-vscode.vscode-websearchforcopilot/websearch, browser/*, knowledge-base/*]
4
+ tools: [execute/runInTerminal, read/problems, read/readFile, read/terminalLastCommand, agent/runSubagent, search/changes, search/codebase, search/usages, web/fetch, web/githubRepo, browser/openBrowserPage, browser/readPage, browser/screenshotPage, browser/navigatePage, browser/clickElement, browser/dragElement, browser/hoverElement, browser/typeInPage, browser/runPlaywrightCode, browser/handleDialog, knowledge-base/*]
5
5
  model: GPT-5.4 (copilot)
6
6
  ---
7
7
 
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  description: 'Security specialist that analyzes code for vulnerabilities and compliance'
3
3
  argument-hint: Code, feature, or component to security review
4
- tools: [execute/runInTerminal, read/problems, read/readFile, agent/runSubagent, search/changes, search/codebase, search/usages, web/fetch, web/githubRepo, ms-vscode.vscode-websearchforcopilot/websearch, browser/*, knowledge-base/*]
4
+ tools: [execute/runInTerminal, read/problems, read/readFile, agent/runSubagent, search/changes, search/codebase, search/usages, web/fetch, web/githubRepo, browser/openBrowserPage, browser/readPage, browser/screenshotPage, browser/navigatePage, browser/clickElement, browser/dragElement, browser/hoverElement, browser/typeInPage, browser/runPlaywrightCode, browser/handleDialog, knowledge-base/*]
5
5
  model: Claude Opus 4.6 (copilot)
6
6
  ---
7
7
 
@@ -1,36 +1,48 @@
1
1
  ---
2
2
  name: present
3
- description: "Use the KB `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, and composition patterns. Load this skill before calling the present tool to ensure professional output."
4
- argument-hint: "Content to present — data, analysis results, status report, comparison"
3
+ description: "Use the KB `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, timeline, kanban, tree, diff-view, dashboard). Load this skill before calling the present tool to ensure professional output."
4
+ argument-hint: "Content to present — data, analysis results, status report, comparison, or interactive MCP App"
5
5
  ---
6
6
 
7
7
  # Present Tool — Rich Interactive Dashboards
8
8
 
9
9
  The `present` tool renders structured content as a professional dark-themed dashboard. It supports two output modes:
10
10
 
11
- - **`browser`** (recommended) Serves a themed dashboard on a local URL and returns it in the response. **You must open the URL** using the `openBrowserPage` browser tool to display it in VS Code's integrated browser. Supports interactive action buttons that block until the user clicks.
12
- - **`html`** — Renders an embedded UIResource for MCP-UI hosts. Actions shown as numbered text choices.
11
+ - **`html`** — Renders an embedded UIResource for MCP-UI hosts (in-chat). Best for display-only content.
12
+ - **`browser`** — Serves a themed dashboard on a local URL. Best when you need **user interaction** (buttons, selections, form input). The tool blocks until the user clicks an action, then returns their selection.
13
13
 
14
- **Always prefer `format: "browser"`** for rich content. Use `"html"` only when the host doesn't support browser mode.
14
+ ## Format Selection Rules (MUST FOLLOW)
15
+
16
+ | Situation | Format | Why |
17
+ |-----------|--------|-----|
18
+ | Display-only content (tables, charts, reports, status boards) | **`html`** | No interaction needed — render in-chat |
19
+ | Need user input back (confirmations, selections, form data) | **`browser`** | Browser supports blocking actions that return data |
20
+ | Rich visual dashboards without interaction | **`html`** | Prefer in-chat when no response is needed |
21
+ | User explicitly asks for browser | **`browser`** | Respect explicit preference |
22
+
23
+ **Rule: If no user interaction is needed, use `format: "html"`. If you need user interaction, use `format: "browser"`.**
15
24
 
16
25
  ---
17
26
 
18
- ## Browser Workflow (IMPORTANT)
27
+ ## Browser Workflow (IMPORTANT — read carefully)
19
28
 
20
- When using `format: "browser"`, the `present` tool does **not** open the page automatically. Follow this workflow:
29
+ When using `format: "browser"`, the tool starts a local HTTP server and returns a URL. **You MUST open the URL** so the user can see and interact with the dashboard.
21
30
 
22
- 1. Call `present` with `format: "browser"` — it returns text containing `🌐 **Dashboard opened in browser:** http://127.0.0.1:{port}`
23
- 2. Extract the URL from the response
24
- 3. Call `openBrowserPage` with that URL to display the dashboard in VS Code's integrated browser
31
+ ### Steps:
32
+ 1. Call `present` with `format: "browser"` and `actions` — it returns text containing `🌐 **Dashboard opened in browser:** http://127.0.0.1:{port}`
33
+ 2. **Extract the URL from the response**
34
+ 3. **Call `openBrowserPage({ url: "http://127.0.0.1:{port}" })` to open it in VS Code's Simple Browser**
25
35
 
26
36
  ```
27
37
  // Step 1: Call present
28
- result = present({ format: "browser", title: "...", content: [...] })
38
+ result = present({ format: "browser", title: "...", content: [...], actions: [...] })
29
39
 
30
- // Step 2: Open in VS Code integrated browser
40
+ // Step 2: MUST open in VS Code Simple Browser
31
41
  openBrowserPage({ url: "http://127.0.0.1:{port}" })
32
42
  ```
33
43
 
44
+ > **Fallback**: The server also auto-opens the system browser as a safety net. But you should ALWAYS call `openBrowserPage` yourself so the user sees it inside VS Code.
45
+
34
46
  **Note:** The HTTP server auto-closes after 5 minutes. Open the page promptly after receiving the URL.
35
47
 
36
48
  ---
@@ -151,3 +163,262 @@ The dashboard uses a professional dark theme:
151
163
  - Use `donut` for proportions/distributions
152
164
  - Use `sparkline` inline with metrics for mini trends
153
165
  7. **Table auto-features:** Tables with 5+ rows get automatic search/filter. Columns are sortable by click.
166
+
167
+ ---
168
+
169
+ ## MCP Apps Templates (VS Code Chat Widgets)
170
+
171
+ When `chat.mcp.apps.enabled` is true in VS Code settings, the `present` tool can render **interactive widgets directly in the chat panel** using the `template` parameter. These are distinct from the browser/html dashboard modes.
172
+
173
+ **Key difference:** Templates use `template` + object `content` (not array of blocks). No `format` parameter needed. The widget renders inline in VS Code chat. User interactions (reorder, select, submit) are returned to the LLM as structured data.
174
+
175
+ ### When to use MCP Apps vs Browser Dashboard
176
+
177
+ | Use Case | Mode | Why |
178
+ |----------|------|-----|
179
+ | Quick user input (pick items, reorder, fill form) | **MCP App template** | Inline in chat, no context switch |
180
+ | Rich multi-section dashboard with charts | **browser** | Full page layout with all block types |
181
+ | Simple confirmation or selection | **Actions** (browser/html) | Buttons/selects in dashboard |
182
+
183
+ ### Template: `list-sort`
184
+
185
+ Drag-and-drop reorderable list. Use for priority ordering, task sequencing, or ranked preferences.
186
+
187
+ ```json
188
+ {
189
+ "template": "list-sort",
190
+ "title": "Priority Order",
191
+ "content": {
192
+ "items": [
193
+ { "id": "task-1", "label": "Fix authentication bug" },
194
+ { "id": "task-2", "label": "Add search feature" },
195
+ { "id": "task-3", "label": "Update documentation" }
196
+ ]
197
+ }
198
+ }
199
+ ```
200
+
201
+ **Content schema:** `{ items: Array<{ id: string, label: string }> }`
202
+ **Returns:** Reordered array of items after user drags to reorder and submits.
203
+
204
+ ### Template: `data-table`
205
+
206
+ Filterable, sortable table with optional summary stat cards. Use for structured data review, change summaries, or audit results.
207
+
208
+ ```json
209
+ {
210
+ "template": "data-table",
211
+ "title": "File Changes",
212
+ "content": {
213
+ "columns": [
214
+ { "key": "file", "label": "File" },
215
+ { "key": "change", "label": "Change" },
216
+ { "key": "lines", "label": "Lines" }
217
+ ],
218
+ "rows": [
219
+ { "file": "auth.ts", "change": "Added guard", "lines": 5 },
220
+ { "file": "cache.ts", "change": "Fixed bug", "lines": 12 }
221
+ ],
222
+ "stats": [
223
+ { "label": "Files Changed", "value": "2" },
224
+ { "label": "Total Lines", "value": "17" }
225
+ ]
226
+ }
227
+ }
228
+ ```
229
+
230
+ **Content schema:** `{ columns: Array<{ key: string, label: string }>, rows: Array<Record<string, unknown>>, stats?: Array<{ label: string, value: string }> }`
231
+ **Returns:** Selected row(s) data when user interacts and submits.
232
+
233
+ ### Template: `picker`
234
+
235
+ Multi-select with categories and tag-based search. Use for component selection, feature toggles, or module picking.
236
+
237
+ ```json
238
+ {
239
+ "template": "picker",
240
+ "title": "Select Modules",
241
+ "content": {
242
+ "categories": [
243
+ { "id": "core", "label": "Core" },
244
+ { "id": "plugins", "label": "Plugins" }
245
+ ],
246
+ "items": [
247
+ { "id": "auth", "label": "Authentication", "category": "core", "tags": ["security"] },
248
+ { "id": "cache", "label": "Cache Layer", "category": "core", "tags": ["performance"] },
249
+ { "id": "sentry", "label": "Sentry Plugin", "category": "plugins", "tags": ["monitoring"] }
250
+ ]
251
+ }
252
+ }
253
+ ```
254
+
255
+ **Content schema:** `{ categories: Array<{ id: string, label: string }>, items: Array<{ id: string, label: string, category: string, tags?: string[] }> }`
256
+ **Returns:** Array of selected item IDs after user checks items and submits.
257
+
258
+ ### Template: `flame-graph`
259
+
260
+ Hierarchical zoomable visualization. Use for codebase structure, performance profiles, dependency trees, or budget breakdowns.
261
+
262
+ ```json
263
+ {
264
+ "template": "flame-graph",
265
+ "title": "Module Hierarchy",
266
+ "content": {
267
+ "profile": {
268
+ "name": "root",
269
+ "total": 100,
270
+ "children": [
271
+ {
272
+ "name": "packages/tools",
273
+ "total": 60,
274
+ "children": [
275
+ { "name": "search.ts", "total": 35 },
276
+ { "name": "compact.ts", "total": 25 }
277
+ ]
278
+ },
279
+ { "name": "packages/server", "total": 40 }
280
+ ]
281
+ }
282
+ }
283
+ }
284
+ ```
285
+
286
+ **Content schema:** `{ profile: { name: string, total: number, children?: Array<(recursive)> } }`
287
+ **Returns:** Clicked node information when user interacts.
288
+
289
+ ### Template: `form`
290
+
291
+ Input fields with text inputs, selects, and checkboxes. Use for configuration, parameter collection, or setup wizards.
292
+
293
+ ```json
294
+ {
295
+ "template": "form",
296
+ "title": "Project Configuration",
297
+ "content": {
298
+ "fields": [
299
+ { "name": "projectName", "label": "Project Name", "type": "text", "value": "my-app" },
300
+ { "name": "framework", "label": "Framework", "type": "select", "options": ["React", "Vue", "Svelte"], "value": "React" },
301
+ { "name": "typescript", "label": "Use TypeScript", "type": "checkbox", "value": true },
302
+ { "name": "description", "label": "Description", "type": "text", "value": "" }
303
+ ]
304
+ }
305
+ }
306
+ ```
307
+
308
+ **Content schema:** `{ fields: Array<{ name: string, label: string, type: "text" | "select" | "checkbox", value?: string | boolean, options?: string[] }> }`
309
+ **Returns:** Object with field name-value pairs after user fills out and submits.
310
+
311
+ ### MCP Apps Best Practices
312
+
313
+ 1. **Use meaningful `id` values** — they are returned in responses and used for programmatic handling.
314
+ 2. **Keep list-sort items under 15** — longer lists become unwieldy for drag-and-drop.
315
+ 3. **Always provide `value` defaults** in forms — pre-fill with sensible defaults to reduce user effort.
316
+ 4. **Use `tags` in picker** — they power the search/filter functionality.
317
+ 5. **Flame-graph `total` values** should be consistent — parent total should equal sum of children.
318
+ 6. **Data-table `stats`** are optional — use them for KPI summary cards above the table.
319
+ 7. **Combine with LLM logic** — use returned values to drive next steps (e.g., form → generate config, picker → scope analysis).
320
+
321
+ #### 6. `timeline` — Vertical Event Timeline (display only)
322
+
323
+ ```json
324
+ {
325
+ "events": [
326
+ {"title": "v1.0 Release", "description": "Initial release with core features", "timestamp": "2025-01", "status": "complete"},
327
+ {"title": "v2.0 Beta", "description": "MCP Apps support", "timestamp": "2025-07", "status": "active"},
328
+ {"title": "v3.0 Planning", "status": "pending"}
329
+ ]
330
+ }
331
+ ```
332
+
333
+ Fields: `title` (required), `description?`, `timestamp?`, `status?` (`'complete'|'active'|'pending'|'error'`), `icon?`, `category?`
334
+
335
+ #### 7. `kanban` — Drag-Drop Board (interactive — emits on card move)
336
+
337
+ ```json
338
+ {
339
+ "columns": [
340
+ {"id": "todo", "label": "To Do"},
341
+ {"id": "in-progress", "label": "In Progress", "color": "#3b82f6"},
342
+ {"id": "done", "label": "Done", "color": "#22c55e"}
343
+ ],
344
+ "cards": [
345
+ {"id": "c1", "title": "Fix auth bug", "column": "todo", "tags": ["bugfix"], "priority": "high"},
346
+ {"id": "c2", "title": "Add search", "column": "in-progress", "tags": ["feature"], "priority": "medium"}
347
+ ]
348
+ }
349
+ ```
350
+
351
+ Returns `{cardId, fromColumn, toColumn}` when a card is dragged between columns.
352
+
353
+ #### 8. `tree` — Collapsible Tree View (display only)
354
+
355
+ ```json
356
+ {
357
+ "root": {
358
+ "label": "packages/",
359
+ "children": [
360
+ {"label": "server/", "children": [{"label": "index.ts"}, {"label": "tools/", "children": [{"label": "present.ts"}]}]},
361
+ {"label": "present/", "children": [{"label": "present-app.ts"}]}
362
+ ]
363
+ }
364
+ }
365
+ ```
366
+
367
+ Fields: `label` (required), `id?`, `icon?`, `children?: TreeNode[]`, `metadata?: Record<string,string>`. Accepts `root` as single node or array of nodes.
368
+
369
+ #### 9. `diff-view` — Side-by-Side Code Diff (display only)
370
+
371
+ ```json
372
+ {
373
+ "files": [{
374
+ "path": "auth.ts",
375
+ "status": "modified",
376
+ "additions": 12,
377
+ "deletions": 3,
378
+ "hunks": [{
379
+ "header": "@@ -10,5 +10,14 @@",
380
+ "changes": [
381
+ {"type": "context", "content": "const auth = {};"},
382
+ {"type": "delete", "content": "// old validation"},
383
+ {"type": "add", "content": "// new JWT validation"},
384
+ {"type": "add", "content": "const token = verify(jwt);"}
385
+ ]
386
+ }]
387
+ }],
388
+ "stats": {"additions": 12, "deletions": 3, "filesChanged": 1}
389
+ }
390
+ ```
391
+
392
+ Status values: `'added'|'modified'|'deleted'|'renamed'`. Change types: `'add'|'delete'|'context'`.
393
+
394
+ #### 10. `dashboard` — Metric Cards Grid (display only)
395
+
396
+ ```json
397
+ {
398
+ "metrics": [
399
+ {"label": "Uptime", "value": "99.9%", "status": "success", "trend": {"value": "+0.1%", "direction": "up"}},
400
+ {"label": "Build Time", "value": "4.2s", "type": "progress", "progress": 42, "status": "warning"},
401
+ {"label": "Top Endpoints", "type": "list", "value": "3", "items": [
402
+ {"label": "/api/search", "value": "1.2k/day"},
403
+ {"label": "/api/present", "value": "890/day"}
404
+ ]}
405
+ ]
406
+ }
407
+ ```
408
+
409
+ Metric types: `'stat'` (default), `'progress'` (with bar), `'list'` (sub-items). Status: `'success'|'warning'|'error'|'info'`.
410
+
411
+ ### Interaction Summary (All 10 Templates)
412
+
413
+ | Template | Trigger | Data Returned to LLM |
414
+ |----------|---------|---------------------|
415
+ | list-sort | Auto on drag-drop | Reordered ID array |
416
+ | data-table | Export button | Current filtered rows |
417
+ | picker | Apply Selection button | Selected ID array |
418
+ | flame-graph | Auto on node click | Clicked node object |
419
+ | form | Submit button | Field values object |
420
+ | kanban | Auto on card drag | `{cardId, fromColumn, toColumn}` |
421
+ | timeline | Display only | — |
422
+ | tree | Display only | — |
423
+ | diff-view | Display only | — |
424
+ | dashboard | Display only | — |