@openblah/core 0.0.0-stage → 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Daniel Machado Kupfer
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,5 @@
1
- # Temporary Holding Version
1
+ # @openblah/core
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Shared client and React hooks behind `@openblah/web` and `@openblah/react-native`. Install one of those packages instead of this one.
4
+
5
+ **0.x, unstable:** the API may change in any minor release.
package/dist/api.d.ts ADDED
@@ -0,0 +1,370 @@
1
+ import type { Role } from "./protocol.js";
2
+ /** Consent wording and version, as the server returns it. Show `text` as is. */
3
+ export interface ConsentText {
4
+ version: string;
5
+ text: string;
6
+ }
7
+ /** What a guest sees before joining: from `GET /v1/invites/:token`. */
8
+ export interface InvitePreview {
9
+ hostDisplayName: string;
10
+ agent: "on" | "off" | "ask";
11
+ agentName: string;
12
+ consent: ConsentText;
13
+ }
14
+ /** The consent a person gives when joining; `textVersion` comes from the text they were shown. */
15
+ export interface ConsentGrant {
16
+ accepted: true;
17
+ textVersion: string;
18
+ }
19
+ export interface Invite {
20
+ id: string;
21
+ roomId: string;
22
+ token: string;
23
+ /** Link to share. */
24
+ url: string;
25
+ expiresAt: string;
26
+ maxUses: number;
27
+ }
28
+ export interface CreateInviteOptions {
29
+ expiresInSeconds?: number;
30
+ maxUses?: number;
31
+ }
32
+ /** Result of joining with an invite link. Pass `token` and `livekitUrl` to `connect`. */
33
+ export interface GuestJoin {
34
+ token: string;
35
+ roomId: string;
36
+ userId: string;
37
+ role: "guest";
38
+ expiresIn: number;
39
+ livekitUrl?: string;
40
+ }
41
+ export interface RoomParticipant {
42
+ userId: string;
43
+ displayName: string;
44
+ role: Role;
45
+ joinedAt: string;
46
+ /** Hosts and members only. */
47
+ contact?: string;
48
+ }
49
+ /** A non-host asked for the agent; the host approves or declines it. */
50
+ export interface AgentRequestInfo {
51
+ id: string;
52
+ userId: string;
53
+ displayName: string;
54
+ requestedAt: string;
55
+ }
56
+ /**
57
+ * The room's agent setting and what is pending. `agent` is `off` (a plain call), `on`, or `ask`
58
+ * (off until someone invites it).
59
+ */
60
+ export interface AgentControlState {
61
+ agent: "on" | "off" | "ask";
62
+ agentName: string;
63
+ /** Any participant may bring the agent in or send it out, not only the host. */
64
+ anyoneCanAddAgent: boolean;
65
+ /** The agent leaves after this many seconds of silence. */
66
+ idleTimeoutSeconds: number;
67
+ /** The agent is on but waits for everyone to consent; it listens to nobody until then. */
68
+ awaitingConsent: boolean;
69
+ /** Who has not consented yet (only while awaiting consent). */
70
+ missing: {
71
+ userId: string;
72
+ displayName: string;
73
+ }[];
74
+ /** Pending requests; only the host sees them. */
75
+ requests: AgentRequestInfo[];
76
+ /** True when you may bring the agent in and send it out without asking. */
77
+ canControl: boolean;
78
+ }
79
+ /**
80
+ * What happened to a request to bring the agent in: it is `on`, `awaiting_consent` (asking
81
+ * everyone again), `requested` (the host was asked) or `refused` (a cap, key or trial limit).
82
+ */
83
+ export interface AgentBringInResult {
84
+ status: "on" | "awaiting_consent" | "requested" | "refused";
85
+ agent: "on" | "off" | "ask";
86
+ missing?: {
87
+ userId: string;
88
+ displayName: string;
89
+ }[];
90
+ error?: string;
91
+ }
92
+ export interface ConsentStatus extends ConsentText {
93
+ agentName: string;
94
+ /** People in the room who have not consented to the current text. */
95
+ missing: {
96
+ userId: string;
97
+ displayName: string;
98
+ }[];
99
+ }
100
+ /** A model provider in the onboarding list. Show `copy`; the Gemini entry is `recommended`. */
101
+ export interface OnboardingProvider {
102
+ id: "gemini" | "openai" | "claude";
103
+ label: string;
104
+ recommended: boolean;
105
+ /** You saved a key for this provider. */
106
+ hasKey: boolean;
107
+ /** It can run now (own keys, the product's keys or the trial). */
108
+ usable: boolean;
109
+ keyMode?: "server" | "byok" | "product" | "trial";
110
+ /** Keys still missing to use this provider with your own keys (speech keys are needed too). */
111
+ missingKeys: KeyProviderName[];
112
+ copy: string;
113
+ /** Where to get a (free) key. */
114
+ keyUrl?: string;
115
+ }
116
+ export type KeyProviderName = "gemini" | "deepgram" | "cartesia" | "openai" | "claude";
117
+ export interface TrialInfo {
118
+ limitSeconds: number;
119
+ usedSeconds: number;
120
+ remainingSeconds: number;
121
+ available: boolean;
122
+ }
123
+ export interface ModelSettings {
124
+ llm: {
125
+ provider: "gemini" | "openai" | "claude";
126
+ model?: string;
127
+ };
128
+ /** Which level decided: room, user, product, server or default. */
129
+ source: string;
130
+ usable: boolean;
131
+ problem?: string;
132
+ language: "en" | "pt" | "auto";
133
+ agentName?: string;
134
+ }
135
+ export interface OnboardingInfo {
136
+ /** Intro text that suggests the free Gemini key first. */
137
+ intro: string;
138
+ providers: OnboardingProvider[];
139
+ trial: TrialInfo | null;
140
+ trialAvailable: boolean;
141
+ dataTerms: string;
142
+ current: ModelSettings;
143
+ }
144
+ export interface KeyCheckResult {
145
+ provider: KeyProviderName;
146
+ /** `unchecked`: no cheap check exists for this vendor. `unreachable`: try again. */
147
+ status: "valid" | "invalid" | "unchecked" | "unreachable";
148
+ }
149
+ /** A saved MCP server connection. Tokens are never returned. */
150
+ export interface McpConnection {
151
+ id: string;
152
+ serverUrl: string;
153
+ name: string;
154
+ /** `pending` until the person has consented in the browser. */
155
+ status: "pending" | "connected" | "error";
156
+ error?: string;
157
+ scope?: string;
158
+ createdAt: string;
159
+ connectedAt?: string;
160
+ }
161
+ export interface StartMcpConnectionOptions {
162
+ /** The person's id in your product. Leave out for the standalone app (Firebase sign-in). */
163
+ userId?: string;
164
+ name?: string;
165
+ /** Only the scopes you need; the server's own default when left out. */
166
+ scope?: string;
167
+ /** Where the browser goes after consent. Must be allowed in the server's settings. */
168
+ returnUrl?: string;
169
+ }
170
+ /** How long saved history is kept. */
171
+ export type HistoryRetention = "30d" | "1y" | "forever";
172
+ /** One past call in the list (no transcript). */
173
+ export interface CallListItem {
174
+ roomId: string;
175
+ hostDisplayName: string;
176
+ participants: string[];
177
+ summary: string;
178
+ savedAt: string;
179
+ /** When it is deleted automatically, or null when kept until the host deletes it. */
180
+ expiresAt: string | null;
181
+ }
182
+ /** One past call, in full. Only saved when the host turned "save notes" on; never audio. */
183
+ export interface CallRecord extends CallListItem {
184
+ hostUserId: string;
185
+ transcript: {
186
+ speaker: string;
187
+ text: string;
188
+ at: string;
189
+ }[];
190
+ notes: string[];
191
+ actions: {
192
+ text: string;
193
+ owner?: string;
194
+ done: boolean;
195
+ }[];
196
+ language: "en" | "pt";
197
+ actionLog: {
198
+ text: string;
199
+ at: string;
200
+ }[];
201
+ retention: HistoryRetention;
202
+ startedAt?: string;
203
+ }
204
+ /** Result of {@link OpenBlahApi.startCall}. `livekitUrl` is set when the server knows it. */
205
+ export interface StartedCall {
206
+ roomId: string;
207
+ token: string;
208
+ expiresIn: number;
209
+ livekitUrl?: string;
210
+ }
211
+ export interface OpenBlahApiOptions {
212
+ /** Server base URL including `/v1`, e.g. `https://api.example.com/v1`. */
213
+ baseUrl: string;
214
+ /**
215
+ * Headers for the endpoints that need the host app's credentials (everything
216
+ * except joining by invite). The API key belongs to the host app's backend:
217
+ * point `baseUrl` at a proxy there that adds it, or return it here only in a
218
+ * trusted environment. Never ship the key in a public web bundle.
219
+ */
220
+ headers?: () => Record<string, string> | Promise<Record<string, string>>;
221
+ /** Defaults to the global `fetch`. */
222
+ fetch?: typeof fetch;
223
+ }
224
+ /** Error from the server: `status` is the HTTP status, `message` the server's `error` text. */
225
+ export declare class OpenBlahApiError extends Error {
226
+ readonly status: number;
227
+ readonly body: unknown;
228
+ constructor(status: number, message: string, body: unknown);
229
+ }
230
+ /** Why a product asks the user for their own key. */
231
+ export type KeyRequiredReason = "product_not_paying" | "trial_used";
232
+ /**
233
+ * The server answered `402 key_required`: the product does not pay for this user's voice (any
234
+ * more). Show "Add your own key to keep using voice" and the add-key sheet; never a generic error.
235
+ */
236
+ export declare class KeyRequiredError extends OpenBlahApiError {
237
+ readonly reason: KeyRequiredReason;
238
+ constructor(message: string, reason: KeyRequiredReason, body: unknown);
239
+ }
240
+ /** Result of {@link OpenBlahApi.getKeyStatus}. */
241
+ export interface KeyStatus {
242
+ /** `needs_key`: this user's next voice start will ask for their own key. */
243
+ status: "ok" | "needs_key";
244
+ reason?: KeyRequiredReason;
245
+ }
246
+ /** Typed calls to the OpenBlah server's invite, consent and host-control endpoints. */
247
+ export declare class OpenBlahApi {
248
+ private readonly options;
249
+ private readonly base;
250
+ private readonly doFetch;
251
+ constructor(options: OpenBlahApiOptions);
252
+ /** Start a call as the signed-in user (you are the host). Returns the room and a join token. */
253
+ startCall(opts: {
254
+ displayName: string;
255
+ agent?: "on" | "off" | "ask";
256
+ agentName?: string;
257
+ }): Promise<StartedCall>;
258
+ /** Ask the server to wake the agent worker for the signed-in user. Never throws. */
259
+ warmup(): Promise<"warming" | "warm" | "unavailable" | "limited">;
260
+ createInvite(roomId: string, actorUserId: string, opts?: CreateInviteOptions): Promise<Invite>;
261
+ revokeInvite(roomId: string, inviteId: string, actorUserId: string): Promise<{
262
+ id: string;
263
+ revoked: true;
264
+ }>;
265
+ removeParticipant(roomId: string, userId: string, actorUserId: string): Promise<{
266
+ userId: string;
267
+ removed: true;
268
+ }>;
269
+ endRoom(roomId: string, actorUserId: string): Promise<{
270
+ id: string;
271
+ ended: true;
272
+ }>;
273
+ listParticipants(roomId: string, viewerUserId: string): Promise<RoomParticipant[]>;
274
+ getAgentState(roomId: string, actorUserId: string): Promise<AgentControlState>;
275
+ /** Host (or anyone, if the room allows it) brings the agent in; others leave a request. */
276
+ bringInAgent(roomId: string, actorUserId: string): Promise<AgentBringInResult>;
277
+ sendOutAgent(roomId: string, actorUserId: string): Promise<{
278
+ status: "off";
279
+ agent: "on" | "off" | "ask";
280
+ }>;
281
+ answerAgentRequest(roomId: string, requestId: string, actorUserId: string, approve: boolean): Promise<AgentBringInResult | {
282
+ status: "declined";
283
+ agent: string;
284
+ }>;
285
+ /** Host: "anyone can add the agent" and the idle timeout (`null` goes back to the default). */
286
+ updateAgentSettings(roomId: string, actorUserId: string, settings: {
287
+ anyoneCanAddAgent?: boolean;
288
+ idleTimeoutSeconds?: number | null;
289
+ }): Promise<unknown>;
290
+ getConsent(roomId: string, userId: string): Promise<ConsentStatus>;
291
+ giveConsent(roomId: string, userId: string, textVersion: string): Promise<{
292
+ roomId: string;
293
+ userId: string;
294
+ textVersion: string;
295
+ consentedAt: string;
296
+ }>;
297
+ getOnboarding(userId?: string): Promise<OnboardingInfo>;
298
+ /** Ask the vendor whether a key works. The key is not stored. */
299
+ checkKey(provider: KeyProviderName, key: string, userId?: string): Promise<KeyCheckResult>;
300
+ saveKey(provider: KeyProviderName, key: string, opts: {
301
+ tier: "free" | "paid";
302
+ noTrainingConfirmed?: boolean;
303
+ }, userId?: string): Promise<{
304
+ provider: string;
305
+ tier: string;
306
+ }>;
307
+ /**
308
+ * A product's pre-check: would this user's next voice start need their own key? Call it from
309
+ * your backend proxy or UI to show the banner before they tap. Product users only.
310
+ */
311
+ getKeyStatus(userId: string): Promise<KeyStatus>;
312
+ startTrial(userId?: string): Promise<{
313
+ started: true;
314
+ status: TrialInfo;
315
+ }>;
316
+ getSettings(userId?: string): Promise<ModelSettings>;
317
+ /** Change your model or language setting. `llm: null` goes back to the default. */
318
+ updateSettings(settings: {
319
+ llm?: "gemini" | "openai" | "claude" | {
320
+ provider: string;
321
+ model?: string;
322
+ } | null;
323
+ language?: "en" | "pt" | "auto";
324
+ }, userId?: string): Promise<ModelSettings>;
325
+ /** Room settings: the model, language and agent name for one room (host only to change). */
326
+ getRoomSettings(roomId: string, viewerUserId: string): Promise<ModelSettings>;
327
+ updateRoomSettings(roomId: string, actorUserId: string, settings: {
328
+ llm?: "gemini" | "openai" | "claude" | {
329
+ provider: string;
330
+ model?: string;
331
+ } | null;
332
+ language?: "en" | "pt" | "auto";
333
+ agentName?: string;
334
+ }): Promise<ModelSettings>;
335
+ listCalls(actorUserId: string): Promise<CallListItem[]>;
336
+ getCall(roomId: string, actorUserId: string): Promise<CallRecord>;
337
+ /** Host only: remove everything stored for this call. */
338
+ deleteCall(roomId: string, actorUserId: string): Promise<{
339
+ roomId: string;
340
+ deleted: true;
341
+ existed: boolean;
342
+ }>;
343
+ /** Host only: turn saving notes on or off, and choose how long history is kept. */
344
+ updateHistorySettings(roomId: string, actorUserId: string, settings: {
345
+ saveNotes?: boolean;
346
+ retention?: HistoryRetention;
347
+ }): Promise<{
348
+ saveNotes: boolean;
349
+ retention: HistoryRetention;
350
+ }>;
351
+ /** A guest reads the call they joined, read-only, through their invite token (30 days). */
352
+ getCallWithInvite(token: string): Promise<CallRecord>;
353
+ getInvite(token: string): Promise<InvitePreview>;
354
+ joinWithInvite(token: string, displayName: string, consent: ConsentGrant | null): Promise<GuestJoin>;
355
+ private mcpBase;
356
+ /** Start connecting an MCP server; open `authorizationUrl` for the person to consent. */
357
+ startMcpConnection(url: string, opts?: StartMcpConnectionOptions): Promise<{
358
+ id: string;
359
+ authorizationUrl: string;
360
+ }>;
361
+ listMcpConnections(userId?: string): Promise<McpConnection[]>;
362
+ getMcpConnection(id: string, userId?: string): Promise<McpConnection>;
363
+ testMcpConnection(id: string, userId?: string): Promise<{
364
+ ok: boolean;
365
+ message: string;
366
+ }>;
367
+ /** Disconnect; the server deletes the stored tokens. */
368
+ disconnectMcp(id: string, userId?: string): Promise<void>;
369
+ private call;
370
+ }
package/dist/api.js ADDED
@@ -0,0 +1,249 @@
1
+ /** Error from the server: `status` is the HTTP status, `message` the server's `error` text. */
2
+ export class OpenBlahApiError extends Error {
3
+ status;
4
+ body;
5
+ constructor(status, message, body) {
6
+ super(message);
7
+ this.status = status;
8
+ this.body = body;
9
+ this.name = "OpenBlahApiError";
10
+ }
11
+ }
12
+ /**
13
+ * The server answered `402 key_required`: the product does not pay for this user's voice (any
14
+ * more). Show "Add your own key to keep using voice" and the add-key sheet; never a generic error.
15
+ */
16
+ export class KeyRequiredError extends OpenBlahApiError {
17
+ reason;
18
+ constructor(message, reason, body) {
19
+ super(402, message, body);
20
+ this.reason = reason;
21
+ this.name = "KeyRequiredError";
22
+ }
23
+ }
24
+ /** Typed calls to the OpenBlah server's invite, consent and host-control endpoints. */
25
+ export class OpenBlahApi {
26
+ options;
27
+ base;
28
+ doFetch;
29
+ constructor(options) {
30
+ this.options = options;
31
+ this.base = options.baseUrl.replace(/\/+$/, "");
32
+ this.doFetch = options.fetch ?? ((...a) => fetch(...a));
33
+ }
34
+ // ---- Standalone app: calls and warm-up (the `/me` endpoints, Firebase ID token in `headers`) ----
35
+ /** Start a call as the signed-in user (you are the host). Returns the room and a join token. */
36
+ startCall(opts) {
37
+ return this.call("POST", "/me/calls", { body: opts, auth: true });
38
+ }
39
+ /** Ask the server to wake the agent worker for the signed-in user. Never throws. */
40
+ async warmup() {
41
+ try {
42
+ const r = await this.call("POST", "/me/warmup", {
43
+ body: {},
44
+ auth: true,
45
+ });
46
+ return r.status === "warming" || r.status === "warm" ? r.status : "unavailable";
47
+ }
48
+ catch (e) {
49
+ return e instanceof OpenBlahApiError && e.status === 429 ? "limited" : "unavailable";
50
+ }
51
+ }
52
+ // ---- Host: invites ----
53
+ createInvite(roomId, actorUserId, opts = {}) {
54
+ return this.call("POST", `/rooms/${enc(roomId)}/invites`, {
55
+ body: { actorUserId, ...opts },
56
+ auth: true,
57
+ });
58
+ }
59
+ revokeInvite(roomId, inviteId, actorUserId) {
60
+ return this.call("DELETE", `/rooms/${enc(roomId)}/invites/${enc(inviteId)}`, { query: { actorUserId }, auth: true });
61
+ }
62
+ // ---- Host: controls ----
63
+ removeParticipant(roomId, userId, actorUserId) {
64
+ return this.call("DELETE", `/rooms/${enc(roomId)}/participants/${enc(userId)}`, { query: { actorUserId }, auth: true });
65
+ }
66
+ endRoom(roomId, actorUserId) {
67
+ return this.call("POST", `/rooms/${enc(roomId)}/end`, {
68
+ body: { actorUserId },
69
+ auth: true,
70
+ });
71
+ }
72
+ listParticipants(roomId, viewerUserId) {
73
+ return this.call("GET", `/rooms/${enc(roomId)}/participants`, { query: { viewerUserId }, auth: true }).then((r) => r.participants);
74
+ }
75
+ // ---- Optional agent (T18) ----
76
+ getAgentState(roomId, actorUserId) {
77
+ return this.call("GET", `/rooms/${enc(roomId)}/agent`, {
78
+ query: { actorUserId },
79
+ auth: true,
80
+ });
81
+ }
82
+ /** Host (or anyone, if the room allows it) brings the agent in; others leave a request. */
83
+ bringInAgent(roomId, actorUserId) {
84
+ return this.call("POST", `/rooms/${enc(roomId)}/agent/bring-in`, {
85
+ body: { actorUserId },
86
+ auth: true,
87
+ });
88
+ }
89
+ sendOutAgent(roomId, actorUserId) {
90
+ return this.call("POST", `/rooms/${enc(roomId)}/agent/send-out`, { body: { actorUserId }, auth: true });
91
+ }
92
+ answerAgentRequest(roomId, requestId, actorUserId, approve) {
93
+ return this.call("POST", `/rooms/${enc(roomId)}/agent/requests/${enc(requestId)}/${approve ? "approve" : "decline"}`, { body: { actorUserId }, auth: true });
94
+ }
95
+ /** Host: "anyone can add the agent" and the idle timeout (`null` goes back to the default). */
96
+ updateAgentSettings(roomId, actorUserId, settings) {
97
+ return this.call("PUT", `/rooms/${enc(roomId)}/agent`, {
98
+ body: { actorUserId, ...settings },
99
+ auth: true,
100
+ });
101
+ }
102
+ // ---- Consent ----
103
+ getConsent(roomId, userId) {
104
+ return this.call("GET", `/rooms/${enc(roomId)}/consent`, {
105
+ query: { userId },
106
+ auth: true,
107
+ });
108
+ }
109
+ giveConsent(roomId, userId, textVersion) {
110
+ return this.call("POST", `/rooms/${enc(roomId)}/consent`, { body: { userId, accepted: true, textVersion }, auth: true });
111
+ }
112
+ // ---- Onboarding and settings. `userId` for a product's user; omit it for the standalone
113
+ // app's own signed-in user (the `/me` endpoints, with a Firebase ID token in `headers`). ----
114
+ getOnboarding(userId) {
115
+ return this.call("GET", `${userPath(userId)}/onboarding`, { auth: true });
116
+ }
117
+ /** Ask the vendor whether a key works. The key is not stored. */
118
+ checkKey(provider, key, userId) {
119
+ return this.call("POST", `${userPath(userId)}/keys/${enc(provider)}/check`, {
120
+ body: { key },
121
+ auth: true,
122
+ });
123
+ }
124
+ saveKey(provider, key, opts, userId) {
125
+ return this.call("PUT", `${userPath(userId)}/keys/${enc(provider)}`, { body: { key, ...opts }, auth: true });
126
+ }
127
+ /**
128
+ * A product's pre-check: would this user's next voice start need their own key? Call it from
129
+ * your backend proxy or UI to show the banner before they tap. Product users only.
130
+ */
131
+ getKeyStatus(userId) {
132
+ return this.call("GET", `${userPath(userId)}/key-status`, { auth: true });
133
+ }
134
+ startTrial(userId) {
135
+ return this.call("POST", `${userPath(userId)}/trial/start`, { body: {}, auth: true });
136
+ }
137
+ getSettings(userId) {
138
+ return this.call("GET", `${userPath(userId)}/settings`, { auth: true });
139
+ }
140
+ /** Change your model or language setting. `llm: null` goes back to the default. */
141
+ updateSettings(settings, userId) {
142
+ return this.call("PUT", `${userPath(userId)}/settings`, {
143
+ body: { settings },
144
+ auth: true,
145
+ });
146
+ }
147
+ /** Room settings: the model, language and agent name for one room (host only to change). */
148
+ getRoomSettings(roomId, viewerUserId) {
149
+ return this.call("GET", `/rooms/${enc(roomId)}/settings`, {
150
+ query: { viewerUserId },
151
+ auth: true,
152
+ });
153
+ }
154
+ updateRoomSettings(roomId, actorUserId, settings) {
155
+ return this.call("PUT", `/rooms/${enc(roomId)}/settings`, {
156
+ body: { actorUserId, settings },
157
+ auth: true,
158
+ });
159
+ }
160
+ // ---- Call history (people who were in the call; the host can delete) ----
161
+ listCalls(actorUserId) {
162
+ return this.call("GET", "/history", {
163
+ query: { actorUserId },
164
+ auth: true,
165
+ }).then((r) => r.calls);
166
+ }
167
+ getCall(roomId, actorUserId) {
168
+ return this.call("GET", `/history/${enc(roomId)}`, {
169
+ query: { actorUserId },
170
+ auth: true,
171
+ });
172
+ }
173
+ /** Host only: remove everything stored for this call. */
174
+ deleteCall(roomId, actorUserId) {
175
+ return this.call("DELETE", `/history/${enc(roomId)}`, { query: { actorUserId }, auth: true });
176
+ }
177
+ /** Host only: turn saving notes on or off, and choose how long history is kept. */
178
+ updateHistorySettings(roomId, actorUserId, settings) {
179
+ return this.call("PUT", `/rooms/${enc(roomId)}/history-settings`, { body: { actorUserId, ...settings }, auth: true });
180
+ }
181
+ // ---- Guests (public endpoints, no credentials) ----
182
+ /** A guest reads the call they joined, read-only, through their invite token (30 days). */
183
+ getCallWithInvite(token) {
184
+ return this.call("GET", `/invites/${enc(token)}/history`);
185
+ }
186
+ getInvite(token) {
187
+ return this.call("GET", `/invites/${enc(token)}`);
188
+ }
189
+ joinWithInvite(token, displayName, consent) {
190
+ return this.call("POST", `/invites/${enc(token)}/join`, {
191
+ body: consent ? { displayName, consent } : { displayName },
192
+ });
193
+ }
194
+ // ---- MCP connections (OAuth) ----
195
+ mcpBase(userId) {
196
+ return userId ? `/users/${enc(userId)}/mcp/connections` : "/me/mcp/connections";
197
+ }
198
+ /** Start connecting an MCP server; open `authorizationUrl` for the person to consent. */
199
+ startMcpConnection(url, opts = {}) {
200
+ const { userId, ...rest } = opts;
201
+ return this.call("POST", this.mcpBase(userId), {
202
+ body: { url, ...rest },
203
+ auth: true,
204
+ });
205
+ }
206
+ listMcpConnections(userId) {
207
+ return this.call("GET", this.mcpBase(userId), {
208
+ auth: true,
209
+ }).then((r) => r.connections);
210
+ }
211
+ getMcpConnection(id, userId) {
212
+ return this.call("GET", `${this.mcpBase(userId)}/${enc(id)}`, { auth: true });
213
+ }
214
+ testMcpConnection(id, userId) {
215
+ return this.call("POST", `${this.mcpBase(userId)}/${enc(id)}/test`, { auth: true });
216
+ }
217
+ /** Disconnect; the server deletes the stored tokens. */
218
+ async disconnectMcp(id, userId) {
219
+ await this.call("DELETE", `${this.mcpBase(userId)}/${enc(id)}`, { auth: true });
220
+ }
221
+ async call(method, path, opts = {}) {
222
+ const qs = opts.query ? `?${new URLSearchParams(opts.query)}` : "";
223
+ const headers = {};
224
+ if (opts.body !== undefined)
225
+ headers["content-type"] = "application/json";
226
+ if (opts.auth)
227
+ Object.assign(headers, await this.options.headers?.());
228
+ const res = await this.doFetch(`${this.base}${path}${qs}`, {
229
+ method,
230
+ headers,
231
+ body: opts.body === undefined ? undefined : JSON.stringify(opts.body),
232
+ });
233
+ const data = await res.json().catch(() => null);
234
+ if (!res.ok) {
235
+ const msg = typeof data === "object" && data && "error" in data && typeof data.error === "string"
236
+ ? data.error
237
+ : `request failed (${res.status})`;
238
+ if (res.status === 402 && data?.code === "key_required") {
239
+ const reason = data.reason;
240
+ throw new KeyRequiredError(msg, reason === "trial_used" ? "trial_used" : "product_not_paying", data);
241
+ }
242
+ throw new OpenBlahApiError(res.status, msg, data);
243
+ }
244
+ return data;
245
+ }
246
+ }
247
+ const enc = encodeURIComponent;
248
+ const userPath = (userId) => (userId ? `/users/${enc(userId)}` : "/me");
249
+ //# sourceMappingURL=api.js.map
@@ -0,0 +1 @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