lemma-sdk 0.2.40 → 0.2.41
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 -1
- package/dist/browser/lemma-client.js +80 -14
- package/dist/index.d.ts +1 -1
- package/dist/namespaces/resources.d.ts +21 -5
- package/dist/openapi_client/index.d.ts +19 -14
- package/dist/openapi_client/index.js +3 -4
- package/dist/openapi_client/models/AgentResponse.d.ts +3 -2
- package/dist/openapi_client/models/BillingHistoryResponse.d.ts +8 -0
- package/dist/openapi_client/models/BillingInvoiceResponse.d.ts +29 -0
- package/dist/openapi_client/models/BillingInvoiceStatus.d.ts +10 -0
- package/dist/openapi_client/models/BillingInvoiceStatus.js +15 -0
- package/dist/openapi_client/models/BillingScope.d.ts +7 -0
- package/dist/openapi_client/models/BillingScope.js +12 -0
- package/dist/openapi_client/models/ConversationResponse.d.ts +1 -0
- package/dist/openapi_client/models/CreateAgentRequest.d.ts +3 -2
- package/dist/openapi_client/models/CreateConversationRequest.d.ts +1 -0
- package/dist/openapi_client/models/CreateDeskRequest.d.ts +1 -0
- package/dist/openapi_client/models/CreateFolderRequest.d.ts +2 -0
- package/dist/openapi_client/models/CreateFunctionRequest.d.ts +9 -4
- package/dist/openapi_client/models/CreateInvoicePaymentUrlRequest.d.ts +7 -0
- package/dist/openapi_client/models/CreateInvoicePaymentUrlResponse.d.ts +8 -0
- package/dist/openapi_client/models/CreateScheduleRequest.d.ts +1 -0
- package/dist/openapi_client/models/CreateTableRequest.d.ts +1 -0
- package/dist/openapi_client/models/DatastoreFileUploadRequest.d.ts +1 -0
- package/dist/openapi_client/models/DeskResponse.d.ts +2 -0
- package/dist/openapi_client/models/FileResponse.d.ts +2 -0
- package/dist/openapi_client/models/FlowResponse.d.ts +2 -0
- package/dist/openapi_client/models/FunctionResponse.d.ts +13 -2
- package/dist/openapi_client/models/{app__modules__function__api__schemas__function_schemas__TableAccessEntry.d.ts → FunctionTableAccessEntry.d.ts} +1 -1
- package/dist/openapi_client/models/PodMemberAddRequest.d.ts +1 -0
- package/dist/openapi_client/models/PodMemberDetailResponse.d.ts +1 -0
- package/dist/openapi_client/models/PodMemberResponse.d.ts +1 -0
- package/dist/openapi_client/models/PodMemberUpdateRoleRequest.d.ts +2 -1
- package/dist/openapi_client/models/PodRoleCreateRequest.d.ts +6 -0
- package/dist/openapi_client/models/PodRoleListResponse.d.ts +7 -0
- package/dist/openapi_client/models/PodRoleResponse.d.ts +11 -0
- package/dist/openapi_client/models/ScheduleResponse.d.ts +2 -0
- package/dist/openapi_client/models/SendMessageRequest.d.ts +1 -0
- package/dist/openapi_client/models/StartSubscriptionResponse.d.ts +3 -1
- package/dist/openapi_client/models/StartTeamBillingRequest.d.ts +6 -0
- package/dist/openapi_client/models/SubscriptionResponse.d.ts +22 -0
- package/dist/openapi_client/models/SubscriptionWithPlanResponse.d.ts +4 -1
- package/dist/openapi_client/models/{app__modules__agent__domain__value_objects__TableAccessEntry.d.ts → TableAccessEntry.d.ts} +1 -1
- package/dist/openapi_client/models/TableAccessEntry.js +1 -0
- package/dist/openapi_client/models/TableResponse.d.ts +2 -0
- package/dist/openapi_client/models/UpdateAgentRequest.d.ts +3 -2
- package/dist/openapi_client/models/UpdateConversationRequest.d.ts +1 -0
- package/dist/openapi_client/models/UpdateDeskRequest.d.ts +2 -0
- package/dist/openapi_client/models/UpdateFunctionRequest.d.ts +6 -2
- package/dist/openapi_client/models/UpdateScheduleRequest.d.ts +1 -0
- package/dist/openapi_client/models/UpdateTableRequest.d.ts +2 -1
- package/dist/openapi_client/models/UsageLimitScopeResponse.d.ts +10 -0
- package/dist/openapi_client/models/UsageLimitScopeResponse.js +1 -0
- package/dist/openapi_client/models/UsageLimitsResponse.d.ts +11 -0
- package/dist/openapi_client/models/UsageLimitsResponse.js +1 -0
- package/dist/openapi_client/models/UsageListResponse.d.ts +10 -0
- package/dist/openapi_client/models/UsageListResponse.js +1 -0
- package/dist/openapi_client/models/UsageRecordResponse.d.ts +12 -4
- package/dist/openapi_client/models/UsageStatsBucketResponse.d.ts +12 -0
- package/dist/openapi_client/models/UsageStatsBucketResponse.js +1 -0
- package/dist/openapi_client/models/UsageStatsResponse.d.ts +12 -0
- package/dist/openapi_client/models/UsageStatsResponse.js +1 -0
- package/dist/openapi_client/models/UsageSummaryResponse.d.ts +3 -0
- package/dist/openapi_client/models/WorkflowCreateRequest.d.ts +1 -0
- package/dist/openapi_client/models/WorkflowUpdateRequest.d.ts +1 -0
- package/dist/openapi_client/models/update.d.ts +2 -0
- package/dist/openapi_client/services/BillingSubscriptionsService.d.ts +80 -20
- package/dist/openapi_client/services/BillingSubscriptionsService.js +164 -27
- package/dist/openapi_client/services/BillingUsageService.d.ts +89 -5
- package/dist/openapi_client/services/BillingUsageService.js +186 -6
- package/dist/openapi_client/services/DesksService.d.ts +21 -4
- package/dist/openapi_client/services/DesksService.js +44 -2
- package/dist/openapi_client/services/FilesService.d.ts +10 -10
- package/dist/openapi_client/services/FilesService.js +10 -10
- package/dist/openapi_client/services/FunctionsService.d.ts +2 -2
- package/dist/openapi_client/services/FunctionsService.js +2 -2
- package/dist/openapi_client/services/PodMembersService.d.ts +10 -0
- package/dist/openapi_client/services/PodMembersService.js +24 -0
- package/dist/openapi_client/services/PodRolesService.d.ts +29 -0
- package/dist/openapi_client/services/PodRolesService.js +63 -0
- package/dist/react/index.d.ts +1 -1
- package/dist/react/useAssistantController.d.ts +8 -4
- package/dist/react/useAssistantController.js +9 -6
- package/dist/react/useAssistantSession.d.ts +3 -0
- package/dist/react/useAssistantSession.js +6 -2
- package/dist/react/useConversationMessages.d.ts +2 -1
- package/dist/react/useConversationMessages.js +2 -1
- package/package.json +1 -1
- package/dist/openapi_client/models/Body_upload_file_files__resource_type___resource_id__upload_post.d.ts +0 -3
- package/dist/openapi_client/models/FileInfo.d.ts +0 -14
- package/dist/openapi_client/models/FileInfo.js +0 -8
- package/dist/openapi_client/models/FileUploadResponse.d.ts +0 -6
- package/dist/openapi_client/models/GrantPermissionRequest.d.ts +0 -6
- package/dist/openapi_client/models/PodPermissionsResponse.d.ts +0 -4
- package/dist/openapi_client/models/ResourceFileListResponse.d.ts +0 -6
- package/dist/openapi_client/models/ResourcePermissionListResponse.d.ts +0 -4
- package/dist/openapi_client/models/ResourcePermissionResponse.d.ts +0 -12
- package/dist/openapi_client/models/ResourceType.d.ts +0 -4
- package/dist/openapi_client/models/ResourceType.js +0 -9
- package/dist/openapi_client/models/SetVisibilityRequest.d.ts +0 -3
- package/dist/openapi_client/services/AgentFilesService.d.ts +0 -46
- package/dist/openapi_client/services/AgentFilesService.js +0 -103
- package/dist/openapi_client/services/AuthorizationService.d.ts +0 -58
- package/dist/openapi_client/services/AuthorizationService.js +0 -122
- /package/dist/openapi_client/models/{Body_upload_file_files__resource_type___resource_id__upload_post.js → BillingHistoryResponse.js} +0 -0
- /package/dist/openapi_client/models/{FileUploadResponse.js → BillingInvoiceResponse.js} +0 -0
- /package/dist/openapi_client/models/{GrantPermissionRequest.js → CreateInvoicePaymentUrlRequest.js} +0 -0
- /package/dist/openapi_client/models/{PodPermissionsResponse.js → CreateInvoicePaymentUrlResponse.js} +0 -0
- /package/dist/openapi_client/models/{ResourceFileListResponse.js → FunctionTableAccessEntry.js} +0 -0
- /package/dist/openapi_client/models/{ResourcePermissionListResponse.js → PodRoleCreateRequest.js} +0 -0
- /package/dist/openapi_client/models/{ResourcePermissionResponse.js → PodRoleListResponse.js} +0 -0
- /package/dist/openapi_client/models/{SetVisibilityRequest.js → PodRoleResponse.js} +0 -0
- /package/dist/openapi_client/models/{app__modules__agent__domain__value_objects__TableAccessEntry.js → StartTeamBillingRequest.js} +0 -0
- /package/dist/openapi_client/models/{app__modules__function__api__schemas__function_schemas__TableAccessEntry.js → SubscriptionResponse.js} +0 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { OpenAPI } from '../core/OpenAPI.js';
|
|
2
|
+
import { request as __request } from '../core/request.js';
|
|
3
|
+
export class PodRolesService {
|
|
4
|
+
/**
|
|
5
|
+
* List Pod Roles
|
|
6
|
+
* @param podId
|
|
7
|
+
* @returns PodRoleListResponse Successful Response
|
|
8
|
+
* @throws ApiError
|
|
9
|
+
*/
|
|
10
|
+
static podRolesList(podId) {
|
|
11
|
+
return __request(OpenAPI, {
|
|
12
|
+
method: 'GET',
|
|
13
|
+
url: '/pods/{pod_id}/roles',
|
|
14
|
+
path: {
|
|
15
|
+
'pod_id': podId,
|
|
16
|
+
},
|
|
17
|
+
errors: {
|
|
18
|
+
422: `Validation Error`,
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Create Pod Role
|
|
24
|
+
* @param podId
|
|
25
|
+
* @param requestBody
|
|
26
|
+
* @returns PodRoleResponse Successful Response
|
|
27
|
+
* @throws ApiError
|
|
28
|
+
*/
|
|
29
|
+
static podRolesCreate(podId, requestBody) {
|
|
30
|
+
return __request(OpenAPI, {
|
|
31
|
+
method: 'POST',
|
|
32
|
+
url: '/pods/{pod_id}/roles',
|
|
33
|
+
path: {
|
|
34
|
+
'pod_id': podId,
|
|
35
|
+
},
|
|
36
|
+
body: requestBody,
|
|
37
|
+
mediaType: 'application/json',
|
|
38
|
+
errors: {
|
|
39
|
+
422: `Validation Error`,
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Delete Pod Role
|
|
45
|
+
* @param podId
|
|
46
|
+
* @param roleName
|
|
47
|
+
* @returns void
|
|
48
|
+
* @throws ApiError
|
|
49
|
+
*/
|
|
50
|
+
static podRolesDelete(podId, roleName) {
|
|
51
|
+
return __request(OpenAPI, {
|
|
52
|
+
method: 'DELETE',
|
|
53
|
+
url: '/pods/{pod_id}/roles/{role_name}',
|
|
54
|
+
path: {
|
|
55
|
+
'pod_id': podId,
|
|
56
|
+
'role_name': roleName,
|
|
57
|
+
},
|
|
58
|
+
errors: {
|
|
59
|
+
422: `Validation Error`,
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
package/dist/react/index.d.ts
CHANGED
|
@@ -85,7 +85,7 @@ export type { UseRecordFormOptions, UseRecordFormResult } from "./useRecordForm.
|
|
|
85
85
|
export { useSchemaForm } from "./useSchemaForm.js";
|
|
86
86
|
export type { UseSchemaFormOptions, UseSchemaFormResult } from "./useSchemaForm.js";
|
|
87
87
|
export { useAssistantController } from "./useAssistantController.js";
|
|
88
|
-
export type { AssistantAction, AssistantConversationScope, AssistantMessagePart, AssistantRenderableMessage, AssistantToolInvocation, UseAssistantControllerOptions, UseAssistantControllerResult, } from "./useAssistantController.js";
|
|
88
|
+
export type { AssistantAction, AssistantConversationScope, AssistantMessagePart, AssistantRenderableMessage, AssistantToolInvocation, SendAssistantControllerMessageOptions, UseAssistantControllerOptions, UseAssistantControllerResult, } from "./useAssistantController.js";
|
|
89
89
|
export { useFunctionSession } from "./useFunctionSession.js";
|
|
90
90
|
export type { UseFunctionSessionOptions, UseFunctionSessionResult, } from "./useFunctionSession.js";
|
|
91
91
|
export { useFunctionRun } from "./useFunctionRun.js";
|
|
@@ -57,6 +57,12 @@ export interface AssistantAction {
|
|
|
57
57
|
export interface UseAssistantControllerOptions extends AssistantConversationScope {
|
|
58
58
|
client: LemmaClient;
|
|
59
59
|
enabled?: boolean;
|
|
60
|
+
instructions?: string | null;
|
|
61
|
+
}
|
|
62
|
+
export interface SendAssistantControllerMessageOptions {
|
|
63
|
+
forceNewConversation?: boolean;
|
|
64
|
+
metadata?: Record<string, unknown> | null;
|
|
65
|
+
instructions?: string | null;
|
|
60
66
|
}
|
|
61
67
|
export interface UseAssistantControllerResult {
|
|
62
68
|
messages: AssistantRenderableMessage[];
|
|
@@ -77,9 +83,7 @@ export interface UseAssistantControllerResult {
|
|
|
77
83
|
completedActions: AssistantAction[];
|
|
78
84
|
selectConversation: (conversationId: string | null) => void;
|
|
79
85
|
setConversationModel: (model: ConversationModel | null) => Promise<void>;
|
|
80
|
-
sendMessage: (content: string, options?:
|
|
81
|
-
forceNewConversation?: boolean;
|
|
82
|
-
}) => Promise<void>;
|
|
86
|
+
sendMessage: (content: string, options?: SendAssistantControllerMessageOptions) => Promise<void>;
|
|
83
87
|
uploadFiles: (files: File[], options?: {
|
|
84
88
|
deferUntilSend?: boolean;
|
|
85
89
|
}) => Promise<void>;
|
|
@@ -89,4 +93,4 @@ export interface UseAssistantControllerResult {
|
|
|
89
93
|
clearMessages: () => void;
|
|
90
94
|
stop: () => void;
|
|
91
95
|
}
|
|
92
|
-
export declare function useAssistantController({ client, podId, agentName, assistantName, assistantId, organizationId, enabled, }: UseAssistantControllerOptions): UseAssistantControllerResult;
|
|
96
|
+
export declare function useAssistantController({ client, podId, agentName, assistantName, assistantId, organizationId, enabled, instructions, }: UseAssistantControllerOptions): UseAssistantControllerResult;
|
|
@@ -570,7 +570,7 @@ function appendPersonalFileReferences(content, files) {
|
|
|
570
570
|
const references = formatPersonalFileReferences(files);
|
|
571
571
|
return `${content}\n\nPersonal files available to this run:\n${references}`;
|
|
572
572
|
}
|
|
573
|
-
export function useAssistantController({ client, podId, agentName, assistantName, assistantId, organizationId, enabled = true, }) {
|
|
573
|
+
export function useAssistantController({ client, podId, agentName, assistantName, assistantId, organizationId, enabled = true, instructions, }) {
|
|
574
574
|
const [localError, setLocalError] = useState(null);
|
|
575
575
|
const [conversations, setConversations] = useState([]);
|
|
576
576
|
const [activeConversationId, setActiveConversationId] = useState(null);
|
|
@@ -617,6 +617,7 @@ export function useAssistantController({ client, podId, agentName, assistantName
|
|
|
617
617
|
assistantName: scope.assistantName ?? undefined,
|
|
618
618
|
assistantId: scope.assistantId ?? undefined,
|
|
619
619
|
organizationId: scope.organizationId ?? undefined,
|
|
620
|
+
instructions,
|
|
620
621
|
conversationId: activeConversationId ?? undefined,
|
|
621
622
|
autoLoad: false,
|
|
622
623
|
onError: handleAssistantSessionError,
|
|
@@ -977,13 +978,14 @@ export function useAssistantController({ client, podId, agentName, assistantName
|
|
|
977
978
|
const clearMessages = useCallback(() => {
|
|
978
979
|
resetConversationState(false);
|
|
979
980
|
}, [resetConversationState]);
|
|
980
|
-
const ensureConversation = useCallback(async (titleSeed) => {
|
|
981
|
+
const ensureConversation = useCallback(async (titleSeed, options = {}) => {
|
|
981
982
|
const existingConversationId = activeConversationIdRef.current;
|
|
982
983
|
if (existingConversationId) {
|
|
983
984
|
return existingConversationId;
|
|
984
985
|
}
|
|
985
986
|
const createdConversation = await sessionCreateConversation({
|
|
986
987
|
title: titleSeed.slice(0, 120),
|
|
988
|
+
instructions: typeof options.instructions === "undefined" ? instructions : options.instructions,
|
|
987
989
|
model: conversationModel,
|
|
988
990
|
...scope,
|
|
989
991
|
});
|
|
@@ -1001,7 +1003,7 @@ export function useAssistantController({ client, podId, agentName, assistantName
|
|
|
1001
1003
|
clearRuntimeMessages();
|
|
1002
1004
|
setOlderMessagesCursor(null);
|
|
1003
1005
|
return createdConversation.id;
|
|
1004
|
-
}, [clearRuntimeMessages, conversationModel, scope, sessionCreateConversation]);
|
|
1006
|
+
}, [clearRuntimeMessages, conversationModel, instructions, scope, sessionCreateConversation]);
|
|
1005
1007
|
const queuePendingFiles = useCallback((files) => {
|
|
1006
1008
|
if (files.length === 0)
|
|
1007
1009
|
return;
|
|
@@ -1018,11 +1020,11 @@ export function useAssistantController({ client, podId, agentName, assistantName
|
|
|
1018
1020
|
const clearPendingFiles = useCallback(() => {
|
|
1019
1021
|
setPendingFiles([]);
|
|
1020
1022
|
}, []);
|
|
1021
|
-
const sendMessage = useCallback(async (content, options) => {
|
|
1023
|
+
const sendMessage = useCallback(async (content, options = {}) => {
|
|
1022
1024
|
const trimmed = content.trim();
|
|
1023
1025
|
if (!enabled || !trimmed || isStreaming || sessionIsStreaming)
|
|
1024
1026
|
return;
|
|
1025
|
-
const forceNewConversation = options
|
|
1027
|
+
const forceNewConversation = options.forceNewConversation === true;
|
|
1026
1028
|
setLocalError(null);
|
|
1027
1029
|
if (forceNewConversation) {
|
|
1028
1030
|
resetConversationState(true);
|
|
@@ -1030,7 +1032,7 @@ export function useAssistantController({ client, podId, agentName, assistantName
|
|
|
1030
1032
|
let conversationId = forceNewConversation ? null : activeConversationId;
|
|
1031
1033
|
try {
|
|
1032
1034
|
if (!conversationId) {
|
|
1033
|
-
conversationId = await ensureConversation(trimmed);
|
|
1035
|
+
conversationId = await ensureConversation(trimmed, { instructions: options.instructions });
|
|
1034
1036
|
}
|
|
1035
1037
|
if (!conversationId) {
|
|
1036
1038
|
throw new Error("Conversation could not be initialized");
|
|
@@ -1057,6 +1059,7 @@ export function useAssistantController({ client, podId, agentName, assistantName
|
|
|
1057
1059
|
touchConversation(finalConversationId, { status: "running" });
|
|
1058
1060
|
await sessionSendMessage(messageContent, {
|
|
1059
1061
|
conversationId: finalConversationId,
|
|
1062
|
+
metadata: options.metadata ?? undefined,
|
|
1060
1063
|
});
|
|
1061
1064
|
touchConversation(finalConversationId, { updated_at: new Date().toISOString() });
|
|
1062
1065
|
}
|
|
@@ -27,6 +27,7 @@ export interface UseAssistantSessionOptions {
|
|
|
27
27
|
*/
|
|
28
28
|
assistantId?: string;
|
|
29
29
|
organizationId?: string;
|
|
30
|
+
instructions?: string | null;
|
|
30
31
|
conversationId?: string | null;
|
|
31
32
|
autoLoad?: boolean;
|
|
32
33
|
autoResume?: boolean;
|
|
@@ -38,6 +39,7 @@ export interface UseAssistantSessionOptions {
|
|
|
38
39
|
}
|
|
39
40
|
export interface CreateConversationInput {
|
|
40
41
|
title?: string | null;
|
|
42
|
+
instructions?: string | null;
|
|
41
43
|
model?: ConversationModel | null;
|
|
42
44
|
podId?: string | null;
|
|
43
45
|
agentName?: string | null;
|
|
@@ -54,6 +56,7 @@ export interface CreateConversationInput {
|
|
|
54
56
|
}
|
|
55
57
|
export interface SendAssistantMessageOptions {
|
|
56
58
|
conversationId?: string | null;
|
|
59
|
+
metadata?: Record<string, unknown> | null;
|
|
57
60
|
syncOnTurnEnd?: boolean;
|
|
58
61
|
}
|
|
59
62
|
export interface ResumeAssistantOptions {
|
|
@@ -51,7 +51,7 @@ function resolveResumeInput(input) {
|
|
|
51
51
|
return input ?? {};
|
|
52
52
|
}
|
|
53
53
|
export function useAssistantSession(options) {
|
|
54
|
-
const { client, podId: defaultPodId, agentName: defaultAgentName, assistantName: defaultAssistantName, assistantId: defaultAssistantId, organizationId: defaultOrganizationId, conversationId: externalConversationId = null, autoLoad = true, autoResume = false, syncOnTurnEnd = false, onEvent, onStatus, onMessage, onError, } = options;
|
|
54
|
+
const { client, podId: defaultPodId, agentName: defaultAgentName, assistantName: defaultAssistantName, assistantId: defaultAssistantId, organizationId: defaultOrganizationId, instructions: defaultInstructions, conversationId: externalConversationId = null, autoLoad = true, autoResume = false, syncOnTurnEnd = false, onEvent, onStatus, onMessage, onError, } = options;
|
|
55
55
|
const [conversationId, setConversationIdState] = useState(externalConversationId);
|
|
56
56
|
const [conversation, setConversation] = useState(null);
|
|
57
57
|
const [status, setStatus] = useState(undefined);
|
|
@@ -193,6 +193,9 @@ export function useAssistantSession(options) {
|
|
|
193
193
|
const scopedClient = applyPodScope(client, input.podId ?? defaultPodId ?? null);
|
|
194
194
|
const payload = {
|
|
195
195
|
title: input.title ?? undefined,
|
|
196
|
+
instructions: typeof input.instructions === "undefined"
|
|
197
|
+
? defaultInstructions ?? undefined
|
|
198
|
+
: input.instructions,
|
|
196
199
|
pod_id: input.podId ?? defaultPodId ?? scopedClient.podId ?? undefined,
|
|
197
200
|
agent_name: input.agentName
|
|
198
201
|
?? input.assistantName
|
|
@@ -228,6 +231,7 @@ export function useAssistantSession(options) {
|
|
|
228
231
|
defaultAgentName,
|
|
229
232
|
defaultAssistantId,
|
|
230
233
|
defaultAssistantName,
|
|
234
|
+
defaultInstructions,
|
|
231
235
|
defaultPodId,
|
|
232
236
|
setConversationStatus,
|
|
233
237
|
]);
|
|
@@ -386,7 +390,7 @@ export function useAssistantSession(options) {
|
|
|
386
390
|
abortRef.current = controller;
|
|
387
391
|
const scope = normalizeScope(client, defaultScope);
|
|
388
392
|
const scopedClient = applyPodScope(client, scope.podId);
|
|
389
|
-
const stream = await scopedClient.conversations.sendMessageStream(resolvedConversationId, { content }, {
|
|
393
|
+
const stream = await scopedClient.conversations.sendMessageStream(resolvedConversationId, { content, metadata: input.metadata ?? undefined }, {
|
|
390
394
|
pod_id: scope.podId ?? undefined,
|
|
391
395
|
signal: controller.signal,
|
|
392
396
|
});
|
|
@@ -15,6 +15,7 @@ export interface UseConversationMessagesOptions {
|
|
|
15
15
|
*/
|
|
16
16
|
assistantId?: string;
|
|
17
17
|
organizationId?: string;
|
|
18
|
+
instructions?: string | null;
|
|
18
19
|
conversationId?: string | null;
|
|
19
20
|
enabled?: boolean;
|
|
20
21
|
autoLoad?: boolean;
|
|
@@ -60,4 +61,4 @@ export interface UseConversationMessagesResult {
|
|
|
60
61
|
clearMessages: () => void;
|
|
61
62
|
createConversation: (input?: CreateConversationInput) => Promise<Conversation>;
|
|
62
63
|
}
|
|
63
|
-
export declare function useConversationMessages({ client, podId, agentName, assistantName, assistantId, organizationId, conversationId, enabled, autoLoad, autoResume, limit, syncOnTurnEnd, onEvent, onStatus, onMessage, onError, }: UseConversationMessagesOptions): UseConversationMessagesResult;
|
|
64
|
+
export declare function useConversationMessages({ client, podId, agentName, assistantName, assistantId, organizationId, instructions, conversationId, enabled, autoLoad, autoResume, limit, syncOnTurnEnd, onEvent, onStatus, onMessage, onError, }: UseConversationMessagesOptions): UseConversationMessagesResult;
|
|
@@ -12,7 +12,7 @@ function isSettledStatus(status, isStreaming) {
|
|
|
12
12
|
return true;
|
|
13
13
|
return !isConversationRunningStatus(normalized);
|
|
14
14
|
}
|
|
15
|
-
export function useConversationMessages({ client, podId, agentName, assistantName, assistantId, organizationId, conversationId = null, enabled = true, autoLoad = true, autoResume = false, limit = 100, syncOnTurnEnd = false, onEvent, onStatus, onMessage, onError, }) {
|
|
15
|
+
export function useConversationMessages({ client, podId, agentName, assistantName, assistantId, organizationId, instructions, conversationId = null, enabled = true, autoLoad = true, autoResume = false, limit = 100, syncOnTurnEnd = false, onEvent, onStatus, onMessage, onError, }) {
|
|
16
16
|
const [nextPageToken, setNextPageToken] = useState(null);
|
|
17
17
|
const [isLoading, setIsLoading] = useState(false);
|
|
18
18
|
const [isLoadingOlder, setIsLoadingOlder] = useState(false);
|
|
@@ -25,6 +25,7 @@ export function useConversationMessages({ client, podId, agentName, assistantNam
|
|
|
25
25
|
assistantName,
|
|
26
26
|
assistantId,
|
|
27
27
|
organizationId,
|
|
28
|
+
instructions,
|
|
28
29
|
conversationId: conversationId ?? undefined,
|
|
29
30
|
autoLoad: false,
|
|
30
31
|
autoResume: false,
|
package/package.json
CHANGED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export type FileInfo = {
|
|
2
|
-
created?: (string | null);
|
|
3
|
-
last_modified?: (string | null);
|
|
4
|
-
name: string;
|
|
5
|
-
path: string;
|
|
6
|
-
size?: (number | null);
|
|
7
|
-
type: FileInfo.type;
|
|
8
|
-
};
|
|
9
|
-
export declare namespace FileInfo {
|
|
10
|
-
enum type {
|
|
11
|
-
FILE = "file",
|
|
12
|
-
DIRECTORY = "directory"
|
|
13
|
-
}
|
|
14
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export type ResourcePermissionResponse = {
|
|
2
|
-
created_at: string;
|
|
3
|
-
effective_role: string;
|
|
4
|
-
granted_by_user_id: string;
|
|
5
|
-
grantee_min_role: (string | null);
|
|
6
|
-
grantee_type: string;
|
|
7
|
-
grantee_user_id: (string | null);
|
|
8
|
-
id: string;
|
|
9
|
-
pod_id: string;
|
|
10
|
-
resource_id: string;
|
|
11
|
-
resource_type: string;
|
|
12
|
-
};
|
|
@@ -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 ResourceType;
|
|
6
|
-
(function (ResourceType) {
|
|
7
|
-
ResourceType["POD"] = "pod";
|
|
8
|
-
ResourceType["CONVERSATION"] = "conversation";
|
|
9
|
-
})(ResourceType || (ResourceType = {}));
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import type { Body_upload_file_files__resource_type___resource_id__upload_post } from '../models/Body_upload_file_files__resource_type___resource_id__upload_post.js';
|
|
2
|
-
import type { FileUploadResponse } from '../models/FileUploadResponse.js';
|
|
3
|
-
import type { ResourceFileListResponse } from '../models/ResourceFileListResponse.js';
|
|
4
|
-
import type { ResourceType } from '../models/ResourceType.js';
|
|
5
|
-
import type { CancelablePromise } from '../core/CancelablePromise.js';
|
|
6
|
-
export declare class AgentFilesService {
|
|
7
|
-
/**
|
|
8
|
-
* Delete File
|
|
9
|
-
* @param resourceType
|
|
10
|
-
* @param resourceId
|
|
11
|
-
* @param filePath
|
|
12
|
-
* @returns any Successful Response
|
|
13
|
-
* @throws ApiError
|
|
14
|
-
*/
|
|
15
|
-
static deleteFileFilesResourceTypeResourceIdDeleteFilePathDelete(resourceType: ResourceType, resourceId: string, filePath: string): CancelablePromise<Record<string, any>>;
|
|
16
|
-
/**
|
|
17
|
-
* Download File
|
|
18
|
-
* @param resourceType
|
|
19
|
-
* @param resourceId
|
|
20
|
-
* @param filePath
|
|
21
|
-
* @returns any Successful Response
|
|
22
|
-
* @throws ApiError
|
|
23
|
-
*/
|
|
24
|
-
static downloadFileFilesResourceTypeResourceIdDownloadFilePathGet(resourceType: ResourceType, resourceId: string, filePath: string): CancelablePromise<any>;
|
|
25
|
-
/**
|
|
26
|
-
* List Files
|
|
27
|
-
* @param resourceType
|
|
28
|
-
* @param resourceId
|
|
29
|
-
* @param path
|
|
30
|
-
* @param limit
|
|
31
|
-
* @param pageToken
|
|
32
|
-
* @returns ResourceFileListResponse Successful Response
|
|
33
|
-
* @throws ApiError
|
|
34
|
-
*/
|
|
35
|
-
static listFilesFilesResourceTypeResourceIdListGet(resourceType: ResourceType, resourceId: string, path?: string, limit?: number, pageToken?: (string | null)): CancelablePromise<ResourceFileListResponse>;
|
|
36
|
-
/**
|
|
37
|
-
* Upload File
|
|
38
|
-
* @param resourceType
|
|
39
|
-
* @param resourceId
|
|
40
|
-
* @param formData
|
|
41
|
-
* @param path
|
|
42
|
-
* @returns FileUploadResponse Successful Response
|
|
43
|
-
* @throws ApiError
|
|
44
|
-
*/
|
|
45
|
-
static uploadFileFilesResourceTypeResourceIdUploadPost(resourceType: ResourceType, resourceId: string, formData: Body_upload_file_files__resource_type___resource_id__upload_post, path?: (string | null)): CancelablePromise<FileUploadResponse>;
|
|
46
|
-
}
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import { OpenAPI } from '../core/OpenAPI.js';
|
|
2
|
-
import { request as __request } from '../core/request.js';
|
|
3
|
-
export class AgentFilesService {
|
|
4
|
-
/**
|
|
5
|
-
* Delete File
|
|
6
|
-
* @param resourceType
|
|
7
|
-
* @param resourceId
|
|
8
|
-
* @param filePath
|
|
9
|
-
* @returns any Successful Response
|
|
10
|
-
* @throws ApiError
|
|
11
|
-
*/
|
|
12
|
-
static deleteFileFilesResourceTypeResourceIdDeleteFilePathDelete(resourceType, resourceId, filePath) {
|
|
13
|
-
return __request(OpenAPI, {
|
|
14
|
-
method: 'DELETE',
|
|
15
|
-
url: '/files/{resource_type}/{resource_id}/delete/{file_path}',
|
|
16
|
-
path: {
|
|
17
|
-
'resource_type': resourceType,
|
|
18
|
-
'resource_id': resourceId,
|
|
19
|
-
'file_path': filePath,
|
|
20
|
-
},
|
|
21
|
-
errors: {
|
|
22
|
-
422: `Validation Error`,
|
|
23
|
-
},
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Download File
|
|
28
|
-
* @param resourceType
|
|
29
|
-
* @param resourceId
|
|
30
|
-
* @param filePath
|
|
31
|
-
* @returns any Successful Response
|
|
32
|
-
* @throws ApiError
|
|
33
|
-
*/
|
|
34
|
-
static downloadFileFilesResourceTypeResourceIdDownloadFilePathGet(resourceType, resourceId, filePath) {
|
|
35
|
-
return __request(OpenAPI, {
|
|
36
|
-
method: 'GET',
|
|
37
|
-
url: '/files/{resource_type}/{resource_id}/download/{file_path}',
|
|
38
|
-
path: {
|
|
39
|
-
'resource_type': resourceType,
|
|
40
|
-
'resource_id': resourceId,
|
|
41
|
-
'file_path': filePath,
|
|
42
|
-
},
|
|
43
|
-
errors: {
|
|
44
|
-
422: `Validation Error`,
|
|
45
|
-
},
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* List Files
|
|
50
|
-
* @param resourceType
|
|
51
|
-
* @param resourceId
|
|
52
|
-
* @param path
|
|
53
|
-
* @param limit
|
|
54
|
-
* @param pageToken
|
|
55
|
-
* @returns ResourceFileListResponse Successful Response
|
|
56
|
-
* @throws ApiError
|
|
57
|
-
*/
|
|
58
|
-
static listFilesFilesResourceTypeResourceIdListGet(resourceType, resourceId, path = '', limit = 100, pageToken) {
|
|
59
|
-
return __request(OpenAPI, {
|
|
60
|
-
method: 'GET',
|
|
61
|
-
url: '/files/{resource_type}/{resource_id}/list',
|
|
62
|
-
path: {
|
|
63
|
-
'resource_type': resourceType,
|
|
64
|
-
'resource_id': resourceId,
|
|
65
|
-
},
|
|
66
|
-
query: {
|
|
67
|
-
'path': path,
|
|
68
|
-
'limit': limit,
|
|
69
|
-
'page_token': pageToken,
|
|
70
|
-
},
|
|
71
|
-
errors: {
|
|
72
|
-
422: `Validation Error`,
|
|
73
|
-
},
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Upload File
|
|
78
|
-
* @param resourceType
|
|
79
|
-
* @param resourceId
|
|
80
|
-
* @param formData
|
|
81
|
-
* @param path
|
|
82
|
-
* @returns FileUploadResponse Successful Response
|
|
83
|
-
* @throws ApiError
|
|
84
|
-
*/
|
|
85
|
-
static uploadFileFilesResourceTypeResourceIdUploadPost(resourceType, resourceId, formData, path) {
|
|
86
|
-
return __request(OpenAPI, {
|
|
87
|
-
method: 'POST',
|
|
88
|
-
url: '/files/{resource_type}/{resource_id}/upload',
|
|
89
|
-
path: {
|
|
90
|
-
'resource_type': resourceType,
|
|
91
|
-
'resource_id': resourceId,
|
|
92
|
-
},
|
|
93
|
-
query: {
|
|
94
|
-
'path': path,
|
|
95
|
-
},
|
|
96
|
-
formData: formData,
|
|
97
|
-
mediaType: 'multipart/form-data',
|
|
98
|
-
errors: {
|
|
99
|
-
422: `Validation Error`,
|
|
100
|
-
},
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import type { GrantPermissionRequest } from '../models/GrantPermissionRequest.js';
|
|
2
|
-
import type { PodPermissionsResponse } from '../models/PodPermissionsResponse.js';
|
|
3
|
-
import type { ResourcePermissionListResponse } from '../models/ResourcePermissionListResponse.js';
|
|
4
|
-
import type { ResourcePermissionResponse } from '../models/ResourcePermissionResponse.js';
|
|
5
|
-
import type { SetVisibilityRequest } from '../models/SetVisibilityRequest.js';
|
|
6
|
-
import type { CancelablePromise } from '../core/CancelablePromise.js';
|
|
7
|
-
export declare class AuthorizationService {
|
|
8
|
-
/**
|
|
9
|
-
* Get My Pod Permissions
|
|
10
|
-
* @param podId
|
|
11
|
-
* @returns PodPermissionsResponse Successful Response
|
|
12
|
-
* @throws ApiError
|
|
13
|
-
*/
|
|
14
|
-
static podPermissionsMe(podId: string): CancelablePromise<PodPermissionsResponse>;
|
|
15
|
-
/**
|
|
16
|
-
* List Resource Permissions
|
|
17
|
-
* List all ACL entries for a resource. Requires POD_ADMIN or being the resource creator.
|
|
18
|
-
* @param podId
|
|
19
|
-
* @param resourceType
|
|
20
|
-
* @param resourceId
|
|
21
|
-
* @returns ResourcePermissionListResponse Successful Response
|
|
22
|
-
* @throws ApiError
|
|
23
|
-
*/
|
|
24
|
-
static resourcePermissionsList(podId: string, resourceType: string, resourceId: string): CancelablePromise<ResourcePermissionListResponse>;
|
|
25
|
-
/**
|
|
26
|
-
* Grant Resource Permission
|
|
27
|
-
* Add an ACL entry granting a user or role access to a resource.
|
|
28
|
-
* @param podId
|
|
29
|
-
* @param resourceType
|
|
30
|
-
* @param resourceId
|
|
31
|
-
* @param requestBody
|
|
32
|
-
* @returns ResourcePermissionResponse Successful Response
|
|
33
|
-
* @throws ApiError
|
|
34
|
-
*/
|
|
35
|
-
static resourcePermissionsGrant(podId: string, resourceType: string, resourceId: string, requestBody: GrantPermissionRequest): CancelablePromise<ResourcePermissionResponse>;
|
|
36
|
-
/**
|
|
37
|
-
* Revoke Resource Permission
|
|
38
|
-
* Remove an ACL entry for a resource.
|
|
39
|
-
* @param podId
|
|
40
|
-
* @param resourceType
|
|
41
|
-
* @param resourceId
|
|
42
|
-
* @param permissionId
|
|
43
|
-
* @returns void
|
|
44
|
-
* @throws ApiError
|
|
45
|
-
*/
|
|
46
|
-
static resourcePermissionsRevoke(podId: string, resourceType: string, resourceId: string, permissionId: string): CancelablePromise<void>;
|
|
47
|
-
/**
|
|
48
|
-
* Set Resource Visibility
|
|
49
|
-
* Update visibility for a resource (OWNER | RESTRICTED | POD). Requires POD_ADMIN or being the resource creator.
|
|
50
|
-
* @param podId
|
|
51
|
-
* @param resourceType
|
|
52
|
-
* @param resourceId
|
|
53
|
-
* @param requestBody
|
|
54
|
-
* @returns void
|
|
55
|
-
* @throws ApiError
|
|
56
|
-
*/
|
|
57
|
-
static resourceVisibilitySet(podId: string, resourceType: string, resourceId: string, requestBody: SetVisibilityRequest): CancelablePromise<void>;
|
|
58
|
-
}
|