@andespindola/brainlink 1.6.3 → 1.6.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/dist/application/vault-bundle.js +72 -0
- package/dist/application/vault-snapshot.js +11 -5
- package/dist/cli/commands/vault-sync-commands.js +32 -7
- package/dist/infrastructure/config.js +13 -0
- package/dist/mcp/server.js +16 -1
- package/dist/mcp/tools/vault-tools.js +47 -0
- package/dist/mcp/tools.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// Multi-vault bundle (`.blbundle`): a single gzip-compressed envelope carrying one
|
|
2
|
+
// snapshot per vault, built on the reusable single-vault snapshot helpers. Exports
|
|
3
|
+
// all known vaults (or a chosen subset) into one movable file; import restores every
|
|
4
|
+
// bundled vault back to its recorded path or a chosen target, preserving conflicts.
|
|
5
|
+
import { readFile, writeFile } from 'node:fs/promises';
|
|
6
|
+
import { gzipSync, gunzipSync } from 'node:zlib';
|
|
7
|
+
import { basename, resolve } from 'node:path';
|
|
8
|
+
import { buildSnapshotEnvelope, applySnapshotEnvelope } from './vault-snapshot.js';
|
|
9
|
+
const bundleVersion = 1;
|
|
10
|
+
const bundleKind = 'brainlink-vault-bundle';
|
|
11
|
+
const dedupePaths = (vaultPaths) => {
|
|
12
|
+
const seen = new Set();
|
|
13
|
+
const paths = [];
|
|
14
|
+
for (const vaultPath of vaultPaths) {
|
|
15
|
+
if (seen.has(vaultPath)) {
|
|
16
|
+
continue;
|
|
17
|
+
}
|
|
18
|
+
seen.add(vaultPath);
|
|
19
|
+
paths.push(vaultPath);
|
|
20
|
+
}
|
|
21
|
+
return paths;
|
|
22
|
+
};
|
|
23
|
+
const parseBundle = (raw) => {
|
|
24
|
+
const envelope = JSON.parse(gunzipSync(raw).toString('utf8'));
|
|
25
|
+
if (!envelope || envelope.kind !== bundleKind || envelope.version !== bundleVersion || !Array.isArray(envelope.vaults)) {
|
|
26
|
+
throw new Error('Unrecognized .blbundle format.');
|
|
27
|
+
}
|
|
28
|
+
return envelope;
|
|
29
|
+
};
|
|
30
|
+
export const exportVaultsBundle = async (vaultPaths, outputFile) => {
|
|
31
|
+
const uniquePaths = dedupePaths(vaultPaths);
|
|
32
|
+
const vaults = await Promise.all(uniquePaths.map(async (vaultPath) => {
|
|
33
|
+
const vault = resolve(vaultPath);
|
|
34
|
+
return { vault, name: basename(vault), snapshot: await buildSnapshotEnvelope(vaultPath) };
|
|
35
|
+
}));
|
|
36
|
+
const envelope = {
|
|
37
|
+
version: bundleVersion,
|
|
38
|
+
kind: bundleKind,
|
|
39
|
+
createdAt: new Date().toISOString(),
|
|
40
|
+
vaults
|
|
41
|
+
};
|
|
42
|
+
const packed = gzipSync(Buffer.from(JSON.stringify(envelope), 'utf8'), { level: 9 });
|
|
43
|
+
await writeFile(outputFile, packed, { mode: 0o600 });
|
|
44
|
+
const fileCount = vaults.reduce((total, entry) => total + entry.snapshot.files.length, 0);
|
|
45
|
+
return { file: outputFile, vaultCount: vaults.length, fileCount, bytes: packed.byteLength };
|
|
46
|
+
};
|
|
47
|
+
export const listBundleVaults = async (bundleFile) => {
|
|
48
|
+
const envelope = parseBundle(await readFile(bundleFile));
|
|
49
|
+
return envelope.vaults.map((entry) => ({
|
|
50
|
+
name: entry.name,
|
|
51
|
+
vault: entry.vault,
|
|
52
|
+
fileCount: entry.snapshot.files.length
|
|
53
|
+
}));
|
|
54
|
+
};
|
|
55
|
+
export const importVaultsBundle = async (bundleFile, options = {}) => {
|
|
56
|
+
const envelope = parseBundle(await readFile(bundleFile));
|
|
57
|
+
const selected = options.only
|
|
58
|
+
? envelope.vaults.filter((entry) => entry.name === options.only || entry.vault === options.only)
|
|
59
|
+
: envelope.vaults;
|
|
60
|
+
if (options.only && selected.length === 0) {
|
|
61
|
+
throw new Error(`No vault "${options.only}" in bundle.`);
|
|
62
|
+
}
|
|
63
|
+
if (options.targetVault && selected.length > 1) {
|
|
64
|
+
throw new Error('targetVault requires selecting a single vault via only.');
|
|
65
|
+
}
|
|
66
|
+
const vaults = await Promise.all(selected.map(async (entry) => {
|
|
67
|
+
const target = options.targetVault ?? entry.vault;
|
|
68
|
+
const result = await applySnapshotEnvelope(entry.snapshot, target, { skipIndex: options.skipIndex });
|
|
69
|
+
return { name: entry.name, vault: target, imported: result.imported, conflicted: result.conflicted };
|
|
70
|
+
}));
|
|
71
|
+
return { vaults };
|
|
72
|
+
};
|
|
@@ -19,7 +19,7 @@ const conflictName = (path) => {
|
|
|
19
19
|
const base = extension ? path.slice(0, -extension.length) : path;
|
|
20
20
|
return `${base}.conflict-${stamp}${extension}`;
|
|
21
21
|
};
|
|
22
|
-
export const
|
|
22
|
+
export const buildSnapshotEnvelope = async (vaultPath) => {
|
|
23
23
|
const root = await ensureVault(vaultPath);
|
|
24
24
|
const markdownFiles = (await listVaultFiles(root)).filter(isMarkdown);
|
|
25
25
|
const entries = await Promise.all(markdownFiles.map(async (absolutePath) => {
|
|
@@ -30,15 +30,18 @@ export const exportVaultSnapshot = async (vaultPath, outputFile) => {
|
|
|
30
30
|
file: { path, contentB64: content.toString('base64') }
|
|
31
31
|
};
|
|
32
32
|
}));
|
|
33
|
-
|
|
33
|
+
return {
|
|
34
34
|
version: snapshotVersion,
|
|
35
35
|
createdAt: new Date().toISOString(),
|
|
36
36
|
manifest: entries.map((entry) => entry.manifest),
|
|
37
37
|
files: entries.map((entry) => entry.file)
|
|
38
38
|
};
|
|
39
|
+
};
|
|
40
|
+
export const exportVaultSnapshot = async (vaultPath, outputFile) => {
|
|
41
|
+
const envelope = await buildSnapshotEnvelope(vaultPath);
|
|
39
42
|
const packed = gzipSync(Buffer.from(JSON.stringify(envelope), 'utf8'), { level: 9 });
|
|
40
43
|
await writeFile(outputFile, packed, { mode: 0o600 });
|
|
41
|
-
return { file: outputFile, fileCount:
|
|
44
|
+
return { file: outputFile, fileCount: envelope.files.length, bytes: packed.byteLength };
|
|
42
45
|
};
|
|
43
46
|
const parseEnvelope = (raw) => {
|
|
44
47
|
const envelope = JSON.parse(gunzipSync(raw).toString('utf8'));
|
|
@@ -47,9 +50,8 @@ const parseEnvelope = (raw) => {
|
|
|
47
50
|
}
|
|
48
51
|
return envelope;
|
|
49
52
|
};
|
|
50
|
-
export const
|
|
53
|
+
export const applySnapshotEnvelope = async (envelope, vaultPath, options = {}) => {
|
|
51
54
|
const root = await ensureVault(vaultPath);
|
|
52
|
-
const envelope = parseEnvelope(await readFile(snapshotFile));
|
|
53
55
|
const manifestByPath = new Map(envelope.manifest.map((entry) => [entry.path, entry]));
|
|
54
56
|
let imported = 0;
|
|
55
57
|
let conflicted = 0;
|
|
@@ -85,3 +87,7 @@ export const importVaultSnapshot = async (snapshotFile, vaultPath, options = {})
|
|
|
85
87
|
const index = !options.skipIndex && imported + conflicted > 0 ? await indexVault(root) : undefined;
|
|
86
88
|
return { imported, conflicted, index };
|
|
87
89
|
};
|
|
90
|
+
export const importVaultSnapshot = async (snapshotFile, vaultPath, options = {}) => {
|
|
91
|
+
const envelope = parseEnvelope(await readFile(snapshotFile));
|
|
92
|
+
return applySnapshotEnvelope(envelope, vaultPath, options);
|
|
93
|
+
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { cloneVault, commitVault, initVaultGit, pullVault, pushVault, restoreVault, vaultGitStatus, vaultHistory } from '../../application/vault-git.js';
|
|
2
2
|
import { provisionVaultRepo } from '../../application/provision-vault.js';
|
|
3
3
|
import { exportVaultSnapshot, importVaultSnapshot } from '../../application/vault-snapshot.js';
|
|
4
|
+
import { exportVaultsBundle, importVaultsBundle, listBundleVaults } from '../../application/vault-bundle.js';
|
|
5
|
+
import { getKnownVaults } from '../../infrastructure/config.js';
|
|
4
6
|
import { print, resolveOptions } from '../runtime.js';
|
|
5
7
|
export const registerVaultSyncCommands = (program) => {
|
|
6
8
|
program
|
|
@@ -113,25 +115,48 @@ export const registerVaultSyncCommands = (program) => {
|
|
|
113
115
|
});
|
|
114
116
|
program
|
|
115
117
|
.command('vault-export')
|
|
116
|
-
.
|
|
118
|
+
.option('-o, --output <file>', 'output file (.blvault for one vault, .blbundle with --all)')
|
|
117
119
|
.option('--vault <vault>', 'vault directory')
|
|
120
|
+
.option('--all', 'export every known vault (config vault + allowedVaults) into a single .blbundle')
|
|
118
121
|
.option('--json', 'print machine-readable JSON')
|
|
119
|
-
.description('export
|
|
122
|
+
.description('export vault Markdown to a portable snapshot: one vault (.blvault) or all vaults (--all, .blbundle)')
|
|
120
123
|
.action(async (options) => {
|
|
121
|
-
const { vault } = await resolveOptions(options);
|
|
124
|
+
const { config, vault } = await resolveOptions(options);
|
|
125
|
+
if (options.all) {
|
|
126
|
+
const vaults = getKnownVaults(config);
|
|
127
|
+
const result = await exportVaultsBundle(vaults, options.output ?? 'vaults.blbundle');
|
|
128
|
+
print(options.json, result, () => `Exported ${result.vaultCount} vaults (${result.fileCount} files) to ${result.file} (${result.bytes} bytes).`);
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
122
131
|
const result = await exportVaultSnapshot(vault, options.output ?? 'vault.blvault');
|
|
123
132
|
print(options.json, result, () => `Exported ${result.fileCount} files to ${result.file} (${result.bytes} bytes).`);
|
|
124
133
|
});
|
|
125
134
|
program
|
|
126
135
|
.command('vault-import')
|
|
127
|
-
.argument('<file>', 'input .blvault
|
|
128
|
-
.option('--vault <vault>', 'vault directory')
|
|
136
|
+
.argument('<file>', 'input .blvault snapshot or .blbundle')
|
|
137
|
+
.option('--vault <vault>', 'target vault directory (single snapshot, or the target for --only)')
|
|
138
|
+
.option('--only <vault>', 'when importing a bundle, restore only this vault (by name or recorded path)')
|
|
129
139
|
.option('--no-index', 'skip reindexing after import')
|
|
130
140
|
.option('--json', 'print machine-readable JSON')
|
|
131
|
-
.description('import a .blvault snapshot into
|
|
141
|
+
.description('import a .blvault snapshot into a vault, or a .blbundle (all vaults, or one via --only)')
|
|
132
142
|
.action(async (file, options) => {
|
|
143
|
+
const skipIndex = options.index === false;
|
|
144
|
+
// Auto-detect a bundle so a single command handles both formats. --only is
|
|
145
|
+
// bundle-only, so it forces the bundle path.
|
|
146
|
+
const bundleEntries = await listBundleVaults(file).catch(() => null);
|
|
147
|
+
if (bundleEntries !== null || options.only !== undefined) {
|
|
148
|
+
const result = await importVaultsBundle(file, {
|
|
149
|
+
only: options.only,
|
|
150
|
+
targetVault: options.only !== undefined ? options.vault : undefined,
|
|
151
|
+
skipIndex
|
|
152
|
+
});
|
|
153
|
+
print(options.json, result, () => result.vaults
|
|
154
|
+
.map((entry) => `${entry.name} → ${entry.vault}: imported ${entry.imported} (${entry.conflicted} conflicts)`)
|
|
155
|
+
.join('\n'));
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
133
158
|
const { vault } = await resolveOptions(options);
|
|
134
|
-
const result = await importVaultSnapshot(file, vault, { skipIndex
|
|
159
|
+
const result = await importVaultSnapshot(file, vault, { skipIndex });
|
|
135
160
|
print(options.json, result, () => `Imported ${result.imported} files (${result.conflicted} conflicts)${result.index ? `; reindexed ${result.index.documentCount} docs` : ''}.`);
|
|
136
161
|
});
|
|
137
162
|
};
|
|
@@ -248,6 +248,19 @@ const sanitizeConfig = (value) => ({
|
|
|
248
248
|
defaultSearchMode: sanitizeSearchMode(value.defaultSearchMode),
|
|
249
249
|
agentProfiles: sanitizeAgentProfiles(value.agentProfiles)
|
|
250
250
|
});
|
|
251
|
+
export const getKnownVaults = (config) => {
|
|
252
|
+
const seen = new Set();
|
|
253
|
+
const vaults = [];
|
|
254
|
+
for (const vault of [config.vault, ...config.allowedVaults]) {
|
|
255
|
+
const trimmed = vault.trim();
|
|
256
|
+
if (trimmed.length === 0 || seen.has(trimmed)) {
|
|
257
|
+
continue;
|
|
258
|
+
}
|
|
259
|
+
seen.add(trimmed);
|
|
260
|
+
vaults.push(trimmed);
|
|
261
|
+
}
|
|
262
|
+
return vaults;
|
|
263
|
+
};
|
|
251
264
|
export const resolveAgentRuntimeDefaults = (config, agent) => {
|
|
252
265
|
const normalizedAgent = agent?.trim().length ? sanitizeAgentId(agent) : undefined;
|
|
253
266
|
const profile = (normalizedAgent ? config.agentProfiles[normalizedAgent] : undefined) ?? config.agentProfiles['*'];
|
package/dist/mcp/server.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
-
import { addNoteInputSchema, addFileInputSchema, addFileTool, addNoteTool, addNotesInputSchema, addNotesTool, deleteNoteInputSchema, deleteNoteTool, deleteNotesInputSchema, deleteNotesTool, volatileAddInputSchema, volatileAddTool, volatileClearInputSchema, volatileClearTool, dedupeInputSchema, dedupeResolveInputSchema, dedupeResolveTool, dedupeTool, brokenLinksInputSchema, brokenLinksTool, bootstrapInputSchema, bootstrapTool, canonicalizeContextLinksInputSchema, canonicalizeContextLinksTool, contextInputSchema, contextPacksInputSchema, contextPacksTool, contextTool, doctorActionsInputSchema, doctorActionsTool, graphContextsInputSchema, graphContextsTool, graphInputSchema, graphTool, explainInputSchema, explainTool, indexInputSchema, indexTool, inboxAddInputSchema, inboxAddTool, inboxListInputSchema, inboxListTool, inboxProcessInputSchema, inboxProcessTool, orphansInputSchema, orphansTool, policyInputSchema, policyTool, projectInitInputSchema, projectInitTool, recommendationsInputSchema, recommendationsTool, rememberInputSchema, rememberTool, repairLinksInputSchema, repairLinksTool, searchInputSchema, searchTool, similarNotesInputSchema, similarNotesTool, sessionCloseInputSchema, sessionCloseTool, statsInputSchema, statsTool, suggestLinksInputSchema, suggestLinksTool, syncInputSchema, syncTool, validateInputSchema, validateTool, vaultCommitInputSchema, vaultCommitTool, vaultExportInputSchema, vaultExportTool, vaultHistoryInputSchema, vaultHistoryTool, vaultImportInputSchema, vaultImportTool, vaultInitInputSchema, vaultInitTool, vaultMergeAgentsInputSchema, vaultMergeAgentsTool, vaultProvisionInputSchema, vaultProvisionTool, vaultPullInputSchema, vaultPullTool, vaultRestoreInputSchema, vaultRestoreTool, vaultStatusInputSchema, vaultStatusTool, versionInputSchema, versionTool } from './tools.js';
|
|
2
|
+
import { addNoteInputSchema, addFileInputSchema, addFileTool, addNoteTool, addNotesInputSchema, addNotesTool, deleteNoteInputSchema, deleteNoteTool, deleteNotesInputSchema, deleteNotesTool, volatileAddInputSchema, volatileAddTool, volatileClearInputSchema, volatileClearTool, dedupeInputSchema, dedupeResolveInputSchema, dedupeResolveTool, dedupeTool, brokenLinksInputSchema, brokenLinksTool, bootstrapInputSchema, bootstrapTool, canonicalizeContextLinksInputSchema, canonicalizeContextLinksTool, contextInputSchema, contextPacksInputSchema, contextPacksTool, contextTool, doctorActionsInputSchema, doctorActionsTool, graphContextsInputSchema, graphContextsTool, graphInputSchema, graphTool, explainInputSchema, explainTool, indexInputSchema, indexTool, inboxAddInputSchema, inboxAddTool, inboxListInputSchema, inboxListTool, inboxProcessInputSchema, inboxProcessTool, orphansInputSchema, orphansTool, policyInputSchema, policyTool, projectInitInputSchema, projectInitTool, recommendationsInputSchema, recommendationsTool, rememberInputSchema, rememberTool, repairLinksInputSchema, repairLinksTool, searchInputSchema, searchTool, similarNotesInputSchema, similarNotesTool, sessionCloseInputSchema, sessionCloseTool, statsInputSchema, statsTool, suggestLinksInputSchema, suggestLinksTool, syncInputSchema, syncTool, validateInputSchema, validateTool, vaultBundleListInputSchema, vaultBundleListTool, vaultCommitInputSchema, vaultCommitTool, vaultExportBundleInputSchema, vaultExportBundleTool, vaultExportInputSchema, vaultExportTool, vaultHistoryInputSchema, vaultHistoryTool, vaultImportBundleInputSchema, vaultImportBundleTool, vaultImportInputSchema, vaultImportTool, vaultInitInputSchema, vaultInitTool, vaultMergeAgentsInputSchema, vaultMergeAgentsTool, vaultProvisionInputSchema, vaultProvisionTool, vaultPullInputSchema, vaultPullTool, vaultRestoreInputSchema, vaultRestoreTool, vaultStatusInputSchema, vaultStatusTool, versionInputSchema, versionTool } from './tools.js';
|
|
3
3
|
import { getRuntimeVersion } from './runtime.js';
|
|
4
4
|
import { brainlinkServerInstructions } from './server-instructions.js';
|
|
5
5
|
import { guardToolHandler } from './tool-guard.js';
|
|
@@ -206,6 +206,21 @@ export const createBrainlinkMcpServer = () => {
|
|
|
206
206
|
description: 'Import a .blvault snapshot into the vault and reindex. Checksums are verified; divergent local files are preserved as *.conflict-<ts>.md instead of being overwritten.',
|
|
207
207
|
inputSchema: vaultImportInputSchema
|
|
208
208
|
}, vaultImportTool);
|
|
209
|
+
server.registerTool('brainlink_vault_export_bundle', {
|
|
210
|
+
title: 'Export All Vaults (bundle)',
|
|
211
|
+
description: 'Write a portable .blbundle containing every known vault (config vault + allowedVaults). Each vault is a gzip-free snapshot envelope inside one gzipped bundle; the derived index is not included.',
|
|
212
|
+
inputSchema: vaultExportBundleInputSchema
|
|
213
|
+
}, vaultExportBundleTool);
|
|
214
|
+
server.registerTool('brainlink_vault_bundle_list', {
|
|
215
|
+
title: 'List Vaults in a Bundle',
|
|
216
|
+
description: 'Inspect a .blbundle and list the vaults it contains (name, recorded path, file count) without importing anything.',
|
|
217
|
+
inputSchema: vaultBundleListInputSchema
|
|
218
|
+
}, vaultBundleListTool);
|
|
219
|
+
server.registerTool('brainlink_vault_import_bundle', {
|
|
220
|
+
title: 'Import Vaults from a Bundle',
|
|
221
|
+
description: 'Import a .blbundle: restore every vault to its recorded path, or a single one via "only" (optionally into "targetVault"). Checksums are verified; divergent local files are preserved as *.conflict-<ts>.md.',
|
|
222
|
+
inputSchema: vaultImportBundleInputSchema
|
|
223
|
+
}, vaultImportBundleTool);
|
|
209
224
|
server.registerTool('brainlink_graph', {
|
|
210
225
|
title: 'Read Brainlink Graph',
|
|
211
226
|
description: 'Read indexed graph nodes and wiki-link edges. Edges include weight and priority fields so agents can rank importance and priority.',
|
|
@@ -2,7 +2,9 @@ import { z } from 'zod';
|
|
|
2
2
|
import { commitVault, initVaultGit, pullVault, pushVault, restoreVault, vaultGitStatus, vaultHistory } from '../../application/vault-git.js';
|
|
3
3
|
import { provisionVaultRepo } from '../../application/provision-vault.js';
|
|
4
4
|
import { exportVaultSnapshot, importVaultSnapshot } from '../../application/vault-snapshot.js';
|
|
5
|
+
import { exportVaultsBundle, importVaultsBundle, listBundleVaults } from '../../application/vault-bundle.js';
|
|
5
6
|
import { mergeAgentNamespace } from '../../application/merge-agent-namespace.js';
|
|
7
|
+
import { getKnownVaults, loadBrainlinkConfig } from '../../infrastructure/config.js';
|
|
6
8
|
import { jsonResult, optionalPositiveInteger, resolveExecutionContext, vaultInput } from './shared.js';
|
|
7
9
|
export const vaultStatusInputSchema = { ...vaultInput };
|
|
8
10
|
export const vaultInitInputSchema = {
|
|
@@ -38,6 +40,19 @@ export const vaultImportInputSchema = {
|
|
|
38
40
|
snapshotFile: z.string().min(1).describe('Path to a .blvault snapshot to import. Divergent local files are preserved as *.conflict-<ts>.md.'),
|
|
39
41
|
skipIndex: z.boolean().optional().default(false).describe('Skip the automatic reindex after importing Markdown.')
|
|
40
42
|
};
|
|
43
|
+
export const vaultExportBundleInputSchema = {
|
|
44
|
+
...vaultInput,
|
|
45
|
+
outputFile: z.string().min(1).describe('Path to write the portable .blbundle to (contains every known vault).')
|
|
46
|
+
};
|
|
47
|
+
export const vaultBundleListInputSchema = {
|
|
48
|
+
bundleFile: z.string().min(1).describe('Path to a .blbundle to inspect.')
|
|
49
|
+
};
|
|
50
|
+
export const vaultImportBundleInputSchema = {
|
|
51
|
+
bundleFile: z.string().min(1).describe('Path to a .blbundle to import. Divergent local files are preserved as *.conflict-<ts>.md.'),
|
|
52
|
+
only: z.string().min(1).optional().describe('Restore only this vault from the bundle (by name or recorded path). Omit to restore every vault.'),
|
|
53
|
+
targetVault: z.string().min(1).optional().describe('Target directory for the restored vault (only valid with "only"). Defaults to the recorded path.'),
|
|
54
|
+
skipIndex: z.boolean().optional().default(false).describe('Skip the automatic reindex after importing Markdown.')
|
|
55
|
+
};
|
|
41
56
|
export const vaultProvisionInputSchema = {
|
|
42
57
|
...vaultInput,
|
|
43
58
|
name: z.string().min(1).optional().describe('Repository name to create. Defaults to brainlink-vault.'),
|
|
@@ -163,6 +178,38 @@ export const vaultImportTool = async (input) => {
|
|
|
163
178
|
return failure(context.vault, error);
|
|
164
179
|
}
|
|
165
180
|
};
|
|
181
|
+
export const vaultExportBundleTool = async (input) => {
|
|
182
|
+
const context = await resolveExecutionContext(input);
|
|
183
|
+
try {
|
|
184
|
+
const config = await loadBrainlinkConfig();
|
|
185
|
+
const result = await exportVaultsBundle(getKnownVaults(config), input.outputFile);
|
|
186
|
+
return jsonResult({ ok: true, ...result });
|
|
187
|
+
}
|
|
188
|
+
catch (error) {
|
|
189
|
+
return failure(context.vault, error);
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
export const vaultBundleListTool = async (input) => {
|
|
193
|
+
try {
|
|
194
|
+
return jsonResult({ ok: true, bundleFile: input.bundleFile, vaults: await listBundleVaults(input.bundleFile) });
|
|
195
|
+
}
|
|
196
|
+
catch (error) {
|
|
197
|
+
return jsonResult({ ok: false, bundleFile: input.bundleFile, error: error instanceof Error ? error.message : String(error) });
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
export const vaultImportBundleTool = async (input) => {
|
|
201
|
+
try {
|
|
202
|
+
const result = await importVaultsBundle(input.bundleFile, {
|
|
203
|
+
only: input.only,
|
|
204
|
+
targetVault: input.targetVault,
|
|
205
|
+
skipIndex: input.skipIndex === true
|
|
206
|
+
});
|
|
207
|
+
return jsonResult({ ok: true, ...result });
|
|
208
|
+
}
|
|
209
|
+
catch (error) {
|
|
210
|
+
return jsonResult({ ok: false, bundleFile: input.bundleFile, error: error instanceof Error ? error.message : String(error) });
|
|
211
|
+
}
|
|
212
|
+
};
|
|
166
213
|
export const vaultMergeAgentsTool = async (input) => {
|
|
167
214
|
const context = await resolveExecutionContext(input);
|
|
168
215
|
try {
|
package/dist/mcp/tools.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { brokenLinksInputSchema, brokenLinksTool, contextInputSchema, contextPacksInputSchema, contextPacksTool, contextTool, doctorActionsInputSchema, doctorActionsTool, explainInputSchema, explainTool, graphContextsInputSchema, graphContextsTool, graphInputSchema, graphTool, orphansInputSchema, orphansTool, recommendationsInputSchema, recommendationsTool, searchInputSchema, searchTool, similarNotesInputSchema, similarNotesTool, statsInputSchema, statsTool, suggestLinksInputSchema, suggestLinksTool, validateInputSchema, validateTool, versionInputSchema, versionTool } from './tools/read-tools.js';
|
|
2
2
|
export { addFileInputSchema, addFileTool, addNoteInputSchema, addNoteTool, addNotesInputSchema, addNotesTool, deleteNoteInputSchema, deleteNoteTool, deleteNotesInputSchema, deleteNotesTool, inboxAddInputSchema, inboxAddTool, inboxListInputSchema, inboxListTool, inboxProcessInputSchema, inboxProcessTool, rememberInputSchema, rememberTool, volatileAddInputSchema, volatileAddTool, volatileClearInputSchema, volatileClearTool } from './tools/write-tools.js';
|
|
3
3
|
export { bootstrapInputSchema, bootstrapTool, canonicalizeContextLinksInputSchema, canonicalizeContextLinksTool, dedupeInputSchema, dedupeResolveInputSchema, dedupeResolveTool, dedupeTool, indexInputSchema, indexTool, policyInputSchema, policyTool, projectInitInputSchema, projectInitTool, repairLinksInputSchema, repairLinksTool, sessionCloseInputSchema, sessionCloseTool, syncInputSchema, syncTool } from './tools/maintenance-tools.js';
|
|
4
|
-
export { vaultCommitInputSchema, vaultCommitTool, vaultExportInputSchema, vaultExportTool, vaultHistoryInputSchema, vaultHistoryTool, vaultImportInputSchema, vaultImportTool, vaultInitInputSchema, vaultInitTool, vaultMergeAgentsInputSchema, vaultMergeAgentsTool, vaultProvisionInputSchema, vaultProvisionTool, vaultPullInputSchema, vaultPullTool, vaultRestoreInputSchema, vaultRestoreTool, vaultStatusInputSchema, vaultStatusTool } from './tools/vault-tools.js';
|
|
4
|
+
export { vaultBundleListInputSchema, vaultBundleListTool, vaultCommitInputSchema, vaultCommitTool, vaultExportBundleInputSchema, vaultExportBundleTool, vaultExportInputSchema, vaultExportTool, vaultHistoryInputSchema, vaultHistoryTool, vaultImportBundleInputSchema, vaultImportBundleTool, vaultImportInputSchema, vaultImportTool, vaultInitInputSchema, vaultInitTool, vaultMergeAgentsInputSchema, vaultMergeAgentsTool, vaultProvisionInputSchema, vaultProvisionTool, vaultPullInputSchema, vaultPullTool, vaultRestoreInputSchema, vaultRestoreTool, vaultStatusInputSchema, vaultStatusTool } from './tools/vault-tools.js';
|
package/package.json
CHANGED