lemma-sdk 0.2.22 → 0.2.24

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 (55) hide show
  1. package/README.md +3 -3
  2. package/dist/auth.d.ts +1 -0
  3. package/dist/auth.js +12 -12
  4. package/dist/browser/lemma-client.js +179 -115
  5. package/dist/namespaces/assistants.d.ts +21 -3
  6. package/dist/namespaces/assistants.js +13 -7
  7. package/dist/namespaces/files.d.ts +9 -4
  8. package/dist/namespaces/files.js +52 -14
  9. package/dist/namespaces/records.d.ts +10 -2
  10. package/dist/namespaces/records.js +15 -9
  11. package/dist/openapi_client/index.d.ts +6 -5
  12. package/dist/openapi_client/index.js +2 -2
  13. package/dist/openapi_client/models/CreateConversationRequest.d.ts +1 -1
  14. package/dist/openapi_client/models/CreateFolderRequest.d.ts +1 -2
  15. package/dist/openapi_client/models/CreateTriggerRequest.d.ts +0 -1
  16. package/dist/openapi_client/models/DatastoreFileUploadRequest.d.ts +1 -1
  17. package/dist/openapi_client/models/DatastoreQueryRequest.d.ts +9 -0
  18. package/dist/openapi_client/models/DatastoreQueryResponse.d.ts +7 -0
  19. package/dist/openapi_client/models/DirectoryTreeNode.d.ts +7 -0
  20. package/dist/openapi_client/models/DirectoryTreeResponse.d.ts +6 -0
  21. package/dist/openapi_client/models/DirectoryTreeResponse.js +1 -0
  22. package/dist/openapi_client/models/FileResponse.d.ts +4 -6
  23. package/dist/openapi_client/models/FileSearchRequest.d.ts +5 -3
  24. package/dist/openapi_client/models/FileSearchResultSchema.d.ts +1 -0
  25. package/dist/openapi_client/models/FileSearchScopeMode.d.ts +4 -0
  26. package/dist/openapi_client/models/FileSearchScopeMode.js +9 -0
  27. package/dist/openapi_client/models/TableResponse.d.ts +1 -1
  28. package/dist/openapi_client/models/TriggerResponse.d.ts +0 -1
  29. package/dist/openapi_client/models/update.d.ts +2 -2
  30. package/dist/openapi_client/services/ConversationsService.d.ts +3 -2
  31. package/dist/openapi_client/services/ConversationsService.js +5 -3
  32. package/dist/openapi_client/services/FilesService.d.ts +34 -25
  33. package/dist/openapi_client/services/FilesService.js +75 -47
  34. package/dist/openapi_client/services/QueryService.d.ts +14 -0
  35. package/dist/openapi_client/services/QueryService.js +26 -0
  36. package/dist/openapi_client/services/RecordsService.d.ts +7 -13
  37. package/dist/openapi_client/services/RecordsService.js +12 -26
  38. package/dist/react/components/AssistantEmbedded.d.ts +1 -1
  39. package/dist/react/components/AssistantEmbedded.js +2 -1
  40. package/dist/react/useAssistantController.d.ts +5 -1
  41. package/dist/react/useAssistantController.js +7 -3
  42. package/dist/react/useAssistantSession.d.ts +12 -0
  43. package/dist/react/useAssistantSession.js +24 -5
  44. package/dist/types.d.ts +10 -4
  45. package/package.json +1 -1
  46. package/dist/openapi_client/models/RecordFilter.d.ts +0 -15
  47. package/dist/openapi_client/models/RecordFilterOperator.d.ts +0 -10
  48. package/dist/openapi_client/models/RecordFilterOperator.js +0 -15
  49. package/dist/openapi_client/models/RecordQueryRequest.d.ts +0 -20
  50. package/dist/openapi_client/models/RecordSort.d.ts +0 -11
  51. package/dist/openapi_client/models/RecordSortDirection.d.ts +0 -4
  52. package/dist/openapi_client/models/RecordSortDirection.js +0 -9
  53. /package/dist/openapi_client/models/{RecordFilter.js → DatastoreQueryRequest.js} +0 -0
  54. /package/dist/openapi_client/models/{RecordQueryRequest.js → DatastoreQueryResponse.js} +0 -0
  55. /package/dist/openapi_client/models/{RecordSort.js → DirectoryTreeNode.js} +0 -0
@@ -23,8 +23,14 @@ function normalizeError(error, fallback) {
23
23
  return new Error(fallback);
24
24
  }
