@tapedock/mcp 0.1.2 → 0.1.3
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/api/client.d.ts +2 -0
- package/dist/downloads/manager.js +80 -1
- package/package.json +1 -1
- package/server.json +2 -2
package/dist/api/client.d.ts
CHANGED
|
@@ -17,6 +17,43 @@ const PROGRESS_THROTTLE_MS = 1500;
|
|
|
17
17
|
const MAX_STORED_JOBS = 50;
|
|
18
18
|
const SESSION_OTIO_FILENAME = "session.otio";
|
|
19
19
|
const RESOLVE_OTIO_FILENAME = "session.resolve.otio";
|
|
20
|
+
const DOWNLOAD_RECEIPT_FILENAME = ".tapedock-download.json";
|
|
21
|
+
async function readDownloadReceipt(targetDir) {
|
|
22
|
+
try {
|
|
23
|
+
const raw = await fs.readFile(path.join(targetDir, DOWNLOAD_RECEIPT_FILENAME), "utf8");
|
|
24
|
+
const parsed = JSON.parse(raw);
|
|
25
|
+
if (parsed && parsed.version === 1 && parsed.files && typeof parsed.files === "object") {
|
|
26
|
+
return parsed;
|
|
27
|
+
}
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
async function writeDownloadReceipt(targetDir, sessionId, entries) {
|
|
35
|
+
if (entries.size === 0)
|
|
36
|
+
return;
|
|
37
|
+
const existing = await readDownloadReceipt(targetDir);
|
|
38
|
+
const merged = { ...(existing?.files ?? {}) };
|
|
39
|
+
for (const [name, entry] of entries) {
|
|
40
|
+
merged[name] = entry;
|
|
41
|
+
}
|
|
42
|
+
const payload = {
|
|
43
|
+
version: 1,
|
|
44
|
+
sessionId,
|
|
45
|
+
files: merged,
|
|
46
|
+
};
|
|
47
|
+
const receiptPath = path.join(targetDir, DOWNLOAD_RECEIPT_FILENAME);
|
|
48
|
+
const tmpPath = `${receiptPath}.${randomBytes(4).toString("hex")}.tmp`;
|
|
49
|
+
try {
|
|
50
|
+
await fs.writeFile(tmpPath, `${JSON.stringify(payload, null, 2)}\n`, { mode: 0o644 });
|
|
51
|
+
await fs.rename(tmpPath, receiptPath);
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
await fs.unlink(tmpPath).catch(() => { });
|
|
55
|
+
}
|
|
56
|
+
}
|
|
20
57
|
export function resolveDefaultDownloadDir() {
|
|
21
58
|
const fromEnv = process.env.TAPEDOCK_DOWNLOAD_DIR?.trim() || process.env.VCR_DOWNLOAD_DIR?.trim();
|
|
22
59
|
if (fromEnv)
|
|
@@ -160,20 +197,43 @@ export class DownloadManager {
|
|
|
160
197
|
? path.join(baseDir, buildSessionFolderName(session))
|
|
161
198
|
: baseDir;
|
|
162
199
|
const overwrite = Boolean(input.overwrite);
|
|
200
|
+
const receipt = overwrite ? null : await readDownloadReceipt(targetDir);
|
|
201
|
+
const currentJobId = detail.syncReport?.jobId ?? detail.jobs[0]?.id ?? undefined;
|
|
163
202
|
const fileStates = [];
|
|
164
203
|
const urlByName = new Map();
|
|
204
|
+
const metaByName = new Map();
|
|
165
205
|
let totalBytes = 0;
|
|
166
206
|
let remainingBytes = 0;
|
|
167
207
|
for (const file of matchingFiles) {
|
|
168
208
|
const localPath = assertSafeExportPath(targetDir, file.name);
|
|
169
209
|
urlByName.set(file.name, file.downloadUrl);
|
|
210
|
+
if (file.etag || currentJobId) {
|
|
211
|
+
metaByName.set(file.name, {
|
|
212
|
+
...(file.etag ? { etag: file.etag } : {}),
|
|
213
|
+
...(currentJobId ? { jobId: currentJobId } : {}),
|
|
214
|
+
});
|
|
215
|
+
}
|
|
170
216
|
totalBytes += file.byteSize;
|
|
171
217
|
let alreadyComplete = false;
|
|
172
218
|
if (!overwrite) {
|
|
173
219
|
try {
|
|
174
220
|
const stat = await fs.stat(localPath);
|
|
175
221
|
if (stat.isFile() && stat.size === file.byteSize) {
|
|
176
|
-
|
|
222
|
+
const recorded = receipt?.files[file.name];
|
|
223
|
+
let remoteIsNewer = false;
|
|
224
|
+
if (file.etag) {
|
|
225
|
+
if (recorded?.etag) {
|
|
226
|
+
remoteIsNewer = recorded.etag !== file.etag;
|
|
227
|
+
}
|
|
228
|
+
else if (typeof file.uploadedAtMs === "number" &&
|
|
229
|
+
file.uploadedAtMs > stat.mtimeMs + 1000) {
|
|
230
|
+
remoteIsNewer = true;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
else if (currentJobId && recorded?.jobId && recorded.jobId !== currentJobId) {
|
|
234
|
+
remoteIsNewer = true;
|
|
235
|
+
}
|
|
236
|
+
alreadyComplete = !remoteIsNewer;
|
|
177
237
|
}
|
|
178
238
|
}
|
|
179
239
|
catch {
|
|
@@ -246,6 +306,7 @@ export class DownloadManager {
|
|
|
246
306
|
this.pruneOldJobs();
|
|
247
307
|
const runPromise = this.executeJob(job, {
|
|
248
308
|
urlByName,
|
|
309
|
+
metaByName,
|
|
249
310
|
urlsFetchedAtMs: now,
|
|
250
311
|
overwrite,
|
|
251
312
|
signal: resolvedMode === "foreground" ? runtimeOpts?.signal : undefined,
|
|
@@ -387,6 +448,24 @@ export class DownloadManager {
|
|
|
387
448
|
}
|
|
388
449
|
}
|
|
389
450
|
finally {
|
|
451
|
+
const receiptEntries = new Map();
|
|
452
|
+
const recordedAt = Date.now();
|
|
453
|
+
for (const file of job.files) {
|
|
454
|
+
if (file.status !== "completed" && file.status !== "skipped")
|
|
455
|
+
continue;
|
|
456
|
+
const meta = ctx.metaByName.get(file.name);
|
|
457
|
+
if (!meta)
|
|
458
|
+
continue;
|
|
459
|
+
receiptEntries.set(file.name, {
|
|
460
|
+
byteSize: file.byteSize,
|
|
461
|
+
...(meta.etag ? { etag: meta.etag } : {}),
|
|
462
|
+
...(meta.jobId ? { jobId: meta.jobId } : {}),
|
|
463
|
+
downloadedAtMs: recordedAt,
|
|
464
|
+
});
|
|
465
|
+
}
|
|
466
|
+
if (receiptEntries.size > 0) {
|
|
467
|
+
await writeDownloadReceipt(job.targetDir, job.sessionId, receiptEntries);
|
|
468
|
+
}
|
|
390
469
|
ctx.signal?.removeEventListener("abort", onParentAbort);
|
|
391
470
|
}
|
|
392
471
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tapedock/mcp",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Official TapeDock MCP server — plan remote video interviews, mint guest invites, drop timeline markers, and stream resumable multi-GB synced exports.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"license": "MIT",
|
package/server.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"url": "https://git.audrow.com/audrow/video-call-recorder",
|
|
7
7
|
"source": "git"
|
|
8
8
|
},
|
|
9
|
-
"version": "0.1.
|
|
9
|
+
"version": "0.1.3",
|
|
10
10
|
"websiteUrl": "https://tapedock.com/docs/mcp",
|
|
11
11
|
"remotes": [
|
|
12
12
|
{
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
{
|
|
19
19
|
"registryType": "npm",
|
|
20
20
|
"identifier": "@tapedock/mcp",
|
|
21
|
-
"version": "0.1.
|
|
21
|
+
"version": "0.1.3",
|
|
22
22
|
"transport": {
|
|
23
23
|
"type": "stdio"
|
|
24
24
|
},
|