lemma-sdk 0.2.2 → 0.2.4

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.
@@ -3,7 +3,7 @@
3
3
  "./browser.js": function (module, exports, require) {
4
4
  "use strict";
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.ApiError = exports.AuthManager = exports.LemmaClient = void 0;
6
+ exports.ApiError = exports.resolveSafeRedirectUri = exports.buildAuthUrl = exports.AuthManager = exports.LemmaClient = void 0;
7
7
  /**
8
8
  * Browser bundle entry point.
9
9
  * Exposes LemmaClient as globalThis.LemmaClient.LemmaClient
@@ -18,6 +18,8 @@ var client_js_1 = require("./client.js");
18
18
  Object.defineProperty(exports, "LemmaClient", { enumerable: true, get: function () { return client_js_1.LemmaClient; } });
19
19
  var auth_js_1 = require("./auth.js");
20
20
  Object.defineProperty(exports, "AuthManager", { enumerable: true, get: function () { return auth_js_1.AuthManager; } });
21
+ Object.defineProperty(exports, "buildAuthUrl", { enumerable: true, get: function () { return auth_js_1.buildAuthUrl; } });
22
+ Object.defineProperty(exports, "resolveSafeRedirectUri", { enumerable: true, get: function () { return auth_js_1.resolveSafeRedirectUri; } });
21
23
  var http_js_1 = require("./http.js");
22
24
  Object.defineProperty(exports, "ApiError", { enumerable: true, get: function () { return http_js_1.ApiError; } });
23
25
 
@@ -50,11 +52,11 @@ const tasks_js_1 = require("./namespaces/tasks.js");
50
52
  const users_js_1 = require("./namespaces/users.js");
51
53
  const workflows_js_1 = require("./namespaces/workflows.js");
52
54
  class LemmaClient {
53
- constructor(overrides = {}) {
55
+ constructor(overrides = {}, internalOptions = {}) {
54
56
  this._config = (0, config_js_1.resolveConfig)(overrides);
55
57
  this._currentPodId = this._config.podId;
56
58
  this._podId = this._config.podId;
57
- this.auth = new auth_js_1.AuthManager(this._config.apiUrl, this._config.authUrl);
59
+ this.auth = internalOptions.authManager ?? new auth_js_1.AuthManager(this._config.apiUrl, this._config.authUrl);
58
60
  this._http = new http_js_1.HttpClient(this._config.apiUrl, this.auth);
59
61
  this._generated = new generated_js_1.GeneratedClientAdapter(this._config.apiUrl, this.auth);
60
62
  const podIdFn = () => {
@@ -89,7 +91,7 @@ class LemmaClient {
89
91
  }
90
92
  /** Return a new client scoped to a specific pod, sharing auth state. */
91
93
  withPod(podId) {
92
- return new LemmaClient({ ...this._config, podId });
94
+ return new LemmaClient({ ...this._config, podId }, { authManager: this.auth });
93
95
  }
94
96
  get podId() {
95
97
  return this._currentPodId;
@@ -192,7 +194,11 @@ function resolveConfig(overrides = {}) {
192
194
  */
193
195
  Object.defineProperty(exports, "__esModule", { value: true });
194
196
  exports.AuthManager = void 0;
197
+ exports.buildAuthUrl = buildAuthUrl;
198
+ exports.resolveSafeRedirectUri = resolveSafeRedirectUri;
199
+ const session_1 = require("supertokens-web-js/recipe/session");
195
200
  const supertokens_js_1 = require("./supertokens.js");
201
+ const DEFAULT_BLOCKED_REDIRECT_PATHS = ["/login", "/signup", "/auth"];
196
202
  const LOCALSTORAGE_TOKEN_KEY = "lemma_token";
197
203
  const QUERY_PARAM_TOKEN_KEY = "lemma_token";
198
204
  function detectInjectedToken() {
@@ -227,6 +233,79 @@ function detectInjectedToken() {
227
233
  catch { /* ignore */ }
228
234
  return null;
229
235
  }
236
+ function normalizePath(path) {
237
+ const trimmed = path.trim();
238
+ if (!trimmed)
239
+ return "/";
240
+ if (trimmed === "/")
241
+ return "/";
242
+ const withLeadingSlash = trimmed.startsWith("/") ? trimmed : `/${trimmed}`;
243
+ return withLeadingSlash.endsWith("/") ? withLeadingSlash.slice(0, -1) : withLeadingSlash;
244
+ }
245
+ function resolveAuthPath(basePath, path) {
246
+ const normalizedBase = normalizePath(basePath);
247
+ if (!path || !path.trim()) {
248
+ return normalizedBase;
249
+ }
250
+ const segment = path.trim().replace(/^\/+/, "");
251
+ if (!segment) {
252
+ return normalizedBase;
253
+ }
254
+ return `${normalizedBase}/${segment}`.replace(/\/{2,}/g, "/");
255
+ }
256
+ function isBlockedLocalPath(pathname, blockedPaths) {
257
+ const normalizedPathname = normalizePath(pathname);
258
+ return blockedPaths.some((rawBlockedPath) => {
259
+ const blockedPath = normalizePath(rawBlockedPath);
260
+ return normalizedPathname === blockedPath || normalizedPathname.startsWith(`${blockedPath}/`);
261
+ });
262
+ }
263
+ function normalizeOrigin(rawOrigin) {
264
+ const parsed = new URL(rawOrigin);
265
+ return parsed.origin;
266
+ }
267
+ function buildAuthUrl(authUrl, options = {}) {
268
+ const url = new URL(authUrl);
269
+ url.pathname = resolveAuthPath(url.pathname, options.path);
270
+ for (const [key, value] of Object.entries(options.params ?? {})) {
271
+ if (value === null || value === undefined)
272
+ continue;
273
+ if (Array.isArray(value)) {
274
+ url.searchParams.delete(key);
275
+ for (const item of value) {
276
+ url.searchParams.append(key, String(item));
277
+ }
278
+ continue;
279
+ }
280
+ url.searchParams.set(key, String(value));
281
+ }
282
+ if (options.mode === "signup") {
283
+ url.searchParams.set("show", "signup");
284
+ }
285
+ if (options.redirectUri && options.redirectUri.trim()) {
286
+ url.searchParams.set("redirect_uri", options.redirectUri);
287
+ }
288
+ return url.toString();
289
+ }
290
+ function resolveSafeRedirectUri(rawValue, options) {
291
+ const siteOrigin = normalizeOrigin(options.siteOrigin);
292
+ const blockedPaths = options.blockedPaths ?? DEFAULT_BLOCKED_REDIRECT_PATHS;
293
+ const fallbackTarget = options.fallback ?? "/";
294
+ const fallback = new URL(fallbackTarget, siteOrigin).toString();
295
+ if (!rawValue || !rawValue.trim()) {
296
+ return fallback;
297
+ }
298
+ try {
299
+ const parsed = new URL(rawValue, siteOrigin);
300
+ if (parsed.origin === siteOrigin && isBlockedLocalPath(parsed.pathname, blockedPaths)) {
301
+ return fallback;
302
+ }
303
+ return parsed.toString();
304
+ }
305
+ catch {
306
+ return fallback;
307
+ }
308
+ }
230
309
  class AuthManager {
231
310
  constructor(apiUrl, authUrl) {
232
311
  this.state = { status: "loading", user: null };
@@ -266,6 +345,109 @@ class AuthManager {
266
345
  this.state = state;
267
346
  this.notify();
268
347
  }
348
+ assertBrowserContext() {
349
+ if (typeof window === "undefined") {
350
+ throw new Error("This auth method is only available in browser environments.");
351
+ }
352
+ }
353
+ getCookie(name) {
354
+ if (typeof document === "undefined")
355
+ return undefined;
356
+ const escaped = name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
357
+ const match = document.cookie.match(new RegExp(`(?:^|; )${escaped}=([^;]*)`));
358
+ return match ? decodeURIComponent(match[1]) : undefined;
359
+ }
360
+ clearInjectedToken() {
361
+ this.injectedToken = null;
362
+ if (typeof window === "undefined")
363
+ return;
364
+ try {
365
+ sessionStorage.removeItem(LOCALSTORAGE_TOKEN_KEY);
366
+ }
367
+ catch {
368
+ // ignore storage errors
369
+ }
370
+ try {
371
+ localStorage.removeItem(LOCALSTORAGE_TOKEN_KEY);
372
+ }
373
+ catch {
374
+ // ignore storage errors
375
+ }
376
+ }
377
+ async rawSignOutViaBackend() {
378
+ const antiCsrf = this.getCookie("sAntiCsrf");
379
+ const headers = {
380
+ Accept: "application/json",
381
+ "Content-Type": "application/json",
382
+ rid: "anti-csrf",
383
+ "fdi-version": "4.2",
384
+ "st-auth-mode": "cookie",
385
+ };
386
+ if (antiCsrf) {
387
+ headers["anti-csrf"] = antiCsrf;
388
+ }
389
+ const separator = this.apiUrl.includes("?") ? "&" : "?";
390
+ const signOutUrl = `${this.apiUrl.replace(/\/$/, "")}/st/auth/signout${separator}superTokensDoNotDoInterception=true`;
391
+ await fetch(signOutUrl, {
392
+ method: "POST",
393
+ credentials: "include",
394
+ headers,
395
+ });
396
+ }
397
+ /**
398
+ * Check whether a cookie-backed session is active without mutating auth state.
399
+ */
400
+ async isAuthenticatedViaCookie() {
401
+ if (this.injectedToken) {
402
+ return this.isAuthenticated();
403
+ }
404
+ try {
405
+ const response = await fetch(`${this.apiUrl}/users/me`, {
406
+ method: "GET",
407
+ credentials: "include",
408
+ headers: { Accept: "application/json" },
409
+ });
410
+ return response.status !== 401;
411
+ }
412
+ catch {
413
+ return false;
414
+ }
415
+ }
416
+ /**
417
+ * Return a browser access token from the session layer.
418
+ * Throws if no token is available.
419
+ */
420
+ async getAccessToken() {
421
+ if (this.injectedToken) {
422
+ return this.injectedToken;
423
+ }
424
+ this.assertBrowserContext();
425
+ (0, supertokens_js_1.ensureCookieSessionSupport)(this.apiUrl, () => this.markUnauthenticated());
426
+ const token = await session_1.default.getAccessToken();
427
+ if (!token) {
428
+ throw new Error("Token unavailable");
429
+ }
430
+ return token;
431
+ }
432
+ /**
433
+ * Force a refresh-token flow and return the new access token.
434
+ */
435
+ async refreshAccessToken() {
436
+ if (this.injectedToken) {
437
+ return this.injectedToken;
438
+ }
439
+ this.assertBrowserContext();
440
+ (0, supertokens_js_1.ensureCookieSessionSupport)(this.apiUrl, () => this.markUnauthenticated());
441
+ const refreshed = await session_1.default.attemptRefreshingSession();
442
+ if (!refreshed) {
443
+ throw new Error("Session refresh failed");
444
+ }
445
+ const token = await session_1.default.getAccessToken();
446
+ if (!token) {
447
+ throw new Error("Token unavailable");
448
+ }
449
+ return token;
450
+ }
269
451
  /**
270
452
  * Build request headers for an API call.
271
453
  * Uses Bearer token if one was injected, otherwise omits Authorization
@@ -324,17 +506,55 @@ class AuthManager {
324
506
  markUnauthenticated() {
325
507
  this.setState({ status: "unauthenticated", user: null });
326
508
  }
509
+ /**
510
+ * Sign out the current user session.
511
+ * Returns true when the session is no longer active.
512
+ */
513
+ async signOut() {
514
+ if (this.injectedToken) {
515
+ this.clearInjectedToken();
516
+ this.markUnauthenticated();
517
+ return true;
518
+ }
519
+ this.assertBrowserContext();
520
+ (0, supertokens_js_1.ensureCookieSessionSupport)(this.apiUrl, () => this.markUnauthenticated());
521
+ try {
522
+ await session_1.default.signOut();
523
+ }
524
+ catch {
525
+ // continue with raw fallback
526
+ }
527
+ if (await this.isAuthenticatedViaCookie()) {
528
+ try {
529
+ await this.rawSignOutViaBackend();
530
+ }
531
+ catch {
532
+ // best effort fallback only
533
+ }
534
+ }
535
+ const isAuthenticated = await this.isAuthenticatedViaCookie();
536
+ if (!isAuthenticated) {
537
+ this.markUnauthenticated();
538
+ }
539
+ return !isAuthenticated;
540
+ }
541
+ /**
542
+ * Build auth URL for login/signup/custom auth sub-path.
543
+ */
544
+ getAuthUrl(options = {}) {
545
+ return buildAuthUrl(this.authUrl, options);
546
+ }
327
547
  /**
328
548
  * Redirect to the auth service, passing the current URL as redirect_uri.
329
549
  * After the user authenticates, the auth service should redirect back to
330
550
  * the original URL and set the session cookie.
331
551
  */
332
- redirectToAuth() {
552
+ redirectToAuth(options = {}) {
333
553
  if (typeof window === "undefined") {
334
554
  return;
335
555
  }
336
- const redirectUri = encodeURIComponent(window.location.href);
337
- window.location.href = `${this.authUrl}?redirect_uri=${redirectUri}`;
556
+ const redirectUri = options.redirectUri ?? window.location.href;
557
+ window.location.href = this.getAuthUrl({ ...options, redirectUri });
338
558
  }
339
559
  }
340
560
  exports.AuthManager = AuthManager;
@@ -1241,8 +1461,7 @@ class AssistantsNamespace {
1241
1461
  return this.http.request("GET", `/pods/${this.podId()}/assistants`, {
1242
1462
  params: {
1243
1463
  limit: options.limit ?? 100,
1244
- page_token: options.pageToken ?? options.cursor,
1245
- cursor: options.cursor,
1464
+ page_token: options.page_token,
1246
1465
  },
1247
1466
  });
1248
1467
  }
@@ -1269,16 +1488,14 @@ class ConversationsNamespace {
1269
1488
  this.messages = {
1270
1489
  list: (conversationId, options = {}) => this.http.request("GET", `/conversations/${conversationId}/messages`, {
1271
1490
  params: {
1272
- pod_id: this.resolvePodId(options.podId),
1491
+ pod_id: this.resolvePodId(options.pod_id),
1273
1492
  limit: options.limit ?? 20,
1274
- page_token: options.pageToken ?? options.cursor,
1275
- cursor: options.cursor,
1276
- order: options.order,
1493
+ page_token: options.page_token,
1277
1494
  },
1278
1495
  }),
1279
1496
  send: (conversationId, payload, options = {}) => this.http.request("POST", `/conversations/${conversationId}/messages`, {
1280
1497
  params: {
1281
- pod_id: this.resolvePodId(options.podId),
1498
+ pod_id: this.resolvePodId(options.pod_id),
1282
1499
  },
1283
1500
  body: payload,
1284
1501
  }),
@@ -1305,58 +1522,55 @@ class ConversationsNamespace {
1305
1522
  list(options = {}) {
1306
1523
  return this.http.request("GET", "/conversations", {
1307
1524
  params: {
1308
- assistant_id: options.assistantName ?? options.assistantId,
1309
- pod_id: this.resolvePodId(options.podId),
1310
- organization_id: options.organizationId,
1525
+ assistant_id: options.assistant_id,
1526
+ pod_id: this.resolvePodId(options.pod_id),
1527
+ organization_id: options.organization_id,
1311
1528
  limit: options.limit ?? 20,
1312
- page_token: options.pageToken ?? options.cursor,
1313
- cursor: options.cursor,
1529
+ page_token: options.page_token,
1314
1530
  },
1315
1531
  });
1316
1532
  }
1317
- listByAssistant(assistantName, options = {}) {
1318
- return this.list({ ...options, assistantName });
1533
+ listByAssistant(assistantId, options = {}) {
1534
+ return this.list({ ...options, assistant_id: assistantId });
1319
1535
  }
1320
1536
  create(payload) {
1321
1537
  return this.http.request("POST", "/conversations", {
1322
1538
  body: {
1323
1539
  ...payload,
1324
- assistant_id: payload.assistant_id ?? payload.assistant_name,
1325
1540
  pod_id: this.resolvePodId(payload.pod_id),
1326
1541
  },
1327
1542
  });
1328
1543
  }
1329
- createForAssistant(assistantName, payload = {}) {
1544
+ createForAssistant(assistantId, payload = {}) {
1330
1545
  return this.create({
1331
1546
  ...payload,
1332
- assistant_name: assistantName,
1333
- pod_id: payload.pod_id,
1547
+ assistant_id: assistantId,
1334
1548
  });
1335
1549
  }
1336
1550
  get(conversationId, options = {}) {
1337
1551
  return this.http.request("GET", `/conversations/${conversationId}`, {
1338
1552
  params: {
1339
- pod_id: this.resolvePodId(options.podId),
1553
+ pod_id: this.resolvePodId(options.pod_id),
1340
1554
  },
1341
1555
  });
1342
1556
  }
1343
1557
  update(conversationId, payload, options = {}) {
1344
1558
  return this.http.request("PATCH", `/conversations/${conversationId}`, {
1345
1559
  params: {
1346
- pod_id: this.resolvePodId(options.podId),
1560
+ pod_id: this.resolvePodId(options.pod_id),
1347
1561
  },
1348
1562
  body: payload,
1349
1563
  });
1350
1564
  }
1351
1565
  delete(conversationId, options = {}) {
1352
- const scopedPodId = this.requirePodId(options.podId);
1566
+ const scopedPodId = this.requirePodId(options.pod_id);
1353
1567
  return this.http.request("DELETE", `/pods/${scopedPodId}/conversations/${conversationId}`);
1354
1568
  }
1355
1569
  sendMessageStream(conversationId, payload, options = {}) {
1356
1570
  return this.http.stream(`/conversations/${conversationId}/messages`, {
1357
1571
  method: "POST",
1358
1572
  params: {
1359
- pod_id: this.resolvePodId(options.podId),
1573
+ pod_id: this.resolvePodId(options.pod_id),
1360
1574
  },
1361
1575
  body: payload,
1362
1576
  signal: options.signal,
@@ -1369,7 +1583,7 @@ class ConversationsNamespace {
1369
1583
  resumeStream(conversationId, options = {}) {
1370
1584
  return this.http.stream(`/conversations/${conversationId}/stream`, {
1371
1585
  params: {
1372
- pod_id: this.resolvePodId(options.podId),
1586
+ pod_id: this.resolvePodId(options.pod_id),
1373
1587
  },
1374
1588
  signal: options.signal,
1375
1589
  headers: {
@@ -1380,7 +1594,7 @@ class ConversationsNamespace {
1380
1594
  stopRun(conversationId, options = {}) {
1381
1595
  return this.http.request("PATCH", `/conversations/${conversationId}/stop`, {
1382
1596
  params: {
1383
- pod_id: this.resolvePodId(options.podId),
1597
+ pod_id: this.resolvePodId(options.pod_id),
1384
1598
  },
1385
1599
  body: {},
1386
1600
  });
@@ -3973,14 +4187,15 @@ class ResourcesNamespace {
3973
4187
  return this.http.request("GET", `/files/${resourceType}/${resourceId}/list`, {
3974
4188
  params: {
3975
4189
  path: options.path,
4190
+ limit: options.limit ?? 100,
4191
+ page_token: options.page_token,
3976
4192
  },
3977
4193
  });
3978
4194
  }
3979
4195
  upload(resourceType, resourceId, file, options = {}) {
3980
4196
  const formData = new FormData();
3981
- const fieldName = options.fieldName ?? "file";
3982
4197
  const name = options.name ?? (file instanceof File ? file.name : "upload.bin");
3983
- formData.append(fieldName, file, name);
4198
+ formData.append("file", file, name);
3984
4199
  return this.http.request("POST", `/files/${resourceType}/${resourceId}/upload`, {
3985
4200
  params: {
3986
4201
  path: options.path,
@@ -4242,12 +4457,10 @@ class TasksNamespace {
4242
4457
  list: (taskId, options = {}) => this.http.request("GET", `/pods/${this.podId()}/tasks/${taskId}/messages`, {
4243
4458
  params: {
4244
4459
  limit: options.limit ?? 100,
4245
- page_token: options.pageToken ?? options.cursor,
4246
- cursor: options.cursor,
4460
+ page_token: options.page_token,
4247
4461
  },
4248
4462
  }),
4249
- add: (taskId, content) => {
4250
- const payload = { content };
4463
+ add: (taskId, payload) => {
4251
4464
  return this.http.request("POST", `/pods/${this.podId()}/tasks/${taskId}/messages`, {
4252
4465
  body: payload,
4253
4466
  });
@@ -4257,25 +4470,15 @@ class TasksNamespace {
4257
4470
  list(options = {}) {
4258
4471
  return this.http.request("GET", `/pods/${this.podId()}/tasks`, {
4259
4472
  params: {
4260
- agent_name: options.agentName,
4261
- agent_id: options.agentId,
4473
+ agent_name: options.agent_name,
4262
4474
  limit: options.limit ?? 100,
4263
- page_token: options.pageToken ?? options.cursor,
4264
- cursor: options.cursor,
4475
+ page_token: options.page_token,
4265
4476
  },
4266
4477
  });
4267
4478
  }
4268
- create(options) {
4269
- if (!options.agentId && !options.agentName) {
4270
- throw new Error("Either agentId or agentName is required.");
4271
- }
4479
+ create(payload) {
4272
4480
  return this.http.request("POST", `/pods/${this.podId()}/tasks`, {
4273
- body: {
4274
- agent_id: options.agentId,
4275
- agent_name: options.agentName ?? options.agentId,
4276
- input_data: options.input,
4277
- runtime_account_ids: options.runtimeAccountIds,
4278
- },
4481
+ body: payload,
4279
4482
  });
4280
4483
  }
4281
4484
  get(taskId) {
package/dist/browser.d.ts CHANGED
@@ -9,5 +9,5 @@
9
9
  * </script>
10
10
  */
11
11
  export { LemmaClient } from "./client.js";
12
- export { AuthManager } from "./auth.js";
12
+ export { AuthManager, buildAuthUrl, resolveSafeRedirectUri } from "./auth.js";
13
13
  export { ApiError } from "./http.js";
package/dist/browser.js CHANGED
@@ -9,5 +9,5 @@
9
9
  * </script>
10
10
  */
11
11
  export { LemmaClient } from "./client.js";
12
- export { AuthManager } from "./auth.js";
12
+ export { AuthManager, buildAuthUrl, resolveSafeRedirectUri } from "./auth.js";
13
13
  export { ApiError } from "./http.js";
package/dist/client.d.ts CHANGED
@@ -21,6 +21,9 @@ import { WorkflowsNamespace } from "./namespaces/workflows.js";
21
21
  export type { LemmaConfig };
22
22
  export { AuthManager };
23
23
  export type { AuthState, AuthListener };
24
+ interface LemmaClientInternalOptions {
25
+ authManager?: AuthManager;
26
+ }
24
27
  export declare class LemmaClient {
25
28
  private readonly _config;
26
29
  private readonly _podId;
@@ -48,7 +51,7 @@ export declare class LemmaClient {
48
51
  readonly podMembers: PodMembersNamespace;
49
52
  readonly organizations: OrganizationsNamespace;
50
53
  readonly podSurfaces: PodSurfacesNamespace;
51
- constructor(overrides?: Partial<LemmaConfig>);
54
+ constructor(overrides?: Partial<LemmaConfig>, internalOptions?: LemmaClientInternalOptions);
52
55
  /** Change the active pod ID for subsequent calls. */
53
56
  setPodId(podId: string): void;
54
57
  /** Return a new client scoped to a specific pod, sharing auth state. */
package/dist/client.js CHANGED
@@ -49,11 +49,11 @@ export class LemmaClient {
49
49
  podMembers;
50
50
  organizations;
51
51
  podSurfaces;
52
- constructor(overrides = {}) {
52
+ constructor(overrides = {}, internalOptions = {}) {
53
53
  this._config = resolveConfig(overrides);
54
54
  this._currentPodId = this._config.podId;
55
55
  this._podId = this._config.podId;
56
- this.auth = new AuthManager(this._config.apiUrl, this._config.authUrl);
56
+ this.auth = internalOptions.authManager ?? new AuthManager(this._config.apiUrl, this._config.authUrl);
57
57
  this._http = new HttpClient(this._config.apiUrl, this.auth);
58
58
  this._generated = new GeneratedClientAdapter(this._config.apiUrl, this.auth);
59
59
  const podIdFn = () => {
@@ -88,7 +88,7 @@ export class LemmaClient {
88
88
  }
89
89
  /** Return a new client scoped to a specific pod, sharing auth state. */
90
90
  withPod(podId) {
91
- return new LemmaClient({ ...this._config, podId });
91
+ return new LemmaClient({ ...this._config, podId }, { authManager: this.auth });
92
92
  }
93
93
  get podId() {
94
94
  return this._currentPodId;
package/dist/index.d.ts CHANGED
@@ -1,12 +1,11 @@
1
1
  export { LemmaClient } from "./client.js";
2
2
  export type { LemmaConfig } from "./client.js";
3
- export { AuthManager } from "./auth.js";
4
- export type { AuthState, AuthListener, AuthStatus, UserInfo } from "./auth.js";
3
+ export { AuthManager, buildAuthUrl, resolveSafeRedirectUri } from "./auth.js";
4
+ export type { AuthState, AuthListener, AuthStatus, UserInfo, AuthRedirectMode, BuildAuthUrlOptions, ResolveSafeRedirectUriOptions, } from "./auth.js";
5
5
  export { ApiError } from "./http.js";
6
- export type { Agent, Assistant, Conversation, ConversationMessage, ConversationModel, CreateAgentInput, CreateAssistantInput, CreateTaskOptions, CursorPage, ListRecordsOptions, Organization, OrganizationInvitation, OrganizationMember, Pod, PodConfig, PodMember, RecordFilter, RecordSort, RunFunctionOptions, StreamOptions, Task, TaskMessage, UpdateAgentInput, UpdateAssistantInput, UploadedIcon, User, WorkflowRunInputs, } from "./types.js";
6
+ export * from "./types.js";
7
7
  export { readSSE, parseSSEJson } from "./streams.js";
8
8
  export type { SseRawEvent } from "./streams.js";
9
- export * from "./openapi_client/index.js";
10
9
  export type { AgentsNamespace } from "./namespaces/agents.js";
11
10
  export type { AssistantsNamespace, ConversationsNamespace } from "./namespaces/assistants.js";
12
11
  export type { DatastoresNamespace } from "./namespaces/datastores.js";
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export { LemmaClient } from "./client.js";
2
- export { AuthManager } from "./auth.js";
2
+ export { AuthManager, buildAuthUrl, resolveSafeRedirectUri } from "./auth.js";
3
3
  export { ApiError } from "./http.js";
4
+ export * from "./types.js";
4
5
  export { readSSE, parseSSEJson } from "./streams.js";
5
- export * from "./openapi_client/index.js";
@@ -8,9 +8,9 @@ export declare class AgentsNamespace {
8
8
  list(options?: {
9
9
  limit?: number;
10
10
  pageToken?: string;
11
- }): Promise<import("../index.js").AgentListResponse>;
12
- create(payload: CreateAgentRequest): Promise<import("../index.js").AgentResponse>;
13
- get(agentName: string): Promise<import("../index.js").AgentResponse>;
14
- update(agentName: string, payload: UpdateAgentRequest): Promise<import("../index.js").AgentResponse>;
15
- delete(agentName: string): Promise<import("../index.js").AgentMessageResponse>;
11
+ }): Promise<import("../types.js").AgentListResponse>;
12
+ create(payload: CreateAgentRequest): Promise<import("../types.js").AgentResponse>;
13
+ get(agentName: string): Promise<import("../types.js").AgentResponse>;
14
+ update(agentName: string, payload: UpdateAgentRequest): Promise<import("../types.js").AgentResponse>;
15
+ delete(agentName: string): Promise<import("../types.js").AgentMessageResponse>;
16
16
  }