25
25
  function normalizeScope(client, defaults, override) {
26
+ const resolvedAssistantName = override?.assistantName
27
+ ?? override?.assistantId
28
+ ?? defaults.assistantName
29
+ ?? defaults.assistantId
30
+ ?? null;
26
31
  return {
27
32
  podId: override?.podId ?? defaults.podId ?? client.podId ?? null,
33
+ assistantName: resolvedAssistantName,
28
34
  assistantId: override?.assistantId ?? defaults.assistantId ?? null,
29
35
  organizationId: override?.organizationId ?? defaults.organizationId ?? null,
30
36
  };
@@ -48,7 +54,7 @@ function resolveResumeInput(input) {
48
54
  return input ?? {};
49
55
  }
50
56
  export function useAssistantSession(options) {
51
- const { client, podId: defaultPodId, assistantId: defaultAssistantId, organizationId: defaultOrganizationId, conversationId: externalConversationId = null, autoLoad = true, autoResume = false, syncOnTurnEnd = false, onEvent, onStatus, onMessage, onError, } = options;
57
+ const { client, podId: defaultPodId, assistantName: defaultAssistantName, assistantId: defaultAssistantId, organizationId: defaultOrganizationId, conversationId: externalConversationId = null, autoLoad = true, autoResume = false, syncOnTurnEnd = false, onEvent, onStatus, onMessage, onError, } = options;
52
58
  const [conversationId, setConversationIdState] = useState(externalConversationId);
53
59
  const [conversation, setConversation] = useState(null);
54
60
  const [status, setStatus] = useState(undefined);
@@ -129,16 +135,17 @@ export function useAssistantSession(options) {
129
135
  }, []);
130
136
  const defaultScope = useMemo(() => ({
131
137
  podId: defaultPodId ?? null,
138
+ assistantName: defaultAssistantName ?? defaultAssistantId ?? null,
132
139
  assistantId: defaultAssistantId ?? null,
133
140
  organizationId: defaultOrganizationId ?? null,
134
- }), [defaultAssistantId, defaultOrganizationId, defaultPodId]);
141
+ }), [defaultAssistantId, defaultAssistantName, defaultOrganizationId, defaultPodId]);
135
142
  const listConversations = useCallback(async (input = {}) => {
136
143
  try {
137
144
  const scope = normalizeScope(client, defaultScope, input.scope);
138
145
  applyPodScope(client, scope.podId);
139
146
  const response = await client.conversations.list({
140
147
  pod_id: scope.podId ?? undefined,
141
- assistant_id: scope.assistantId ?? undefined,
148
+ assistant_name: scope.assistantName ?? scope.assistantId ?? undefined,
142
149
  organization_id: scope.organizationId ?? undefined,
143
150
  limit: input.limit,
144
151
  page_token: input.pageToken,
@@ -165,7 +172,11 @@ export function useAssistantSession(options) {
165
172
  const payload = {
166
173
  title: input.title ?? undefined,
167
174
  pod_id: input.podId ?? defaultPodId ?? client.podId ?? undefined,
168
- assistant_id: input.assistantId ?? defaultAssistantId ?? undefined,
175
+ assistant_name: input.assistantName
176
+ ?? input.assistantId
177
+ ?? defaultAssistantName
178
+ ?? defaultAssistantId
179
+ ?? undefined,
169
180
  organization_id: input.organizationId ?? defaultOrganizationId ?? undefined,
170
181
  model: typeof input.model === "undefined"
171
182
  ? undefined
@@ -181,7 +192,15 @@ export function useAssistantSession(options) {
181
192
  autoResumedKeyRef.current = null;
182
193
  }
183
194
  return created;
184
- }, [clearStreamingText, client, defaultAssistantId, defaultOrganizationId, defaultPodId, setConversationStatus]);
195
+ }, [
196
+ clearStreamingText,
197
+ client,
198
+ defaultAssistantId,
199
+ defaultAssistantName,
200
+ defaultOrganizationId,
201
+ defaultPodId,
202
+ setConversationStatus,
203
+ ]);
185
204
  const refreshConversation = useCallback(async (explicitConversationId) => {
186
205
  const id = explicitConversationId ?? conversationId;
187
206
  if (!id)
package/dist/types.d.ts CHANGED
@@ -1,5 +1,3 @@
1
- import type { RecordFilter as GeneratedRecordFilter } from "./openapi_client/models/RecordFilter.js";
2
- import type { RecordSort as GeneratedRecordSort } from "./openapi_client/models/RecordSort.js";
3
1
  import type { AgentResponse, AssistantResponse, AvailableModels, ConversationMessageResponse, ConversationResponse, CreateAgentRequest, CreateAssistantRequest, CreateTaskRequest, FlowRunEntity, FunctionRunResponse, IconUploadResponse, OrganizationInvitationResponse, OrganizationMemberResponse, OrganizationResponse, PodConfigResponse, PodMemberResponse, PodResponse, TaskMessageResponse, TaskResponse, UpdateAgentRequest, UpdateAssistantRequest, UserResponse } from "./openapi_client/index.js";
4
2
  /** Public ergonomic types. */
5
3
  export interface PageResult<T> {
@@ -7,8 +5,16 @@ export interface PageResult<T> {
7
5
  nextPageToken?: string;
8
6
  total?: number;
9
7
  }
10
- export type RecordFilter = GeneratedRecordFilter;
11
- export type RecordSort = GeneratedRecordSort;
8
+ export interface RecordFilter {
9
+ field: string;
10
+ op: string;
11
+ value?: unknown;
12
+ values?: unknown[];
13
+ }
14
+ export interface RecordSort {
15
+ field: string;
16
+ direction?: "asc" | "desc" | string;
17
+ }
12
18
  export interface ListRecordsOptions {
13
19
  filters?: RecordFilter[];
14
20
  sort?: RecordSort[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lemma-sdk",
3
- "version": "0.2.22",
3
+ "version": "0.2.24",
4
4
  "description": "Official TypeScript SDK for Lemma pod-scoped APIs",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -1,15 +0,0 @@
1
- import type { RecordFilterOperator } from './RecordFilterOperator.js';
2
- export type RecordFilter = {
3
- /**
4
- * Table column name to filter on.
5
- */
6
- field: string;
7
- /**
8
- * Comparison operator to apply.
9
- */
10
- op?: RecordFilterOperator;
11
- /**
12
- * Filter comparison value.
13
- */
14
- value: any;
15
- };
@@ -1,10 +0,0 @@
1
- export declare enum RecordFilterOperator {
2
- EQ = "eq",
3
- NE = "ne",
4
- GT = "gt",
5
- GTE = "gte",
6
- LT = "lt",
7
- LTE = "lte",
8
- LIKE = "like",
9
- ILIKE = "ilike"
10
- }
@@ -1,15 +0,0 @@
1
- /* generated using openapi-typescript-codegen -- do not edit */
2
- /* istanbul ignore file */
3
- /* tslint:disable */
4
- /* eslint-disable */
5
- export var RecordFilterOperator;
6
- (function (RecordFilterOperator) {
7
- RecordFilterOperator["EQ"] = "eq";
8
- RecordFilterOperator["NE"] = "ne";
9
- RecordFilterOperator["GT"] = "gt";
10
- RecordFilterOperator["GTE"] = "gte";
11
- RecordFilterOperator["LT"] = "lt";
12
- RecordFilterOperator["LTE"] = "lte";
13
- RecordFilterOperator["LIKE"] = "like";
14
- RecordFilterOperator["ILIKE"] = "ilike";
15
- })(RecordFilterOperator || (RecordFilterOperator = {}));
@@ -1,20 +0,0 @@
1
- import type { RecordFilter } from './RecordFilter.js';
2
- import type { RecordSort } from './RecordSort.js';
3
- /**
4
- * Structured query contract for listing table records.
5
- */
6
- export type RecordQueryRequest = {
7
- /**
8
- * Structured filter conditions combined with AND semantics. Example: `[{"field": "status", "op": "eq", "value": "OPEN"}]`.
9
- */
10
- filters?: Array<RecordFilter>;
11
- limit?: number;
12
- /**
13
- * Opaque token from a previous response page.
14
- */
15
- page_token?: (string | null);
16
- /**
17
- * Ordered sort clauses. Example: `[{"field": "created_at", "direction": "desc"}]`.
18
- */
19
- sort?: Array<RecordSort>;
20
- };
@@ -1,11 +0,0 @@
1
- import type { RecordSortDirection } from './RecordSortDirection.js';
2
- export type RecordSort = {
3
- /**
4
- * Sort direction.
5
- */
6
- direction?: RecordSortDirection;
7
- /**
8
- * Table column name to sort by.
9
- */
10
- field: string;
11
- };
@@ -1,4 +0,0 @@
1
- export declare enum RecordSortDirection {
2
- ASC = "asc",
3
- DESC = "desc"
4
- }
@@ -1,9 +0,0 @@
1
- /* generated using openapi-typescript-codegen -- do not edit */
2
- /* istanbul ignore file */
3
- /* tslint:disable */
4
- /* eslint-disable */
5
- export var RecordSortDirection;
6
- (function (RecordSortDirection) {
7
- RecordSortDirection["ASC"] = "asc";
8
- RecordSortDirection["DESC"] = "desc";
9
- })(RecordSortDirection || (RecordSortDirection = {}));