lemma-sdk 0.2.4 → 0.2.6

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.
Files changed (71) hide show
  1. package/README.md +59 -0
  2. package/dist/assistant-events.d.ts +7 -0
  3. package/dist/assistant-events.js +78 -0
  4. package/dist/auth.d.ts +6 -4
  5. package/dist/auth.js +42 -41
  6. package/dist/browser/lemma-client.js +71 -61
  7. package/dist/browser.d.ts +1 -1
  8. package/dist/browser.js +1 -1
  9. package/dist/index.d.ts +7 -1
  10. package/dist/index.js +4 -1
  11. package/dist/namespaces/desks.d.ts +2 -2
  12. package/dist/namespaces/desks.js +7 -7
  13. package/dist/namespaces/icons.js +4 -1
  14. package/dist/openapi_client/index.d.ts +10 -7
  15. package/dist/openapi_client/models/{AgentNode.d.ts → AgentNode_Input.d.ts} +1 -1
  16. package/dist/openapi_client/models/AgentNode_Output.d.ts +11 -0
  17. package/dist/openapi_client/models/AppDescriptorResponse.d.ts +2 -2
  18. package/dist/openapi_client/models/Body_upload_file_files__resource_type___resource_id__upload_post.d.ts +1 -1
  19. package/dist/openapi_client/models/{Body_file_upload.d.ts → DatastoreFileUploadRequest.d.ts} +2 -2
  20. package/dist/openapi_client/models/{DecisionNode.d.ts → DecisionNode_Input.d.ts} +1 -1
  21. package/dist/openapi_client/models/DecisionNode_Output.d.ts +11 -0
  22. package/dist/openapi_client/models/DeskBundleUploadRequest.d.ts +4 -0
  23. package/dist/openapi_client/models/FlowEntity.d.ts +4 -4
  24. package/dist/openapi_client/models/{FunctionNode.d.ts → FunctionNode_Input.d.ts} +1 -1
  25. package/dist/openapi_client/models/FunctionNode_Output.d.ts +11 -0
  26. package/dist/openapi_client/models/FunctionNode_Output.js +1 -0
  27. package/dist/openapi_client/models/IconUploadRequest.d.ts +3 -0
  28. package/dist/openapi_client/models/IconUploadRequest.js +1 -0
  29. package/dist/openapi_client/models/ValidationError.d.ts +2 -0
  30. package/dist/openapi_client/models/WorkflowGraphUpdateRequest.d.ts +4 -4
  31. package/dist/openapi_client/models/{Body_file_update.d.ts → update.d.ts} +2 -2
  32. package/dist/openapi_client/models/update.js +1 -0
  33. package/dist/openapi_client/services/ApplicationsService.d.ts +2 -2
  34. package/dist/openapi_client/services/ApplicationsService.js +3 -3
  35. package/dist/openapi_client/services/DesksService.d.ts +9 -9
  36. package/dist/openapi_client/services/DesksService.js +8 -8
  37. package/dist/openapi_client/services/FilesService.d.ts +4 -4
  38. package/dist/openapi_client/services/IconsService.d.ts +2 -2
  39. package/dist/openapi_client/services/PublicSdkService.d.ts +1 -1
  40. package/dist/openapi_client/services/PublicSdkService.js +1 -1
  41. package/dist/react/index.d.ts +12 -0
  42. package/dist/react/index.js +6 -0
  43. package/dist/react/useAssistantRun.d.ts +1 -1
  44. package/dist/react/useAssistantRun.js +23 -69
  45. package/dist/react/useAssistantRuntime.d.ts +13 -0
  46. package/dist/react/useAssistantRuntime.js +108 -0
  47. package/dist/react/useAssistantSession.d.ts +61 -0
  48. package/dist/react/useAssistantSession.js +278 -0
  49. package/dist/react/useFlowRunHistory.d.ts +19 -0
  50. package/dist/react/useFlowRunHistory.js +77 -0
  51. package/dist/react/useFlowSession.d.ts +39 -0
  52. package/dist/react/useFlowSession.js +195 -0
  53. package/dist/react/useFunctionSession.d.ts +32 -0
  54. package/dist/react/useFunctionSession.js +154 -0
  55. package/dist/react/useTaskSession.d.ts +35 -0
  56. package/dist/react/useTaskSession.js +207 -0
  57. package/dist/run-utils.d.ts +18 -0
  58. package/dist/run-utils.js +62 -0
  59. package/dist/task-events.d.ts +7 -0
  60. package/dist/task-events.js +78 -0
  61. package/dist/types.d.ts +3 -1
  62. package/package.json +1 -1
  63. package/dist/openapi_client/models/Body_icon_upload.d.ts +0 -3
  64. package/dist/openapi_client/models/Body_pod_desk_bundle_upload.d.ts +0 -4
  65. /package/dist/openapi_client/models/{AgentNode.js → AgentNode_Input.js} +0 -0
  66. /package/dist/openapi_client/models/{Body_file_update.js → AgentNode_Output.js} +0 -0
  67. /package/dist/openapi_client/models/{Body_file_upload.js → DatastoreFileUploadRequest.js} +0 -0
  68. /package/dist/openapi_client/models/{Body_icon_upload.js → DecisionNode_Input.js} +0 -0
  69. /package/dist/openapi_client/models/{Body_pod_desk_bundle_upload.js → DecisionNode_Output.js} +0 -0
  70. /package/dist/openapi_client/models/{DecisionNode.js → DeskBundleUploadRequest.js} +0 -0
  71. /package/dist/openapi_client/models/{FunctionNode.js → FunctionNode_Input.js} +0 -0
