@vpxa/aikit 0.1.22 → 0.1.23

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 (31) hide show
  1. package/package.json +1 -1
  2. package/packages/cli/dist/commands/init/constants.d.ts +3 -0
  3. package/packages/cli/dist/commands/init/constants.js +1 -1
  4. package/scaffold/adapters/claude-code.mjs +9 -0
  5. package/scaffold/adapters/copilot.mjs +6 -6
  6. package/scaffold/definitions/models.mjs +10 -3
  7. package/scaffold/general/agents/Architect-Reviewer-Alpha.agent.md +1 -1
  8. package/scaffold/general/agents/Architect-Reviewer-Beta.agent.md +1 -1
  9. package/scaffold/general/agents/Code-Reviewer-Alpha.agent.md +1 -1
  10. package/scaffold/general/agents/Code-Reviewer-Beta.agent.md +1 -1
  11. package/scaffold/general/agents/Debugger.agent.md +1 -1
  12. package/scaffold/general/agents/Documenter.agent.md +1 -1
  13. package/scaffold/general/agents/Explorer.agent.md +1 -1
  14. package/scaffold/general/agents/Frontend.agent.md +1 -1
  15. package/scaffold/general/agents/Implementer.agent.md +1 -1
  16. package/scaffold/general/agents/Refactor.agent.md +1 -1
  17. package/scaffold/general/agents/Researcher-Alpha.agent.md +1 -1
  18. package/scaffold/general/agents/Researcher-Beta.agent.md +1 -1
  19. package/scaffold/general/agents/Researcher-Delta.agent.md +1 -1
  20. package/scaffold/general/agents/Researcher-Gamma.agent.md +1 -1
  21. package/scaffold/general/agents/Security.agent.md +1 -1
  22. package/packages/kb-client/dist/direct-client.d.ts +0 -37
  23. package/packages/kb-client/dist/direct-client.js +0 -1
  24. package/packages/kb-client/dist/index.d.ts +0 -5
  25. package/packages/kb-client/dist/index.js +0 -1
  26. package/packages/kb-client/dist/mcp-client.d.ts +0 -19
  27. package/packages/kb-client/dist/mcp-client.js +0 -4
  28. package/packages/kb-client/dist/parsers.d.ts +0 -35
  29. package/packages/kb-client/dist/parsers.js +0 -2
  30. package/packages/kb-client/dist/types.d.ts +0 -62
  31. package/packages/kb-client/dist/types.js +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vpxa/aikit",
3
- "version": "0.1.22",
3
+ "version": "0.1.23",
4
4
  "type": "module",
5
5
  "description": "Local-first AI developer toolkit — knowledge base, code analysis, context management, and developer tools for LLM agents",
6
6
  "license": "MIT",
@@ -37,6 +37,9 @@ declare const FLOW_DIRS: readonly ["aikit-basic", "aikit-advanced"];
37
37
  * web pages inside VS Code's built-in browser.
38
38
  * - mcpApps: Enables MCP tool apps so AI Kit tools can be consumed by Copilot
39
39
  * Chat without requiring manual MCP server configuration.
40
+ * - instructionsFilesLocations: Tells VS Code to load .instructions.md files
41
+ * from ~/.copilot/instructions/ (user-level) in addition to workspace-level
42
+ * locations. This is where `aikit init` places copilot-instructions.md.
40
43
  */
41
44
  declare const VSCODE_SETTINGS: Record<string, unknown>;
42
45
  //#endregion
