@librechat/data-schemas 0.0.35 → 0.0.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.
@@ -0,0 +1,39 @@
1
+ /// <reference types="mongoose/types/aggregate" />
2
+ /// <reference types="mongoose/types/callback" />
3
+ /// <reference types="mongoose/types/collection" />
4
+ /// <reference types="mongoose/types/connection" />
5
+ /// <reference types="mongoose/types/cursor" />
6
+ /// <reference types="mongoose/types/document" />
7
+ /// <reference types="mongoose/types/error" />
8
+ /// <reference types="mongoose/types/expressions" />
9
+ /// <reference types="mongoose/types/helpers" />
10
+ /// <reference types="mongoose/types/middlewares" />
11
+ /// <reference types="mongoose/types/indexes" />
12
+ /// <reference types="mongoose/types/models" />
13
+ /// <reference types="mongoose/types/mongooseoptions" />
14
+ /// <reference types="mongoose/types/pipelinestage" />
15
+ /// <reference types="mongoose/types/populate" />
16
+ /// <reference types="mongoose/types/query" />
17
+ /// <reference types="mongoose/types/schemaoptions" />
18
+ /// <reference types="mongoose/types/schematypes" />
19
+ /// <reference types="mongoose/types/session" />
20
+ /// <reference types="mongoose/types/types" />
21
+ /// <reference types="mongoose/types/utility" />
22
+ /// <reference types="mongoose/types/validation" />
23
+ /// <reference types="mongoose/types/virtuals" />
24
+ /// <reference types="mongoose/types/inferschematype" />
25
+ /// <reference types="mongoose/types/inferrawdoctype" />
26
+ import type { Types } from 'mongoose';
27
+ import type { AgentApiKeyCreateResult, AgentApiKeyCreateData, AgentApiKeyListItem } from '~/types';
28
+ export declare function createAgentApiKeyMethods(mongoose: typeof import('mongoose')): {
29
+ createAgentApiKey: (data: AgentApiKeyCreateData) => Promise<AgentApiKeyCreateResult>;
30
+ validateAgentApiKey: (apiKey: string) => Promise<{
31
+ userId: Types.ObjectId;
32
+ keyId: Types.ObjectId;
33
+ } | null>;
34
+ listAgentApiKeys: (userId: string | Types.ObjectId) => Promise<AgentApiKeyListItem[]>;
35
+ deleteAgentApiKey: (keyId: string | Types.ObjectId, userId: string | Types.ObjectId) => Promise<boolean>;
36
+ deleteAllAgentApiKeys: (userId: string | Types.ObjectId) => Promise<number>;
37
+ getAgentApiKeyById: (keyId: string | Types.ObjectId, userId: string | Types.ObjectId) => Promise<AgentApiKeyListItem | null>;
38
+ };
39
+ export type AgentApiKeyMethods = ReturnType<typeof createAgentApiKeyMethods>;
@@ -31,6 +31,14 @@ export declare function createFileMethods(mongoose: typeof import('mongoose')):
31
31
  findFileById: (file_id: string, options?: Record<string, unknown>) => Promise<IMongoFile | null>;
32
32
  getFiles: (filter: FilterQuery<IMongoFile>, _sortOptions?: Record<string, SortOrder> | null, selectFields?: string | Record<string, 0 | 1> | null | undefined) => Promise<IMongoFile[] | null>;
33
33
  getToolFilesByIds: (fileIds: string[], toolResourceSet?: Set<EToolResources>) => Promise<IMongoFile[]>;
34
+ getCodeGeneratedFiles: (conversationId: string, messageIds?: string[]) => Promise<IMongoFile[]>;
35
+ getUserCodeFiles: (fileIds?: string[]) => Promise<IMongoFile[]>;
36
+ claimCodeFile: (data: {
37
+ filename: string;
38
+ conversationId: string;
39
+ file_id: string;
40
+ user: string;
41
+ }) => Promise<IMongoFile>;
34
42
  createFile: (data: Partial<IMongoFile>, disableTTL?: boolean) => Promise<IMongoFile | null>;
