@unson/brainbase-mcp 0.24.1 → 0.26.0
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/meeting-source-connection.d.ts +265 -0
- package/dist/meeting-source-connection.js +702 -0
- package/dist/meeting-source-reader.d.ts +18 -0
- package/dist/meeting-source-reader.js +31 -0
- package/dist/world-extension.d.ts +12 -0
- package/dist/world-extension.js +24 -3
- package/package.json +6 -2
- package/ui/world/world-canvas-ui.js +3 -2
- package/ui/world/world-district.js +135 -8
- package/ui/world/world-exits.js +200 -0
- package/ui/world/world-view.css +79 -0
- package/ui/world/world-view.js +117 -15
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
import { type OAuthClientProvider } from '@modelcontextprotocol/sdk/client/auth.js';
|
|
2
|
+
import type { AuthorizationServerMetadata, OAuthClientInformationMixed, OAuthTokens } from '@modelcontextprotocol/sdk/shared/auth.js';
|
|
3
|
+
import type { Transport } from '@modelcontextprotocol/sdk/shared/transport.js';
|
|
4
|
+
import { type MeetingSourceAccessDetail, type MeetingSourceCallTool, type MeetingSourceFailure, type MeetingSourceFailureReason, type MeetingSourceMeeting, type MeetingSourceProvider, type MeetingSourceSegment, type TactiqTranscriptBudget, type TactiqTranscriptRead } from './meeting-source-reader.js';
|
|
5
|
+
import type { OrganizationConnectionBinding, OrganizationConnectionProviderAdapter } from './organization-connection.js';
|
|
6
|
+
export type MeetingSourceCapability = 'meetings:list' | 'transcript:read';
|
|
7
|
+
export type MeetingSourceConnectionStatus = 'pending' | 'connected' | 'reauth_required' | 'disabled' | 'revoked';
|
|
8
|
+
export interface MeetingSourceConnectionRecord {
|
|
9
|
+
/** Issued by Brainbase. An external connection platform's ID lives only in `backend.ref`. */
|
|
10
|
+
connectionId: string;
|
|
11
|
+
tenantId: string;
|
|
12
|
+
provider: MeetingSourceProvider;
|
|
13
|
+
scope: 'personal' | 'org';
|
|
14
|
+
ownerPersonId: string | null;
|
|
15
|
+
orgId: string | null;
|
|
16
|
+
backend: {
|
|
17
|
+
kind: string;
|
|
18
|
+
ref: Record<string, string> | null;
|
|
19
|
+
};
|
|
20
|
+
capabilities: MeetingSourceCapability[];
|
|
21
|
+
status: MeetingSourceConnectionStatus;
|
|
22
|
+
revision: number;
|
|
23
|
+
lastVerifiedAt: string | null;
|
|
24
|
+
}
|
|
25
|
+
export declare class MeetingSourceConnectionError extends Error {
|
|
26
|
+
readonly code: string;
|
|
27
|
+
constructor(code: string, message: string);
|
|
28
|
+
}
|
|
29
|
+
export declare function createMeetingSourceConnectionId(): string;
|
|
30
|
+
export declare function normalizeMeetingSourceConnectionRecord(value: unknown): MeetingSourceConnectionRecord;
|
|
31
|
+
export interface StoredMeetingSourceCredentials {
|
|
32
|
+
provider: MeetingSourceProvider;
|
|
33
|
+
binding: OrganizationConnectionBinding;
|
|
34
|
+
serverUrl: string;
|
|
35
|
+
clientInformation: OAuthClientInformationMixed;
|
|
36
|
+
tokens: OAuthTokens | null;
|
|
37
|
+
connectedAt: string;
|
|
38
|
+
}
|
|
39
|
+
export interface PendingMcpAuthorization {
|
|
40
|
+
provider: MeetingSourceProvider;
|
|
41
|
+
binding: OrganizationConnectionBinding;
|
|
42
|
+
serverUrl: string;
|
|
43
|
+
authorizationServerUrl: string;
|
|
44
|
+
authorizationServerMetadata: AuthorizationServerMetadata | null;
|
|
45
|
+
clientInformation: OAuthClientInformationMixed;
|
|
46
|
+
codeVerifier: string;
|
|
47
|
+
redirectUrl: string;
|
|
48
|
+
resource: string | null;
|
|
49
|
+
createdAt: string;
|
|
50
|
+
}
|
|
51
|
+
export interface MeetingSourceCredentialStore {
|
|
52
|
+
read(connectionId: string): Promise<StoredMeetingSourceCredentials | null>;
|
|
53
|
+
write(connectionId: string, value: StoredMeetingSourceCredentials): Promise<void>;
|
|
54
|
+
remove(connectionId: string): Promise<void>;
|
|
55
|
+
savePendingAuthorization(stateHash: string, value: PendingMcpAuthorization): Promise<void>;
|
|
56
|
+
/** Returns the pending authorization once and forgets it. */
|
|
57
|
+
takePendingAuthorization(stateHash: string): Promise<PendingMcpAuthorization | null>;
|
|
58
|
+
}
|
|
59
|
+
export declare class MemoryMeetingSourceCredentialStore implements MeetingSourceCredentialStore {
|
|
60
|
+
private data;
|
|
61
|
+
read(connectionId: string): Promise<StoredMeetingSourceCredentials | null>;
|
|
62
|
+
write(connectionId: string, value: StoredMeetingSourceCredentials): Promise<void>;
|
|
63
|
+
remove(connectionId: string): Promise<void>;
|
|
64
|
+
savePendingAuthorization(stateHash: string, value: PendingMcpAuthorization): Promise<void>;
|
|
65
|
+
takePendingAuthorization(stateHash: string): Promise<PendingMcpAuthorization | null>;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* One JSON file (mode 0600) holding credentials per connection ID. Writes go
|
|
69
|
+
* through a temporary file and a rename. Calls are serialized in-process.
|
|
70
|
+
*/
|
|
71
|
+
export declare class FileMeetingSourceCredentialStore implements MeetingSourceCredentialStore {
|
|
72
|
+
private readonly filePath;
|
|
73
|
+
private queue;
|
|
74
|
+
constructor(filePath: string);
|
|
75
|
+
read(connectionId: string): Promise<StoredMeetingSourceCredentials>;
|
|
76
|
+
write(connectionId: string, value: StoredMeetingSourceCredentials): Promise<void>;
|
|
77
|
+
remove(connectionId: string): Promise<void>;
|
|
78
|
+
savePendingAuthorization(stateHash: string, value: PendingMcpAuthorization): Promise<void>;
|
|
79
|
+
takePendingAuthorization(stateHash: string): Promise<PendingMcpAuthorization>;
|
|
80
|
+
private mutate;
|
|
81
|
+
private run;
|
|
82
|
+
private load;
|
|
83
|
+
private save;
|
|
84
|
+
}
|
|
85
|
+
export interface MeetingSourceConnectionNote {
|
|
86
|
+
capability: MeetingSourceCapability;
|
|
87
|
+
reason: MeetingSourceFailureReason | 'no_meetings';
|
|
88
|
+
message: string;
|
|
89
|
+
access?: MeetingSourceAccessDetail;
|
|
90
|
+
}
|
|
91
|
+
export interface MeetingSourceConnectionHealth {
|
|
92
|
+
status: 'connected' | 'reauth_required' | 'error';
|
|
93
|
+
capabilities: MeetingSourceCapability[];
|
|
94
|
+
checkedAt: string;
|
|
95
|
+
failure: MeetingSourceFailure | null;
|
|
96
|
+
notes: MeetingSourceConnectionNote[];
|
|
97
|
+
}
|
|
98
|
+
export interface ConnectionRuntime {
|
|
99
|
+
verify(connection: MeetingSourceConnectionRecord, options?: {
|
|
100
|
+
budget?: TactiqTranscriptBudget;
|
|
101
|
+
}): Promise<MeetingSourceConnectionHealth>;
|
|
102
|
+
callTool(connection: MeetingSourceConnectionRecord, tool: string, args: Record<string, unknown>): Promise<unknown>;
|
|
103
|
+
disconnect(connection: MeetingSourceConnectionRecord): Promise<void>;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Checks that a connection can actually list meetings and read the first page
|
|
107
|
+
* of a full transcript. Shared by every runtime so the result does not depend
|
|
108
|
+
* on how the connection is executed.
|
|
109
|
+
*/
|
|
110
|
+
export declare function probeMeetingSourceConnection(input: {
|
|
111
|
+
provider: MeetingSourceProvider;
|
|
112
|
+
callTool: MeetingSourceCallTool;
|
|
113
|
+
budget?: TactiqTranscriptBudget;
|
|
114
|
+
now?: () => Date;
|
|
115
|
+
lookbackMs?: number;
|
|
116
|
+
}): Promise<MeetingSourceConnectionHealth>;
|
|
117
|
+
export interface NativeMcpRuntimeOptions {
|
|
118
|
+
credentials: MeetingSourceCredentialStore;
|
|
119
|
+
/** MCP server URL per provider, used when the stored credentials have none. */
|
|
120
|
+
serverUrlFor?: (provider: MeetingSourceProvider) => string;
|
|
121
|
+
/** Replaces the Streamable HTTP transport, e.g. for tests. */
|
|
122
|
+
createTransport?: (input: {
|
|
123
|
+
url: URL;
|
|
124
|
+
authProvider: OAuthClientProvider;
|
|
125
|
+
connection: MeetingSourceConnectionRecord;
|
|
126
|
+
}) => Transport;
|
|
127
|
+
clientName?: string;
|
|
128
|
+
now?: () => Date;
|
|
129
|
+
}
|
|
130
|
+
/** Runs MCP tools with the SDK client, reading credentials through the credential port. */
|
|
131
|
+
export declare class NativeMcpRuntime implements ConnectionRuntime {
|
|
132
|
+
private readonly options;
|
|
133
|
+
constructor(options: NativeMcpRuntimeOptions);
|
|
134
|
+
verify(connection: MeetingSourceConnectionRecord, options?: {
|
|
135
|
+
budget?: TactiqTranscriptBudget;
|
|
136
|
+
}): Promise<MeetingSourceConnectionHealth>;
|
|
137
|
+
callTool(connection: MeetingSourceConnectionRecord, tool: string, args: Record<string, unknown>): Promise<unknown>;
|
|
138
|
+
disconnect(connection: MeetingSourceConnectionRecord): Promise<void>;
|
|
139
|
+
}
|
|
140
|
+
export interface MeetingSourcePendingMeeting {
|
|
141
|
+
meeting: MeetingSourceMeeting;
|
|
142
|
+
reason: MeetingSourceFailureReason | 'delivery_failed';
|
|
143
|
+
message: string;
|
|
144
|
+
retryAt: string | null;
|
|
145
|
+
attempts: number;
|
|
146
|
+
firstSeenAt: string;
|
|
147
|
+
}
|
|
148
|
+
export interface MeetingSourceDeliveredMeeting {
|
|
149
|
+
digest: string;
|
|
150
|
+
version: number;
|
|
151
|
+
deliveredAt: string;
|
|
152
|
+
}
|
|
153
|
+
export interface MeetingSourceSyncState {
|
|
154
|
+
schemaVersion: 1;
|
|
155
|
+
connectionId: string;
|
|
156
|
+
provider: MeetingSourceProvider;
|
|
157
|
+
syncEnabled: boolean;
|
|
158
|
+
listedThrough: string | null;
|
|
159
|
+
pending: MeetingSourcePendingMeeting[];
|
|
160
|
+
unobtainable: Array<{
|
|
161
|
+
meetingId: string;
|
|
162
|
+
reason: string;
|
|
163
|
+
message: string;
|
|
164
|
+
decidedAt: string;
|
|
165
|
+
}>;
|
|
166
|
+
delivered: Record<string, MeetingSourceDeliveredMeeting>;
|
|
167
|
+
tactiqReads: TactiqTranscriptRead[];
|
|
168
|
+
lastAttemptAt: string | null;
|
|
169
|
+
lastSuccessAt: string | null;
|
|
170
|
+
lastError: {
|
|
171
|
+
reason: string;
|
|
172
|
+
message: string;
|
|
173
|
+
at: string;
|
|
174
|
+
} | null;
|
|
175
|
+
}
|
|
176
|
+
export interface MeetingSourceSyncStateStore {
|
|
177
|
+
load(connectionId: string): Promise<MeetingSourceSyncState | null>;
|
|
178
|
+
save(state: MeetingSourceSyncState): Promise<void>;
|
|
179
|
+
}
|
|
180
|
+
export interface MeetingSourceDelivery {
|
|
181
|
+
connectionId: string;
|
|
182
|
+
tenantId: string;
|
|
183
|
+
provider: MeetingSourceProvider;
|
|
184
|
+
scope: 'personal' | 'org';
|
|
185
|
+
ownerPersonId: string | null;
|
|
186
|
+
orgId: string | null;
|
|
187
|
+
meeting: MeetingSourceMeeting;
|
|
188
|
+
transcript: {
|
|
189
|
+
text: string;
|
|
190
|
+
segments: MeetingSourceSegment[];
|
|
191
|
+
digest: string;
|
|
192
|
+
};
|
|
193
|
+
version: number;
|
|
194
|
+
retrievedAt: string;
|
|
195
|
+
}
|
|
196
|
+
export type MeetingSourceDeliver = (delivery: MeetingSourceDelivery) => Promise<void>;
|
|
197
|
+
export interface MeetingSourceSyncResult {
|
|
198
|
+
status: 'ok' | 'failed' | 'skipped';
|
|
199
|
+
skippedReason?: 'not_connected' | 'sync_disabled';
|
|
200
|
+
delivered: Array<{
|
|
201
|
+
meetingId: string;
|
|
202
|
+
version: number;
|
|
203
|
+
}>;
|
|
204
|
+
pending: number;
|
|
205
|
+
failure: {
|
|
206
|
+
reason: string;
|
|
207
|
+
message: string;
|
|
208
|
+
} | null;
|
|
209
|
+
state: MeetingSourceSyncState;
|
|
210
|
+
}
|
|
211
|
+
export declare function emptyMeetingSourceSyncState(connection: MeetingSourceConnectionRecord): MeetingSourceSyncState;
|
|
212
|
+
export declare class MemoryMeetingSourceSyncStateStore implements MeetingSourceSyncStateStore {
|
|
213
|
+
private readonly states;
|
|
214
|
+
load(connectionId: string): Promise<MeetingSourceSyncState | null>;
|
|
215
|
+
save(state: MeetingSourceSyncState): Promise<void>;
|
|
216
|
+
}
|
|
217
|
+
export declare function syncMeetingSourceConnection(input: {
|
|
218
|
+
connection: MeetingSourceConnectionRecord;
|
|
219
|
+
runtime: ConnectionRuntime;
|
|
220
|
+
stateStore: MeetingSourceSyncStateStore;
|
|
221
|
+
deliver: MeetingSourceDeliver;
|
|
222
|
+
/** Re-fetch a past period. Does not move `listedThrough`. */
|
|
223
|
+
window?: {
|
|
224
|
+
since: string;
|
|
225
|
+
until: string;
|
|
226
|
+
};
|
|
227
|
+
recheckDelivered?: boolean;
|
|
228
|
+
now?: () => Date;
|
|
229
|
+
initialLookbackMs?: number;
|
|
230
|
+
overlapMs?: number;
|
|
231
|
+
maxAttempts?: number;
|
|
232
|
+
}): Promise<MeetingSourceSyncResult>;
|
|
233
|
+
export interface MeetingSourceListedMeeting {
|
|
234
|
+
connection: MeetingSourceConnectionRecord;
|
|
235
|
+
meeting: MeetingSourceMeeting;
|
|
236
|
+
}
|
|
237
|
+
export interface SameMeetingCandidate {
|
|
238
|
+
first: MeetingSourceListedMeeting;
|
|
239
|
+
second: MeetingSourceListedMeeting;
|
|
240
|
+
sharedParticipants: string[];
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Suggests pairs that may be the same meeting. Only meetings of the same tenant
|
|
244
|
+
* and the same owner are compared; nothing is merged automatically.
|
|
245
|
+
*/
|
|
246
|
+
export declare function findSameMeetingCandidates(entries: readonly MeetingSourceListedMeeting[], options?: {
|
|
247
|
+
toleranceMs?: number;
|
|
248
|
+
}): SameMeetingCandidate[];
|
|
249
|
+
export interface McpOAuthConnectionAdapterOptions {
|
|
250
|
+
credentials: MeetingSourceCredentialStore;
|
|
251
|
+
serverUrlFor: (provider: MeetingSourceProvider) => string;
|
|
252
|
+
redirectUrl: string;
|
|
253
|
+
clientName?: string;
|
|
254
|
+
/** Overrides the scopes requested. Defaults to the protected resource's `scopes_supported`. */
|
|
255
|
+
scopeFor?: (provider: MeetingSourceProvider, supported: string[] | undefined) => string | undefined;
|
|
256
|
+
fetchFn?: typeof fetch;
|
|
257
|
+
now?: () => Date;
|
|
258
|
+
issueConnectionId?: () => string;
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Implements the provider side of `@unson/brainbase-mcp/organization-connection`
|
|
262
|
+
* for MCP servers: discovery (RFC 9728 / RFC 8414), dynamic client
|
|
263
|
+
* registration, PKCE, and the token exchange. Readbacks never carry tokens.
|
|
264
|
+
*/
|
|
265
|
+
export declare function createMcpOAuthConnectionAdapter(options: McpOAuthConnectionAdapterOptions): OrganizationConnectionProviderAdapter;
|