@@ -1 +1 @@
1
- const e=`aikit`,t={type:`stdio`,command:`npx`,args:[`-y`,`@vpxa/aikit`,`serve`]},n=[`aikit`,`brainstorming`,`multi-agents-development`,`session-handoff`,`requirements-clarity`,`lesson-learned`,`c4-architecture`,`adr-skill`,`present`,`frontend-design`,`react`,`typescript`],r=[`aikit-basic`,`aikit-advanced`],i={"chat.agentFilesLocations":{"~/.claude/agents":!1},"github.copilot.chat.copilotMemory.enabled":!0,"chat.customAgentInSubagent.enabled":!0,"chat.useNestedAgentsMdFiles":!0,"chat.useAgentSkills":!0,"github.copilot.chat.switchAgent.enabled":!0,"workbench.browser.enableChatTools":!0,"chat.mcp.apps.enabled":!0};export{r as FLOW_DIRS,t as MCP_SERVER_ENTRY,e as SERVER_NAME,n as SKILL_NAMES,i as VSCODE_SETTINGS};
1
+ const e=`aikit`,t={type:`stdio`,command:`npx`,args:[`-y`,`@vpxa/aikit`,`serve`]},n=[`aikit`,`brainstorming`,`multi-agents-development`,`session-handoff`,`requirements-clarity`,`lesson-learned`,`c4-architecture`,`adr-skill`,`present`,`frontend-design`,`react`,`typescript`],r=[`aikit-basic`,`aikit-advanced`],i={"chat.agentFilesLocations":{"~/.claude/agents":!1},"github.copilot.chat.copilotMemory.enabled":!0,"chat.customAgentInSubagent.enabled":!0,"chat.useNestedAgentsMdFiles":!0,"chat.useAgentSkills":!0,"github.copilot.chat.switchAgent.enabled":!0,"workbench.browser.enableChatTools":!0,"chat.mcp.apps.enabled":!0,"chat.instructionsFilesLocations":{"~/.copilot/instructions":!0,".github/instructions":!0}};export{r as FLOW_DIRS,t as MCP_SERVER_ENTRY,e as SERVER_NAME,n as SKILL_NAMES,i as VSCODE_SETTINGS};
@@ -10,6 +10,15 @@
10
10
  * Status: STUB — not yet implemented.
11
11
  */
12
12
 