package/README.md CHANGED
@@ -8,6 +8,12 @@ Official TypeScript SDK for Lemma APIs with pod-scoped namespaces, auth helpers,
8
8
  npm i lemma-sdk
9
9
  ```
10
10
 
11
+ For local workspace development against the checked-out SDK instead of npm:
12
+
13
+ ```bash
14
+ npm i file:../lemma-typescript
15
+ ```
16
+
11
17
  If you want to import as `lemma`, use npm aliasing:
12
18
 
13
19
  ```bash
@@ -69,6 +75,40 @@ const refreshed = await client.auth.refreshAccessToken();
69
75
  client.auth.redirectToAuth({ mode: "signup", redirectUri: safeRedirect });
70
76
  ```
71
77
 
78
+ ### Browser Testing With Injected Token
79
+
80
+ For desk and app testing, the SDK supports a fixed bearer token injected through localStorage.
81
+ This is the only supported browser token-injection path.
82
+
83
+ ```ts
84
+ import { LemmaClient, setTestingToken, clearTestingToken } from "lemma-sdk";
85
+
86
+ setTestingToken("<access-token>");
87
+
88
+ const client = new LemmaClient({
89
+ apiUrl: "/api",
90
+ authUrl: "http://localhost:4173",
91
+ podId: "<pod-id>",
92
+ });
93
+
94
+ await client.initialize();
95
+
96
+ clearTestingToken();
97
+ ```
98
+
99
+ Equivalent manual browser setup:
100
+
101
+ ```js
102
+ localStorage.setItem("lemma_token", "<access-token>");
103
+ window.location.reload();
104
+ ```
105
+
106
+ Notes:
107
+
108
+ - do not pass testing tokens in query parameters
109
+ - prefer a same-origin dev proxy such as Vite `/api` during local browser testing to avoid CORS on `/users/me`
110
+ - production auth should use the normal cookie/session flow
111
+
72
112
  ## Assistants + Agent Runs
73
113
 
74
114
  ### Assistant names (resource key)
@@ -133,6 +173,21 @@ Import from `lemma-sdk/react`:
133
173
  - `AuthGuard`
134
174
  - `useAgentRunStream(...)`
135
175
  - `useAssistantRun(...)`
176
+ - `useAssistantSession(...)`
177
+ - `useTaskSession(...)`
178
+ - `useFunctionSession(...)`
179
+ - `useFlowSession(...)`
180
+
181
+ Core run helpers from `lemma-sdk`:
182
+
183
+ - `normalizeRunStatus(...)`
184
+ - `isTerminalTaskStatus(...)`
185
+ - `isTerminalFunctionStatus(...)`
186
+ - `isTerminalFlowStatus(...)`
187
+ - `parseTaskStreamEvent(...)`
188
+ - `upsertTaskMessage(...)`
189
+ - `parseAssistantStreamEvent(...)`
190
+ - `upsertConversationMessage(...)`
136
191
 
137
192
  Example:
138
193
 
@@ -149,6 +204,10 @@ const { sendMessage, stop, isStreaming } = useAssistantRun({
149
204
  });
150
205
  ```
151
206
 
207
+ For the SDK consumption UI roadmap (AssistantChat / FunctionInvokeForm / FlowRunExperience / RunPanel), see:
208
+
209
+ - `docs/sdk-consumption-ui-v2.md`
210
+
152
211
  ## File Resources
153
212
 
