@tapedock/mcp 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +49 -2
- package/dist/api/client.d.ts +192 -0
- package/dist/api/client.js +152 -0
- package/dist/auth/credentials.d.ts +42 -0
- package/dist/auth/credentials.js +244 -0
- package/dist/auth/login.d.ts +22 -0
- package/dist/auth/login.js +229 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +145 -0
- package/dist/downloads/manager.d.ts +74 -0
- package/dist/downloads/manager.js +509 -0
- package/dist/downloads/resolve-otio.d.ts +7 -0
- package/dist/downloads/resolve-otio.js +68 -0
- package/dist/lib/format.d.ts +31 -0
- package/dist/lib/format.js +146 -0
- package/dist/server.d.ts +9 -0
- package/dist/server.js +1068 -0
- package/package.json +56 -4
- package/server.json +41 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 TapeDock
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,50 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @tapedock/mcp
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Official **TapeDock** Model Context Protocol (MCP) server for remote multi-track podcast and video interview recording.
|
|
4
|
+
|
|
5
|
+
Full documentation: [https://tapedock.com/docs/mcp](https://tapedock.com/docs/mcp)
|
|
6
|
+
|
|
7
|
+
## Quick Start
|
|
8
|
+
|
|
9
|
+
### Option 1 — Hosted Remote MCP (zero install)
|
|
10
|
+
Connect Claude, Cursor, Codex, or T3 Code directly to:
|
|
11
|
+
|
|
12
|
+
```text
|
|
13
|
+
https://app.tapedock.com/mcp
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
### Option 2 — Local CLI MCP (adds resumable multi-GB downloads)
|
|
17
|
+
|
|
18
|
+
Authorize your machine once via browser OAuth 2.0 + PKCE:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npx -y @tapedock/mcp login
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Then add TapeDock to your MCP client config:
|
|
25
|
+
|
|
26
|
+
```json
|
|
27
|
+
{
|
|
28
|
+
"mcpServers": {
|
|
29
|
+
"tapedock": {
|
|
30
|
+
"command": "npx",
|
|
31
|
+
"args": ["-y", "@tapedock/mcp"]
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Tools Included
|
|
38
|
+
- `list_rooms`, `create_room`
|
|
39
|
+
- `plan_session`, `update_planned_session`, `cancel_planned_session`
|
|
40
|
+
- `create_session_invite`, `revoke_session_invite`
|
|
41
|
+
- `list_sessions`, `get_session`
|
|
42
|
+
- `add_marker`, `delete_marker`
|
|
43
|
+
- `process_session_now`
|
|
44
|
+
- `download_session`, `get_download_status` (atomic `.part` streaming, HTTP Range resume, exact byte-size skip, automatic presigned URL refresh)
|
|
45
|
+
|
|
46
|
+
## Security Boundaries
|
|
47
|
+
OAuth tokens granted to MCP agents **cannot** initiate Stripe payments, unlock paid Sessions, modify subscriptions or billing, delete your account, join live Rooms, or permanently delete recorded media. Revoke any connected device anytime from **Dashboard → Agents (MCP)**.
|
|
48
|
+
|
|
49
|
+
## License
|
|
50
|
+
MIT
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import type { MarkerColor, PlannedSessionSummary, QualityTier, RoomSummary, SessionInviteSummary, SyncReport } from "@vcr/protocol";
|
|
2
|
+
import { type CredentialStore } from "../auth/credentials.js";
|
|
3
|
+
export interface HostAuthMeResponse {
|
|
4
|
+
authenticated: boolean;
|
|
5
|
+
user: {
|
|
6
|
+
accountId: string;
|
|
7
|
+
email: string;
|
|
8
|
+
name: string;
|
|
9
|
+
nameConfirmed: boolean;
|
|
10
|
+
role: "host";
|
|
11
|
+
isFreeAccount?: boolean;
|
|
12
|
+
} | null;
|
|
13
|
+
authMethod?: "cookie" | "bearer" | null;
|
|
14
|
+
scopes?: string[];
|
|
15
|
+
devMode: boolean;
|
|
16
|
+
googleConfigured: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface SessionSummaryRow {
|
|
19
|
+
id: string;
|
|
20
|
+
roomId: string;
|
|
21
|
+
title: string;
|
|
22
|
+
qualityTier: QualityTier;
|
|
23
|
+
status: string;
|
|
24
|
+
scheduledStartAtMs?: number | null;
|
|
25
|
+
startedAtMs: number;
|
|
26
|
+
endedAtMs: number | null;
|
|
27
|
+
durationMs: number;
|
|
28
|
+
mediaDeletedAt: number | null;
|
|
29
|
+
syncQaPass: boolean | null;
|
|
30
|
+
createdAt?: number;
|
|
31
|
+
}
|
|
32
|
+
export interface SessionExportFile {
|
|
33
|
+
name: string;
|
|
34
|
+
r2Key: string;
|
|
35
|
+
category: "bundle" | "video" | "audio" | "screen";
|
|
36
|
+
downloadUrl: string;
|
|
37
|
+
byteSize: number;
|
|
38
|
+
}
|
|
39
|
+
export interface SessionDetailResponse {
|
|
40
|
+
session: SessionSummaryRow;
|
|
41
|
+
participants: Array<{
|
|
42
|
+
id: string;
|
|
43
|
+
participantId: string;
|
|
44
|
+
orderIndex: number;
|
|
45
|
+
displayName: string;
|
|
46
|
+
slug: string;
|
|
47
|
+
role: string;
|
|
48
|
+
}>;
|
|
49
|
+
markers: Array<{
|
|
50
|
+
id: string;
|
|
51
|
+
timeMs: number;
|
|
52
|
+
timecode: string;
|
|
53
|
+
color: MarkerColor;
|
|
54
|
+
label: string;
|
|
55
|
+
note: string;
|
|
56
|
+
}>;
|
|
57
|
+
jobs: Array<{
|
|
58
|
+
id: string;
|
|
59
|
+
trackId: string | null;
|
|
60
|
+
modalCallId: string | null;
|
|
61
|
+
status: string;
|
|
62
|
+
attempt: number;
|
|
63
|
+
errorMessage: string | null;
|
|
64
|
+
startedAt: number;
|
|
65
|
+
completedAt: number | null;
|
|
66
|
+
}>;
|
|
67
|
+
ledger: Array<{
|
|
68
|
+
id: string;
|
|
69
|
+
qualityTier: string;
|
|
70
|
+
sessionDurationMs: number;
|
|
71
|
+
recordedParticipantMs: number;
|
|
72
|
+
rawBytesUploaded: number;
|
|
73
|
+
exportBytesGenerated: number;
|
|
74
|
+
postprocessCpuSec: number;
|
|
75
|
+
estimatedCogsUsd: number;
|
|
76
|
+
recordedAt: number;
|
|
77
|
+
}>;
|
|
78
|
+
syncReport: SyncReport | null;
|
|
79
|
+
files: SessionExportFile[];
|
|
80
|
+
genericInvite?: SessionInviteSummary | null;
|
|
81
|
+
guestInvites?: SessionInviteSummary[];
|
|
82
|
+
}
|
|
83
|
+
export interface SessionsListResponse {
|
|
84
|
+
plannedSessions: PlannedSessionSummary[];
|
|
85
|
+
sessions: SessionSummaryRow[];
|
|
86
|
+
usageSummary: {
|
|
87
|
+
monthlyCogsUsd: number;
|
|
88
|
+
totalSessions: number;
|
|
89
|
+
ledgerEntries: SessionDetailResponse["ledger"];
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
export declare class VcrApiError extends Error {
|
|
93
|
+
readonly status: number;
|
|
94
|
+
readonly requiredScope?: string | undefined;
|
|
95
|
+
constructor(status: number, message: string, requiredScope?: string | undefined);
|
|
96
|
+
}
|
|
97
|
+
export declare class VcrApiClient {
|
|
98
|
+
readonly origin: string;
|
|
99
|
+
private readonly store;
|
|
100
|
+
private readonly fetchImpl;
|
|
101
|
+
constructor(opts: {
|
|
102
|
+
origin: string;
|
|
103
|
+
store: CredentialStore;
|
|
104
|
+
fetchImpl?: typeof fetch;
|
|
105
|
+
});
|
|
106
|
+
private refreshTokens;
|
|
107
|
+
requestJson<T>(pathname: string, init?: {
|
|
108
|
+
method?: string;
|
|
109
|
+
body?: unknown;
|
|
110
|
+
signal?: AbortSignal;
|
|
111
|
+
}): Promise<T>;
|
|
112
|
+
getAuthMe(): Promise<HostAuthMeResponse>;
|
|
113
|
+
listRooms(): Promise<{
|
|
114
|
+
rooms: RoomSummary[];
|
|
115
|
+
}>;
|
|
116
|
+
createRoom(payload: {
|
|
117
|
+
name: string;
|
|
118
|
+
defaultQuality: QualityTier;
|
|
119
|
+
}): Promise<{
|
|
120
|
+
room: RoomSummary;
|
|
121
|
+
}>;
|
|
122
|
+
setRoomLock(roomId: string, isLocked: boolean): Promise<{
|
|
123
|
+
ok: boolean;
|
|
124
|
+
isLocked: boolean;
|
|
125
|
+
}>;
|
|
126
|
+
setRoomArchived(roomId: string, archived: boolean): Promise<{
|
|
127
|
+
ok: boolean;
|
|
128
|
+
archivedAt: number | null;
|
|
129
|
+
}>;
|
|
130
|
+
rotateRoomLink(roomId: string): Promise<{
|
|
131
|
+
inviteUrl: string;
|
|
132
|
+
}>;
|
|
133
|
+
listSessions(): Promise<SessionsListResponse>;
|
|
134
|
+
getSession(sessionId: string, signal?: AbortSignal): Promise<SessionDetailResponse>;
|
|
135
|
+
planSession(payload: {
|
|
136
|
+
roomId?: string;
|
|
137
|
+
newRoomName?: string;
|
|
138
|
+
title: string;
|
|
139
|
+
scheduledStartAtMs?: number | null;
|
|
140
|
+
guestNames?: string[];
|
|
141
|
+
}): Promise<{
|
|
142
|
+
session: PlannedSessionSummary;
|
|
143
|
+
}>;
|
|
144
|
+
updatePlannedSession(sessionId: string, payload: {
|
|
145
|
+
title?: string;
|
|
146
|
+
scheduledStartAtMs?: number | null;
|
|
147
|
+
}): Promise<{
|
|
148
|
+
ok: boolean;
|
|
149
|
+
title: string;
|
|
150
|
+
scheduledStartAtMs: number | null;
|
|
151
|
+
}>;
|
|
152
|
+
cancelPlannedSession(sessionId: string): Promise<{
|
|
153
|
+
ok: boolean;
|
|
154
|
+
}>;
|
|
155
|
+
addSessionInvite(sessionId: string, guestName: string): Promise<{
|
|
156
|
+
invite: SessionInviteSummary;
|
|
157
|
+
}>;
|
|
158
|
+
renameSessionInvite(inviteId: string, guestName: string): Promise<{
|
|
159
|
+
ok: boolean;
|
|
160
|
+
guestName: string;
|
|
161
|
+
}>;
|
|
162
|
+
rotateSessionInvite(inviteId: string): Promise<{
|
|
163
|
+
ok: boolean;
|
|
164
|
+
inviteUrl: string;
|
|
165
|
+
guestName?: string | null;
|
|
166
|
+
sessionTitle?: string;
|
|
167
|
+
scheduledStartAtMs?: number | null;
|
|
168
|
+
}>;
|
|
169
|
+
revokeSessionInvite(inviteId: string): Promise<{
|
|
170
|
+
ok: boolean;
|
|
171
|
+
}>;
|
|
172
|
+
addMarker(sessionId: string, payload: {
|
|
173
|
+
timeMs: number;
|
|
174
|
+
color: MarkerColor;
|
|
175
|
+
label: string;
|
|
176
|
+
note: string;
|
|
177
|
+
}): Promise<{
|
|
178
|
+
ok: boolean;
|
|
179
|
+
id: string;
|
|
180
|
+
}>;
|
|
181
|
+
deleteMarker(sessionId: string, markerId: string): Promise<{
|
|
182
|
+
ok: boolean;
|
|
183
|
+
}>;
|
|
184
|
+
processSessionNow(sessionId: string, opts?: {
|
|
185
|
+
forcePartial?: boolean;
|
|
186
|
+
onlyParticipantIds?: string[];
|
|
187
|
+
}): Promise<{
|
|
188
|
+
ok: boolean;
|
|
189
|
+
jobId?: string;
|
|
190
|
+
error?: string;
|
|
191
|
+
}>;
|
|
192
|
+
}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { AuthRequiredError, InvalidGrantError, } from "../auth/credentials.js";
|
|
2
|
+
import { OAUTH_CLIENT_ID } from "../auth/login.js";
|
|
3
|
+
import { normalizeOrigin } from "../lib/format.js";
|
|
4
|
+
export class VcrApiError extends Error {
|
|
5
|
+
status;
|
|
6
|
+
requiredScope;
|
|
7
|
+
constructor(status, message, requiredScope) {
|
|
8
|
+
super(message);
|
|
9
|
+
this.status = status;
|
|
10
|
+
this.requiredScope = requiredScope;
|
|
11
|
+
this.name = "VcrApiError";
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
const enc = encodeURIComponent;
|
|
15
|
+
export class VcrApiClient {
|
|
16
|
+
origin;
|
|
17
|
+
store;
|
|
18
|
+
fetchImpl;
|
|
19
|
+
constructor(opts) {
|
|
20
|
+
this.origin = normalizeOrigin(opts.origin);
|
|
21
|
+
this.store = opts.store;
|
|
22
|
+
this.fetchImpl = opts.fetchImpl ?? fetch;
|
|
23
|
+
}
|
|
24
|
+
async refreshTokens(refreshToken) {
|
|
25
|
+
const resp = await this.fetchImpl(`${this.origin}/oauth/token`, {
|
|
26
|
+
method: "POST",
|
|
27
|
+
headers: { "Content-Type": "application/x-www-form-urlencoded" },
|
|
28
|
+
body: new URLSearchParams({
|
|
29
|
+
grant_type: "refresh_token",
|
|
30
|
+
refresh_token: refreshToken,
|
|
31
|
+
client_id: OAUTH_CLIENT_ID,
|
|
32
|
+
}),
|
|
33
|
+
signal: AbortSignal.timeout(15_000),
|
|
34
|
+
});
|
|
35
|
+
if (resp.status === 400 || resp.status === 401) {
|
|
36
|
+
const body = (await resp.json().catch(() => ({})));
|
|
37
|
+
if (body.error === "invalid_grant" || resp.status === 401) {
|
|
38
|
+
throw new InvalidGrantError(body.error || "invalid_grant");
|
|
39
|
+
}
|
|
40
|
+
throw new VcrApiError(resp.status, body.error || `Token refresh failed (${resp.status})`);
|
|
41
|
+
}
|
|
42
|
+
if (!resp.ok) {
|
|
43
|
+
throw new VcrApiError(resp.status, `Token refresh failed (${resp.status})`);
|
|
44
|
+
}
|
|
45
|
+
const data = (await resp.json());
|
|
46
|
+
return {
|
|
47
|
+
accessToken: data.access_token,
|
|
48
|
+
refreshToken: data.refresh_token,
|
|
49
|
+
expiresInSec: data.expires_in,
|
|
50
|
+
scope: data.scope ?? "",
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
async requestJson(pathname, init) {
|
|
54
|
+
const method = init?.method ?? "GET";
|
|
55
|
+
const url = `${this.origin}${pathname}`;
|
|
56
|
+
let creds = await this.store.getValidCredentials(this.origin, (rt) => this.refreshTokens(rt));
|
|
57
|
+
for (let attempt = 0; attempt < 2; attempt++) {
|
|
58
|
+
const headers = {
|
|
59
|
+
Authorization: `Bearer ${creds.accessToken}`,
|
|
60
|
+
Accept: "application/json",
|
|
61
|
+
};
|
|
62
|
+
let bodyStr;
|
|
63
|
+
if (init?.body !== undefined) {
|
|
64
|
+
headers["Content-Type"] = "application/json";
|
|
65
|
+
bodyStr = JSON.stringify(init.body);
|
|
66
|
+
}
|
|
67
|
+
const resp = await this.fetchImpl(url, {
|
|
68
|
+
method,
|
|
69
|
+
headers,
|
|
70
|
+
body: bodyStr,
|
|
71
|
+
signal: init?.signal,
|
|
72
|
+
});
|
|
73
|
+
if (resp.status === 401 && attempt === 0) {
|
|
74
|
+
creds = await this.store.getValidCredentials(this.origin, (rt) => this.refreshTokens(rt), { forceRefreshAfterFailedToken: creds.accessToken });
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
if (resp.status === 401) {
|
|
78
|
+
throw new AuthRequiredError(this.origin);
|
|
79
|
+
}
|
|
80
|
+
if (!resp.ok) {
|
|
81
|
+
const errBody = (await resp.json().catch(() => ({})));
|
|
82
|
+
throw new VcrApiError(resp.status, errBody.error || errBody.reason || `Request failed (${resp.status})`, errBody.requiredScope);
|
|
83
|
+
}
|
|
84
|
+
return (await resp.json());
|
|
85
|
+
}
|
|
86
|
+
throw new AuthRequiredError(this.origin);
|
|
87
|
+
}
|
|
88
|
+
getAuthMe() {
|
|
89
|
+
return this.requestJson("/auth/me");
|
|
90
|
+
}
|
|
91
|
+
listRooms() {
|
|
92
|
+
return this.requestJson("/api/host/rooms");
|
|
93
|
+
}
|
|
94
|
+
createRoom(payload) {
|
|
95
|
+
return this.requestJson("/api/host/rooms", {
|
|
96
|
+
method: "POST",
|
|
97
|
+
body: payload,
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
setRoomLock(roomId, isLocked) {
|
|
101
|
+
return this.requestJson(`/api/host/rooms/${enc(roomId)}/lock`, { method: "POST", body: { isLocked } });
|
|
102
|
+
}
|
|
103
|
+
setRoomArchived(roomId, archived) {
|
|
104
|
+
return this.requestJson(`/api/host/rooms/${enc(roomId)}/archive`, { method: "POST", body: { archived } });
|
|
105
|
+
}
|
|
106
|
+
rotateRoomLink(roomId) {
|
|
107
|
+
return this.requestJson(`/api/host/rooms/${enc(roomId)}/rotate-link`, { method: "POST" });
|
|
108
|
+
}
|
|
109
|
+
listSessions() {
|
|
110
|
+
return this.requestJson("/api/host/sessions");
|
|
111
|
+
}
|
|
112
|
+
getSession(sessionId, signal) {
|
|
113
|
+
return this.requestJson(`/api/host/sessions/${enc(sessionId)}`, {
|
|
114
|
+
signal,
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
planSession(payload) {
|
|
118
|
+
return this.requestJson("/api/host/sessions/planned", {
|
|
119
|
+
method: "POST",
|
|
120
|
+
body: payload,
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
updatePlannedSession(sessionId, payload) {
|
|
124
|
+
return this.requestJson(`/api/host/sessions/${enc(sessionId)}`, { method: "PATCH", body: payload });
|
|
125
|
+
}
|
|
126
|
+
cancelPlannedSession(sessionId) {
|
|
127
|
+
return this.requestJson(`/api/host/sessions/${enc(sessionId)}/cancel`, {
|
|
128
|
+
method: "POST",
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
addSessionInvite(sessionId, guestName) {
|
|
132
|
+
return this.requestJson(`/api/host/sessions/${enc(sessionId)}/invites`, { method: "POST", body: { guestName } });
|
|
133
|
+
}
|
|
134
|
+
renameSessionInvite(inviteId, guestName) {
|
|
135
|
+
return this.requestJson(`/api/host/session-invites/${enc(inviteId)}`, { method: "PATCH", body: { guestName } });
|
|
136
|
+
}
|
|
137
|
+
rotateSessionInvite(inviteId) {
|
|
138
|
+
return this.requestJson(`/api/host/session-invites/${enc(inviteId)}/rotate`, { method: "POST" });
|
|
139
|
+
}
|
|
140
|
+
revokeSessionInvite(inviteId) {
|
|
141
|
+
return this.requestJson(`/api/host/session-invites/${enc(inviteId)}/revoke`, { method: "POST" });
|
|
142
|
+
}
|
|
143
|
+
addMarker(sessionId, payload) {
|
|
144
|
+
return this.requestJson(`/api/host/sessions/${enc(sessionId)}/markers`, { method: "POST", body: payload });
|
|
145
|
+
}
|
|
146
|
+
deleteMarker(sessionId, markerId) {
|
|
147
|
+
return this.requestJson(`/api/host/sessions/${enc(sessionId)}/markers/${enc(markerId)}`, { method: "DELETE" });
|
|
148
|
+
}
|
|
149
|
+
processSessionNow(sessionId, opts) {
|
|
150
|
+
return this.requestJson(`/api/host/sessions/${enc(sessionId)}/process-now`, { method: "POST", body: opts ?? { forcePartial: true } });
|
|
151
|
+
}
|
|
152
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export interface OriginCredentials {
|
|
2
|
+
accessToken: string;
|
|
3
|
+
refreshToken: string;
|
|
4
|
+
expiresAtMs: number;
|
|
5
|
+
scope: string;
|
|
6
|
+
accountEmail?: string;
|
|
7
|
+
updatedAtMs: number;
|
|
8
|
+
}
|
|
9
|
+
export declare class AuthRequiredError extends Error {
|
|
10
|
+
readonly origin: string;
|
|
11
|
+
constructor(origin: string, message?: string);
|
|
12
|
+
}
|
|
13
|
+
export declare function resolveCredentialsPath(overridePath?: string): string;
|
|
14
|
+
export declare class CredentialStore {
|
|
15
|
+
readonly filePath: string;
|
|
16
|
+
private readonly lockPath;
|
|
17
|
+
private readonly inFlightRefreshes;
|
|
18
|
+
constructor(filePath?: string);
|
|
19
|
+
private ensureParentDir;
|
|
20
|
+
private readFileUnlocked;
|
|
21
|
+
private writeFileAtomicUnlocked;
|
|
22
|
+
withCrossProcessLock<T>(fn: () => Promise<T>): Promise<T>;
|
|
23
|
+
get(originRaw: string): Promise<OriginCredentials | null>;
|
|
24
|
+
save(originRaw: string, creds: OriginCredentials): Promise<void>;
|
|
25
|
+
remove(originRaw: string): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Return a valid access token for `origin`, refreshing transparently under a two-level lock
|
|
28
|
+
* (in-process single-flight mutex + cross-process lockfile + double-checked disk reload)
|
|
29
|
+
* so parallel tool calls never trigger RFC 9700 refresh-token reuse revocation.
|
|
30
|
+
*/
|
|
31
|
+
getValidCredentials(originRaw: string, refreshFn: (refreshToken: string) => Promise<{
|
|
32
|
+
accessToken: string;
|
|
33
|
+
refreshToken: string;
|
|
34
|
+
expiresInSec: number;
|
|
35
|
+
scope: string;
|
|
36
|
+
}>, opts?: {
|
|
37
|
+
forceRefreshAfterFailedToken?: string;
|
|
38
|
+
}): Promise<OriginCredentials>;
|
|
39
|
+
}
|
|
40
|
+
export declare class InvalidGrantError extends Error {
|
|
41
|
+
constructor(message?: string);
|
|
42
|
+
}
|