@librechat/data-schemas 0.0.40 → 0.0.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/dist/index.cjs +4819 -284
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.es.js +4791 -283
  4. package/dist/index.es.js.map +1 -1
  5. package/dist/types/admin/capabilities.d.ts +73 -0
  6. package/dist/types/admin/index.d.ts +1 -0
  7. package/dist/types/app/index.d.ts +1 -0
  8. package/dist/types/app/resolution.d.ts +13 -0
  9. package/dist/types/config/tenantContext.d.ts +20 -0
  10. package/dist/types/index.d.ts +5 -1
  11. package/dist/types/methods/aclEntry.d.ts +10 -1
  12. package/dist/types/methods/action.d.ts +34 -0
  13. package/dist/types/methods/agent.d.ts +89 -0
  14. package/dist/types/methods/assistant.d.ts +39 -0
  15. package/dist/types/methods/banner.d.ts +31 -0
  16. package/dist/types/methods/categories.d.ts +34 -0
  17. package/dist/types/methods/config.d.ts +39 -0
  18. package/dist/types/methods/conversation.d.ts +82 -0
  19. package/dist/types/methods/conversationTag.d.ts +93 -0
  20. package/dist/types/methods/index.d.ts +35 -4
  21. package/dist/types/methods/memory.d.ts +1 -0
  22. package/dist/types/methods/message.d.ts +77 -0
  23. package/dist/types/methods/preset.d.ts +88 -0
  24. package/dist/types/methods/prompt.d.ts +410 -0
  25. package/dist/types/methods/role.d.ts +13 -1
  26. package/dist/types/methods/spendTokens.d.ts +63 -0
  27. package/dist/types/methods/systemGrant.d.ts +59 -0
  28. package/dist/types/methods/test-helpers.d.ts +18 -0
  29. package/dist/types/methods/toolCall.d.ts +82 -0
  30. package/dist/types/methods/transaction.d.ts +67 -13
  31. package/dist/types/methods/tx.d.ts +108 -0
  32. package/dist/types/methods/userGroup.d.ts +6 -0
  33. package/dist/types/migrations/index.d.ts +1 -0
  34. package/dist/types/migrations/tenantIndexes.d.ts +52 -0
  35. package/dist/types/models/accessRole.d.ts +0 -3
  36. package/dist/types/models/aclEntry.d.ts +0 -3
  37. package/dist/types/models/action.d.ts +0 -3
  38. package/dist/types/models/agent.d.ts +0 -3
  39. package/dist/types/models/agentCategory.d.ts +0 -3
  40. package/dist/types/models/assistant.d.ts +0 -3
  41. package/dist/types/models/balance.d.ts +0 -3
  42. package/dist/types/models/banner.d.ts +0 -3
  43. package/dist/types/models/{project.d.ts → config.d.ts} +1 -4
  44. package/dist/types/models/conversationTag.d.ts +0 -3
  45. package/dist/types/models/convo.d.ts +0 -3
  46. package/dist/types/models/file.d.ts +0 -3
  47. package/dist/types/models/group.d.ts +0 -3
  48. package/dist/types/models/index.d.ts +2 -1
  49. package/dist/types/models/key.d.ts +0 -3
  50. package/dist/types/models/mcpServer.d.ts +0 -3
  51. package/dist/types/models/message.d.ts +0 -3
  52. package/dist/types/models/pluginAuth.d.ts +0 -3
  53. package/dist/types/models/plugins/tenantIsolation.d.ts +38 -0
  54. package/dist/types/models/preset.d.ts +0 -3
  55. package/dist/types/models/prompt.d.ts +0 -3
  56. package/dist/types/models/promptGroup.d.ts +0 -3
  57. package/dist/types/models/role.d.ts +0 -3
  58. package/dist/types/models/session.d.ts +0 -3
  59. package/dist/types/models/sharedLink.d.ts +0 -3
  60. package/dist/types/models/systemGrant.d.ts +33 -0
  61. package/dist/types/models/token.d.ts +0 -3
  62. package/dist/types/models/toolCall.d.ts +0 -3
  63. package/dist/types/models/transaction.d.ts +0 -3
  64. package/dist/types/models/user.d.ts +0 -3
  65. package/dist/types/schema/agentApiKey.d.ts +1 -0
  66. package/dist/types/schema/banner.d.ts +1 -0
  67. package/dist/types/schema/categories.d.ts +1 -0
  68. package/dist/types/schema/{project.d.ts → config.d.ts} +9 -13
  69. package/dist/types/schema/conversationTag.d.ts +1 -0
  70. package/dist/types/schema/index.d.ts +2 -1
  71. package/dist/types/schema/key.d.ts +1 -0
  72. package/dist/types/schema/preset.d.ts +1 -0
  73. package/dist/types/schema/share.d.ts +1 -0
  74. package/dist/types/schema/systemGrant.d.ts +39 -0
  75. package/dist/types/schema/toolCall.d.ts +1 -0
  76. package/dist/types/schema/transaction.d.ts +1 -0
  77. package/dist/types/types/accessRole.d.ts +1 -0
  78. package/dist/types/types/aclEntry.d.ts +1 -0
  79. package/dist/types/types/action.d.ts +1 -0
  80. package/dist/types/types/admin.d.ts +98 -0
  81. package/dist/types/types/agent.d.ts +3 -5
  82. package/dist/types/types/agentApiKey.d.ts +1 -0
  83. package/dist/types/types/agentCategory.d.ts +1 -0
  84. package/dist/types/types/app.d.ts +3 -1
  85. package/dist/types/types/assistant.d.ts +1 -0
  86. package/dist/types/types/balance.d.ts +11 -0
  87. package/dist/types/types/banner.d.ts +1 -0
  88. package/dist/types/types/config.d.ts +58 -0
  89. package/dist/types/types/convo.d.ts +1 -0
  90. package/dist/types/types/file.d.ts +1 -0
  91. package/dist/types/types/group.d.ts +1 -0
  92. package/dist/types/types/index.d.ts +3 -0
  93. package/dist/types/types/mcp.d.ts +1 -0
  94. package/dist/types/types/memory.d.ts +1 -0
  95. package/dist/types/types/message.d.ts +7 -2
  96. package/dist/types/types/pluginAuth.d.ts +1 -0
  97. package/dist/types/types/prompts.d.ts +2 -1
  98. package/dist/types/types/role.d.ts +1 -0
  99. package/dist/types/types/session.d.ts +1 -0
  100. package/dist/types/types/systemGrant.d.ts +47 -0
  101. package/dist/types/types/token.d.ts +2 -0
  102. package/dist/types/types/user.d.ts +1 -0
  103. package/dist/types/utils/index.d.ts +3 -0
  104. package/dist/types/utils/principal.d.ts +34 -0
  105. package/dist/types/utils/retry.d.ts +41 -0
  106. package/dist/types/utils/string.d.ts +4 -0
  107. package/dist/types/utils/tempChatRetention.d.ts +25 -0
  108. package/package.json +1 -1
  109. package/dist/types/app/web.spec.d.ts +0 -1
  110. package/dist/types/methods/accessRole.spec.d.ts +0 -1
  111. package/dist/types/methods/aclEntry.spec.d.ts +0 -1
  112. package/dist/types/methods/file.spec.d.ts +0 -1
  113. package/dist/types/methods/mcpServer.spec.d.ts +0 -1
  114. package/dist/types/methods/token.spec.d.ts +0 -1
  115. package/dist/types/methods/user.methods.spec.d.ts +0 -1
  116. package/dist/types/methods/userGroup.methods.spec.d.ts +0 -1
  117. package/dist/types/methods/userGroup.roles.spec.d.ts +0 -1
  118. package/dist/types/methods/userGroup.spec.d.ts +0 -1
  119. package/dist/types/models/plugins/mongoMeili.spec.d.ts +0 -1
