lemma-sdk 0.2.23 → 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.
- package/README.md +3 -3
- package/dist/auth.js +0 -1
- package/dist/browser/lemma-client.js +167 -104
- package/dist/namespaces/assistants.d.ts +21 -3
- package/dist/namespaces/assistants.js +13 -7
- package/dist/namespaces/files.d.ts +9 -4
- package/dist/namespaces/files.js +52 -14
- package/dist/namespaces/records.d.ts +10 -2
- package/dist/namespaces/records.js +15 -9
- package/dist/openapi_client/index.d.ts +6 -5
- package/dist/openapi_client/index.js +2 -2
- package/dist/openapi_client/models/CreateConversationRequest.d.ts +1 -1
- package/dist/openapi_client/models/CreateFolderRequest.d.ts +1 -2
- package/dist/openapi_client/models/CreateTriggerRequest.d.ts +0 -1
- package/dist/openapi_client/models/DatastoreFileUploadRequest.d.ts +1 -1
- package/dist/openapi_client/models/DatastoreQueryRequest.d.ts +9 -0
- package/dist/openapi_client/models/DatastoreQueryResponse.d.ts +7 -0
- package/dist/openapi_client/models/DirectoryTreeNode.d.ts +7 -0
- package/dist/openapi_client/models/DirectoryTreeResponse.d.ts +6 -0
- package/dist/openapi_client/models/DirectoryTreeResponse.js +1 -0
- package/dist/openapi_client/models/FileResponse.d.ts +4 -6
- package/dist/openapi_client/models/FileSearchRequest.d.ts +5 -3
- package/dist/openapi_client/models/FileSearchResultSchema.d.ts +1 -0
- package/dist/openapi_client/models/FileSearchScopeMode.d.ts +4 -0
- package/dist/openapi_client/models/FileSearchScopeMode.js +9 -0
- package/dist/openapi_client/models/TableResponse.d.ts +1 -1
- package/dist/openapi_client/models/TriggerResponse.d.ts +0 -1
- package/dist/openapi_client/models/update.d.ts +2 -2
- package/dist/openapi_client/services/ConversationsService.d.ts +3 -2
- package/dist/openapi_client/services/ConversationsService.js +5 -3
- package/dist/openapi_client/services/FilesService.d.ts +34 -25
- package/dist/openapi_client/services/FilesService.js +75 -47
- package/dist/openapi_client/services/QueryService.d.ts +14 -0
- package/dist/openapi_client/services/QueryService.js +26 -0
- package/dist/openapi_client/services/RecordsService.d.ts +7 -13
- package/dist/openapi_client/services/RecordsService.js +12 -26
- package/dist/react/components/AssistantEmbedded.d.ts +1 -1
- package/dist/react/components/AssistantEmbedded.js +2 -1
- package/dist/react/useAssistantController.d.ts +5 -1
- package/dist/react/useAssistantController.js +7 -3
- package/dist/react/useAssistantSession.d.ts +12 -0
- package/dist/react/useAssistantSession.js +24 -5
- package/dist/types.d.ts +10 -4
- package/package.json +1 -1
- package/dist/openapi_client/models/RecordFilter.d.ts +0 -15
- package/dist/openapi_client/models/RecordFilterOperator.d.ts +0 -10
- package/dist/openapi_client/models/RecordFilterOperator.js +0 -15
- package/dist/openapi_client/models/RecordQueryRequest.d.ts +0 -20
- package/dist/openapi_client/models/RecordSort.d.ts +0 -11
- package/dist/openapi_client/models/RecordSortDirection.d.ts +0 -4
- package/dist/openapi_client/models/RecordSortDirection.js +0 -9
- /package/dist/openapi_client/models/{RecordFilter.js → DatastoreQueryRequest.js} +0 -0
- /package/dist/openapi_client/models/{RecordQueryRequest.js → DatastoreQueryResponse.js} +0 -0
- /package/dist/openapi_client/models/{RecordSort.js → DirectoryTreeNode.js} +0 -0
|
@@ -4,13 +4,13 @@ export class FilesService {
|
|
|
4
4
|
/**
|
|
5
5
|
* List Files
|
|
6
6
|
* @param podId
|
|
7
|
-
* @param
|
|
7
|
+
* @param directoryPath
|
|
8
8
|
* @param limit
|
|
9
9
|
* @param pageToken
|
|
10
10
|
* @returns FileListResponse Successful Response
|
|
11
11
|
* @throws ApiError
|
|
12
12
|
*/
|
|
13
|
-
static fileList(podId,
|
|
13
|
+
static fileList(podId, directoryPath = '/', limit = 100, pageToken) {
|
|
14
14
|
return __request(OpenAPI, {
|
|
15
15
|
method: 'GET',
|
|
16
16
|
url: '/pods/{pod_id}/datastore/files',
|
|
@@ -18,7 +18,7 @@ export class FilesService {
|
|
|
18
18
|
'pod_id': podId,
|
|
19
19
|
},
|
|
20
20
|
query: {
|
|
21
|
-
'
|
|
21
|
+
'directory_path': directoryPath,
|
|
22
22
|
'limit': limit,
|
|
23
23
|
'page_token': pageToken,
|
|
24
24
|
},
|
|
@@ -49,81 +49,86 @@ export class FilesService {
|
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
51
|
/**
|
|
52
|
-
*
|
|
52
|
+
* Delete File
|
|
53
53
|
* @param podId
|
|
54
|
-
* @param
|
|
55
|
-
* @returns
|
|
54
|
+
* @param path
|
|
55
|
+
* @returns DatastoreMessageResponse Successful Response
|
|
56
56
|
* @throws ApiError
|
|
57
57
|
*/
|
|
58
|
-
static
|
|
58
|
+
static fileDelete(podId, path) {
|
|
59
59
|
return __request(OpenAPI, {
|
|
60
|
-
method: '
|
|
61
|
-
url: '/pods/{pod_id}/datastore/files/
|
|
60
|
+
method: 'DELETE',
|
|
61
|
+
url: '/pods/{pod_id}/datastore/files/by-path',
|
|
62
62
|
path: {
|
|
63
63
|
'pod_id': podId,
|
|
64
64
|
},
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
query: {
|
|
66
|
+
'path': path,
|
|
67
|
+
},
|
|
67
68
|
errors: {
|
|
68
69
|
422: `Validation Error`,
|
|
69
70
|
},
|
|
70
71
|
});
|
|
71
72
|
}
|
|
72
73
|
/**
|
|
73
|
-
*
|
|
74
|
+
* Get File
|
|
74
75
|
* @param podId
|
|
75
|
-
* @param
|
|
76
|
-
* @returns
|
|
76
|
+
* @param path
|
|
77
|
+
* @returns FileResponse Successful Response
|
|
77
78
|
* @throws ApiError
|
|
78
79
|
*/
|
|
79
|
-
static
|
|
80
|
+
static fileGet(podId, path) {
|
|
80
81
|
return __request(OpenAPI, {
|
|
81
|
-
method: '
|
|
82
|
-
url: '/pods/{pod_id}/datastore/files/
|
|
82
|
+
method: 'GET',
|
|
83
|
+
url: '/pods/{pod_id}/datastore/files/by-path',
|
|
83
84
|
path: {
|
|
84
85
|
'pod_id': podId,
|
|
85
86
|
},
|
|
86
|
-
|
|
87
|
-
|
|
87
|
+
query: {
|
|
88
|
+
'path': path,
|
|
89
|
+
},
|
|
88
90
|
errors: {
|
|
89
91
|
422: `Validation Error`,
|
|
90
92
|
},
|
|
91
93
|
});
|
|
92
94
|
}
|
|
93
95
|
/**
|
|
94
|
-
*
|
|
96
|
+
* Update File
|
|
95
97
|
* @param podId
|
|
96
|
-
* @param
|
|
97
|
-
* @returns
|
|
98
|
+
* @param formData
|
|
99
|
+
* @returns FileResponse Successful Response
|
|
98
100
|
* @throws ApiError
|
|
99
101
|
*/
|
|
100
|
-
static
|
|
102
|
+
static fileUpdate(podId, formData) {
|
|
101
103
|
return __request(OpenAPI, {
|
|
102
|
-
method: '
|
|
103
|
-
url: '/pods/{pod_id}/datastore/files/
|
|
104
|
+
method: 'PATCH',
|
|
105
|
+
url: '/pods/{pod_id}/datastore/files/by-path',
|
|
104
106
|
path: {
|
|
105
107
|
'pod_id': podId,
|
|
106
|
-
'file_id': fileId,
|
|
107
108
|
},
|
|
109
|
+
formData: formData,
|
|
110
|
+
mediaType: 'multipart/form-data',
|
|
108
111
|
errors: {
|
|
109
112
|
422: `Validation Error`,
|
|
110
113
|
},
|
|
111
114
|
});
|
|
112
115
|
}
|
|
113
116
|
/**
|
|
114
|
-
*
|
|
117
|
+
* Download File
|
|
115
118
|
* @param podId
|
|
116
|
-
* @param
|
|
117
|
-
* @returns
|
|
119
|
+
* @param path
|
|
120
|
+
* @returns any Successful Response
|
|
118
121
|
* @throws ApiError
|
|
119
122
|
*/
|
|
120
|
-
static
|
|
123
|
+
static fileDownload(podId, path) {
|
|
121
124
|
return __request(OpenAPI, {
|
|
122
125
|
method: 'GET',
|
|
123
|
-
url: '/pods/{pod_id}/datastore/files/
|
|
126
|
+
url: '/pods/{pod_id}/datastore/files/download',
|
|
124
127
|
path: {
|
|
125
128
|
'pod_id': podId,
|
|
126
|
-
|
|
129
|
+
},
|
|
130
|
+
query: {
|
|
131
|
+
'path': path,
|
|
127
132
|
},
|
|
128
133
|
errors: {
|
|
129
134
|
422: `Validation Error`,
|
|
@@ -131,42 +136,65 @@ export class FilesService {
|
|
|
131
136
|
});
|
|
132
137
|
}
|
|
133
138
|
/**
|
|
134
|
-
*
|
|
139
|
+
* Create Folder
|
|
135
140
|
* @param podId
|
|
136
|
-
* @param
|
|
137
|
-
* @param formData
|
|
141
|
+
* @param requestBody
|
|
138
142
|
* @returns FileResponse Successful Response
|
|
139
143
|
* @throws ApiError
|
|
140
144
|
*/
|
|
141
|
-
static
|
|
145
|
+
static fileFolderCreate(podId, requestBody) {
|
|
142
146
|
return __request(OpenAPI, {
|
|
143
|
-
method: '
|
|
144
|
-
url: '/pods/{pod_id}/datastore/files/
|
|
147
|
+
method: 'POST',
|
|
148
|
+
url: '/pods/{pod_id}/datastore/files/folders',
|
|
145
149
|
path: {
|
|
146
150
|
'pod_id': podId,
|
|
147
|
-
'file_id': fileId,
|
|
148
151
|
},
|
|
149
|
-
|
|
150
|
-
mediaType: '
|
|
152
|
+
body: requestBody,
|
|
153
|
+
mediaType: 'application/json',
|
|
151
154
|
errors: {
|
|
152
155
|
422: `Validation Error`,
|
|
153
156
|
},
|
|
154
157
|
});
|
|
155
158
|
}
|
|
156
159
|
/**
|
|
157
|
-
*
|
|
160
|
+
* Search Files
|
|
158
161
|
* @param podId
|
|
159
|
-
* @param
|
|
160
|
-
* @returns
|
|
162
|
+
* @param requestBody
|
|
163
|
+
* @returns FileSearchResponse Successful Response
|
|
161
164
|
* @throws ApiError
|
|
162
165
|
*/
|
|
163
|
-
static
|
|
166
|
+
static fileSearch(podId, requestBody) {
|
|
167
|
+
return __request(OpenAPI, {
|
|
168
|
+
method: 'POST',
|
|
169
|
+
url: '/pods/{pod_id}/datastore/files/search',
|
|
170
|
+
path: {
|
|
171
|
+
'pod_id': podId,
|
|
172
|
+
},
|
|
173
|
+
body: requestBody,
|
|
174
|
+
mediaType: 'application/json',
|
|
175
|
+
errors: {
|
|
176
|
+
422: `Validation Error`,
|
|
177
|
+
},
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Get Directory Tree
|
|
182
|
+
* @param podId
|
|
183
|
+
* @param rootPath
|
|
184
|
+
* @param filesPerDirectory
|
|
185
|
+
* @returns DirectoryTreeResponse Successful Response
|
|
186
|
+
* @throws ApiError
|
|
187
|
+
*/
|
|
188
|
+
static fileTree(podId, rootPath = '/', filesPerDirectory = 3) {
|
|
164
189
|
return __request(OpenAPI, {
|
|
165
190
|
method: 'GET',
|
|
166
|
-
url: '/pods/{pod_id}/datastore/files/
|
|
191
|
+
url: '/pods/{pod_id}/datastore/files/tree',
|
|
167
192
|
path: {
|
|
168
193
|
'pod_id': podId,
|
|
169
|
-
|
|
194
|
+
},
|
|
195
|
+
query: {
|
|
196
|
+
'root_path': rootPath,
|
|
197
|
+
'files_per_directory': filesPerDirectory,
|
|
170
198
|
},
|
|
171
199
|
errors: {
|
|
172
200
|
422: `Validation Error`,
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { DatastoreQueryRequest } from '../models/DatastoreQueryRequest.js';
|
|
2
|
+
import type { DatastoreQueryResponse } from '../models/DatastoreQueryResponse.js';
|
|
3
|
+
import type { CancelablePromise } from '../core/CancelablePromise.js';
|
|
4
|
+
export declare class QueryService {
|
|
5
|
+
/**
|
|
6
|
+
* Execute Query
|
|
7
|
+
* Execute a read-only SQL query inside the datastore schema. Joins, aggregates, subqueries, and cross-table reads are allowed as long as the statement is read only.
|
|
8
|
+
* @param podId
|
|
9
|
+
* @param requestBody
|
|
10
|
+
* @returns DatastoreQueryResponse Successful Response
|
|
11
|
+
* @throws ApiError
|
|
12
|
+
*/
|
|
13
|
+
static queryExecute(podId: string, requestBody: DatastoreQueryRequest): CancelablePromise<DatastoreQueryResponse>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { OpenAPI } from '../core/OpenAPI.js';
|
|
2
|
+
import { request as __request } from '../core/request.js';
|
|
3
|
+
export class QueryService {
|
|
4
|
+
/**
|
|
5
|
+
* Execute Query
|
|
6
|
+
* Execute a read-only SQL query inside the datastore schema. Joins, aggregates, subqueries, and cross-table reads are allowed as long as the statement is read only.
|
|
7
|
+
* @param podId
|
|
8
|
+
* @param requestBody
|
|
9
|
+
* @returns DatastoreQueryResponse Successful Response
|
|
10
|
+
* @throws ApiError
|
|
11
|
+
*/
|
|
12
|
+
static queryExecute(podId, requestBody) {
|
|
13
|
+
return __request(OpenAPI, {
|
|
14
|
+
method: 'POST',
|
|
15
|
+
url: '/pods/{pod_id}/datastore/query',
|
|
16
|
+
path: {
|
|
17
|
+
'pod_id': podId,
|
|
18
|
+
},
|
|
19
|
+
body: requestBody,
|
|
20
|
+
mediaType: 'application/json',
|
|
21
|
+
errors: {
|
|
22
|
+
422: `Validation Error`,
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -4,22 +4,26 @@ import type { BulkUpdateRecordsRequest } from '../models/BulkUpdateRecordsReques
|
|
|
4
4
|
import type { CreateRecordRequest } from '../models/CreateRecordRequest.js';
|
|
5
5
|
import type { DatastoreMessageResponse } from '../models/DatastoreMessageResponse.js';
|
|
6
6
|
import type { RecordListResponse } from '../models/RecordListResponse.js';
|
|
7
|
-
import type { RecordQueryRequest } from '../models/RecordQueryRequest.js';
|
|
8
7
|
import type { RecordResponse } from '../models/RecordResponse.js';
|
|
9
8
|
import type { UpdateRecordRequest } from '../models/UpdateRecordRequest.js';
|
|
10
9
|
import type { CancelablePromise } from '../core/CancelablePromise.js';
|
|
11
10
|
export declare class RecordsService {
|
|
12
11
|
/**
|
|
13
12
|
* List Records
|
|
14
|
-
* List table records with token pagination only. Use
|
|
13
|
+
* List table records with token pagination only. Use the datastore query endpoint for joins, aggregates, or custom read-only SQL.
|
|
15
14
|
* @param podId
|
|
16
15
|
* @param tableName
|
|
17
16
|
* @param limit Max number of rows to return.
|
|
17
|
+
* @param offset Row offset for direct pagination.
|
|
18
|
+
* @param sortBy Optional column name to sort by.
|
|
19
|
+
* @param order Sort direction for `sort_by`: `asc` or `desc`.
|
|
20
|
+
* @param filter Optional repeated JSON filters for advanced comparisons. Example: `filter={"field":"amount","op":"gt","value":100}`
|
|
21
|
+
* @param sort Optional repeated JSON sort clauses. Example: `sort={"field":"created_at","direction":"desc"}`
|
|
18
22
|
* @param pageToken Opaque token from a previous response page.
|
|
19
23
|
* @returns RecordListResponse Successful Response
|
|
20
24
|
* @throws ApiError
|
|
21
25
|
*/
|
|
22
|
-
static recordList(podId: string, tableName: string, limit?: number, pageToken?: (string | null)): CancelablePromise<RecordListResponse>;
|
|
26
|
+
static recordList(podId: string, tableName: string, limit?: number, offset?: number, sortBy?: (string | null), order?: string, filter?: (Array<string> | null), sort?: (Array<string> | null), pageToken?: (string | null)): CancelablePromise<RecordListResponse>;
|
|
23
27
|
/**
|
|
24
28
|
* Create Record
|
|
25
29
|
* Insert a record into a table. Reserved tables (`reserved_*`) are system-managed and cannot be mutated through record write endpoints.
|
|
@@ -60,16 +64,6 @@ export declare class RecordsService {
|
|
|
60
64
|
* @throws ApiError
|
|
61
65
|
*/
|
|
62
66
|
static recordBulkUpdate(podId: string, tableName: string, requestBody: BulkUpdateRecordsRequest): CancelablePromise<DatastoreMessageResponse>;
|
|
63
|
-
/**
|
|
64
|
-
* Query Records
|
|
65
|
-
* Query one table with structured filters and sorting. Use this instead of dynamic query parameters when you need filtering. Example filters: `[{"field": "status", "op": "eq", "value": "OPEN"}]`.
|
|
66
|
-
* @param podId
|
|
67
|
-
* @param tableName
|
|
68
|
-
* @param requestBody
|
|
69
|
-
* @returns RecordListResponse Successful Response
|
|
70
|
-
* @throws ApiError
|
|
71
|
-
*/
|
|
72
|
-
static recordQuery(podId: string, tableName: string, requestBody: RecordQueryRequest): CancelablePromise<RecordListResponse>;
|
|
73
67
|
/**
|
|
74
68
|
* Delete Record
|
|
75
69
|
* Delete a record by primary key.
|
|
@@ -3,15 +3,20 @@ import { request as __request } from '../core/request.js';
|
|
|
3
3
|
export class RecordsService {
|
|
4
4
|
/**
|
|
5
5
|
* List Records
|
|
6
|
-
* List table records with token pagination only. Use
|
|
6
|
+
* List table records with token pagination only. Use the datastore query endpoint for joins, aggregates, or custom read-only SQL.
|
|
7
7
|
* @param podId
|
|
8
8
|
* @param tableName
|
|
9
9
|
* @param limit Max number of rows to return.
|
|
10
|
+
* @param offset Row offset for direct pagination.
|
|
11
|
+
* @param sortBy Optional column name to sort by.
|
|
12
|
+
* @param order Sort direction for `sort_by`: `asc` or `desc`.
|
|
13
|
+
* @param filter Optional repeated JSON filters for advanced comparisons. Example: `filter={"field":"amount","op":"gt","value":100}`
|
|
14
|
+
* @param sort Optional repeated JSON sort clauses. Example: `sort={"field":"created_at","direction":"desc"}`
|
|
10
15
|
* @param pageToken Opaque token from a previous response page.
|
|
11
16
|
* @returns RecordListResponse Successful Response
|
|
12
17
|
* @throws ApiError
|
|
13
18
|
*/
|
|
14
|
-
static recordList(podId, tableName, limit = 20, pageToken) {
|
|
19
|
+
static recordList(podId, tableName, limit = 20, offset, sortBy, order = 'asc', filter, sort, pageToken) {
|
|
15
20
|
return __request(OpenAPI, {
|
|
16
21
|
method: 'GET',
|
|
17
22
|
url: '/pods/{pod_id}/datastore/tables/{table_name}/records',
|
|
@@ -21,6 +26,11 @@ export class RecordsService {
|
|
|
21
26
|
},
|
|
22
27
|
query: {
|
|
23
28
|
'limit': limit,
|
|
29
|
+
'offset': offset,
|
|
30
|
+
'sort_by': sortBy,
|
|
31
|
+
'order': order,
|
|
32
|
+
'filter': filter,
|
|
33
|
+
'sort': sort,
|
|
24
34
|
'page_token': pageToken,
|
|
25
35
|
},
|
|
26
36
|
errors: {
|
|
@@ -124,30 +134,6 @@ export class RecordsService {
|
|
|
124
134
|
},
|
|
125
135
|
});
|
|
126
136
|
}
|
|
127
|
-
/**
|
|
128
|
-
* Query Records
|
|
129
|
-
* Query one table with structured filters and sorting. Use this instead of dynamic query parameters when you need filtering. Example filters: `[{"field": "status", "op": "eq", "value": "OPEN"}]`.
|
|
130
|
-
* @param podId
|
|
131
|
-
* @param tableName
|
|
132
|
-
* @param requestBody
|
|
133
|
-
* @returns RecordListResponse Successful Response
|
|
134
|
-
* @throws ApiError
|
|
135
|
-
*/
|
|
136
|
-
static recordQuery(podId, tableName, requestBody) {
|
|
137
|
-
return __request(OpenAPI, {
|
|
138
|
-
method: 'POST',
|
|
139
|
-
url: '/pods/{pod_id}/datastore/tables/{table_name}/records/query',
|
|
140
|
-
path: {
|
|
141
|
-
'pod_id': podId,
|
|
142
|
-
'table_name': tableName,
|
|
143
|
-
},
|
|
144
|
-
body: requestBody,
|
|
145
|
-
mediaType: 'application/json',
|
|
146
|
-
errors: {
|
|
147
|
-
422: `Validation Error`,
|
|
148
|
-
},
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
137
|
/**
|
|
152
138
|
* Delete Record
|
|
153
139
|
* Delete a record by primary key.
|
|
@@ -7,4 +7,4 @@ export interface AssistantEmbeddedProps extends Omit<AssistantExperienceViewProp
|
|
|
7
7
|
enabled?: boolean;
|
|
8
8
|
theme?: AssistantThemeMode;
|
|
9
9
|
}
|
|
10
|
-
export declare function AssistantEmbedded({ client, podId, assistantId, organizationId, enabled, theme, ...props }: AssistantEmbeddedProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare function AssistantEmbedded({ client, podId, assistantName, assistantId, organizationId, enabled, theme, ...props }: AssistantEmbeddedProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,10 +2,11 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useAssistantController } from "../useAssistantController.js";
|
|
3
3
|
import { AssistantThemeScope } from "./AssistantChrome.js";
|
|
4
4
|
import { AssistantExperienceView } from "./AssistantExperience.js";
|
|
5
|
-
export function AssistantEmbedded({ client, podId, assistantId, organizationId, enabled = true, theme = "auto", ...props }) {
|
|
5
|
+
export function AssistantEmbedded({ client, podId, assistantName, assistantId, organizationId, enabled = true, theme = "auto", ...props }) {
|
|
6
6
|
const controller = useAssistantController({
|
|
7
7
|
client,
|
|
8
8
|
podId: podId ?? undefined,
|
|
9
|
+
assistantName: assistantName ?? undefined,
|
|
9
10
|
assistantId: assistantId ?? undefined,
|
|
10
11
|
organizationId: organizationId ?? undefined,
|
|
11
12
|
enabled,
|
|
@@ -2,6 +2,10 @@ import type { LemmaClient } from "../client.js";
|
|
|
2
2
|
import type { AvailableModelInfo, Conversation, ConversationModel } from "../types.js";
|
|
3
3
|
export interface AssistantConversationScope {
|
|
4
4
|
podId?: string | null;
|
|
5
|
+
assistantName?: string | null;
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated Use assistantName instead.
|
|
8
|
+
*/
|
|
5
9
|
assistantId?: string | null;
|
|
6
10
|
organizationId?: string | null;
|
|
7
11
|
}
|
|
@@ -81,4 +85,4 @@ export interface UseAssistantControllerResult {
|
|
|
81
85
|
clearMessages: () => void;
|
|
82
86
|
stop: () => void;
|
|
83
87
|
}
|
|
84
|
-
export declare function useAssistantController({ client, podId, assistantId, organizationId, enabled, }: UseAssistantControllerOptions): UseAssistantControllerResult;
|
|
88
|
+
export declare function useAssistantController({ client, podId, assistantName, assistantId, organizationId, enabled, }: UseAssistantControllerOptions): UseAssistantControllerResult;
|
|
@@ -3,6 +3,7 @@ import { useAssistantRuntime } from "./useAssistantRuntime.js";
|
|
|
3
3
|
import { useAssistantSession } from "./useAssistantSession.js";
|
|
4
4
|
const EMPTY_SCOPE_KEY = JSON.stringify({
|
|
5
5
|
podId: null,
|
|
6
|
+
assistantName: null,
|
|
6
7
|
assistantId: null,
|
|
7
8
|
organizationId: null,
|
|
8
9
|
});
|
|
@@ -538,7 +539,7 @@ function isConversationRunning(status) {
|
|
|
538
539
|
}
|
|
539
540
|
return true;
|
|
540
541
|
}
|
|
541
|
-
export function useAssistantController({ client, podId, assistantId, organizationId, enabled = true, }) {
|
|
542
|
+
export function useAssistantController({ client, podId, assistantName, assistantId, organizationId, enabled = true, }) {
|
|
542
543
|
const [localError, setLocalError] = useState(null);
|
|
543
544
|
const [messages, setMessages] = useState([]);
|
|
544
545
|
const [conversations, setConversations] = useState([]);
|
|
@@ -560,20 +561,23 @@ export function useAssistantController({ client, podId, assistantId, organizatio
|
|
|
560
561
|
const skipInitialLoadConversationIdsRef = useRef(new Set());
|
|
561
562
|
const scope = useMemo(() => ({
|
|
562
563
|
podId: podId ?? null,
|
|
564
|
+
assistantName: assistantName ?? assistantId ?? null,
|
|
563
565
|
assistantId: assistantId ?? null,
|
|
564
566
|
organizationId: organizationId ?? null,
|
|
565
|
-
}), [assistantId, organizationId, podId]);
|
|
567
|
+
}), [assistantId, assistantName, organizationId, podId]);
|
|
566
568
|
const scopeKey = useMemo(() => JSON.stringify({
|
|
567
569
|
podId: scope.podId ?? null,
|
|
570
|
+
assistantName: scope.assistantName ?? null,
|
|
568
571
|
assistantId: scope.assistantId ?? null,
|
|
569
572
|
organizationId: scope.organizationId ?? null,
|
|
570
|
-
}), [scope.assistantId, scope.organizationId, scope.podId]);
|
|
573
|
+
}), [scope.assistantId, scope.assistantName, scope.organizationId, scope.podId]);
|
|
571
574
|
const handleAssistantSessionError = useCallback((sessionError) => {
|
|
572
575
|
setLocalError((prev) => prev || (sessionError instanceof Error ? sessionError.message : "Assistant session failed"));
|
|
573
576
|
}, []);
|
|
574
577
|
const assistantSession = useAssistantSession({
|
|
575
578
|
client,
|
|
576
579
|
podId: scope.podId ?? undefined,
|
|
580
|
+
assistantName: scope.assistantName ?? undefined,
|
|
577
581
|
assistantId: scope.assistantId ?? undefined,
|
|
578
582
|
organizationId: scope.organizationId ?? undefined,
|
|
579
583
|
conversationId: activeConversationId ?? undefined,
|
|
@@ -3,12 +3,20 @@ import { type SseRawEvent } from "../streams.js";
|
|
|
3
3
|
import type { Conversation, ConversationMessage, ConversationModel, CursorPage } from "../types.js";
|
|
4
4
|
interface ConversationScope {
|
|
5
5
|
podId?: string | null;
|
|
6
|
+
assistantName?: string | null;
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated Use assistantName instead.
|
|
9
|
+
*/
|
|
6
10
|
assistantId?: string | null;
|
|
7
11
|
organizationId?: string | null;
|
|
8
12
|
}
|
|
9
13
|
export interface UseAssistantSessionOptions {
|
|
10
14
|
client: LemmaClient;
|
|
11
15
|
podId?: string;
|
|
16
|
+
assistantName?: string;
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated Use assistantName instead.
|
|
19
|
+
*/
|
|
12
20
|
assistantId?: string;
|
|
13
21
|
organizationId?: string;
|
|
14
22
|
conversationId?: string | null;
|
|
@@ -24,6 +32,10 @@ export interface CreateConversationInput {
|
|
|
24
32
|
title?: string | null;
|
|
25
33
|
model?: ConversationModel | null;
|
|
26
34
|
podId?: string | null;
|
|
35
|
+
assistantName?: string | null;
|
|
36
|
+
/**
|
|
37
|
+
* @deprecated Use assistantName instead.
|
|
38
|
+
*/
|
|
27
39
|
assistantId?: string | null;
|
|
28
40
|
organizationId?: string | null;
|
|
29
41
|
setActive?: boolean;
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
}, [
|
|
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
|
|
11
|
-
|
|
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,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,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 = {}));
|