@tapedock/mcp 0.1.1 → 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 +14 -0
- package/dist/api/client.js +6 -0
- package/dist/downloads/manager.js +88 -1
- package/dist/server.js +57 -4
- package/package.json +1 -1
- package/server.json +2 -2
package/dist/api/client.d.ts
CHANGED
|
@@ -26,6 +26,10 @@ export interface SessionSummaryRow {
|
|
|
26
26
|
endedAtMs: number | null;
|
|
27
27
|
durationMs: number;
|
|
28
28
|
mediaDeletedAt: number | null;
|
|
29
|
+
archivedAt?: number | null;
|
|
30
|
+
downloadedAt?: number | null;
|
|
31
|
+
expiresAt?: number | null;
|
|
32
|
+
expired?: boolean;
|
|
29
33
|
syncQaPass: boolean | null;
|
|
30
34
|
createdAt?: number;
|
|
31
35
|
}
|
|
@@ -35,6 +39,8 @@ export interface SessionExportFile {
|
|
|
35
39
|
category: "bundle" | "video" | "audio" | "screen";
|
|
36
40
|
downloadUrl: string;
|
|
37
41
|
byteSize: number;
|
|
42
|
+
etag?: string;
|
|
43
|
+
uploadedAtMs?: number;
|
|
38
44
|
}
|
|
39
45
|
export interface SessionDetailResponse {
|
|
40
46
|
session: SessionSummaryRow;
|
|
@@ -189,4 +195,12 @@ export declare class VcrApiClient {
|
|
|
189
195
|
jobId?: string;
|
|
190
196
|
error?: string;
|
|
191
197
|
}>;
|
|
198
|
+
setSessionArchived(sessionId: string, archived: boolean): Promise<{
|
|
199
|
+
ok: boolean;
|
|
200
|
+
archivedAt: number | null;
|
|
201
|
+
}>;
|
|
202
|
+
markSessionDownloaded(sessionId: string): Promise<{
|
|
203
|
+
ok: boolean;
|
|
204
|
+
downloadedAt: number;
|
|
205
|
+
}>;
|
|
192
206
|
}
|
package/dist/api/client.js
CHANGED
|
@@ -149,4 +149,10 @@ export class VcrApiClient {
|
|
|
149
149
|
processSessionNow(sessionId, opts) {
|
|
150
150
|
return this.requestJson(`/api/host/sessions/${enc(sessionId)}/process-now`, { method: "POST", body: opts ?? { forcePartial: true } });
|
|
151
151
|
}
|
|
152
|
+
setSessionArchived(sessionId, archived) {
|
|
153
|
+
return this.requestJson(`/api/host/sessions/${enc(sessionId)}/archive`, { method: "POST", body: { archived } });
|
|
154
|
+
}
|
|
155
|
+
markSessionDownloaded(sessionId) {
|
|
156
|
+
return this.requestJson(`/api/host/sessions/${enc(sessionId)}/downloaded`, { method: "POST" });
|
|
157
|
+
}
|
|
152
158
|
}
|
|
@@ -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)
|
|
@@ -141,6 +178,9 @@ export class DownloadManager {
|
|
|
141
178
|
if (session.mediaDeletedAt) {
|
|
142
179
|
throw new Error(`Media for Session "${session.title}" (${session.id}) has been permanently deleted.`);
|
|
143
180
|
}
|
|
181
|
+
if (session.expired || session.status === "expired") {
|
|
182
|
+
throw new Error(`Exports for Session "${session.title}" (${session.id}) have expired and are no longer available.`);
|
|
183
|
+
}
|
|
144
184
|
if (session.status !== "ready" && session.status !== "ready_partial") {
|
|
145
185
|
throw new Error(`Session "${session.title}" (${session.id}) is currently "${session.status}" and exports are not ready yet.`);
|
|
146
186
|
}
|
|
@@ -157,20 +197,43 @@ export class DownloadManager {
|
|
|
157
197
|
? path.join(baseDir, buildSessionFolderName(session))
|
|
158
198
|
: baseDir;
|
|
159
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;
|
|
160
202
|
const fileStates = [];
|
|
161
203
|
const urlByName = new Map();
|
|
204
|
+
const metaByName = new Map();
|
|
162
205
|
let totalBytes = 0;
|
|
163
206
|
let remainingBytes = 0;
|
|
164
207
|
for (const file of matchingFiles) {
|
|
165
208
|
const localPath = assertSafeExportPath(targetDir, file.name);
|
|
166
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
|
+
}
|
|
167
216
|
totalBytes += file.byteSize;
|
|
168
217
|
let alreadyComplete = false;
|
|
169
218
|
if (!overwrite) {
|
|
170
219
|
try {
|
|
171
220
|
const stat = await fs.stat(localPath);
|
|
172
221
|
if (stat.isFile() && stat.size === file.byteSize) {
|
|
173
|
-
|
|
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;
|
|
174
237
|
}
|
|
175
238
|
}
|
|
176
239
|
catch {
|
|
@@ -243,6 +306,7 @@ export class DownloadManager {
|
|
|
243
306
|
this.pruneOldJobs();
|
|
244
307
|
const runPromise = this.executeJob(job, {
|
|
245
308
|
urlByName,
|
|
309
|
+
metaByName,
|
|
246
310
|
urlsFetchedAtMs: now,
|
|
247
311
|
overwrite,
|
|
248
312
|
signal: resolvedMode === "foreground" ? runtimeOpts?.signal : undefined,
|
|
@@ -365,6 +429,11 @@ export class DownloadManager {
|
|
|
365
429
|
const resolveOtioPath = await writeLocalResolveOtio(job.targetDir);
|
|
366
430
|
if (resolveOtioPath)
|
|
367
431
|
job.resolveOtioPath = resolveOtioPath;
|
|
432
|
+
// Best-effort download acknowledgement so TapeDock suppresses redundant expiry reminders
|
|
433
|
+
// (never fails a completed download, e.g. under read-only OAuth scopes or transient errors).
|
|
434
|
+
if (typeof this.api.markSessionDownloaded === "function") {
|
|
435
|
+
await this.api.markSessionDownloaded(job.sessionId).catch(() => { });
|
|
436
|
+
}
|
|
368
437
|
job.status = "completed";
|
|
369
438
|
job.completedAtMs = Date.now();
|
|
370
439
|
}
|
|
@@ -379,6 +448,24 @@ export class DownloadManager {
|
|
|
379
448
|
}
|
|
380
449
|
}
|
|
381
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
|
+
}
|
|
382
469
|
ctx.signal?.removeEventListener("abort", onParentAbort);
|
|
383
470
|
}
|
|
384
471
|
}
|
package/dist/server.js
CHANGED
|
@@ -581,7 +581,7 @@ export function createVcrMcpServer(deps) {
|
|
|
581
581
|
// 9. list_sessions
|
|
582
582
|
server.registerTool("list_sessions", {
|
|
583
583
|
title: "List Sessions",
|
|
584
|
-
description: "List upcoming planned Sessions and/or recorded Sessions, with optional Room/status filters and Usage Ledger summary.",
|
|
584
|
+
description: "List upcoming planned Sessions and/or recorded Sessions, with optional Room/status filters and Usage Ledger summary. Archived recorded Sessions are hidden by default.",
|
|
585
585
|
inputSchema: {
|
|
586
586
|
filter: z
|
|
587
587
|
.enum(["all", "planned", "recorded"])
|
|
@@ -591,7 +591,11 @@ export function createVcrMcpServer(deps) {
|
|
|
591
591
|
status: z
|
|
592
592
|
.string()
|
|
593
593
|
.optional()
|
|
594
|
-
.describe("Filter recorded Sessions by exact status (e.g. 'ready', 'processing', 'uploading')."),
|
|
594
|
+
.describe("Filter recorded Sessions by exact status (e.g. 'ready', 'processing', 'uploading', 'expired')."),
|
|
595
|
+
includeArchived: z
|
|
596
|
+
.boolean()
|
|
597
|
+
.default(false)
|
|
598
|
+
.describe("Include archived recorded Sessions in the result."),
|
|
595
599
|
limit: z.number().int().min(1).max(100).default(25).describe("Maximum Sessions per list."),
|
|
596
600
|
},
|
|
597
601
|
outputSchema: {
|
|
@@ -615,6 +619,10 @@ export function createVcrMcpServer(deps) {
|
|
|
615
619
|
startedAtMs: z.number(),
|
|
616
620
|
durationMs: z.number(),
|
|
617
621
|
mediaDeletedAt: z.number().nullable(),
|
|
622
|
+
archivedAt: z.number().nullable(),
|
|
623
|
+
downloadedAt: z.number().nullable(),
|
|
624
|
+
expiresAt: z.number().nullable(),
|
|
625
|
+
expired: z.boolean(),
|
|
618
626
|
syncQaPass: z.boolean().nullable(),
|
|
619
627
|
})),
|
|
620
628
|
usageSummary: z.object({
|
|
@@ -629,7 +637,7 @@ export function createVcrMcpServer(deps) {
|
|
|
629
637
|
idempotentHint: true,
|
|
630
638
|
openWorldHint: true,
|
|
631
639
|
},
|
|
632
|
-
}, async ({ filter, roomId, status, limit }) => runTool(async () => {
|
|
640
|
+
}, async ({ filter, roomId, status, includeArchived, limit }) => runTool(async () => {
|
|
633
641
|
const resp = await api.listSessions();
|
|
634
642
|
const planned = filter === "recorded"
|
|
635
643
|
? []
|
|
@@ -652,7 +660,9 @@ export function createVcrMcpServer(deps) {
|
|
|
652
660
|
const recorded = filter === "planned"
|
|
653
661
|
? []
|
|
654
662
|
: resp.sessions
|
|
655
|
-
.filter((s) => (
|
|
663
|
+
.filter((s) => (includeArchived || !s.archivedAt) &&
|
|
664
|
+
(!roomId || s.roomId === roomId) &&
|
|
665
|
+
(!status || s.status === status))
|
|
656
666
|
.slice(0, limit)
|
|
657
667
|
.map((s) => ({
|
|
658
668
|
id: s.id,
|
|
@@ -663,6 +673,10 @@ export function createVcrMcpServer(deps) {
|
|
|
663
673
|
startedAtMs: s.startedAtMs,
|
|
664
674
|
durationMs: s.durationMs,
|
|
665
675
|
mediaDeletedAt: s.mediaDeletedAt,
|
|
676
|
+
archivedAt: s.archivedAt ?? null,
|
|
677
|
+
downloadedAt: s.downloadedAt ?? null,
|
|
678
|
+
expiresAt: s.expiresAt ?? null,
|
|
679
|
+
expired: Boolean(s.expired || s.status === "expired"),
|
|
666
680
|
syncQaPass: s.syncQaPass,
|
|
667
681
|
}));
|
|
668
682
|
return {
|
|
@@ -697,6 +711,10 @@ export function createVcrMcpServer(deps) {
|
|
|
697
711
|
endedAtMs: z.number().nullable(),
|
|
698
712
|
durationMs: z.number(),
|
|
699
713
|
mediaDeletedAt: z.number().nullable(),
|
|
714
|
+
archivedAt: z.number().nullable(),
|
|
715
|
+
downloadedAt: z.number().nullable(),
|
|
716
|
+
expiresAt: z.number().nullable(),
|
|
717
|
+
expired: z.boolean(),
|
|
700
718
|
syncQaPass: z.boolean().nullable(),
|
|
701
719
|
}),
|
|
702
720
|
guidance: z.string(),
|
|
@@ -754,10 +772,14 @@ export function createVcrMcpServer(deps) {
|
|
|
754
772
|
const detail = await api.getSession(sessionId);
|
|
755
773
|
const s = detail.session;
|
|
756
774
|
const totalExportBytes = detail.files.reduce((sum, f) => sum + f.byteSize, 0);
|
|
775
|
+
const isExpired = Boolean(s.expired || s.status === "expired");
|
|
757
776
|
let guidance = "Session exports are ready. Use download_session to save Tracks locally.";
|
|
758
777
|
if (s.mediaDeletedAt) {
|
|
759
778
|
guidance = "Media files for this Session were permanently deleted; only metadata and Markers remain.";
|
|
760
779
|
}
|
|
780
|
+
else if (isExpired) {
|
|
781
|
+
guidance = "Media files for this Session have expired and are no longer available; only metadata and Markers remain.";
|
|
782
|
+
}
|
|
761
783
|
else if (s.status === "planned") {
|
|
762
784
|
guidance = "Session is planned. Share Session Invite links or enter the Room as Host to start recording.";
|
|
763
785
|
}
|
|
@@ -813,6 +835,10 @@ export function createVcrMcpServer(deps) {
|
|
|
813
835
|
endedAtMs: s.endedAtMs,
|
|
814
836
|
durationMs: s.durationMs,
|
|
815
837
|
mediaDeletedAt: s.mediaDeletedAt,
|
|
838
|
+
archivedAt: s.archivedAt ?? null,
|
|
839
|
+
downloadedAt: s.downloadedAt ?? null,
|
|
840
|
+
expiresAt: s.expiresAt ?? null,
|
|
841
|
+
expired: isExpired,
|
|
816
842
|
syncQaPass: s.syncQaPass,
|
|
817
843
|
},
|
|
818
844
|
guidance,
|
|
@@ -967,6 +993,33 @@ export function createVcrMcpServer(deps) {
|
|
|
967
993
|
}
|
|
968
994
|
return res;
|
|
969
995
|
}));
|
|
996
|
+
// 13b. archive_session
|
|
997
|
+
server.registerTool("archive_session", {
|
|
998
|
+
title: "Archive or Restore Session",
|
|
999
|
+
description: "Hide a settled recorded Session from the active Session Timeline (or restore an archived Session). Non-destructive and reversible: media remains downloadable until its natural 7-day/30-day expiry window, and archiving suppresses remaining expiry reminder emails.",
|
|
1000
|
+
inputSchema: {
|
|
1001
|
+
sessionId: z.string().min(1).describe("Recorded Session ID."),
|
|
1002
|
+
archived: z
|
|
1003
|
+
.boolean()
|
|
1004
|
+
.default(true)
|
|
1005
|
+
.describe("true to archive the Session, false to restore it to the active timeline."),
|
|
1006
|
+
},
|
|
1007
|
+
outputSchema: {
|
|
1008
|
+
ok: z.boolean(),
|
|
1009
|
+
sessionId: z.string(),
|
|
1010
|
+
archivedAt: z.number().nullable(),
|
|
1011
|
+
},
|
|
1012
|
+
annotations: {
|
|
1013
|
+
title: "Archive or Restore Session",
|
|
1014
|
+
readOnlyHint: false,
|
|
1015
|
+
destructiveHint: false,
|
|
1016
|
+
idempotentHint: true,
|
|
1017
|
+
openWorldHint: true,
|
|
1018
|
+
},
|
|
1019
|
+
}, async ({ sessionId, archived }) => runTool(async () => {
|
|
1020
|
+
const res = await api.setSessionArchived(sessionId, archived);
|
|
1021
|
+
return { ok: res.ok, sessionId, archivedAt: res.archivedAt };
|
|
1022
|
+
}));
|
|
970
1023
|
// 14. download_session
|
|
971
1024
|
server.registerTool("download_session", {
|
|
972
1025
|
title: "Download Session",
|
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
|
},
|