@multiplayer-app/ai-agent-mongo 0.1.0-beta.7 → 0.1.0-beta.71
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/cjs/__tests__/helpers.cjs +1 -1
- package/dist/cjs/__tests__/helpers.cjs.map +1 -1
- package/dist/cjs/__tests__/repositories/MongoActivityRepository.test.cjs +365 -0
- package/dist/cjs/__tests__/repositories/MongoActivityRepository.test.cjs.map +1 -0
- package/dist/cjs/__tests__/repositories/MongoActivityRepository.test.d.ts +2 -0
- package/dist/cjs/__tests__/repositories/MongoActivityRepository.test.d.ts.map +1 -0
- package/dist/cjs/__tests__/repositories/MongoAgentChatRepository.test.cjs +12 -68
- package/dist/cjs/__tests__/repositories/MongoAgentChatRepository.test.cjs.map +1 -1
- package/dist/cjs/__tests__/repositories/MongoAgentConfigRepository.test.cjs +67 -0
- package/dist/cjs/__tests__/repositories/MongoAgentConfigRepository.test.cjs.map +1 -0
- package/dist/cjs/__tests__/repositories/MongoAgentConfigRepository.test.d.ts +2 -0
- package/dist/cjs/__tests__/repositories/MongoAgentConfigRepository.test.d.ts.map +1 -0
- package/dist/cjs/__tests__/repositories/MongoAgentMessageRepository.test.cjs +92 -0
- package/dist/cjs/__tests__/repositories/MongoAgentMessageRepository.test.cjs.map +1 -1
- package/dist/cjs/__tests__/schemas/AgentChatSchema.test.cjs +20 -14
- package/dist/cjs/__tests__/schemas/AgentChatSchema.test.cjs.map +1 -1
- package/dist/cjs/__tests__/schemas/AgentConfigPreferenceSchema.test.cjs +62 -0
- package/dist/cjs/__tests__/schemas/AgentConfigPreferenceSchema.test.cjs.map +1 -0
- package/dist/cjs/__tests__/schemas/AgentConfigPreferenceSchema.test.d.ts +2 -0
- package/dist/cjs/__tests__/schemas/AgentConfigPreferenceSchema.test.d.ts.map +1 -0
- package/dist/cjs/__tests__/schemas/AgentMessageSchema.test.cjs +11 -0
- package/dist/cjs/__tests__/schemas/AgentMessageSchema.test.cjs.map +1 -1
- package/dist/cjs/index.cjs +11 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.ts +5 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/repositories/MongoActivityRepository.cjs +403 -0
- package/dist/cjs/repositories/MongoActivityRepository.cjs.map +1 -0
- package/dist/cjs/repositories/MongoActivityRepository.d.ts +64 -0
- package/dist/cjs/repositories/MongoActivityRepository.d.ts.map +1 -0
- package/dist/cjs/repositories/MongoAgentChatRepository.cjs +36 -141
- package/dist/cjs/repositories/MongoAgentChatRepository.cjs.map +1 -1
- package/dist/cjs/repositories/MongoAgentChatRepository.d.ts +4 -14
- package/dist/cjs/repositories/MongoAgentChatRepository.d.ts.map +1 -1
- package/dist/cjs/repositories/MongoAgentConfigRepository.cjs +126 -0
- package/dist/cjs/repositories/MongoAgentConfigRepository.cjs.map +1 -0
- package/dist/cjs/repositories/MongoAgentConfigRepository.d.ts +25 -0
- package/dist/cjs/repositories/MongoAgentConfigRepository.d.ts.map +1 -0
- package/dist/cjs/repositories/MongoAgentMessageRepository.cjs +66 -14
- package/dist/cjs/repositories/MongoAgentMessageRepository.cjs.map +1 -1
- package/dist/cjs/repositories/MongoAgentMessageRepository.d.ts +11 -2
- package/dist/cjs/repositories/MongoAgentMessageRepository.d.ts.map +1 -1
- package/dist/cjs/repositories/MongoTenantAICredentialRepository.cjs +129 -0
- package/dist/cjs/repositories/MongoTenantAICredentialRepository.cjs.map +1 -0
- package/dist/cjs/repositories/MongoTenantAICredentialRepository.d.ts +25 -0
- package/dist/cjs/repositories/MongoTenantAICredentialRepository.d.ts.map +1 -0
- package/dist/cjs/repositories/index.cjs +3 -0
- package/dist/cjs/repositories/index.cjs.map +1 -1
- package/dist/cjs/repositories/index.d.ts +3 -0
- package/dist/cjs/repositories/index.d.ts.map +1 -1
- package/dist/cjs/schemas/ActivitySchema.cjs +34 -0
- package/dist/cjs/schemas/ActivitySchema.cjs.map +1 -0
- package/dist/cjs/schemas/ActivitySchema.d.ts +30 -0
- package/dist/cjs/schemas/ActivitySchema.d.ts.map +1 -0
- package/dist/cjs/schemas/AgentChatSchema.cjs +3 -2
- package/dist/cjs/schemas/AgentChatSchema.cjs.map +1 -1
- package/dist/cjs/schemas/AgentChatSchema.d.ts.map +1 -1
- package/dist/cjs/schemas/AgentConfigPreferenceSchema.cjs +24 -0
- package/dist/cjs/schemas/AgentConfigPreferenceSchema.cjs.map +1 -0
- package/dist/cjs/schemas/AgentConfigPreferenceSchema.d.ts +24 -0
- package/dist/cjs/schemas/AgentConfigPreferenceSchema.d.ts.map +1 -0
- package/dist/cjs/schemas/AgentMessageSchema.cjs +8 -4
- package/dist/cjs/schemas/AgentMessageSchema.cjs.map +1 -1
- package/dist/cjs/schemas/AgentMessageSchema.d.ts.map +1 -1
- package/dist/cjs/schemas/TenantAICredentialSchema.cjs +17 -0
- package/dist/cjs/schemas/TenantAICredentialSchema.cjs.map +1 -0
- package/dist/cjs/schemas/TenantAICredentialSchema.d.ts +20 -0
- package/dist/cjs/schemas/TenantAICredentialSchema.d.ts.map +1 -0
- package/dist/cjs/schemas/index.cjs +3 -0
- package/dist/cjs/schemas/index.cjs.map +1 -1
- package/dist/cjs/schemas/index.d.ts +3 -0
- package/dist/cjs/schemas/index.d.ts.map +1 -1
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/esm/__tests__/helpers.js +1 -1
- package/dist/esm/__tests__/helpers.js.map +1 -1
- package/dist/esm/__tests__/repositories/MongoActivityRepository.test.d.ts +2 -0
- package/dist/esm/__tests__/repositories/MongoActivityRepository.test.d.ts.map +1 -0
- package/dist/esm/__tests__/repositories/MongoActivityRepository.test.js +363 -0
- package/dist/esm/__tests__/repositories/MongoActivityRepository.test.js.map +1 -0
- package/dist/esm/__tests__/repositories/MongoAgentChatRepository.test.js +12 -68
- package/dist/esm/__tests__/repositories/MongoAgentChatRepository.test.js.map +1 -1
- package/dist/esm/__tests__/repositories/MongoAgentConfigRepository.test.d.ts +2 -0
- package/dist/esm/__tests__/repositories/MongoAgentConfigRepository.test.d.ts.map +1 -0
- package/dist/esm/__tests__/repositories/MongoAgentConfigRepository.test.js +65 -0
- package/dist/esm/__tests__/repositories/MongoAgentConfigRepository.test.js.map +1 -0
- package/dist/esm/__tests__/repositories/MongoAgentMessageRepository.test.js +92 -0
- package/dist/esm/__tests__/repositories/MongoAgentMessageRepository.test.js.map +1 -1
- package/dist/esm/__tests__/schemas/AgentChatSchema.test.js +20 -14
- package/dist/esm/__tests__/schemas/AgentChatSchema.test.js.map +1 -1
- package/dist/esm/__tests__/schemas/AgentConfigPreferenceSchema.test.d.ts +2 -0
- package/dist/esm/__tests__/schemas/AgentConfigPreferenceSchema.test.d.ts.map +1 -0
- package/dist/esm/__tests__/schemas/AgentConfigPreferenceSchema.test.js +60 -0
- package/dist/esm/__tests__/schemas/AgentConfigPreferenceSchema.test.js.map +1 -0
- package/dist/esm/__tests__/schemas/AgentMessageSchema.test.js +11 -0
- package/dist/esm/__tests__/schemas/AgentMessageSchema.test.js.map +1 -1
- package/dist/esm/index.d.ts +5 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +5 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/repositories/MongoActivityRepository.d.ts +64 -0
- package/dist/esm/repositories/MongoActivityRepository.d.ts.map +1 -0
- package/dist/esm/repositories/MongoActivityRepository.js +398 -0
- package/dist/esm/repositories/MongoActivityRepository.js.map +1 -0
- package/dist/esm/repositories/MongoAgentChatRepository.d.ts +4 -14
- package/dist/esm/repositories/MongoAgentChatRepository.d.ts.map +1 -1
- package/dist/esm/repositories/MongoAgentChatRepository.js +36 -141
- package/dist/esm/repositories/MongoAgentChatRepository.js.map +1 -1
- package/dist/esm/repositories/MongoAgentConfigRepository.d.ts +25 -0
- package/dist/esm/repositories/MongoAgentConfigRepository.d.ts.map +1 -0
- package/dist/esm/repositories/MongoAgentConfigRepository.js +122 -0
- package/dist/esm/repositories/MongoAgentConfigRepository.js.map +1 -0
- package/dist/esm/repositories/MongoAgentMessageRepository.d.ts +11 -2
- package/dist/esm/repositories/MongoAgentMessageRepository.d.ts.map +1 -1
- package/dist/esm/repositories/MongoAgentMessageRepository.js +66 -14
- package/dist/esm/repositories/MongoAgentMessageRepository.js.map +1 -1
- package/dist/esm/repositories/MongoTenantAICredentialRepository.d.ts +25 -0
- package/dist/esm/repositories/MongoTenantAICredentialRepository.d.ts.map +1 -0
- package/dist/esm/repositories/MongoTenantAICredentialRepository.js +125 -0
- package/dist/esm/repositories/MongoTenantAICredentialRepository.js.map +1 -0
- package/dist/esm/repositories/index.d.ts +3 -0
- package/dist/esm/repositories/index.d.ts.map +1 -1
- package/dist/esm/repositories/index.js +3 -0
- package/dist/esm/repositories/index.js.map +1 -1
- package/dist/esm/schemas/ActivitySchema.d.ts +30 -0
- package/dist/esm/schemas/ActivitySchema.d.ts.map +1 -0
- package/dist/esm/schemas/ActivitySchema.js +31 -0
- package/dist/esm/schemas/ActivitySchema.js.map +1 -0
- package/dist/esm/schemas/AgentChatSchema.d.ts.map +1 -1
- package/dist/esm/schemas/AgentChatSchema.js +3 -2
- package/dist/esm/schemas/AgentChatSchema.js.map +1 -1
- package/dist/esm/schemas/AgentConfigPreferenceSchema.d.ts +24 -0
- package/dist/esm/schemas/AgentConfigPreferenceSchema.d.ts.map +1 -0
- package/dist/esm/schemas/AgentConfigPreferenceSchema.js +21 -0
- package/dist/esm/schemas/AgentConfigPreferenceSchema.js.map +1 -0
- package/dist/esm/schemas/AgentMessageSchema.d.ts.map +1 -1
- package/dist/esm/schemas/AgentMessageSchema.js +8 -4
- package/dist/esm/schemas/AgentMessageSchema.js.map +1 -1
- package/dist/esm/schemas/TenantAICredentialSchema.d.ts +20 -0
- package/dist/esm/schemas/TenantAICredentialSchema.d.ts.map +1 -0
- package/dist/esm/schemas/TenantAICredentialSchema.js +14 -0
- package/dist/esm/schemas/TenantAICredentialSchema.js.map +1 -0
- package/dist/esm/schemas/index.d.ts +3 -0
- package/dist/esm/schemas/index.d.ts.map +1 -1
- package/dist/esm/schemas/index.js +3 -0
- package/dist/esm/schemas/index.js.map +1 -1
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +48 -43
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { TenantAICredential, AIProvider } from '@multiplayer-app/ai-agent-types';
|
|
2
|
+
import type { TenantAICredentialRepository } from '@multiplayer-app/ai-agent-db';
|
|
3
|
+
import { SortOrder } from '@multiplayer-app/ai-agent-types';
|
|
4
|
+
export declare class MongoTenantAICredentialRepository implements TenantAICredentialRepository {
|
|
5
|
+
findById(id: string): Promise<TenantAICredential | null>;
|
|
6
|
+
find(filter?: Partial<TenantAICredential>, options?: {
|
|
7
|
+
sort?: {
|
|
8
|
+
field: string;
|
|
9
|
+
order: SortOrder;
|
|
10
|
+
};
|
|
11
|
+
skip?: number;
|
|
12
|
+
limit?: number;
|
|
13
|
+
}): Promise<TenantAICredential[]>;
|
|
14
|
+
findOne(filter: Partial<TenantAICredential>): Promise<TenantAICredential | null>;
|
|
15
|
+
create(entity: Omit<TenantAICredential, 'id' | 'createdAt' | 'updatedAt'>): Promise<TenantAICredential>;
|
|
16
|
+
update(id: string, updates: Partial<Omit<TenantAICredential, 'id' | 'createdAt'>>): Promise<TenantAICredential | null>;
|
|
17
|
+
delete(id: string): Promise<boolean>;
|
|
18
|
+
exists(id: string): Promise<boolean>;
|
|
19
|
+
count(filter?: Partial<TenantAICredential>): Promise<number>;
|
|
20
|
+
findByTenantKey(tenantKey: string): Promise<TenantAICredential[]>;
|
|
21
|
+
findByTenantKeyAndProvider(tenantKey: string, provider: AIProvider): Promise<TenantAICredential | null>;
|
|
22
|
+
upsertByTenantKeyAndProvider(tenantKey: string, tenants: Record<string, string>, provider: AIProvider, encryptedApiKey: string, baseUrl?: string): Promise<TenantAICredential>;
|
|
23
|
+
deleteByTenantKeyAndProvider(tenantKey: string, provider: AIProvider): Promise<boolean>;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=MongoTenantAICredentialRepository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MongoTenantAICredentialRepository.d.ts","sourceRoot":"","sources":["../../../src/repositories/MongoTenantAICredentialRepository.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AACtF,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,8BAA8B,CAAC;AACjF,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AA4B5D,qBAAa,iCAAkC,YAAW,4BAA4B;IAC9E,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC;IAKxD,IAAI,CACR,MAAM,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,EACpC,OAAO,CAAC,EAAE;QACR,IAAI,CAAC,EAAE;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,SAAS,CAAA;SAAE,CAAC;QAC3C,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,GACA,OAAO,CAAC,kBAAkB,EAAE,CAAC;IAqB1B,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,kBAAkB,CAAC,GAAG,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC;IAUhF,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,kBAAkB,EAAE,IAAI,GAAG,WAAW,GAAG,WAAW,CAAC,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAQvG,MAAM,CACV,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,kBAAkB,EAAE,IAAI,GAAG,WAAW,CAAC,CAAC,GAC7D,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC;IAS/B,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAKpC,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAKpC,KAAK,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;IAU5D,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC;IAKjE,0BAA0B,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,GAAG,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC;IAKvG,4BAA4B,CAChC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC/B,QAAQ,EAAE,UAAU,EACpB,eAAe,EAAE,MAAM,EACvB,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,kBAAkB,CAAC;IAwBxB,4BAA4B,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC;CAI9F"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { SortOrder } from '@multiplayer-app/ai-agent-types';
|
|
2
|
+
import { TenantAICredentialModel, } from '../schemas/TenantAICredentialSchema';
|
|
3
|
+
function toTenantAICredential(doc) {
|
|
4
|
+
if (!doc)
|
|
5
|
+
return null;
|
|
6
|
+
const value = doc.toObject ? doc.toObject() : doc;
|
|
7
|
+
const tenantsValue = value.tenants;
|
|
8
|
+
const tenants = tenantsValue instanceof Map
|
|
9
|
+
? Object.fromEntries(tenantsValue.entries())
|
|
10
|
+
: (tenantsValue ?? {});
|
|
11
|
+
return {
|
|
12
|
+
id: doc._id.toString(),
|
|
13
|
+
tenantKey: value.tenantKey,
|
|
14
|
+
tenants,
|
|
15
|
+
provider: value.provider,
|
|
16
|
+
encryptedApiKey: value.encryptedApiKey,
|
|
17
|
+
baseUrl: value.baseUrl,
|
|
18
|
+
createdAt: value.createdAt?.toISOString?.() ?? value.createdAt,
|
|
19
|
+
updatedAt: value.updatedAt?.toISOString?.() ?? value.updatedAt,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export class MongoTenantAICredentialRepository {
|
|
23
|
+
async findById(id) {
|
|
24
|
+
const doc = await TenantAICredentialModel.findById(id).exec();
|
|
25
|
+
return toTenantAICredential(doc);
|
|
26
|
+
}
|
|
27
|
+
async find(filter, options) {
|
|
28
|
+
const query = {};
|
|
29
|
+
if (filter) {
|
|
30
|
+
if (filter.id)
|
|
31
|
+
query._id = filter.id;
|
|
32
|
+
if (filter.tenantKey !== undefined)
|
|
33
|
+
query.tenantKey = filter.tenantKey;
|
|
34
|
+
if (filter.provider !== undefined)
|
|
35
|
+
query.provider = filter.provider;
|
|
36
|
+
}
|
|
37
|
+
let qb = TenantAICredentialModel.find(query);
|
|
38
|
+
if (options?.sort) {
|
|
39
|
+
const sortField = options.sort.field === 'id' ? '_id' : options.sort.field;
|
|
40
|
+
const sortOrder = options.sort.order === SortOrder.Asc ? 1 : -1;
|
|
41
|
+
qb = qb.sort({ [sortField]: sortOrder });
|
|
42
|
+
}
|
|
43
|
+
if (options?.skip)
|
|
44
|
+
qb = qb.skip(options.skip);
|
|
45
|
+
if (options?.limit)
|
|
46
|
+
qb = qb.limit(options.limit);
|
|
47
|
+
const docs = await qb.exec();
|
|
48
|
+
return docs.map((doc) => toTenantAICredential(doc)).filter(Boolean);
|
|
49
|
+
}
|
|
50
|
+
async findOne(filter) {
|
|
51
|
+
const query = {};
|
|
52
|
+
if (filter.id)
|
|
53
|
+
query._id = filter.id;
|
|
54
|
+
if (filter.tenantKey !== undefined)
|
|
55
|
+
query.tenantKey = filter.tenantKey;
|
|
56
|
+
if (filter.provider !== undefined)
|
|
57
|
+
query.provider = filter.provider;
|
|
58
|
+
const doc = await TenantAICredentialModel.findOne(query).exec();
|
|
59
|
+
return toTenantAICredential(doc);
|
|
60
|
+
}
|
|
61
|
+
async create(entity) {
|
|
62
|
+
const doc = new TenantAICredentialModel(entity);
|
|
63
|
+
const saved = await doc.save();
|
|
64
|
+
const result = toTenantAICredential(saved);
|
|
65
|
+
if (!result)
|
|
66
|
+
throw new Error('Failed to create tenant AI credential');
|
|
67
|
+
return result;
|
|
68
|
+
}
|
|
69
|
+
async update(id, updates) {
|
|
70
|
+
const doc = await TenantAICredentialModel.findByIdAndUpdate(id, { $set: updates }, { new: true, runValidators: true }).exec();
|
|
71
|
+
return toTenantAICredential(doc);
|
|
72
|
+
}
|
|
73
|
+
async delete(id) {
|
|
74
|
+
const result = await TenantAICredentialModel.findByIdAndDelete(id).exec();
|
|
75
|
+
return !!result;
|
|
76
|
+
}
|
|
77
|
+
async exists(id) {
|
|
78
|
+
const count = await TenantAICredentialModel.countDocuments({ _id: id }).exec();
|
|
79
|
+
return count > 0;
|
|
80
|
+
}
|
|
81
|
+
async count(filter) {
|
|
82
|
+
const query = {};
|
|
83
|
+
if (filter) {
|
|
84
|
+
if (filter.id)
|
|
85
|
+
query._id = filter.id;
|
|
86
|
+
if (filter.tenantKey !== undefined)
|
|
87
|
+
query.tenantKey = filter.tenantKey;
|
|
88
|
+
if (filter.provider !== undefined)
|
|
89
|
+
query.provider = filter.provider;
|
|
90
|
+
}
|
|
91
|
+
return TenantAICredentialModel.countDocuments(query).exec();
|
|
92
|
+
}
|
|
93
|
+
async findByTenantKey(tenantKey) {
|
|
94
|
+
const docs = await TenantAICredentialModel.find({ tenantKey }).exec();
|
|
95
|
+
return docs.map((doc) => toTenantAICredential(doc)).filter(Boolean);
|
|
96
|
+
}
|
|
97
|
+
async findByTenantKeyAndProvider(tenantKey, provider) {
|
|
98
|
+
const doc = await TenantAICredentialModel.findOne({ tenantKey, provider }).exec();
|
|
99
|
+
return toTenantAICredential(doc);
|
|
100
|
+
}
|
|
101
|
+
async upsertByTenantKeyAndProvider(tenantKey, tenants, provider, encryptedApiKey, baseUrl) {
|
|
102
|
+
const doc = await TenantAICredentialModel.findOneAndUpdate({ tenantKey, provider }, {
|
|
103
|
+
$set: {
|
|
104
|
+
tenantKey,
|
|
105
|
+
tenants,
|
|
106
|
+
provider,
|
|
107
|
+
encryptedApiKey,
|
|
108
|
+
baseUrl,
|
|
109
|
+
},
|
|
110
|
+
}, {
|
|
111
|
+
new: true,
|
|
112
|
+
upsert: true,
|
|
113
|
+
runValidators: true,
|
|
114
|
+
}).exec();
|
|
115
|
+
const result = toTenantAICredential(doc);
|
|
116
|
+
if (!result)
|
|
117
|
+
throw new Error('Failed to upsert tenant AI credential');
|
|
118
|
+
return result;
|
|
119
|
+
}
|
|
120
|
+
async deleteByTenantKeyAndProvider(tenantKey, provider) {
|
|
121
|
+
const result = await TenantAICredentialModel.findOneAndDelete({ tenantKey, provider }).exec();
|
|
122
|
+
return !!result;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=MongoTenantAICredentialRepository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MongoTenantAICredentialRepository.js","sourceRoot":"","sources":["../../../src/repositories/MongoTenantAICredentialRepository.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAC5D,OAAO,EACL,uBAAuB,GAExB,MAAM,qCAAqC,CAAC;AAE7C,SAAS,oBAAoB,CAAC,GAAsC;IAClE,IAAI,CAAC,GAAG;QAAE,OAAO,IAAI,CAAC;IAEtB,MAAM,KAAK,GAAI,GAAW,CAAC,QAAQ,CAAC,CAAC,CAAE,GAAW,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;IACpE,MAAM,YAAY,GAAG,KAAK,CAAC,OAAmE,CAAC;IAC/F,MAAM,OAAO,GACX,YAAY,YAAY,GAAG;QACzB,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;QAC5C,CAAC,CAAC,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC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I,CAAC,MAAM;YAAE,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;QACtE,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,KAAK,CAAC,4BAA4B,CAAC,SAAiB,EAAE,QAAoB;QACxE,MAAM,MAAM,GAAG,MAAM,uBAAuB,CAAC,gBAAgB,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;QAC9F,OAAO,CAAC,CAAC,MAAM,CAAC;IAClB,CAAC;CACF"}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
export * from './MongoAgentChatRepository';
|
|
2
2
|
export * from './MongoAgentMessageRepository';
|
|
3
|
+
export * from './MongoActivityRepository';
|
|
4
|
+
export * from './MongoAgentConfigRepository';
|
|
5
|
+
export * from './MongoTenantAICredentialRepository';
|
|
3
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/repositories/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,+BAA+B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/repositories/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qCAAqC,CAAC"}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
export * from './MongoAgentChatRepository';
|
|
2
2
|
export * from './MongoAgentMessageRepository';
|
|
3
|
+
export * from './MongoActivityRepository';
|
|
4
|
+
export * from './MongoAgentConfigRepository';
|
|
5
|
+
export * from './MongoTenantAICredentialRepository';
|
|
3
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/repositories/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,+BAA+B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/repositories/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qCAAqC,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type ObjectId, type Document } from '../mongo';
|
|
2
|
+
import type { Activity } from '@multiplayer-app/ai-agent-types';
|
|
3
|
+
/**
|
|
4
|
+
* Mongoose document interface for Activity
|
|
5
|
+
*/
|
|
6
|
+
export interface ActivityDocument extends Omit<Activity, 'id'>, Document {
|
|
7
|
+
_id: ObjectId;
|
|
8
|
+
systemCost: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Mongoose schema for Activity
|
|
12
|
+
*/
|
|
13
|
+
export declare const ActivitySchema: import("mongoose").Schema<ActivityDocument, import("mongoose").Model<ActivityDocument, any, any, any, Document<unknown, any, ActivityDocument, any, {}> & ActivityDocument & Required<{
|
|
14
|
+
_id: import("mongoose").Types.ObjectId;
|
|
15
|
+
}> & {
|
|
16
|
+
__v: number;
|
|
17
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, ActivityDocument, Document<unknown, {}, import("mongoose").FlatRecord<ActivityDocument>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<ActivityDocument> & Required<{
|
|
18
|
+
_id: import("mongoose").Types.ObjectId;
|
|
19
|
+
}> & {
|
|
20
|
+
__v: number;
|
|
21
|
+
}>;
|
|
22
|
+
/**
|
|
23
|
+
* Mongoose model for Activity
|
|
24
|
+
*/
|
|
25
|
+
export declare const ActivityModel: import("mongoose").Model<ActivityDocument, {}, {}, {}, Document<unknown, {}, ActivityDocument, {}, {}> & ActivityDocument & Required<{
|
|
26
|
+
_id: import("mongoose").Types.ObjectId;
|
|
27
|
+
}> & {
|
|
28
|
+
__v: number;
|
|
29
|
+
}, any>;
|
|
30
|
+
//# sourceMappingURL=ActivitySchema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ActivitySchema.d.ts","sourceRoot":"","sources":["../../../src/schemas/ActivitySchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,QAAQ,EAAE,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAC;AAC1E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAEhE;;GAEG;AACH,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAE,QAAQ;IACtE,GAAG,EAAE,QAAQ,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,eAAO,MAAM,cAAc;;;;;;;;EAczB,CAAC;AAYH;;GAEG;AACH,eAAO,MAAM,aAAa;;;;OAA+D,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { mongoose, Schema } from '../mongo';
|
|
2
|
+
/**
|
|
3
|
+
* Mongoose schema for Activity
|
|
4
|
+
*/
|
|
5
|
+
export const ActivitySchema = new Schema({
|
|
6
|
+
ownerId: { type: String, required: true, index: true },
|
|
7
|
+
groupId: { type: String, required: true, index: true },
|
|
8
|
+
name: { type: String, required: true, index: true },
|
|
9
|
+
description: { type: String, required: false },
|
|
10
|
+
parentId: { type: String, required: false, index: true, sparse: true },
|
|
11
|
+
tenants: { type: Map, of: String, required: true, default: {} },
|
|
12
|
+
sourceId: { type: String, required: true, index: true, default: '' },
|
|
13
|
+
sourceType: { type: String, required: true, index: true, default: 'Unknown' },
|
|
14
|
+
metadata: { type: Schema.Types.Mixed, required: true },
|
|
15
|
+
systemCost: { type: Number, required: false, default: 0, select: false }
|
|
16
|
+
}, {
|
|
17
|
+
timestamps: true,
|
|
18
|
+
_id: true,
|
|
19
|
+
});
|
|
20
|
+
// Create indexes for common queries
|
|
21
|
+
ActivitySchema.index({ "tenants.workspace": 1 });
|
|
22
|
+
ActivitySchema.index({ "tenants.project": 1 });
|
|
23
|
+
ActivitySchema.index({ "tenants.account": 1 });
|
|
24
|
+
ActivitySchema.index({ "tenants.$**": 1 });
|
|
25
|
+
ActivitySchema.index({ ownerId: 1, groupId: 1 });
|
|
26
|
+
ActivitySchema.index({ ownerId: 1, sourceId: 1 });
|
|
27
|
+
/**
|
|
28
|
+
* Mongoose model for Activity
|
|
29
|
+
*/
|
|
30
|
+
export const ActivityModel = mongoose.model('Activity', ActivitySchema);
|
|
31
|
+
//# sourceMappingURL=ActivitySchema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ActivitySchema.js","sourceRoot":"","sources":["../../../src/schemas/ActivitySchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAgC,MAAM,UAAU,CAAC;AAW1E;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,MAAM,CAAmB;IACzD,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE;IACtD,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE;IACtD,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE;IACnD,WAAW,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE;IAC9C,QAAQ,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE;I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,KAAK,CAAmB,UAAU,EAAE,cAAc,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentChatSchema.d.ts","sourceRoot":"","sources":["../../../src/schemas/AgentChatSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,QAAQ,EAAE,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAC;AAC1E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAGjE;;GAEG;AACH,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC;IACvF,GAAG,EAAE,QAAQ,CAAC;CACf;AAED;;GAEG;AACH,eAAO,MAAM,eAAe;;;;;;;;EAa1B,CAAC;
|
|
1
|
+
{"version":3,"file":"AgentChatSchema.d.ts","sourceRoot":"","sources":["../../../src/schemas/AgentChatSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,QAAQ,EAAE,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAC;AAC1E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAGjE;;GAEG;AACH,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC;IACvF,GAAG,EAAE,QAAQ,CAAC;CACf;AAED;;GAEG;AACH,eAAO,MAAM,eAAe;;;;;;;;EAa1B,CAAC;AAMH;;GAEG;AACH,eAAO,MAAM,cAAc;;;;OAAkE,CAAC"}
|
|
@@ -12,13 +12,14 @@ export const AgentChatSchema = new Schema({
|
|
|
12
12
|
createdAt: { type: String, required: true },
|
|
13
13
|
updatedAt: { type: String, required: true },
|
|
14
14
|
metadata: { type: Schema.Types.Mixed },
|
|
15
|
-
|
|
15
|
+
tenants: { type: Map, of: String, required: true }
|
|
16
16
|
}, {
|
|
17
17
|
timestamps: false,
|
|
18
18
|
_id: true,
|
|
19
19
|
});
|
|
20
20
|
// Create indexes for common queries
|
|
21
|
-
AgentChatSchema.index({ userId: 1
|
|
21
|
+
AgentChatSchema.index({ 'tenants.userId': 1 });
|
|
22
|
+
AgentChatSchema.index({ 'tenants.userId': 1, contextKey: 1 });
|
|
22
23
|
/**
|
|
23
24
|
* Mongoose model for AgentChat
|
|
24
25
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentChatSchema.js","sourceRoot":"","sources":["../../../src/schemas/AgentChatSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAgC,MAAM,UAAU,CAAC;AAE1E,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AASxE;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,MAAM,CAAoB;IAC3D,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE;IACxC,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,IAAI,EAAE;IAC9F,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE;IAC3E,UAAU,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE;IACzD,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;IACvB,SAAS,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IAC3C,SAAS,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,I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,UAAU,EAAE,KAAK;IACjB,GAAG,EAAE,IAAI;CACV,CAAC,CAAC;AAEH,oCAAoC;AACpC,eAAe,CAAC,KAAK,CAAC,EAAE,gBAAgB,EAAE,CAAC,EAAE,CAAC,CAAC;AAC/C,eAAe,CAAC,KAAK,CAAC,EAAE,gBAAgB,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC,CAAC;AAE9D;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,QAAQ,CAAC,KAAK,CAAoB,WAAW,EAAE,eAAe,CAAC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ObjectId, type Document } from '../mongo';
|
|
2
|
+
import type { AgentConfigPreference } from '@multiplayer-app/ai-agent-types';
|
|
3
|
+
export interface AgentConfigPreferenceDocument extends Omit<AgentConfigPreference, 'id'>, Document {
|
|
4
|
+
_id: ObjectId;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Stores per-user tool preferences for a specific agent.
|
|
8
|
+
* One document per (userId, agentName).
|
|
9
|
+
*/
|
|
10
|
+
export declare const AgentConfigPreferenceSchema: import("mongoose").Schema<AgentConfigPreferenceDocument, import("mongoose").Model<AgentConfigPreferenceDocument, any, any, any, Document<unknown, any, AgentConfigPreferenceDocument, any, {}> & AgentConfigPreferenceDocument & Required<{
|
|
11
|
+
_id: import("mongoose").Types.ObjectId;
|
|
12
|
+
}> & {
|
|
13
|
+
__v: number;
|
|
14
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, AgentConfigPreferenceDocument, Document<unknown, {}, import("mongoose").FlatRecord<AgentConfigPreferenceDocument>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<AgentConfigPreferenceDocument> & Required<{
|
|
15
|
+
_id: import("mongoose").Types.ObjectId;
|
|
16
|
+
}> & {
|
|
17
|
+
__v: number;
|
|
18
|
+
}>;
|
|
19
|
+
export declare const AgentConfigPreferenceModel: import("mongoose").Model<AgentConfigPreferenceDocument, {}, {}, {}, Document<unknown, {}, AgentConfigPreferenceDocument, {}, {}> & AgentConfigPreferenceDocument & Required<{
|
|
20
|
+
_id: import("mongoose").Types.ObjectId;
|
|
21
|
+
}> & {
|
|
22
|
+
__v: number;
|
|
23
|
+
}, any>;
|
|
24
|
+
//# sourceMappingURL=AgentConfigPreferenceSchema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgentConfigPreferenceSchema.d.ts","sourceRoot":"","sources":["../../../src/schemas/AgentConfigPreferenceSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,QAAQ,EAAU,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAC;AACrE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAE7E,MAAM,WAAW,6BAA8B,SAAQ,IAAI,CAAC,qBAAqB,EAAE,IAAI,CAAC,EAAE,QAAQ;IAChG,GAAG,EAAE,QAAQ,CAAC;CACf;AAED;;;GAGG;AACH,eAAO,MAAM,2BAA2B;;;;;;;;EAWtC,CAAC;AAKH,eAAO,MAAM,0BAA0B;;;;OAGtC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { mongoose, Schema } from '../mongo';
|
|
2
|
+
/**
|
|
3
|
+
* Stores per-user tool preferences for a specific agent.
|
|
4
|
+
* One document per (userId, agentName).
|
|
5
|
+
*/
|
|
6
|
+
export const AgentConfigPreferenceSchema = new Schema({
|
|
7
|
+
userId: { type: String, required: true },
|
|
8
|
+
agentName: { type: String, required: true },
|
|
9
|
+
tools: {
|
|
10
|
+
type: Map,
|
|
11
|
+
of: Boolean,
|
|
12
|
+
default: {},
|
|
13
|
+
},
|
|
14
|
+
}, {
|
|
15
|
+
timestamps: true,
|
|
16
|
+
_id: true,
|
|
17
|
+
});
|
|
18
|
+
// Enforce one preference document per user/agent pair.
|
|
19
|
+
AgentConfigPreferenceSchema.index({ userId: 1, agentName: 1 }, { unique: true });
|
|
20
|
+
export const AgentConfigPreferenceModel = mongoose.model('AgentConfigPreference', AgentConfigPreferenceSchema);
|
|
21
|
+
//# sourceMappingURL=AgentConfigPreferenceSchema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgentConfigPreferenceSchema.js","sourceRoot":"","sources":["../../../src/schemas/AgentConfigPreferenceSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAY,MAAM,EAAiB,MAAM,UAAU,CAAC;AAOrE;;;GAGG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,IAAI,MAAM,CAAgC;IACnF,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IACxC,SAAS,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IAC3C,KAAK,EAAE;QACL,IAAI,EAAE,GAAG;QACT,EAAE,EAAE,OAAO;QACX,OAAO,EAAE,EAAE;KACZ;CACF,EAAE;IACD,UAAU,EAAE,IAAI;IAChB,GAAG,EAAE,IAAI;CACV,CAAC,CAAC;AAEH,uDAAuD;AACvD,2BAA2B,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;AAEjF,MAAM,CAAC,MAAM,0BAA0B,GAAG,QAAQ,CAAC,KAAK,CACtD,uBAAuB,EACvB,2BAA2B,CAC5B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentMessageSchema.d.ts","sourceRoot":"","sources":["../../../src/schemas/AgentMessageSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,QAAQ,EAAE,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAC;AAC1E,OAAO,KAAK,EAAE,YAAY,EAAkC,MAAM,iCAAiC,CAAC;AAGpG;;GAEG;AACH,MAAM,WAAW,oBAAqB,SAAQ,IAAI,CAAC,YAAY,EAAE,IAAI,GAAG,MAAM,CAAC,EAAE,QAAQ;IACvF,GAAG,EAAE,QAAQ,CAAC;IACd,IAAI,EAAE,QAAQ,CAAC;CAChB;
|
|
1
|
+
{"version":3,"file":"AgentMessageSchema.d.ts","sourceRoot":"","sources":["../../../src/schemas/AgentMessageSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,QAAQ,EAAE,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAC;AAC1E,OAAO,KAAK,EAAE,YAAY,EAAkC,MAAM,iCAAiC,CAAC;AAGpG;;GAEG;AACH,MAAM,WAAW,oBAAqB,SAAQ,IAAI,CAAC,YAAY,EAAE,IAAI,GAAG,MAAM,CAAC,EAAE,QAAQ;IACvF,GAAG,EAAE,QAAQ,CAAC;IACd,IAAI,EAAE,QAAQ,CAAC;CAChB;AAiCD;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;EAe7B,CAAC;AAMH;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;OAA2E,CAAC"}
|
|
@@ -13,8 +13,9 @@ const AgentToolCallSchema = new Schema({
|
|
|
13
13
|
requiresConfirmation: { type: Boolean },
|
|
14
14
|
approved: { type: Boolean },
|
|
15
15
|
approvalId: { type: String },
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
userResponse: { type: String },
|
|
17
|
+
requiresUserAction: { type: Boolean, default: false },
|
|
18
|
+
}, { _id: false, minimize: false });
|
|
18
19
|
/**
|
|
19
20
|
* Schema for AgentAttachment subdocument
|
|
20
21
|
*/
|
|
@@ -34,19 +35,22 @@ const AgentAttachmentSchema = new Schema({
|
|
|
34
35
|
export const AgentMessageSchema = new Schema({
|
|
35
36
|
chat: { type: Schema.Types.ObjectId, ref: 'AgentChat', required: true },
|
|
36
37
|
role: { type: String, enum: Object.values(MessageRole), required: true },
|
|
37
|
-
content: { type: String
|
|
38
|
+
content: { type: String },
|
|
39
|
+
activity: { type: String },
|
|
38
40
|
reasoning: { type: String },
|
|
39
41
|
toolCalls: { type: [AgentToolCallSchema], default: [] },
|
|
40
42
|
attachments: { type: [AgentAttachmentSchema], default: [] },
|
|
41
43
|
annotations: { type: Schema.Types.Mixed },
|
|
42
44
|
tokens: { type: Number, default: 0 },
|
|
43
45
|
agentName: { type: String },
|
|
46
|
+
userId: { type: String, required: false },
|
|
44
47
|
}, {
|
|
45
48
|
timestamps: true,
|
|
46
49
|
_id: true
|
|
47
50
|
});
|
|
48
|
-
//
|
|
51
|
+
// Index for list-by-chat; compound for cursor pagination (chatId + createdAt DESC)
|
|
49
52
|
AgentMessageSchema.index({ chat: 1 });
|
|
53
|
+
AgentMessageSchema.index({ chat: 1, createdAt: -1 });
|
|
50
54
|
/**
|
|
51
55
|
* Mongoose model for AgentMessage
|
|
52
56
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentMessageSchema.js","sourceRoot":"","sources":["../../../src/schemas/AgentMessageSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAgC,MAAM,UAAU,CAAC;AAE1E,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAUxG;;GAEG;AACH,MAAM,mBAAmB,GAAG,IAAI,MAAM,CAAgB;IACpD,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IACpC,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IACtC,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE;IACnD,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,mBAAmB,CAAC,EAAE,QAAQ,E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,EAAE,MAAM,EAAE;IAC1B,SAAS,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;IAC3B,SAAS,EAAE,EAAE,IAAI,EAAE,CAAC,mBAAmB,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE;IACvD,WAAW,EAAE,EAAE,IAAI,EAAE,CAAC,qBAAqB,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE;IAC3D,WAAW,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE;IACzC,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE;IACpC,SAAS,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;IAC3B,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE;CAC1C,EAAE;IACD,UAAU,EAAE,IAAI;IAChB,GAAG,EAAE,IAAI;CACV,CAAC,CAAC;AAEH,mFAAmF;AACnF,kBAAkB,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC;AACtC,kBAAkB,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;AAErD;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,QAAQ,CAAC,KAAK,CAAuB,cAAc,EAAE,kBAAkB,CAAC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ObjectId, type Document } from '../mongo';
|
|
2
|
+
import type { TenantAICredential } from '@multiplayer-app/ai-agent-types';
|
|
3
|
+
export interface TenantAICredentialDocument extends Omit<TenantAICredential, 'id'>, Document {
|
|
4
|
+
_id: ObjectId;
|
|
5
|
+
}
|
|
6
|
+
export declare const TenantAICredentialSchema: import("mongoose").Schema<TenantAICredentialDocument, import("mongoose").Model<TenantAICredentialDocument, any, any, any, Document<unknown, any, TenantAICredentialDocument, any, {}> & TenantAICredentialDocument & Required<{
|
|
7
|
+
_id: import("mongoose").Types.ObjectId;
|
|
8
|
+
}> & {
|
|
9
|
+
__v: number;
|
|
10
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, TenantAICredentialDocument, Document<unknown, {}, import("mongoose").FlatRecord<TenantAICredentialDocument>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<TenantAICredentialDocument> & Required<{
|
|
11
|
+
_id: import("mongoose").Types.ObjectId;
|
|
12
|
+
}> & {
|
|
13
|
+
__v: number;
|
|
14
|
+
}>;
|
|
15
|
+
export declare const TenantAICredentialModel: import("mongoose").Model<TenantAICredentialDocument, {}, {}, {}, Document<unknown, {}, TenantAICredentialDocument, {}, {}> & TenantAICredentialDocument & Required<{
|
|
16
|
+
_id: import("mongoose").Types.ObjectId;
|
|
17
|
+
}> & {
|
|
18
|
+
__v: number;
|
|
19
|
+
}, any>;
|
|
20
|
+
//# sourceMappingURL=TenantAICredentialSchema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TenantAICredentialSchema.d.ts","sourceRoot":"","sources":["../../../src/schemas/TenantAICredentialSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,QAAQ,EAAU,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAC;AACrE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAE1E,MAAM,WAAW,0BAA2B,SAAQ,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,EAAE,QAAQ;IAC1F,GAAG,EAAE,QAAQ,CAAC;CACf;AAED,eAAO,MAAM,wBAAwB;;;;;;;;EASnC,CAAC;AAIH,eAAO,MAAM,uBAAuB;;;;OAGnC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { mongoose, Schema } from '../mongo';
|
|
2
|
+
export const TenantAICredentialSchema = new Schema({
|
|
3
|
+
tenantKey: { type: String, required: true },
|
|
4
|
+
tenants: { type: Map, of: String, required: true, default: {} },
|
|
5
|
+
provider: { type: String, required: true },
|
|
6
|
+
encryptedApiKey: { type: String, required: true },
|
|
7
|
+
baseUrl: { type: String, required: false },
|
|
8
|
+
}, {
|
|
9
|
+
timestamps: true,
|
|
10
|
+
_id: true,
|
|
11
|
+
});
|
|
12
|
+
TenantAICredentialSchema.index({ tenantKey: 1, provider: 1 }, { unique: true });
|
|
13
|
+
export const TenantAICredentialModel = mongoose.model('TenantAICredential', TenantAICredentialSchema);
|
|
14
|
+
//# sourceMappingURL=TenantAICredentialSchema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TenantAICredentialSchema.js","sourceRoot":"","sources":["../../../src/schemas/TenantAICredentialSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAY,MAAM,EAAiB,MAAM,UAAU,CAAC;AAOrE,MAAM,CAAC,MAAM,wBAAwB,GAAG,IAAI,MAAM,CAA6B;IAC7E,SAAS,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IAC3C,OAAO,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE;IAC/D,QAAQ,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IAC1C,eAAe,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IACjD,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE;CAC3C,EAAE;IACD,UAAU,EAAE,IAAI;IAChB,GAAG,EAAE,IAAI;CACV,CAAC,CAAC;AAEH,wBAAwB,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;AAEhF,MAAM,CAAC,MAAM,uBAAuB,GAAG,QAAQ,CAAC,KAAK,CACnD,oBAAoB,EACpB,wBAAwB,CACzB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC"}
|