@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
|
@@ -1,46 +1,39 @@
|
|
|
1
|
-
import { __exportAll } from "
|
|
2
|
-
import { account, deviceCode, invitation, member, organization, session, ssoProvider, user, verification } from "../auth/auth-schema.js";
|
|
1
|
+
import { __exportAll } from "../../_virtual/rolldown_runtime.js";
|
|
3
2
|
import { relations } from "drizzle-orm";
|
|
4
|
-
import {
|
|
3
|
+
import { boolean, doublePrecision, foreignKey, jsonb, pgTable, primaryKey, text, timestamp, unique, varchar } from "drizzle-orm/pg-core";
|
|
5
4
|
|
|
6
|
-
//#region src/db/schema.ts
|
|
7
|
-
var
|
|
8
|
-
account: () => account,
|
|
5
|
+
//#region src/db/manage/manage-schema.ts
|
|
6
|
+
var manage_schema_exports = /* @__PURE__ */ __exportAll({
|
|
9
7
|
agentRelations: () => agentRelations,
|
|
10
8
|
agentToolRelationsRelations: () => agentToolRelationsRelations,
|
|
11
9
|
agents: () => agents,
|
|
12
|
-
apiKeys: () => apiKeys,
|
|
13
|
-
apiKeysRelations: () => apiKeysRelations,
|
|
14
10
|
artifactComponents: () => artifactComponents,
|
|
15
11
|
artifactComponentsRelations: () => artifactComponentsRelations,
|
|
16
|
-
contextCache: () => contextCache,
|
|
17
|
-
contextCacheRelations: () => contextCacheRelations,
|
|
18
12
|
contextConfigs: () => contextConfigs,
|
|
19
13
|
contextConfigsRelations: () => contextConfigsRelations,
|
|
20
|
-
conversations: () => conversations,
|
|
21
|
-
conversationsRelations: () => conversationsRelations,
|
|
22
14
|
credentialReferences: () => credentialReferences,
|
|
23
15
|
credentialReferencesRelations: () => credentialReferencesRelations,
|
|
24
16
|
dataComponents: () => dataComponents,
|
|
25
17
|
dataComponentsRelations: () => dataComponentsRelations,
|
|
26
|
-
|
|
18
|
+
dataset: () => dataset,
|
|
19
|
+
datasetItem: () => datasetItem,
|
|
20
|
+
datasetRunConfig: () => datasetRunConfig,
|
|
21
|
+
datasetRunConfigAgentRelations: () => datasetRunConfigAgentRelations,
|
|
22
|
+
evaluationJobConfig: () => evaluationJobConfig,
|
|
23
|
+
evaluationJobConfigEvaluatorRelations: () => evaluationJobConfigEvaluatorRelations,
|
|
24
|
+
evaluationRunConfig: () => evaluationRunConfig,
|
|
25
|
+
evaluationRunConfigEvaluationSuiteConfigRelations: () => evaluationRunConfigEvaluationSuiteConfigRelations,
|
|
26
|
+
evaluationSuiteConfig: () => evaluationSuiteConfig,
|
|
27
|
+
evaluationSuiteConfigEvaluatorRelations: () => evaluationSuiteConfigEvaluatorRelations,
|
|
28
|
+
evaluator: () => evaluator,
|
|
27
29
|
externalAgents: () => externalAgents,
|
|
28
30
|
externalAgentsRelations: () => externalAgentsRelations,
|
|
29
31
|
functionTools: () => functionTools,
|
|
30
32
|
functionToolsRelations: () => functionToolsRelations,
|
|
31
33
|
functions: () => functions,
|
|
32
34
|
functionsRelations: () => functionsRelations,
|
|
33
|
-
invitation: () => invitation,
|
|
34
|
-
ledgerArtifacts: () => ledgerArtifacts,
|
|
35
|
-
ledgerArtifactsRelations: () => ledgerArtifactsRelations,
|
|
36
|
-
member: () => member,
|
|
37
|
-
messages: () => messages,
|
|
38
|
-
messagesRelations: () => messagesRelations,
|
|
39
|
-
organization: () => organization,
|
|
40
35
|
projects: () => projects,
|
|
41
36
|
projectsRelations: () => projectsRelations,
|
|
42
|
-
session: () => session,
|
|
43
|
-
ssoProvider: () => ssoProvider,
|
|
44
37
|
subAgentArtifactComponents: () => subAgentArtifactComponents,
|
|
45
38
|
subAgentArtifactComponentsRelations: () => subAgentArtifactComponentsRelations,
|
|
46
39
|
subAgentDataComponents: () => subAgentDataComponents,
|
|
@@ -56,14 +49,9 @@ var schema_exports = /* @__PURE__ */ __exportAll({
|
|
|
56
49
|
subAgentToolRelations: () => subAgentToolRelations,
|
|
57
50
|
subAgents: () => subAgents,
|
|
58
51
|
subAgentsRelations: () => subAgentsRelations,
|
|
59
|
-
taskRelations: () => taskRelations,
|
|
60
|
-
taskRelationsRelations: () => taskRelationsRelations,
|
|
61
|
-
tasks: () => tasks,
|
|
62
|
-
tasksRelations: () => tasksRelations,
|
|
63
52
|
tools: () => tools,
|
|
64
53
|
toolsRelations: () => toolsRelations,
|
|
65
|
-
|
|
66
|
-
verification: () => verification
|
|
54
|
+
triggers: () => triggers
|
|
67
55
|
});
|
|
68
56
|
const tenantScoped = {
|
|
69
57
|
tenantId: varchar("tenant_id", { length: 256 }).notNull(),
|
|
@@ -95,11 +83,7 @@ const projects = pgTable("projects", {
|
|
|
95
83
|
models: jsonb("models").$type(),
|
|
96
84
|
stopWhen: jsonb("stop_when").$type(),
|
|
97
85
|
...timestamps
|
|
98
|
-
}, (table) => [primaryKey({ columns: [table.tenantId, table.id] })
|
|
99
|
-
columns: [table.tenantId],
|
|
100
|
-
foreignColumns: [organization.id],
|
|
101
|
-
name: "projects_tenant_id_fk"
|
|
102
|
-
}).onDelete("cascade")]);
|
|
86
|
+
}, (table) => [primaryKey({ columns: [table.tenantId, table.id] })]);
|
|
103
87
|
const agents = pgTable("agent", {
|
|
104
88
|
...projectScoped,
|
|
105
89
|
name: varchar("name", { length: 256 }).notNull(),
|
|
@@ -143,30 +127,34 @@ const contextConfigs = pgTable("context_configs", {
|
|
|
143
127
|
],
|
|
144
128
|
name: "context_configs_agent_fk"
|
|
145
129
|
}).onDelete("cascade")]);
|
|
146
|
-
const
|
|
147
|
-
...
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
fetchDurationMs: integer("fetch_duration_ms"),
|
|
130
|
+
const triggers = pgTable("triggers", {
|
|
131
|
+
...agentScoped,
|
|
132
|
+
...uiProperties,
|
|
133
|
+
enabled: boolean("enabled").notNull().default(true),
|
|
134
|
+
inputSchema: jsonb("input_schema").$type(),
|
|
135
|
+
outputTransform: jsonb("output_transform").$type(),
|
|
136
|
+
messageTemplate: text("message_template"),
|
|
137
|
+
authentication: jsonb("authentication").$type(),
|
|
138
|
+
signingSecret: text("signing_secret"),
|
|
156
139
|
...timestamps
|
|
157
|
-
}, (table) => [
|
|
158
|
-
|
|
140
|
+
}, (table) => [primaryKey({ columns: [
|
|
141
|
+
table.tenantId,
|
|
142
|
+
table.projectId,
|
|
143
|
+
table.agentId,
|
|
144
|
+
table.id
|
|
145
|
+
] }), foreignKey({
|
|
146
|
+
columns: [
|
|
159
147
|
table.tenantId,
|
|
160
148
|
table.projectId,
|
|
161
|
-
table.
|
|
162
|
-
]
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
]);
|
|
149
|
+
table.agentId
|
|
150
|
+
],
|
|
151
|
+
foreignColumns: [
|
|
152
|
+
agents.tenantId,
|
|
153
|
+
agents.projectId,
|
|
154
|
+
agents.id
|
|
155
|
+
],
|
|
156
|
+
name: "triggers_agent_fk"
|
|
157
|
+
}).onDelete("cascade")]);
|
|
170
158
|
const subAgents = pgTable("sub_agents", {
|
|
171
159
|
...agentScoped,
|
|
172
160
|
...uiProperties,
|
|
@@ -246,46 +234,6 @@ const externalAgents = pgTable("external_agents", {
|
|
|
246
234
|
name: "external_agents_credential_reference_fk"
|
|
247
235
|
}).onDelete("set null")
|
|
248
236
|
]);
|
|
249
|
-
const tasks = pgTable("tasks", {
|
|
250
|
-
...subAgentScoped,
|
|
251
|
-
contextId: varchar("context_id", { length: 256 }).notNull(),
|
|
252
|
-
status: varchar("status", { length: 256 }).notNull(),
|
|
253
|
-
metadata: jsonb("metadata").$type(),
|
|
254
|
-
...timestamps
|
|
255
|
-
}, (table) => [primaryKey({ columns: [
|
|
256
|
-
table.tenantId,
|
|
257
|
-
table.projectId,
|
|
258
|
-
table.id
|
|
259
|
-
] }), foreignKey({
|
|
260
|
-
columns: [
|
|
261
|
-
table.tenantId,
|
|
262
|
-
table.projectId,
|
|
263
|
-
table.agentId,
|
|
264
|
-
table.subAgentId
|
|
265
|
-
],
|
|
266
|
-
foreignColumns: [
|
|
267
|
-
subAgents.tenantId,
|
|
268
|
-
subAgents.projectId,
|
|
269
|
-
subAgents.agentId,
|
|
270
|
-
subAgents.id
|
|
271
|
-
],
|
|
272
|
-
name: "tasks_sub_agent_fk"
|
|
273
|
-
}).onDelete("cascade")]);
|
|
274
|
-
const taskRelations = pgTable("task_relations", {
|
|
275
|
-
...projectScoped,
|
|
276
|
-
parentTaskId: varchar("parent_task_id", { length: 256 }).notNull(),
|
|
277
|
-
childTaskId: varchar("child_task_id", { length: 256 }).notNull(),
|
|
278
|
-
relationType: varchar("relation_type", { length: 256 }).default("parent_child"),
|
|
279
|
-
...timestamps
|
|
280
|
-
}, (table) => [primaryKey({ columns: [
|
|
281
|
-
table.tenantId,
|
|
282
|
-
table.projectId,
|
|
283
|
-
table.id
|
|
284
|
-
] }), foreignKey({
|
|
285
|
-
columns: [table.tenantId, table.projectId],
|
|
286
|
-
foreignColumns: [projects.tenantId, projects.id],
|
|
287
|
-
name: "task_relations_project_fk"
|
|
288
|
-
}).onDelete("cascade")]);
|
|
289
237
|
const dataComponents = pgTable("data_components", {
|
|
290
238
|
...projectScoped,
|
|
291
239
|
...uiProperties,
|
|
@@ -360,13 +308,16 @@ const subAgentArtifactComponents = pgTable("sub_agent_artifact_components", {
|
|
|
360
308
|
artifactComponentId: varchar("artifact_component_id", { length: 256 }).notNull(),
|
|
361
309
|
createdAt: timestamp("created_at", { mode: "string" }).notNull().defaultNow()
|
|
362
310
|
}, (table) => [
|
|
363
|
-
primaryKey({
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
311
|
+
primaryKey({
|
|
312
|
+
columns: [
|
|
313
|
+
table.tenantId,
|
|
314
|
+
table.projectId,
|
|
315
|
+
table.agentId,
|
|
316
|
+
table.subAgentId,
|
|
317
|
+
table.id
|
|
318
|
+
],
|
|
319
|
+
name: "sub_agent_artifact_components_pk"
|
|
320
|
+
}),
|
|
370
321
|
foreignKey({
|
|
371
322
|
columns: [
|
|
372
323
|
table.tenantId,
|
|
@@ -529,12 +480,15 @@ const subAgentExternalAgentRelations = pgTable("sub_agent_external_agent_relatio
|
|
|
529
480
|
headers: jsonb("headers").$type(),
|
|
530
481
|
...timestamps
|
|
531
482
|
}, (table) => [
|
|
532
|
-
primaryKey({
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
483
|
+
primaryKey({
|
|
484
|
+
columns: [
|
|
485
|
+
table.tenantId,
|
|
486
|
+
table.projectId,
|
|
487
|
+
table.agentId,
|
|
488
|
+
table.id
|
|
489
|
+
],
|
|
490
|
+
name: "sub_agent_external_agent_relations_pk"
|
|
491
|
+
}),
|
|
538
492
|
foreignKey({
|
|
539
493
|
columns: [
|
|
540
494
|
table.tenantId,
|
|
@@ -570,12 +524,15 @@ const subAgentTeamAgentRelations = pgTable("sub_agent_team_agent_relations", {
|
|
|
570
524
|
headers: jsonb("headers").$type(),
|
|
571
525
|
...timestamps
|
|
572
526
|
}, (table) => [
|
|
573
|
-
primaryKey({
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
527
|
+
primaryKey({
|
|
528
|
+
columns: [
|
|
529
|
+
table.tenantId,
|
|
530
|
+
table.projectId,
|
|
531
|
+
table.agentId,
|
|
532
|
+
table.id
|
|
533
|
+
],
|
|
534
|
+
name: "sub_agent_team_agent_relations_pk"
|
|
535
|
+
}),
|
|
579
536
|
foreignKey({
|
|
580
537
|
columns: [
|
|
581
538
|
table.tenantId,
|
|
@@ -610,12 +567,15 @@ const subAgentFunctionToolRelations = pgTable("sub_agent_function_tool_relations
|
|
|
610
567
|
functionToolId: varchar("function_tool_id", { length: 256 }).notNull(),
|
|
611
568
|
...timestamps
|
|
612
569
|
}, (table) => [
|
|
613
|
-
primaryKey({
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
570
|
+
primaryKey({
|
|
571
|
+
columns: [
|
|
572
|
+
table.tenantId,
|
|
573
|
+
table.projectId,
|
|
574
|
+
table.agentId,
|
|
575
|
+
table.id
|
|
576
|
+
],
|
|
577
|
+
name: "sub_agent_function_tool_relations_pk"
|
|
578
|
+
}),
|
|
619
579
|
foreignKey({
|
|
620
580
|
columns: [
|
|
621
581
|
table.tenantId,
|
|
@@ -647,13 +607,43 @@ const subAgentFunctionToolRelations = pgTable("sub_agent_function_tool_relations
|
|
|
647
607
|
name: "sub_agent_function_tool_relations_function_tool_fk"
|
|
648
608
|
}).onDelete("cascade")
|
|
649
609
|
]);
|
|
650
|
-
const
|
|
610
|
+
const credentialReferences = pgTable("credential_references", {
|
|
651
611
|
...projectScoped,
|
|
612
|
+
name: varchar("name", { length: 256 }).notNull(),
|
|
613
|
+
type: varchar("type", { length: 256 }).notNull(),
|
|
614
|
+
credentialStoreId: varchar("credential_store_id", { length: 256 }).notNull(),
|
|
615
|
+
retrievalParams: jsonb("retrieval_params").$type(),
|
|
616
|
+
toolId: varchar("tool_id", { length: 256 }),
|
|
652
617
|
userId: varchar("user_id", { length: 256 }),
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
618
|
+
createdBy: varchar("created_by", { length: 256 }),
|
|
619
|
+
...timestamps
|
|
620
|
+
}, (t) => [
|
|
621
|
+
primaryKey({ columns: [
|
|
622
|
+
t.tenantId,
|
|
623
|
+
t.projectId,
|
|
624
|
+
t.id
|
|
625
|
+
] }),
|
|
626
|
+
foreignKey({
|
|
627
|
+
columns: [t.tenantId, t.projectId],
|
|
628
|
+
foreignColumns: [projects.tenantId, projects.id],
|
|
629
|
+
name: "credential_references_project_fk"
|
|
630
|
+
}).onDelete("cascade"),
|
|
631
|
+
unique("credential_references_id_unique").on(t.id),
|
|
632
|
+
unique("credential_references_tool_user_unique").on(t.toolId, t.userId)
|
|
633
|
+
]);
|
|
634
|
+
/**
|
|
635
|
+
* A collection of test cases/items used for evaluation. Contains dataset items
|
|
636
|
+
* that define input/output pairs for testing agents. Used for batch evaluation
|
|
637
|
+
* runs where conversations are created from dataset items. Each datasetRun
|
|
638
|
+
* specifies which agent to use when executing the dataset.
|
|
639
|
+
*
|
|
640
|
+
* one to many relationship with datasetItem
|
|
641
|
+
*
|
|
642
|
+
* Includes: name and timestamps
|
|
643
|
+
*/
|
|
644
|
+
const dataset = pgTable("dataset", {
|
|
645
|
+
...projectScoped,
|
|
646
|
+
name: varchar("name", { length: 256 }).notNull(),
|
|
657
647
|
...timestamps
|
|
658
648
|
}, (table) => [primaryKey({ columns: [
|
|
659
649
|
table.tenantId,
|
|
@@ -662,26 +652,50 @@ const conversations = pgTable("conversations", {
|
|
|
662
652
|
] }), foreignKey({
|
|
663
653
|
columns: [table.tenantId, table.projectId],
|
|
664
654
|
foreignColumns: [projects.tenantId, projects.id],
|
|
665
|
-
name: "
|
|
655
|
+
name: "dataset_project_fk"
|
|
656
|
+
}).onDelete("cascade")]);
|
|
657
|
+
/**
|
|
658
|
+
*
|
|
659
|
+
* Individual test case within a dataset. Contains the input messages to send
|
|
660
|
+
* to an agent and optionally expected output or simulation configuration.
|
|
661
|
+
* When a dataset run executes, it creates conversations from these items.
|
|
662
|
+
*
|
|
663
|
+
*
|
|
664
|
+
* Includes: input (messages array with optional headers), expected output (array of messages),
|
|
665
|
+
* simulation agent (stopWhen conditions, prompt/modelConfig), and timestamps
|
|
666
|
+
* simulationAgent is for when a user wants to create a multi-turn simulation aka a simulating agent is creating input messages based on a persona
|
|
667
|
+
*/
|
|
668
|
+
const datasetItem = pgTable("dataset_item", {
|
|
669
|
+
...projectScoped,
|
|
670
|
+
datasetId: text("dataset_id").notNull(),
|
|
671
|
+
input: jsonb("input").$type().notNull(),
|
|
672
|
+
expectedOutput: jsonb("expected_output").$type(),
|
|
673
|
+
simulationAgent: jsonb("simulation_agent").$type(),
|
|
674
|
+
...timestamps
|
|
675
|
+
}, (table) => [primaryKey({ columns: [
|
|
676
|
+
table.tenantId,
|
|
677
|
+
table.projectId,
|
|
678
|
+
table.id
|
|
679
|
+
] }), foreignKey({
|
|
680
|
+
columns: [
|
|
681
|
+
table.tenantId,
|
|
682
|
+
table.projectId,
|
|
683
|
+
table.datasetId
|
|
684
|
+
],
|
|
685
|
+
foreignColumns: [
|
|
686
|
+
dataset.tenantId,
|
|
687
|
+
dataset.projectId,
|
|
688
|
+
dataset.id
|
|
689
|
+
],
|
|
690
|
+
name: "dataset_item_dataset_fk"
|
|
666
691
|
}).onDelete("cascade")]);
|
|
667
|
-
const
|
|
692
|
+
const evaluator = pgTable("evaluator", {
|
|
668
693
|
...projectScoped,
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
toExternalAgentId: varchar("to_external_sub_agent_id", { length: 256 }),
|
|
675
|
-
fromTeamAgentId: varchar("from_team_agent_id", { length: 256 }),
|
|
676
|
-
toTeamAgentId: varchar("to_team_agent_id", { length: 256 }),
|
|
677
|
-
content: jsonb("content").$type().notNull(),
|
|
678
|
-
visibility: varchar("visibility", { length: 256 }).notNull().default("user-facing"),
|
|
679
|
-
messageType: varchar("message_type", { length: 256 }).notNull().default("chat"),
|
|
680
|
-
taskId: varchar("task_id", { length: 256 }),
|
|
681
|
-
parentMessageId: varchar("parent_message_id", { length: 256 }),
|
|
682
|
-
a2aTaskId: varchar("a2a_task_id", { length: 256 }),
|
|
683
|
-
a2aSessionId: varchar("a2a_session_id", { length: 256 }),
|
|
684
|
-
metadata: jsonb("metadata").$type(),
|
|
694
|
+
...uiProperties,
|
|
695
|
+
prompt: text("prompt").notNull(),
|
|
696
|
+
schema: jsonb("schema").$type().notNull(),
|
|
697
|
+
model: jsonb("model").$type().notNull(),
|
|
698
|
+
passCriteria: jsonb("pass_criteria").$type(),
|
|
685
699
|
...timestamps
|
|
686
700
|
}, (table) => [primaryKey({ columns: [
|
|
687
701
|
table.tenantId,
|
|
@@ -690,116 +704,265 @@ const messages = pgTable("messages", {
|
|
|
690
704
|
] }), foreignKey({
|
|
691
705
|
columns: [table.tenantId, table.projectId],
|
|
692
706
|
foreignColumns: [projects.tenantId, projects.id],
|
|
693
|
-
name: "
|
|
707
|
+
name: "evaluator_project_fk"
|
|
694
708
|
}).onDelete("cascade")]);
|
|
695
|
-
const
|
|
709
|
+
const datasetRunConfig = pgTable("dataset_run_config", {
|
|
696
710
|
...projectScoped,
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
contextId: varchar("context_id", { length: 256 }).notNull(),
|
|
700
|
-
type: varchar("type", { length: 256 }).notNull().default("source"),
|
|
701
|
-
name: varchar("name", { length: 256 }),
|
|
702
|
-
description: text("description"),
|
|
703
|
-
parts: jsonb("parts").$type(),
|
|
704
|
-
metadata: jsonb("metadata").$type(),
|
|
705
|
-
summary: text("summary"),
|
|
706
|
-
mime: jsonb("mime").$type(),
|
|
707
|
-
visibility: varchar("visibility", { length: 256 }).default("context"),
|
|
708
|
-
allowedAgents: jsonb("allowed_agents").$type(),
|
|
709
|
-
derivedFrom: varchar("derived_from", { length: 256 }),
|
|
711
|
+
...uiProperties,
|
|
712
|
+
datasetId: text("dataset_id").notNull(),
|
|
710
713
|
...timestamps
|
|
711
714
|
}, (table) => [
|
|
712
715
|
primaryKey({ columns: [
|
|
713
716
|
table.tenantId,
|
|
714
717
|
table.projectId,
|
|
715
|
-
table.id
|
|
716
|
-
table.taskId
|
|
718
|
+
table.id
|
|
717
719
|
] }),
|
|
718
720
|
foreignKey({
|
|
719
721
|
columns: [table.tenantId, table.projectId],
|
|
720
722
|
foreignColumns: [projects.tenantId, projects.id],
|
|
721
|
-
name: "
|
|
723
|
+
name: "dataset_run_config_project_fk"
|
|
722
724
|
}).onDelete("cascade"),
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
725
|
+
foreignKey({
|
|
726
|
+
columns: [
|
|
727
|
+
table.tenantId,
|
|
728
|
+
table.projectId,
|
|
729
|
+
table.datasetId
|
|
730
|
+
],
|
|
731
|
+
foreignColumns: [
|
|
732
|
+
dataset.tenantId,
|
|
733
|
+
dataset.projectId,
|
|
734
|
+
dataset.id
|
|
735
|
+
],
|
|
736
|
+
name: "dataset_run_config_dataset_fk"
|
|
737
|
+
}).onDelete("cascade")
|
|
727
738
|
]);
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
739
|
+
/**
|
|
740
|
+
* Configuration that defines what to evaluate. Contains filters and evaluators.
|
|
741
|
+
* Example: "Evaluate conversations for agentId X with filters Y"
|
|
742
|
+
*
|
|
743
|
+
* Linked to one or more evaluationRunConfigs (via join table) that define when to run.
|
|
744
|
+
* When triggered, creates an evaluationRun with computed filters based on the criteria.
|
|
745
|
+
*
|
|
746
|
+
* Configuration-level filters:
|
|
747
|
+
* - Filters stored in filters JSONB field
|
|
748
|
+
*
|
|
749
|
+
* many to many relationship with evaluationRunConfig
|
|
750
|
+
*
|
|
751
|
+
* Includes: name, description, filters (JSONB for evaluation criteria),
|
|
752
|
+
* sampleRate for sampling, and timestamps
|
|
753
|
+
*/
|
|
754
|
+
const evaluationSuiteConfig = pgTable("evaluation_suite_config", {
|
|
755
|
+
...projectScoped,
|
|
756
|
+
filters: jsonb("filters").$type(),
|
|
757
|
+
sampleRate: doublePrecision("sample_rate"),
|
|
736
758
|
...timestamps
|
|
737
|
-
}, (
|
|
759
|
+
}, (table) => [primaryKey({ columns: [
|
|
760
|
+
table.tenantId,
|
|
761
|
+
table.projectId,
|
|
762
|
+
table.id
|
|
763
|
+
] }), foreignKey({
|
|
764
|
+
columns: [table.tenantId, table.projectId],
|
|
765
|
+
foreignColumns: [projects.tenantId, projects.id],
|
|
766
|
+
name: "evaluation_suite_config_project_fk"
|
|
767
|
+
}).onDelete("cascade")]);
|
|
768
|
+
/**
|
|
769
|
+
* Links evaluators to evaluation suite configs. Many-to-many relationship that
|
|
770
|
+
* attaches evaluators to an evaluation suite configuration. Each evaluator must
|
|
771
|
+
* have its own model configuration defined.
|
|
772
|
+
*
|
|
773
|
+
* Includes: evaluationSuiteConfigId, evaluatorId, and timestamps
|
|
774
|
+
*/
|
|
775
|
+
const evaluationSuiteConfigEvaluatorRelations = pgTable("evaluation_suite_config_evaluator_relations", {
|
|
776
|
+
...projectScoped,
|
|
777
|
+
evaluationSuiteConfigId: text("evaluation_suite_config_id").notNull(),
|
|
778
|
+
evaluatorId: text("evaluator_id").notNull(),
|
|
779
|
+
...timestamps
|
|
780
|
+
}, (table) => [
|
|
781
|
+
primaryKey({
|
|
782
|
+
columns: [
|
|
783
|
+
table.tenantId,
|
|
784
|
+
table.projectId,
|
|
785
|
+
table.id
|
|
786
|
+
],
|
|
787
|
+
name: "eval_suite_cfg_evaluator_rel_pk"
|
|
788
|
+
}),
|
|
738
789
|
foreignKey({
|
|
739
|
-
columns: [
|
|
740
|
-
|
|
741
|
-
|
|
790
|
+
columns: [
|
|
791
|
+
table.tenantId,
|
|
792
|
+
table.projectId,
|
|
793
|
+
table.evaluationSuiteConfigId
|
|
794
|
+
],
|
|
795
|
+
foreignColumns: [
|
|
796
|
+
evaluationSuiteConfig.tenantId,
|
|
797
|
+
evaluationSuiteConfig.projectId,
|
|
798
|
+
evaluationSuiteConfig.id
|
|
799
|
+
],
|
|
800
|
+
name: "eval_suite_cfg_evaluator_rel_suite_cfg_fk"
|
|
742
801
|
}).onDelete("cascade"),
|
|
743
802
|
foreignKey({
|
|
744
|
-
columns: [
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
803
|
+
columns: [
|
|
804
|
+
table.tenantId,
|
|
805
|
+
table.projectId,
|
|
806
|
+
table.evaluatorId
|
|
807
|
+
],
|
|
808
|
+
foreignColumns: [
|
|
809
|
+
evaluator.tenantId,
|
|
810
|
+
evaluator.projectId,
|
|
811
|
+
evaluator.id
|
|
812
|
+
],
|
|
813
|
+
name: "eval_suite_cfg_evaluator_rel_evaluator_fk"
|
|
814
|
+
}).onDelete("cascade")
|
|
815
|
+
]);
|
|
816
|
+
/**
|
|
817
|
+
* Links evaluation run configs to evaluation suite configs. Many-to-many relationship that
|
|
818
|
+
* allows one suite config to have multiple run schedules, and one run config to be used
|
|
819
|
+
* by multiple suite configs.
|
|
820
|
+
*
|
|
821
|
+
* Includes: evaluationRunConfigId, evaluationSuiteConfigId, and timestamps
|
|
822
|
+
*/
|
|
823
|
+
const evaluationRunConfigEvaluationSuiteConfigRelations = pgTable("evaluation_run_config_evaluation_suite_config_relations", {
|
|
824
|
+
...projectScoped,
|
|
825
|
+
evaluationRunConfigId: text("evaluation_run_config_id").notNull(),
|
|
826
|
+
evaluationSuiteConfigId: text("evaluation_suite_config_id").notNull(),
|
|
827
|
+
...timestamps
|
|
828
|
+
}, (table) => [
|
|
829
|
+
primaryKey({
|
|
830
|
+
columns: [
|
|
831
|
+
table.tenantId,
|
|
832
|
+
table.projectId,
|
|
833
|
+
table.id
|
|
834
|
+
],
|
|
835
|
+
name: "eval_run_cfg_eval_suite_cfg_rel_pk"
|
|
836
|
+
}),
|
|
748
837
|
foreignKey({
|
|
749
838
|
columns: [
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
839
|
+
table.tenantId,
|
|
840
|
+
table.projectId,
|
|
841
|
+
table.evaluationRunConfigId
|
|
753
842
|
],
|
|
754
843
|
foreignColumns: [
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
844
|
+
evaluationRunConfig.tenantId,
|
|
845
|
+
evaluationRunConfig.projectId,
|
|
846
|
+
evaluationRunConfig.id
|
|
758
847
|
],
|
|
759
|
-
name: "
|
|
848
|
+
name: "eval_run_cfg_eval_suite_rel_run_cfg_fk"
|
|
760
849
|
}).onDelete("cascade"),
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
850
|
+
foreignKey({
|
|
851
|
+
columns: [
|
|
852
|
+
table.tenantId,
|
|
853
|
+
table.projectId,
|
|
854
|
+
table.evaluationSuiteConfigId
|
|
855
|
+
],
|
|
856
|
+
foreignColumns: [
|
|
857
|
+
evaluationSuiteConfig.tenantId,
|
|
858
|
+
evaluationSuiteConfig.projectId,
|
|
859
|
+
evaluationSuiteConfig.id
|
|
860
|
+
],
|
|
861
|
+
name: "eval_run_cfg_eval_suite_rel_suite_cfg_fk"
|
|
862
|
+
}).onDelete("cascade")
|
|
764
863
|
]);
|
|
765
|
-
|
|
864
|
+
/**
|
|
865
|
+
* Configuration for automated evaluation runs. Trigger policies is conversation end.
|
|
866
|
+
* Can be linked to multiple evaluation suite configs via join table.
|
|
867
|
+
* many to many relationship with evaluationSuiteConfig
|
|
868
|
+
*
|
|
869
|
+
* Evaluations are automatically triggered when regular conversations complete.
|
|
870
|
+
* When a conversation ends, creates an evaluationRun that evaluates that conversation.
|
|
871
|
+
*
|
|
872
|
+
* NOTE: Evaluation run configs ONLY run on regular conversations, NOT dataset run conversations.
|
|
873
|
+
* Dataset runs create their own evaluationJobConfig with specific evaluators at run-time.
|
|
874
|
+
*
|
|
875
|
+
* one to many relationship with evaluationRun
|
|
876
|
+
*/
|
|
877
|
+
const evaluationRunConfig = pgTable("evaluation_run_config", {
|
|
766
878
|
...projectScoped,
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
credentialStoreId: varchar("credential_store_id", { length: 256 }).notNull(),
|
|
770
|
-
retrievalParams: jsonb("retrieval_params").$type(),
|
|
771
|
-
toolId: varchar("tool_id", { length: 256 }),
|
|
772
|
-
userId: varchar("user_id", { length: 256 }),
|
|
773
|
-
createdBy: varchar("created_by", { length: 256 }),
|
|
879
|
+
...uiProperties,
|
|
880
|
+
isActive: boolean("is_active").notNull().default(true),
|
|
774
881
|
...timestamps
|
|
775
|
-
}, (
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
882
|
+
}, (table) => [primaryKey({ columns: [
|
|
883
|
+
table.tenantId,
|
|
884
|
+
table.projectId,
|
|
885
|
+
table.id
|
|
886
|
+
] }), foreignKey({
|
|
887
|
+
columns: [table.tenantId, table.projectId],
|
|
888
|
+
foreignColumns: [projects.tenantId, projects.id],
|
|
889
|
+
name: "evaluation_run_config_project_fk"
|
|
890
|
+
}).onDelete("cascade")]);
|
|
891
|
+
/**
|
|
892
|
+
* Configuration for a one-off evaluation job to be executed.
|
|
893
|
+
* Example: "Evaluate all conversations in datasetRunId 1234"
|
|
894
|
+
*
|
|
895
|
+
* Created manually or by external systems. Contains job-specific filters like
|
|
896
|
+
* datasetRunIds, conversationIds, and absolute dateRange.
|
|
897
|
+
*
|
|
898
|
+
* one to many relationship with evaluationRun
|
|
899
|
+
*
|
|
900
|
+
* When a job completes, an evaluationRun is created with evaluationJobConfigId set.
|
|
901
|
+
*
|
|
902
|
+
* Includes: jobFilters (specific filters for this job execution: datasetRunIds, conversationIds,
|
|
903
|
+
* dateRange with absolute dates), and timestamps
|
|
904
|
+
*/
|
|
905
|
+
const evaluationJobConfig = pgTable("evaluation_job_config", {
|
|
906
|
+
...projectScoped,
|
|
907
|
+
jobFilters: jsonb("job_filters").$type(),
|
|
908
|
+
...timestamps
|
|
909
|
+
}, (table) => [primaryKey({ columns: [
|
|
910
|
+
table.tenantId,
|
|
911
|
+
table.projectId,
|
|
912
|
+
table.id
|
|
913
|
+
] }), foreignKey({
|
|
914
|
+
columns: [table.tenantId, table.projectId],
|
|
915
|
+
foreignColumns: [projects.tenantId, projects.id],
|
|
916
|
+
name: "evaluation_job_config_project_fk"
|
|
917
|
+
}).onDelete("cascade")]);
|
|
918
|
+
/**
|
|
919
|
+
* Links evaluators to evaluation job configs. Many-to-many relationship that
|
|
920
|
+
* attaches evaluators to an evaluation job configuration. Each evaluator must
|
|
921
|
+
* have its own model configuration defined.
|
|
922
|
+
*
|
|
923
|
+
* Includes: evaluationJobConfigId, evaluatorId, and timestamps
|
|
924
|
+
*/
|
|
925
|
+
const evaluationJobConfigEvaluatorRelations = pgTable("evaluation_job_config_evaluator_relations", {
|
|
926
|
+
...projectScoped,
|
|
927
|
+
evaluationJobConfigId: text("evaluation_job_config_id").notNull(),
|
|
928
|
+
evaluatorId: text("evaluator_id").notNull(),
|
|
929
|
+
...timestamps
|
|
930
|
+
}, (table) => [
|
|
931
|
+
primaryKey({
|
|
932
|
+
columns: [
|
|
933
|
+
table.tenantId,
|
|
934
|
+
table.projectId,
|
|
935
|
+
table.id
|
|
936
|
+
],
|
|
937
|
+
name: "eval_job_cfg_evaluator_rel_pk"
|
|
938
|
+
}),
|
|
781
939
|
foreignKey({
|
|
782
|
-
columns: [
|
|
783
|
-
|
|
784
|
-
|
|
940
|
+
columns: [
|
|
941
|
+
table.tenantId,
|
|
942
|
+
table.projectId,
|
|
943
|
+
table.evaluationJobConfigId
|
|
944
|
+
],
|
|
945
|
+
foreignColumns: [
|
|
946
|
+
evaluationJobConfig.tenantId,
|
|
947
|
+
evaluationJobConfig.projectId,
|
|
948
|
+
evaluationJobConfig.id
|
|
949
|
+
],
|
|
950
|
+
name: "eval_job_cfg_evaluator_rel_job_cfg_fk"
|
|
785
951
|
}).onDelete("cascade"),
|
|
786
|
-
|
|
787
|
-
|
|
952
|
+
foreignKey({
|
|
953
|
+
columns: [
|
|
954
|
+
table.tenantId,
|
|
955
|
+
table.projectId,
|
|
956
|
+
table.evaluatorId
|
|
957
|
+
],
|
|
958
|
+
foreignColumns: [
|
|
959
|
+
evaluator.tenantId,
|
|
960
|
+
evaluator.projectId,
|
|
961
|
+
evaluator.id
|
|
962
|
+
],
|
|
963
|
+
name: "eval_job_cfg_evaluator_rel_evaluator_fk"
|
|
964
|
+
}).onDelete("cascade")
|
|
788
965
|
]);
|
|
789
|
-
const tasksRelations = relations(tasks, ({ one, many }) => ({
|
|
790
|
-
project: one(projects, {
|
|
791
|
-
fields: [tasks.tenantId, tasks.projectId],
|
|
792
|
-
references: [projects.tenantId, projects.id]
|
|
793
|
-
}),
|
|
794
|
-
parentRelations: many(taskRelations, { relationName: "childTask" }),
|
|
795
|
-
childRelations: many(taskRelations, { relationName: "parentTask" }),
|
|
796
|
-
subAgent: one(subAgents, {
|
|
797
|
-
fields: [tasks.subAgentId],
|
|
798
|
-
references: [subAgents.id]
|
|
799
|
-
}),
|
|
800
|
-
messages: many(messages),
|
|
801
|
-
ledgerArtifacts: many(ledgerArtifacts)
|
|
802
|
-
}));
|
|
803
966
|
const projectsRelations = relations(projects, ({ many }) => ({
|
|
804
967
|
subAgents: many(subAgents),
|
|
805
968
|
agents: many(agents),
|
|
@@ -807,48 +970,25 @@ const projectsRelations = relations(projects, ({ many }) => ({
|
|
|
807
970
|
functions: many(functions),
|
|
808
971
|
contextConfigs: many(contextConfigs),
|
|
809
972
|
externalAgents: many(externalAgents),
|
|
810
|
-
conversations: many(conversations),
|
|
811
|
-
tasks: many(tasks),
|
|
812
973
|
dataComponents: many(dataComponents),
|
|
813
974
|
artifactComponents: many(artifactComponents),
|
|
814
|
-
ledgerArtifacts: many(ledgerArtifacts),
|
|
815
975
|
credentialReferences: many(credentialReferences)
|
|
816
976
|
}));
|
|
817
|
-
const taskRelationsRelations = relations(taskRelations, ({ one }) => ({
|
|
818
|
-
parentTask: one(tasks, {
|
|
819
|
-
fields: [taskRelations.parentTaskId],
|
|
820
|
-
references: [tasks.id],
|
|
821
|
-
relationName: "parentTask"
|
|
822
|
-
}),
|
|
823
|
-
childTask: one(tasks, {
|
|
824
|
-
fields: [taskRelations.childTaskId],
|
|
825
|
-
references: [tasks.id],
|
|
826
|
-
relationName: "childTask"
|
|
827
|
-
})
|
|
828
|
-
}));
|
|
829
977
|
const contextConfigsRelations = relations(contextConfigs, ({ many, one }) => ({
|
|
830
978
|
project: one(projects, {
|
|
831
979
|
fields: [contextConfigs.tenantId, contextConfigs.projectId],
|
|
832
980
|
references: [projects.tenantId, projects.id]
|
|
833
981
|
}),
|
|
834
|
-
agents: many(agents)
|
|
835
|
-
cache: many(contextCache)
|
|
982
|
+
agents: many(agents)
|
|
836
983
|
}));
|
|
837
|
-
const contextCacheRelations = relations(contextCache, ({ one }) => ({ contextConfig: one(contextConfigs, {
|
|
838
|
-
fields: [contextCache.contextConfigId],
|
|
839
|
-
references: [contextConfigs.id]
|
|
840
|
-
}) }));
|
|
841
984
|
const subAgentsRelations = relations(subAgents, ({ many, one }) => ({
|
|
842
985
|
project: one(projects, {
|
|
843
986
|
fields: [subAgents.tenantId, subAgents.projectId],
|
|
844
987
|
references: [projects.tenantId, projects.id]
|
|
845
988
|
}),
|
|
846
|
-
tasks: many(tasks),
|
|
847
989
|
defaultForAgents: many(agents),
|
|
848
990
|
sourceRelations: many(subAgentRelations, { relationName: "sourceRelations" }),
|
|
849
991
|
targetRelations: many(subAgentRelations, { relationName: "targetRelations" }),
|
|
850
|
-
sentMessages: many(messages, { relationName: "sentMessages" }),
|
|
851
|
-
receivedMessages: many(messages, { relationName: "receivedMessages" }),
|
|
852
992
|
toolRelations: many(subAgentToolRelations),
|
|
853
993
|
functionToolRelations: many(subAgentFunctionToolRelations),
|
|
854
994
|
dataComponentRelations: many(subAgentDataComponents),
|
|
@@ -880,16 +1020,6 @@ const externalAgentsRelations = relations(externalAgents, ({ one, many }) => ({
|
|
|
880
1020
|
references: [credentialReferences.id]
|
|
881
1021
|
})
|
|
882
1022
|
}));
|
|
883
|
-
const apiKeysRelations = relations(apiKeys, ({ one }) => ({
|
|
884
|
-
project: one(projects, {
|
|
885
|
-
fields: [apiKeys.tenantId, apiKeys.projectId],
|
|
886
|
-
references: [projects.tenantId, projects.id]
|
|
887
|
-
}),
|
|
888
|
-
agent: one(agents, {
|
|
889
|
-
fields: [apiKeys.agentId],
|
|
890
|
-
references: [agents.id]
|
|
891
|
-
})
|
|
892
|
-
}));
|
|
893
1023
|
const agentToolRelationsRelations = relations(subAgentToolRelations, ({ one }) => ({
|
|
894
1024
|
subAgent: one(subAgents, {
|
|
895
1025
|
fields: [subAgentToolRelations.subAgentId],
|
|
@@ -919,79 +1049,6 @@ const toolsRelations = relations(tools, ({ one, many }) => ({
|
|
|
919
1049
|
references: [credentialReferences.id]
|
|
920
1050
|
})
|
|
921
1051
|
}));
|
|
922
|
-
const conversationsRelations = relations(conversations, ({ one, many }) => ({
|
|
923
|
-
project: one(projects, {
|
|
924
|
-
fields: [conversations.tenantId, conversations.projectId],
|
|
925
|
-
references: [projects.tenantId, projects.id]
|
|
926
|
-
}),
|
|
927
|
-
messages: many(messages),
|
|
928
|
-
activeSubAgent: one(subAgents, {
|
|
929
|
-
fields: [conversations.activeSubAgentId],
|
|
930
|
-
references: [subAgents.id]
|
|
931
|
-
})
|
|
932
|
-
}));
|
|
933
|
-
const messagesRelations = relations(messages, ({ one, many }) => ({
|
|
934
|
-
conversation: one(conversations, {
|
|
935
|
-
fields: [messages.conversationId],
|
|
936
|
-
references: [conversations.id]
|
|
937
|
-
}),
|
|
938
|
-
fromSubAgent: one(subAgents, {
|
|
939
|
-
fields: [messages.fromSubAgentId],
|
|
940
|
-
references: [subAgents.id],
|
|
941
|
-
relationName: "sentMessages"
|
|
942
|
-
}),
|
|
943
|
-
toSubAgent: one(subAgents, {
|
|
944
|
-
fields: [messages.toSubAgentId],
|
|
945
|
-
references: [subAgents.id],
|
|
946
|
-
relationName: "receivedMessages"
|
|
947
|
-
}),
|
|
948
|
-
fromTeamAgent: one(agents, {
|
|
949
|
-
fields: [messages.fromTeamAgentId],
|
|
950
|
-
references: [agents.id],
|
|
951
|
-
relationName: "receivedTeamMessages"
|
|
952
|
-
}),
|
|
953
|
-
toTeamAgent: one(agents, {
|
|
954
|
-
fields: [messages.toTeamAgentId],
|
|
955
|
-
references: [agents.id],
|
|
956
|
-
relationName: "sentTeamMessages"
|
|
957
|
-
}),
|
|
958
|
-
fromExternalAgent: one(externalAgents, {
|
|
959
|
-
fields: [
|
|
960
|
-
messages.tenantId,
|
|
961
|
-
messages.projectId,
|
|
962
|
-
messages.fromExternalAgentId
|
|
963
|
-
],
|
|
964
|
-
references: [
|
|
965
|
-
externalAgents.tenantId,
|
|
966
|
-
externalAgents.projectId,
|
|
967
|
-
externalAgents.id
|
|
968
|
-
],
|
|
969
|
-
relationName: "receivedExternalMessages"
|
|
970
|
-
}),
|
|
971
|
-
toExternalAgent: one(externalAgents, {
|
|
972
|
-
fields: [
|
|
973
|
-
messages.tenantId,
|
|
974
|
-
messages.projectId,
|
|
975
|
-
messages.toExternalAgentId
|
|
976
|
-
],
|
|
977
|
-
references: [
|
|
978
|
-
externalAgents.tenantId,
|
|
979
|
-
externalAgents.projectId,
|
|
980
|
-
externalAgents.id
|
|
981
|
-
],
|
|
982
|
-
relationName: "sentExternalMessages"
|
|
983
|
-
}),
|
|
984
|
-
task: one(tasks, {
|
|
985
|
-
fields: [messages.taskId],
|
|
986
|
-
references: [tasks.id]
|
|
987
|
-
}),
|
|
988
|
-
parentMessage: one(messages, {
|
|
989
|
-
fields: [messages.parentMessageId],
|
|
990
|
-
references: [messages.id],
|
|
991
|
-
relationName: "parentChild"
|
|
992
|
-
}),
|
|
993
|
-
childMessages: many(messages, { relationName: "parentChild" })
|
|
994
|
-
}));
|
|
995
1052
|
const artifactComponentsRelations = relations(artifactComponents, ({ many, one }) => ({
|
|
996
1053
|
project: one(projects, {
|
|
997
1054
|
fields: [artifactComponents.tenantId, artifactComponents.projectId],
|
|
@@ -1026,16 +1083,6 @@ const subAgentDataComponentsRelations = relations(subAgentDataComponents, ({ one
|
|
|
1026
1083
|
references: [dataComponents.id]
|
|
1027
1084
|
})
|
|
1028
1085
|
}));
|
|
1029
|
-
const ledgerArtifactsRelations = relations(ledgerArtifacts, ({ one }) => ({
|
|
1030
|
-
project: one(projects, {
|
|
1031
|
-
fields: [ledgerArtifacts.tenantId, ledgerArtifacts.projectId],
|
|
1032
|
-
references: [projects.tenantId, projects.id]
|
|
1033
|
-
}),
|
|
1034
|
-
task: one(tasks, {
|
|
1035
|
-
fields: [ledgerArtifacts.taskId],
|
|
1036
|
-
references: [tasks.id]
|
|
1037
|
-
})
|
|
1038
|
-
}));
|
|
1039
1086
|
const functionsRelations = relations(functions, ({ many, one }) => ({
|
|
1040
1087
|
functionTools: many(functionTools),
|
|
1041
1088
|
project: one(projects, {
|
|
@@ -1156,6 +1203,51 @@ const subAgentTeamAgentRelationsRelations = relations(subAgentTeamAgentRelations
|
|
|
1156
1203
|
]
|
|
1157
1204
|
})
|
|
1158
1205
|
}));
|
|
1206
|
+
/**
|
|
1207
|
+
* Links agents to dataset run configs. Many-to-many relationship that
|
|
1208
|
+
* allows one dataset run config to use multiple agents, and one agent to be used
|
|
1209
|
+
* by multiple dataset run configs.
|
|
1210
|
+
*
|
|
1211
|
+
* Includes: datasetRunConfigId, agentId, and timestamps
|
|
1212
|
+
*/
|
|
1213
|
+
const datasetRunConfigAgentRelations = pgTable("dataset_run_config_agent_relations", {
|
|
1214
|
+
...projectScoped,
|
|
1215
|
+
datasetRunConfigId: text("dataset_run_config_id").notNull(),
|
|
1216
|
+
agentId: text("agent_id").notNull(),
|
|
1217
|
+
...timestamps
|
|
1218
|
+
}, (table) => [
|
|
1219
|
+
primaryKey({ columns: [
|
|
1220
|
+
table.tenantId,
|
|
1221
|
+
table.projectId,
|
|
1222
|
+
table.id
|
|
1223
|
+
] }),
|
|
1224
|
+
foreignKey({
|
|
1225
|
+
columns: [
|
|
1226
|
+
table.tenantId,
|
|
1227
|
+
table.projectId,
|
|
1228
|
+
table.datasetRunConfigId
|
|
1229
|
+
],
|
|
1230
|
+
foreignColumns: [
|
|
1231
|
+
datasetRunConfig.tenantId,
|
|
1232
|
+
datasetRunConfig.projectId,
|
|
1233
|
+
datasetRunConfig.id
|
|
1234
|
+
],
|
|
1235
|
+
name: "dataset_run_config_agent_relations_dataset_run_config_fk"
|
|
1236
|
+
}).onDelete("cascade"),
|
|
1237
|
+
foreignKey({
|
|
1238
|
+
columns: [
|
|
1239
|
+
table.tenantId,
|
|
1240
|
+
table.projectId,
|
|
1241
|
+
table.agentId
|
|
1242
|
+
],
|
|
1243
|
+
foreignColumns: [
|
|
1244
|
+
agents.tenantId,
|
|
1245
|
+
agents.projectId,
|
|
1246
|
+
agents.id
|
|
1247
|
+
],
|
|
1248
|
+
name: "dataset_run_config_agent_relations_agent_fk"
|
|
1249
|
+
}).onDelete("cascade")
|
|
1250
|
+
]);
|
|
1159
1251
|
|
|
1160
1252
|
//#endregion
|
|
1161
|
-
export {
|
|
1253
|
+
export { agentRelations, agentToolRelationsRelations, agents, artifactComponents, artifactComponentsRelations, contextConfigs, contextConfigsRelations, credentialReferences, credentialReferencesRelations, dataComponents, dataComponentsRelations, dataset, datasetItem, datasetRunConfig, datasetRunConfigAgentRelations, evaluationJobConfig, evaluationJobConfigEvaluatorRelations, evaluationRunConfig, evaluationRunConfigEvaluationSuiteConfigRelations, evaluationSuiteConfig, evaluationSuiteConfigEvaluatorRelations, evaluator, externalAgents, externalAgentsRelations, functionTools, functionToolsRelations, functions, functionsRelations, manage_schema_exports, projects, projectsRelations, subAgentArtifactComponents, subAgentArtifactComponentsRelations, subAgentDataComponents, subAgentDataComponentsRelations, subAgentExternalAgentRelations, subAgentExternalAgentRelationsRelations, subAgentFunctionToolRelations, subAgentFunctionToolRelationsRelations, subAgentRelations, subAgentRelationsRelations, subAgentTeamAgentRelations, subAgentTeamAgentRelationsRelations, subAgentToolRelations, subAgents, subAgentsRelations, tools, toolsRelations, triggers };
|