lemma-sdk 0.2.41 → 0.2.43
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 +5 -2
- package/dist/browser/lemma-client.js +22 -61
- package/dist/namespaces/conversations.d.ts +6 -0
- package/dist/namespaces/conversations.js +2 -0
- package/dist/namespaces/files.js +12 -21
- package/dist/openapi_client/index.d.ts +2 -1
- package/dist/openapi_client/index.js +2 -1
- package/dist/openapi_client/models/ConversationResponse.d.ts +5 -0
- package/dist/openapi_client/models/ConversationStatus.d.ts +11 -0
- package/dist/openapi_client/models/ConversationStatus.js +16 -0
- package/dist/openapi_client/models/ConversationType.d.ts +7 -0
- package/dist/openapi_client/models/ConversationType.js +12 -0
- package/dist/openapi_client/models/CreateConversationRequest.d.ts +3 -0
- package/dist/openapi_client/models/CreateFolderRequest.d.ts +0 -3
- package/dist/openapi_client/models/DatastoreFileUploadRequest.d.ts +0 -2
- package/dist/openapi_client/models/FileResponse.d.ts +0 -2
- package/dist/openapi_client/models/UpdateConversationRequest.d.ts +1 -0
- package/dist/openapi_client/models/update.d.ts +0 -3
- package/dist/openapi_client/services/AgentConversationsService.d.ts +5 -1
- package/dist/openapi_client/services/AgentConversationsService.js +5 -1
- package/dist/openapi_client/services/FilesService.d.ts +8 -17
- package/dist/openapi_client/services/FilesService.js +8 -25
- package/dist/react/AuthGuard.d.ts +2 -16
- package/dist/react/AuthGuard.js +130 -169
- package/dist/react/useAssistantSession.d.ts +6 -0
- package/dist/react/useAssistantSession.js +4 -0
- package/dist/react/useConversations.d.ts +7 -1
- package/dist/react/useConversations.js +10 -4
- package/dist/types.d.ts +2 -2
- package/package.json +1 -1
- package/dist/openapi_client/models/FileNamespace.d.ts +0 -4
- package/dist/openapi_client/models/FileNamespace.js +0 -9
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { LemmaClient } from "../client.js";
|
|
2
2
|
import { type SseRawEvent } from "../streams.js";
|
|
3
3
|
import type { Conversation, ConversationMessage, ConversationModel, CursorPage } from "../types.js";
|
|
4
|
+
import type { ConversationStatus } from "../openapi_client/models/ConversationStatus.js";
|
|
5
|
+
import type { ConversationType } from "../openapi_client/models/ConversationType.js";
|
|
4
6
|
interface ConversationScope {
|
|
5
7
|
podId?: string | null;
|
|
6
8
|
agentName?: string | null;
|
|
@@ -40,6 +42,8 @@ export interface UseAssistantSessionOptions {
|
|
|
40
42
|
export interface CreateConversationInput {
|
|
41
43
|
title?: string | null;
|
|
42
44
|
instructions?: string | null;
|
|
45
|
+
metadata?: Record<string, unknown> | null;
|
|
46
|
+
type?: ConversationType | `${ConversationType}` | null;
|
|
43
47
|
model?: ConversationModel | null;
|
|
44
48
|
podId?: string | null;
|
|
45
49
|
agentName?: string | null;
|
|
@@ -84,6 +88,8 @@ export interface UseAssistantSessionResult {
|
|
|
84
88
|
listConversations: (options?: {
|
|
85
89
|
limit?: number;
|
|
86
90
|
pageToken?: string;
|
|
91
|
+
status?: ConversationStatus | `${ConversationStatus}` | null;
|
|
92
|
+
type?: ConversationType | `${ConversationType}` | null;
|
|
87
93
|
scope?: ConversationScope;
|
|
88
94
|
}) => Promise<CursorPage<Conversation>>;
|
|
89
95
|
createConversation: (input?: CreateConversationInput) => Promise<Conversation>;
|
|
@@ -166,6 +166,8 @@ export function useAssistantSession(options) {
|
|
|
166
166
|
const response = await scopedClient.conversations.list({
|
|
167
167
|
pod_id: scope.podId ?? undefined,
|
|
168
168
|
agent_name: scope.agentName ?? undefined,
|
|
169
|
+
status: input.status ?? undefined,
|
|
170
|
+
type: input.type,
|
|
169
171
|
limit: input.limit,
|
|
170
172
|
page_token: input.pageToken,
|
|
171
173
|
});
|
|
@@ -196,6 +198,8 @@ export function useAssistantSession(options) {
|
|
|
196
198
|
instructions: typeof input.instructions === "undefined"
|
|
197
199
|
? defaultInstructions ?? undefined
|
|
198
200
|
: input.instructions,
|
|
201
|
+
metadata: input.metadata ?? undefined,
|
|
202
|
+
type: input.type,
|
|
199
203
|
pod_id: input.podId ?? defaultPodId ?? scopedClient.podId ?? undefined,
|
|
200
204
|
agent_name: input.agentName
|
|
201
205
|
?? input.assistantName
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { LemmaClient } from "../client.js";
|
|
2
|
+
import type { ConversationStatus } from "../openapi_client/models/ConversationStatus.js";
|
|
3
|
+
import type { ConversationType } from "../openapi_client/models/ConversationType.js";
|
|
2
4
|
import type { Conversation } from "../types.js";
|
|
3
5
|
import { type CreateConversationInput } from "./useAssistantSession.js";
|
|
4
6
|
export interface UseConversationsOptions {
|
|
@@ -19,6 +21,8 @@ export interface UseConversationsOptions {
|
|
|
19
21
|
autoSelectFirst?: boolean;
|
|
20
22
|
limit?: number;
|
|
21
23
|
pageToken?: string;
|
|
24
|
+
status?: ConversationStatus | `${ConversationStatus}` | null;
|
|
25
|
+
type?: ConversationType | `${ConversationType}` | null;
|
|
22
26
|
initialConversationId?: string | null;
|
|
23
27
|
}
|
|
24
28
|
export interface UseConversationsResult {
|
|
@@ -45,6 +49,8 @@ export interface UseConversationsResult {
|
|
|
45
49
|
refresh: (overrides?: {
|
|
46
50
|
limit?: number;
|
|
47
51
|
pageToken?: string;
|
|
52
|
+
status?: ConversationStatus | `${ConversationStatus}` | null;
|
|
53
|
+
type?: ConversationType | `${ConversationType}` | null;
|
|
48
54
|
}) => Promise<Conversation[]>;
|
|
49
55
|
loadMore: (overrides?: {
|
|
50
56
|
limit?: number;
|
|
@@ -53,4 +59,4 @@ export interface UseConversationsResult {
|
|
|
53
59
|
createAndSelectConversation: (input?: Omit<CreateConversationInput, "setActive">) => Promise<Conversation>;
|
|
54
60
|
ensureConversation: (input?: Omit<CreateConversationInput, "setActive">) => Promise<Conversation>;
|
|
55
61
|
}
|
|
56
|
-
export declare function useConversations({ client, podId, agentName, assistantName, assistantId, organizationId, enabled, autoLoad, autoSelectFirst, limit, pageToken, initialConversationId, }: UseConversationsOptions): UseConversationsResult;
|
|
62
|
+
export declare function useConversations({ client, podId, agentName, assistantName, assistantId, organizationId, enabled, autoLoad, autoSelectFirst, limit, pageToken, status, type, initialConversationId, }: UseConversationsOptions): UseConversationsResult;
|
|
@@ -8,7 +8,7 @@ function sortConversationsByUpdatedAt(conversations) {
|
|
|
8
8
|
return bTime - aTime;
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
|
-
export function useConversations({ client, podId, agentName, assistantName, assistantId, organizationId, enabled = true, autoLoad = true, autoSelectFirst = true, limit = 20, pageToken, initialConversationId = null, }) {
|
|
11
|
+
export function useConversations({ client, podId, agentName, assistantName, assistantId, organizationId, enabled = true, autoLoad = true, autoSelectFirst = true, limit = 20, pageToken, status, type, initialConversationId = null, }) {
|
|
12
12
|
const [conversations, setConversations] = useState([]);
|
|
13
13
|
const [total, setTotal] = useState(0);
|
|
14
14
|
const [nextPageToken, setNextPageToken] = useState(null);
|
|
@@ -21,7 +21,9 @@ export function useConversations({ client, podId, agentName, assistantName, assi
|
|
|
21
21
|
assistantName: assistantName ?? null,
|
|
22
22
|
assistantId: assistantId ?? null,
|
|
23
23
|
organizationId: organizationId ?? null,
|
|
24
|
-
|
|
24
|
+
status: status ?? null,
|
|
25
|
+
type: type ?? null,
|
|
26
|
+
}), [agentName, assistantId, assistantName, organizationId, podId, status, type]);
|
|
25
27
|
const { error, listConversations, createConversation: sessionCreateConversation, } = useAssistantSession({
|
|
26
28
|
client,
|
|
27
29
|
podId,
|
|
@@ -44,6 +46,8 @@ export function useConversations({ client, podId, agentName, assistantName, assi
|
|
|
44
46
|
const response = await listConversations({
|
|
45
47
|
limit: overrides.limit ?? limit,
|
|
46
48
|
pageToken: overrides.pageToken ?? pageToken,
|
|
49
|
+
status: overrides.status ?? status,
|
|
50
|
+
type: overrides.type ?? type,
|
|
47
51
|
});
|
|
48
52
|
const nextConversations = sortConversationsByUpdatedAt(response.items ?? []);
|
|
49
53
|
setConversations(nextConversations);
|
|
@@ -63,7 +67,7 @@ export function useConversations({ client, podId, agentName, assistantName, assi
|
|
|
63
67
|
finally {
|
|
64
68
|
setIsLoading(false);
|
|
65
69
|
}
|
|
66
|
-
}, [autoSelectFirst, enabled, initialConversationId, limit, listConversations, pageToken]);
|
|
70
|
+
}, [autoSelectFirst, enabled, initialConversationId, limit, listConversations, pageToken, status, type]);
|
|
67
71
|
const loadMore = useCallback(async (overrides = {}) => {
|
|
68
72
|
if (!enabled || !nextPageToken || isLoading || isLoadingMore) {
|
|
69
73
|
return [];
|
|
@@ -73,6 +77,8 @@ export function useConversations({ client, podId, agentName, assistantName, assi
|
|
|
73
77
|
const response = await listConversations({
|
|
74
78
|
limit: overrides.limit ?? limit,
|
|
75
79
|
pageToken: nextPageToken,
|
|
80
|
+
status,
|
|
81
|
+
type,
|
|
76
82
|
});
|
|
77
83
|
const moreConversations = sortConversationsByUpdatedAt(response.items ?? []);
|
|
78
84
|
setConversations((previous) => [...previous, ...moreConversations]);
|
|
@@ -87,7 +93,7 @@ export function useConversations({ client, podId, agentName, assistantName, assi
|
|
|
87
93
|
finally {
|
|
88
94
|
setIsLoadingMore(false);
|
|
89
95
|
}
|
|
90
|
-
}, [conversations.length, enabled, isLoading, isLoadingMore, limit, listConversations, nextPageToken]);
|
|
96
|
+
}, [conversations.length, enabled, isLoading, isLoadingMore, limit, listConversations, nextPageToken, status, type]);
|
|
91
97
|
const createConversation = useCallback(async (input = {}) => {
|
|
92
98
|
const createdConversation = await sessionCreateConversation({
|
|
93
99
|
...input,
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AgentModelName, AgentResponse, ColumnSchema, ConversationResponse as GeneratedConversationResponse, CreateAgentRequest, DatastoreQueryResponse, DirectoryTreeNode, DirectoryTreeResponse, FileResponse,
|
|
1
|
+
import type { AgentModelName, AgentResponse, ColumnSchema, ConversationResponse as GeneratedConversationResponse, CreateAgentRequest, DatastoreQueryResponse, DirectoryTreeNode, DirectoryTreeResponse, FileResponse, FileSearchResponse, FileSearchResultSchema, FlowRunEntity, FlowResponse, FunctionRunResponse, IconUploadResponse, OrganizationInvitationResponse, OrganizationMemberResponse, OrganizationResponse, PodConfigResponse, PodJoinRequestCreateResponse, PodMemberResponse, PodResponse, ScheduleResponse, TableResponse, UpdateAgentRequest, UserResponse, WorkflowRunWaitAssignment } from "./openapi_client/index.js";
|
|
2
2
|
/** Public ergonomic types. */
|
|
3
3
|
export interface AvailableModelInfo {
|
|
4
4
|
id: ConversationModel;
|
|
@@ -77,7 +77,7 @@ export type DatastoreFileSearchResponse = FileSearchResponse;
|
|
|
77
77
|
export type DatastoreFileSearchResult = FileSearchResultSchema;
|
|
78
78
|
export type DatastoreDirectoryTree = DirectoryTreeResponse;
|
|
79
79
|
export type DatastoreDirectoryTreeNode = DirectoryTreeNode;
|
|
80
|
-
export type DatastoreFileNamespace =
|
|
80
|
+
export type DatastoreFileNamespace = "PRIVATE" | "PERSONAL" | "POD";
|
|
81
81
|
export type Pod = PodResponse;
|
|
82
82
|
export type PodConfig = PodConfigResponse;
|
|
83
83
|
export type PodMember = PodMemberResponse;
|
package/package.json
CHANGED
|
@@ -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 FileNamespace;
|
|
6
|
-
(function (FileNamespace) {
|
|
7
|
-
FileNamespace["PERSONAL"] = "PERSONAL";
|
|
8
|
-
FileNamespace["POD"] = "POD";
|
|
9
|
-
})(FileNamespace || (FileNamespace = {}));
|