obsidian-sync-mcp 0.12.0 → 0.12.1
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/main.js
CHANGED
|
@@ -1863,7 +1863,7 @@ if (VAULT_PATH) {
|
|
|
1863
1863
|
console.error("COUCHDB_PASSWORD is required in remote mode.");
|
|
1864
1864
|
process.exit(1);
|
|
1865
1865
|
}
|
|
1866
|
-
const { Vault } = await import("./vault-
|
|
1866
|
+
const { Vault } = await import("./vault-AV7JZZT2.js");
|
|
1867
1867
|
let pathNormalization;
|
|
1868
1868
|
try {
|
|
1869
1869
|
pathNormalization = parsePathNormalization(COUCHDB_PATH_NORMALIZATION);
|
|
@@ -2081,7 +2081,7 @@ var ATTACHMENT_INSTRUCTIONS = ATTACHMENTS_ENABLED ? " Images, PDFs, audio and vi
|
|
|
2081
2081
|
var BASE_INSTRUCTIONS = "Access and manage an Obsidian vault. You can read, write, list, search, move, and delete markdown notes." + ATTACHMENT_INSTRUCTIONS + " Every tool response includes an Obsidian deep link. Always show this link to the user using the format [obsidian://open?vault=...&file=...](obsidian://open?vault=...&file=...) so it is both clickable and visible as a URL.";
|
|
2082
2082
|
var serverOptions = {
|
|
2083
2083
|
name: "obsidian-sync-mcp",
|
|
2084
|
-
version: "0.12.
|
|
2084
|
+
version: "0.12.1",
|
|
2085
2085
|
instructions: MCP_EXTRA_INSTRUCTIONS ? `${BASE_INSTRUCTIONS}
|
|
2086
2086
|
|
|
2087
2087
|
${MCP_EXTRA_INSTRUCTIONS}` : BASE_INSTRUCTIONS
|
|
@@ -2179,7 +2179,7 @@ server.start({
|
|
|
2179
2179
|
transportType: "httpStream",
|
|
2180
2180
|
httpStream: { port: PORT, endpoint: "/mcp", host: process.env.HOST ?? "0.0.0.0" }
|
|
2181
2181
|
});
|
|
2182
|
-
console.log(`obsidian-sync-mcp v${"0.12.
|
|
2182
|
+
console.log(`obsidian-sync-mcp v${"0.12.1"} listening on port ${PORT}`);
|
|
2183
2183
|
process.on("unhandledRejection", (err) => {
|
|
2184
2184
|
console.error(`Unhandled rejection: ${describeError(err, debugLogging2)}`);
|
|
2185
2185
|
});
|
|
@@ -13279,10 +13279,16 @@ function idDerivationOptions(obfuscatePaths, idDerivationKey) {
|
|
|
13279
13279
|
}
|
|
13280
13280
|
|
|
13281
13281
|
// src/id-format.ts
|
|
13282
|
+
var ID_SAMPLE_TARGET = 100;
|
|
13283
|
+
var NAMESPACE_PREFIXES = ["i:", "ix:", "ps:"];
|
|
13284
|
+
function isNamespacedId(id) {
|
|
13285
|
+
return NAMESPACE_PREFIXES.some((p) => id.startsWith(p));
|
|
13286
|
+
}
|
|
13282
13287
|
function classifyIds(ids) {
|
|
13283
13288
|
let obfuscated = 0;
|
|
13284
13289
|
let plain = 0;
|
|
13285
13290
|
for (const id of ids) {
|
|
13291
|
+
if (isNamespacedId(id)) continue;
|
|
13286
13292
|
if (id.startsWith("f:")) obfuscated++;
|
|
13287
13293
|
else plain++;
|
|
13288
13294
|
}
|
|
@@ -13448,7 +13454,7 @@ var Vault = class _Vault {
|
|
|
13448
13454
|
*/
|
|
13449
13455
|
async reconcileObfuscation() {
|
|
13450
13456
|
const configured = !!this.config.obfuscatePaths;
|
|
13451
|
-
const format = await this.
|
|
13457
|
+
const format = classifyIds(await this.sampleNoteIds());
|
|
13452
13458
|
if (format === "empty") return;
|
|
13453
13459
|
if (format === "mixed") {
|
|
13454
13460
|
console.warn(
|
|
@@ -13471,14 +13477,17 @@ var Vault = class _Vault {
|
|
|
13471
13477
|
this.manipulator = new DirectFileManipulator(this.options(actual));
|
|
13472
13478
|
await this.awaitManipulatorReady();
|
|
13473
13479
|
}
|
|
13474
|
-
/**
|
|
13475
|
-
|
|
13476
|
-
|
|
13480
|
+
/**
|
|
13481
|
+
* Sample note-document IDs from the changes feed, oldest first. Namespaced
|
|
13482
|
+
* file documents (`i:`, `ix:`, `ps:`) are skipped: their prefix hides the ID
|
|
13483
|
+
* format (#62).
|
|
13484
|
+
*/
|
|
13485
|
+
async sampleNoteIds() {
|
|
13477
13486
|
const BATCH_SIZE2 = 100;
|
|
13478
13487
|
const db = this.manipulator.liveSyncLocalDB.localDatabase;
|
|
13479
13488
|
const ids = [];
|
|
13480
13489
|
let since = 0;
|
|
13481
|
-
while (ids.length <
|
|
13490
|
+
while (ids.length < ID_SAMPLE_TARGET) {
|
|
13482
13491
|
const result = await db.changes({
|
|
13483
13492
|
since,
|
|
13484
13493
|
limit: BATCH_SIZE2,
|
|
@@ -13487,13 +13496,13 @@ var Vault = class _Vault {
|
|
|
13487
13496
|
live: false
|
|
13488
13497
|
});
|
|
13489
13498
|
for (const change of result.results) {
|
|
13490
|
-
if (ids.length >=
|
|
13491
|
-
ids.push(change.id);
|
|
13499
|
+
if (ids.length >= ID_SAMPLE_TARGET) break;
|
|
13500
|
+
if (!isNamespacedId(change.id)) ids.push(change.id);
|
|
13492
13501
|
}
|
|
13493
13502
|
if (result.results.length < BATCH_SIZE2) break;
|
|
13494
13503
|
since = result.last_seq;
|
|
13495
13504
|
}
|
|
13496
|
-
return
|
|
13505
|
+
return ids;
|
|
13497
13506
|
}
|
|
13498
13507
|
async close() {
|
|
13499
13508
|
await _Vault.closeManipulator(this.manipulator);
|
|
@@ -13755,4 +13764,4 @@ var Vault = class _Vault {
|
|
|
13755
13764
|
export {
|
|
13756
13765
|
Vault
|
|
13757
13766
|
};
|
|
13758
|
-
//# sourceMappingURL=vault-
|
|
13767
|
+
//# sourceMappingURL=vault-AV7JZZT2.js.map
|