@@ -24,7 +24,4 @@
24
24
  /// <reference types="mongoose" />
25
25
  /// <reference types="mongoose/types/inferschematype" />
26
26
  /// <reference types="mongoose/types/inferrawdoctype" />
27
- /**
28
- * Creates or returns the Group model using the provided mongoose instance and schema
29
- */
30
27
  export declare function createGroupModel(mongoose: typeof import('mongoose')): import("mongoose").Model<any, {}, {}, {}, any, any>;
@@ -43,7 +43,6 @@ export declare function createModels(mongoose: typeof import('mongoose')): {
43
43
  Assistant: import("mongoose").Model<any, {}, {}, {}, any, any>;
44
44
  File: import("mongoose").Model<any, {}, {}, {}, any, any>;
45
45
  Banner: import("mongoose").Model<any, {}, {}, {}, any, any>;
46
- Project: import("mongoose").Model<any, {}, {}, {}, any, any>;
47
46
  Key: import("mongoose").Model<any, {}, {}, {}, any, any>;
48
47
  PluginAuth: import("mongoose").Model<any, {}, {}, {}, any, any>;
49
48
  Transaction: import("mongoose").Model<any, {}, {}, {}, any, any>;
@@ -56,5 +55,7 @@ export declare function createModels(mongoose: typeof import('mongoose')): {
56
55
  MemoryEntry: import("mongoose").Model<any, {}, {}, {}, any, any>;
57
56
  AccessRole: import("mongoose").Model<any, {}, {}, {}, any, any>;
58
57
  AclEntry: import("mongoose").Model<any, {}, {}, {}, any, any>;
58
+ SystemGrant: import("mongoose").Model<any, {}, {}, {}, any, any>;
59
59
  Group: import("mongoose").Model<any, {}, {}, {}, any, any>;
60
+ Config: import("mongoose").Model<any, {}, {}, {}, any, any>;
60
61
  };
@@ -24,7 +24,4 @@
24
24
  /// <reference types="mongoose" />
25
25
  /// <reference types="mongoose/types/inferschematype" />
26
26
  /// <reference types="mongoose/types/inferrawdoctype" />
27
- /**
28
- * Creates or returns the Key model using the provided mongoose instance and schema
29
- */
30
27
  export declare function createKeyModel(mongoose: typeof import('mongoose')): import("mongoose").Model<any, {}, {}, {}, any, any>;
@@ -24,7 +24,4 @@
24
24
  /// <reference types="mongoose" />
25
25
  /// <reference types="mongoose/types/inferschematype" />
26
26
  /// <reference types="mongoose/types/inferrawdoctype" />
27
- /**
28
- * Creates or returns the MCPServer model using the provided mongoose instance and schema
29
- */
30
27
  export declare function createMCPServerModel(mongoose: typeof import('mongoose')): import("mongoose").Model<any, {}, {}, {}, any, any>;
@@ -24,7 +24,4 @@
24
24
  /// <reference types="mongoose" />
25
25
  /// <reference types="mongoose/types/inferschematype" />
26
26
  /// <reference types="mongoose/types/inferrawdoctype" />
27
- /**
28
- * Creates or returns the Message model using the provided mongoose instance and schema
29
- */
30
27
  export declare function createMessageModel(mongoose: typeof import('mongoose')): import("mongoose").Model<any, {}, {}, {}, any, any>;
@@ -24,7 +24,4 @@
24
24
  /// <reference types="mongoose" />
25
25
  /// <reference types="mongoose/types/inferschematype" />
26
26
  /// <reference types="mongoose/types/inferrawdoctype" />
27
- /**
28
- * Creates or returns the PluginAuth model using the provided mongoose instance and schema
29
- */
30
27
  export declare function createPluginAuthModel(mongoose: typeof import('mongoose')): 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 type { Schema } from 'mongoose';
27
+ /** Resets the cached strict-mode flag. Exposed for test teardown only. */
28
+ export declare function _resetStrictCache(): void;
29
+ /**
30
+ * Mongoose schema plugin that enforces tenant-level data isolation.
31
+ *
32
+ * - `tenantId` present in async context -> injected into every query filter.
33
+ * - `tenantId` is `SYSTEM_TENANT_ID` -> skips injection (explicit cross-tenant op).
34
+ * - `tenantId` absent + `TENANT_ISOLATION_STRICT=true` -> throws (fail-closed).
35
+ * - `tenantId` absent + strict mode off -> passes through (transitional/pre-tenancy).
36
+ * - Update and replace operations that modify `tenantId` are blocked unless running as system.
37
+ */
38
+ export declare function applyTenantIsolation(schema: Schema): void;
@@ -24,7 +24,4 @@
24
24
  /// <reference types="mongoose" />
25
25
  /// <reference types="mongoose/types/inferschematype" />
26
26
  /// <reference types="mongoose/types/inferrawdoctype" />
27
- /**
28
- * Creates or returns the Preset model using the provided mongoose instance and schema
29
- */
30
27
  export declare function createPresetModel(mongoose: typeof import('mongoose')): import("mongoose").Model<any, {}, {}, {}, any, any>;
@@ -24,7 +24,4 @@
24
24
  /// <reference types="mongoose" />
25
25
  /// <reference types="mongoose/types/inferschematype" />
26
26
  /// <reference types="mongoose/types/inferrawdoctype" />
27
- /**
28
- * Creates or returns the Prompt model using the provided mongoose instance and schema
29
- */
30
27
  export declare function createPromptModel(mongoose: typeof import('mongoose')): import("mongoose").Model<any, {}, {}, {}, any, any>;
@@ -24,7 +24,4 @@
24
24
  /// <reference types="mongoose" />
25
25
  /// <reference types="mongoose/types/inferschematype" />
26
26
  /// <reference types="mongoose/types/inferrawdoctype" />
27
- /**
28
- * Creates or returns the PromptGroup model using the provided mongoose instance and schema
29
- */
30
27
  export declare function createPromptGroupModel(mongoose: typeof import('mongoose')): import("mongoose").Model<any, {}, {}, {}, any, any>;
@@ -24,7 +24,4 @@
24
24
  /// <reference types="mongoose" />
25
25
  /// <reference types="mongoose/types/inferschematype" />
26
26
  /// <reference types="mongoose/types/inferrawdoctype" />
27
- /**
28
- * Creates or returns the Role model using the provided mongoose instance and schema
29
- */
30
27
  export declare function createRoleModel(mongoose: typeof import('mongoose')): import("mongoose").Model<any, {}, {}, {}, any, any>;
@@ -24,7 +24,4 @@
24
24
  /// <reference types="mongoose" />
25
25
  /// <reference types="mongoose/types/inferschematype" />
26
26
  /// <reference types="mongoose/types/inferrawdoctype" />
27
- /**
28
- * Creates or returns the Session model using the provided mongoose instance and schema
29
- */
30
27
  export declare function createSessionModel(mongoose: typeof import('mongoose')): import("mongoose").Model<any, {}, {}, {}, any, any>;
@@ -24,7 +24,4 @@
24
24
  /// <reference types="mongoose" />
25
25
  /// <reference types="mongoose/types/inferschematype" />
26
26
  /// <reference types="mongoose/types/inferrawdoctype" />
27
- /**
28
- * Creates or returns the SharedLink model using the provided mongoose instance and schema
29
- */
30
27
  export declare function createSharedLinkModel(mongoose: typeof import('mongoose')): import("mongoose").Model<any, {}, {}, {}, any, any>;
@@ -0,0 +1,33 @@
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
+ /**
28
+ * SystemGrant is a cross-tenant control plane — its query logic in systemGrant methods
29
+ * explicitly handles tenantId conditions (platform-level vs tenant-scoped grants).
30
+ * Do NOT apply tenant isolation plugin here; it would inject a hard tenantId equality
31
+ * filter that conflicts with the $and/$or logic in hasCapabilityForPrincipals.
32
+ */
33
+ export declare function createSystemGrantModel(mongoose: typeof import('mongoose')): import("mongoose").Model<any, {}, {}, {}, any, any>;
@@ -24,7 +24,4 @@
24
24
  /// <reference types="mongoose" />
25
25
  /// <reference types="mongoose/types/inferschematype" />
26
26
  /// <reference types="mongoose/types/inferrawdoctype" />
27
- /**
28
- * Creates or returns the Token model using the provided mongoose instance and schema
29
- */
30
27
  export declare function createTokenModel(mongoose: typeof import('mongoose')): import("mongoose").Model<any, {}, {}, {}, any, any>;
@@ -24,7 +24,4 @@
24
24
  /// <reference types="mongoose" />
25
25
  /// <reference types="mongoose/types/inferschematype" />
26
26
  /// <reference types="mongoose/types/inferrawdoctype" />
27
- /**
28
- * Creates or returns the ToolCall model using the provided mongoose instance and schema
29
- */
30
27
  export declare function createToolCallModel(mongoose: typeof import('mongoose')): import("mongoose").Model<any, {}, {}, {}, any, any>;
@@ -24,7 +24,4 @@
24
24
  /// <reference types="mongoose" />
25
25
  /// <reference types="mongoose/types/inferschematype" />
26
26
  /// <reference types="mongoose/types/inferrawdoctype" />
27
- /**
28
- * Creates or returns the Transaction model using the provided mongoose instance and schema
29
- */
30
27
  export declare function createTransactionModel(mongoose: typeof import('mongoose')): import("mongoose").Model<any, {}, {}, {}, any, any>;
@@ -24,7 +24,4 @@
24
24
  /// <reference types="mongoose" />
25
25
  /// <reference types="mongoose/types/inferschematype" />
26
26
  /// <reference types="mongoose/types/inferrawdoctype" />
27
- /**
28
- * Creates or returns the User model using the provided mongoose instance and schema
29
- */
30
27
  export declare function createUserModel(mongoose: typeof import('mongoose')): import("mongoose").Model<any, {}, {}, {}, any, any>;
@@ -33,6 +33,7 @@ export interface IAgentApiKey extends Document {
33
33
  expiresAt?: Date;
34
34
  createdAt: Date;
35
35
  updatedAt: Date;
36
+ tenantId?: string;
36
37
  }
37
38
  declare const agentApiKeySchema: Schema<IAgentApiKey>;
38
39
  export default agentApiKeySchema;
@@ -32,6 +32,7 @@ export interface IBanner extends Document {
32
32
  type: 'banner' | 'popup';
33
33
  isPublic: boolean;
34
34
  persistable: boolean;
35
+ tenantId?: string;
35
36
  }
36
37
  declare const bannerSchema: Schema<IBanner, import("mongoose").Model<IBanner, any, any, any, Document<unknown, any, IBanner> & IBanner & Required<{
37
38
  _id: unknown;
@@ -27,6 +27,7 @@ import { Schema, Document } from 'mongoose';
27
27
  export interface ICategory extends Document {
28
28
  label: string;
29
29
  value: string;
30
+ tenantId?: string;
30
31
  }
31
32
  declare const categoriesSchema: Schema<ICategory, import("mongoose").Model<ICategory, any, any, any, Document<unknown, any, ICategory> & ICategory & Required<{
32
33
  _id: unknown;
@@ -23,21 +23,17 @@
23
23
  /// <reference types="mongoose/types/virtuals" />
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
25
  /// <reference types="mongoose/types/inferrawdoctype" />
26
- import { Schema, Document, Types } from 'mongoose';
27
- export interface IMongoProject extends Document {
28
- name: string;
29
- promptGroupIds: Types.ObjectId[];
30
- agentIds: string[];
31
- createdAt?: Date;
32
- updatedAt?: Date;
33
- }
34
- declare const projectSchema: Schema<IMongoProject, import("mongoose").Model<IMongoProject, any, any, any, Document<unknown, any, IMongoProject> & IMongoProject & Required<{
35
- _id: unknown;
26
+ import { Schema } from 'mongoose';
27
+ import type { IConfig } from '~/types';
28
+ declare const configSchema: Schema<IConfig, import("mongoose").Model<IConfig, any, any, any, import("mongoose").Document<unknown, any, IConfig> & import("~/types").Config & import("mongoose").Document<unknown, any, any> & {
29
+ _id: import("mongoose").Types.ObjectId;
30
+ } & Required<{
31
+ _id: import("mongoose").Types.ObjectId;
36
32
  }> & {
37
33
  __v: number;
38
- }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, IMongoProject, Document<unknown, {}, import("mongoose").FlatRecord<IMongoProject>> & import("mongoose").FlatRecord<IMongoProject> & Required<{
39
- _id: unknown;
34
+ }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, IConfig, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<IConfig>> & import("mongoose").FlatRecord<IConfig> & Required<{
35
+ _id: import("mongoose").Types.ObjectId;
40
36
  }> & {
41
37
  __v: number;
42
38
  }>;
43
- export default projectSchema;
39
+ export default configSchema;
@@ -30,6 +30,7 @@ export interface IConversationTag extends Document {
30
30
  description?: string;
31
31
  count?: number;
32
32
  position?: number;
33
+ tenantId?: string;
33
34
  }
34
35
  declare const conversationTag: Schema<IConversationTag, import("mongoose").Model<IConversationTag, any, any, any, Document<unknown, any, IConversationTag> & IConversationTag & Required<{
35
36
  _id: unknown;
@@ -13,7 +13,6 @@ export { default as keySchema } from './key';
13
13
  export { default as messageSchema } from './message';
14
14
  export { default as pluginAuthSchema } from './pluginAuth';
15
15
  export { default as presetSchema } from './preset';
16
- export { default as projectSchema } from './project';
17
16
  export { default as promptSchema } from './prompt';
18
17
  export { default as promptGroupSchema } from './promptGroup';
19
18
  export { default as roleSchema } from './role';
@@ -25,3 +24,5 @@ export { default as transactionSchema } from './transaction';
25
24
  export { default as userSchema } from './user';
26
25
  export { default as memorySchema } from './memory';
27
26
  export { default as groupSchema } from './group';
27
+ export { default as systemGrantSchema } from './systemGrant';
28
+ export { default as configSchema } from './config';
@@ -29,6 +29,7 @@ export interface IKey extends Document {
29
29
  name: string;
30
30
  value: string;
31
31
  expiresAt?: Date;
32
+ tenantId?: string;
32
33
  }
33
34
  declare const keySchema: Schema<IKey>;
34
35
  export default keySchema;
@@ -74,6 +74,7 @@ export interface IPreset extends Document {
74
74
  web_search?: boolean;
75
75
  disableStreaming?: boolean;
76
76
  fileTokenLimit?: number;
77
+ tenantId?: string;
77
78
  }
78
79
  declare const presetSchema: Schema<IPreset>;
79
80
  export default presetSchema;
@@ -34,6 +34,7 @@ export interface ISharedLink extends Document {
34
34
  isPublic: boolean;
35
35
  createdAt?: Date;
36
36
  updatedAt?: Date;
37
+ tenantId?: string;
37
38
  }
38
39
  declare const shareSchema: Schema<ISharedLink>;
39
40
  export default shareSchema;
@@ -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 { Schema } from 'mongoose';
27
+ import type { ISystemGrant } from '~/types';
28
+ declare const systemGrantSchema: Schema<ISystemGrant, import("mongoose").Model<ISystemGrant, any, any, any, import("mongoose").Document<unknown, any, ISystemGrant> & import("~/types").SystemGrant & import("mongoose").Document<unknown, any, any> & {
29
+ _id: import("mongoose").Types.ObjectId;
30
+ } & Required<{
31
+ _id: import("mongoose").Types.ObjectId;
32
+ }> & {
33
+ __v: number;
34
+ }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, ISystemGrant, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<ISystemGrant>> & import("mongoose").FlatRecord<ISystemGrant> & Required<{
35
+ _id: import("mongoose").Types.ObjectId;
36
+ }> & {
37
+ __v: number;
38
+ }>;
39
+ export default systemGrantSchema;
@@ -36,6 +36,7 @@ export interface IToolCallData extends Document {
36
36
  partIndex?: number;
37
37
  createdAt?: Date;
38
38
  updatedAt?: Date;
39
+ tenantId?: string;
39
40
  }
40
41
  declare const toolCallSchema: Schema<IToolCallData>;
41
42
  export default toolCallSchema;
@@ -40,6 +40,7 @@ export interface ITransaction extends Document {
40
40
  messageId?: string;
41
41
  createdAt?: Date;
42
42
  updatedAt?: Date;
43
+ tenantId?: string;
43
44
  }
44
45
  declare const transactionSchema: Schema<ITransaction>;
45
46
  export default transactionSchema;
@@ -34,6 +34,7 @@ export type AccessRole = {
34
34
  resourceType: string;
35
35
  /** e.g., 1 for read, 3 for read+write */
36
36
  permBits: number;
37
+ tenantId?: string;
37
38
  };
38
39
  export type IAccessRole = AccessRole & Document & {
39
40
  _id: Types.ObjectId;
@@ -46,6 +46,7 @@ export type AclEntry = {
46
46
  grantedBy?: Types.ObjectId;
47
47
  /** When this permission was granted */
48
48
  grantedAt?: Date;
49
+ tenantId?: string;
49
50
  };
50
51
  export type IAclEntry = AclEntry & Document & {
51
52
  _id: Types.ObjectId;
@@ -49,4 +49,5 @@ export interface IAction extends Document {
49
49
  oauth_client_id?: string;
50
50
  oauth_client_secret?: string;
51
51
  };
52
+ tenantId?: string;
52
53
  }
@@ -0,0 +1,98 @@
1
+ import type { PrincipalType, PrincipalModel, TCustomConfig, z, configSchema } from 'librechat-data-provider';
2
+ /** Base capabilities defined in the SystemCapabilities object. */
3
+ export type BaseSystemCapability = 'access:admin' | 'read:users' | 'manage:users' | 'read:groups' | 'manage:groups' | 'read:roles' | 'manage:roles' | 'read:configs' | 'manage:configs' | 'assign:configs' | 'read:usage' | 'read:agents' | 'manage:agents' | 'manage:mcpservers' | 'read:prompts' | 'manage:prompts' | 'read:assistants' | 'manage:assistants';
4
+ /** Principal types that can receive config overrides. */
5
+ export type ConfigAssignTarget = 'user' | 'group' | 'role';
6
+ /** Top-level keys of the configSchema from librechat.yaml. */
7
+ export type ConfigSection = keyof z.infer<typeof configSchema>;
8
+ /** Section-level config capabilities derived from configSchema keys. */
9
+ type ConfigSectionCapability = `manage:configs:${ConfigSection}` | `read:configs:${ConfigSection}`;
10
+ /** Principal-scoped config assignment capabilities. */
11
+ type ConfigAssignCapability = `assign:configs:${ConfigAssignTarget}`;
12
+ /**
13
+ * Union of all valid capability strings:
14
+ * - Base capabilities from SystemCapabilities
15
+ * - Section-level config capabilities (manage:configs:<section>, read:configs:<section>)
16
+ * - Config assignment capabilities (assign:configs:<user|group|role>)
17
+ */
18
+ export type SystemCapability = BaseSystemCapability | ConfigSectionCapability | ConfigAssignCapability;
19
+ /** UI grouping of capabilities for the admin panel's capability editor. */
20
+ export type CapabilityCategory = {
21
+ key: string;
22
+ labelKey: string;
23
+ capabilities: BaseSystemCapability[];
24
+ };
25
+ /** Config document as returned by the admin API (no Mongoose internals). */
26
+ export type AdminConfig = {
27
+ _id: string;
28
+ principalType: PrincipalType;
29
+ principalId: string;
30
+ principalModel: PrincipalModel;
31
+ priority: number;
32
+ overrides: Partial<TCustomConfig>;
33
+ isActive: boolean;
34
+ configVersion: number;
35
+ tenantId?: string;
36
+ createdAt?: string;
37
+ updatedAt?: string;
38
+ };
39
+ export type AdminConfigListResponse = {
40
+ configs: AdminConfig[];
41
+ };
42
+ export type AdminConfigResponse = {
43
+ config: AdminConfig;
44
+ };
45
+ export type AdminConfigDeleteResponse = {
46
+ success: boolean;
47
+ };
48
+ /** Audit action types for grant changes. */
49
+ export type AuditAction = 'grant_assigned' | 'grant_removed';
50
+ /** SystemGrant document as returned by the admin API. */
51
+ export type AdminSystemGrant = {
52
+ id: string;
53
+ principalType: PrincipalType;
54
+ principalId: string;
55
+ capability: string;
56
+ grantedBy?: string;
57
+ grantedAt: string;
58
+ expiresAt?: string;
59
+ };
60
+ /** Audit log entry for grant changes as returned by the admin API. */
61
+ export type AdminAuditLogEntry = {
62
+ id: string;
63
+ action: AuditAction;
64
+ actorId: string;
65
+ actorName: string;
66
+ targetPrincipalType: PrincipalType;
67
+ targetPrincipalId: string;
68
+ targetName: string;
69
+ capability: string;
70
+ timestamp: string;
71
+ };
72
+ /** Group as returned by the admin API. */
73
+ export type AdminGroup = {
74
+ id: string;
75
+ name: string;
76
+ description: string;
77
+ memberCount: number;
78
+ topMembers: {
79
+ name: string;
80
+ }[];
81
+ isActive: boolean;
82
+ };
83
+ /** Member entry as returned by the admin API for group/role membership lists. */
84
+ export type AdminMember = {
85
+ userId: string;
86
+ name: string;
87
+ email: string;
88
+ avatarUrl?: string;
89
+ joinedAt: string;
90
+ };
91
+ /** Minimal user info returned by user search endpoints. */
92
+ export type AdminUserSearchResult = {
93
+ userId: string;
94
+ name: string;
95
+ email: string;
96
+ avatarUrl?: string;
97
+ };
98
+ export {};
@@ -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, AgentToolOptions } from 'librechat-data-provider';
27
+ import type { GraphEdge, AgentToolOptions, AgentToolResources } from 'librechat-data-provider';
28
28
  export interface ISupportContact {
29
29
  name?: string;
30
30
  email?: string;
@@ -54,11 +54,8 @@ export interface IAgent extends Omit<Document, 'model'> {
54
54
  /** @deprecated Use edges instead */
55
55
  agent_ids?: string[];
56
56
  edges?: GraphEdge[];
57
- /** @deprecated Use ACL permissions instead */
58
- isCollaborative?: boolean;
59
57
  conversation_starters?: string[];
60
- tool_resources?: unknown;
61
- projectIds?: Types.ObjectId[];
58
+ tool_resources?: AgentToolResources;
62
59
  versions?: Omit<IAgent, 'versions'>[];
63
60
  category: string;
64
61
  support_contact?: ISupportContact;
@@ -67,4 +64,5 @@ export interface IAgent extends Omit<Document, 'model'> {
67
64
  mcpServerNames?: string[];
68
65
  /** Per-tool configuration (defer_loading, allowed_callers) */
69
66
  tool_options?: AgentToolOptions;
67
+ tenantId?: string;
70
68
  }
@@ -33,6 +33,7 @@ export interface IAgentApiKey extends Document {
33
33
  expiresAt?: Date;
34
34
  createdAt: Date;
35
35
  updatedAt: Date;
36
+ tenantId?: string;
36
37
  }
37
38
  export interface AgentApiKeyCreateData {
38
39
  userId: Types.ObjectId | string;
@@ -37,6 +37,7 @@ export type AgentCategory = {
37
37
  isActive: boolean;
38
38
  /** Whether this is a custom user-created category */
39
39
  custom?: boolean;
40
+ tenantId?: string;
40
41
  };
41
42
  export type IAgentCategory = AgentCategory & Document & {
42
43
  _id: Types.ObjectId;
@@ -1,4 +1,4 @@
1
- import type { TEndpoint, FileSources, TFileConfig, TAzureConfig, TCustomConfig, TMemoryConfig, TVertexAIConfig, TAssistantEndpoint, TAnthropicEndpoint } from 'librechat-data-provider';
1
+ import type { TEndpoint, FileSources, TFileConfig, TAzureConfig, TCustomConfig, TMemoryConfig, TVertexAIConfig, TAssistantEndpoint, TAnthropicEndpoint, SummarizationConfig } from 'librechat-data-provider';
2
2
  export type JsonSchemaType = {
3
3
  type: 'string' | 'number' | 'integer' | 'float' | 'boolean' | 'array' | 'object';
4
4
  enum?: string[];
@@ -39,6 +39,8 @@ export interface AppConfig {
39
39
  };
40
40
  /** Memory configuration */
41
41
  memory?: TMemoryConfig;
42
+ /** Summarization configuration */
43
+ summarization?: SummarizationConfig;
42
44
  /** Web search configuration */
43
45
  webSearch?: TCustomConfig['webSearch'];
44
46
  /** File storage strategy ('local', 's3', 'firebase', 'azure_blob') */
@@ -36,4 +36,5 @@ export interface IAssistant extends Document {
36
36
  file_ids?: string[];
37
37
  actions?: string[];
38
38
  append_current_datetime?: boolean;
39
+ tenantId?: string;
39
40
  }
@@ -32,4 +32,15 @@ export interface IBalance extends Document {
32
32
  refillIntervalUnit: 'seconds' | 'minutes' | 'hours' | 'days' | 'weeks' | 'months';
33
33
  lastRefill: Date;
34
34
  refillAmount: number;
35
+ tenantId?: string;
36
+ }
37
+ /** Plain data fields for creating or updating a balance record (no Mongoose Document methods) */
38
+ export interface IBalanceUpdate {
39
+ user?: string;
40
+ tokenCredits?: number;
41
+ autoRefillEnabled?: boolean;
42
+ refillIntervalValue?: number;
43
+ refillIntervalUnit?: string;
44
+ refillAmount?: number;
45
+ lastRefill?: Date;
35
46
  }
@@ -32,4 +32,5 @@ export interface IBanner extends Document {
32
32
  type: 'banner' | 'popup';
33
33
  isPublic: boolean;
34
34
  persistable: boolean;
35
+ tenantId?: string;
35
36
  }