35
43
  updateFile: (data: Partial<IMongoFile> & {
36
44
  file_id: string;
@@ -33,16 +33,18 @@ import { type KeyMethods } from './key';
33
33
  import { type FileMethods } from './file';
34
34
  import { type MemoryMethods } from './memory';
35
35
  import { type AgentCategoryMethods } from './agentCategory';
36
+ import { type AgentApiKeyMethods } from './agentApiKey';
36
37
  import { type MCPServerMethods } from './mcpServer';
37
38
  import { type PluginAuthMethods } from './pluginAuth';
38
39
  import { type AccessRoleMethods } from './accessRole';
39
40
  import { type UserGroupMethods } from './userGroup';
40
41
  import { type AclEntryMethods } from './aclEntry';
41
42
  import { type ShareMethods } from './share';
42
- export type AllMethods = UserMethods & SessionMethods & TokenMethods & RoleMethods & KeyMethods & FileMethods & MemoryMethods & AgentCategoryMethods & MCPServerMethods & UserGroupMethods & AclEntryMethods & ShareMethods & AccessRoleMethods & PluginAuthMethods;
43
+ import { type TransactionMethods } from './transaction';
44
+ export type AllMethods = UserMethods & SessionMethods & TokenMethods & RoleMethods & KeyMethods & FileMethods & MemoryMethods & AgentCategoryMethods & AgentApiKeyMethods & MCPServerMethods & UserGroupMethods & AclEntryMethods & ShareMethods & AccessRoleMethods & PluginAuthMethods & TransactionMethods;
43
45
  /**
44
46
  * Creates all database methods for all collections
45
47
  * @param mongoose - Mongoose instance
46
48
  */
47
49
  export declare function createMethods(mongoose: typeof import('mongoose')): AllMethods;
48
- export type { UserMethods, SessionMethods, TokenMethods, RoleMethods, KeyMethods, FileMethods, MemoryMethods, AgentCategoryMethods, MCPServerMethods, UserGroupMethods, AclEntryMethods, ShareMethods, AccessRoleMethods, PluginAuthMethods, };
50
+ export type { UserMethods, SessionMethods, TokenMethods, RoleMethods, KeyMethods, FileMethods, MemoryMethods, AgentCategoryMethods, AgentApiKeyMethods, MCPServerMethods, UserGroupMethods, AclEntryMethods, ShareMethods, AccessRoleMethods, PluginAuthMethods, TransactionMethods, };
@@ -0,0 +1,46 @@
1
+ /// <reference types="mongoose/types/aggregate" />
2
+ /// <reference types="mongoose/types/callback" />
3
+ /// <reference types="mongoose/types/collection" />
4
+ /// <reference types="mongoose/types/connection" />
5
+ /// <reference types="mongoose/types/cursor" />
6
+ /// <reference types="mongoose/types/document" />
7
+ /// <reference types="mongoose/types/error" />
8
+ /// <reference types="mongoose/types/expressions" />
9
+ /// <reference types="mongoose/types/helpers" />
10
+ /// <reference types="mongoose/types/middlewares" />
11
+ /// <reference types="mongoose/types/indexes" />
12
+ /// <reference types="mongoose/types/models" />
13
+ /// <reference types="mongoose/types/mongooseoptions" />
14
+ /// <reference types="mongoose/types/pipelinestage" />
15
+ /// <reference types="mongoose/types/populate" />
16
+ /// <reference types="mongoose/types/query" />
17
+ /// <reference types="mongoose/types/schemaoptions" />
18
+ /// <reference types="mongoose/types/schematypes" />
19
+ /// <reference types="mongoose/types/session" />
20
+ /// <reference types="mongoose/types/types" />
21
+ /// <reference types="mongoose/types/utility" />
22
+ /// <reference types="mongoose/types/validation" />
23
+ /// <reference types="mongoose/types/virtuals" />
24
+ /// <reference types="mongoose" />
25
+ /// <reference types="mongoose/types/inferschematype" />
26
+ /// <reference types="mongoose/types/inferrawdoctype" />
27
+ import type { IBalance, TransactionData } from '~/types';
28
+ interface UpdateBalanceParams {
29
+ user: string;
30
+ incrementValue: number;
31
+ setValues?: Partial<Pick<IBalance, 'tokenCredits' | 'lastRefill'>>;
32
+ }
33
+ export declare function createTransactionMethods(mongoose: typeof import('mongoose')): {
34
+ updateBalance: ({ user, incrementValue, setValues }: UpdateBalanceParams) => Promise<(import("mongoose").FlattenMaps<any> & Required<{
35
+ _id: unknown;
36
+ }> & {
37
+ __v: number;
38
+ })[] | (import("mongoose").FlattenMaps<any> & Required<{
39
+ _id: unknown;
40
+ }> & {
41
+ __v: number;
42
+ })>;
43
+ bulkInsertTransactions: (docs: TransactionData[]) => Promise<void>;
44
+ };
45
+ export type TransactionMethods = ReturnType<typeof createTransactionMethods>;
46
+ export {};
@@ -0,0 +1,27 @@
1
+ /// <reference types="mongoose/types/aggregate" />
2
+ /// <reference types="mongoose/types/callback" />
3
+ /// <reference types="mongoose/types/collection" />
4
+ /// <reference types="mongoose/types/connection" />
5
+ /// <reference types="mongoose/types/cursor" />
6
+ /// <reference types="mongoose/types/document" />
7
+ /// <reference types="mongoose/types/error" />
8
+ /// <reference types="mongoose/types/expressions" />
9
+ /// <reference types="mongoose/types/helpers" />
10
+ /// <reference types="mongoose/types/middlewares" />
11
+ /// <reference types="mongoose/types/indexes" />
12
+ /// <reference types="mongoose/types/models" />
13
+ /// <reference types="mongoose/types/mongooseoptions" />
14
+ /// <reference types="mongoose/types/pipelinestage" />
15
+ /// <reference types="mongoose/types/populate" />
16
+ /// <reference types="mongoose/types/query" />
17
+ /// <reference types="mongoose/types/schemaoptions" />
18
+ /// <reference types="mongoose/types/schematypes" />
19
+ /// <reference types="mongoose/types/session" />
20
+ /// <reference types="mongoose/types/types" />
21
+ /// <reference types="mongoose/types/utility" />
22
+ /// <reference types="mongoose/types/validation" />
23
+ /// <reference types="mongoose/types/virtuals" />
24
+ /// <reference types="mongoose" />
25
+ /// <reference types="mongoose/types/inferschematype" />
26
+ /// <reference types="mongoose/types/inferrawdoctype" />
27
+ export declare function createAgentApiKeyModel(mongoose: typeof import('mongoose')): import("mongoose").Model<any, {}, {}, {}, any, any>;
@@ -35,6 +35,7 @@ export declare function createModels(mongoose: typeof import('mongoose')): {
35
35
  Conversation: import("mongoose").Model<any, {}, {}, {}, any, any>;
36
36
  Message: import("mongoose").Model<any, {}, {}, {}, any, any>;
37
37
  Agent: import("mongoose").Model<any, {}, {}, {}, any, any>;
38
+ AgentApiKey: import("mongoose").Model<any, {}, {}, {}, any, any>;
38
39
  AgentCategory: import("mongoose").Model<any, {}, {}, {}, any, any>;
39
40
  MCPServer: import("mongoose").Model<any, {}, {}, {}, any, any>;
40
41
  Role: import("mongoose").Model<any, {}, {}, {}, any, any>;
@@ -0,0 +1,38 @@
1
+ /// <reference types="mongoose/types/aggregate" />
2
+ /// <reference types="mongoose/types/callback" />
3
+ /// <reference types="mongoose/types/collection" />
4
+ /// <reference types="mongoose/types/connection" />
5
+ /// <reference types="mongoose/types/cursor" />
6
+ /// <reference types="mongoose/types/document" />
7
+ /// <reference types="mongoose/types/error" />
8
+ /// <reference types="mongoose/types/expressions" />
9
+ /// <reference types="mongoose/types/helpers" />
10
+ /// <reference types="mongoose/types/middlewares" />
11
+ /// <reference types="mongoose/types/indexes" />
12
+ /// <reference types="mongoose/types/models" />
13
+ /// <reference types="mongoose/types/mongooseoptions" />
14
+ /// <reference types="mongoose/types/pipelinestage" />
15
+ /// <reference types="mongoose/types/populate" />
16
+ /// <reference types="mongoose/types/query" />
17
+ /// <reference types="mongoose/types/schemaoptions" />
18
+ /// <reference types="mongoose/types/schematypes" />
19
+ /// <reference types="mongoose/types/session" />
20
+ /// <reference types="mongoose/types/types" />
21
+ /// <reference types="mongoose/types/utility" />
22
+ /// <reference types="mongoose/types/validation" />
23
+ /// <reference types="mongoose/types/virtuals" />
24
+ /// <reference types="mongoose/types/inferschematype" />
25
+ /// <reference types="mongoose/types/inferrawdoctype" />
26
+ import { Schema, Document, Types } from 'mongoose';
27
+ export interface IAgentApiKey extends Document {
28
+ userId: Types.ObjectId;
29
+ name: string;
30
+ keyHash: string;
31
+ keyPrefix: string;
32
+ lastUsedAt?: Date;
33
+ expiresAt?: Date;
34
+ createdAt: Date;
35
+ updatedAt: Date;
36
+ }
37
+ declare const agentApiKeySchema: Schema<IAgentApiKey>;
38
+ export default agentApiKeySchema;
@@ -109,6 +109,12 @@ export declare const conversationPreset: {
109
109
  thinkingBudget: {
110
110
  type: NumberConstructor;
111
111
  };
112
+ thinkingLevel: {
113
+ type: StringConstructor;
114
+ };
115
+ effort: {
116
+ type: StringConstructor;
117
+ };
112
118
  system: {
113
119
  type: StringConstructor;
114
120
  };
@@ -1,5 +1,6 @@
1
1
  export { default as actionSchema } from './action';
2
2
  export { default as agentSchema } from './agent';
3
+ export { default as agentApiKeySchema } from './agentApiKey';
3
4
  export { default as agentCategorySchema } from './agentCategory';
4
5
  export { default as assistantSchema } from './assistant';
5
6
  export { default as balanceSchema } from './balance';
@@ -51,6 +51,7 @@ export interface IPreset extends Document {
51
51
  promptCache?: boolean;
52
52
  thinking?: boolean;
53
53
  thinkingBudget?: number;
54
+ effort?: string;
54
55
  system?: string;
55
56
  resendFiles?: boolean;
56
57
  imageDetail?: string;
@@ -37,6 +37,7 @@ export interface ITransaction extends Document {
37
37
  inputTokens?: number;
38
38
  writeTokens?: number;
39
39
  readTokens?: number;
40
+ messageId?: string;
40
41
  createdAt?: Date;
41
42
  updatedAt?: Date;
42
43
  }
@@ -24,7 +24,7 @@
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
25
  /// <reference types="mongoose/types/inferrawdoctype" />
26
26
  import { Document, Types } from 'mongoose';
27
- import type { GraphEdge } from 'librechat-data-provider';
27
+ import type { GraphEdge, AgentToolOptions } from 'librechat-data-provider';
28
28
  export interface ISupportContact {
29
29
  name?: string;
30
30
  email?: string;
@@ -65,4 +65,6 @@ export interface IAgent extends Omit<Document, 'model'> {
65
65
  is_promoted?: boolean;
66
66
  /** MCP server names extracted from tools for efficient querying */
67
67
  mcpServerNames?: string[];
68
+ /** Per-tool configuration (defer_loading, allowed_callers) */
69
+ tool_options?: AgentToolOptions;
68
70
  }
@@ -0,0 +1,65 @@
1
+ /// <reference types="mongoose/types/aggregate" />
2
+ /// <reference types="mongoose/types/callback" />
3
+ /// <reference types="mongoose/types/collection" />
4
+ /// <reference types="mongoose/types/connection" />
5
+ /// <reference types="mongoose/types/cursor" />
6
+ /// <reference types="mongoose/types/document" />
7
+ /// <reference types="mongoose/types/error" />
8
+ /// <reference types="mongoose/types/expressions" />
9
+ /// <reference types="mongoose/types/helpers" />
10
+ /// <reference types="mongoose/types/middlewares" />
11
+ /// <reference types="mongoose/types/indexes" />
12
+ /// <reference types="mongoose/types/models" />
13
+ /// <reference types="mongoose/types/mongooseoptions" />
14
+ /// <reference types="mongoose/types/pipelinestage" />
15
+ /// <reference types="mongoose/types/populate" />
16
+ /// <reference types="mongoose/types/query" />
17
+ /// <reference types="mongoose/types/schemaoptions" />
18
+ /// <reference types="mongoose/types/schematypes" />
19
+ /// <reference types="mongoose/types/session" />
20
+ /// <reference types="mongoose/types/types" />
21
+ /// <reference types="mongoose/types/utility" />
22
+ /// <reference types="mongoose/types/validation" />
23
+ /// <reference types="mongoose/types/virtuals" />
24
+ /// <reference types="mongoose/types/inferschematype" />
25
+ /// <reference types="mongoose/types/inferrawdoctype" />
26
+ import { Document, Types } from 'mongoose';
27
+ export interface IAgentApiKey extends Document {
28
+ userId: Types.ObjectId;
29
+ name: string;
30
+ keyHash: string;
31
+ keyPrefix: string;
32
+ lastUsedAt?: Date;
33
+ expiresAt?: Date;
34
+ createdAt: Date;
35
+ updatedAt: Date;
36
+ }
37
+ export interface AgentApiKeyCreateData {
38
+ userId: Types.ObjectId | string;
39
+ name: string;
40
+ expiresAt?: Date | null;
41
+ }
42
+ export interface AgentApiKeyCreateResult {
43
+ id: string;
44
+ name: string;
45
+ keyPrefix: string;
46
+ key: string;
47
+ createdAt: Date;
48
+ expiresAt?: Date;
49
+ }
50
+ export interface AgentApiKeyListItem {
51
+ id: string;
52
+ name: string;
53
+ keyPrefix: string;
54
+ lastUsedAt?: Date;
55
+ expiresAt?: Date;
56
+ createdAt: Date;
57
+ }
58
+ export interface AgentApiKeyQuery {
59
+ userId?: Types.ObjectId | string;
60
+ keyPrefix?: string;
61
+ id?: string;
62
+ }
63
+ export interface AgentApiKeyDeleteResult {
64
+ deletedCount?: number;
65
+ }
@@ -50,6 +50,7 @@ export interface IConversation extends Document {
50
50
  promptCache?: boolean;
51
51
  thinking?: boolean;
52
52
  thinkingBudget?: number;
53
+ effort?: string;
53
54
  system?: string;
54
55
  resendFiles?: boolean;
55
56
  imageDetail?: string;
@@ -27,6 +27,7 @@ import { Document, Types } from 'mongoose';
27
27
  export interface IMongoFile extends Omit<Document, 'model'> {
28
28
  user: Types.ObjectId;
29
29
  conversationId?: string;
30
+ messageId?: string;
30
31
  file_id: string;
31
32
  temp_file_id?: string;
32
33
  bytes: number;
@@ -32,8 +32,10 @@ export * from './convo';
32
32
  export * from './session';
33
33
  export * from './balance';
34
34
  export * from './banner';
35
+ export * from './transaction';
35
36
  export * from './message';
36
37
  export * from './agent';
38
+ export * from './agentApiKey';
37
39
  export * from './agentCategory';
38
40
  export * from './role';
39
41
  export * from './action';
@@ -0,0 +1,17 @@
1
+ export interface TransactionData {
2
+ user: string;
3
+ conversationId: string;
4
+ tokenType: string;
5
+ model?: string;
6
+ context?: string;
7
+ valueKey?: string;
8
+ rate?: number;
9
+ rawAmount?: number;
10
+ tokenValue?: number;
11
+ inputTokens?: number;
12
+ writeTokens?: number;
13
+ readTokens?: number;
14
+ messageId?: string;
15
+ inputTokenCount?: number;
16
+ rateDetail?: Record<string, number>;
17
+ }
@@ -1,3 +1,4 @@
1
+ export declare const CANCEL_RATE = 1.15;
1
2
  /**
2
3
  * Checks if the connected MongoDB deployment supports transactions
3
4
  * This requires a MongoDB replica set configuration
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@librechat/data-schemas",
3
- "version": "0.0.35",
3
+ "version": "0.0.37",
4
4
  "description": "Mongoose schemas and models for LibreChat",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -50,8 +50,8 @@
50
50
  "jest": "^30.2.0",
51
51
  "jest-junit": "^16.0.0",
52
52
  "mongodb-memory-server": "^10.1.4",
53
- "rimraf": "^6.1.2",
54
- "rollup": "^4.22.4",
53
+ "rimraf": "^6.1.3",
54
+ "rollup": "^4.34.9",
55
55
  "rollup-plugin-peer-deps-external": "^2.2.4",
56
56
  "rollup-plugin-typescript2": "^0.35.0",
57
57
  "ts-node": "^10.9.2",