13
+ // biome-ignore lint/correctness/noUnusedImports: reserved for implementation
14
+ import { AGENTS } from '../definitions/agents.mjs';
15
+ // biome-ignore lint/correctness/noUnusedImports: reserved for implementation
16
+ import { AGENT_BODIES } from '../definitions/bodies.mjs';
17
+ // biome-ignore lint/correctness/noUnusedImports: reserved for implementation
18
+ import { CLAUDE_MODELS, VARIANT_GROUPS } from '../definitions/models.mjs';
19
+ // biome-ignore lint/correctness/noUnusedImports: reserved for implementation
20
+ import { IDE_CAPABILITIES } from '../definitions/tools.mjs';
21
+
13
22
  export const CLAUDE_FLOWS_SECTION = [
14
23
  '## Flows',
15
24
  '',
@@ -18,7 +18,7 @@
18
18
 
19
19
  import { AGENTS } from '../definitions/agents.mjs';
20
20
  import { AGENT_BODIES } from '../definitions/bodies.mjs';
21
- import { MODELS, VARIANT_GROUPS } from '../definitions/models.mjs';
21
+ import { COPILOT_MODELS, VARIANT_GROUPS } from '../definitions/models.mjs';
22
22
  import { PROMPTS } from '../definitions/prompts.mjs';
23
23
  import { PROTOCOLS, TEMPLATES } from '../definitions/protocols.mjs';
24
24
  import { IDE_CAPABILITIES } from '../definitions/tools.mjs';
@@ -64,7 +64,7 @@ function buildToolsYaml(toolRole) {
64
64
  }
65
65
 
66
66
  function copilotModel(agentName) {
67
- const models = MODELS[agentName];
67
+ const models = COPILOT_MODELS[agentName];
68
68
  if (!models) return 'Auto (copilot)';
69
69
  if (Array.isArray(models)) {
70
70
  if (models.length === 0) return 'Auto (copilot)';
@@ -90,14 +90,14 @@ function buildAgentTable() {
90
90
  if (def.variants) {
91
91
  for (const suffix of VARIANT_GROUPS[name] || []) {
92
92
  const fullName = `${name}-${suffix}`;
93
- const models = MODELS[fullName] || MODELS[name];
93
+ const models = COPILOT_MODELS[fullName] || COPILOT_MODELS[name];
94
94
  const model = Array.isArray(models) ? models[0] : models || 'Unknown';
95
95
  const varDef = def.variants[suffix] || {};
96
96
  const desc = varDef.description || def.description;
97
97
  rows.push(`| **${fullName}** | ${desc} | ${model} | ${def.category} |`);
98
98
  }
99
99
  } else {
100
- const models = MODELS[name];
100
+ const models = COPILOT_MODELS[name];
101
101
  const model = Array.isArray(models) ? models[0] : models || 'Unknown';
102
102
  rows.push(`| **${name}** | ${def.description} | ${model} | ${def.category} |`);
103
103
  }
@@ -130,7 +130,7 @@ function generateVariantAgent(roleName, suffix, def) {
130
130
 
131
131
  return `---
132
132
  description: '${desc}'
133
- ${def.argumentHint ? `argument-hint: ${def.argumentHint}\n` : ''}tools: ${buildToolsYaml(def.toolRole)}
133
+ ${def.argumentHint ? `argument-hint: "${def.argumentHint}"\n` : ''}tools: ${buildToolsYaml(def.toolRole)}
134
134
  model: ${model}
135
135
  ---
136
136
 
@@ -157,7 +157,7 @@ function generateSingleAgent(name, def) {
157
157
 
158
158
  return `---
159
159
  description: '${def.description}'
160
- ${def.argumentHint ? `argument-hint: ${def.argumentHint}\n` : ''}tools: ${buildToolsYaml(def.toolRole)}
160
+ ${def.argumentHint ? `argument-hint: "${def.argumentHint}"\n` : ''}tools: ${buildToolsYaml(def.toolRole)}
161
161
  model: ${model}
162
162
  ---
163
163
 
@@ -2,14 +2,14 @@
2
2
  * Centralized model assignments — THE SINGLE FILE to update when models change.
3
3
  *
4
4
  * Keys are agent names (stable, model-agnostic).
5
- * Values are model strings in the format expected by the target IDE.
6
- * Each IDE adapter may interpret or transform these values.
5
+ * COPILOT_MODELS keeps the full fallback list in Copilot format.
6
+ * CLAUDE_MODELS maps each agent to its primary model as a single plain string.
7
7
  *
8
8
  * Naming convention for variants: {Role}-Alpha, {Role}-Beta, {Role}-Gamma, {Role}-Delta
9
9
  * These are abstract labels — the actual model behind each is defined HERE.
10
10
  */
11
11
 
12
- export const MODELS = {
12
+ export const COPILOT_MODELS = {
13
13
  // ─── Single-role agents ───────────────────────────────────────────────
14
14
  Orchestrator: ['Claude Opus 4.6 (copilot)', 'GPT-5.4 (copilot)', 'Auto (copilot)'],
15
15
  Planner: ['Claude Opus 4.6 (copilot)', 'GPT-5.4 (copilot)', 'Auto (copilot)'],
@@ -51,6 +51,13 @@ export const MODELS = {
51
51
  'Architect-Reviewer-Beta': ['Claude Opus 4.6 (copilot)', 'Auto (copilot)'],
52
52
  };
53
53
 
54
+ export const CLAUDE_MODELS = Object.fromEntries(
55
+ Object.entries(COPILOT_MODELS).map(([agentName, models]) => {
56
+ const primaryModel = Array.isArray(models) ? models[0] : models;
57
+ return [agentName, primaryModel?.replace(/ \(copilot\)$/, '') || 'Auto'];
58
+ }),
59
+ );
60
+
54
61
  /**
55
62
  * Variant group definitions — maps role to variant suffixes.
56
63
  * Used by adapters to know which agents are variants of the same role.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  description: 'Primary architecture reviewer'
3
- argument-hint: Files, PR, or subsystem to architecture-review
3
+ argument-hint: "Files, PR, or subsystem to architecture-review"
4
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, aikit/*]
5
5
  model: [GPT-5.4 (copilot), Auto (copilot)]
6
6
  ---
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  description: 'Architecture reviewer variant — different LLM perspective for dual review'
3
- argument-hint: Files, PR, or subsystem to architecture-review
3
+ argument-hint: "Files, PR, or subsystem to architecture-review"
4
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, aikit/*]
5
5
  model: [Claude Opus 4.6 (copilot), Auto (copilot)]
6
6
  ---
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  description: 'Primary code reviewer'
3
- argument-hint: File path, PR, or code to review
3
+ argument-hint: "File path, PR, or code to review"
4
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, aikit/*]
5
5
  model: [GPT-5.4 (copilot), Auto (copilot)]
6
6
  ---
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  description: 'Code reviewer variant — different LLM perspective for dual review'
3
- argument-hint: File path, PR, or code to review
3
+ argument-hint: "File path, PR, or code to review"
4
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, aikit/*]
5
5
  model: [Claude Opus 4.6 (copilot), Auto (copilot)]
6
6
  ---
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  description: 'Expert debugger that diagnoses issues, traces errors, and provides solutions'
3
- argument-hint: Error message, stack trace, or description of issue
3
+ argument-hint: "Error message, stack trace, or description of issue"
4
4
  tools: [execute/runInTerminal, read/problems, read/readFile, read/terminalSelection, read/terminalLastCommand, agent/runSubagent, edit/createFile, edit/editFiles, search/changes, search/codebase, search/usages, browser/openBrowserPage, browser/readPage, browser/screenshotPage, browser/navigatePage, browser/clickElement, browser/dragElement, browser/hoverElement, browser/typeInPage, browser/runPlaywrightCode, browser/handleDialog, aikit/*]
5
5
  model: [Claude Opus 4.6 (copilot), GPT-5.4 (copilot), GPT-5.3-Codex (copilot), Auto (copilot)]
6
6
  ---
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  description: 'Documentation specialist that creates and maintains comprehensive project documentation'
3
- argument-hint: Component, API, feature, or area to document
3
+ argument-hint: "Component, API, feature, or area to document"
4
4
  tools: [execute/runInTerminal, read/problems, read/readFile, read/terminalLastCommand, agent/runSubagent, edit/createFile, edit/editFiles, edit/rename, edit/createDirectory, 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, aikit/*]
5
5
  model: [GPT-5.4 (copilot), Gemini 3.1 Pro (Preview) (copilot), Auto (copilot)]
6
6
  ---
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  description: 'Rapid codebase exploration to find files, usages, dependencies, and structural context'
3
- argument-hint: Find files, usages, and context related to: {topic or goal}
3
+ argument-hint: "Find files, usages, and context related to: {topic or goal}"
4
4
  tools: [read/problems, read/readFile, search/changes, search/codebase, search/usages, search/fileSearch, search/listDirectory, search/textSearch, browser/openBrowserPage, browser/readPage, browser/screenshotPage, browser/navigatePage, browser/clickElement, browser/dragElement, browser/hoverElement, browser/typeInPage, browser/runPlaywrightCode, browser/handleDialog, aikit/*]
5
5
  model: [Gemini 3 Flash (Preview) (copilot), Claude Haiku 4.5 (copilot), Auto (copilot)]
6
6
  ---
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  description: 'UI/UX specialist for React, styling, responsive design, and frontend implementation'
3
- argument-hint: UI component, styling task, or frontend feature
3
+ argument-hint: "UI component, styling task, or frontend feature"
4
4
  tools: [execute/createAndRunTask, execute/runInTerminal, read/problems, read/readFile, read/terminalLastCommand, agent/runSubagent, edit/createFile, edit/editFiles, edit/rename, edit/createDirectory, search/changes, search/codebase, search/usages, todo, browser/openBrowserPage, browser/readPage, browser/screenshotPage, browser/navigatePage, browser/clickElement, browser/dragElement, browser/hoverElement, browser/typeInPage, browser/runPlaywrightCode, browser/handleDialog, aikit/*]
5
5
  model: [Gemini 3.1 Pro (Preview) (copilot), GPT-5.4 (copilot), GPT-5.3-Codex (copilot), Auto (copilot)]
6
6
  ---
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  description: 'Persistent implementation agent that writes code following TDD practices until all tasks are complete'
3
- argument-hint: Implementation task, feature, or phase from plan
3
+ argument-hint: "Implementation task, feature, or phase from plan"
4
4
  tools: [execute/createAndRunTask, execute/runInTerminal, read/problems, read/readFile, read/terminalLastCommand, agent/runSubagent, edit/createFile, edit/editFiles, edit/rename, edit/createDirectory, search/changes, search/codebase, search/usages, todo, browser/openBrowserPage, browser/readPage, browser/screenshotPage, browser/navigatePage, browser/clickElement, browser/dragElement, browser/hoverElement, browser/typeInPage, browser/runPlaywrightCode, browser/handleDialog, aikit/*]
5
5
  model: [GPT-5.4 (copilot), Gemini 3.1 Pro (Preview) (copilot), GPT-5.3-Codex (copilot), Auto (copilot)]
6
6
  ---
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  description: 'Code refactoring specialist that improves structure, readability, and maintainability'
3
- argument-hint: Code, component, or pattern to refactor
3
+ argument-hint: "Code, component, or pattern to refactor"
4
4
  tools: [execute/runInTerminal, read/problems, read/readFile, read/terminalLastCommand, agent/runSubagent, edit/createFile, edit/editFiles, edit/rename, edit/createDirectory, search/changes, search/codebase, search/usages, browser/openBrowserPage, browser/readPage, browser/screenshotPage, browser/navigatePage, browser/clickElement, browser/dragElement, browser/hoverElement, browser/typeInPage, browser/runPlaywrightCode, browser/handleDialog, aikit/*]
5
5
  model: [GPT-5.4 (copilot), GPT-5.3-Codex (copilot), Auto (copilot)]
6
6
  ---
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  description: 'Primary deep research agent — also serves as default Researcher'
3
- argument-hint: Research question, problem statement, or subsystem to investigate
3
+ argument-hint: "Research question, problem statement, or subsystem to investigate"
4
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, aikit/*]
5
5
  model: [Claude Opus 4.6 (copilot), Auto (copilot)]
6
6
  ---
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  description: 'Research variant — pragmatic analysis with focus on trade-offs and edge cases'
3
- argument-hint: Research question, problem statement, or subsystem to investigate
3
+ argument-hint: "Research question, problem statement, or subsystem to investigate"
4
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, aikit/*]
5
5
  model: [Claude Sonnet 4.6 (copilot), Auto (copilot)]
6
6
  ---
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  description: 'Research variant — implementation feasibility and performance implications'
3
- argument-hint: Research question, problem statement, or subsystem to investigate
3
+ argument-hint: "Research question, problem statement, or subsystem to investigate"
4
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, aikit/*]
5
5
  model: [Gemini 3.1 Pro (Preview) (copilot), Auto (copilot)]
6
6
  ---
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  description: 'Research variant — broad pattern matching across domains and technologies'
3
- argument-hint: Research question, problem statement, or subsystem to investigate
3
+ argument-hint: "Research question, problem statement, or subsystem to investigate"
4
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, aikit/*]
5
5
  model: [GPT-5.4 (copilot), Auto (copilot)]
6
6
  ---
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  description: 'Security specialist that analyzes code for vulnerabilities and compliance'
3
- argument-hint: Code, feature, or component to security review
3
+ argument-hint: "Code, feature, or component to security review"
4
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, aikit/*]
5
5
  model: [Claude Opus 4.6 (copilot), GPT-5.4 (copilot), Auto (copilot)]
6
6
  ---
@@ -1,37 +0,0 @@
1
- import { IKBClient, KBGraphData, KBKnowledgeEntry, KBSearchResult, KBStatus } from "./types.js";
2
- import { IEmbedder } from "../../embeddings/dist/index.js";
3
- import { IGraphStore, IKnowledgeStore } from "../../store/dist/index.js";
4
-
5
- //#region packages/kb-client/src/direct-client.d.ts
6
- interface CuratedEntry {
7
- path: string;
8
- title: string;
9
- category: string;
10
- tags: string[];
11
- content: string;
12
- }
13
- interface DirectClientDeps {
14
- store: IKnowledgeStore;
15
- embedder: IEmbedder;
16
- graphStore?: IGraphStore;
17
- /** Function to list curated entries */
18
- listCurated?: () => Promise<CuratedEntry[]>;
19
- /** Function to read a single curated entry */
20
- readCurated?: (path: string) => Promise<CuratedEntry | null>;
21
- }
22
- declare class DirectKBClient implements IKBClient {
23
- private readonly deps;
24
- constructor(deps: DirectClientDeps);
25
- getStatus(): Promise<KBStatus>;
26
- search(query: string, options?: {
27
- limit?: number;
28
- mode?: 'hybrid' | 'semantic' | 'keyword';
29
- }): Promise<KBSearchResult[]>;
30
- listKnowledge(): Promise<KBKnowledgeEntry[]>;
31
- readKnowledge(path: string): Promise<KBKnowledgeEntry | null>;
32
- getGraph(query?: string): Promise<KBGraphData>;
33
- getFileTree(): Promise<string[]>;
34
- private getEdgesForNodes;
35
- }
36
- //#endregion
37
- export { DirectClientDeps, DirectKBClient };
@@ -1 +0,0 @@
1
- const e=1e3;var t=class{constructor(e){this.deps=e}async getStatus(){let e=await this.deps.store.getStats();return{totalRecords:e.totalRecords,totalFiles:e.totalFiles,lastIndexedAt:e.lastIndexedAt??null,onboarded:e.totalRecords>0}}async search(e,t){let n=t?.limit??10,i=t?.mode??`hybrid`;if(i===`keyword`)return(await this.deps.store.ftsSearch(e,{limit:n})).map(r);let a=await this.deps.embedder.embedQuery(e);if(i===`semantic`)return(await this.deps.store.search(a,{limit:n})).map(r);let[o,s]=await Promise.all([this.deps.store.search(a,{limit:n*2}),this.deps.store.ftsSearch(e,{limit:n*2}).catch(()=>[])]),c=new Map;for(let e of[...o,...s]){let t=c.get(e.record.id);(!t||e.score>t.score)&&c.set(e.record.id,e)}return[...c.values()].sort((e,t)=>t.score-e.score).slice(0,n).map(r)}async listKnowledge(){return this.deps.listCurated?(await this.deps.listCurated()).map(n):[]}async readKnowledge(e){if(!this.deps.readCurated)return null;let t=await this.deps.readCurated(e);return t?n(t):null}async getGraph(t){if(!this.deps.graphStore)return{nodes:[],edges:[]};let n=await this.deps.graphStore.findNodes(t?{namePattern:t,limit:500}:{limit:500});if(n.length===0)return{nodes:[],edges:[]};let r=t?await this.getEdgesForNodes(n):await this.deps.graphStore.findEdges({limit:e});return{nodes:n.map(e=>({id:e.id,name:e.name,type:e.type,...e.sourcePath?{sourcePath:e.sourcePath}:{}})),edges:i(r).map(e=>({fromId:e.fromId,toId:e.toId,type:e.type}))}}async getFileTree(){return this.deps.store.listSourcePaths()}async getEdgesForNodes(t){let n=this.deps.graphStore;if(!n)return[];let r=t.flatMap(t=>[n.findEdges({fromId:t.id,limit:e}),n.findEdges({toId:t.id,limit:e})]);return(await Promise.all(r)).flat()}};function n(e){return{path:e.path,title:e.title,category:e.category,tags:e.tags,content:e.content}}function r(e){return{sourcePath:e.record.sourcePath,contentType:e.record.contentType,score:e.score,content:e.record.content,headingPath:e.record.headingPath,startLine:e.record.startLine,endLine:e.record.endLine}}function i(e){let t=new Map;for(let n of e)t.set(n.id,n);return[...t.values()]}export{t as DirectKBClient};
@@ -1,5 +0,0 @@
1
- import { IKBClient, KBGraphData, KBKnowledgeEntry, KBSearchResult, KBStatus } from "./types.js";
2
- import { DirectClientDeps, DirectKBClient } from "./direct-client.js";
3
- import { McpKBClient } from "./mcp-client.js";
4
- import { ParsedContent, extractStructured, extractText, parseToolResult, tryParseJson } from "./parsers.js";
5
- export { type DirectClientDeps, DirectKBClient, type IKBClient, type KBGraphData, type KBKnowledgeEntry, type KBSearchResult, type KBStatus, McpKBClient, type ParsedContent, extractStructured, extractText, parseToolResult, tryParseJson };
@@ -1 +0,0 @@
1
- import{DirectKBClient as e}from"./direct-client.js";import{extractStructured as t,extractText as n,parseToolResult as r,tryParseJson as i}from"./parsers.js";import{McpKBClient as a}from"./mcp-client.js";export{e as DirectKBClient,a as McpKBClient,t as extractStructured,n as extractText,r as parseToolResult,i as tryParseJson};
@@ -1,19 +0,0 @@
1
- import { IKBClient, KBGraphData, KBKnowledgeEntry, KBSearchResult, KBStatus } from "./types.js";
2
- import { Client } from "@modelcontextprotocol/sdk/client/index.js";
3
-
4
- //#region packages/kb-client/src/mcp-client.d.ts
5
- declare class McpKBClient implements IKBClient {
6
- private readonly client;
7
- constructor(client: Client);
8
- getStatus(): Promise<KBStatus>;
9
- search(query: string, options?: {
10
- limit?: number;
11
- mode?: 'hybrid' | 'semantic' | 'keyword';
12
- }): Promise<KBSearchResult[]>;
13
- listKnowledge(): Promise<KBKnowledgeEntry[]>;
14
- readKnowledge(path: string): Promise<KBKnowledgeEntry | null>;
15
- getGraph(query?: string): Promise<KBGraphData>;
16
- getFileTree(): Promise<string[]>;
17
- }
18
- //#endregion
19
- export { McpKBClient };
@@ -1,4 +0,0 @@
1
- import{extractStructured as e,extractText as t}from"./parsers.js";var n=class{constructor(e){this.client=e}async getStatus(){let e=await this.client.callTool({name:`status`,arguments:{}}),t=i(e);if(t)return{totalRecords:l(t.totalRecords),totalFiles:l(t.totalFiles),lastIndexedAt:d(t.lastIndexedAt),onboarded:!!t.onboarded};let n=r(e);return{totalRecords:a(n,/Records:\s*(\d+)/i),totalFiles:a(n,/Files:\s*(\d+)/i),lastIndexedAt:null,onboarded:!/not onboarded/i.test(n)}}async search(e,t){let n=await this.client.callTool({name:`search`,arguments:{query:e,limit:t?.limit??10,search_mode:t?.mode??`hybrid`}}),a=i(n);return a?.results?a.results.map(e=>({sourcePath:f(e.sourcePath??e.path),contentType:f(e.contentType,`unknown`),score:l(e.score),content:f(e.content??e.snippet),headingPath:p(e.headingPath),startLine:u(e.startLine),endLine:u(e.endLine)})):o(r(n))}async listKnowledge(){let e=i(await this.client.callTool({name:`list`,arguments:{}}));return e?.entries?e.entries.map(e=>({path:f(e.path),title:f(e.title),category:f(e.category),tags:m(e.tags),content:f(e.content)})):[]}async readKnowledge(e){try{let t=r(await this.client.callTool({name:`read`,arguments:{path:e}}));return!t||/not found/i.test(t)?null:{path:e,title:e.split(`/`).pop()??e,category:e.split(`/`).at(-2)??`uncategorized`,tags:[],content:t}}catch{return null}}async getGraph(e){let t=s(r(await this.client.callTool({name:`graph`,arguments:{action:`find_nodes`,...e?{name_pattern:e}:{},limit:500}})));return t.length===0?{nodes:[],edges:[]}:{nodes:t,edges:c(r(await this.client.callTool({name:`graph`,arguments:{action:`find_edges`,limit:1e3}})))}}async getFileTree(){let e=await this.client.callTool({name:`find`,arguments:{glob:`**/*`,limit:1e4}}),t=i(e);return t?.results?t.results.map(e=>typeof e==`string`?e:e.path??``).filter(e=>e.length>0):r(e).split(`
2
- `).map(e=>e.trim()).filter(e=>e.length>0)}};function r(e){return t(e)}function i(t){return e(t)}function a(e,t){let n=t.exec(e);return n?Number.parseInt(n[1],10):0}function o(e){let t=[],n=e.split(/\n(?=\d+\.\s|\*\*)/);for(let e of n){let n=/(?:\*\*|`)([^*`]+?)(?:\*\*|`)/.exec(e),r=/score:\s*([\d.]+)/i.exec(e);n&&t.push({sourcePath:n[1].trim(),contentType:`unknown`,score:r?Number.parseFloat(r[1]):0,content:e.replace(/^.*\n/,``).trim().slice(0,200)})}return t}function s(e){let t=[];for(let n of e.split(`
3
- `)){let e=/\*\*(.+?)\*\*\s*\(([^,)]+)(?:,\s*id:\s*`?([\w-]+)`?)?/.exec(n);e&&t.push({id:e[3]??`node-${t.length}`,name:e[1],type:e[2]})}return t}function c(e){let t=[];for(let n of e.split(`
4
- `)){let e=/`?([\w-]+)`?\s*[—-]+\[(\w+)\][→>]\s*`?([\w-]+)`?/.exec(n);e&&t.push({fromId:e[1],toId:e[3],type:e[2]})}return t}function l(e){return typeof e==`number`?e:0}function u(e){return typeof e==`number`?e:void 0}function d(e){return typeof e==`string`?e:null}function f(e,t=``){return typeof e==`string`?e:t}function p(e){return typeof e==`string`?e:void 0}function m(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}export{n as McpKBClient};
@@ -1,35 +0,0 @@
1
- //#region packages/kb-client/src/parsers.d.ts
2
- /**
3
- * Content parsers for MCP tool responses.
4
- * Used by McpKBClient to parse structuredContent from tool calls.
5
- */
6
- interface ParsedContent<T = unknown> {
7
- text: string;
8
- structured?: T;
9
- }
10
- /**
11
- * Extract text content from an MCP tool result.
12
- */
13
- declare function extractText(result: {
14
- content?: unknown;
15
- } | null | undefined): string;
16
- /**
17
- * Extract structured content from an MCP tool result.
18
- */
19
- declare function extractStructured<T>(result: {
20
- structuredContent?: unknown;
21
- } | null | undefined): T | undefined;
22
- /**
23
- * Parse a tool result, returning both text and structured content.
24
- */
25
- declare function parseToolResult<T = unknown>(result: {
26
- content?: unknown;
27
- structuredContent?: unknown;
28
- } | null | undefined): ParsedContent<T>;
29
- /**
30
- * Try to parse JSON from a text tool result.
31
- * Returns undefined if parsing fails.
32
- */
33
- declare function tryParseJson<T = unknown>(text: string): T | undefined;
34
- //#endregion
35
- export { ParsedContent, extractStructured, extractText, parseToolResult, tryParseJson };
@@ -1,2 +0,0 @@
1
- function e(e){return!Array.isArray(e?.content)||e.content.length===0?``:e.content.filter(e=>typeof e==`object`&&!!e).filter(e=>e.type===`text`&&typeof e.text==`string`).map(e=>e.text).join(`
2
- `)}function t(e){return e?.structuredContent}function n(n){return{text:e(n),structured:t(n)}}function r(e){try{return JSON.parse(e)}catch{return}}export{t as extractStructured,e as extractText,n as parseToolResult,r as tryParseJson};
@@ -1,62 +0,0 @@
1
- //#region packages/kb-client/src/types.d.ts
2
- /**
3
- * IKBClient — Unified data access interface for KB consumers.
4
- *
5
- * Implemented by:
6
- * - DirectKBClient (in-process, used by TUI)
7
- * - McpKBClient (over MCP transport, used by Dashboard)
8
- */
9
- interface KBStatus {
10
- totalRecords: number;
11
- totalFiles: number;
12
- lastIndexedAt: string | null;
13
- onboarded: boolean;
14
- }
15
- interface KBSearchResult {
16
- sourcePath: string;
17
- contentType: string;
18
- score: number;
19
- content: string;
20
- headingPath?: string;
21
- startLine?: number;
22
- endLine?: number;
23
- }
24
- interface KBKnowledgeEntry {
25
- path: string;
26
- title: string;
27
- category: string;
28
- tags: string[];
29
- content: string;
30
- }
31
- interface KBGraphData {
32
- nodes: Array<{
33
- id: string;
34
- name: string;
35
- type: string;
36
- sourcePath?: string;
37
- }>;
38
- edges: Array<{
39
- fromId: string;
40
- toId: string;
41
- type: string;
42
- }>;
43
- }
44
- interface IKBClient {
45
- /** Get KB status. */
46
- getStatus(): Promise<KBStatus>;
47
- /** Search the knowledge base. */
48
- search(query: string, options?: {
49
- limit?: number;
50
- mode?: 'hybrid' | 'semantic' | 'keyword';
51
- }): Promise<KBSearchResult[]>;
52
- /** List curated knowledge entries. */
53
- listKnowledge(): Promise<KBKnowledgeEntry[]>;
54
- /** Read a specific curated entry. */
55
- readKnowledge(path: string): Promise<KBKnowledgeEntry | null>;
56
- /** Get knowledge graph data. */
57
- getGraph(query?: string): Promise<KBGraphData>;
58
- /** Get file tree of indexed sources. */
59
- getFileTree(): Promise<string[]>;
60
- }
61
- //#endregion
62
- export { IKBClient, KBGraphData, KBKnowledgeEntry, KBSearchResult, KBStatus };
@@ -1 +0,0 @@
1
- export{};