@inkeep/agents-core 0.41.2 → 0.42.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/dist/api-client/base-client.d.ts +87 -8
- package/dist/api-client/base-client.js +174 -1
- package/dist/api-client/eval-api-client.d.ts +47 -0
- package/dist/api-client/eval-api-client.js +65 -0
- package/dist/api-client/index.d.ts +4 -0
- package/dist/api-client/index.js +5 -0
- package/dist/api-client/manage-api-client.d.ts +34 -0
- package/dist/api-client/manage-api-client.js +104 -0
- package/dist/auth/auth.d.ts +86 -20
- package/dist/auth/auth.js +55 -1
- package/dist/auth/authz/client.d.ts +81 -0
- package/dist/auth/authz/client.js +189 -0
- package/dist/auth/authz/config.d.ts +76 -0
- package/dist/auth/authz/config.js +76 -0
- package/dist/auth/authz/index.d.ts +5 -0
- package/dist/auth/authz/index.js +6 -0
- package/dist/auth/authz/permissions.d.ts +57 -0
- package/dist/auth/authz/permissions.js +83 -0
- package/dist/auth/authz/sync.d.ts +85 -0
- package/dist/auth/authz/sync.js +237 -0
- package/dist/auth/permissions.d.ts +13 -13
- package/dist/auth/permissions.js +2 -181
- package/dist/client-exports.d.ts +8 -3
- package/dist/client-exports.js +3 -2
- package/dist/constants/context-breakdown.d.ts +61 -0
- package/dist/constants/context-breakdown.js +124 -0
- package/dist/constants/otel-attributes.d.ts +4 -0
- package/dist/constants/otel-attributes.js +4 -0
- package/dist/context/ContextConfig.d.ts +2 -2
- package/dist/context/ContextConfig.js +3 -3
- package/dist/context/TemplateEngine.js +0 -1
- package/dist/context/index.d.ts +1 -5
- package/dist/context/index.js +1 -5
- package/dist/credential-stuffer/CredentialStuffer.d.ts +1 -1
- package/dist/data-access/index.d.ts +34 -26
- package/dist/data-access/index.js +34 -26
- package/dist/data-access/manage/agentFull.d.ts +36 -0
- package/dist/data-access/{agentFull.js → manage/agentFull.js} +205 -7
- package/dist/data-access/{agents.d.ts → manage/agents.d.ts} +23 -22
- package/dist/data-access/{agents.js → manage/agents.js} +52 -7
- package/dist/data-access/{artifactComponents.d.ts → manage/artifactComponents.d.ts} +21 -21
- package/dist/data-access/{artifactComponents.js → manage/artifactComponents.js} +5 -5
- package/dist/data-access/{contextConfigs.d.ts → manage/contextConfigs.d.ts} +14 -14
- package/dist/data-access/{contextConfigs.js → manage/contextConfigs.js} +3 -3
- package/dist/data-access/{credentialReferences.d.ts → manage/credentialReferences.d.ts} +17 -17
- package/dist/data-access/{credentialReferences.js → manage/credentialReferences.js} +2 -2
- package/dist/data-access/{dataComponents.d.ts → manage/dataComponents.d.ts} +20 -20
- package/dist/data-access/{dataComponents.js → manage/dataComponents.js} +7 -7
- package/dist/data-access/manage/evalConfig.d.ts +221 -0
- package/dist/data-access/manage/evalConfig.js +275 -0
- package/dist/data-access/{externalAgents.d.ts → manage/externalAgents.d.ts} +16 -16
- package/dist/data-access/{externalAgents.js → manage/externalAgents.js} +2 -2
- package/dist/data-access/{functionTools.d.ts → manage/functionTools.d.ts} +65 -15
- package/dist/data-access/{functionTools.js → manage/functionTools.js} +90 -8
- package/dist/data-access/{functions.d.ts → manage/functions.d.ts} +9 -9
- package/dist/data-access/{functions.js → manage/functions.js} +3 -3
- package/dist/data-access/manage/projectFull.d.ts +38 -0
- package/dist/data-access/{projectFull.js → manage/projectFull.js} +64 -65
- package/dist/data-access/manage/projectLifecycle.d.ts +119 -0
- package/dist/data-access/manage/projectLifecycle.js +234 -0
- package/dist/data-access/manage/projects.d.ts +75 -0
- package/dist/data-access/{projects.js → manage/projects.js} +15 -16
- package/dist/data-access/{subAgentExternalAgentRelations.d.ts → manage/subAgentExternalAgentRelations.d.ts} +19 -19
- package/dist/data-access/{subAgentExternalAgentRelations.js → manage/subAgentExternalAgentRelations.js} +2 -2
- package/dist/data-access/{subAgentRelations.d.ts → manage/subAgentRelations.d.ts} +29 -29
- package/dist/data-access/{subAgentRelations.js → manage/subAgentRelations.js} +3 -3
- package/dist/data-access/{subAgentTeamAgentRelations.d.ts → manage/subAgentTeamAgentRelations.d.ts} +19 -19
- package/dist/data-access/{subAgentTeamAgentRelations.js → manage/subAgentTeamAgentRelations.js} +2 -2
- package/dist/data-access/{subAgents.d.ts → manage/subAgents.d.ts} +13 -13
- package/dist/data-access/{subAgents.js → manage/subAgents.js} +4 -4
- package/dist/data-access/{tools.d.ts → manage/tools.d.ts} +26 -19
- package/dist/data-access/{tools.js → manage/tools.js} +57 -35
- package/dist/data-access/manage/triggers.d.ts +80 -0
- package/dist/data-access/manage/triggers.js +81 -0
- package/dist/data-access/{apiKeys.d.ts → runtime/apiKeys.d.ts} +17 -17
- package/dist/data-access/{apiKeys.js → runtime/apiKeys.js} +3 -3
- package/dist/data-access/runtime/cascade-delete.d.ts +77 -0
- package/dist/data-access/runtime/cascade-delete.js +111 -0
- package/dist/data-access/{contextCache.d.ts → runtime/contextCache.d.ts} +13 -13
- package/dist/data-access/{contextCache.js → runtime/contextCache.js} +5 -5
- package/dist/data-access/{conversations.d.ts → runtime/conversations.d.ts} +68 -19
- package/dist/data-access/{conversations.js → runtime/conversations.js} +13 -7
- package/dist/data-access/runtime/evalRuns.d.ts +120 -0
- package/dist/data-access/runtime/evalRuns.js +168 -0
- package/dist/data-access/{ledgerArtifacts.d.ts → runtime/ledgerArtifacts.d.ts} +13 -13
- package/dist/data-access/{ledgerArtifacts.js → runtime/ledgerArtifacts.js} +3 -3
- package/dist/data-access/{messages.d.ts → runtime/messages.d.ts} +15 -15
- package/dist/data-access/{messages.js → runtime/messages.js} +2 -2
- package/dist/data-access/{organizations.d.ts → runtime/organizations.d.ts} +16 -7
- package/dist/data-access/{organizations.js → runtime/organizations.js} +15 -3
- package/dist/data-access/runtime/projects.d.ts +62 -0
- package/dist/data-access/runtime/projects.js +90 -0
- package/dist/data-access/runtime/tasks.d.ts +55 -0
- package/dist/data-access/{tasks.js → runtime/tasks.js} +2 -2
- package/dist/data-access/runtime/triggerInvocations.d.ts +62 -0
- package/dist/data-access/runtime/triggerInvocations.js +54 -0
- package/dist/data-access/runtime/users.d.ts +19 -0
- package/dist/data-access/{users.js → runtime/users.js} +2 -2
- package/dist/data-access/validation.d.ts +4 -4
- package/dist/data-access/validation.js +1 -1
- package/dist/db/clean.d.ts +8 -4
- package/dist/db/clean.js +14 -105
- package/dist/db/delete.d.ts +1 -1
- package/dist/db/delete.js +7 -10
- package/dist/db/manage/dolt-cleanup.d.ts +51 -0
- package/dist/db/manage/dolt-cleanup.js +132 -0
- package/dist/db/manage/manage-client.d.ts +26 -0
- package/dist/db/manage/manage-client.js +68 -0
- package/dist/db/{schema.d.ts → manage/manage-schema.d.ts} +1459 -1285
- package/dist/db/{schema.js → manage/manage-schema.js} +433 -341
- package/dist/db/manage/test-manage-client.d.ts +27 -0
- package/dist/db/manage/test-manage-client.js +68 -0
- package/dist/db/runtime/runtime-client.d.ts +20 -0
- package/dist/db/runtime/runtime-client.js +30 -0
- package/dist/db/runtime/runtime-schema.d.ts +2834 -0
- package/dist/db/runtime/runtime-schema.js +483 -0
- package/dist/db/runtime/test-runtime-client.d.ts +27 -0
- package/dist/db/{test-client.js → runtime/test-runtime-client.js} +11 -25
- package/dist/dolt/branch.d.ts +62 -0
- package/dist/dolt/branch.js +82 -0
- package/dist/dolt/branches-api.d.ts +108 -0
- package/dist/dolt/branches-api.js +162 -0
- package/dist/dolt/commit.d.ts +94 -0
- package/dist/dolt/commit.js +103 -0
- package/dist/dolt/diff.d.ts +27 -0
- package/dist/dolt/diff.js +21 -0
- package/dist/dolt/index.d.ts +10 -0
- package/dist/dolt/index.js +11 -0
- package/dist/dolt/merge.d.ts +63 -0
- package/dist/dolt/merge.js +81 -0
- package/dist/dolt/migrate-all-branches.d.ts +4 -0
- package/dist/dolt/migrate-all-branches.js +78 -0
- package/dist/dolt/migrate-dolt.d.ts +1 -0
- package/dist/dolt/migrate-dolt.js +22 -0
- package/dist/dolt/ref-helpers.d.ts +19 -0
- package/dist/dolt/ref-helpers.js +65 -0
- package/dist/dolt/ref-middleware.d.ts +82 -0
- package/dist/dolt/ref-middleware.js +217 -0
- package/dist/dolt/ref-scope.d.ts +101 -0
- package/dist/dolt/ref-scope.js +231 -0
- package/dist/dolt/schema-sync.d.ts +134 -0
- package/dist/dolt/schema-sync.js +246 -0
- package/dist/env.d.ts +6 -4
- package/dist/env.js +3 -2
- package/dist/index.d.ts +71 -44
- package/dist/index.js +74 -47
- package/dist/types/entities.d.ts +81 -2
- package/dist/types/index.d.ts +3 -3
- package/dist/types/utility.d.ts +45 -4
- package/dist/utils/JsonTransformer.d.ts +44 -0
- package/dist/utils/JsonTransformer.js +112 -0
- package/dist/utils/apiKeys.d.ts +5 -1
- package/dist/utils/apiKeys.js +11 -1
- package/dist/utils/colors.d.ts +34 -0
- package/dist/utils/colors.js +49 -0
- package/dist/utils/credential-store-utils.d.ts +1 -1
- package/dist/utils/format-messages.d.ts +1 -1
- package/dist/utils/index.d.ts +7 -3
- package/dist/utils/index.js +7 -3
- package/dist/utils/internal-service-auth.d.ts +79 -0
- package/dist/utils/internal-service-auth.js +140 -0
- package/dist/utils/jwt-helpers.d.ts +56 -0
- package/dist/utils/jwt-helpers.js +90 -0
- package/dist/utils/service-token-auth.d.ts +9 -27
- package/dist/utils/service-token-auth.js +48 -96
- package/dist/utils/template-interpolation.d.ts +22 -0
- package/dist/utils/template-interpolation.js +62 -0
- package/dist/utils/third-party-mcp-servers/composio-client.js +23 -23
- package/dist/utils/trigger-auth.d.ts +62 -0
- package/dist/utils/trigger-auth.js +125 -0
- package/dist/validation/agentFull.js +2 -4
- package/dist/validation/dolt-schemas.d.ts +49 -0
- package/dist/validation/dolt-schemas.js +44 -0
- package/dist/validation/drizzle-schema-helpers.d.ts +4 -26
- package/dist/validation/drizzle-schema-helpers.js +5 -151
- package/dist/validation/index.d.ts +4 -3
- package/dist/validation/index.js +3 -2
- package/dist/validation/schemas.d.ts +17647 -4789
- package/dist/validation/schemas.js +328 -11
- package/drizzle/manage/0000_tearful_rhodey.sql +414 -0
- package/drizzle/manage/0001_broken_wendell_vaughn.sql +19 -0
- package/drizzle/manage/0002_bent_sunfire.sql +1 -0
- package/drizzle/manage/meta/0000_snapshot.json +2987 -0
- package/drizzle/manage/meta/0001_snapshot.json +3115 -0
- package/drizzle/manage/meta/0002_snapshot.json +3115 -0
- package/drizzle/manage/meta/_journal.json +27 -0
- package/drizzle/runtime/0008_silly_preak.sql +127 -0
- package/drizzle/runtime/0009_freezing_leo.sql +17 -0
- package/drizzle/runtime/meta/0008_snapshot.json +2263 -0
- package/drizzle/runtime/meta/0009_snapshot.json +2397 -0
- package/drizzle/{meta → runtime/meta}/_journal.json +14 -0
- package/package.json +48 -15
- package/dist/context/ContextFetcher.d.ts +0 -73
- package/dist/context/ContextFetcher.js +0 -291
- package/dist/context/ContextResolver.d.ts +0 -60
- package/dist/context/ContextResolver.js +0 -278
- package/dist/context/context.d.ts +0 -27
- package/dist/context/context.js +0 -128
- package/dist/context/contextCache.d.ts +0 -58
- package/dist/context/contextCache.js +0 -177
- package/dist/data-access/agentFull.d.ts +0 -33
- package/dist/data-access/projectFull.d.ts +0 -32
- package/dist/data-access/projects.d.ts +0 -71
- package/dist/data-access/tasks.d.ts +0 -45
- package/dist/data-access/users.d.ts +0 -19
- package/dist/db/client.d.ts +0 -20
- package/dist/db/client.js +0 -28
- package/dist/db/test-client.d.ts +0 -31
- package/dist/middleware/contextValidation.d.ts +0 -46
- package/dist/middleware/contextValidation.js +0 -280
- package/dist/middleware/index.d.ts +0 -2
- package/dist/middleware/index.js +0 -3
- package/dist/utils/execution.d.ts +0 -22
- package/dist/utils/execution.js +0 -25
- /package/drizzle/{0000_exotic_mysterio.sql → runtime/0000_exotic_mysterio.sql} +0 -0
- /package/drizzle/{0001_calm_sheva_callister.sql → runtime/0001_calm_sheva_callister.sql} +0 -0
- /package/drizzle/{0002_puzzling_goblin_queen.sql → runtime/0002_puzzling_goblin_queen.sql} +0 -0
- /package/drizzle/{0003_sweet_human_robot.sql → runtime/0003_sweet_human_robot.sql} +0 -0
- /package/drizzle/{0004_cuddly_shooting_star.sql → runtime/0004_cuddly_shooting_star.sql} +0 -0
- /package/drizzle/{0005_reflective_starfox.sql → runtime/0005_reflective_starfox.sql} +0 -0
- /package/drizzle/{0006_stale_thaddeus_ross.sql → runtime/0006_stale_thaddeus_ross.sql} +0 -0
- /package/drizzle/{0007_slim_karma.sql → runtime/0007_slim_karma.sql} +0 -0
- /package/drizzle/{meta → runtime/meta}/0000_snapshot.json +0 -0
- /package/drizzle/{meta → runtime/meta}/0001_snapshot.json +0 -0
- /package/drizzle/{meta → runtime/meta}/0003_snapshot.json +0 -0
- /package/drizzle/{meta → runtime/meta}/0005_snapshot.json +0 -0
- /package/drizzle/{meta → runtime/meta}/0006_snapshot.json +0 -0
- /package/drizzle/{meta → runtime/meta}/0007_snapshot.json +0 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { apiKeys, contextCache, conversations, tasks } from "../../db/runtime/runtime-schema.js";
|
|
2
|
+
import { and, eq, inArray, sql } from "drizzle-orm";
|
|
3
|
+
|
|
4
|
+
//#region src/data-access/runtime/cascade-delete.ts
|
|
5
|
+
/**
|
|
6
|
+
* Delete all runtime entities for a specific branch.
|
|
7
|
+
* PostgreSQL cascades handle: messages, taskRelations, ledgerArtifacts
|
|
8
|
+
*
|
|
9
|
+
* @param db - Runtime database client
|
|
10
|
+
* @returns Function that performs the cascade delete
|
|
11
|
+
*/
|
|
12
|
+
const cascadeDeleteByBranch = (db) => async (params) => {
|
|
13
|
+
const { scopes, fullBranchName } = params;
|
|
14
|
+
const contextCacheResult = await db.delete(contextCache).where(and(eq(contextCache.tenantId, scopes.tenantId), eq(contextCache.projectId, scopes.projectId), sql`${contextCache.ref}->>'name' = ${fullBranchName}`)).returning();
|
|
15
|
+
const conversationsResult = await db.delete(conversations).where(and(eq(conversations.tenantId, scopes.tenantId), eq(conversations.projectId, scopes.projectId), sql`${conversations.ref}->>'name' = ${fullBranchName}`)).returning();
|
|
16
|
+
const tasksResult = await db.delete(tasks).where(and(eq(tasks.tenantId, scopes.tenantId), eq(tasks.projectId, scopes.projectId), sql`${tasks.ref}->>'name' = ${fullBranchName}`)).returning();
|
|
17
|
+
return {
|
|
18
|
+
conversationsDeleted: conversationsResult.length,
|
|
19
|
+
tasksDeleted: tasksResult.length,
|
|
20
|
+
contextCacheDeleted: contextCacheResult.length,
|
|
21
|
+
apiKeysDeleted: 0
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Delete all runtime entities for a project on a specific branch.
|
|
26
|
+
* Used when deleting a project from a branch.
|
|
27
|
+
* PostgreSQL cascades handle: messages, taskRelations, ledgerArtifacts
|
|
28
|
+
*
|
|
29
|
+
* @param db - Runtime database client
|
|
30
|
+
* @returns Function that performs the cascade delete
|
|
31
|
+
*/
|
|
32
|
+
const cascadeDeleteByProject = (db) => async (params) => {
|
|
33
|
+
const { scopes, fullBranchName } = params;
|
|
34
|
+
const contextCacheResult = await db.delete(contextCache).where(and(eq(contextCache.tenantId, scopes.tenantId), eq(contextCache.projectId, scopes.projectId), sql`${contextCache.ref}->>'name' = ${fullBranchName}`)).returning();
|
|
35
|
+
const conversationsResult = await db.delete(conversations).where(and(eq(conversations.tenantId, scopes.tenantId), eq(conversations.projectId, scopes.projectId), sql`${conversations.ref}->>'name' = ${fullBranchName}`)).returning();
|
|
36
|
+
const tasksResult = await db.delete(tasks).where(and(eq(tasks.tenantId, scopes.tenantId), eq(tasks.projectId, scopes.projectId), sql`${tasks.ref}->>'name' = ${fullBranchName}`)).returning();
|
|
37
|
+
const apiKeysResult = await db.delete(apiKeys).where(and(eq(apiKeys.tenantId, scopes.tenantId), eq(apiKeys.projectId, scopes.projectId))).returning();
|
|
38
|
+
return {
|
|
39
|
+
conversationsDeleted: conversationsResult.length,
|
|
40
|
+
tasksDeleted: tasksResult.length,
|
|
41
|
+
contextCacheDeleted: contextCacheResult.length,
|
|
42
|
+
apiKeysDeleted: apiKeysResult.length
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Delete all runtime entities for a specific agent on a specific branch.
|
|
47
|
+
* This includes tasks for the agent and conversations where the agent's
|
|
48
|
+
* subAgents are active.
|
|
49
|
+
*
|
|
50
|
+
* @param db - Runtime database client
|
|
51
|
+
* @returns Function that performs the cascade delete
|
|
52
|
+
*/
|
|
53
|
+
const cascadeDeleteByAgent = (db) => async (params) => {
|
|
54
|
+
const { scopes, fullBranchName, subAgentIds } = params;
|
|
55
|
+
let contextCacheDeleted = 0;
|
|
56
|
+
let conversationsDeleted = 0;
|
|
57
|
+
let tasksDeleted = 0;
|
|
58
|
+
let apiKeysDeleted = 0;
|
|
59
|
+
if (subAgentIds.length > 0) {
|
|
60
|
+
const conversationIds = (await db.select({ id: conversations.id }).from(conversations).where(and(eq(conversations.tenantId, scopes.tenantId), eq(conversations.projectId, scopes.projectId), inArray(conversations.activeSubAgentId, subAgentIds), sql`${conversations.ref}->>'name' = ${fullBranchName}`))).map((c) => c.id);
|
|
61
|
+
if (conversationIds.length > 0) {
|
|
62
|
+
contextCacheDeleted = (await db.delete(contextCache).where(and(eq(contextCache.tenantId, scopes.tenantId), eq(contextCache.projectId, scopes.projectId), inArray(contextCache.conversationId, conversationIds))).returning()).length;
|
|
63
|
+
conversationsDeleted = (await db.delete(conversations).where(and(eq(conversations.tenantId, scopes.tenantId), eq(conversations.projectId, scopes.projectId), inArray(conversations.id, conversationIds))).returning()).length;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
tasksDeleted = (await db.delete(tasks).where(and(eq(tasks.tenantId, scopes.tenantId), eq(tasks.projectId, scopes.projectId), eq(tasks.agentId, scopes.agentId), sql`${tasks.ref}->>'name' = ${fullBranchName}`)).returning()).length;
|
|
67
|
+
apiKeysDeleted = (await db.delete(apiKeys).where(and(eq(apiKeys.tenantId, scopes.tenantId), eq(apiKeys.projectId, scopes.projectId), eq(apiKeys.agentId, scopes.agentId))).returning()).length;
|
|
68
|
+
return {
|
|
69
|
+
conversationsDeleted,
|
|
70
|
+
tasksDeleted,
|
|
71
|
+
contextCacheDeleted,
|
|
72
|
+
apiKeysDeleted
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Delete all runtime entities for a specific subAgent on a specific branch.
|
|
77
|
+
*
|
|
78
|
+
* @param db - Runtime database client
|
|
79
|
+
* @returns Function that performs the cascade delete
|
|
80
|
+
*/
|
|
81
|
+
const cascadeDeleteBySubAgent = (db) => async (params) => {
|
|
82
|
+
const { scopes, subAgentId, fullBranchName } = params;
|
|
83
|
+
const conversationIds = (await db.select({ id: conversations.id }).from(conversations).where(and(eq(conversations.tenantId, scopes.tenantId), eq(conversations.projectId, scopes.projectId), eq(conversations.activeSubAgentId, subAgentId), sql`${conversations.ref}->>'name' = ${fullBranchName}`))).map((c) => c.id);
|
|
84
|
+
let contextCacheDeleted = 0;
|
|
85
|
+
let conversationsDeleted = 0;
|
|
86
|
+
if (conversationIds.length > 0) {
|
|
87
|
+
contextCacheDeleted = (await db.delete(contextCache).where(and(eq(contextCache.tenantId, scopes.tenantId), eq(contextCache.projectId, scopes.projectId), inArray(contextCache.conversationId, conversationIds))).returning()).length;
|
|
88
|
+
conversationsDeleted = (await db.delete(conversations).where(and(eq(conversations.tenantId, scopes.tenantId), eq(conversations.projectId, scopes.projectId), inArray(conversations.id, conversationIds))).returning()).length;
|
|
89
|
+
}
|
|
90
|
+
const tasksResult = await db.delete(tasks).where(and(eq(tasks.tenantId, scopes.tenantId), eq(tasks.projectId, scopes.projectId), eq(tasks.subAgentId, subAgentId), sql`${tasks.ref}->>'name' = ${fullBranchName}`)).returning();
|
|
91
|
+
return {
|
|
92
|
+
conversationsDeleted,
|
|
93
|
+
tasksDeleted: tasksResult.length,
|
|
94
|
+
contextCacheDeleted,
|
|
95
|
+
apiKeysDeleted: 0
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* Delete contextCache entries for a specific contextConfig.
|
|
100
|
+
* Used when deleting a contextConfig from the manage DB.
|
|
101
|
+
*
|
|
102
|
+
* @param db - Runtime database client
|
|
103
|
+
* @returns Function that performs the delete
|
|
104
|
+
*/
|
|
105
|
+
const cascadeDeleteByContextConfig = (db) => async (params) => {
|
|
106
|
+
const { scopes, contextConfigId, fullBranchName } = params;
|
|
107
|
+
return { contextCacheDeleted: (await db.delete(contextCache).where(and(eq(contextCache.tenantId, scopes.tenantId), eq(contextCache.projectId, scopes.projectId), eq(contextCache.contextConfigId, contextConfigId), sql`${contextCache.ref}->>'name' = ${fullBranchName}`)).returning()).length };
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
//#endregion
|
|
111
|
+
export { cascadeDeleteByAgent, cascadeDeleteByBranch, cascadeDeleteByContextConfig, cascadeDeleteByProject, cascadeDeleteBySubAgent };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { ProjectScopeConfig } from "../../types/utility.js";
|
|
2
|
+
import { AgentsRunDatabaseClient } from "../../db/runtime/runtime-client.js";
|
|
3
|
+
import { ContextCacheInsert, ContextCacheSelect } from "../../types/entities.js";
|
|
4
4
|
|
|
5
|
-
//#region src/data-access/contextCache.d.ts
|
|
5
|
+
//#region src/data-access/runtime/contextCache.d.ts
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Get cached context data for a conversation with optional request hash validation
|
|
9
9
|
*/
|
|
10
|
-
declare const getCacheEntry: (db:
|
|
10
|
+
declare const getCacheEntry: (db: AgentsRunDatabaseClient) => (params: {
|
|
11
11
|
conversationId: string;
|
|
12
12
|
contextConfigId: string;
|
|
13
13
|
contextVariableKey: string;
|
|
@@ -16,31 +16,31 @@ declare const getCacheEntry: (db: DatabaseClient) => (params: {
|
|
|
16
16
|
/**
|
|
17
17
|
* Set cached context data for a conversation
|
|
18
18
|
*/
|
|
19
|
-
declare const setCacheEntry: (db:
|
|
19
|
+
declare const setCacheEntry: (db: AgentsRunDatabaseClient) => (entry: ContextCacheInsert) => Promise<ContextCacheSelect | null>;
|
|
20
20
|
/**
|
|
21
21
|
* Clear cache entries for a specific conversation
|
|
22
22
|
*/
|
|
23
|
-
declare const clearConversationCache: (db:
|
|
23
|
+
declare const clearConversationCache: (db: AgentsRunDatabaseClient) => (params: {
|
|
24
24
|
scopes: ProjectScopeConfig;
|
|
25
25
|
conversationId: string;
|
|
26
26
|
}) => Promise<number>;
|
|
27
27
|
/**
|
|
28
28
|
* Clear all cache entries for a specific context configuration
|
|
29
29
|
*/
|
|
30
|
-
declare const clearContextConfigCache: (db:
|
|
30
|
+
declare const clearContextConfigCache: (db: AgentsRunDatabaseClient) => (params: {
|
|
31
31
|
scopes: ProjectScopeConfig;
|
|
32
32
|
contextConfigId: string;
|
|
33
33
|
}) => Promise<number>;
|
|
34
34
|
/**
|
|
35
35
|
* Clean up all cache entries for a tenant
|
|
36
36
|
*/
|
|
37
|
-
declare const cleanupTenantCache: (db:
|
|
37
|
+
declare const cleanupTenantCache: (db: AgentsRunDatabaseClient) => (params: {
|
|
38
38
|
scopes: ProjectScopeConfig;
|
|
39
39
|
}) => Promise<number>;
|
|
40
40
|
/**
|
|
41
41
|
* Invalidate the headers cache for a conversation
|
|
42
42
|
*/
|
|
43
|
-
declare const invalidateHeadersCache: (db:
|
|
43
|
+
declare const invalidateHeadersCache: (db: AgentsRunDatabaseClient) => (params: {
|
|
44
44
|
scopes: ProjectScopeConfig;
|
|
45
45
|
conversationId: string;
|
|
46
46
|
contextConfigId: string;
|
|
@@ -48,7 +48,7 @@ declare const invalidateHeadersCache: (db: DatabaseClient) => (params: {
|
|
|
48
48
|
/**
|
|
49
49
|
* Invalidate specific cache entries for invocation-trigger definitions
|
|
50
50
|
*/
|
|
51
|
-
declare const invalidateInvocationDefinitionsCache: (db:
|
|
51
|
+
declare const invalidateInvocationDefinitionsCache: (db: AgentsRunDatabaseClient) => (params: {
|
|
52
52
|
scopes: ProjectScopeConfig;
|
|
53
53
|
conversationId: string;
|
|
54
54
|
contextConfigId: string;
|
|
@@ -57,14 +57,14 @@ declare const invalidateInvocationDefinitionsCache: (db: DatabaseClient) => (par
|
|
|
57
57
|
/**
|
|
58
58
|
* Get all cache entries for a conversation
|
|
59
59
|
*/
|
|
60
|
-
declare const getConversationCacheEntries: (db:
|
|
60
|
+
declare const getConversationCacheEntries: (db: AgentsRunDatabaseClient) => (params: {
|
|
61
61
|
scopes: ProjectScopeConfig;
|
|
62
62
|
conversationId: string;
|
|
63
63
|
}) => Promise<ContextCacheSelect[]>;
|
|
64
64
|
/**
|
|
65
65
|
* Get all cache entries for a context configuration
|
|
66
66
|
*/
|
|
67
|
-
declare const getContextConfigCacheEntries: (db:
|
|
67
|
+
declare const getContextConfigCacheEntries: (db: AgentsRunDatabaseClient) => (params: {
|
|
68
68
|
scopes: ProjectScopeConfig;
|
|
69
69
|
contextConfigId: string;
|
|
70
70
|
}) => Promise<ContextCacheSelect[]>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { contextCache } from "
|
|
2
|
-
import { generateId } from "
|
|
1
|
+
import { contextCache } from "../../db/runtime/runtime-schema.js";
|
|
2
|
+
import { generateId } from "../../utils/conversations.js";
|
|
3
3
|
import { and, eq } from "drizzle-orm";
|
|
4
4
|
|
|
5
|
-
//#region src/data-access/contextCache.ts
|
|
5
|
+
//#region src/data-access/runtime/contextCache.ts
|
|
6
6
|
/**
|
|
7
7
|
* Get cached context data for a conversation with optional request hash validation
|
|
8
8
|
*/
|
|
@@ -35,9 +35,9 @@ const setCacheEntry = (db) => async (entry) => {
|
|
|
35
35
|
requestHash: entry.requestHash || null,
|
|
36
36
|
fetchedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
37
37
|
fetchSource: `${entry.contextConfigId}:${entry.contextVariableKey}`,
|
|
38
|
-
fetchDurationMs: 0,
|
|
39
38
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
40
|
-
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
39
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
40
|
+
ref: entry.ref
|
|
41
41
|
};
|
|
42
42
|
const [result] = await db.insert(contextCache).values(cacheData).returning();
|
|
43
43
|
return {
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "
|
|
3
|
-
import "
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
1
|
+
import { ResolvedRef } from "../../validation/dolt-schemas.js";
|
|
2
|
+
import { ConversationHistoryConfig, ConversationMetadata, PaginationConfig, ProjectScopeConfig } from "../../types/utility.js";
|
|
3
|
+
import "../../types/index.js";
|
|
4
|
+
import { AgentsRunDatabaseClient } from "../../db/runtime/runtime-client.js";
|
|
5
|
+
import "../../index.js";
|
|
6
|
+
import { ConversationInsert, ConversationSelect, ConversationUpdate } from "../../types/entities.js";
|
|
6
7
|
|
|
7
|
-
//#region src/data-access/conversations.d.ts
|
|
8
|
-
declare const listConversations: (db:
|
|
8
|
+
//#region src/data-access/runtime/conversations.d.ts
|
|
9
|
+
declare const listConversations: (db: AgentsRunDatabaseClient) => (params: {
|
|
9
10
|
scopes: ProjectScopeConfig;
|
|
10
11
|
userId?: string;
|
|
11
12
|
pagination?: PaginationConfig;
|
|
@@ -13,19 +14,25 @@ declare const listConversations: (db: DatabaseClient) => (params: {
|
|
|
13
14
|
conversations: ConversationSelect[];
|
|
14
15
|
total: number;
|
|
15
16
|
}>;
|
|
16
|
-
declare const createConversation: (db:
|
|
17
|
+
declare const createConversation: (db: AgentsRunDatabaseClient) => (params: ConversationInsert) => Promise<{
|
|
17
18
|
tenantId: string;
|
|
18
19
|
projectId: string;
|
|
19
20
|
id: string;
|
|
20
21
|
title: string | null;
|
|
22
|
+
agentId: string | null;
|
|
21
23
|
createdAt: string;
|
|
22
24
|
updatedAt: string;
|
|
23
25
|
userId: string | null;
|
|
24
26
|
metadata: ConversationMetadata | null;
|
|
27
|
+
ref: {
|
|
28
|
+
type: "tag" | "commit" | "branch";
|
|
29
|
+
name: string;
|
|
30
|
+
hash: string;
|
|
31
|
+
} | null;
|
|
25
32
|
activeSubAgentId: string;
|
|
26
33
|
lastContextResolution: string | null;
|
|
27
34
|
}>;
|
|
28
|
-
declare const updateConversation: (db:
|
|
35
|
+
declare const updateConversation: (db: AgentsRunDatabaseClient) => (params: {
|
|
29
36
|
scopes: ProjectScopeConfig;
|
|
30
37
|
conversationId: string;
|
|
31
38
|
data: ConversationUpdate;
|
|
@@ -33,7 +40,13 @@ declare const updateConversation: (db: DatabaseClient) => (params: {
|
|
|
33
40
|
createdAt: string;
|
|
34
41
|
updatedAt: string;
|
|
35
42
|
userId: string | null;
|
|
43
|
+
agentId: string | null;
|
|
36
44
|
activeSubAgentId: string;
|
|
45
|
+
ref: {
|
|
46
|
+
type: "tag" | "commit" | "branch";
|
|
47
|
+
name: string;
|
|
48
|
+
hash: string;
|
|
49
|
+
} | null;
|
|
37
50
|
title: string | null;
|
|
38
51
|
lastContextResolution: string | null;
|
|
39
52
|
metadata: ConversationMetadata | null;
|
|
@@ -41,11 +54,11 @@ declare const updateConversation: (db: DatabaseClient) => (params: {
|
|
|
41
54
|
tenantId: string;
|
|
42
55
|
id: string;
|
|
43
56
|
}>;
|
|
44
|
-
declare const deleteConversation: (db:
|
|
57
|
+
declare const deleteConversation: (db: AgentsRunDatabaseClient) => (params: {
|
|
45
58
|
scopes: ProjectScopeConfig;
|
|
46
59
|
conversationId: string;
|
|
47
60
|
}) => Promise<boolean>;
|
|
48
|
-
declare const
|
|
61
|
+
declare const updateConversationActiveSubAgent: (db: AgentsRunDatabaseClient) => (params: {
|
|
49
62
|
scopes: ProjectScopeConfig;
|
|
50
63
|
conversationId: string;
|
|
51
64
|
activeSubAgentId: string;
|
|
@@ -53,7 +66,13 @@ declare const updateConversationActiveAgent: (db: DatabaseClient) => (params: {
|
|
|
53
66
|
createdAt: string;
|
|
54
67
|
updatedAt: string;
|
|
55
68
|
userId: string | null;
|
|
69
|
+
agentId: string | null;
|
|
56
70
|
activeSubAgentId: string;
|
|
71
|
+
ref: {
|
|
72
|
+
type: "tag" | "commit" | "branch";
|
|
73
|
+
name: string;
|
|
74
|
+
hash: string;
|
|
75
|
+
} | null;
|
|
57
76
|
title: string | null;
|
|
58
77
|
lastContextResolution: string | null;
|
|
59
78
|
metadata: ConversationMetadata | null;
|
|
@@ -61,7 +80,7 @@ declare const updateConversationActiveAgent: (db: DatabaseClient) => (params: {
|
|
|
61
80
|
tenantId: string;
|
|
62
81
|
id: string;
|
|
63
82
|
}>;
|
|
64
|
-
declare const getConversation: (db:
|
|
83
|
+
declare const getConversation: (db: AgentsRunDatabaseClient) => (params: {
|
|
65
84
|
scopes: ProjectScopeConfig;
|
|
66
85
|
conversationId: string;
|
|
67
86
|
}) => Promise<{
|
|
@@ -69,21 +88,33 @@ declare const getConversation: (db: DatabaseClient) => (params: {
|
|
|
69
88
|
projectId: string;
|
|
70
89
|
id: string;
|
|
71
90
|
title: string | null;
|
|
91
|
+
agentId: string | null;
|
|
72
92
|
createdAt: string;
|
|
73
93
|
updatedAt: string;
|
|
74
94
|
userId: string | null;
|
|
75
95
|
metadata: ConversationMetadata | null;
|
|
96
|
+
ref: {
|
|
97
|
+
type: "tag" | "commit" | "branch";
|
|
98
|
+
name: string;
|
|
99
|
+
hash: string;
|
|
100
|
+
} | null;
|
|
76
101
|
activeSubAgentId: string;
|
|
77
102
|
lastContextResolution: string | null;
|
|
78
103
|
} | undefined>;
|
|
79
|
-
declare const createOrGetConversation: (db:
|
|
104
|
+
declare const createOrGetConversation: (db: AgentsRunDatabaseClient) => (input: ConversationInsert) => Promise<{
|
|
80
105
|
activeSubAgentId: string;
|
|
81
106
|
projectId: string;
|
|
82
107
|
tenantId: string;
|
|
83
108
|
id: string;
|
|
109
|
+
ref: {
|
|
110
|
+
type: "tag" | "commit" | "branch";
|
|
111
|
+
name: string;
|
|
112
|
+
hash: string;
|
|
113
|
+
};
|
|
84
114
|
createdAt?: string | undefined;
|
|
85
115
|
updatedAt?: string | undefined;
|
|
86
116
|
userId?: string | null | undefined;
|
|
117
|
+
agentId?: string | null | undefined;
|
|
87
118
|
title?: string | null | undefined;
|
|
88
119
|
lastContextResolution?: string | null | undefined;
|
|
89
120
|
metadata?: ConversationMetadata | null | undefined;
|
|
@@ -93,17 +124,23 @@ declare const createOrGetConversation: (db: DatabaseClient) => (input: Conversat
|
|
|
93
124
|
projectId: string;
|
|
94
125
|
id: string;
|
|
95
126
|
title: string | null;
|
|
127
|
+
agentId: string | null;
|
|
96
128
|
createdAt: string;
|
|
97
129
|
updatedAt: string;
|
|
98
130
|
userId: string | null;
|
|
99
131
|
metadata: ConversationMetadata | null;
|
|
132
|
+
ref: {
|
|
133
|
+
type: "tag" | "commit" | "branch";
|
|
134
|
+
name: string;
|
|
135
|
+
hash: string;
|
|
136
|
+
} | null;
|
|
100
137
|
activeSubAgentId: string;
|
|
101
138
|
lastContextResolution: string | null;
|
|
102
139
|
}>;
|
|
103
140
|
/**
|
|
104
141
|
* Get conversation history with filtering and context management
|
|
105
142
|
*/
|
|
106
|
-
declare const getConversationHistory: (db:
|
|
143
|
+
declare const getConversationHistory: (db: AgentsRunDatabaseClient) => (params: {
|
|
107
144
|
scopes: ProjectScopeConfig;
|
|
108
145
|
conversationId: string;
|
|
109
146
|
options?: ConversationHistoryConfig;
|
|
@@ -111,7 +148,7 @@ declare const getConversationHistory: (db: DatabaseClient) => (params: {
|
|
|
111
148
|
/**
|
|
112
149
|
* Get active agent for a conversation
|
|
113
150
|
*/
|
|
114
|
-
declare const getActiveAgentForConversation: (db:
|
|
151
|
+
declare const getActiveAgentForConversation: (db: AgentsRunDatabaseClient) => (params: {
|
|
115
152
|
scopes: ProjectScopeConfig;
|
|
116
153
|
conversationId: string;
|
|
117
154
|
}) => Promise<{
|
|
@@ -119,29 +156,41 @@ declare const getActiveAgentForConversation: (db: DatabaseClient) => (params: {
|
|
|
119
156
|
projectId: string;
|
|
120
157
|
id: string;
|
|
121
158
|
title: string | null;
|
|
159
|
+
agentId: string | null;
|
|
122
160
|
createdAt: string;
|
|
123
161
|
updatedAt: string;
|
|
124
162
|
userId: string | null;
|
|
125
163
|
metadata: ConversationMetadata | null;
|
|
164
|
+
ref: {
|
|
165
|
+
type: "tag" | "commit" | "branch";
|
|
166
|
+
name: string;
|
|
167
|
+
hash: string;
|
|
168
|
+
} | null;
|
|
126
169
|
activeSubAgentId: string;
|
|
127
170
|
lastContextResolution: string | null;
|
|
128
171
|
} | undefined>;
|
|
129
172
|
/**
|
|
130
173
|
* Set active agent for a conversation (upsert operation)
|
|
131
174
|
*/
|
|
132
|
-
declare const setActiveAgentForConversation: (db:
|
|
175
|
+
declare const setActiveAgentForConversation: (db: AgentsRunDatabaseClient) => (params: {
|
|
133
176
|
scopes: ProjectScopeConfig;
|
|
134
177
|
conversationId: string;
|
|
135
178
|
subAgentId: string;
|
|
179
|
+
agentId: string;
|
|
180
|
+
ref: ResolvedRef;
|
|
136
181
|
}) => Promise<void>;
|
|
137
|
-
declare const setActiveAgentForThread: (db:
|
|
182
|
+
declare const setActiveAgentForThread: (db: AgentsRunDatabaseClient) => ({
|
|
138
183
|
scopes,
|
|
139
184
|
threadId,
|
|
140
|
-
subAgentId
|
|
185
|
+
subAgentId,
|
|
186
|
+
agentId,
|
|
187
|
+
ref
|
|
141
188
|
}: {
|
|
142
189
|
scopes: ProjectScopeConfig;
|
|
143
190
|
threadId: string;
|
|
144
191
|
subAgentId: string;
|
|
192
|
+
agentId: string;
|
|
193
|
+
ref: ResolvedRef;
|
|
145
194
|
}) => Promise<void>;
|
|
146
195
|
//#endregion
|
|
147
|
-
export { createConversation, createOrGetConversation, deleteConversation, getActiveAgentForConversation, getConversation, getConversationHistory, listConversations, setActiveAgentForConversation, setActiveAgentForThread, updateConversation,
|
|
196
|
+
export { createConversation, createOrGetConversation, deleteConversation, getActiveAgentForConversation, getConversation, getConversationHistory, listConversations, setActiveAgentForConversation, setActiveAgentForThread, updateConversation, updateConversationActiveSubAgent };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { conversations, messages } from "
|
|
2
|
-
import { getConversationId } from "
|
|
1
|
+
import { conversations, messages } from "../../db/runtime/runtime-schema.js";
|
|
2
|
+
import { getConversationId } from "../../utils/conversations.js";
|
|
3
3
|
import { and, count, desc, eq, inArray } from "drizzle-orm";
|
|
4
4
|
|
|
5
|
-
//#region src/data-access/conversations.ts
|
|
5
|
+
//#region src/data-access/runtime/conversations.ts
|
|
6
6
|
const listConversations = (db) => async (params) => {
|
|
7
7
|
const { userId, pagination } = params;
|
|
8
8
|
const page = pagination?.page || 1;
|
|
@@ -44,7 +44,7 @@ const deleteConversation = (db) => async (params) => {
|
|
|
44
44
|
return false;
|
|
45
45
|
}
|
|
46
46
|
};
|
|
47
|
-
const
|
|
47
|
+
const updateConversationActiveSubAgent = (db) => async (params) => {
|
|
48
48
|
return updateConversation(db)({
|
|
49
49
|
scopes: params.scopes,
|
|
50
50
|
conversationId: params.conversationId,
|
|
@@ -77,10 +77,12 @@ const createOrGetConversation = (db) => async (input) => {
|
|
|
77
77
|
tenantId: input.tenantId,
|
|
78
78
|
projectId: input.projectId,
|
|
79
79
|
userId: input.userId,
|
|
80
|
+
agentId: input.agentId,
|
|
80
81
|
activeSubAgentId: input.activeSubAgentId,
|
|
81
82
|
title: input.title,
|
|
82
83
|
lastContextResolution: input.lastContextResolution,
|
|
83
84
|
metadata: input.metadata,
|
|
85
|
+
ref: input.ref,
|
|
84
86
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
85
87
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
86
88
|
};
|
|
@@ -158,6 +160,8 @@ const setActiveAgentForConversation = (db) => async (params) => {
|
|
|
158
160
|
tenantId: params.scopes.tenantId,
|
|
159
161
|
projectId: params.scopes.projectId,
|
|
160
162
|
activeSubAgentId: params.subAgentId,
|
|
163
|
+
agentId: params.agentId,
|
|
164
|
+
ref: params.ref,
|
|
161
165
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
162
166
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
163
167
|
}).onConflictDoUpdate({
|
|
@@ -172,13 +176,15 @@ const setActiveAgentForConversation = (db) => async (params) => {
|
|
|
172
176
|
}
|
|
173
177
|
});
|
|
174
178
|
};
|
|
175
|
-
const setActiveAgentForThread = (db) => async ({ scopes, threadId, subAgentId }) => {
|
|
179
|
+
const setActiveAgentForThread = (db) => async ({ scopes, threadId, subAgentId, agentId, ref }) => {
|
|
176
180
|
return setActiveAgentForConversation(db)({
|
|
177
181
|
scopes,
|
|
178
182
|
conversationId: threadId,
|
|
179
|
-
subAgentId
|
|
183
|
+
subAgentId,
|
|
184
|
+
agentId,
|
|
185
|
+
ref
|
|
180
186
|
});
|
|
181
187
|
};
|
|
182
188
|
|
|
183
189
|
//#endregion
|
|
184
|
-
export { createConversation, createOrGetConversation, deleteConversation, getActiveAgentForConversation, getConversation, getConversationHistory, listConversations, setActiveAgentForConversation, setActiveAgentForThread, updateConversation,
|
|
190
|
+
export { createConversation, createOrGetConversation, deleteConversation, getActiveAgentForConversation, getConversation, getConversationHistory, listConversations, setActiveAgentForConversation, setActiveAgentForThread, updateConversation, updateConversationActiveSubAgent };
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { EvaluationJobFilterCriteria, Filter, ProjectScopeConfig } from "../../types/utility.js";
|
|
2
|
+
import { AgentsRunDatabaseClient } from "../../db/runtime/runtime-client.js";
|
|
3
|
+
import { ConversationSelect, DatasetRunConversationRelationInsert, DatasetRunConversationRelationSelect, DatasetRunInsert, DatasetRunSelect, EvaluationResultInsert, EvaluationResultSelect, EvaluationResultUpdate, EvaluationRunInsert, EvaluationRunSelect, EvaluationRunUpdate } from "../../types/entities.js";
|
|
4
|
+
|
|
5
|
+
//#region src/data-access/runtime/evalRuns.d.ts
|
|
6
|
+
declare const getDatasetRunById: (db: AgentsRunDatabaseClient) => (params: {
|
|
7
|
+
scopes: ProjectScopeConfig & {
|
|
8
|
+
datasetRunId: string;
|
|
9
|
+
};
|
|
10
|
+
}) => Promise<DatasetRunSelect | null>;
|
|
11
|
+
declare const listDatasetRuns: (db: AgentsRunDatabaseClient) => (params: {
|
|
12
|
+
scopes: ProjectScopeConfig;
|
|
13
|
+
}) => Promise<DatasetRunSelect[]>;
|
|
14
|
+
declare const listDatasetRunsByConfig: (db: AgentsRunDatabaseClient) => (params: {
|
|
15
|
+
scopes: ProjectScopeConfig & {
|
|
16
|
+
datasetRunConfigId: string;
|
|
17
|
+
};
|
|
18
|
+
}) => Promise<DatasetRunSelect[]>;
|
|
19
|
+
declare const createDatasetRun: (db: AgentsRunDatabaseClient) => (data: DatasetRunInsert) => Promise<DatasetRunSelect>;
|
|
20
|
+
declare const deleteDatasetRun: (db: AgentsRunDatabaseClient) => (params: {
|
|
21
|
+
scopes: ProjectScopeConfig & {
|
|
22
|
+
datasetRunId: string;
|
|
23
|
+
};
|
|
24
|
+
}) => Promise<boolean>;
|
|
25
|
+
declare const getDatasetRunConversationRelations: (db: AgentsRunDatabaseClient) => (params: {
|
|
26
|
+
scopes: ProjectScopeConfig & {
|
|
27
|
+
datasetRunId: string;
|
|
28
|
+
};
|
|
29
|
+
}) => Promise<DatasetRunConversationRelationSelect[]>;
|
|
30
|
+
declare const createDatasetRunConversationRelation: (db: AgentsRunDatabaseClient) => (data: DatasetRunConversationRelationInsert) => Promise<DatasetRunConversationRelationSelect>;
|
|
31
|
+
declare const createDatasetRunConversationRelations: (db: AgentsRunDatabaseClient) => (data: DatasetRunConversationRelationInsert[]) => Promise<DatasetRunConversationRelationSelect[]>;
|
|
32
|
+
declare const deleteDatasetRunConversationRelation: (db: AgentsRunDatabaseClient) => (params: {
|
|
33
|
+
scopes: ProjectScopeConfig & {
|
|
34
|
+
datasetRunId: string;
|
|
35
|
+
conversationId: string;
|
|
36
|
+
};
|
|
37
|
+
}) => Promise<boolean>;
|
|
38
|
+
declare const deleteDatasetRunConversationRelationsByRun: (db: AgentsRunDatabaseClient) => (params: {
|
|
39
|
+
scopes: ProjectScopeConfig & {
|
|
40
|
+
datasetRunId: string;
|
|
41
|
+
};
|
|
42
|
+
}) => Promise<number>;
|
|
43
|
+
declare const getDatasetRunConversationRelationByConversation: (db: AgentsRunDatabaseClient) => (params: {
|
|
44
|
+
scopes: ProjectScopeConfig & {
|
|
45
|
+
conversationId: string;
|
|
46
|
+
};
|
|
47
|
+
}) => Promise<DatasetRunConversationRelationSelect | null>;
|
|
48
|
+
declare const getEvaluationRunById: (db: AgentsRunDatabaseClient) => (params: {
|
|
49
|
+
scopes: ProjectScopeConfig & {
|
|
50
|
+
evaluationRunId: string;
|
|
51
|
+
};
|
|
52
|
+
}) => Promise<EvaluationRunSelect | null>;
|
|
53
|
+
declare const listEvaluationRuns: (db: AgentsRunDatabaseClient) => (params: {
|
|
54
|
+
scopes: ProjectScopeConfig;
|
|
55
|
+
}) => Promise<EvaluationRunSelect[]>;
|
|
56
|
+
declare const listEvaluationRunsByJobConfigId: (db: AgentsRunDatabaseClient) => (params: {
|
|
57
|
+
scopes: ProjectScopeConfig;
|
|
58
|
+
evaluationJobConfigId: string;
|
|
59
|
+
}) => Promise<EvaluationRunSelect[]>;
|
|
60
|
+
declare const getEvaluationRunByJobConfigId: (db: AgentsRunDatabaseClient) => (params: {
|
|
61
|
+
scopes: ProjectScopeConfig;
|
|
62
|
+
evaluationJobConfigId: string;
|
|
63
|
+
}) => Promise<EvaluationRunSelect | null>;
|
|
64
|
+
declare const createEvaluationRun: (db: AgentsRunDatabaseClient) => (data: EvaluationRunInsert) => Promise<EvaluationRunSelect>;
|
|
65
|
+
declare const updateEvaluationRun: (db: AgentsRunDatabaseClient) => (params: {
|
|
66
|
+
scopes: ProjectScopeConfig & {
|
|
67
|
+
evaluationRunId: string;
|
|
68
|
+
};
|
|
69
|
+
data: EvaluationRunUpdate;
|
|
70
|
+
}) => Promise<EvaluationRunSelect | null>;
|
|
71
|
+
declare const deleteEvaluationRun: (db: AgentsRunDatabaseClient) => (params: {
|
|
72
|
+
scopes: ProjectScopeConfig & {
|
|
73
|
+
evaluationRunId: string;
|
|
74
|
+
};
|
|
75
|
+
}) => Promise<boolean>;
|
|
76
|
+
declare const getEvaluationResultById: (db: AgentsRunDatabaseClient) => (params: {
|
|
77
|
+
scopes: ProjectScopeConfig & {
|
|
78
|
+
evaluationResultId: string;
|
|
79
|
+
};
|
|
80
|
+
}) => Promise<EvaluationResultSelect | null>;
|
|
81
|
+
declare const listEvaluationResults: (db: AgentsRunDatabaseClient) => (params: {
|
|
82
|
+
scopes: ProjectScopeConfig;
|
|
83
|
+
}) => Promise<EvaluationResultSelect[]>;
|
|
84
|
+
declare const listEvaluationResultsByRun: (db: AgentsRunDatabaseClient) => (params: {
|
|
85
|
+
scopes: ProjectScopeConfig & {
|
|
86
|
+
evaluationRunId: string;
|
|
87
|
+
};
|
|
88
|
+
}) => Promise<EvaluationResultSelect[]>;
|
|
89
|
+
declare const listEvaluationResultsByConversation: (db: AgentsRunDatabaseClient) => (params: {
|
|
90
|
+
scopes: ProjectScopeConfig & {
|
|
91
|
+
conversationId: string;
|
|
92
|
+
};
|
|
93
|
+
}) => Promise<EvaluationResultSelect[]>;
|
|
94
|
+
declare const createEvaluationResult: (db: AgentsRunDatabaseClient) => (data: EvaluationResultInsert) => Promise<EvaluationResultSelect>;
|
|
95
|
+
declare const createEvaluationResults: (db: AgentsRunDatabaseClient) => (data: EvaluationResultInsert[]) => Promise<EvaluationResultSelect[]>;
|
|
96
|
+
declare const updateEvaluationResult: (db: AgentsRunDatabaseClient) => (params: {
|
|
97
|
+
scopes: ProjectScopeConfig & {
|
|
98
|
+
evaluationResultId: string;
|
|
99
|
+
};
|
|
100
|
+
data: EvaluationResultUpdate;
|
|
101
|
+
}) => Promise<EvaluationResultSelect | null>;
|
|
102
|
+
declare const deleteEvaluationResult: (db: AgentsRunDatabaseClient) => (params: {
|
|
103
|
+
scopes: ProjectScopeConfig & {
|
|
104
|
+
evaluationResultId: string;
|
|
105
|
+
};
|
|
106
|
+
}) => Promise<boolean>;
|
|
107
|
+
declare const deleteEvaluationResultsByRun: (db: AgentsRunDatabaseClient) => (params: {
|
|
108
|
+
scopes: ProjectScopeConfig & {
|
|
109
|
+
evaluationRunId: string;
|
|
110
|
+
};
|
|
111
|
+
}) => Promise<number>;
|
|
112
|
+
/**
|
|
113
|
+
* Filter conversations based on evaluation job filter criteria
|
|
114
|
+
*/
|
|
115
|
+
declare const filterConversationsForJob: (db: AgentsRunDatabaseClient) => (params: {
|
|
116
|
+
scopes: ProjectScopeConfig;
|
|
117
|
+
jobFilters: Filter<EvaluationJobFilterCriteria> | null | undefined;
|
|
118
|
+
}) => Promise<ConversationSelect[]>;
|
|
119
|
+
//#endregion
|
|
120
|
+
export { createDatasetRun, createDatasetRunConversationRelation, createDatasetRunConversationRelations, createEvaluationResult, createEvaluationResults, createEvaluationRun, deleteDatasetRun, deleteDatasetRunConversationRelation, deleteDatasetRunConversationRelationsByRun, deleteEvaluationResult, deleteEvaluationResultsByRun, deleteEvaluationRun, filterConversationsForJob, getDatasetRunById, getDatasetRunConversationRelationByConversation, getDatasetRunConversationRelations, getEvaluationResultById, getEvaluationRunById, getEvaluationRunByJobConfigId, listDatasetRuns, listDatasetRunsByConfig, listEvaluationResults, listEvaluationResultsByConversation, listEvaluationResultsByRun, listEvaluationRuns, listEvaluationRunsByJobConfigId, updateEvaluationResult, updateEvaluationRun };
|