librechat-data-provider 0.7.83 → 0.7.85
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/dist/index.es.js +1 -1
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/react-query/index.es.js +1 -1
- package/dist/react-query/index.es.js.map +1 -1
- package/package.json +3 -1
- package/specs/bedrock.spec.ts +114 -0
- package/specs/web.spec.ts +903 -0
- package/src/api-endpoints.ts +2 -0
- package/src/bedrock.ts +4 -1
- package/src/config.ts +76 -4
- package/src/data-service.ts +8 -0
- package/src/file-config.ts +6 -0
- package/src/generate.ts +3 -3
- package/src/index.ts +4 -0
- package/src/keys.ts +1 -0
- package/src/mcp.ts +13 -6
- package/src/parameterSettings.ts +726 -0
- package/src/permissions.ts +10 -0
- package/src/roles.ts +8 -0
- package/src/schemas.ts +11 -2
- package/src/types/assistants.ts +2 -0
- package/src/types/files.ts +1 -0
- package/src/types/mutations.ts +21 -1
- package/src/types/queries.ts +5 -1
- package/src/types/web.ts +593 -0
- package/src/types.ts +8 -2
- package/src/utils.ts +10 -0
- package/src/web.ts +271 -0
package/src/permissions.ts
CHANGED
|
@@ -28,6 +28,10 @@ export enum PermissionTypes {
|
|
|
28
28
|
* Type for using the "Run Code" LC Code Interpreter API feature
|
|
29
29
|
*/
|
|
30
30
|
RUN_CODE = 'RUN_CODE',
|
|
31
|
+
/**
|
|
32
|
+
* Type for using the "Web Search" feature
|
|
33
|
+
*/
|
|
34
|
+
WEB_SEARCH = 'WEB_SEARCH',
|
|
31
35
|
}
|
|
32
36
|
|
|
33
37
|
/**
|
|
@@ -79,6 +83,11 @@ export const runCodePermissionsSchema = z.object({
|
|
|
79
83
|
});
|
|
80
84
|
export type TRunCodePermissions = z.infer<typeof runCodePermissionsSchema>;
|
|
81
85
|
|
|
86
|
+
export const webSearchPermissionsSchema = z.object({
|
|
87
|
+
[Permissions.USE]: z.boolean().default(true),
|
|
88
|
+
});
|
|
89
|
+
export type TWebSearchPermissions = z.infer<typeof webSearchPermissionsSchema>;
|
|
90
|
+
|
|
82
91
|
// Define a single permissions schema that holds all permission types.
|
|
83
92
|
export const permissionsSchema = z.object({
|
|
84
93
|
[PermissionTypes.PROMPTS]: promptPermissionsSchema,
|
|
@@ -87,4 +96,5 @@ export const permissionsSchema = z.object({
|
|
|
87
96
|
[PermissionTypes.MULTI_CONVO]: multiConvoPermissionsSchema,
|
|
88
97
|
[PermissionTypes.TEMPORARY_CHAT]: temporaryChatPermissionsSchema,
|
|
89
98
|
[PermissionTypes.RUN_CODE]: runCodePermissionsSchema,
|
|
99
|
+
[PermissionTypes.WEB_SEARCH]: webSearchPermissionsSchema,
|
|
90
100
|
});
|
package/src/roles.ts
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
agentPermissionsSchema,
|
|
7
7
|
promptPermissionsSchema,
|
|
8
8
|
runCodePermissionsSchema,
|
|
9
|
+
webSearchPermissionsSchema,
|
|
9
10
|
bookmarkPermissionsSchema,
|
|
10
11
|
multiConvoPermissionsSchema,
|
|
11
12
|
temporaryChatPermissionsSchema,
|
|
@@ -62,6 +63,9 @@ const defaultRolesSchema = z.object({
|
|
|
62
63
|
[PermissionTypes.RUN_CODE]: runCodePermissionsSchema.extend({
|
|
63
64
|
[Permissions.USE]: z.boolean().default(true),
|
|
64
65
|
}),
|
|
66
|
+
[PermissionTypes.WEB_SEARCH]: webSearchPermissionsSchema.extend({
|
|
67
|
+
[Permissions.USE]: z.boolean().default(true),
|
|
68
|
+
}),
|
|
65
69
|
}),
|
|
66
70
|
}),
|
|
67
71
|
[SystemRoles.USER]: roleSchema.extend({
|
|
@@ -96,6 +100,9 @@ export const roleDefaults = defaultRolesSchema.parse({
|
|
|
96
100
|
[PermissionTypes.RUN_CODE]: {
|
|
97
101
|
[Permissions.USE]: true,
|
|
98
102
|
},
|
|
103
|
+
[PermissionTypes.WEB_SEARCH]: {
|
|
104
|
+
[Permissions.USE]: true,
|
|
105
|
+
},
|
|
99
106
|
},
|
|
100
107
|
},
|
|
101
108
|
[SystemRoles.USER]: {
|
|
@@ -107,6 +114,7 @@ export const roleDefaults = defaultRolesSchema.parse({
|
|
|
107
114
|
[PermissionTypes.MULTI_CONVO]: {},
|
|
108
115
|
[PermissionTypes.TEMPORARY_CHAT]: {},
|
|
109
116
|
[PermissionTypes.RUN_CODE]: {},
|
|
117
|
+
[PermissionTypes.WEB_SEARCH]: {},
|
|
110
118
|
},
|
|
111
119
|
},
|
|
112
120
|
});
|
package/src/schemas.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { Tools } from './types/assistants';
|
|
3
3
|
import type { TMessageContentParts, FunctionTool, FunctionToolCall } from './types/assistants';
|
|
4
|
+
import type { SearchResultData } from './types/web';
|
|
4
5
|
import type { TEphemeralAgent } from './types';
|
|
5
6
|
import type { TFile } from './types/files';
|
|
6
7
|
|
|
@@ -101,7 +102,8 @@ export const isEphemeralAgent = (
|
|
|
101
102
|
}
|
|
102
103
|
const hasMCPSelected = (ephemeralAgent?.mcp?.length ?? 0) > 0;
|
|
103
104
|
const hasCodeSelected = (ephemeralAgent?.execute_code ?? false) === true;
|
|
104
|
-
|
|
105
|
+
const hasSearchSelected = (ephemeralAgent?.web_search ?? false) === true;
|
|
106
|
+
return hasMCPSelected || hasCodeSelected || hasSearchSelected;
|
|
105
107
|
};
|
|
106
108
|
|
|
107
109
|
export const isParamEndpoint = (
|
|
@@ -177,6 +179,7 @@ export const defaultAgentFormValues = {
|
|
|
177
179
|
recursion_limit: undefined,
|
|
178
180
|
[Tools.execute_code]: false,
|
|
179
181
|
[Tools.file_search]: false,
|
|
182
|
+
[Tools.web_search]: false,
|
|
180
183
|
};
|
|
181
184
|
|
|
182
185
|
export const ImageVisionTool: FunctionTool = {
|
|
@@ -517,7 +520,13 @@ export const tMessageSchema = z.object({
|
|
|
517
520
|
iconURL: z.string().nullable().optional(),
|
|
518
521
|
});
|
|
519
522
|
|
|
520
|
-
export type TAttachmentMetadata = {
|
|
523
|
+
export type TAttachmentMetadata = {
|
|
524
|
+
type?: Tools;
|
|
525
|
+
messageId: string;
|
|
526
|
+
toolCallId: string;
|
|
527
|
+
[Tools.web_search]?: SearchResultData;
|
|
528
|
+
};
|
|
529
|
+
|
|
521
530
|
export type TAttachment =
|
|
522
531
|
| (TFile & TAttachmentMetadata)
|
|
523
532
|
| (Pick<TFile, 'filename' | 'filepath' | 'conversationId'> & {
|
package/src/types/assistants.ts
CHANGED
|
@@ -19,6 +19,7 @@ export enum Tools {
|
|
|
19
19
|
execute_code = 'execute_code',
|
|
20
20
|
code_interpreter = 'code_interpreter',
|
|
21
21
|
file_search = 'file_search',
|
|
22
|
+
web_search = 'web_search',
|
|
22
23
|
retrieval = 'retrieval',
|
|
23
24
|
function = 'function',
|
|
24
25
|
}
|
|
@@ -222,6 +223,7 @@ export type Agent = {
|
|
|
222
223
|
hide_sequential_outputs?: boolean;
|
|
223
224
|
artifacts?: ArtifactModes;
|
|
224
225
|
recursion_limit?: number;
|
|
226
|
+
version?: number;
|
|
225
227
|
};
|
|
226
228
|
|
|
227
229
|
export type TAgentsMap = Record<string, Agent | undefined>;
|
package/src/types/files.ts
CHANGED
package/src/types/mutations.ts
CHANGED
|
@@ -129,7 +129,20 @@ export type UpdateAgentVariables = {
|
|
|
129
129
|
data: AgentUpdateParams;
|
|
130
130
|
};
|
|
131
131
|
|
|
132
|
-
export type
|
|
132
|
+
export type DuplicateVersionError = Error & {
|
|
133
|
+
statusCode?: number;
|
|
134
|
+
details?: {
|
|
135
|
+
duplicateVersion?: unknown;
|
|
136
|
+
versionIndex?: number;
|
|
137
|
+
};
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
export type UpdateAgentMutationOptions = MutationOptions<
|
|
141
|
+
Agent,
|
|
142
|
+
UpdateAgentVariables,
|
|
143
|
+
unknown,
|
|
144
|
+
DuplicateVersionError
|
|
145
|
+
>;
|
|
133
146
|
|
|
134
147
|
export type DuplicateAgentBody = {
|
|
135
148
|
agent_id: string;
|
|
@@ -159,6 +172,13 @@ export type DeleteAgentActionVariables = {
|
|
|
159
172
|
|
|
160
173
|
export type DeleteAgentActionOptions = MutationOptions<void, DeleteAgentActionVariables>;
|
|
161
174
|
|
|
175
|
+
export type RevertAgentVersionVariables = {
|
|
176
|
+
agent_id: string;
|
|
177
|
+
version_index: number;
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
export type RevertAgentVersionOptions = MutationOptions<Agent, RevertAgentVersionVariables>;
|
|
181
|
+
|
|
162
182
|
export type DeleteConversationOptions = MutationOptions<
|
|
163
183
|
types.TDeleteConversationResponse,
|
|
164
184
|
types.TDeleteConversationRequest
|
package/src/types/queries.ts
CHANGED
|
@@ -101,7 +101,11 @@ export type AllPromptGroupsResponse = t.TPromptGroup[];
|
|
|
101
101
|
export type ConversationTagsResponse = s.TConversationTag[];
|
|
102
102
|
|
|
103
103
|
export type VerifyToolAuthParams = { toolId: string };
|
|
104
|
-
export type VerifyToolAuthResponse = {
|
|
104
|
+
export type VerifyToolAuthResponse = {
|
|
105
|
+
authenticated: boolean;
|
|
106
|
+
message?: string | s.AuthType;
|
|
107
|
+
authTypes?: [string, s.AuthType][];
|
|
108
|
+
};
|
|
105
109
|
|
|
106
110
|
export type GetToolCallParams = { conversationId: string };
|
|
107
111
|
export type ToolCallResults = a.ToolCallResult[];
|