mcp-memory-bucket 0.12.5 → 0.12.6

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.
@@ -255,6 +255,9 @@ export function joinRemoteFolderPath(remoteFolderPath, mirrorRelativeDir) {
255
255
  export async function readFile(server, baseDir, tenantId, folderPath, name, owner) {
256
256
  return withAuth(server, baseDir, (jwt) => fetch(`${server}/data/${filenameParam(folderPath, name, owner)}`, { headers: { authorization: `Bearer ${jwt}`, 'x-tenant-id': tenantId } }), (res) => res.text());
257
257
  }
258
+ export async function readBinaryFile(server, baseDir, tenantId, folderPath, name, owner) {
259
+ return withAuth(server, baseDir, (jwt) => fetch(`${server}/data/${filenameParam(folderPath, name, owner)}`, { headers: { authorization: `Bearer ${jwt}`, 'x-tenant-id': tenantId } }), async (res) => Buffer.from(await res.arrayBuffer()));
260
+ }
258
261
  /**
259
262
  * Writes one file's raw content via POST /save/:filename. `owner`, when passed, writes into
260
263
  * someone ELSE's directory via a direct-username share (see filenameParam's own comment) — this is
@@ -1,7 +1,7 @@
1
1
  import fs from 'node:fs';
2
2
  import path from 'node:path';
3
3
  import { upsertFile, removeFile, walkMarkdownFiles, walkAttachmentFiles, walkSkillSiblingFiles } from '../store/sync.js';
4
- import { getLastChanged, getChangedSince, readFile, FolderfooAuthError } from './folderfoo-client.js';
4
+ import { getLastChanged, getChangedSince, readFile, readBinaryFile, FolderfooAuthError } from './folderfoo-client.js';
5
5
  import { isUnderAttachmentsDir } from '../attachments/storage.js';
6
6
  // Fixed for every remote source in v1 - no per-source tuning knob, per the
7
7
  // settled design (Q15 in the grilling session).
@@ -194,7 +194,6 @@ async function pullFile(db, spec, folder, credentialsBaseDir, changedFile) {
194
194
  // correct value to pass straight through to readFile (folderfoo expects
195
195
  // that same absolute form for GET /data/:filename), but it must be
196
196
  // converted to mirror-relative before joining onto folder.mirrorDir.
197
- const content = await readFile(folder.server, credentialsBaseDir, folder.tenantId, changedFile.folderPath, changedFile.name, folder.owner);
198
197
  const mirrorRelativeDir = toMirrorRelativeDir(folder.folderPath, changedFile.folderPath);
199
198
  // spec.remoteFilename.toLocal exists to translate a DOC's own remote name (a skill's fixed
200
199
  // "SKILL" -> "SKILL.md", or a memory doc's legacy extensionless remote name -> "<name>.md") - it
@@ -205,6 +204,7 @@ async function pullFile(db, spec, folder, credentialsBaseDir, changedFile) {
205
204
  // comparison then saw as absent remotely and deleted on the very same poll - so a directory/file
206
205
  // attachment synced down to a second machine, then vanished before its resync even finished.
207
206
  const isAttachment = isUnderAttachmentsDir(mirrorRelativeDir);
207
+ const content = await (isAttachment ? readBinaryFile : readFile)(folder.server, credentialsBaseDir, folder.tenantId, changedFile.folderPath, changedFile.name, folder.owner);
208
208
  const localFilename = isAttachment ? changedFile.name : spec.remoteFilename.toLocal(changedFile.name);
209
209
  const relPath = mirrorRelativeDir ? path.join(mirrorRelativeDir, localFilename) : localFilename;
210
210
  const mirrorPath = path.join(folder.mirrorDir, relPath);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-memory-bucket",
3
- "version": "0.12.5",
3
+ "version": "0.12.6",
4
4
  "type": "module",
5
5
  "description": "MCP server exposing skill_* (reusable coding patterns) and memory_* (point-in-time working context) tools over a markdown+frontmatter source, cached into SQLite at runtime.",
6
6
  "repository": {