@inkeep/agents-core 0.1.0
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/LICENSE.md +51 -0
- package/README.md +464 -0
- package/dist/__tests__/integration/helpers.d.ts +5 -0
- package/dist/__tests__/integration/helpers.d.ts.map +1 -0
- package/dist/__tests__/integration/helpers.js +37 -0
- package/dist/__tests__/integration/helpers.js.map +1 -0
- package/dist/__tests__/setup.d.ts +3 -0
- package/dist/__tests__/setup.d.ts.map +1 -0
- package/dist/__tests__/setup.js +29 -0
- package/dist/__tests__/setup.js.map +1 -0
- package/dist/client-exports.d.ts +301 -0
- package/dist/client-exports.d.ts.map +1 -0
- package/dist/client-exports.js +251 -0
- package/dist/client-exports.js.map +1 -0
- package/dist/context/ContextConfig.d.ts +55 -0
- package/dist/context/ContextConfig.d.ts.map +1 -0
- package/dist/context/ContextConfig.js +302 -0
- package/dist/context/ContextConfig.js.map +1 -0
- package/dist/context/ContextFetcher.d.ts +64 -0
- package/dist/context/ContextFetcher.d.ts.map +1 -0
- package/dist/context/ContextFetcher.js +325 -0
- package/dist/context/ContextFetcher.js.map +1 -0
- package/dist/context/ContextResolver.d.ts +52 -0
- package/dist/context/ContextResolver.d.ts.map +1 -0
- package/dist/context/ContextResolver.js +298 -0
- package/dist/context/ContextResolver.js.map +1 -0
- package/dist/context/TemplateEngine.d.ts +46 -0
- package/dist/context/TemplateEngine.d.ts.map +1 -0
- package/dist/context/TemplateEngine.js +175 -0
- package/dist/context/TemplateEngine.js.map +1 -0
- package/dist/context/context.d.ts +7 -0
- package/dist/context/context.d.ts.map +1 -0
- package/dist/context/context.js +157 -0
- package/dist/context/context.js.map +1 -0
- package/dist/context/contextCache.d.ts +50 -0
- package/dist/context/contextCache.d.ts.map +1 -0
- package/dist/context/contextCache.js +175 -0
- package/dist/context/contextCache.js.map +1 -0
- package/dist/context/index.d.ts +11 -0
- package/dist/context/index.d.ts.map +1 -0
- package/dist/context/index.js +8 -0
- package/dist/context/index.js.map +1 -0
- package/dist/credential-stores/index.d.ts +4 -0
- package/dist/credential-stores/index.d.ts.map +1 -0
- package/dist/credential-stores/index.js +4 -0
- package/dist/credential-stores/index.js.map +1 -0
- package/dist/credential-stores/keychain-store.d.ts +100 -0
- package/dist/credential-stores/keychain-store.d.ts.map +1 -0
- package/dist/credential-stores/keychain-store.js +225 -0
- package/dist/credential-stores/keychain-store.js.map +1 -0
- package/dist/credential-stores/memory-store.d.ts +39 -0
- package/dist/credential-stores/memory-store.d.ts.map +1 -0
- package/dist/credential-stores/memory-store.js +58 -0
- package/dist/credential-stores/memory-store.js.map +1 -0
- package/dist/credential-stores/nango-store.d.ts +59 -0
- package/dist/credential-stores/nango-store.d.ts.map +1 -0
- package/dist/credential-stores/nango-store.js +264 -0
- package/dist/credential-stores/nango-store.js.map +1 -0
- package/dist/credential-stuffer/CredentialStuffer.d.ts +80 -0
- package/dist/credential-stuffer/CredentialStuffer.d.ts.map +1 -0
- package/dist/credential-stuffer/CredentialStuffer.js +186 -0
- package/dist/credential-stuffer/CredentialStuffer.js.map +1 -0
- package/dist/credential-stuffer/index.d.ts +2 -0
- package/dist/credential-stuffer/index.d.ts.map +1 -0
- package/dist/credential-stuffer/index.js +2 -0
- package/dist/credential-stuffer/index.js.map +1 -0
- package/dist/data-access/agentDataComponents.d.ts +1 -0
- package/dist/data-access/agentDataComponents.d.ts.map +1 -0
- package/dist/data-access/agentDataComponents.js +2 -0
- package/dist/data-access/agentDataComponents.js.map +1 -0
- package/dist/data-access/agentGraphs.d.ts +406 -0
- package/dist/data-access/agentGraphs.d.ts.map +1 -0
- package/dist/data-access/agentGraphs.js +551 -0
- package/dist/data-access/agentGraphs.js.map +1 -0
- package/dist/data-access/agentRelations.d.ts +456 -0
- package/dist/data-access/agentRelations.d.ts.map +1 -0
- package/dist/data-access/agentRelations.js +471 -0
- package/dist/data-access/agentRelations.js.map +1 -0
- package/dist/data-access/agents.d.ts +218 -0
- package/dist/data-access/agents.d.ts.map +1 -0
- package/dist/data-access/agents.js +130 -0
- package/dist/data-access/agents.js.map +1 -0
- package/dist/data-access/apiKeys.d.ts +114 -0
- package/dist/data-access/apiKeys.d.ts.map +1 -0
- package/dist/data-access/apiKeys.js +185 -0
- package/dist/data-access/apiKeys.js.map +1 -0
- package/dist/data-access/artifactComponents.d.ts +152 -0
- package/dist/data-access/artifactComponents.d.ts.map +1 -0
- package/dist/data-access/artifactComponents.js +214 -0
- package/dist/data-access/artifactComponents.js.map +1 -0
- package/dist/data-access/contextCache.d.ts +68 -0
- package/dist/data-access/contextCache.d.ts.map +1 -0
- package/dist/data-access/contextCache.js +160 -0
- package/dist/data-access/contextCache.js.map +1 -0
- package/dist/data-access/contextConfigs.d.ts +110 -0
- package/dist/data-access/contextConfigs.d.ts.map +1 -0
- package/dist/data-access/contextConfigs.js +156 -0
- package/dist/data-access/contextConfigs.js.map +1 -0
- package/dist/data-access/conversations.d.ts +125 -0
- package/dist/data-access/conversations.d.ts.map +1 -0
- package/dist/data-access/conversations.js +244 -0
- package/dist/data-access/conversations.js.map +1 -0
- package/dist/data-access/credentialReferences.d.ts +86 -0
- package/dist/data-access/credentialReferences.d.ts.map +1 -0
- package/dist/data-access/credentialReferences.js +175 -0
- package/dist/data-access/credentialReferences.js.map +1 -0
- package/dist/data-access/dataComponents.d.ts +129 -0
- package/dist/data-access/dataComponents.d.ts.map +1 -0
- package/dist/data-access/dataComponents.js +213 -0
- package/dist/data-access/dataComponents.js.map +1 -0
- package/dist/data-access/externalAgents.d.ts +83 -0
- package/dist/data-access/externalAgents.d.ts.map +1 -0
- package/dist/data-access/externalAgents.js +163 -0
- package/dist/data-access/externalAgents.js.map +1 -0
- package/dist/data-access/graphFull.d.ts +32 -0
- package/dist/data-access/graphFull.d.ts.map +1 -0
- package/dist/data-access/graphFull.js +995 -0
- package/dist/data-access/graphFull.js.map +1 -0
- package/dist/data-access/index.d.ts +21 -0
- package/dist/data-access/index.d.ts.map +1 -0
- package/dist/data-access/index.js +22 -0
- package/dist/data-access/index.js.map +1 -0
- package/dist/data-access/ledgerArtifacts.d.ts +50 -0
- package/dist/data-access/ledgerArtifacts.d.ts.map +1 -0
- package/dist/data-access/ledgerArtifacts.js +112 -0
- package/dist/data-access/ledgerArtifacts.js.map +1 -0
- package/dist/data-access/messages.d.ts +209 -0
- package/dist/data-access/messages.d.ts.map +1 -0
- package/dist/data-access/messages.js +100 -0
- package/dist/data-access/messages.js.map +1 -0
- package/dist/data-access/projects.d.ts +67 -0
- package/dist/data-access/projects.d.ts.map +1 -0
- package/dist/data-access/projects.js +336 -0
- package/dist/data-access/projects.js.map +1 -0
- package/dist/data-access/tasks.d.ts +37 -0
- package/dist/data-access/tasks.d.ts.map +1 -0
- package/dist/data-access/tasks.js +40 -0
- package/dist/data-access/tasks.js.map +1 -0
- package/dist/data-access/tools.d.ts +277 -0
- package/dist/data-access/tools.d.ts.map +1 -0
- package/dist/data-access/tools.js +183 -0
- package/dist/data-access/tools.js.map +1 -0
- package/dist/data-access/validation.d.ts +17 -0
- package/dist/data-access/validation.d.ts.map +1 -0
- package/dist/data-access/validation.js +52 -0
- package/dist/data-access/validation.js.map +1 -0
- package/dist/db/clean.d.ts +6 -0
- package/dist/db/clean.d.ts.map +1 -0
- package/dist/db/clean.js +81 -0
- package/dist/db/clean.js.map +1 -0
- package/dist/db/client.d.ts +19 -0
- package/dist/db/client.d.ts.map +1 -0
- package/dist/db/client.js +24 -0
- package/dist/db/client.js.map +1 -0
- package/dist/db/schema.d.ts +4337 -0
- package/dist/db/schema.d.ts.map +1 -0
- package/dist/db/schema.js +696 -0
- package/dist/db/schema.js.map +1 -0
- package/dist/db/test-client.d.ts +25 -0
- package/dist/db/test-client.d.ts.map +1 -0
- package/dist/db/test-client.js +136 -0
- package/dist/db/test-client.js.map +1 -0
- package/dist/env.d.ts +17 -0
- package/dist/env.d.ts.map +1 -0
- package/dist/env.js +48 -0
- package/dist/env.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/dist/middleware/contextValidation.d.ts +48 -0
- package/dist/middleware/contextValidation.d.ts.map +1 -0
- package/dist/middleware/contextValidation.js +469 -0
- package/dist/middleware/contextValidation.js.map +1 -0
- package/dist/middleware/index.d.ts +2 -0
- package/dist/middleware/index.d.ts.map +1 -0
- package/dist/middleware/index.js +2 -0
- package/dist/middleware/index.js.map +1 -0
- package/dist/server/BaseServer.d.ts +83 -0
- package/dist/server/BaseServer.d.ts.map +1 -0
- package/dist/server/BaseServer.js +218 -0
- package/dist/server/BaseServer.js.map +1 -0
- package/dist/types/a2a.d.ts +373 -0
- package/dist/types/a2a.d.ts.map +1 -0
- package/dist/types/a2a.js +14 -0
- package/dist/types/a2a.js.map +1 -0
- package/dist/types/entities.d.ts +147 -0
- package/dist/types/entities.d.ts.map +1 -0
- package/dist/types/entities.js +2 -0
- package/dist/types/entities.js.map +1 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +6 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/server.d.ts +116 -0
- package/dist/types/server.d.ts.map +1 -0
- package/dist/types/server.js +2 -0
- package/dist/types/server.js.map +1 -0
- package/dist/types/utility.d.ts +214 -0
- package/dist/types/utility.d.ts.map +1 -0
- package/dist/types/utility.js +9 -0
- package/dist/types/utility.js.map +1 -0
- package/dist/utils/apiKeys.d.ts +32 -0
- package/dist/utils/apiKeys.d.ts.map +1 -0
- package/dist/utils/apiKeys.js +117 -0
- package/dist/utils/apiKeys.js.map +1 -0
- package/dist/utils/auth-detection.d.ts +23 -0
- package/dist/utils/auth-detection.d.ts.map +1 -0
- package/dist/utils/auth-detection.js +148 -0
- package/dist/utils/auth-detection.js.map +1 -0
- package/dist/utils/credential-store-utils.d.ts +11 -0
- package/dist/utils/credential-store-utils.d.ts.map +1 -0
- package/dist/utils/credential-store-utils.js +19 -0
- package/dist/utils/credential-store-utils.js.map +1 -0
- package/dist/utils/error.d.ts +526 -0
- package/dist/utils/error.d.ts.map +1 -0
- package/dist/utils/error.js +282 -0
- package/dist/utils/error.js.map +1 -0
- package/dist/utils/execution.d.ts +18 -0
- package/dist/utils/execution.d.ts.map +1 -0
- package/dist/utils/execution.js +25 -0
- package/dist/utils/execution.js.map +1 -0
- package/dist/utils/index.d.ts +9 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +9 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/logger.d.ts +79 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +102 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/logging.d.ts +11 -0
- package/dist/utils/logging.d.ts.map +1 -0
- package/dist/utils/logging.js +6 -0
- package/dist/utils/logging.js.map +1 -0
- package/dist/utils/mcp-client.d.ts +48 -0
- package/dist/utils/mcp-client.d.ts.map +1 -0
- package/dist/utils/mcp-client.js +171 -0
- package/dist/utils/mcp-client.js.map +1 -0
- package/dist/utils/tracer.d.ts +24 -0
- package/dist/utils/tracer.d.ts.map +1 -0
- package/dist/utils/tracer.js +98 -0
- package/dist/utils/tracer.js.map +1 -0
- package/dist/validation/graphFull.d.ts +36 -0
- package/dist/validation/graphFull.d.ts.map +1 -0
- package/dist/validation/graphFull.js +128 -0
- package/dist/validation/graphFull.js.map +1 -0
- package/dist/validation/id-validation.d.ts +38 -0
- package/dist/validation/id-validation.d.ts.map +1 -0
- package/dist/validation/id-validation.js +60 -0
- package/dist/validation/id-validation.js.map +1 -0
- package/dist/validation/index.d.ts +4 -0
- package/dist/validation/index.d.ts.map +1 -0
- package/dist/validation/index.js +5 -0
- package/dist/validation/index.js.map +1 -0
- package/dist/validation/schemas.d.ts +7233 -0
- package/dist/validation/schemas.d.ts.map +1 -0
- package/dist/validation/schemas.js +525 -0
- package/dist/validation/schemas.js.map +1 -0
- package/package.json +89 -0
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import type { DatabaseClient } from '../db/client.js';
|
|
2
|
+
import type { ContextConfigInsert, ContextConfigUpdate } from '../types/entities.js';
|
|
3
|
+
import type { PaginationConfig, ScopeConfig } from '../types/utility.js';
|
|
4
|
+
export declare const getContextConfigById: (db: DatabaseClient) => (params: {
|
|
5
|
+
scopes: ScopeConfig;
|
|
6
|
+
id: string;
|
|
7
|
+
}) => Promise<{
|
|
8
|
+
tenantId: string;
|
|
9
|
+
projectId: string;
|
|
10
|
+
id: string;
|
|
11
|
+
name: string;
|
|
12
|
+
description: string;
|
|
13
|
+
createdAt: string;
|
|
14
|
+
updatedAt: string;
|
|
15
|
+
requestContextSchema: unknown;
|
|
16
|
+
contextVariables: Record<string, import("../index.js").ContextFetchDefinition> | null;
|
|
17
|
+
} | undefined>;
|
|
18
|
+
export declare const listContextConfigs: (db: DatabaseClient) => (params: {
|
|
19
|
+
scopes: ScopeConfig;
|
|
20
|
+
}) => Promise<{
|
|
21
|
+
tenantId: string;
|
|
22
|
+
projectId: string;
|
|
23
|
+
id: string;
|
|
24
|
+
name: string;
|
|
25
|
+
description: string;
|
|
26
|
+
createdAt: string;
|
|
27
|
+
updatedAt: string;
|
|
28
|
+
requestContextSchema: unknown;
|
|
29
|
+
contextVariables: Record<string, import("../index.js").ContextFetchDefinition> | null;
|
|
30
|
+
}[]>;
|
|
31
|
+
export declare const listContextConfigsPaginated: (db: DatabaseClient) => (params: {
|
|
32
|
+
scopes: ScopeConfig;
|
|
33
|
+
pagination?: PaginationConfig;
|
|
34
|
+
}) => Promise<{
|
|
35
|
+
data: any[];
|
|
36
|
+
pagination: {
|
|
37
|
+
page: number;
|
|
38
|
+
limit: number;
|
|
39
|
+
total: number;
|
|
40
|
+
pages: number;
|
|
41
|
+
};
|
|
42
|
+
}>;
|
|
43
|
+
export declare const createContextConfig: (db: DatabaseClient) => (params: ContextConfigInsert) => Promise<{
|
|
44
|
+
tenantId: string;
|
|
45
|
+
projectId: string;
|
|
46
|
+
id: string;
|
|
47
|
+
name: string;
|
|
48
|
+
description: string;
|
|
49
|
+
createdAt: string;
|
|
50
|
+
updatedAt: string;
|
|
51
|
+
requestContextSchema: unknown;
|
|
52
|
+
contextVariables: Record<string, import("../index.js").ContextFetchDefinition> | null;
|
|
53
|
+
}>;
|
|
54
|
+
export declare const updateContextConfig: (db: DatabaseClient) => (params: {
|
|
55
|
+
scopes: ScopeConfig;
|
|
56
|
+
id: string;
|
|
57
|
+
data: Partial<ContextConfigUpdate>;
|
|
58
|
+
}) => Promise<{
|
|
59
|
+
tenantId: string;
|
|
60
|
+
projectId: string;
|
|
61
|
+
id: string;
|
|
62
|
+
name: string;
|
|
63
|
+
description: string;
|
|
64
|
+
createdAt: string;
|
|
65
|
+
updatedAt: string;
|
|
66
|
+
requestContextSchema: unknown;
|
|
67
|
+
contextVariables: Record<string, import("../index.js").ContextFetchDefinition> | null;
|
|
68
|
+
}>;
|
|
69
|
+
export declare const deleteContextConfig: (db: DatabaseClient) => (params: {
|
|
70
|
+
scopes: ScopeConfig;
|
|
71
|
+
id: string;
|
|
72
|
+
}) => Promise<boolean>;
|
|
73
|
+
export declare const hasContextConfig: (db: DatabaseClient) => (params: {
|
|
74
|
+
scopes: ScopeConfig;
|
|
75
|
+
id: string;
|
|
76
|
+
}) => Promise<boolean>;
|
|
77
|
+
export declare const countContextConfigs: (db: DatabaseClient) => (params: {
|
|
78
|
+
scopes: ScopeConfig;
|
|
79
|
+
}) => Promise<number>;
|
|
80
|
+
export declare const getContextConfigsByName: (db: DatabaseClient) => (params: {
|
|
81
|
+
scopes: ScopeConfig;
|
|
82
|
+
name: string;
|
|
83
|
+
}) => Promise<{
|
|
84
|
+
tenantId: string;
|
|
85
|
+
projectId: string;
|
|
86
|
+
id: string;
|
|
87
|
+
name: string;
|
|
88
|
+
description: string;
|
|
89
|
+
createdAt: string;
|
|
90
|
+
updatedAt: string;
|
|
91
|
+
requestContextSchema: unknown;
|
|
92
|
+
contextVariables: Record<string, import("../index.js").ContextFetchDefinition> | null;
|
|
93
|
+
}[]>;
|
|
94
|
+
/**
|
|
95
|
+
* Upsert a context config (create if it doesn't exist, update if it does)
|
|
96
|
+
*/
|
|
97
|
+
export declare const upsertContextConfig: (db: DatabaseClient) => (params: {
|
|
98
|
+
data: ContextConfigInsert;
|
|
99
|
+
}) => Promise<{
|
|
100
|
+
tenantId: string;
|
|
101
|
+
projectId: string;
|
|
102
|
+
id: string;
|
|
103
|
+
name: string;
|
|
104
|
+
description: string;
|
|
105
|
+
createdAt: string;
|
|
106
|
+
updatedAt: string;
|
|
107
|
+
requestContextSchema: unknown;
|
|
108
|
+
contextVariables: Record<string, import("../index.js").ContextFetchDefinition> | null;
|
|
109
|
+
}>;
|
|
110
|
+
//# sourceMappingURL=contextConfigs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contextConfigs.d.ts","sourceRoot":"","sources":["../../src/data-access/contextConfigs.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEtD,OAAO,KAAK,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AACrF,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEzE,eAAO,MAAM,oBAAoB,GAC9B,IAAI,cAAc,MAAY,QAAQ;IAAE,MAAM,EAAE,WAAW,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;cAQzE,CAAC;AAEJ,eAAO,MAAM,kBAAkB,GAC5B,IAAI,cAAc,MAAY,QAAQ;IAAE,MAAM,EAAE,WAAW,CAAA;CAAE;;;;;;;;;;IAQ7D,CAAC;AAEJ,eAAO,MAAM,2BAA2B,GACrC,IAAI,cAAc,MACZ,QAAQ;IACb,MAAM,EAAE,WAAW,CAAC;IACpB,UAAU,CAAC,EAAE,gBAAgB,CAAC;CAC/B,KAAG,OAAO,CAAC;IACV,IAAI,EAAE,G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|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { and, eq, desc, count, sql } from 'drizzle-orm';
|
|
2
|
+
import { nanoid } from 'nanoid';
|
|
3
|
+
import { contextConfigs } from '../db/schema.js';
|
|
4
|
+
export const getContextConfigById = (db) => async (params) => {
|
|
5
|
+
return await db.query.contextConfigs.findFirst({
|
|
6
|
+
where: and(eq(contextConfigs.tenantId, params.scopes.tenantId), eq(contextConfigs.projectId, params.scopes.projectId), eq(contextConfigs.id, params.id)),
|
|
7
|
+
});
|
|
8
|
+
};
|
|
9
|
+
export const listContextConfigs = (db) => async (params) => {
|
|
10
|
+
return await db.query.contextConfigs.findMany({
|
|
11
|
+
where: and(eq(contextConfigs.tenantId, params.scopes.tenantId), eq(contextConfigs.projectId, params.scopes.projectId)),
|
|
12
|
+
orderBy: [desc(contextConfigs.createdAt)],
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
export const listContextConfigsPaginated = (db) => async (params) => {
|
|
16
|
+
const page = params.pagination?.page || 1;
|
|
17
|
+
const limit = Math.min(params.pagination?.limit || 10, 100);
|
|
18
|
+
const offset = (page - 1) * limit;
|
|
19
|
+
const whereClause = and(eq(contextConfigs.tenantId, params.scopes.tenantId), eq(contextConfigs.projectId, params.scopes.projectId));
|
|
20
|
+
// Get paginated results
|
|
21
|
+
const [contextConfigList, totalResult] = await Promise.all([
|
|
22
|
+
db
|
|
23
|
+
.select()
|
|
24
|
+
.from(contextConfigs)
|
|
25
|
+
.where(whereClause)
|
|
26
|
+
.limit(limit)
|
|
27
|
+
.offset(offset)
|
|
28
|
+
.orderBy(desc(contextConfigs.createdAt)),
|
|
29
|
+
db.select({ count: sql `COUNT(*)` }).from(contextConfigs).where(whereClause),
|
|
30
|
+
]);
|
|
31
|
+
const total = Number(totalResult[0]?.count || 0);
|
|
32
|
+
const pages = Math.ceil(total / limit);
|
|
33
|
+
return {
|
|
34
|
+
data: contextConfigList,
|
|
35
|
+
pagination: {
|
|
36
|
+
page,
|
|
37
|
+
limit,
|
|
38
|
+
total,
|
|
39
|
+
pages,
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
export const createContextConfig = (db) => async (params) => {
|
|
44
|
+
const id = params.id || nanoid();
|
|
45
|
+
const now = new Date().toISOString();
|
|
46
|
+
// Process contextVariables: empty object should be treated as null for consistency
|
|
47
|
+
let contextVariables = params.contextVariables;
|
|
48
|
+
if (contextVariables !== undefined &&
|
|
49
|
+
contextVariables !== null &&
|
|
50
|
+
typeof contextVariables === 'object' &&
|
|
51
|
+
Object.keys(contextVariables).length === 0) {
|
|
52
|
+
contextVariables = null;
|
|
53
|
+
}
|
|
54
|
+
const contextConfig = await db
|
|
55
|
+
.insert(contextConfigs)
|
|
56
|
+
.values({
|
|
57
|
+
id,
|
|
58
|
+
tenantId: params.tenantId,
|
|
59
|
+
projectId: params.projectId,
|
|
60
|
+
name: params.name,
|
|
61
|
+
description: params.description,
|
|
62
|
+
requestContextSchema: params.requestContextSchema ?? null,
|
|
63
|
+
contextVariables: contextVariables ?? null,
|
|
64
|
+
createdAt: now,
|
|
65
|
+
updatedAt: now,
|
|
66
|
+
})
|
|
67
|
+
.returning();
|
|
68
|
+
return contextConfig[0];
|
|
69
|
+
};
|
|
70
|
+
export const updateContextConfig = (db) => async (params) => {
|
|
71
|
+
const now = new Date().toISOString();
|
|
72
|
+
// Process the update data to handle null/empty object clearing
|
|
73
|
+
const processedData = { ...params.data };
|
|
74
|
+
// Handle contextVariables clearing: null or empty object should set to null for consistency
|
|
75
|
+
if ('contextVariables' in params.data) {
|
|
76
|
+
if (params.data.contextVariables === null ||
|
|
77
|
+
(typeof params.data.contextVariables === 'object' &&
|
|
78
|
+
params.data.contextVariables !== null &&
|
|
79
|
+
Object.keys(params.data.contextVariables).length === 0)) {
|
|
80
|
+
processedData.contextVariables = null;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
// Handle requestContextSchema clearing: null should remain null
|
|
84
|
+
if ('requestContextSchema' in params.data && params.data.requestContextSchema === null) {
|
|
85
|
+
processedData.requestContextSchema = null;
|
|
86
|
+
}
|
|
87
|
+
const updated = await db
|
|
88
|
+
.update(contextConfigs)
|
|
89
|
+
.set({
|
|
90
|
+
...processedData,
|
|
91
|
+
updatedAt: now,
|
|
92
|
+
})
|
|
93
|
+
.where(and(eq(contextConfigs.tenantId, params.scopes.tenantId), eq(contextConfigs.projectId, params.scopes.projectId), eq(contextConfigs.id, params.id)))
|
|
94
|
+
.returning();
|
|
95
|
+
return updated[0];
|
|
96
|
+
};
|
|
97
|
+
export const deleteContextConfig = (db) => async (params) => {
|
|
98
|
+
try {
|
|
99
|
+
const result = await db
|
|
100
|
+
.delete(contextConfigs)
|
|
101
|
+
.where(and(eq(contextConfigs.tenantId, params.scopes.tenantId), eq(contextConfigs.projectId, params.scopes.projectId), eq(contextConfigs.id, params.id)))
|
|
102
|
+
.returning();
|
|
103
|
+
return result.length > 0;
|
|
104
|
+
}
|
|
105
|
+
catch (error) {
|
|
106
|
+
console.error('Error deleting context config:', error);
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
export const hasContextConfig = (db) => async (params) => {
|
|
111
|
+
const contextConfig = await getContextConfigById(db)(params);
|
|
112
|
+
return contextConfig !== null;
|
|
113
|
+
};
|
|
114
|
+
export const countContextConfigs = (db) => async (params) => {
|
|
115
|
+
const result = await db
|
|
116
|
+
.select({ count: count() })
|
|
117
|
+
.from(contextConfigs)
|
|
118
|
+
.where(and(eq(contextConfigs.tenantId, params.scopes.tenantId), eq(contextConfigs.projectId, params.scopes.projectId)));
|
|
119
|
+
const total = result[0]?.count || 0;
|
|
120
|
+
return typeof total === 'string' ? Number.parseInt(total, 10) : total;
|
|
121
|
+
};
|
|
122
|
+
export const getContextConfigsByName = (db) => async (params) => {
|
|
123
|
+
return await db.query.contextConfigs.findMany({
|
|
124
|
+
where: and(eq(contextConfigs.tenantId, params.scopes.tenantId), eq(contextConfigs.projectId, params.scopes.projectId), eq(contextConfigs.name, params.name)),
|
|
125
|
+
orderBy: [desc(contextConfigs.createdAt)],
|
|
126
|
+
});
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* Upsert a context config (create if it doesn't exist, update if it does)
|
|
130
|
+
*/
|
|
131
|
+
export const upsertContextConfig = (db) => async (params) => {
|
|
132
|
+
const scopes = { tenantId: params.data.tenantId, projectId: params.data.projectId };
|
|
133
|
+
// If an ID is provided, check if it exists
|
|
134
|
+
if (params.data.id) {
|
|
135
|
+
const existing = await getContextConfigById(db)({
|
|
136
|
+
scopes,
|
|
137
|
+
id: params.data.id,
|
|
138
|
+
});
|
|
139
|
+
if (existing) {
|
|
140
|
+
// Update existing context config
|
|
141
|
+
return await updateContextConfig(db)({
|
|
142
|
+
scopes,
|
|
143
|
+
id: params.data.id,
|
|
144
|
+
data: {
|
|
145
|
+
name: params.data.name,
|
|
146
|
+
description: params.data.description,
|
|
147
|
+
requestContextSchema: params.data.requestContextSchema,
|
|
148
|
+
contextVariables: params.data.contextVariables,
|
|
149
|
+
},
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
// Create new context config (either no ID provided or ID doesn't exist)
|
|
154
|
+
return await createContextConfig(db)(params.data);
|
|
155
|
+
};
|
|
156
|
+
//# sourceMappingURL=contextConfigs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contextConfigs.js","sourceRoot":"","sources":["../../src/data-access/contextConfigs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,CAAC,MAAM,oBAAoB,GAC/B,CAAC,EAAkB,EAAE,EAAE,CAAC,KAAK,EAAE,MAA2C,EA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,gBAAgB,EAAE,MAAM,CAAC,IAAI,CAAC,gBAAgB;iBAC/C;aACF,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,wEAAwE;IACxE,OAAO,MAAM,mBAAmB,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACpD,CAAC,CAAC"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import type { DatabaseClient } from '../db/client.js';
|
|
2
|
+
import type { ConversationSelect, ScopeConfig, PaginationConfig, ConversationInsert, ConversationUpdate, ConversationHistoryConfig } from '../types/index.js';
|
|
3
|
+
export declare const listConversations: (db: DatabaseClient) => (params: {
|
|
4
|
+
scopes: ScopeConfig;
|
|
5
|
+
userId?: string;
|
|
6
|
+
pagination?: PaginationConfig;
|
|
7
|
+
}) => Promise<{
|
|
8
|
+
conversations: ConversationSelect[];
|
|
9
|
+
total: number;
|
|
10
|
+
}>;
|
|
11
|
+
export declare const createConversation: (db: DatabaseClient) => (params: ConversationInsert) => Promise<{
|
|
12
|
+
tenantId: string;
|
|
13
|
+
projectId: string;
|
|
14
|
+
id: string;
|
|
15
|
+
createdAt: string;
|
|
16
|
+
updatedAt: string;
|
|
17
|
+
metadata: import("../index.js").ConversationMetadata | null;
|
|
18
|
+
userId: string | null;
|
|
19
|
+
activeAgentId: string;
|
|
20
|
+
title: string | null;
|
|
21
|
+
lastContextResolution: string | null;
|
|
22
|
+
}>;
|
|
23
|
+
export declare const updateConversation: (db: DatabaseClient) => (params: {
|
|
24
|
+
scopes: ScopeConfig;
|
|
25
|
+
conversationId: string;
|
|
26
|
+
data: ConversationUpdate;
|
|
27
|
+
}) => Promise<{
|
|
28
|
+
tenantId: string;
|
|
29
|
+
projectId: string;
|
|
30
|
+
id: string;
|
|
31
|
+
createdAt: string;
|
|
32
|
+
updatedAt: string;
|
|
33
|
+
metadata: import("../index.js").ConversationMetadata | null;
|
|
34
|
+
userId: string | null;
|
|
35
|
+
activeAgentId: string;
|
|
36
|
+
title: string | null;
|
|
37
|
+
lastContextResolution: string | null;
|
|
38
|
+
}>;
|
|
39
|
+
export declare const deleteConversation: (db: DatabaseClient) => (params: {
|
|
40
|
+
scopes: ScopeConfig;
|
|
41
|
+
conversationId: string;
|
|
42
|
+
}) => Promise<boolean>;
|
|
43
|
+
export declare const updateConversationActiveAgent: (db: DatabaseClient) => (params: {
|
|
44
|
+
scopes: ScopeConfig;
|
|
45
|
+
conversationId: string;
|
|
46
|
+
activeAgentId: string;
|
|
47
|
+
}) => Promise<{
|
|
48
|
+
tenantId: string;
|
|
49
|
+
projectId: string;
|
|
50
|
+
id: string;
|
|
51
|
+
createdAt: string;
|
|
52
|
+
updatedAt: string;
|
|
53
|
+
metadata: import("../index.js").ConversationMetadata | null;
|
|
54
|
+
userId: string | null;
|
|
55
|
+
activeAgentId: string;
|
|
56
|
+
title: string | null;
|
|
57
|
+
lastContextResolution: string | null;
|
|
58
|
+
}>;
|
|
59
|
+
export declare const getConversation: (db: DatabaseClient) => (params: {
|
|
60
|
+
scopes: ScopeConfig;
|
|
61
|
+
conversationId: string;
|
|
62
|
+
}) => Promise<{
|
|
63
|
+
tenantId: string;
|
|
64
|
+
projectId: string;
|
|
65
|
+
id: string;
|
|
66
|
+
createdAt: string;
|
|
67
|
+
updatedAt: string;
|
|
68
|
+
metadata: import("../index.js").ConversationMetadata | null;
|
|
69
|
+
userId: string | null;
|
|
70
|
+
activeAgentId: string;
|
|
71
|
+
title: string | null;
|
|
72
|
+
lastContextResolution: string | null;
|
|
73
|
+
} | undefined>;
|
|
74
|
+
export declare const createOrGetConversation: (db: DatabaseClient) => (input: ConversationInsert) => Promise<{
|
|
75
|
+
id: string;
|
|
76
|
+
tenantId: string;
|
|
77
|
+
projectId: string;
|
|
78
|
+
userId: string | null | undefined;
|
|
79
|
+
activeAgentId: string;
|
|
80
|
+
title: string | null | undefined;
|
|
81
|
+
lastContextResolution: string | null | undefined;
|
|
82
|
+
metadata: import("../index.js").ConversationMetadata | null | undefined;
|
|
83
|
+
createdAt: string;
|
|
84
|
+
updatedAt: string;
|
|
85
|
+
}>;
|
|
86
|
+
/**
|
|
87
|
+
* Get conversation history with filtering and context management
|
|
88
|
+
*/
|
|
89
|
+
export declare const getConversationHistory: (db: DatabaseClient) => (params: {
|
|
90
|
+
scopes: ScopeConfig;
|
|
91
|
+
conversationId: string;
|
|
92
|
+
options?: ConversationHistoryConfig;
|
|
93
|
+
}) => Promise<any[]>;
|
|
94
|
+
/**
|
|
95
|
+
* Get active agent for a conversation
|
|
96
|
+
*/
|
|
97
|
+
export declare const getActiveAgentForConversation: (db: DatabaseClient) => (params: {
|
|
98
|
+
scopes: ScopeConfig;
|
|
99
|
+
conversationId: string;
|
|
100
|
+
}) => Promise<{
|
|
101
|
+
tenantId: string;
|
|
102
|
+
projectId: string;
|
|
103
|
+
id: string;
|
|
104
|
+
createdAt: string;
|
|
105
|
+
updatedAt: string;
|
|
106
|
+
metadata: import("../index.js").ConversationMetadata | null;
|
|
107
|
+
userId: string | null;
|
|
108
|
+
activeAgentId: string;
|
|
109
|
+
title: string | null;
|
|
110
|
+
lastContextResolution: string | null;
|
|
111
|
+
} | undefined>;
|
|
112
|
+
/**
|
|
113
|
+
* Set active agent for a conversation (upsert operation)
|
|
114
|
+
*/
|
|
115
|
+
export declare const setActiveAgentForConversation: (db: DatabaseClient) => (params: {
|
|
116
|
+
scopes: ScopeConfig;
|
|
117
|
+
conversationId: string;
|
|
118
|
+
agentId: string;
|
|
119
|
+
}) => Promise<void>;
|
|
120
|
+
export declare const setActiveAgentForThread: (db: DatabaseClient) => ({ scopes, threadId, agentId, }: {
|
|
121
|
+
scopes: ScopeConfig;
|
|
122
|
+
threadId: string;
|
|
123
|
+
agentId: string;
|
|
124
|
+
}) => Promise<void>;
|
|
125
|
+
//# sourceMappingURL=conversations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversations.d.ts","sourceRoot":"","sources":["../../src/data-access/conversations.ts"],"names":[],"m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CAAC;AAGJ,eAAO,MAAM,uBAAuB,GACjC,IAAI,cAAc,MAAY,OAAO,kBAAkB;;;;;;;;;;;EA0CvD,CAAC;AA6DJ;;GAEG;AACH,eAAO,MAAM,sBAAsB,GAChC,IAAI,cAAc,MACZ,QAAQ;IACb,MAAM,EAAE,WAAW,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,yBAAyB,CAAC;CACrC,KAAG,OAAO,CAAC,GAAG,EAAE,CAsChB,CAAC;AAEJ;;GAEG;AACH,eAAO,MAAM,6BAA6B,GACvC,IAAI,cAAc,MAAY,QAAQ;IAAE,MAAM,EAAE,WAAW,CAAC;IAAC,cAAc,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;;cAQrF,CAAC;AAEJ;;GAEG;AACH,eAAO,MAAM,6BAA6B,GACvC,IAAI,cAAc,MACZ,QAAQ;IACb,MAAM,EAAE,WAAW,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;CACjB,KAAG,OAAO,CAAC,IAAI,CAkBf,CAAC;AAEJ,eAAO,MAAM,uBAAuB,GACjC,IAAI,cAAc,MACZ,gCAIJ;IACD,MAAM,EAAE,WAAW,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB,kBAEA,CAAC"}
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
import { and, eq, desc, count } from 'drizzle-orm';
|
|
2
|
+
import { nanoid } from 'nanoid';
|
|
3
|
+
import { conversations, messages } from '../db/schema.js';
|
|
4
|
+
export const listConversations = (db) => async (params) => {
|
|
5
|
+
const { userId, pagination } = params;
|
|
6
|
+
const page = pagination?.page || 1;
|
|
7
|
+
const limit = Math.min(pagination?.limit || 20, 200);
|
|
8
|
+
const offset = (page - 1) * limit;
|
|
9
|
+
const whereConditions = [
|
|
10
|
+
eq(conversations.tenantId, params.scopes.tenantId),
|
|
11
|
+
eq(conversations.projectId, params.scopes.projectId),
|
|
12
|
+
];
|
|
13
|
+
if (userId) {
|
|
14
|
+
whereConditions.push(eq(conversations.userId, userId));
|
|
15
|
+
}
|
|
16
|
+
const conversationList = await db
|
|
17
|
+
.select()
|
|
18
|
+
.from(conversations)
|
|
19
|
+
.where(and(...whereConditions))
|
|
20
|
+
.orderBy(desc(conversations.updatedAt))
|
|
21
|
+
.limit(limit)
|
|
22
|
+
.offset(offset);
|
|
23
|
+
// Get total count for pagination
|
|
24
|
+
const totalResult = await db
|
|
25
|
+
.select({ count: count() })
|
|
26
|
+
.from(conversations)
|
|
27
|
+
.where(and(...whereConditions));
|
|
28
|
+
const total = totalResult[0]?.count || 0;
|
|
29
|
+
return {
|
|
30
|
+
conversations: conversationList,
|
|
31
|
+
total: typeof total === 'string' ? Number.parseInt(total, 10) : total,
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
export const createConversation = (db) => async (params) => {
|
|
35
|
+
const now = new Date().toISOString();
|
|
36
|
+
const [created] = await db
|
|
37
|
+
.insert(conversations)
|
|
38
|
+
.values({
|
|
39
|
+
...params,
|
|
40
|
+
createdAt: now,
|
|
41
|
+
updatedAt: now,
|
|
42
|
+
})
|
|
43
|
+
.returning();
|
|
44
|
+
return created;
|
|
45
|
+
};
|
|
46
|
+
export const updateConversation = (db) => async (params) => {
|
|
47
|
+
const now = new Date().toISOString();
|
|
48
|
+
const [updated] = await db
|
|
49
|
+
.update(conversations)
|
|
50
|
+
.set({
|
|
51
|
+
...params.data,
|
|
52
|
+
updatedAt: now,
|
|
53
|
+
})
|
|
54
|
+
.where(and(eq(conversations.tenantId, params.scopes.tenantId), eq(conversations.projectId, params.scopes.projectId), eq(conversations.id, params.conversationId)))
|
|
55
|
+
.returning();
|
|
56
|
+
return updated;
|
|
57
|
+
};
|
|
58
|
+
export const deleteConversation = (db) => async (params) => {
|
|
59
|
+
try {
|
|
60
|
+
// Delete messages first (due to foreign key constraints)
|
|
61
|
+
await db
|
|
62
|
+
.delete(messages)
|
|
63
|
+
.where(and(eq(messages.tenantId, params.scopes.tenantId), eq(messages.projectId, params.scopes.projectId), eq(messages.conversationId, params.conversationId)));
|
|
64
|
+
// Delete conversation
|
|
65
|
+
await db
|
|
66
|
+
.delete(conversations)
|
|
67
|
+
.where(and(eq(conversations.tenantId, params.scopes.tenantId), eq(conversations.projectId, params.scopes.projectId), eq(conversations.id, params.conversationId)));
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
console.error('Error deleting conversation:', error);
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
export const updateConversationActiveAgent = (db) => async (params) => {
|
|
76
|
+
return updateConversation(db)({
|
|
77
|
+
scopes: params.scopes,
|
|
78
|
+
conversationId: params.conversationId,
|
|
79
|
+
data: {
|
|
80
|
+
activeAgentId: params.activeAgentId,
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
//simpler getConversation
|
|
85
|
+
export const getConversation = (db) => async (params) => {
|
|
86
|
+
return await db.query.conversations.findFirst({
|
|
87
|
+
where: and(eq(conversations.tenantId, params.scopes.tenantId), eq(conversations.projectId, params.scopes.projectId), eq(conversations.id, params.conversationId)),
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
// Create or get existing conversation
|
|
91
|
+
export const createOrGetConversation = (db) => async (input) => {
|
|
92
|
+
const conversationId = input.id || nanoid();
|
|
93
|
+
// Check if conversation already exists
|
|
94
|
+
if (input.id) {
|
|
95
|
+
const existing = await db.query.conversations.findFirst({
|
|
96
|
+
where: and(eq(conversations.tenantId, input.tenantId), eq(conversations.id, input.id)),
|
|
97
|
+
});
|
|
98
|
+
if (existing) {
|
|
99
|
+
// Update active agent if different
|
|
100
|
+
if (existing.activeAgentId !== input.activeAgentId) {
|
|
101
|
+
await db
|
|
102
|
+
.update(conversations)
|
|
103
|
+
.set({
|
|
104
|
+
activeAgentId: input.activeAgentId,
|
|
105
|
+
updatedAt: new Date().toISOString(),
|
|
106
|
+
})
|
|
107
|
+
.where(eq(conversations.id, input.id));
|
|
108
|
+
return { ...existing, activeAgentId: input.activeAgentId };
|
|
109
|
+
}
|
|
110
|
+
return existing;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
// Create new conversation
|
|
114
|
+
const newConversation = {
|
|
115
|
+
id: conversationId,
|
|
116
|
+
tenantId: input.tenantId,
|
|
117
|
+
projectId: input.projectId,
|
|
118
|
+
userId: input.userId,
|
|
119
|
+
activeAgentId: input.activeAgentId,
|
|
120
|
+
title: input.title,
|
|
121
|
+
lastContextResolution: input.lastContextResolution,
|
|
122
|
+
metadata: input.metadata,
|
|
123
|
+
createdAt: new Date().toISOString(),
|
|
124
|
+
updatedAt: new Date().toISOString(),
|
|
125
|
+
};
|
|
126
|
+
await db.insert(conversations).values(newConversation);
|
|
127
|
+
return newConversation;
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* Extract text content from message content object
|
|
131
|
+
*/
|
|
132
|
+
function extractMessageText(content) {
|
|
133
|
+
if (content.text) {
|
|
134
|
+
return content.text;
|
|
135
|
+
}
|
|
136
|
+
if (content.parts) {
|
|
137
|
+
return content.parts
|
|
138
|
+
.filter((part) => part.kind === 'text' && part.text)
|
|
139
|
+
.map((part) => part.text)
|
|
140
|
+
.join(' ');
|
|
141
|
+
}
|
|
142
|
+
return '';
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Apply context window management by truncating or summarizing old messages
|
|
146
|
+
*/
|
|
147
|
+
function applyContextWindowManagement(messageHistory, maxTokens) {
|
|
148
|
+
// Simple token estimation: ~4 characters per token
|
|
149
|
+
const estimateTokens = (text) => Math.ceil(text.length / 4);
|
|
150
|
+
let totalTokens = 0;
|
|
151
|
+
const managedHistory = [];
|
|
152
|
+
// Process messages from most recent backwards
|
|
153
|
+
for (let i = messageHistory.length - 1; i >= 0; i--) {
|
|
154
|
+
const message = messageHistory[i];
|
|
155
|
+
const messageText = extractMessageText(message.content);
|
|
156
|
+
const messageTokens = estimateTokens(messageText);
|
|
157
|
+
if (totalTokens + messageTokens <= maxTokens) {
|
|
158
|
+
managedHistory.unshift(message);
|
|
159
|
+
totalTokens += messageTokens;
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
// Add a summary message for truncated history if there are more messages
|
|
163
|
+
if (i > 0) {
|
|
164
|
+
const summaryMessage = {
|
|
165
|
+
id: `summary-${nanoid()}`,
|
|
166
|
+
role: 'system',
|
|
167
|
+
content: {
|
|
168
|
+
text: `[Previous conversation history truncated - ${i + 1} earlier messages]`,
|
|
169
|
+
},
|
|
170
|
+
visibility: 'system',
|
|
171
|
+
messageType: 'chat',
|
|
172
|
+
createdAt: messageHistory[0].createdAt,
|
|
173
|
+
};
|
|
174
|
+
managedHistory.unshift(summaryMessage);
|
|
175
|
+
}
|
|
176
|
+
break;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
return managedHistory;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Get conversation history with filtering and context management
|
|
183
|
+
*/
|
|
184
|
+
export const getConversationHistory = (db) => async (params) => {
|
|
185
|
+
const { scopes, conversationId, options = {} } = params;
|
|
186
|
+
const { tenantId, projectId } = scopes;
|
|
187
|
+
const { limit = options.limit ?? 50, includeInternal = options.includeInternal ?? false, messageTypes = options.messageTypes ?? ['chat'], maxOutputTokens, } = options;
|
|
188
|
+
const whereConditions = [
|
|
189
|
+
eq(messages.tenantId, tenantId),
|
|
190
|
+
eq(messages.projectId, projectId),
|
|
191
|
+
eq(messages.conversationId, conversationId),
|
|
192
|
+
];
|
|
193
|
+
// Filter by visibility unless explicitly including internal messages
|
|
194
|
+
if (!includeInternal) {
|
|
195
|
+
whereConditions.push(eq(messages.visibility, 'user-facing'));
|
|
196
|
+
}
|
|
197
|
+
const messageHistory = await db
|
|
198
|
+
.select()
|
|
199
|
+
.from(messages)
|
|
200
|
+
.where(and(...whereConditions))
|
|
201
|
+
.orderBy(desc(messages.createdAt))
|
|
202
|
+
.limit(limit);
|
|
203
|
+
// Reverse to get chronological order (oldest first)
|
|
204
|
+
const chronologicalHistory = messageHistory.reverse();
|
|
205
|
+
// Apply context window management if maxOutputTokens is specified
|
|
206
|
+
if (maxOutputTokens) {
|
|
207
|
+
return applyContextWindowManagement(chronologicalHistory, maxOutputTokens);
|
|
208
|
+
}
|
|
209
|
+
return chronologicalHistory;
|
|
210
|
+
};
|
|
211
|
+
/**
|
|
212
|
+
* Get active agent for a conversation
|
|
213
|
+
*/
|
|
214
|
+
export const getActiveAgentForConversation = (db) => async (params) => {
|
|
215
|
+
return await db.query.conversations.findFirst({
|
|
216
|
+
where: and(eq(conversations.tenantId, params.scopes.tenantId), eq(conversations.projectId, params.scopes.projectId), eq(conversations.id, params.conversationId)),
|
|
217
|
+
});
|
|
218
|
+
};
|
|
219
|
+
/**
|
|
220
|
+
* Set active agent for a conversation (upsert operation)
|
|
221
|
+
*/
|
|
222
|
+
export const setActiveAgentForConversation = (db) => async (params) => {
|
|
223
|
+
await db
|
|
224
|
+
.insert(conversations)
|
|
225
|
+
.values({
|
|
226
|
+
id: params.conversationId,
|
|
227
|
+
tenantId: params.scopes.tenantId,
|
|
228
|
+
projectId: params.scopes.projectId,
|
|
229
|
+
activeAgentId: params.agentId,
|
|
230
|
+
createdAt: new Date().toISOString(),
|
|
231
|
+
updatedAt: new Date().toISOString(),
|
|
232
|
+
})
|
|
233
|
+
.onConflictDoUpdate({
|
|
234
|
+
target: [conversations.tenantId, conversations.projectId, conversations.id],
|
|
235
|
+
set: {
|
|
236
|
+
activeAgentId: params.agentId,
|
|
237
|
+
updatedAt: new Date().toISOString(),
|
|
238
|
+
},
|
|
239
|
+
});
|
|
240
|
+
};
|
|
241
|
+
export const setActiveAgentForThread = (db) => async ({ scopes, threadId, agentId, }) => {
|
|
242
|
+
return setActiveAgentForConversation(db)({ scopes, conversationId: threadId, agentId });
|
|
243
|
+
};
|
|
244
|
+
//# sourceMappingURL=conversations.js.map
|