lemma-sdk 0.2.35 → 0.2.37
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 +126 -43
- package/dist/browser/lemma-client.js +456 -169
- package/dist/client.d.ts +1 -2
- package/dist/client.js +1 -3
- package/dist/index.d.ts +1 -1
- package/dist/namespaces/agents.js +1 -1
- package/dist/namespaces/conversations.d.ts +73 -0
- package/dist/namespaces/conversations.js +174 -0
- package/dist/namespaces/files.d.ts +24 -6
- package/dist/namespaces/files.js +25 -12
- package/dist/namespaces/integrations.d.ts +10 -2
- package/dist/namespaces/integrations.js +17 -2
- package/dist/namespaces/pod-surfaces.d.ts +1 -1
- package/dist/namespaces/pod-surfaces.js +6 -6
- package/dist/namespaces/tasks.d.ts +1 -5
- package/dist/namespaces/tasks.js +54 -12
- package/dist/openapi_client/index.d.ts +27 -34
- package/dist/openapi_client/index.js +9 -12
- package/dist/openapi_client/models/AdminConsentInfoResponse.d.ts +2 -2
- package/dist/openapi_client/models/AgentListResponse.d.ts +2 -4
- package/dist/openapi_client/models/AgentMessageResponse.d.ts +0 -3
- package/dist/openapi_client/models/{AvailableModels.d.ts → AgentModelName.d.ts} +4 -1
- package/dist/openapi_client/models/AgentModelName.js +18 -0
- package/dist/openapi_client/models/AgentResponse.d.ts +18 -13
- package/dist/openapi_client/models/AgentSurfaceListResponse.d.ts +6 -0
- package/dist/openapi_client/models/{AssistantSurfaceResponse.d.ts → AgentSurfaceResponse.d.ts} +6 -5
- package/dist/openapi_client/models/{AssistantSurfaceStatus.d.ts → AgentSurfaceStatus.d.ts} +1 -1
- package/dist/openapi_client/models/AgentSurfaceStatus.js +10 -0
- package/dist/openapi_client/models/{ToolSet.d.ts → AgentToolset.d.ts} +3 -5
- package/dist/openapi_client/models/AgentToolset.js +17 -0
- package/dist/openapi_client/models/ApplicationAccessConfig.d.ts +3 -5
- package/dist/openapi_client/models/ApplicationMode.d.ts +3 -3
- package/dist/openapi_client/models/ApplicationMode.js +3 -3
- package/dist/openapi_client/models/ConversationResponse.d.ts +9 -20
- package/dist/openapi_client/models/CreateAgentRequest.d.ts +11 -7
- package/dist/openapi_client/models/CreateConversationRequest.d.ts +4 -8
- package/dist/openapi_client/models/CreateFolderRequest.d.ts +2 -5
- package/dist/openapi_client/models/CreateFunctionRequest.d.ts +2 -2
- package/dist/openapi_client/models/CreateSurfaceRequest.d.ts +1 -1
- package/dist/openapi_client/models/DatastoreFileUploadRequest.d.ts +2 -2
- package/dist/openapi_client/models/FeedbackCategory.d.ts +7 -0
- package/dist/openapi_client/models/FeedbackCategory.js +12 -0
- package/dist/openapi_client/models/FileNamespace.d.ts +4 -0
- package/dist/openapi_client/models/FileNamespace.js +9 -0
- package/dist/openapi_client/models/FileResponse.d.ts +2 -2
- package/dist/openapi_client/models/FlowRunEntity.d.ts +11 -1
- package/dist/openapi_client/models/FunctionResponse.d.ts +2 -2
- package/dist/openapi_client/models/HarnessKind.d.ts +7 -0
- package/dist/openapi_client/models/HarnessKind.js +12 -0
- package/dist/openapi_client/models/IntegrationHelperAgentRequest.d.ts +13 -0
- package/dist/openapi_client/models/IntegrationHelperAgentResponse.d.ts +25 -0
- package/dist/openapi_client/models/MessageListResponse.d.ts +6 -0
- package/dist/openapi_client/models/MessageResponse.d.ts +17 -0
- package/dist/openapi_client/models/OperationDetail.d.ts +3 -0
- package/dist/openapi_client/models/OperationDetailsBatchRequest.d.ts +9 -0
- package/dist/openapi_client/models/OperationDetailsBatchResponse.d.ts +18 -0
- package/dist/openapi_client/models/OperationDiscoverResponse.d.ts +26 -0
- package/dist/openapi_client/models/OperationSummary.d.ts +3 -0
- package/dist/openapi_client/models/OrganizationCreateRequest.d.ts +2 -0
- package/dist/openapi_client/models/OrganizationInvitationRequest.d.ts +1 -0
- package/dist/openapi_client/models/OrganizationInvitationResponse.d.ts +4 -0
- package/dist/openapi_client/models/OrganizationMessageResponse.d.ts +1 -0
- package/dist/openapi_client/models/OrganizationResponse.d.ts +2 -0
- package/dist/openapi_client/models/OrganizationSlugAvailabilityResponse.d.ts +7 -0
- package/dist/openapi_client/models/ReportFeedbackRequest.d.ts +30 -0
- package/dist/openapi_client/models/ReportFeedbackResponse.d.ts +25 -0
- package/dist/openapi_client/models/ResourceType.d.ts +0 -1
- package/dist/openapi_client/models/ResourceType.js +0 -1
- package/dist/openapi_client/models/SendMessageRequest.d.ts +5 -0
- package/dist/openapi_client/models/{ToolCallRequest.d.ts → ToolCallContent.d.ts} +1 -1
- package/dist/openapi_client/models/{ToolCallResponse.d.ts → ToolReturnContent.d.ts} +2 -1
- package/dist/openapi_client/models/UpdateAgentRequest.d.ts +11 -7
- package/dist/openapi_client/models/UpdateConversationRequest.d.ts +2 -5
- package/dist/openapi_client/models/UpdateFunctionRequest.d.ts +2 -2
- package/dist/openapi_client/models/WorkflowInstallListResponse.d.ts +4 -0
- package/dist/openapi_client/models/app__modules__agent__domain__value_objects__TableAccessEntry.d.ts +8 -0
- package/dist/openapi_client/models/{TableAccessEntry.d.ts → app__modules__function__api__schemas__function_schemas__TableAccessEntry.d.ts} +1 -1
- package/dist/openapi_client/models/update.d.ts +2 -2
- package/dist/openapi_client/services/AgentConversationsService.d.ts +97 -0
- package/dist/openapi_client/services/AgentConversationsService.js +217 -0
- package/dist/openapi_client/services/{AssistantSurfacesIngressService.d.ts → AgentSurfacesIngressService.d.ts} +2 -2
- package/dist/openapi_client/services/{AssistantSurfacesIngressService.js → AgentSurfacesIngressService.js} +2 -2
- package/dist/openapi_client/services/{AssistantSurfacesService.d.ts → AgentSurfacesService.d.ts} +11 -11
- package/dist/openapi_client/services/{AssistantSurfacesService.js → AgentSurfacesService.js} +10 -10
- package/dist/openapi_client/services/AgentToolsService.d.ts +24 -4
- package/dist/openapi_client/services/AgentToolsService.js +40 -4
- package/dist/openapi_client/services/AgentsService.d.ts +7 -7
- package/dist/openapi_client/services/AgentsService.js +8 -8
- package/dist/openapi_client/services/ApplicationsService.d.ts +10 -9
- package/dist/openapi_client/services/ApplicationsService.js +11 -10
- package/dist/openapi_client/services/FilesService.d.ts +17 -8
- package/dist/openapi_client/services/FilesService.js +25 -8
- package/dist/openapi_client/services/IntegrationsService.d.ts +3 -2
- package/dist/openapi_client/services/IntegrationsService.js +4 -2
- package/dist/openapi_client/services/OrganizationsService.d.ts +18 -0
- package/dist/openapi_client/services/OrganizationsService.js +40 -0
- package/dist/openapi_client/services/WorkflowsService.d.ts +10 -0
- package/dist/openapi_client/services/WorkflowsService.js +21 -0
- package/dist/react/useAgentRun.d.ts +28 -7
- package/dist/react/useAgentRun.js +120 -27
- package/dist/react/useAssistantController.d.ts +6 -2
- package/dist/react/useAssistantController.js +57 -14
- package/dist/react/useAssistantSession.d.ts +15 -3
- package/dist/react/useAssistantSession.js +19 -15
- package/dist/react/useConversationMessages.d.ts +6 -2
- package/dist/react/useConversationMessages.js +2 -1
- package/dist/react/useConversations.d.ts +6 -2
- package/dist/react/useConversations.js +7 -5
- package/dist/react/useCreateFolder.d.ts +4 -2
- package/dist/react/useCreateFolder.js +6 -3
- package/dist/react/useDeleteFile.d.ts +4 -1
- package/dist/react/useDeleteFile.js +3 -3
- package/dist/react/useFile.d.ts +4 -2
- package/dist/react/useFile.js +3 -3
- package/dist/react/useFilePreview.d.ts +4 -1
- package/dist/react/useFilePreview.js +5 -4
- package/dist/react/useFileTree.d.ts +4 -2
- package/dist/react/useFileTree.js +3 -2
- package/dist/react/useFiles.d.ts +4 -2
- package/dist/react/useFiles.js +5 -3
- package/dist/react/useUpdateFile.d.ts +4 -2
- package/dist/react/useUpdateFile.js +6 -3
- package/dist/react/useUploadFile.d.ts +4 -2
- package/dist/react/useUploadFile.js +6 -3
- package/dist/react/useWorkflowRun.js +1 -1
- package/dist/react/useWorkflowStart.js +1 -1
- package/dist/run-utils.d.ts +2 -1
- package/dist/types.d.ts +62 -6
- package/package.json +1 -1
- package/dist/namespaces/assistants.d.ts +0 -96
- package/dist/namespaces/assistants.js +0 -160
- package/dist/openapi_client/models/AddMessageRequest.d.ts +0 -6
- package/dist/openapi_client/models/AppDescriptorResponse.d.ts +0 -5
- package/dist/openapi_client/models/AssistantListResponse.d.ts +0 -6
- package/dist/openapi_client/models/AssistantResponse.d.ts +0 -23
- package/dist/openapi_client/models/AssistantSurfaceListResponse.d.ts +0 -6
- package/dist/openapi_client/models/AssistantSurfaceStatus.js +0 -10
- package/dist/openapi_client/models/AvailableModelInfo.d.ts +0 -8
- package/dist/openapi_client/models/AvailableModels.js +0 -15
- package/dist/openapi_client/models/AvailableModelsListResponse.d.ts +0 -7
- package/dist/openapi_client/models/ConversationMessageListResponse.d.ts +0 -6
- package/dist/openapi_client/models/ConversationMessageResponse.d.ts +0 -19
- package/dist/openapi_client/models/ConversationStatus.d.ts +0 -7
- package/dist/openapi_client/models/ConversationStatus.js +0 -12
- package/dist/openapi_client/models/ConversationType.d.ts +0 -8
- package/dist/openapi_client/models/ConversationType.js +0 -13
- package/dist/openapi_client/models/CreateAssistantRequest.d.ts +0 -18
- package/dist/openapi_client/models/CreateMessageRequest.d.ts +0 -6
- package/dist/openapi_client/models/CreateTaskRequest.d.ts +0 -10
- package/dist/openapi_client/models/FileVisibility.d.ts +0 -4
- package/dist/openapi_client/models/FileVisibility.js +0 -9
- package/dist/openapi_client/models/OperationListResponse.d.ts +0 -6
- package/dist/openapi_client/models/TaskListResponse.d.ts +0 -9
- package/dist/openapi_client/models/TaskMessageListResponse.d.ts +0 -9
- package/dist/openapi_client/models/TaskMessageResponse.d.ts +0 -15
- package/dist/openapi_client/models/TaskResponse.d.ts +0 -16
- package/dist/openapi_client/models/TaskResponse.js +0 -1
- package/dist/openapi_client/models/TaskStatus.d.ts +0 -12
- package/dist/openapi_client/models/TaskStatus.js +0 -17
- package/dist/openapi_client/models/ToolCallRequest.js +0 -1
- package/dist/openapi_client/models/ToolCallResponse.js +0 -1
- package/dist/openapi_client/models/ToolSet.js +0 -19
- package/dist/openapi_client/models/UpdateAssistantRequest.d.ts +0 -17
- package/dist/openapi_client/models/UpdateAssistantRequest.js +0 -1
- package/dist/openapi_client/services/AssistantsService.d.ts +0 -49
- package/dist/openapi_client/services/AssistantsService.js +0 -112
- package/dist/openapi_client/services/ConversationsService.d.ts +0 -88
- package/dist/openapi_client/services/ConversationsService.js +0 -202
- package/dist/openapi_client/services/TasksService.d.ts +0 -76
- package/dist/openapi_client/services/TasksService.js +0 -167
- /package/dist/openapi_client/models/{AddMessageRequest.js → AgentSurfaceListResponse.js} +0 -0
- /package/dist/openapi_client/models/{AppDescriptorResponse.js → AgentSurfaceResponse.js} +0 -0
- /package/dist/openapi_client/models/{AssistantListResponse.js → IntegrationHelperAgentRequest.js} +0 -0
- /package/dist/openapi_client/models/{AssistantResponse.js → IntegrationHelperAgentResponse.js} +0 -0
- /package/dist/openapi_client/models/{AssistantSurfaceListResponse.js → MessageListResponse.js} +0 -0
- /package/dist/openapi_client/models/{AssistantSurfaceResponse.js → MessageResponse.js} +0 -0
- /package/dist/openapi_client/models/{AvailableModelInfo.js → OperationDetailsBatchRequest.js} +0 -0
- /package/dist/openapi_client/models/{AvailableModelsListResponse.js → OperationDetailsBatchResponse.js} +0 -0
- /package/dist/openapi_client/models/{ConversationMessageListResponse.js → OperationDiscoverResponse.js} +0 -0
- /package/dist/openapi_client/models/{ConversationMessageResponse.js → OrganizationSlugAvailabilityResponse.js} +0 -0
- /package/dist/openapi_client/models/{CreateAssistantRequest.js → ReportFeedbackRequest.js} +0 -0
- /package/dist/openapi_client/models/{CreateMessageRequest.js → ReportFeedbackResponse.js} +0 -0
- /package/dist/openapi_client/models/{CreateTaskRequest.js → SendMessageRequest.js} +0 -0
- /package/dist/openapi_client/models/{OperationListResponse.js → ToolCallContent.js} +0 -0
- /package/dist/openapi_client/models/{TableAccessEntry.js → ToolReturnContent.js} +0 -0
- /package/dist/openapi_client/models/{TaskListResponse.js → WorkflowInstallListResponse.js} +0 -0
- /package/dist/openapi_client/models/{TaskMessageListResponse.js → app__modules__agent__domain__value_objects__TableAccessEntry.js} +0 -0
- /package/dist/openapi_client/models/{TaskMessageResponse.js → app__modules__function__api__schemas__function_schemas__TableAccessEntry.js} +0 -0
|
@@ -8,7 +8,7 @@ function sortConversationsByUpdatedAt(conversations) {
|
|
|
8
8
|
return bTime - aTime;
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
|
-
export function useConversations({ client, podId, 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, initialConversationId = null, }) {
|
|
12
12
|
const [conversations, setConversations] = useState([]);
|
|
13
13
|
const [total, setTotal] = useState(0);
|
|
14
14
|
const [nextPageToken, setNextPageToken] = useState(null);
|
|
@@ -17,13 +17,15 @@ export function useConversations({ client, podId, assistantName, assistantId, or
|
|
|
17
17
|
const [isLoadingMore, setIsLoadingMore] = useState(false);
|
|
18
18
|
const scopeKey = useMemo(() => JSON.stringify({
|
|
19
19
|
podId: podId ?? null,
|
|
20
|
-
|
|
20
|
+
agentName: agentName ?? assistantName ?? assistantId ?? null,
|
|
21
|
+
assistantName: assistantName ?? null,
|
|
21
22
|
assistantId: assistantId ?? null,
|
|
22
23
|
organizationId: organizationId ?? null,
|
|
23
|
-
}), [assistantId, assistantName, organizationId, podId]);
|
|
24
|
+
}), [agentName, assistantId, assistantName, organizationId, podId]);
|
|
24
25
|
const { error, listConversations, createConversation: sessionCreateConversation, } = useAssistantSession({
|
|
25
26
|
client,
|
|
26
27
|
podId,
|
|
28
|
+
agentName: agentName ?? assistantName ?? assistantId,
|
|
27
29
|
assistantName,
|
|
28
30
|
assistantId,
|
|
29
31
|
organizationId,
|
|
@@ -90,7 +92,7 @@ export function useConversations({ client, podId, assistantName, assistantId, or
|
|
|
90
92
|
const createdConversation = await sessionCreateConversation({
|
|
91
93
|
...input,
|
|
92
94
|
podId: input.podId ?? podId ?? undefined,
|
|
93
|
-
|
|
95
|
+
agentName: input.agentName ?? input.assistantName ?? agentName ?? assistantName ?? assistantId ?? undefined,
|
|
94
96
|
organizationId: input.organizationId ?? organizationId ?? undefined,
|
|
95
97
|
setActive: input.setActive ?? true,
|
|
96
98
|
});
|
|
@@ -106,7 +108,7 @@ export function useConversations({ client, podId, assistantName, assistantId, or
|
|
|
106
108
|
setSelectedConversationId(createdConversation.id);
|
|
107
109
|
}
|
|
108
110
|
return createdConversation;
|
|
109
|
-
}, [assistantId, assistantName, organizationId, podId, sessionCreateConversation]);
|
|
111
|
+
}, [agentName, assistantId, assistantName, organizationId, podId, sessionCreateConversation]);
|
|
110
112
|
const createAndSelectConversation = useCallback(async (input = {}) => {
|
|
111
113
|
return createConversation({
|
|
112
114
|
...input,
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import type { LemmaClient } from "../client.js";
|
|
2
|
-
import type { FileResponse } from "../types.js";
|
|
2
|
+
import type { DatastoreFileNamespace, FileResponse } from "../types.js";
|
|
3
3
|
export interface CreateFolderInput {
|
|
4
4
|
directoryPath?: string;
|
|
5
5
|
parentId?: string;
|
|
6
6
|
description?: string;
|
|
7
|
+
namespace?: DatastoreFileNamespace | null;
|
|
7
8
|
}
|
|
8
9
|
export interface UseCreateFolderOptions {
|
|
9
10
|
client: LemmaClient;
|
|
10
11
|
podId?: string;
|
|
12
|
+
namespace?: DatastoreFileNamespace | null;
|
|
11
13
|
enabled?: boolean;
|
|
12
14
|
onSuccess?: (folder: FileResponse) => void;
|
|
13
15
|
onError?: (error: unknown) => void;
|
|
@@ -19,4 +21,4 @@ export interface UseCreateFolderResult<TFile extends FileResponse = FileResponse
|
|
|
19
21
|
createFolder: (name: string, options?: CreateFolderInput) => Promise<TFile | null>;
|
|
20
22
|
reset: () => void;
|
|
21
23
|
}
|
|
22
|
-
export declare function useCreateFolder<TFile extends FileResponse = FileResponse>({ client, podId, enabled, onSuccess, onError, }: UseCreateFolderOptions): UseCreateFolderResult<TFile>;
|
|
24
|
+
export declare function useCreateFolder<TFile extends FileResponse = FileResponse>({ client, podId, namespace, enabled, onSuccess, onError, }: UseCreateFolderOptions): UseCreateFolderResult<TFile>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
2
2
|
import { normalizeError, resolvePodClient } from "./utils.js";
|
|
3
|
-
export function useCreateFolder({ client, podId, enabled = true, onSuccess, onError, }) {
|
|
3
|
+
export function useCreateFolder({ client, podId, namespace, enabled = true, onSuccess, onError, }) {
|
|
4
4
|
const [createdFolder, setCreatedFolder] = useState(null);
|
|
5
5
|
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
6
6
|
const [error, setError] = useState(null);
|
|
@@ -17,7 +17,10 @@ export function useCreateFolder({ client, podId, enabled = true, onSuccess, onEr
|
|
|
17
17
|
setError(null);
|
|
18
18
|
try {
|
|
19
19
|
const scopedClient = resolvePodClient(client, podId);
|
|
20
|
-
const nextFolder = await scopedClient.files.folder.create(trimmedName,
|
|
20
|
+
const nextFolder = await scopedClient.files.folder.create(trimmedName, {
|
|
21
|
+
...options,
|
|
22
|
+
namespace: options.namespace ?? namespace,
|
|
23
|
+
});
|
|
21
24
|
setCreatedFolder(nextFolder);
|
|
22
25
|
onSuccessRef.current?.(nextFolder);
|
|
23
26
|
return nextFolder;
|
|
@@ -31,7 +34,7 @@ export function useCreateFolder({ client, podId, enabled = true, onSuccess, onEr
|
|
|
31
34
|
finally {
|
|
32
35
|
setIsSubmitting(false);
|
|
33
36
|
}
|
|
34
|
-
}, [client, enabled, podId]);
|
|
37
|
+
}, [client, enabled, namespace, podId]);
|
|
35
38
|
const reset = useCallback(() => {
|
|
36
39
|
setCreatedFolder(null);
|
|
37
40
|
setError(null);
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { LemmaClient } from "../client.js";
|
|
2
|
+
import type { DatastoreFileNamespace } from "../types.js";
|
|
2
3
|
export interface UseDeleteFileOptions {
|
|
3
4
|
client: LemmaClient;
|
|
4
5
|
podId?: string;
|
|
5
6
|
path?: string | null;
|
|
7
|
+
namespace?: DatastoreFileNamespace | null;
|
|
6
8
|
enabled?: boolean;
|
|
7
9
|
onSuccess?: (path: string) => void;
|
|
8
10
|
onError?: (error: unknown) => void;
|
|
@@ -13,7 +15,8 @@ export interface UseDeleteFileResult {
|
|
|
13
15
|
error: Error | null;
|
|
14
16
|
remove: (overrides?: {
|
|
15
17
|
path?: string | null;
|
|
18
|
+
namespace?: DatastoreFileNamespace | null;
|
|
16
19
|
}) => Promise<boolean>;
|
|
17
20
|
reset: () => void;
|
|
18
21
|
}
|
|
19
|
-
export declare function useDeleteFile({ client, podId, path, enabled, onSuccess, onError, }: UseDeleteFileOptions): UseDeleteFileResult;
|
|
22
|
+
export declare function useDeleteFile({ client, podId, path, namespace, enabled, onSuccess, onError, }: UseDeleteFileOptions): UseDeleteFileResult;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
2
2
|
import { normalizeError, resolvePodClient } from "./utils.js";
|
|
3
|
-
export function useDeleteFile({ client, podId, path = null, enabled = true, onSuccess, onError, }) {
|
|
3
|
+
export function useDeleteFile({ client, podId, path = null, namespace, enabled = true, onSuccess, onError, }) {
|
|
4
4
|
const [deletedPath, setDeletedPath] = useState(null);
|
|
5
5
|
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
6
6
|
const [error, setError] = useState(null);
|
|
@@ -21,7 +21,7 @@ export function useDeleteFile({ client, podId, path = null, enabled = true, onSu
|
|
|
21
21
|
setError(null);
|
|
22
22
|
try {
|
|
23
23
|
const scopedClient = resolvePodClient(client, podId);
|
|
24
|
-
await scopedClient.files.delete(nextPath);
|
|
24
|
+
await scopedClient.files.delete(nextPath, { namespace: overrides.namespace ?? namespace });
|
|
25
25
|
setDeletedPath(nextPath);
|
|
26
26
|
onSuccessRef.current?.(nextPath);
|
|
27
27
|
return true;
|
|
@@ -35,7 +35,7 @@ export function useDeleteFile({ client, podId, path = null, enabled = true, onSu
|
|
|
35
35
|
finally {
|
|
36
36
|
setIsSubmitting(false);
|
|
37
37
|
}
|
|
38
|
-
}, [client, isEnabled, podId, trimmedPath]);
|
|
38
|
+
}, [client, isEnabled, namespace, podId, trimmedPath]);
|
|
39
39
|
const reset = useCallback(() => {
|
|
40
40
|
setDeletedPath(null);
|
|
41
41
|
setError(null);
|
package/dist/react/useFile.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { LemmaClient } from "../client.js";
|
|
2
|
-
import type { FileResponse } from "../types.js";
|
|
2
|
+
import type { DatastoreFileNamespace, FileResponse } from "../types.js";
|
|
3
3
|
export interface UseFileOptions {
|
|
4
4
|
client: LemmaClient;
|
|
5
5
|
podId?: string;
|
|
6
6
|
path?: string | null;
|
|
7
|
+
namespace?: DatastoreFileNamespace | null;
|
|
7
8
|
enabled?: boolean;
|
|
8
9
|
autoLoad?: boolean;
|
|
9
10
|
}
|
|
@@ -13,6 +14,7 @@ export interface UseFileResult {
|
|
|
13
14
|
error: Error | null;
|
|
14
15
|
refresh: (overrides?: {
|
|
15
16
|
path?: string | null;
|
|
17
|
+
namespace?: DatastoreFileNamespace | null;
|
|
16
18
|
}) => Promise<FileResponse | null>;
|
|
17
19
|
}
|
|
18
|
-
export declare function useFile({ client, podId, path, enabled, autoLoad, }: UseFileOptions): UseFileResult;
|
|
20
|
+
export declare function useFile({ client, podId, path, namespace, enabled, autoLoad, }: UseFileOptions): UseFileResult;
|
package/dist/react/useFile.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
2
2
|
import { normalizeError, resolvePodClient } from "./utils.js";
|
|
3
|
-
export function useFile({ client, podId, path = null, enabled = true, autoLoad = true, }) {
|
|
3
|
+
export function useFile({ client, podId, path = null, namespace, enabled = true, autoLoad = true, }) {
|
|
4
4
|
const [file, setFile] = useState(null);
|
|
5
5
|
const [isLoading, setIsLoading] = useState(false);
|
|
6
6
|
const [error, setError] = useState(null);
|
|
@@ -18,7 +18,7 @@ export function useFile({ client, podId, path = null, enabled = true, autoLoad =
|
|
|
18
18
|
setError(null);
|
|
19
19
|
try {
|
|
20
20
|
const scopedClient = resolvePodClient(client, podId);
|
|
21
|
-
const nextFile = await scopedClient.files.get(nextPath);
|
|
21
|
+
const nextFile = await scopedClient.files.get(nextPath, { namespace: overrides.namespace ?? namespace });
|
|
22
22
|
if (signal?.aborted)
|
|
23
23
|
return null;
|
|
24
24
|
setFile(nextFile);
|
|
@@ -35,7 +35,7 @@ export function useFile({ client, podId, path = null, enabled = true, autoLoad =
|
|
|
35
35
|
if (!signal?.aborted)
|
|
36
36
|
setIsLoading(false);
|
|
37
37
|
}
|
|
38
|
-
}, [client, enabled, podId, trimmedPath]);
|
|
38
|
+
}, [client, enabled, namespace, podId, trimmedPath]);
|
|
39
39
|
useEffect(() => {
|
|
40
40
|
if (!isEnabled) {
|
|
41
41
|
setFile(null);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { LemmaClient } from "../client.js";
|
|
2
|
+
import type { DatastoreFileNamespace } from "../types.js";
|
|
2
3
|
export type FilePreviewMode = "rendered" | "artifact";
|
|
3
4
|
export interface UseFilePreviewOptions {
|
|
4
5
|
client: LemmaClient;
|
|
@@ -8,6 +9,7 @@ export interface UseFilePreviewOptions {
|
|
|
8
9
|
autoLoad?: boolean;
|
|
9
10
|
mode?: FilePreviewMode;
|
|
10
11
|
artifact?: string;
|
|
12
|
+
namespace?: DatastoreFileNamespace | null;
|
|
11
13
|
}
|
|
12
14
|
export interface UseFilePreviewResult {
|
|
13
15
|
content: string | null;
|
|
@@ -18,6 +20,7 @@ export interface UseFilePreviewResult {
|
|
|
18
20
|
path?: string | null;
|
|
19
21
|
mode?: FilePreviewMode;
|
|
20
22
|
artifact?: string;
|
|
23
|
+
namespace?: DatastoreFileNamespace | null;
|
|
21
24
|
}) => Promise<string | null>;
|
|
22
25
|
}
|
|
23
|
-
export declare function useFilePreview({ client, podId, path, enabled, autoLoad, mode, artifact, }: UseFilePreviewOptions): UseFilePreviewResult;
|
|
26
|
+
export declare function useFilePreview({ client, podId, path, enabled, autoLoad, mode, artifact, namespace, }: UseFilePreviewOptions): UseFilePreviewResult;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
2
2
|
import { normalizeError, resolvePodClient } from "./utils.js";
|
|
3
|
-
export function useFilePreview({ client, podId, path = null, enabled = true, autoLoad = true, mode = "rendered", artifact = "document.md", }) {
|
|
3
|
+
export function useFilePreview({ client, podId, path = null, enabled = true, autoLoad = true, mode = "rendered", artifact = "document.md", namespace, }) {
|
|
4
4
|
const [content, setContent] = useState(null);
|
|
5
5
|
const [blob, setBlob] = useState(null);
|
|
6
6
|
const [isLoading, setIsLoading] = useState(false);
|
|
@@ -22,8 +22,9 @@ export function useFilePreview({ client, podId, path = null, enabled = true, aut
|
|
|
22
22
|
setError(null);
|
|
23
23
|
try {
|
|
24
24
|
const scopedClient = resolvePodClient(client, podId);
|
|
25
|
+
const nextNamespace = overrides.namespace ?? namespace;
|
|
25
26
|
if (nextMode === "artifact") {
|
|
26
|
-
const nextBlob = await scopedClient.files.converted.download(nextPath, nextArtifact);
|
|
27
|
+
const nextBlob = await scopedClient.files.converted.download(nextPath, nextArtifact, { namespace: nextNamespace });
|
|
27
28
|
const text = await nextBlob.text();
|
|
28
29
|
if (signal?.aborted)
|
|
29
30
|
return null;
|
|
@@ -31,7 +32,7 @@ export function useFilePreview({ client, podId, path = null, enabled = true, aut
|
|
|
31
32
|
setContent(text);
|
|
32
33
|
return text;
|
|
33
34
|
}
|
|
34
|
-
const rendered = await scopedClient.files.converted.render(nextPath);
|
|
35
|
+
const rendered = await scopedClient.files.converted.render(nextPath, { namespace: nextNamespace });
|
|
35
36
|
const text = typeof rendered === "string" ? rendered : String(rendered ?? "");
|
|
36
37
|
if (signal?.aborted)
|
|
37
38
|
return null;
|
|
@@ -51,7 +52,7 @@ export function useFilePreview({ client, podId, path = null, enabled = true, aut
|
|
|
51
52
|
if (!signal?.aborted)
|
|
52
53
|
setIsLoading(false);
|
|
53
54
|
}
|
|
54
|
-
}, [artifact, client, enabled, mode, podId, trimmedPath]);
|
|
55
|
+
}, [artifact, client, enabled, mode, namespace, podId, trimmedPath]);
|
|
55
56
|
useEffect(() => {
|
|
56
57
|
if (!isEnabled) {
|
|
57
58
|
setContent(null);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { LemmaClient } from "../client.js";
|
|
2
|
-
import type { DirectoryTreeNode, DirectoryTreeResponse } from "../types.js";
|
|
2
|
+
import type { DatastoreFileNamespace, DirectoryTreeNode, DirectoryTreeResponse } from "../types.js";
|
|
3
3
|
export interface UseFileTreeOptions {
|
|
4
4
|
client: LemmaClient;
|
|
5
5
|
podId?: string;
|
|
@@ -7,6 +7,7 @@ export interface UseFileTreeOptions {
|
|
|
7
7
|
autoLoad?: boolean;
|
|
8
8
|
rootPath?: string;
|
|
9
9
|
filesPerDirectory?: number;
|
|
10
|
+
namespace?: DatastoreFileNamespace | null;
|
|
10
11
|
}
|
|
11
12
|
export interface UseFileTreeResult {
|
|
12
13
|
tree: DirectoryTreeNode | null;
|
|
@@ -16,6 +17,7 @@ export interface UseFileTreeResult {
|
|
|
16
17
|
refresh: (overrides?: {
|
|
17
18
|
rootPath?: string;
|
|
18
19
|
filesPerDirectory?: number;
|
|
20
|
+
namespace?: DatastoreFileNamespace | null;
|
|
19
21
|
}) => Promise<DirectoryTreeResponse | null>;
|
|
20
22
|
}
|
|
21
|
-
export declare function useFileTree({ client, podId, enabled, autoLoad, rootPath, filesPerDirectory, }: UseFileTreeOptions): UseFileTreeResult;
|
|
23
|
+
export declare function useFileTree({ client, podId, enabled, autoLoad, rootPath, filesPerDirectory, namespace, }: UseFileTreeOptions): UseFileTreeResult;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
2
2
|
import { normalizeError, resolvePodClient } from "./utils.js";
|
|
3
|
-
export function useFileTree({ client, podId, enabled = true, autoLoad = true, rootPath = "/", filesPerDirectory = 3, }) {
|
|
3
|
+
export function useFileTree({ client, podId, enabled = true, autoLoad = true, rootPath = "/", filesPerDirectory = 3, namespace, }) {
|
|
4
4
|
const [response, setResponse] = useState(null);
|
|
5
5
|
const [isLoading, setIsLoading] = useState(false);
|
|
6
6
|
const [error, setError] = useState(null);
|
|
@@ -18,6 +18,7 @@ export function useFileTree({ client, podId, enabled = true, autoLoad = true, ro
|
|
|
18
18
|
const nextResponse = await scopedClient.files.tree({
|
|
19
19
|
rootPath: overrides.rootPath ?? rootPath,
|
|
20
20
|
filesPerDirectory: overrides.filesPerDirectory ?? filesPerDirectory,
|
|
21
|
+
namespace: overrides.namespace ?? namespace,
|
|
21
22
|
});
|
|
22
23
|
if (signal?.aborted)
|
|
23
24
|
return null;
|
|
@@ -35,7 +36,7 @@ export function useFileTree({ client, podId, enabled = true, autoLoad = true, ro
|
|
|
35
36
|
if (!signal?.aborted)
|
|
36
37
|
setIsLoading(false);
|
|
37
38
|
}
|
|
38
|
-
}, [client, enabled, filesPerDirectory, podId, rootPath]);
|
|
39
|
+
}, [client, enabled, filesPerDirectory, namespace, podId, rootPath]);
|
|
39
40
|
useEffect(() => {
|
|
40
41
|
if (!enabled) {
|
|
41
42
|
setResponse(null);
|
package/dist/react/useFiles.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { LemmaClient } from "../client.js";
|
|
2
|
-
import type { FileResponse } from "../types.js";
|
|
2
|
+
import type { DatastoreFileNamespace, FileResponse } from "../types.js";
|
|
3
3
|
export interface UseFilesOptions {
|
|
4
4
|
client: LemmaClient;
|
|
5
5
|
podId?: string;
|
|
@@ -9,6 +9,7 @@ export interface UseFilesOptions {
|
|
|
9
9
|
pageToken?: string;
|
|
10
10
|
directoryPath?: string;
|
|
11
11
|
parentId?: string;
|
|
12
|
+
namespace?: DatastoreFileNamespace | null;
|
|
12
13
|
}
|
|
13
14
|
export interface UseFilesResult {
|
|
14
15
|
files: FileResponse[];
|
|
@@ -21,9 +22,10 @@ export interface UseFilesResult {
|
|
|
21
22
|
pageToken?: string;
|
|
22
23
|
directoryPath?: string;
|
|
23
24
|
parentId?: string;
|
|
25
|
+
namespace?: DatastoreFileNamespace | null;
|
|
24
26
|
}) => Promise<FileResponse[]>;
|
|
25
27
|
loadMore: (overrides?: {
|
|
26
28
|
limit?: number;
|
|
27
29
|
}) => Promise<FileResponse[]>;
|
|
28
30
|
}
|
|
29
|
-
export declare function useFiles({ client, podId, enabled, autoLoad, limit, pageToken, directoryPath, parentId, }: UseFilesOptions): UseFilesResult;
|
|
31
|
+
export declare function useFiles({ client, podId, enabled, autoLoad, limit, pageToken, directoryPath, parentId, namespace, }: UseFilesOptions): UseFilesResult;
|
package/dist/react/useFiles.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
2
2
|
import { normalizeError, resolvePodClient } from "./utils.js";
|
|
3
|
-
export function useFiles({ client, podId, enabled = true, autoLoad = true, limit = 100, pageToken, directoryPath = "/", parentId, }) {
|
|
3
|
+
export function useFiles({ client, podId, enabled = true, autoLoad = true, limit = 100, pageToken, directoryPath = "/", parentId, namespace, }) {
|
|
4
4
|
const [files, setFiles] = useState([]);
|
|
5
5
|
const [nextPageToken, setNextPageToken] = useState(null);
|
|
6
6
|
const [isLoading, setIsLoading] = useState(false);
|
|
@@ -18,6 +18,7 @@ export function useFiles({ client, podId, enabled = true, autoLoad = true, limit
|
|
|
18
18
|
pageToken: overrides.pageToken ?? pageToken,
|
|
19
19
|
directoryPath: overrides.directoryPath ?? directoryPath,
|
|
20
20
|
parentId: overrides.parentId ?? parentId,
|
|
21
|
+
namespace: overrides.namespace ?? namespace,
|
|
21
22
|
});
|
|
22
23
|
if (signal?.aborted)
|
|
23
24
|
return [];
|
|
@@ -36,7 +37,7 @@ export function useFiles({ client, podId, enabled = true, autoLoad = true, limit
|
|
|
36
37
|
if (!signal?.aborted)
|
|
37
38
|
setIsLoading(false);
|
|
38
39
|
}
|
|
39
|
-
}, [client, directoryPath, enabled, limit, pageToken, parentId, podId]);
|
|
40
|
+
}, [client, directoryPath, enabled, limit, namespace, pageToken, parentId, podId]);
|
|
40
41
|
const loadMore = useCallback(async (overrides = {}) => {
|
|
41
42
|
if (!enabled || !nextPageToken || isLoading || isLoadingMore)
|
|
42
43
|
return [];
|
|
@@ -49,6 +50,7 @@ export function useFiles({ client, podId, enabled = true, autoLoad = true, limit
|
|
|
49
50
|
pageToken: nextPageToken,
|
|
50
51
|
directoryPath,
|
|
51
52
|
parentId,
|
|
53
|
+
namespace,
|
|
52
54
|
});
|
|
53
55
|
const moreFiles = response.items ?? [];
|
|
54
56
|
setFiles((previous) => [...previous, ...moreFiles]);
|
|
@@ -62,7 +64,7 @@ export function useFiles({ client, podId, enabled = true, autoLoad = true, limit
|
|
|
62
64
|
finally {
|
|
63
65
|
setIsLoadingMore(false);
|
|
64
66
|
}
|
|
65
|
-
}, [client, directoryPath, enabled, isLoading, isLoadingMore, limit, nextPageToken, parentId, podId]);
|
|
67
|
+
}, [client, directoryPath, enabled, isLoading, isLoadingMore, limit, namespace, nextPageToken, parentId, podId]);
|
|
66
68
|
useEffect(() => {
|
|
67
69
|
if (!enabled) {
|
|
68
70
|
setFiles([]);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { LemmaClient } from "../client.js";
|
|
2
|
-
import type { FileResponse } from "../types.js";
|
|
2
|
+
import type { DatastoreFileNamespace, FileResponse } from "../types.js";
|
|
3
3
|
export interface UpdateFileInput {
|
|
4
4
|
file?: Blob;
|
|
5
5
|
name?: string;
|
|
@@ -8,11 +8,13 @@ export interface UpdateFileInput {
|
|
|
8
8
|
parentId?: string;
|
|
9
9
|
newPath?: string;
|
|
10
10
|
searchEnabled?: boolean;
|
|
11
|
+
namespace?: DatastoreFileNamespace | null;
|
|
11
12
|
}
|
|
12
13
|
export interface UseUpdateFileOptions {
|
|
13
14
|
client: LemmaClient;
|
|
14
15
|
podId?: string;
|
|
15
16
|
path?: string | null;
|
|
17
|
+
namespace?: DatastoreFileNamespace | null;
|
|
16
18
|
enabled?: boolean;
|
|
17
19
|
onSuccess?: (file: FileResponse) => void;
|
|
18
20
|
onError?: (error: unknown) => void;
|
|
@@ -26,4 +28,4 @@ export interface UseUpdateFileResult<TFile extends FileResponse = FileResponse>
|
|
|
26
28
|
}) => Promise<TFile | null>;
|
|
27
29
|
reset: () => void;
|
|
28
30
|
}
|
|
29
|
-
export declare function useUpdateFile<TFile extends FileResponse = FileResponse>({ client, podId, path, enabled, onSuccess, onError, }: UseUpdateFileOptions): UseUpdateFileResult<TFile>;
|
|
31
|
+
export declare function useUpdateFile<TFile extends FileResponse = FileResponse>({ client, podId, path, namespace, enabled, onSuccess, onError, }: UseUpdateFileOptions): UseUpdateFileResult<TFile>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
2
2
|
import { normalizeError, resolvePodClient } from "./utils.js";
|
|
3
|
-
export function useUpdateFile({ client, podId, path = null, enabled = true, onSuccess, onError, }) {
|
|
3
|
+
export function useUpdateFile({ client, podId, path = null, namespace, enabled = true, onSuccess, onError, }) {
|
|
4
4
|
const [updatedFile, setUpdatedFile] = useState(null);
|
|
5
5
|
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
6
6
|
const [error, setError] = useState(null);
|
|
@@ -21,7 +21,10 @@ export function useUpdateFile({ client, podId, path = null, enabled = true, onSu
|
|
|
21
21
|
setError(null);
|
|
22
22
|
try {
|
|
23
23
|
const scopedClient = resolvePodClient(client, podId);
|
|
24
|
-
const nextFile = await scopedClient.files.update(nextPath,
|
|
24
|
+
const nextFile = await scopedClient.files.update(nextPath, {
|
|
25
|
+
...input,
|
|
26
|
+
namespace: input.namespace ?? namespace,
|
|
27
|
+
});
|
|
25
28
|
setUpdatedFile(nextFile);
|
|
26
29
|
onSuccessRef.current?.(nextFile);
|
|
27
30
|
return nextFile;
|
|
@@ -35,7 +38,7 @@ export function useUpdateFile({ client, podId, path = null, enabled = true, onSu
|
|
|
35
38
|
finally {
|
|
36
39
|
setIsSubmitting(false);
|
|
37
40
|
}
|
|
38
|
-
}, [client, isEnabled, podId, trimmedPath]);
|
|
41
|
+
}, [client, isEnabled, namespace, podId, trimmedPath]);
|
|
39
42
|
const reset = useCallback(() => {
|
|
40
43
|
setUpdatedFile(null);
|
|
41
44
|
setError(null);
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import type { LemmaClient } from "../client.js";
|
|
2
|
-
import type { FileResponse } from "../types.js";
|
|
2
|
+
import type { DatastoreFileNamespace, FileResponse } from "../types.js";
|
|
3
3
|
export interface UploadFileInput {
|
|
4
4
|
name?: string;
|
|
5
5
|
directoryPath?: string;
|
|
6
6
|
parentId?: string;
|
|
7
7
|
searchEnabled?: boolean;
|
|
8
8
|
description?: string;
|
|
9
|
+
namespace?: DatastoreFileNamespace | null;
|
|
9
10
|
}
|
|
10
11
|
export interface UseUploadFileOptions {
|
|
11
12
|
client: LemmaClient;
|
|
12
13
|
podId?: string;
|
|
14
|
+
namespace?: DatastoreFileNamespace | null;
|
|
13
15
|
enabled?: boolean;
|
|
14
16
|
onSuccess?: (file: FileResponse) => void;
|
|
15
17
|
onError?: (error: unknown) => void;
|
|
@@ -21,4 +23,4 @@ export interface UseUploadFileResult<TFile extends FileResponse = FileResponse>
|
|
|
21
23
|
upload: (file: Blob, options?: UploadFileInput) => Promise<TFile | null>;
|
|
22
24
|
reset: () => void;
|
|
23
25
|
}
|
|
24
|
-
export declare function useUploadFile<TFile extends FileResponse = FileResponse>({ client, podId, enabled, onSuccess, onError, }: UseUploadFileOptions): UseUploadFileResult<TFile>;
|
|
26
|
+
export declare function useUploadFile<TFile extends FileResponse = FileResponse>({ client, podId, namespace, enabled, onSuccess, onError, }: UseUploadFileOptions): UseUploadFileResult<TFile>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
2
2
|
import { normalizeError, resolvePodClient } from "./utils.js";
|
|
3
|
-
export function useUploadFile({ client, podId, enabled = true, onSuccess, onError, }) {
|
|
3
|
+
export function useUploadFile({ client, podId, namespace, enabled = true, onSuccess, onError, }) {
|
|
4
4
|
const [uploadedFile, setUploadedFile] = useState(null);
|
|
5
5
|
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
6
6
|
const [error, setError] = useState(null);
|
|
@@ -16,7 +16,10 @@ export function useUploadFile({ client, podId, enabled = true, onSuccess, onErro
|
|
|
16
16
|
setError(null);
|
|
17
17
|
try {
|
|
18
18
|
const scopedClient = resolvePodClient(client, podId);
|
|
19
|
-
const nextFile = await scopedClient.files.upload(file,
|
|
19
|
+
const nextFile = await scopedClient.files.upload(file, {
|
|
20
|
+
...options,
|
|
21
|
+
namespace: options.namespace ?? namespace,
|
|
22
|
+
});
|
|
20
23
|
setUploadedFile(nextFile);
|
|
21
24
|
onSuccessRef.current?.(nextFile);
|
|
22
25
|
return nextFile;
|
|
@@ -30,7 +33,7 @@ export function useUploadFile({ client, podId, enabled = true, onSuccess, onErro
|
|
|
30
33
|
finally {
|
|
31
34
|
setIsSubmitting(false);
|
|
32
35
|
}
|
|
33
|
-
}, [client, enabled, podId]);
|
|
36
|
+
}, [client, enabled, namespace, podId]);
|
|
34
37
|
const reset = useCallback(() => {
|
|
35
38
|
setUploadedFile(null);
|
|
36
39
|
setError(null);
|
|
@@ -31,7 +31,7 @@ export function useWorkflowRun({ workflowName, ...options }) {
|
|
|
31
31
|
const normalizedStatus = normalizeRunStatus(session.status);
|
|
32
32
|
const isFinished = isTerminalFlowStatus(normalizedStatus);
|
|
33
33
|
const isWaitingForInput = normalizedStatus === "WAITING"
|
|
34
|
-
|| !!session.run?.
|
|
34
|
+
|| !!session.run?.waiting_agent_conversation_id
|
|
35
35
|
|| !!session.run?.waiting_function_run_id
|
|
36
36
|
|| !!session.run?.waiting_trigger_id;
|
|
37
37
|
const output = session.run?.execution_context ?? null;
|
|
@@ -22,7 +22,7 @@ function isWaitingFlowRun(run) {
|
|
|
22
22
|
const normalizedStatus = normalizeRunStatus(run.status);
|
|
23
23
|
return normalizedStatus === "WAITING"
|
|
24
24
|
|| !!run.waiting_function_run_id
|
|
25
|
-
|| !!run.
|
|
25
|
+
|| !!run.waiting_agent_conversation_id
|
|
26
26
|
|| !!run.waiting_trigger_id;
|
|
27
27
|
}
|
|
28
28
|
export function useWorkflowStart({ client, podId, workflowName, runId = null, enabled = true, autoLoad = true, autoPoll = true, pollIntervalMs = 2000, onRun, onError, }) {
|
package/dist/run-utils.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { FlowRunStatus, FunctionRunStatus
|
|
1
|
+
import type { FlowRunStatus, FunctionRunStatus } from "./openapi_client/index.js";
|
|
2
|
+
import type { TaskStatus } from "./types.js";
|
|
2
3
|
export type AnyRunStatus = TaskStatus | FunctionRunStatus | FlowRunStatus | (string & {});
|
|
3
4
|
interface BackoffOptions {
|
|
4
5
|
baseMs?: number;
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AgentModelName, AgentResponse, ColumnSchema, ConversationResponse as GeneratedConversationResponse, CreateAgentRequest, DatastoreQueryResponse, DirectoryTreeNode, DirectoryTreeResponse, FileResponse, FileNamespace, FileSearchResponse, FileSearchResultSchema, FlowRunEntity, FlowResponse, FunctionRunResponse, IconUploadResponse, OrganizationInvitationResponse, OrganizationMemberResponse, OrganizationResponse, PodConfigResponse, PodJoinRequestCreateResponse, PodMemberResponse, PodResponse, TableResponse, UpdateAgentRequest, UserResponse } from "./openapi_client/index.js";
|
|
2
2
|
/** Public ergonomic types. */
|
|
3
|
+
export interface AvailableModelInfo {
|
|
4
|
+
id: ConversationModel;
|
|
5
|
+
name: string;
|
|
6
|
+
description?: string | null;
|
|
7
|
+
}
|
|
8
|
+
export type AvailableModels = AgentModelName;
|
|
3
9
|
export interface PageResult<T> {
|
|
4
10
|
items: T[];
|
|
5
11
|
nextPageToken?: string;
|
|
@@ -41,12 +47,61 @@ export interface StreamOptions {
|
|
|
41
47
|
export type Agent = AgentResponse;
|
|
42
48
|
export type CreateAgentInput = CreateAgentRequest;
|
|
43
49
|
export type UpdateAgentInput = UpdateAgentRequest;
|
|
44
|
-
export type
|
|
45
|
-
export type
|
|
46
|
-
|
|
47
|
-
|
|
50
|
+
export type ConversationModel = `${AgentModelName}` | (string & {});
|
|
51
|
+
export type Conversation = GeneratedConversationResponse & {
|
|
52
|
+
model?: ConversationModel | null;
|
|
53
|
+
status?: string | null;
|
|
54
|
+
};
|
|
55
|
+
export interface ConversationMessageResponse {
|
|
56
|
+
id: string;
|
|
57
|
+
role: string;
|
|
58
|
+
content: unknown;
|
|
59
|
+
created_at: string;
|
|
60
|
+
conversation_id?: string;
|
|
61
|
+
sequence?: number;
|
|
62
|
+
agent_run_id?: string | null;
|
|
63
|
+
metadata?: Record<string, unknown> | null;
|
|
64
|
+
tool_call_id?: string | null;
|
|
65
|
+
tool_name?: string | null;
|
|
66
|
+
}
|
|
48
67
|
export type ConversationMessage = ConversationMessageResponse;
|
|
49
|
-
export type
|
|
68
|
+
export type TaskStatus = "PENDING" | "RUNNING" | "WAITING" | "COMPLETED" | "FAILED" | "CANCELLED" | "STOPPED" | (string & {});
|
|
69
|
+
export interface CreateTaskRequest {
|
|
70
|
+
agent_name: string;
|
|
71
|
+
input_data?: Record<string, unknown> | null;
|
|
72
|
+
title?: string | null;
|
|
73
|
+
conversation_id?: string | null;
|
|
74
|
+
content?: string | null;
|
|
75
|
+
}
|
|
76
|
+
export interface AddMessageRequest {
|
|
77
|
+
content: string;
|
|
78
|
+
}
|
|
79
|
+
export interface TaskResponse {
|
|
80
|
+
id: string;
|
|
81
|
+
agent_id?: string | null;
|
|
82
|
+
agent_name?: string | null;
|
|
83
|
+
pod_id: string;
|
|
84
|
+
user_id?: string;
|
|
85
|
+
input_data?: Record<string, unknown> | null;
|
|
86
|
+
output_data?: unknown;
|
|
87
|
+
error?: string | null;
|
|
88
|
+
status?: TaskStatus;
|
|
89
|
+
created_at?: string;
|
|
90
|
+
updated_at?: string;
|
|
91
|
+
conversation?: Conversation;
|
|
92
|
+
}
|
|
93
|
+
export interface TaskListResponse {
|
|
94
|
+
items: TaskResponse[];
|
|
95
|
+
limit: number;
|
|
96
|
+
next_page_token?: string | null;
|
|
97
|
+
total?: number;
|
|
98
|
+
}
|
|
99
|
+
export type TaskMessageResponse = ConversationMessageResponse;
|
|
100
|
+
export interface TaskMessageListResponse {
|
|
101
|
+
items: TaskMessageResponse[];
|
|
102
|
+
limit: number;
|
|
103
|
+
next_page_token?: string | null;
|
|
104
|
+
}
|
|
50
105
|
export type Task = TaskResponse;
|
|
51
106
|
export type TaskMessage = TaskMessageResponse;
|
|
52
107
|
export type FunctionRun = FunctionRunResponse;
|
|
@@ -62,6 +117,7 @@ export type DatastoreFileSearchResponse = FileSearchResponse;
|
|
|
62
117
|
export type DatastoreFileSearchResult = FileSearchResultSchema;
|
|
63
118
|
export type DatastoreDirectoryTree = DirectoryTreeResponse;
|
|
64
119
|
export type DatastoreDirectoryTreeNode = DirectoryTreeNode;
|
|
120
|
+
export type DatastoreFileNamespace = FileNamespace | "PRIVATE" | "PERSONAL" | "POD";
|
|
65
121
|
export type Pod = PodResponse;
|
|
66
122
|
export type PodConfig = PodConfigResponse;
|
|
67
123
|
export type PodMember = PodMemberResponse;
|