154
213
  ```ts
@@ -0,0 +1,7 @@
1
+ import type { ConversationMessage } from "./types.js";
2
+ export interface ParsedAssistantStreamEvent {
3
+ message?: ConversationMessage;
4
+ status?: string;
5
+ }
6
+ export declare function parseAssistantStreamEvent(value: unknown): ParsedAssistantStreamEvent;
7
+ export declare function upsertConversationMessage(messages: ConversationMessage[], incoming: ConversationMessage): ConversationMessage[];
@@ -0,0 +1,78 @@
1
+ function isRecord(value) {
2
+ return !!value && typeof value === "object" && !Array.isArray(value);
3
+ }
4
+ function normalizeStatus(status) {
5
+ if (typeof status !== "string")
6
+ return undefined;
7
+ const normalized = status.trim().toUpperCase();
8
+ return normalized.length > 0 ? normalized : undefined;
9
+ }
10
+ function toConversationMessage(value) {
11
+ if (!isRecord(value))
12
+ return undefined;
13
+ if (typeof value.id !== "string")
14
+ return undefined;
15
+ if (typeof value.role !== "string")
16
+ return undefined;
17
+ if (!("content" in value))
18
+ return undefined;
19
+ const message = {
20
+ id: value.id,
21
+ role: value.role,
22
+ content: value.content,
23
+ created_at: typeof value.created_at === "string" ? value.created_at : new Date().toISOString(),
24
+ metadata: isRecord(value.metadata) ? value.metadata : null,
25
+ };
26
+ return message;
27
+ }
28
+ function extractPayload(record) {
29
+ if ("data" in record)
30
+ return record.data;
31
+ if ("payload" in record)
32
+ return record.payload;
33
+ return undefined;
34
+ }
35
+ function extractStatus(payload) {
36
+ if (isRecord(payload)) {
37
+ return normalizeStatus(payload.status)
38
+ ?? normalizeStatus(payload.conversation_status)
39
+ ?? normalizeStatus(payload.run_status)
40
+ ?? (isRecord(payload.conversation) ? normalizeStatus(payload.conversation.status) : undefined);
41
+ }
42
+ return normalizeStatus(payload);
43
+ }
44
+ export function parseAssistantStreamEvent(value) {
45
+ const directMessage = toConversationMessage(value);
46
+ if (directMessage) {
47
+ return { message: directMessage };
48
+ }
49
+ if (!isRecord(value)) {
50
+ return {};
51
+ }
52
+ const eventType = typeof value.type === "string" ? value.type.toLowerCase() : "";
53
+ const payload = extractPayload(value);
54
+ if (eventType === "message" || eventType === "message_added") {
55
+ const message = toConversationMessage(payload);
56
+ return message ? { message } : {};
57
+ }
58
+ if (eventType === "status"
59
+ || eventType === "conversation_status"
60
+ || eventType === "conversation_updated"
61
+ || eventType === "run_status") {
62
+ const status = extractStatus(payload);
63
+ return status ? { status } : {};
64
+ }
65
+ return {};
66
+ }
67
+ export function upsertConversationMessage(messages, incoming) {
68
+ const next = [...messages];
69
+ const index = next.findIndex((message) => message.id === incoming.id);
70
+ if (index >= 0) {
71
+ next[index] = incoming;
72
+ }
73
+ else {
74
+ next.push(incoming);
75
+ }
76
+ next.sort((a, b) => new Date(a.created_at).getTime() - new Date(b.created_at).getTime());
77
+ return next;
78
+ }
package/dist/auth.d.ts CHANGED
@@ -3,11 +3,10 @@
3
3
  * for agent/dev testing.
4
4
  *
5
5
  * Auth resolution order on init:
6
- * 1. ?lemma_token=<token> query param (stored in memory for session)
7
- * 2. localStorage.getItem("lemma_token")
8
- * 3. Session cookie (credentials: "include") — production path
6
+ * 1. localStorage.getItem("lemma_token")
7
+ * 2. Session cookie (credentials: "include") — production path
9
8
  *
10
- * If a token is found in (1) or (2), all requests use Authorization: Bearer <token>.
9
+ * If a token is found in (1), all requests use Authorization: Bearer <token>.
11
10
  * Otherwise requests rely on cookies, and the server must set the session cookie
12
11
  * after the user authenticates at the auth service. In cookie mode we initialise
13
12
  * the SuperTokens browser SDK so fetch/XHR automatically handles anti-CSRF and
@@ -47,6 +46,9 @@ export interface ResolveSafeRedirectUriOptions {
47
46
  /** Local paths blocked as redirect targets to avoid auth loops. */
48
47
  blockedPaths?: string[];
49
48
  }
49
+ export declare function setTestingToken(token: string): void;
50
+ export declare function getTestingToken(): string | null;
51
+ export declare function clearTestingToken(): void;
50
52
  export declare function buildAuthUrl(authUrl: string, options?: BuildAuthUrlOptions): string;
51
53
  export declare function resolveSafeRedirectUri(rawValue: string | null | undefined, options: ResolveSafeRedirectUriOptions): string;
52
54
  export declare class AuthManager {
package/dist/auth.js CHANGED
@@ -3,11 +3,10 @@
3
3
  * for agent/dev testing.
4
4
  *
5
5
  * Auth resolution order on init:
6
- * 1. ?lemma_token=<token> query param (stored in memory for session)
7
- * 2. localStorage.getItem("lemma_token")
8
- * 3. Session cookie (credentials: "include") — production path
6
+ * 1. localStorage.getItem("lemma_token")
7
+ * 2. Session cookie (credentials: "include") — production path
9
8
  *
10
- * If a token is found in (1) or (2), all requests use Authorization: Bearer <token>.
9
+ * If a token is found in (1), all requests use Authorization: Bearer <token>.
11
10
  * Otherwise requests rely on cookies, and the server must set the session cookie
12
11
  * after the user authenticates at the auth service. In cookie mode we initialise
13
12
  * the SuperTokens browser SDK so fetch/XHR automatically handles anti-CSRF and
@@ -20,37 +19,52 @@ import Session from "supertokens-web-js/recipe/session";
20
19
  import { ensureCookieSessionSupport } from "./supertokens.js";
21
20
  const DEFAULT_BLOCKED_REDIRECT_PATHS = ["/login", "/signup", "/auth"];
22
21
  const LOCALSTORAGE_TOKEN_KEY = "lemma_token";
23
- const QUERY_PARAM_TOKEN_KEY = "lemma_token";
24
- function detectInjectedToken() {
22
+ function readStorageToken() {
25
23
  if (typeof window === "undefined")
26
24
  return null;
27
- // 1. Query param — highest priority, persist to sessionStorage for this session
28
25
  try {
29
- const params = new URLSearchParams(window.location.search);
30
- const qpToken = params.get(QUERY_PARAM_TOKEN_KEY);
31
- if (qpToken) {
32
- try {
33
- sessionStorage.setItem(LOCALSTORAGE_TOKEN_KEY, qpToken);
34
- }
35
- catch { /* ignore */ }
36
- return qpToken;
37
- }
26
+ return localStorage.getItem(LOCALSTORAGE_TOKEN_KEY);
38
27
  }
39
- catch { /* ignore */ }
40
- // 2. sessionStorage — survives HMR and same-tab navigation
28
+ catch {
29
+ return null;
30
+ }
31
+ }
32
+ function writeStorageToken(token) {
33
+ if (typeof window === "undefined")
34
+ return;
41
35
  try {
42
- const stored = sessionStorage.getItem(LOCALSTORAGE_TOKEN_KEY);
43
- if (stored)
44
- return stored;
36
+ localStorage.setItem(LOCALSTORAGE_TOKEN_KEY, token);
37
+ }
38
+ catch {
39
+ // ignore storage errors
45
40
  }
46
- catch { /* ignore */ }
47
- // 3. localStorage — set manually by dev/agent for persistent testing
41
+ }
42
+ function removeStorageToken() {
43
+ if (typeof window === "undefined")
44
+ return;
48
45
  try {
49
- const stored = localStorage.getItem(LOCALSTORAGE_TOKEN_KEY);
50
- if (stored)
51
- return stored;
46
+ localStorage.removeItem(LOCALSTORAGE_TOKEN_KEY);
47
+ }
48
+ catch {
49
+ // ignore storage errors
52
50
  }
53
- catch { /* ignore */ }
51
+ }
52
+ export function setTestingToken(token) {
53
+ writeStorageToken(token);
54
+ }
55
+ export function getTestingToken() {
56
+ return readStorageToken();
57
+ }
58
+ export function clearTestingToken() {
59
+ removeStorageToken();
60
+ }
61
+ function detectInjectedToken() {
62
+ if (typeof window === "undefined")
63
+ return null;
64
+ // 1. localStorage — the only supported browser testing path
65
+ const localToken = readStorageToken();
66
+ if (localToken)
67
+ return localToken;
54
68
  return null;
55
69
  }
56
70
  function normalizePath(path) {
@@ -182,20 +196,7 @@ export class AuthManager {
182
196
  }
183
197
  clearInjectedToken() {
184
198
  this.injectedToken = null;
185
- if (typeof window === "undefined")
186
- return;
187
- try {
188
- sessionStorage.removeItem(LOCALSTORAGE_TOKEN_KEY);
189
- }
190
- catch {
191
- // ignore storage errors
192
- }
193
- try {
194
- localStorage.removeItem(LOCALSTORAGE_TOKEN_KEY);
195
- }
196
- catch {
197
- // ignore storage errors
198
- }
199
+ clearTestingToken();
199
200
  }
200
201
  async rawSignOutViaBackend() {
201
202
  const antiCsrf = this.getCookie("sAntiCsrf");
@@ -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.resolveSafeRedirectUri = exports.buildAuthUrl = exports.AuthManager = exports.LemmaClient = void 0;
6
+ exports.ApiError = exports.setTestingToken = exports.resolveSafeRedirectUri = exports.getTestingToken = exports.clearTestingToken = exports.buildAuthUrl = exports.AuthManager = exports.LemmaClient = void 0;
7
7
  /**
8
8
  * Browser bundle entry point.
9
9
  * Exposes LemmaClient as globalThis.LemmaClient.LemmaClient
@@ -19,7 +19,10 @@ Object.defineProperty(exports, "LemmaClient", { enumerable: true, get: function
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
21
  Object.defineProperty(exports, "buildAuthUrl", { enumerable: true, get: function () { return auth_js_1.buildAuthUrl; } });
22
+ Object.defineProperty(exports, "clearTestingToken", { enumerable: true, get: function () { return auth_js_1.clearTestingToken; } });
23
+ Object.defineProperty(exports, "getTestingToken", { enumerable: true, get: function () { return auth_js_1.getTestingToken; } });
22
24
  Object.defineProperty(exports, "resolveSafeRedirectUri", { enumerable: true, get: function () { return auth_js_1.resolveSafeRedirectUri; } });
25
+ Object.defineProperty(exports, "setTestingToken", { enumerable: true, get: function () { return auth_js_1.setTestingToken; } });
23
26
  var http_js_1 = require("./http.js");
24
27
  Object.defineProperty(exports, "ApiError", { enumerable: true, get: function () { return http_js_1.ApiError; } });
25
28
 
@@ -179,11 +182,10 @@ function resolveConfig(overrides = {}) {
179
182
  * for agent/dev testing.
180
183
  *
181
184
  * Auth resolution order on init:
182
- * 1. ?lemma_token=<token> query param (stored in memory for session)
183
- * 2. localStorage.getItem("lemma_token")
184
- * 3. Session cookie (credentials: "include") — production path
185
+ * 1. localStorage.getItem("lemma_token")
186
+ * 2. Session cookie (credentials: "include") — production path
185
187
  *
186
- * If a token is found in (1) or (2), all requests use Authorization: Bearer <token>.
188
+ * If a token is found in (1), all requests use Authorization: Bearer <token>.
187
189
  * Otherwise requests rely on cookies, and the server must set the session cookie
188
190
  * after the user authenticates at the auth service. In cookie mode we initialise
189
191
  * the SuperTokens browser SDK so fetch/XHR automatically handles anti-CSRF and
@@ -194,43 +196,61 @@ function resolveConfig(overrides = {}) {
194
196
  */
195
197
  Object.defineProperty(exports, "__esModule", { value: true });
196
198
  exports.AuthManager = void 0;
199
+ exports.setTestingToken = setTestingToken;
200
+ exports.getTestingToken = getTestingToken;
201
+ exports.clearTestingToken = clearTestingToken;
197
202
  exports.buildAuthUrl = buildAuthUrl;
198
203
  exports.resolveSafeRedirectUri = resolveSafeRedirectUri;
199
204
  const session_1 = require("supertokens-web-js/recipe/session");
200
205
  const supertokens_js_1 = require("./supertokens.js");
201
206
  const DEFAULT_BLOCKED_REDIRECT_PATHS = ["/login", "/signup", "/auth"];
202
207
  const LOCALSTORAGE_TOKEN_KEY = "lemma_token";
203
- const QUERY_PARAM_TOKEN_KEY = "lemma_token";
204
- function detectInjectedToken() {
208
+ function readStorageToken() {
205
209
  if (typeof window === "undefined")
206
210
  return null;
207
- // 1. Query param — highest priority, persist to sessionStorage for this session
208
211
  try {
209
- const params = new URLSearchParams(window.location.search);
210
- const qpToken = params.get(QUERY_PARAM_TOKEN_KEY);
211
- if (qpToken) {
212
- try {
213
- sessionStorage.setItem(LOCALSTORAGE_TOKEN_KEY, qpToken);
214
- }
215
- catch { /* ignore */ }
216
- return qpToken;
217
- }
212
+ return localStorage.getItem(LOCALSTORAGE_TOKEN_KEY);
213
+ }
214
+ catch {
215
+ return null;
218
216
  }
219
- catch { /* ignore */ }
220
- // 2. sessionStorage — survives HMR and same-tab navigation
217
+ }
218
+ function writeStorageToken(token) {
219
+ if (typeof window === "undefined")
220
+ return;
221
221
  try {
222
- const stored = sessionStorage.getItem(LOCALSTORAGE_TOKEN_KEY);
223
- if (stored)
224
- return stored;
222
+ localStorage.setItem(LOCALSTORAGE_TOKEN_KEY, token);
225
223
  }
226
- catch { /* ignore */ }
227
- // 3. localStorage — set manually by dev/agent for persistent testing
224
+ catch {
225
+ // ignore storage errors
226
+ }
227
+ }
228
+ function removeStorageToken() {
229
+ if (typeof window === "undefined")
230
+ return;
228
231
  try {
229
- const stored = localStorage.getItem(LOCALSTORAGE_TOKEN_KEY);
230
- if (stored)
231
- return stored;
232
+ localStorage.removeItem(LOCALSTORAGE_TOKEN_KEY);
232
233
  }
233
- catch { /* ignore */ }
234
+ catch {
235
+ // ignore storage errors
236
+ }
237
+ }
238
+ function setTestingToken(token) {
239
+ writeStorageToken(token);
240
+ }
241
+ function getTestingToken() {
242
+ return readStorageToken();
243
+ }
244
+ function clearTestingToken() {
245
+ removeStorageToken();
246
+ }
247
+ function detectInjectedToken() {
248
+ if (typeof window === "undefined")
249
+ return null;
250
+ // 1. localStorage — the only supported browser testing path
251
+ const localToken = readStorageToken();
252
+ if (localToken)
253
+ return localToken;
234
254
  return null;
235
255
  }
236
256
  function normalizePath(path) {
@@ -359,20 +379,7 @@ class AuthManager {
359
379
  }
360
380
  clearInjectedToken() {
361
381
  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
- }
382
+ clearTestingToken();
376
383
  }
377
384
  async rawSignOutViaBackend() {
378
385
  const antiCsrf = this.getCookie("sAntiCsrf");
@@ -1795,29 +1802,29 @@ class DesksNamespace {
1795
1802
  this.http = http;
1796
1803
  this.podId = podId;
1797
1804
  this.html = {
1798
- get: (name) => this.client.request(() => DesksService_js_1.DesksService.podDeskHtmlGet(this.podId(), name)),
1805
+ get: (name) => this.client.request(() => DesksService_js_1.DesksService.deskHtmlGet(this.podId(), name)),
1799
1806
  };
1800
1807
  this.bundle = {
1801
- upload: (name, payload) => this.client.request(() => DesksService_js_1.DesksService.podDeskBundleUpload(this.podId(), name, payload)),
1808
+ upload: (name, payload) => this.client.request(() => DesksService_js_1.DesksService.deskBundleUpload(this.podId(), name, payload)),
1802
1809
  };
1803
1810
  this.source = {
1804
1811
  download: (name) => this.http.requestBytes("GET", `/pods/${this.podId()}/desks/${name}/source/archive`),
1805
1812
  };
1806
1813
  }
1807
1814
  list(options = {}) {
1808
- return this.client.request(() => DesksService_js_1.DesksService.podDeskList(this.podId(), options.limit ?? 100, options.pageToken));
1815
+ return this.client.request(() => DesksService_js_1.DesksService.deskList(this.podId(), options.limit ?? 100, options.pageToken));
1809
1816
  }
1810
1817
  create(payload) {
1811
- return this.client.request(() => DesksService_js_1.DesksService.podDeskCreate(this.podId(), payload));
1818
+ return this.client.request(() => DesksService_js_1.DesksService.deskCreate(this.podId(), payload));
1812
1819
  }
1813
1820
  get(name) {
1814
- return this.client.request(() => DesksService_js_1.DesksService.podDeskGet(this.podId(), name));
1821
+ return this.client.request(() => DesksService_js_1.DesksService.deskGet(this.podId(), name));
1815
1822
  }
1816
1823
  update(name, payload) {
1817
- return this.client.request(() => DesksService_js_1.DesksService.podDeskUpdate(this.podId(), name, payload));
1824
+ return this.client.request(() => DesksService_js_1.DesksService.deskUpdate(this.podId(), name, payload));
1818
1825
  }
1819
1826
  delete(name) {
1820
- return this.client.request(() => DesksService_js_1.DesksService.podDeskDelete(this.podId(), name));
1827
+ return this.client.request(() => DesksService_js_1.DesksService.deskDelete(this.podId(), name));
1821
1828
  }
1822
1829
  }
1823
1830
  exports.DesksNamespace = DesksNamespace;
@@ -1837,7 +1844,7 @@ class DesksService {
1837
1844
  * @returns DeskResponse Successful Response
1838
1845
  * @throws ApiError
1839
1846
  */
1840
- static podDeskCreate(podId, requestBody) {
1847
+ static deskCreate(podId, requestBody) {
1841
1848
  return (0, request_js_1.request)(OpenAPI_js_1.OpenAPI, {
1842
1849
  method: 'POST',
1843
1850
  url: '/pods/{pod_id}/desks',
@@ -1859,7 +1866,7 @@ class DesksService {
1859
1866
  * @returns DeskListResponse Successful Response
1860
1867
  * @throws ApiError
1861
1868
  */
1862
- static podDeskList(podId, limit = 100, pageToken) {
1869
+ static deskList(podId, limit = 100, pageToken) {
1863
1870
  return (0, request_js_1.request)(OpenAPI_js_1.OpenAPI, {
1864
1871
  method: 'GET',
1865
1872
  url: '/pods/{pod_id}/desks',
@@ -1882,7 +1889,7 @@ class DesksService {
1882
1889
  * @returns DeskResponse Successful Response
1883
1890
  * @throws ApiError
1884
1891
  */
1885
- static podDeskGet(podId, deskName) {
1892
+ static deskGet(podId, deskName) {
1886
1893
  return (0, request_js_1.request)(OpenAPI_js_1.OpenAPI, {
1887
1894
  method: 'GET',
1888
1895
  url: '/pods/{pod_id}/desks/{desk_name}',
@@ -1903,7 +1910,7 @@ class DesksService {
1903
1910
  * @returns DeskResponse Successful Response
1904
1911
  * @throws ApiError
1905
1912
  */
1906
- static podDeskUpdate(podId, deskName, requestBody) {
1913
+ static deskUpdate(podId, deskName, requestBody) {
1907
1914
  return (0, request_js_1.request)(OpenAPI_js_1.OpenAPI, {
1908
1915
  method: 'PATCH',
1909
1916
  url: '/pods/{pod_id}/desks/{desk_name}',
@@ -1925,7 +1932,7 @@ class DesksService {
1925
1932
  * @returns DeskMessageResponse Successful Response
1926
1933
  * @throws ApiError
1927
1934
  */
1928
- static podDeskDelete(podId, deskName) {
1935
+ static deskDelete(podId, deskName) {
1929
1936
  return (0, request_js_1.request)(OpenAPI_js_1.OpenAPI, {
1930
1937
  method: 'DELETE',
1931
1938
  url: '/pods/{pod_id}/desks/{desk_name}',
@@ -1946,7 +1953,7 @@ class DesksService {
1946
1953
  * @returns DeskBundleUploadResponse Successful Response
1947
1954
  * @throws ApiError
1948
1955
  */
1949
- static podDeskBundleUpload(podId, deskName, formData) {
1956
+ static deskBundleUpload(podId, deskName, formData) {
1950
1957
  return (0, request_js_1.request)(OpenAPI_js_1.OpenAPI, {
1951
1958
  method: 'POST',
1952
1959
  url: '/pods/{pod_id}/desks/{desk_name}/bundle',
@@ -1968,7 +1975,7 @@ class DesksService {
1968
1975
  * @returns any Successful Response
1969
1976
  * @throws ApiError
1970
1977
  */
1971
- static podDeskHtmlGet(podId, deskName) {
1978
+ static deskHtmlGet(podId, deskName) {
1972
1979
  return (0, request_js_1.request)(OpenAPI_js_1.OpenAPI, {
1973
1980
  method: 'GET',
1974
1981
  url: '/pods/{pod_id}/desks/{desk_name}/html',
@@ -1988,7 +1995,7 @@ class DesksService {
1988
1995
  * @returns any Successful Response
1989
1996
  * @throws ApiError
1990
1997
  */
1991
- static podDeskSourceArchiveGet(podId, deskName) {
1998
+ static deskSourceArchiveGet(podId, deskName) {
1992
1999
  return (0, request_js_1.request)(OpenAPI_js_1.OpenAPI, {
1993
2000
  method: 'GET',
1994
2001
  url: '/pods/{pod_id}/desks/{desk_name}/source/archive',
@@ -2629,7 +2636,10 @@ class IconsNamespace {
2629
2636
  this.client = client;
2630
2637
  }
2631
2638
  upload(file) {
2632
- return this.client.request(() => IconsService_js_1.IconsService.iconUpload({ file }));
2639
+ const payload = {
2640
+ file: file,
2641
+ };
2642
+ return this.client.request(() => IconsService_js_1.IconsService.iconUpload(payload));
2633
2643
  }
2634
2644
  getPublic(iconPath) {
2635
2645
  return this.client.request(() => IconsService_js_1.IconsService.iconPublicGet(iconPath));
@@ -2841,13 +2851,13 @@ class ApplicationsService {
2841
2851
  /**
2842
2852
  * List Application Operations
2843
2853
  * @param applicationId
2844
- * @param search
2854
+ * @param query
2845
2855
  * @param limit
2846
2856
  * @param pageToken
2847
2857
  * @returns OperationListResponse Successful Response
2848
2858
  * @throws ApiError
2849
2859
  */
2850
- static applicationOperationList(applicationId, search, limit = 100, pageToken) {
2860
+ static applicationOperationList(applicationId, query, limit = 100, pageToken) {
2851
2861
  return (0, request_js_1.request)(OpenAPI_js_1.OpenAPI, {
2852
2862
  method: 'GET',
2853
2863
  url: '/integrations/applications/{application_id}/operations',
@@ -2855,7 +2865,7 @@ class ApplicationsService {
2855
2865
  'application_id': applicationId,
2856
2866
  },
2857
2867
  query: {
2858
- 'search': search,
2868
+ 'query': query,
2859
2869
  'limit': limit,
2860
2870
  'page_token': pageToken,
2861
2871
  },
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, buildAuthUrl, resolveSafeRedirectUri } from "./auth.js";
12
+ export { AuthManager, buildAuthUrl, clearTestingToken, getTestingToken, resolveSafeRedirectUri, setTestingToken, } 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, buildAuthUrl, resolveSafeRedirectUri } from "./auth.js";
12
+ export { AuthManager, buildAuthUrl, clearTestingToken, getTestingToken, resolveSafeRedirectUri, setTestingToken, } from "./auth.js";
13
13
  export { ApiError } from "./http.js";
package/dist/index.d.ts CHANGED
@@ -1,11 +1,17 @@
1
1
  export { LemmaClient } from "./client.js";
2
2
  export type { LemmaConfig } from "./client.js";
3
- export { AuthManager, buildAuthUrl, resolveSafeRedirectUri } from "./auth.js";
3
+ export { AuthManager, buildAuthUrl, clearTestingToken, getTestingToken, resolveSafeRedirectUri, setTestingToken, } from "./auth.js";
4
4
  export type { AuthState, AuthListener, AuthStatus, UserInfo, AuthRedirectMode, BuildAuthUrlOptions, ResolveSafeRedirectUriOptions, } from "./auth.js";
5
5
  export { ApiError } from "./http.js";
6
6
  export * from "./types.js";
7
7
  export { readSSE, parseSSEJson } from "./streams.js";
8
8
  export type { SseRawEvent } from "./streams.js";
9
+ export { normalizeRunStatus, isTerminalTaskStatus, isTerminalFunctionStatus, isTerminalFlowStatus, sleep, nextBackoffDelay, } from "./run-utils.js";
10
+ export type { AnyRunStatus } from "./run-utils.js";
11
+ export { parseTaskStreamEvent, upsertTaskMessage } from "./task-events.js";
12
+ export type { ParsedTaskStreamEvent } from "./task-events.js";
13
+ export { parseAssistantStreamEvent, upsertConversationMessage } from "./assistant-events.js";
14
+ export type { ParsedAssistantStreamEvent } from "./assistant-events.js";
9
15
  export type { AgentsNamespace } from "./namespaces/agents.js";
10
16
  export type { AssistantsNamespace, ConversationsNamespace } from "./namespaces/assistants.js";
11
17
  export type { DatastoresNamespace } from "./namespaces/datastores.js";
package/dist/index.js CHANGED
@@ -1,5 +1,8 @@
1
1
  export { LemmaClient } from "./client.js";
2
- export { AuthManager, buildAuthUrl, resolveSafeRedirectUri } from "./auth.js";
2
+ export { AuthManager, buildAuthUrl, clearTestingToken, getTestingToken, resolveSafeRedirectUri, setTestingToken, } from "./auth.js";
3
3
  export { ApiError } from "./http.js";
4
4
  export * from "./types.js";
5
5
  export { readSSE, parseSSEJson } from "./streams.js";
6
+ export { normalizeRunStatus, isTerminalTaskStatus, isTerminalFunctionStatus, isTerminalFlowStatus, sleep, nextBackoffDelay, } from "./run-utils.js";
7
+ export { parseTaskStreamEvent, upsertTaskMessage } from "./task-events.js";
8
+ export { parseAssistantStreamEvent, upsertConversationMessage } from "./assistant-events.js";
@@ -1,7 +1,7 @@
1
1
  import type { GeneratedClientAdapter } from "../generated.js";
2
2
  import type { HttpClient } from "../http.js";
3
- import type { Body_pod_desk_bundle_upload } from "../openapi_client/models/Body_pod_desk_bundle_upload.js";
4
3
  import type { CreateDeskRequest } from "../openapi_client/models/CreateDeskRequest.js";
4
+ import type { DeskBundleUploadRequest } from "../openapi_client/models/DeskBundleUploadRequest.js";
5
5
  import type { UpdateDeskRequest } from "../openapi_client/models/UpdateDeskRequest.js";
6
6
  export declare class DesksNamespace {
7
7
  private readonly client;
@@ -20,7 +20,7 @@ export declare class DesksNamespace {
20
20
  get: (name: string) => Promise<string>;
21
21
  };
22
22
  readonly bundle: {
23
- upload: (name: string, payload: Body_pod_desk_bundle_upload) => Promise<import("../types.js").DeskBundleUploadResponse>;
23
+ upload: (name: string, payload: DeskBundleUploadRequest) => Promise<import("../types.js").DeskBundleUploadResponse>;
24
24
  };
25
25
  readonly source: {
26
26
  download: (name: string) => Promise<Blob>;