@synth-coder/memhub 0.2.2 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.factory/commands/opsx-apply.md +150 -0
- package/.factory/commands/opsx-archive.md +155 -0
- package/.factory/commands/opsx-explore.md +171 -0
- package/.factory/commands/opsx-propose.md +104 -0
- package/.factory/skills/openspec-apply-change/SKILL.md +156 -0
- package/.factory/skills/openspec-archive-change/SKILL.md +114 -0
- package/.factory/skills/openspec-explore/SKILL.md +288 -0
- package/.factory/skills/openspec-propose/SKILL.md +110 -0
- package/.github/workflows/ci.yml +48 -12
- package/.github/workflows/release.yml +67 -0
- package/AGENTS.md +158 -17
- package/README.md +147 -66
- package/README.zh-CN.md +75 -23
- package/dist/src/cli/agents/claude-code.d.ts +5 -0
- package/dist/src/cli/agents/claude-code.d.ts.map +1 -0
- package/dist/src/cli/agents/claude-code.js +14 -0
- package/dist/src/cli/agents/claude-code.js.map +1 -0
- package/dist/src/cli/agents/cline.d.ts +5 -0
- package/dist/src/cli/agents/cline.d.ts.map +1 -0
- package/dist/src/cli/agents/cline.js +14 -0
- package/dist/src/cli/agents/cline.js.map +1 -0
- package/dist/src/cli/agents/codex.d.ts +5 -0
- package/dist/src/cli/agents/codex.d.ts.map +1 -0
- package/dist/src/cli/agents/codex.js +14 -0
- package/dist/src/cli/agents/codex.js.map +1 -0
- package/dist/src/cli/agents/cursor.d.ts +5 -0
- package/dist/src/cli/agents/cursor.d.ts.map +1 -0
- package/dist/src/cli/agents/cursor.js +14 -0
- package/dist/src/cli/agents/cursor.js.map +1 -0
- package/dist/src/cli/agents/factory-droid.d.ts +5 -0
- package/dist/src/cli/agents/factory-droid.d.ts.map +1 -0
- package/dist/src/cli/agents/factory-droid.js +14 -0
- package/dist/src/cli/agents/factory-droid.js.map +1 -0
- package/dist/src/cli/agents/gemini-cli.d.ts +5 -0
- package/dist/src/cli/agents/gemini-cli.d.ts.map +1 -0
- package/dist/src/cli/agents/gemini-cli.js +14 -0
- package/dist/src/cli/agents/gemini-cli.js.map +1 -0
- package/dist/src/cli/agents/index.d.ts +14 -0
- package/dist/src/cli/agents/index.d.ts.map +1 -0
- package/dist/src/cli/agents/index.js +30 -0
- package/dist/src/cli/agents/index.js.map +1 -0
- package/dist/src/cli/agents/windsurf.d.ts +5 -0
- package/dist/src/cli/agents/windsurf.d.ts.map +1 -0
- package/dist/src/cli/agents/windsurf.js +14 -0
- package/dist/src/cli/agents/windsurf.js.map +1 -0
- package/dist/src/cli/index.d.ts +8 -0
- package/dist/src/cli/index.d.ts.map +1 -0
- package/dist/src/cli/index.js +168 -0
- package/dist/src/cli/index.js.map +1 -0
- package/dist/src/cli/init.d.ts +34 -0
- package/dist/src/cli/init.d.ts.map +1 -0
- package/dist/src/cli/init.js +160 -0
- package/dist/src/cli/init.js.map +1 -0
- package/dist/src/cli/instructions.d.ts +29 -0
- package/dist/src/cli/instructions.d.ts.map +1 -0
- package/dist/src/cli/instructions.js +141 -0
- package/dist/src/cli/instructions.js.map +1 -0
- package/dist/src/cli/types.d.ts +22 -0
- package/dist/src/cli/types.d.ts.map +1 -0
- package/dist/src/cli/types.js +86 -0
- package/dist/src/cli/types.js.map +1 -0
- package/dist/src/contracts/schemas.js.map +1 -1
- package/dist/src/server/mcp-server.d.ts +8 -0
- package/dist/src/server/mcp-server.d.ts.map +1 -1
- package/dist/src/server/mcp-server.js +30 -16
- package/dist/src/server/mcp-server.js.map +1 -1
- package/dist/src/services/embedding-service.d.ts.map +1 -1
- package/dist/src/services/embedding-service.js +1 -1
- package/dist/src/services/embedding-service.js.map +1 -1
- package/dist/src/services/memory-service.d.ts +1 -0
- package/dist/src/services/memory-service.d.ts.map +1 -1
- package/dist/src/services/memory-service.js +125 -82
- package/dist/src/services/memory-service.js.map +1 -1
- package/dist/src/storage/markdown-storage.d.ts.map +1 -1
- package/dist/src/storage/markdown-storage.js +1 -1
- package/dist/src/storage/markdown-storage.js.map +1 -1
- package/dist/src/storage/vector-index.d.ts.map +1 -1
- package/dist/src/storage/vector-index.js +4 -5
- package/dist/src/storage/vector-index.js.map +1 -1
- package/docs/README.md +21 -0
- package/docs/mcp-tools.md +136 -0
- package/docs/user-guide.md +182 -0
- package/package.json +22 -19
- package/src/cli/agents/claude-code.ts +14 -0
- package/src/cli/agents/cline.ts +14 -0
- package/src/cli/agents/codex.ts +14 -0
- package/src/cli/agents/cursor.ts +14 -0
- package/src/cli/agents/factory-droid.ts +14 -0
- package/src/cli/agents/gemini-cli.ts +14 -0
- package/src/cli/agents/index.ts +36 -0
- package/src/cli/agents/windsurf.ts +14 -0
- package/src/cli/index.ts +192 -0
- package/src/cli/init.ts +218 -0
- package/src/cli/instructions.ts +156 -0
- package/src/cli/types.ts +112 -0
- package/src/contracts/mcp.ts +1 -1
- package/src/contracts/schemas.ts +4 -4
- package/src/contracts/types.ts +4 -4
- package/src/server/mcp-server.ts +36 -29
- package/src/services/embedding-service.ts +80 -80
- package/src/services/memory-service.ts +142 -107
- package/src/storage/markdown-storage.ts +1 -9
- package/src/storage/vector-index.ts +117 -118
- package/test/cli/init.test.ts +380 -0
- package/test/server/mcp-server.test.ts +45 -3
- package/test/services/memory-service.test.ts +16 -4
- package/test/storage/frontmatter-parser.test.ts +1 -1
- package/test/storage/markdown-storage.test.ts +19 -10
- package/test/storage/vector-index.test.ts +129 -133
- package/test/utils/slugify.test.ts +5 -1
- package/docs/architecture.md +0 -349
- package/docs/contracts.md +0 -119
- package/docs/prompt-template.md +0 -79
- package/docs/proposals/mcp-typescript-sdk-refactor.md +0 -568
- package/docs/proposals/proposal-close-gates.md +0 -58
- package/docs/tool-calling-policy.md +0 -107
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Init command implementation
|
|
3
|
+
* Generates MCP configuration for different AI agents
|
|
4
|
+
*/
|
|
5
|
+
import { existsSync, mkdirSync, writeFileSync, readFileSync } from 'fs';
|
|
6
|
+
import { dirname, join } from 'path';
|
|
7
|
+
import { homedir } from 'os';
|
|
8
|
+
import * as p from '@clack/prompts';
|
|
9
|
+
import { AGENTS, getAgentById } from './types.js';
|
|
10
|
+
import { getConfigGenerator } from './agents/index.js';
|
|
11
|
+
import { updateInstructionsContent } from './instructions.js';
|
|
12
|
+
import { parse as parseToml, stringify as stringifyToml } from 'smol-toml';
|
|
13
|
+
/**
|
|
14
|
+
* Parse config file content based on format
|
|
15
|
+
*/
|
|
16
|
+
function parseConfig(content, format) {
|
|
17
|
+
if (format === 'toml') {
|
|
18
|
+
return parseToml(content);
|
|
19
|
+
}
|
|
20
|
+
return JSON.parse(content);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Stringify config to string based on format
|
|
24
|
+
*/
|
|
25
|
+
function stringifyConfig(config, format) {
|
|
26
|
+
if (format === 'toml') {
|
|
27
|
+
return stringifyToml(config);
|
|
28
|
+
}
|
|
29
|
+
return JSON.stringify(config, null, 2);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Merge memhub config into existing config
|
|
33
|
+
* Preserves all existing servers, adds/updates memhub
|
|
34
|
+
*/
|
|
35
|
+
function mergeMcpConfig(existing, newConfig) {
|
|
36
|
+
const result = { ...existing };
|
|
37
|
+
// Ensure mcpServers object exists
|
|
38
|
+
if (typeof result.mcpServers !== 'object' || result.mcpServers === null) {
|
|
39
|
+
result.mcpServers = {};
|
|
40
|
+
}
|
|
41
|
+
// Merge memhub server
|
|
42
|
+
const existingServers = result.mcpServers;
|
|
43
|
+
const newServers = newConfig.mcpServers;
|
|
44
|
+
for (const [serverName, serverConfig] of Object.entries(newServers)) {
|
|
45
|
+
existingServers[serverName] = serverConfig;
|
|
46
|
+
}
|
|
47
|
+
return result;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Run interactive agent selection using clack
|
|
51
|
+
*/
|
|
52
|
+
export async function selectAgentInteractive() {
|
|
53
|
+
const selection = await p.select({
|
|
54
|
+
message: 'Select your AI agent',
|
|
55
|
+
options: AGENTS.map(agent => ({
|
|
56
|
+
value: agent.id,
|
|
57
|
+
label: agent.name,
|
|
58
|
+
hint: agent.description,
|
|
59
|
+
})),
|
|
60
|
+
});
|
|
61
|
+
if (p.isCancel(selection)) {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
return selection;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Generate and write MCP configuration for the specified agent
|
|
68
|
+
*/
|
|
69
|
+
export function initAgent(options) {
|
|
70
|
+
const { agent, force = false, local = false, projectPath } = options;
|
|
71
|
+
const agentConfig = getAgentById(agent);
|
|
72
|
+
if (!agentConfig) {
|
|
73
|
+
return {
|
|
74
|
+
success: false,
|
|
75
|
+
error: `Unknown agent: ${agent}. Valid agents: ${AGENTS.map(a => a.id).join(', ')}`,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
// Determine base path and file paths based on local flag
|
|
79
|
+
const basePath = projectPath ?? (local ? process.cwd() : homedir());
|
|
80
|
+
const configFile = local ? agentConfig.configFile : agentConfig.globalConfigFile;
|
|
81
|
+
const instructionsFile = local
|
|
82
|
+
? agentConfig.instructionsFile
|
|
83
|
+
: agentConfig.globalInstructionsFile;
|
|
84
|
+
const configPath = join(basePath, configFile);
|
|
85
|
+
const configDir = dirname(configPath);
|
|
86
|
+
const instructionsPath = join(basePath, instructionsFile);
|
|
87
|
+
const instructionsDir = dirname(instructionsPath);
|
|
88
|
+
// Generate MCP configuration
|
|
89
|
+
const generator = getConfigGenerator(agent);
|
|
90
|
+
const newConfig = generator(basePath);
|
|
91
|
+
let finalConfig;
|
|
92
|
+
// Check if config already exists
|
|
93
|
+
const configFormat = agentConfig.configFormat;
|
|
94
|
+
if (existsSync(configPath)) {
|
|
95
|
+
if (force) {
|
|
96
|
+
// Force: still merge, but this updates memhub entry
|
|
97
|
+
try {
|
|
98
|
+
const existingContent = readFileSync(configPath, 'utf-8');
|
|
99
|
+
const existingConfig = parseConfig(existingContent, configFormat);
|
|
100
|
+
finalConfig = mergeMcpConfig(existingConfig, newConfig);
|
|
101
|
+
}
|
|
102
|
+
catch {
|
|
103
|
+
// Invalid config, use new config
|
|
104
|
+
finalConfig = newConfig;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
// No force: check if memhub already exists
|
|
109
|
+
try {
|
|
110
|
+
const existingContent = readFileSync(configPath, 'utf-8');
|
|
111
|
+
const existingConfig = parseConfig(existingContent, configFormat);
|
|
112
|
+
const servers = existingConfig.mcpServers;
|
|
113
|
+
if (servers && 'memhub' in servers) {
|
|
114
|
+
return {
|
|
115
|
+
success: false,
|
|
116
|
+
error: `MemHub is already configured in ${configFile}. Use --force to update.`,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
// Merge with existing config
|
|
120
|
+
finalConfig = mergeMcpConfig(existingConfig, newConfig);
|
|
121
|
+
}
|
|
122
|
+
catch {
|
|
123
|
+
return {
|
|
124
|
+
success: false,
|
|
125
|
+
error: `Failed to parse existing config at ${configFile}. Use --force to overwrite.`,
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
finalConfig = newConfig;
|
|
132
|
+
}
|
|
133
|
+
// Ensure directories exist
|
|
134
|
+
if (!existsSync(configDir)) {
|
|
135
|
+
mkdirSync(configDir, { recursive: true });
|
|
136
|
+
}
|
|
137
|
+
if (!existsSync(instructionsDir)) {
|
|
138
|
+
mkdirSync(instructionsDir, { recursive: true });
|
|
139
|
+
}
|
|
140
|
+
// Write MCP configuration
|
|
141
|
+
writeFileSync(configPath, stringifyConfig(finalConfig, configFormat), 'utf-8');
|
|
142
|
+
// Handle instructions file
|
|
143
|
+
let existingContent = '';
|
|
144
|
+
if (existsSync(instructionsPath)) {
|
|
145
|
+
existingContent = readFileSync(instructionsPath, 'utf-8');
|
|
146
|
+
}
|
|
147
|
+
const { content: updatedContent, updated: instructionsUpdated, reason: instructionsReason, } = updateInstructionsContent(existingContent, agentConfig);
|
|
148
|
+
if (instructionsUpdated || !existsSync(instructionsPath)) {
|
|
149
|
+
writeFileSync(instructionsPath, updatedContent, 'utf-8');
|
|
150
|
+
}
|
|
151
|
+
return {
|
|
152
|
+
success: true,
|
|
153
|
+
configPath: configFile,
|
|
154
|
+
instructionsPath: instructionsFile,
|
|
155
|
+
instructionsUpdated,
|
|
156
|
+
instructionsReason,
|
|
157
|
+
agent: agentConfig,
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
//# sourceMappingURL=init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../src/cli/init.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAC7B,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAC;AACpC,OAAO,EAAE,MAAM,EAAoC,YAAY,EAAE,MAAM,YAAY,CAAC;AACpF,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,WAAW,CAAC;AA0B3E;;GAEG;AACH,SAAS,WAAW,CAClB,OAAe,EACf,MAAoC;IAEpC,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;QACtB,OAAO,SAAS,CAAC,OAAO,CAA4B,CAAC;IACvD,CAAC;IACD,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAA4B,CAAC;AACxD,CAAC;AAED;;GAEG;AACH,SAAS,eAAe,CACtB,MAA+B,EAC/B,MAAoC;IAEpC,IA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AC,EAAE,CAAC;QAC3B,SAAS,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC5C,CAAC;IACD,IAAI,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE,CAAC;QACjC,SAAS,CAAC,eAAe,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAClD,CAAC;IAED,0BAA0B;IAC1B,aAAa,CAAC,UAAU,EAAE,eAAe,CAAC,WAAW,EAAE,YAAY,CAAC,EAAE,OAAO,CAAC,CAAC;IAE/E,2BAA2B;IAC3B,IAAI,eAAe,GAAG,EAAE,CAAC;IACzB,IAAI,UAAU,CAAC,gBAAgB,CAAC,EAAE,CAAC;QACjC,eAAe,GAAG,YAAY,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;IAC5D,CAAC;IAED,MAAM,EACJ,OAAO,EAAE,cAAc,EACvB,OAAO,EAAE,mBAAmB,EAC5B,MAAM,EAAE,kBAAkB,GAC3B,GAAG,yBAAyB,CAAC,eAAe,EAAE,WAAW,CAAC,CAAC;IAE5D,IAAI,mBAAmB,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE,CAAC;QACzD,aAAa,CAAC,gBAAgB,EAAE,cAAc,EAAE,OAAO,CAAC,CAAC;IAC3D,CAAC;IAED,OAAO;QACL,OAAO,EAAE,IAAI;QACb,UAAU,EAAE,UAAU;QACtB,gBAAgB,EAAE,gBAAgB;QAClC,mBAAmB;QACnB,kBAAkB;QAClB,KAAK,EAAE,WAAW;KACnB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MemHub instructions generator
|
|
3
|
+
* Generates agent-specific instruction content with versioned tags
|
|
4
|
+
*/
|
|
5
|
+
import type { AgentConfig } from './types.js';
|
|
6
|
+
/**
|
|
7
|
+
* Extract MemHub version from content if present
|
|
8
|
+
*/
|
|
9
|
+
export declare function extractMemHubVersion(content: string): string | null;
|
|
10
|
+
/**
|
|
11
|
+
* Check if MemHub instructions exist and need update
|
|
12
|
+
*/
|
|
13
|
+
export declare function needsUpdate(content: string): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Generate MemHub instructions content
|
|
16
|
+
*/
|
|
17
|
+
export declare function generateInstructionsContent(agent: AgentConfig): string;
|
|
18
|
+
/**
|
|
19
|
+
* Update instructions file content
|
|
20
|
+
* - If no MemHub section: prepend new instructions
|
|
21
|
+
* - If MemHub section exists and outdated: replace with new version
|
|
22
|
+
* - If MemHub section exists and current: no change
|
|
23
|
+
*/
|
|
24
|
+
export declare function updateInstructionsContent(existingContent: string, agent: AgentConfig): {
|
|
25
|
+
content: string;
|
|
26
|
+
updated: boolean;
|
|
27
|
+
reason: string;
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=instructions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instructions.d.ts","sourceRoot":"","sources":["../../../src/cli/instructions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAO9C;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAGnE;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAIpD;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,CA8EtE;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CACvC,eAAe,EAAE,MAAM,EACvB,KAAK,EAAE,WAAW,GACjB;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAkCvD"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MemHub instructions generator
|
|
3
|
+
* Generates agent-specific instruction content with versioned tags
|
|
4
|
+
*/
|
|
5
|
+
const MEMHUB_VERSION = '0.2.3';
|
|
6
|
+
const START_TAG = `<!-- MEMHUB:v${MEMHUB_VERSION}:START -->`;
|
|
7
|
+
const END_TAG = '<!-- MEMHUB:END -->';
|
|
8
|
+
/**
|
|
9
|
+
* Extract MemHub version from content if present
|
|
10
|
+
*/
|
|
11
|
+
export function extractMemHubVersion(content) {
|
|
12
|
+
const match = content.match(/<!-- MEMHUB:v([\d.]+):START -->/);
|
|
13
|
+
return match ? match[1] : null;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Check if MemHub instructions exist and need update
|
|
17
|
+
*/
|
|
18
|
+
export function needsUpdate(content) {
|
|
19
|
+
const version = extractMemHubVersion(content);
|
|
20
|
+
if (!version)
|
|
21
|
+
return true;
|
|
22
|
+
return version !== MEMHUB_VERSION;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Generate MemHub instructions content
|
|
26
|
+
*/
|
|
27
|
+
export function generateInstructionsContent(agent) {
|
|
28
|
+
const isMarkdown = agent.instructionsFormat === 'markdown';
|
|
29
|
+
if (isMarkdown) {
|
|
30
|
+
return `${START_TAG}
|
|
31
|
+
## MemHub - AI Memory System
|
|
32
|
+
|
|
33
|
+
MemHub is a Git-friendly memory system for storing decisions, preferences, and reusable knowledge.
|
|
34
|
+
|
|
35
|
+
### When to Call memory_load
|
|
36
|
+
|
|
37
|
+
**Proactively call** memory_load in these scenarios:
|
|
38
|
+
|
|
39
|
+
- Starting a new conversation or task
|
|
40
|
+
- User mentions "before", "remember", "last time" keywords
|
|
41
|
+
- Uncertain about user preferences or constraints
|
|
42
|
+
- Need project context (tech stack, conventions, architecture)
|
|
43
|
+
|
|
44
|
+
### When to Call memory_update
|
|
45
|
+
|
|
46
|
+
**Proactively store** memories in these scenarios:
|
|
47
|
+
|
|
48
|
+
- User explicitly expresses a preference ("I prefer functional components")
|
|
49
|
+
- User makes a decision with reasoning ("Using PostgreSQL because...")
|
|
50
|
+
- Discover important project context (tech stack, constraints, patterns)
|
|
51
|
+
- User corrects your assumptions ("Actually, we don't use Redux")
|
|
52
|
+
|
|
53
|
+
### Usage Principles
|
|
54
|
+
|
|
55
|
+
1. **Load on demand** - Call memory_load at task start to get context
|
|
56
|
+
2. **Store timely** - Call memory_update when learning valuable information
|
|
57
|
+
3. **Query precisely** - Use tags to filter relevant memories
|
|
58
|
+
4. **Describe concisely** - Be specific in content, helpful in title
|
|
59
|
+
|
|
60
|
+
### Memory Types
|
|
61
|
+
|
|
62
|
+
| entryType | Purpose |
|
|
63
|
+
|-----------|---------|
|
|
64
|
+
| preference | User preferences (coding style, framework choices) |
|
|
65
|
+
| decision | Architecture decisions, technology choices |
|
|
66
|
+
| context | Project context (team, processes, constraints) |
|
|
67
|
+
| fact | Learned facts, important notes |
|
|
68
|
+
|
|
69
|
+
${END_TAG}`;
|
|
70
|
+
}
|
|
71
|
+
// Plain text format (for .cursorrules, .clinerules, etc.)
|
|
72
|
+
return `${START_TAG}
|
|
73
|
+
# MemHub - AI Memory System
|
|
74
|
+
|
|
75
|
+
MemHub is a Git-friendly memory system for storing decisions, preferences, and reusable knowledge.
|
|
76
|
+
|
|
77
|
+
## When to Call memory_load
|
|
78
|
+
|
|
79
|
+
- Starting a new conversation or task
|
|
80
|
+
- User mentions "before", "remember", "last time" keywords
|
|
81
|
+
- Uncertain about user preferences or constraints
|
|
82
|
+
- Need project context (tech stack, conventions, architecture)
|
|
83
|
+
|
|
84
|
+
## When to Call memory_update
|
|
85
|
+
|
|
86
|
+
- User explicitly expresses a preference
|
|
87
|
+
- User makes a decision with reasoning
|
|
88
|
+
- Discover important project context
|
|
89
|
+
- User corrects your assumptions
|
|
90
|
+
|
|
91
|
+
## Memory Types
|
|
92
|
+
|
|
93
|
+
- preference: User preferences
|
|
94
|
+
- decision: Architecture decisions
|
|
95
|
+
- context: Project context
|
|
96
|
+
- fact: Learned facts
|
|
97
|
+
|
|
98
|
+
## Principle
|
|
99
|
+
|
|
100
|
+
Will my future self benefit from knowing this? If yes, store it.
|
|
101
|
+
|
|
102
|
+
${END_TAG}`;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Update instructions file content
|
|
106
|
+
* - If no MemHub section: prepend new instructions
|
|
107
|
+
* - If MemHub section exists and outdated: replace with new version
|
|
108
|
+
* - If MemHub section exists and current: no change
|
|
109
|
+
*/
|
|
110
|
+
export function updateInstructionsContent(existingContent, agent) {
|
|
111
|
+
const trimmedContent = existingContent.trim();
|
|
112
|
+
const hasMemHub = trimmedContent.includes('<!-- MEMHUB:');
|
|
113
|
+
if (!hasMemHub) {
|
|
114
|
+
// No MemHub section: prepend
|
|
115
|
+
const newInstructions = generateInstructionsContent(agent);
|
|
116
|
+
return {
|
|
117
|
+
content: `${newInstructions}\n\n${trimmedContent}`,
|
|
118
|
+
updated: true,
|
|
119
|
+
reason: 'MemHub instructions added',
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
const currentVersion = extractMemHubVersion(trimmedContent);
|
|
123
|
+
if (currentVersion === MEMHUB_VERSION) {
|
|
124
|
+
// Already up to date
|
|
125
|
+
return {
|
|
126
|
+
content: existingContent,
|
|
127
|
+
updated: false,
|
|
128
|
+
reason: 'Already up to date',
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
// Need to update: replace old section with new
|
|
132
|
+
const newInstructions = generateInstructionsContent(agent);
|
|
133
|
+
const pattern = /<!-- MEMHUB:v[\d.]+:START -->[\s\S]*?<!-- MEMHUB:END -->/;
|
|
134
|
+
const updatedContent = trimmedContent.replace(pattern, newInstructions);
|
|
135
|
+
return {
|
|
136
|
+
content: updatedContent,
|
|
137
|
+
updated: true,
|
|
138
|
+
reason: `Updated from v${currentVersion} to v${MEMHUB_VERSION}`,
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
//# sourceMappingURL=instructions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instructions.js","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,eAAe,GAAG,2BAA2B,CAAC,KAAK,CAAC,CAAC;QAC3D,OAAO;YACL,OAAO,EAAE,GAAG,eAAe,OAAO,cAAc,EAAE;YAClD,OAAO,EAAE,IAAI;YACb,MAAM,EAAE,2BAA2B;SACpC,CAAC;IACJ,CAAC;IAED,MAAM,cAAc,GAAG,oBAAoB,CAAC,cAAc,CAAC,CAAC;IAC5D,IAAI,cAAc,KAAK,cAAc,EAAE,CAAC;QACtC,qBAAqB;QACrB,OAAO;YACL,OAAO,EAAE,eAAe;YACxB,OAAO,EAAE,KAAK;YACd,MAAM,EAAE,oBAAoB;SAC7B,CAAC;IACJ,CAAC;IAED,+CAA+C;IAC/C,MAAM,eAAe,GAAG,2BAA2B,CAAC,KAAK,CAAC,CAAC;IAC3D,MAAM,OAAO,GAAG,0DAA0D,CAAC;IAC3E,MAAM,cAAc,GAAG,cAAc,CAAC,OAAO,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;IAExE,OAAO;QACL,OAAO,EAAE,cAAc;QACvB,OAAO,EAAE,IAAI;QACb,MAAM,EAAE,iBAAiB,cAAc,QAAQ,cAAc,EAAE;KAChE,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI types and constants
|
|
3
|
+
*/
|
|
4
|
+
export type AgentType = 'cursor' | 'claude-code' | 'cline' | 'windsurf' | 'factory-droid' | 'gemini-cli' | 'codex';
|
|
5
|
+
export interface AgentConfig {
|
|
6
|
+
readonly id: AgentType;
|
|
7
|
+
readonly name: string;
|
|
8
|
+
readonly description: string;
|
|
9
|
+
/** Local config file path (relative to project root) */
|
|
10
|
+
readonly configFile: string;
|
|
11
|
+
/** Global config file path (relative to home directory) */
|
|
12
|
+
readonly globalConfigFile: string;
|
|
13
|
+
readonly configFormat: 'json' | 'markdown' | 'toml';
|
|
14
|
+
/** Local instructions file path */
|
|
15
|
+
readonly instructionsFile: string;
|
|
16
|
+
/** Global instructions file path (relative to home directory) */
|
|
17
|
+
readonly globalInstructionsFile: string;
|
|
18
|
+
readonly instructionsFormat: 'markdown' | 'plain';
|
|
19
|
+
}
|
|
20
|
+
export declare const AGENTS: readonly AgentConfig[];
|
|
21
|
+
export declare function getAgentById(id: AgentType): AgentConfig | undefined;
|
|
22
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/cli/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,MAAM,SAAS,GACjB,QAAQ,GACR,aAAa,GACb,OAAO,GACP,UAAU,GACV,eAAe,GACf,YAAY,GACZ,OAAO,CAAC;AAEZ,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,EAAE,EAAE,SAAS,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,wDAAwD;IACxD,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,2DAA2D;IAC3D,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,UAAU,GAAG,MAAM,CAAC;IACpD,mCAAmC;IACnC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,iEAAiE;IACjE,QAAQ,CAAC,sBAAsB,EAAE,MAAM,CAAC;IACxC,QAAQ,CAAC,kBAAkB,EAAE,UAAU,GAAG,OAAO,CAAC;CACnD;AAED,eAAO,MAAM,MAAM,EAAE,SAAS,WAAW,EA8E/B,CAAC;AAEX,wBAAgB,YAAY,CAAC,EAAE,EAAE,SAAS,GAAG,WAAW,GAAG,SAAS,CAEnE"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI types and constants
|
|
3
|
+
*/
|
|
4
|
+
export const AGENTS = [
|
|
5
|
+
{
|
|
6
|
+
id: 'cursor',
|
|
7
|
+
name: 'Cursor',
|
|
8
|
+
description: 'AI code editor with MCP support',
|
|
9
|
+
configFile: '.cursor/mcp.json',
|
|
10
|
+
globalConfigFile: '.cursor/mcp.json',
|
|
11
|
+
configFormat: 'json',
|
|
12
|
+
instructionsFile: '.cursorrules',
|
|
13
|
+
globalInstructionsFile: '.cursorrules',
|
|
14
|
+
instructionsFormat: 'plain',
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
id: 'claude-code',
|
|
18
|
+
name: 'Claude Code',
|
|
19
|
+
description: 'Anthropic CLI for Claude',
|
|
20
|
+
configFile: '.mcp.json',
|
|
21
|
+
globalConfigFile: '.claude/settings.json',
|
|
22
|
+
configFormat: 'json',
|
|
23
|
+
instructionsFile: 'CLAUDE.md',
|
|
24
|
+
globalInstructionsFile: '.claude/CLAUDE.md',
|
|
25
|
+
instructionsFormat: 'markdown',
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
id: 'cline',
|
|
29
|
+
name: 'Cline',
|
|
30
|
+
description: 'VS Code extension for AI coding',
|
|
31
|
+
configFile: '.cline/mcp.json',
|
|
32
|
+
globalConfigFile: '.cline/mcp.json',
|
|
33
|
+
configFormat: 'json',
|
|
34
|
+
instructionsFile: '.clinerules',
|
|
35
|
+
globalInstructionsFile: '.clinerules',
|
|
36
|
+
instructionsFormat: 'plain',
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
id: 'windsurf',
|
|
40
|
+
name: 'Windsurf',
|
|
41
|
+
description: 'Codeium AI editor',
|
|
42
|
+
configFile: '.codeium/windsurf/mcp_config.json',
|
|
43
|
+
globalConfigFile: '.codeium/windsurf/mcp_config.json',
|
|
44
|
+
configFormat: 'json',
|
|
45
|
+
instructionsFile: '.windsurfrules',
|
|
46
|
+
globalInstructionsFile: '.windsurfrules',
|
|
47
|
+
instructionsFormat: 'plain',
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
id: 'factory-droid',
|
|
51
|
+
name: 'Factory Droid',
|
|
52
|
+
description: 'Factory AI coding agent',
|
|
53
|
+
configFile: '.factory/mcp.json',
|
|
54
|
+
globalConfigFile: '.factory/mcp.json',
|
|
55
|
+
configFormat: 'json',
|
|
56
|
+
instructionsFile: '.factory/AGENTS.md',
|
|
57
|
+
globalInstructionsFile: '.factory/AGENTS.md',
|
|
58
|
+
instructionsFormat: 'markdown',
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
id: 'gemini-cli',
|
|
62
|
+
name: 'Gemini CLI',
|
|
63
|
+
description: 'Google Gemini command line tool',
|
|
64
|
+
configFile: '.gemini/settings.json',
|
|
65
|
+
globalConfigFile: '.gemini/settings.json',
|
|
66
|
+
configFormat: 'json',
|
|
67
|
+
instructionsFile: 'GEMINI.md',
|
|
68
|
+
globalInstructionsFile: '.gemini/GEMINI.md',
|
|
69
|
+
instructionsFormat: 'markdown',
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
id: 'codex',
|
|
73
|
+
name: 'Codex',
|
|
74
|
+
description: 'OpenAI CLI coding agent',
|
|
75
|
+
configFile: '.codex/config.toml',
|
|
76
|
+
globalConfigFile: '.codex/config.toml',
|
|
77
|
+
configFormat: 'toml',
|
|
78
|
+
instructionsFile: 'AGENTS.md',
|
|
79
|
+
globalInstructionsFile: '.codex/AGENTS.md',
|
|
80
|
+
instructionsFormat: 'markdown',
|
|
81
|
+
},
|
|
82
|
+
];
|
|
83
|
+
export function getAgentById(id) {
|
|
84
|
+
return AGENTS.find(agent => agent.id === id);
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/cli/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AA2BH,MAAM,CAAC,MAAM,MAAM,GAA2B;IAC5C;QACE,EAAE,EAAE,QAAQ;QACZ,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,iCAAiC;QAC9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AAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;CACrE,CAAC,CAAC"}
|
|
@@ -4,6 +4,14 @@
|
|
|
4
4
|
* Uses @modelcontextprotocol/sdk for protocol handling
|
|
5
5
|
*/
|
|
6
6
|
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
7
|
+
/**
|
|
8
|
+
* Resolve storage path with the following priority:
|
|
9
|
+
* 1. MEMHUB_STORAGE_PATH env var (if set):
|
|
10
|
+
* - Absolute path: use as-is
|
|
11
|
+
* - Relative path starting with '.': resolve from current working directory
|
|
12
|
+
* 2. Default: ~/.memhub (user home directory)
|
|
13
|
+
*/
|
|
14
|
+
export declare function resolveStoragePath(): string;
|
|
7
15
|
/**
|
|
8
16
|
* Create McpServer instance using SDK
|
|
9
17
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-server.d.ts","sourceRoot":"","sources":["../../../src/server/mcp-server.ts"],"names":[],"mappings":";AACA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"mcp-server.d.ts","sourceRoot":"","sources":["../../../src/server/mcp-server.ts"],"names":[],"mappings":";AACA;;;GAGG;AAMH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAyBnE;;;;;;GAMG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAc3C;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAuFxC"}
|
|
@@ -4,13 +4,14 @@
|
|
|
4
4
|
* Uses @modelcontextprotocol/sdk for protocol handling
|
|
5
5
|
*/
|
|
6
6
|
import { readFileSync, existsSync } from 'fs';
|
|
7
|
-
import { join, dirname } from 'path';
|
|
7
|
+
import { join, dirname, resolve } from 'path';
|
|
8
8
|
import { fileURLToPath } from 'url';
|
|
9
|
+
import { homedir } from 'os';
|
|
9
10
|
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
10
11
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
11
|
-
import { CallToolRequestSchema, ListToolsRequestSchema
|
|
12
|
+
import { CallToolRequestSchema, ListToolsRequestSchema } from '@modelcontextprotocol/sdk/types.js';
|
|
12
13
|
import { MemoryService, ServiceError } from '../services/memory-service.js';
|
|
13
|
-
import { MemoryLoadInputSchema, MemoryUpdateInputV2Schema
|
|
14
|
+
import { MemoryLoadInputSchema, MemoryUpdateInputV2Schema } from '../contracts/schemas.js';
|
|
14
15
|
import { TOOL_DEFINITIONS, SERVER_INFO } from '../contracts/mcp.js';
|
|
15
16
|
import { ErrorCode } from '../contracts/types.js';
|
|
16
17
|
// Get package version
|
|
@@ -24,11 +25,31 @@ if (!existsSync(packageJsonPath)) {
|
|
|
24
25
|
packageJsonPath = join(__dirname, '../../package.json');
|
|
25
26
|
}
|
|
26
27
|
const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
|
|
28
|
+
/**
|
|
29
|
+
* Resolve storage path with the following priority:
|
|
30
|
+
* 1. MEMHUB_STORAGE_PATH env var (if set):
|
|
31
|
+
* - Absolute path: use as-is
|
|
32
|
+
* - Relative path starting with '.': resolve from current working directory
|
|
33
|
+
* 2. Default: ~/.memhub (user home directory)
|
|
34
|
+
*/
|
|
35
|
+
export function resolveStoragePath() {
|
|
36
|
+
const envPath = process.env.MEMHUB_STORAGE_PATH;
|
|
37
|
+
if (envPath) {
|
|
38
|
+
// If it's an absolute path, use as-is
|
|
39
|
+
if (envPath.startsWith('/') || envPath.match(/^[A-Z]:\\/i)) {
|
|
40
|
+
return envPath;
|
|
41
|
+
}
|
|
42
|
+
// Relative path: resolve from current working directory
|
|
43
|
+
return resolve(process.cwd(), envPath);
|
|
44
|
+
}
|
|
45
|
+
// Default: ~/.memhub
|
|
46
|
+
return join(homedir(), '.memhub');
|
|
47
|
+
}
|
|
27
48
|
/**
|
|
28
49
|
* Create McpServer instance using SDK
|
|
29
50
|
*/
|
|
30
51
|
export function createMcpServer() {
|
|
31
|
-
const storagePath =
|
|
52
|
+
const storagePath = resolveStoragePath();
|
|
32
53
|
const vectorSearch = process.env.MEMHUB_VECTOR_SEARCH !== 'false';
|
|
33
54
|
const memoryService = new MemoryService({ storagePath, vectorSearch });
|
|
34
55
|
// Create server using SDK
|
|
@@ -103,7 +124,7 @@ export function createMcpServer() {
|
|
|
103
124
|
return server;
|
|
104
125
|
}
|
|
105
126
|
/**
|
|
106
|
-
* Start the MCP server
|
|
127
|
+
* Start the MCP server (only when run directly)
|
|
107
128
|
*/
|
|
108
129
|
async function main() {
|
|
109
130
|
const server = createMcpServer();
|
|
@@ -111,19 +132,12 @@ async function main() {
|
|
|
111
132
|
await server.connect(transport);
|
|
112
133
|
console.error('MemHub MCP Server running on stdio');
|
|
113
134
|
}
|
|
114
|
-
main()
|
|
115
|
-
console.error('Fatal error:', error);
|
|
116
|
-
process.exit(1);
|
|
117
|
-
});
|
|
118
|
-
// Check if this file is being run directly
|
|
135
|
+
// Only run main() when this file is executed directly
|
|
119
136
|
const isMain = import.meta.url === `file://${process.argv[1]}` || false;
|
|
120
137
|
if (isMain) {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
console.error('Fatal error:', error);
|
|
125
|
-
process.exit(1);
|
|
126
|
-
});
|
|
138
|
+
main().catch(error => {
|
|
139
|
+
console.error('Fatal error:', error);
|
|
140
|
+
process.exit(1);
|
|
127
141
|
});
|
|
128
142
|
}
|
|
129
143
|
//# sourceMappingURL=mcp-server.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-server.js","sourceRoot":"","sources":["../../../src/server/mcp-server.ts"],"names":[],"mappings":";AACA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"mcp-server.js","sourceRoot":"","sources":["../../../src/server/mcp-server.ts"],"names":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EAAE,MAAe;4BACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,uBAAuB,KAAK,CAAC,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;yBACjF;qBACF;oBACD,OAAO,EAAE,IAAI;iBACd,CAAC;YACJ,CAAC;YAED,kCAAkC;YAClC,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;GAEG;AACH,KAAK,UAAU,IAAI;IACjB,MAAM,MAAM,GAAG,eAAe,EAAE,CAAC;IACjC,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAE7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,CAAC,KAAK,CAAC,oCAAoC,CAAC,CAAC;AACtD,CAAC;AAED,sDAAsD;AACtD,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,UAAU,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,KAAK,CAAC;AACxE,IAAI,MAAM,EAAE,CAAC;IACX,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;QACnB,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;QACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"embedding-service.d.ts","sourceRoot":"","sources":["../../../src/services/embedding-service.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,mDAAmD;AACnD,eAAO,MAAM,UAAU,MAAM,CAAC;AAmB9B;;;GAGG;AACH,qBAAa,gBAAgB;
|
|
1
|
+
{"version":3,"file":"embedding-service.d.ts","sourceRoot":"","sources":["../../../src/services/embedding-service.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,mDAAmD;AACnD,eAAO,MAAM,UAAU,MAAM,CAAC;AAmB9B;;;GAGG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAiC;IACxD,OAAO,CAAC,SAAS,CAA0C;IAC3D,OAAO,CAAC,WAAW,CAA8B;IACjD,OAAO,CAAC,YAAY,CAAmC;IAEvD,OAAO;IAIP,MAAM,CAAC,WAAW,IAAI,gBAAgB;IAOtC;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAsBjC;;;;;OAKG;IACG,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAe5C;;OAEG;IACG,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAIpE;;;OAGG;IACH,MAAM,CAAC,MAAM,IAAI,IAAI;CAGtB"}
|