@andespindola/brainlink 0.1.0-beta.6 → 0.1.0-beta.61
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/AGENTS.md +8 -5
- package/CHANGELOG.md +58 -2
- package/CONTRIBUTING.md +2 -2
- package/COPYRIGHT.md +5 -0
- package/README.md +266 -20
- package/SECURITY.md +1 -1
- package/dist/application/add-note.js +62 -13
- package/dist/application/analyze-vault.js +95 -8
- package/dist/application/build-context.js +56 -1
- package/dist/application/dedupe-notes.js +226 -0
- package/dist/application/frontend/client-css.js +214 -100
- package/dist/application/frontend/client-html.js +60 -45
- package/dist/application/frontend/client-js.js +1853 -139
- package/dist/application/frontend/client-worker-js.js +66 -0
- package/dist/application/get-graph-layout.js +18 -6
- package/dist/application/get-graph-node.js +12 -0
- package/dist/application/get-graph-summary.js +12 -0
- package/dist/application/get-graph.js +3 -3
- package/dist/application/import-legacy-sqlite.js +296 -0
- package/dist/application/index-vault.js +252 -19
- package/dist/application/list-agents.js +3 -3
- package/dist/application/list-links.js +5 -5
- package/dist/application/migrate-vault.js +91 -0
- package/dist/application/offline-pack-backup.js +44 -0
- package/dist/application/search-graph-node-ids.js +12 -0
- package/dist/application/search-knowledge.js +75 -5
- package/dist/application/server/routes.js +102 -1
- package/dist/application/start-server.js +75 -4
- package/dist/application/watch-vault.js +23 -2
- package/dist/benchmarks/large-vault.js +1 -1
- package/dist/cli/commands/agent-commands.js +419 -0
- package/dist/cli/commands/config-commands.js +167 -0
- package/dist/cli/commands/read-commands.js +25 -8
- package/dist/cli/commands/write-commands.js +989 -10
- package/dist/cli/main.js +4 -0
- package/dist/cli/runtime.js +5 -2
- package/dist/domain/context.js +53 -11
- package/dist/domain/embeddings.js +2 -1
- package/dist/domain/graph-layout.js +62 -15
- package/dist/domain/markdown.js +36 -4
- package/dist/domain/middle-out.js +18 -0
- package/dist/infrastructure/config.js +132 -8
- package/dist/infrastructure/file-index.js +358 -0
- package/dist/infrastructure/file-system-vault.js +30 -0
- package/dist/infrastructure/index-state.js +56 -0
- package/dist/infrastructure/paths.js +9 -1
- package/dist/infrastructure/private-pack-codec.js +134 -0
- package/dist/infrastructure/search-packs.js +452 -0
- package/dist/infrastructure/session-state.js +172 -0
- package/dist/mcp/main.js +11 -3
- package/dist/mcp/server.js +27 -2
- package/dist/mcp/startup.js +35 -0
- package/dist/mcp/tools.js +633 -19
- package/docs/AGENT_USAGE.md +178 -16
- package/docs/ARCHITECTURE.md +37 -26
- package/docs/QUICKSTART.md +111 -0
- package/package.json +6 -4
- package/dist/infrastructure/sqlite/document-writer.js +0 -51
- package/dist/infrastructure/sqlite/graph-reader.js +0 -120
- package/dist/infrastructure/sqlite/schema.js +0 -111
- package/dist/infrastructure/sqlite/search-reader.js +0 -156
- package/dist/infrastructure/sqlite/types.js +0 -1
- package/dist/infrastructure/sqlite-index.js +0 -25
package/dist/mcp/server.js
CHANGED
|
@@ -2,7 +2,7 @@ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
|
2
2
|
import { readFileSync } from 'node:fs';
|
|
3
3
|
import { dirname, join } from 'node:path';
|
|
4
4
|
import { fileURLToPath } from 'node:url';
|
|
5
|
-
import { addNoteInputSchema, addFileInputSchema, addFileTool, addNoteTool, brokenLinksInputSchema, brokenLinksTool, contextInputSchema, contextTool, graphInputSchema, graphTool, indexInputSchema, indexTool, orphansInputSchema, orphansTool, searchInputSchema, searchTool, statsInputSchema, statsTool, syncInputSchema, syncTool, validateInputSchema, validateTool } from './tools.js';
|
|
5
|
+
import { addNoteInputSchema, addFileInputSchema, addFileTool, addNoteTool, dedupeInputSchema, dedupeResolveInputSchema, dedupeResolveTool, dedupeTool, brokenLinksInputSchema, brokenLinksTool, bootstrapInputSchema, bootstrapTool, contextInputSchema, contextTool, graphInputSchema, graphTool, indexInputSchema, indexTool, orphansInputSchema, orphansTool, policyInputSchema, policyTool, recommendationsInputSchema, recommendationsTool, searchInputSchema, searchTool, statsInputSchema, statsTool, syncInputSchema, syncTool, validateInputSchema, validateTool } from './tools.js';
|
|
6
6
|
const readPackageVersion = () => {
|
|
7
7
|
const packagePath = join(dirname(fileURLToPath(import.meta.url)), '../../package.json');
|
|
8
8
|
const metadata = JSON.parse(readFileSync(packagePath, 'utf8'));
|
|
@@ -15,9 +15,24 @@ export const createBrainlinkMcpServer = () => {
|
|
|
15
15
|
version: readPackageVersion(),
|
|
16
16
|
description: 'Local-first Markdown memory tools for AI agents.'
|
|
17
17
|
});
|
|
18
|
+
server.registerTool('brainlink_bootstrap', {
|
|
19
|
+
title: 'Bootstrap Brainlink For A Task (Default Entrypoint)',
|
|
20
|
+
description: 'Default entrypoint for agents. Run this first to index/check memory state, then optionally retrieve context for the current task query.',
|
|
21
|
+
inputSchema: bootstrapInputSchema
|
|
22
|
+
}, bootstrapTool);
|
|
23
|
+
server.registerTool('brainlink_policy', {
|
|
24
|
+
title: 'Brainlink Bootstrap Policy',
|
|
25
|
+
description: 'Read or update bootstrap enforcement policy and inspect bootstrap readiness for the current vault/agent.',
|
|
26
|
+
inputSchema: policyInputSchema
|
|
27
|
+
}, policyTool);
|
|
28
|
+
server.registerTool('brainlink_recommendations', {
|
|
29
|
+
title: 'Brainlink Recommended MCP Workflow',
|
|
30
|
+
description: 'Return a plug-and-play action plan for this vault/agent, including policy, bootstrap, context retrieval and durable write guidance.',
|
|
31
|
+
inputSchema: recommendationsInputSchema
|
|
32
|
+
}, recommendationsTool);
|
|
18
33
|
server.registerTool('brainlink_context', {
|
|
19
34
|
title: 'Build Brainlink Context',
|
|
20
|
-
description: 'Read indexed Brainlink memory for a task or question. This is read-only and does not create graph links.',
|
|
35
|
+
description: 'Read indexed Brainlink memory for a task or question. Usually called after brainlink_bootstrap. This is read-only and does not create graph links.',
|
|
21
36
|
inputSchema: contextInputSchema
|
|
22
37
|
}, contextTool);
|
|
23
38
|
server.registerTool('brainlink_search', {
|
|
@@ -25,6 +40,16 @@ export const createBrainlinkMcpServer = () => {
|
|
|
25
40
|
description: 'Search indexed Brainlink notes with FTS, semantic or hybrid retrieval.',
|
|
26
41
|
inputSchema: searchInputSchema
|
|
27
42
|
}, searchTool);
|
|
43
|
+
server.registerTool('brainlink_dedupe', {
|
|
44
|
+
title: 'Detect Duplicate Notes',
|
|
45
|
+
description: 'Detect possible duplicate notes using exact content hash and semantic similarity scoring.',
|
|
46
|
+
inputSchema: dedupeInputSchema
|
|
47
|
+
}, dedupeTool);
|
|
48
|
+
server.registerTool('brainlink_resolve_duplicate', {
|
|
49
|
+
title: 'Resolve Duplicate Notes',
|
|
50
|
+
description: 'Resolve a duplicate pair with merge, link or ignore. Non-merge actions still create low-priority related edges.',
|
|
51
|
+
inputSchema: dedupeResolveInputSchema
|
|
52
|
+
}, dedupeResolveTool);
|
|
28
53
|
server.registerTool('brainlink_add_note', {
|
|
29
54
|
title: 'Add Brainlink Note',
|
|
30
55
|
description: 'Write durable Markdown memory, then reindex the vault. Include explicit [[wiki links]] for connected graph memory. Add priority markers near links, such as priority: high, #important or #critical, when a relationship should be weighted higher.',
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { indexVault } from '../application/index-vault.js';
|
|
2
|
+
import { loadBrainlinkConfig } from '../infrastructure/config.js';
|
|
3
|
+
import { assertVaultAllowed } from '../infrastructure/file-system-vault.js';
|
|
4
|
+
import { getBootstrapPolicy, touchBootstrapSession } from '../infrastructure/session-state.js';
|
|
5
|
+
export const runStartupBootstrap = async () => {
|
|
6
|
+
try {
|
|
7
|
+
const policy = await getBootstrapPolicy();
|
|
8
|
+
if (!policy.autoBootstrapOnStartup) {
|
|
9
|
+
return {
|
|
10
|
+
attempted: false,
|
|
11
|
+
skipped: true,
|
|
12
|
+
reason: 'autoBootstrapOnStartup=false'
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
const config = await loadBrainlinkConfig();
|
|
16
|
+
const vault = assertVaultAllowed(config.vault, config.allowedVaults);
|
|
17
|
+
const agent = config.defaultAgent;
|
|
18
|
+
const index = await indexVault(vault);
|
|
19
|
+
await touchBootstrapSession(vault, agent);
|
|
20
|
+
return {
|
|
21
|
+
attempted: true,
|
|
22
|
+
skipped: false,
|
|
23
|
+
vault,
|
|
24
|
+
agent: agent ?? '*',
|
|
25
|
+
index
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
return {
|
|
30
|
+
attempted: true,
|
|
31
|
+
skipped: false,
|
|
32
|
+
error: error instanceof Error ? error.message : String(error)
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
};
|