@inkeep/agents-core 0.0.0-dev-20250919020857 → 0.0.0-dev-20250919052931
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/{chunk-BAPMUHVN.js → chunk-IIW7VAP3.js} +20 -12
- package/dist/{chunk-MXQKLGQK.js → chunk-LFWFXR4O.js} +123 -82
- package/dist/{chunk-KNC2AOJM.js → chunk-ZORVFHVU.js} +76 -29
- package/dist/client-exports.cjs +195 -111
- package/dist/client-exports.js +4 -5
- package/dist/db/schema.cjs +121 -80
- package/dist/db/schema.js +1 -1
- package/dist/index.cjs +529 -598
- package/dist/index.js +318 -485
- package/dist/validation/index.cjs +213 -118
- package/dist/validation/index.js +2 -2
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FullGraphDefinitionSchema, resourceIdSchema, MAX_ID_LENGTH } from './chunk-
|
|
1
|
+
import { FullGraphDefinitionSchema, resourceIdSchema, MAX_ID_LENGTH } from './chunk-ZORVFHVU.js';
|
|
2
2
|
|
|
3
3
|
// src/validation/graphFull.ts
|
|
4
4
|
function isInternalAgent(agent) {
|
|
@@ -10,9 +10,11 @@ function isExternalAgent(agent) {
|
|
|
10
10
|
function validateAndTypeGraphData(data) {
|
|
11
11
|
return FullGraphDefinitionSchema.parse(data);
|
|
12
12
|
}
|
|
13
|
-
function validateToolReferences(graphData) {
|
|
13
|
+
function validateToolReferences(graphData, availableToolIds) {
|
|
14
|
+
if (!availableToolIds) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
14
17
|
const errors = [];
|
|
15
|
-
const availableToolIds = new Set(Object.keys(graphData.tools || {}));
|
|
16
18
|
for (const [agentId, agentData] of Object.entries(graphData.agents)) {
|
|
17
19
|
if (isInternalAgent(agentData) && agentData.tools && Array.isArray(agentData.tools)) {
|
|
18
20
|
for (const toolId of agentData.tools) {
|
|
@@ -27,9 +29,11 @@ function validateToolReferences(graphData) {
|
|
|
27
29
|
${errors.join("\n")}`);
|
|
28
30
|
}
|
|
29
31
|
}
|
|
30
|
-
function validateDataComponentReferences(graphData) {
|
|
32
|
+
function validateDataComponentReferences(graphData, availableDataComponentIds) {
|
|
33
|
+
if (!availableDataComponentIds) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
31
36
|
const errors = [];
|
|
32
|
-
const availableDataComponentIds = new Set(Object.keys(graphData.dataComponents || {}));
|
|
33
37
|
for (const [agentId, agentData] of Object.entries(graphData.agents)) {
|
|
34
38
|
if (isInternalAgent(agentData) && agentData.dataComponents) {
|
|
35
39
|
for (const dataComponentId of agentData.dataComponents) {
|
|
@@ -46,9 +50,11 @@ function validateDataComponentReferences(graphData) {
|
|
|
46
50
|
${errors.join("\n")}`);
|
|
47
51
|
}
|
|
48
52
|
}
|
|
49
|
-
function validateArtifactComponentReferences(graphData) {
|
|
53
|
+
function validateArtifactComponentReferences(graphData, availableArtifactComponentIds) {
|
|
54
|
+
if (!availableArtifactComponentIds) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
50
57
|
const errors = [];
|
|
51
|
-
const availableArtifactComponentIds = new Set(Object.keys(graphData.artifactComponents || {}));
|
|
52
58
|
for (const [agentId, agentData] of Object.entries(graphData.agents)) {
|
|
53
59
|
if (isInternalAgent(agentData) && agentData.artifactComponents) {
|
|
54
60
|
for (const artifactComponentId of agentData.artifactComponents) {
|
|
@@ -95,13 +101,15 @@ function validateAgentRelationships(graphData) {
|
|
|
95
101
|
${errors.join("\n")}`);
|
|
96
102
|
}
|
|
97
103
|
}
|
|
98
|
-
function validateGraphStructure(graphData) {
|
|
99
|
-
if (!graphData.agents[graphData.defaultAgentId]) {
|
|
104
|
+
function validateGraphStructure(graphData, projectResources) {
|
|
105
|
+
if (graphData.defaultAgentId && !graphData.agents[graphData.defaultAgentId]) {
|
|
100
106
|
throw new Error(`Default agent '${graphData.defaultAgentId}' does not exist in agents`);
|
|
101
107
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
108
|
+
if (projectResources) {
|
|
109
|
+
validateToolReferences(graphData, projectResources.toolIds);
|
|
110
|
+
validateDataComponentReferences(graphData, projectResources.dataComponentIds);
|
|
111
|
+
validateArtifactComponentReferences(graphData, projectResources.artifactComponentIds);
|
|
112
|
+
}
|
|
105
113
|
validateAgentRelationships(graphData);
|
|
106
114
|
}
|
|
107
115
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __export } from './chunk-MKBO26DX.js';
|
|
2
2
|
import { relations, sql } from 'drizzle-orm';
|
|
3
|
-
import { sqliteTable, index, unique, text, primaryKey,
|
|
3
|
+
import { sqliteTable, index, unique, text, primaryKey, foreignKey, blob, integer } from 'drizzle-orm/sqlite-core';
|
|
4
4
|
|
|
5
5
|
// src/db/schema.ts
|
|
6
6
|
var schema_exports = {};
|
|
@@ -8,6 +8,7 @@ __export(schema_exports, {
|
|
|
8
8
|
agentArtifactComponents: () => agentArtifactComponents,
|
|
9
9
|
agentArtifactComponentsRelations: () => agentArtifactComponentsRelations,
|
|
10
10
|
agentDataComponents: () => agentDataComponents,
|
|
11
|
+
agentDataComponentsRelations: () => agentDataComponentsRelations,
|
|
11
12
|
agentGraph: () => agentGraph,
|
|
12
13
|
agentGraphRelations: () => agentGraphRelations,
|
|
13
14
|
agentRelations: () => agentRelations,
|
|
@@ -29,10 +30,12 @@ __export(schema_exports, {
|
|
|
29
30
|
credentialReferences: () => credentialReferences,
|
|
30
31
|
credentialReferencesRelations: () => credentialReferencesRelations,
|
|
31
32
|
dataComponents: () => dataComponents,
|
|
33
|
+
dataComponentsRelations: () => dataComponentsRelations,
|
|
32
34
|
externalAgents: () => externalAgents,
|
|
33
35
|
externalAgentsRelations: () => externalAgentsRelations,
|
|
34
36
|
ledgerArtifacts: () => ledgerArtifacts,
|
|
35
37
|
ledgerArtifactsContextIdIdx: () => ledgerArtifactsContextIdIdx,
|
|
38
|
+
ledgerArtifactsRelations: () => ledgerArtifactsRelations,
|
|
36
39
|
ledgerArtifactsTaskContextNameUnique: () => ledgerArtifactsTaskContextNameUnique,
|
|
37
40
|
ledgerArtifactsTaskIdIdx: () => ledgerArtifactsTaskIdIdx,
|
|
38
41
|
messages: () => messages,
|
|
@@ -63,11 +66,44 @@ var projects = sqliteTable(
|
|
|
63
66
|
},
|
|
64
67
|
(table) => [primaryKey({ columns: [table.tenantId, table.id] })]
|
|
65
68
|
);
|
|
69
|
+
var agentGraph = sqliteTable(
|
|
70
|
+
"agent_graph",
|
|
71
|
+
{
|
|
72
|
+
tenantId: text("tenant_id").notNull(),
|
|
73
|
+
projectId: text("project_id").notNull(),
|
|
74
|
+
id: text("id").notNull(),
|
|
75
|
+
name: text("name").notNull(),
|
|
76
|
+
description: text("description"),
|
|
77
|
+
defaultAgentId: text("default_agent_id"),
|
|
78
|
+
// Reference to shared context configuration for all agents in this graph
|
|
79
|
+
contextConfigId: text("context_config_id"),
|
|
80
|
+
// add fk relationship
|
|
81
|
+
// Graph-level model settingsuration that can be inherited by agents
|
|
82
|
+
models: text("models", { mode: "json" }).$type(),
|
|
83
|
+
// Status updates configuration for intelligent progress summaries
|
|
84
|
+
statusUpdates: text("status_updates", { mode: "json" }).$type(),
|
|
85
|
+
// Graph-level prompt that can be used as additional context for agents
|
|
86
|
+
graphPrompt: text("graph_prompt"),
|
|
87
|
+
// Graph-level stopWhen configuration that can be inherited by agents
|
|
88
|
+
stopWhen: text("stop_when", { mode: "json" }).$type(),
|
|
89
|
+
createdAt: text("created_at").notNull().default(sql`CURRENT_TIMESTAMP`),
|
|
90
|
+
updatedAt: text("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`)
|
|
91
|
+
},
|
|
92
|
+
(table) => [
|
|
93
|
+
primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
94
|
+
foreignKey({
|
|
95
|
+
columns: [table.tenantId, table.projectId],
|
|
96
|
+
foreignColumns: [projects.tenantId, projects.id],
|
|
97
|
+
name: "agent_graph_project_fk"
|
|
98
|
+
}).onDelete("cascade")
|
|
99
|
+
]
|
|
100
|
+
);
|
|
66
101
|
var contextConfigs = sqliteTable(
|
|
67
102
|
"context_configs",
|
|
68
103
|
{
|
|
69
104
|
tenantId: text("tenant_id").notNull(),
|
|
70
105
|
projectId: text("project_id").notNull(),
|
|
106
|
+
// Add graph level scoping
|
|
71
107
|
id: text("id").notNull(),
|
|
72
108
|
name: text("name").notNull(),
|
|
73
109
|
description: text("description").notNull(),
|
|
@@ -132,6 +168,7 @@ var agents = sqliteTable(
|
|
|
132
168
|
{
|
|
133
169
|
tenantId: text("tenant_id").notNull(),
|
|
134
170
|
projectId: text("project_id").notNull(),
|
|
171
|
+
graphId: text("graph_id").notNull(),
|
|
135
172
|
id: text("id").notNull(),
|
|
136
173
|
name: text("name").notNull(),
|
|
137
174
|
description: text("description").notNull(),
|
|
@@ -146,11 +183,11 @@ var agents = sqliteTable(
|
|
|
146
183
|
updatedAt: text("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`)
|
|
147
184
|
},
|
|
148
185
|
(table) => [
|
|
149
|
-
primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
186
|
+
primaryKey({ columns: [table.tenantId, table.projectId, table.graphId, table.id] }),
|
|
150
187
|
foreignKey({
|
|
151
|
-
columns: [table.tenantId, table.projectId],
|
|
152
|
-
foreignColumns: [
|
|
153
|
-
name: "
|
|
188
|
+
columns: [table.tenantId, table.projectId, table.graphId],
|
|
189
|
+
foreignColumns: [agentGraph.tenantId, agentGraph.projectId, agentGraph.id],
|
|
190
|
+
name: "agents_graph_fk"
|
|
154
191
|
}).onDelete("cascade")
|
|
155
192
|
]
|
|
156
193
|
);
|
|
@@ -159,8 +196,8 @@ var agentRelations = sqliteTable(
|
|
|
159
196
|
{
|
|
160
197
|
tenantId: text("tenant_id").notNull(),
|
|
161
198
|
projectId: text("project_id").notNull(),
|
|
162
|
-
id: text("id").notNull(),
|
|
163
199
|
graphId: text("graph_id").notNull(),
|
|
200
|
+
id: text("id").notNull(),
|
|
164
201
|
sourceAgentId: text("source_agent_id").notNull(),
|
|
165
202
|
// For internal relationships
|
|
166
203
|
targetAgentId: text("target_agent_id"),
|
|
@@ -172,11 +209,11 @@ var agentRelations = sqliteTable(
|
|
|
172
209
|
updatedAt: text("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`)
|
|
173
210
|
},
|
|
174
211
|
(table) => [
|
|
175
|
-
primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
212
|
+
primaryKey({ columns: [table.tenantId, table.projectId, table.graphId, table.id] }),
|
|
176
213
|
foreignKey({
|
|
177
|
-
columns: [table.tenantId, table.projectId],
|
|
178
|
-
foreignColumns: [
|
|
179
|
-
name: "
|
|
214
|
+
columns: [table.tenantId, table.projectId, table.graphId],
|
|
215
|
+
foreignColumns: [agentGraph.tenantId, agentGraph.projectId, agentGraph.id],
|
|
216
|
+
name: "agent_relations_graph_fk"
|
|
180
217
|
}).onDelete("cascade")
|
|
181
218
|
]
|
|
182
219
|
);
|
|
@@ -185,6 +222,7 @@ var externalAgents = sqliteTable(
|
|
|
185
222
|
{
|
|
186
223
|
tenantId: text("tenant_id").notNull(),
|
|
187
224
|
projectId: text("project_id").notNull(),
|
|
225
|
+
graphId: text("graph_id").notNull(),
|
|
188
226
|
id: text("id").notNull(),
|
|
189
227
|
name: text("name").notNull(),
|
|
190
228
|
description: text("description").notNull(),
|
|
@@ -196,11 +234,11 @@ var externalAgents = sqliteTable(
|
|
|
196
234
|
updatedAt: text("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`)
|
|
197
235
|
},
|
|
198
236
|
(table) => [
|
|
199
|
-
primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
237
|
+
primaryKey({ columns: [table.tenantId, table.projectId, table.graphId, table.id] }),
|
|
200
238
|
foreignKey({
|
|
201
|
-
columns: [table.tenantId, table.projectId],
|
|
202
|
-
foreignColumns: [
|
|
203
|
-
name: "
|
|
239
|
+
columns: [table.tenantId, table.projectId, table.graphId],
|
|
240
|
+
foreignColumns: [agentGraph.tenantId, agentGraph.projectId, agentGraph.id],
|
|
241
|
+
name: "external_agents_graph_fk"
|
|
204
242
|
}).onDelete("cascade"),
|
|
205
243
|
foreignKey({
|
|
206
244
|
columns: [table.tenantId, table.projectId, table.credentialReferenceId],
|
|
@@ -213,37 +251,6 @@ var externalAgents = sqliteTable(
|
|
|
213
251
|
}).onDelete("set null")
|
|
214
252
|
]
|
|
215
253
|
);
|
|
216
|
-
var agentGraph = sqliteTable(
|
|
217
|
-
"agent_graph",
|
|
218
|
-
{
|
|
219
|
-
tenantId: text("tenant_id").notNull(),
|
|
220
|
-
projectId: text("project_id").notNull(),
|
|
221
|
-
id: text("id").notNull(),
|
|
222
|
-
name: text("name").notNull(),
|
|
223
|
-
description: text("description"),
|
|
224
|
-
defaultAgentId: text("default_agent_id").notNull(),
|
|
225
|
-
// Reference to shared context configuration for all agents in this graph
|
|
226
|
-
contextConfigId: text("context_config_id"),
|
|
227
|
-
// Graph-level model settingsuration that can be inherited by agents
|
|
228
|
-
models: text("models", { mode: "json" }).$type(),
|
|
229
|
-
// Status updates configuration for intelligent progress summaries
|
|
230
|
-
statusUpdates: text("status_updates", { mode: "json" }).$type(),
|
|
231
|
-
// Graph-level prompt that can be used as additional context for agents
|
|
232
|
-
graphPrompt: text("graph_prompt"),
|
|
233
|
-
// Graph-level stopWhen configuration that can be inherited by agents
|
|
234
|
-
stopWhen: text("stop_when", { mode: "json" }).$type(),
|
|
235
|
-
createdAt: text("created_at").notNull().default(sql`CURRENT_TIMESTAMP`),
|
|
236
|
-
updatedAt: text("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`)
|
|
237
|
-
},
|
|
238
|
-
(table) => [
|
|
239
|
-
primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
240
|
-
foreignKey({
|
|
241
|
-
columns: [table.tenantId, table.projectId],
|
|
242
|
-
foreignColumns: [projects.tenantId, projects.id],
|
|
243
|
-
name: "agent_graph_project_fk"
|
|
244
|
-
}).onDelete("cascade")
|
|
245
|
-
]
|
|
246
|
-
);
|
|
247
254
|
var tasks = sqliteTable(
|
|
248
255
|
"tasks",
|
|
249
256
|
{
|
|
@@ -314,23 +321,18 @@ var agentDataComponents = sqliteTable(
|
|
|
314
321
|
{
|
|
315
322
|
tenantId: text("tenant_id").notNull(),
|
|
316
323
|
projectId: text("project_id").notNull(),
|
|
317
|
-
|
|
324
|
+
graphId: text("graph_id").notNull(),
|
|
318
325
|
agentId: text("agent_id").notNull(),
|
|
326
|
+
id: text("id").notNull(),
|
|
319
327
|
dataComponentId: text("data_component_id").notNull(),
|
|
320
328
|
createdAt: text("created_at").notNull().default(sql`CURRENT_TIMESTAMP`)
|
|
321
329
|
},
|
|
322
330
|
(table) => [
|
|
323
331
|
primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
324
|
-
// Foreign key constraint to
|
|
325
|
-
foreignKey({
|
|
326
|
-
columns: [table.tenantId, table.projectId],
|
|
327
|
-
foreignColumns: [projects.tenantId, projects.id],
|
|
328
|
-
name: "agent_data_components_project_fk"
|
|
329
|
-
}).onDelete("cascade"),
|
|
330
|
-
// Foreign key constraint to agents table
|
|
332
|
+
// Foreign key constraint to agents table (ensures graph and project exist via cascade)
|
|
331
333
|
foreignKey({
|
|
332
|
-
columns: [table.tenantId, table.projectId, table.agentId],
|
|
333
|
-
foreignColumns: [agents.tenantId, agents.projectId, agents.id],
|
|
334
|
+
columns: [table.tenantId, table.projectId, table.graphId, table.agentId],
|
|
335
|
+
foreignColumns: [agents.tenantId, agents.projectId, agents.graphId, agents.id],
|
|
334
336
|
name: "agent_data_components_agent_fk"
|
|
335
337
|
}).onDelete("cascade"),
|
|
336
338
|
// Foreign key constraint to data_components table
|
|
@@ -368,23 +370,20 @@ var agentArtifactComponents = sqliteTable(
|
|
|
368
370
|
{
|
|
369
371
|
tenantId: text("tenant_id").notNull(),
|
|
370
372
|
projectId: text("project_id").notNull(),
|
|
371
|
-
|
|
373
|
+
graphId: text("graph_id").notNull(),
|
|
372
374
|
agentId: text("agent_id").notNull(),
|
|
375
|
+
id: text("id").notNull(),
|
|
373
376
|
artifactComponentId: text("artifact_component_id").notNull(),
|
|
374
377
|
createdAt: text("created_at").notNull().default(sql`CURRENT_TIMESTAMP`)
|
|
375
378
|
},
|
|
376
379
|
(table) => [
|
|
377
|
-
primaryKey({
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
foreignColumns: [projects.tenantId, projects.id],
|
|
382
|
-
name: "agent_artifact_components_project_fk"
|
|
383
|
-
}).onDelete("cascade"),
|
|
384
|
-
// Foreign key constraint to agents table
|
|
380
|
+
primaryKey({
|
|
381
|
+
columns: [table.tenantId, table.projectId, table.graphId, table.agentId, table.id]
|
|
382
|
+
}),
|
|
383
|
+
// Foreign key constraint to agents table (ensures graph and project exist via cascade)
|
|
385
384
|
foreignKey({
|
|
386
|
-
columns: [table.tenantId, table.projectId, table.agentId],
|
|
387
|
-
foreignColumns: [agents.tenantId, agents.projectId, agents.id],
|
|
385
|
+
columns: [table.tenantId, table.projectId, table.graphId, table.agentId],
|
|
386
|
+
foreignColumns: [agents.tenantId, agents.projectId, agents.graphId, agents.id],
|
|
388
387
|
name: "agent_artifact_components_agent_fk"
|
|
389
388
|
}).onDelete("cascade"),
|
|
390
389
|
// Foreign key constraint to artifact_components table
|
|
@@ -438,25 +437,20 @@ var agentToolRelations = sqliteTable(
|
|
|
438
437
|
{
|
|
439
438
|
tenantId: text("tenant_id").notNull(),
|
|
440
439
|
projectId: text("project_id").notNull(),
|
|
441
|
-
|
|
440
|
+
graphId: text("graph_id").notNull(),
|
|
442
441
|
agentId: text("agent_id").notNull(),
|
|
442
|
+
id: text("id").notNull(),
|
|
443
443
|
toolId: text("tool_id").notNull(),
|
|
444
444
|
selectedTools: blob("selected_tools", { mode: "json" }).$type(),
|
|
445
445
|
createdAt: text("created_at").notNull().default(sql`CURRENT_TIMESTAMP`),
|
|
446
446
|
updatedAt: text("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`)
|
|
447
447
|
},
|
|
448
448
|
(table) => [
|
|
449
|
-
primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
450
|
-
// Foreign key constraint to
|
|
449
|
+
primaryKey({ columns: [table.tenantId, table.projectId, table.graphId, table.id] }),
|
|
450
|
+
// Foreign key constraint to agents table (which includes project and graph scope)
|
|
451
451
|
foreignKey({
|
|
452
|
-
columns: [table.tenantId, table.projectId],
|
|
453
|
-
foreignColumns: [
|
|
454
|
-
name: "agent_tool_relations_project_fk"
|
|
455
|
-
}).onDelete("cascade"),
|
|
456
|
-
// Foreign key constraint to agents table
|
|
457
|
-
foreignKey({
|
|
458
|
-
columns: [table.tenantId, table.projectId, table.agentId],
|
|
459
|
-
foreignColumns: [agents.tenantId, agents.projectId, agents.id],
|
|
452
|
+
columns: [table.tenantId, table.projectId, table.graphId, table.agentId],
|
|
453
|
+
foreignColumns: [agents.tenantId, agents.projectId, agents.graphId, agents.id],
|
|
460
454
|
name: "agent_tool_relations_agent_fk"
|
|
461
455
|
}).onDelete("cascade"),
|
|
462
456
|
// Foreign key constraint to tools table
|
|
@@ -663,7 +657,9 @@ var tasksRelations = relations(tasks, ({ one, many }) => ({
|
|
|
663
657
|
references: [agents.id]
|
|
664
658
|
}),
|
|
665
659
|
// A task can have many messages associated with it
|
|
666
|
-
messages: many(messages)
|
|
660
|
+
messages: many(messages),
|
|
661
|
+
// A task can have many ledger artifacts
|
|
662
|
+
ledgerArtifacts: many(ledgerArtifacts)
|
|
667
663
|
}));
|
|
668
664
|
var projectsRelations = relations(projects, ({ many }) => ({
|
|
669
665
|
// A project can have many agents
|
|
@@ -679,7 +675,15 @@ var projectsRelations = relations(projects, ({ many }) => ({
|
|
|
679
675
|
// A project can have many conversations
|
|
680
676
|
conversations: many(conversations),
|
|
681
677
|
// A project can have many tasks
|
|
682
|
-
tasks: many(tasks)
|
|
678
|
+
tasks: many(tasks),
|
|
679
|
+
// A project can have many data components
|
|
680
|
+
dataComponents: many(dataComponents),
|
|
681
|
+
// A project can have many artifact components
|
|
682
|
+
artifactComponents: many(artifactComponents),
|
|
683
|
+
// A project can have many ledger artifacts
|
|
684
|
+
ledgerArtifacts: many(ledgerArtifacts),
|
|
685
|
+
// A project can have many credential references
|
|
686
|
+
credentialReferences: many(credentialReferences)
|
|
683
687
|
}));
|
|
684
688
|
var taskRelationsRelations = relations(taskRelations, ({ one }) => ({
|
|
685
689
|
// Each relation has one parent task
|
|
@@ -741,7 +745,11 @@ var agentsRelations = relations(agents, ({ many, one }) => ({
|
|
|
741
745
|
associatedMessages: many(messages, {
|
|
742
746
|
relationName: "associatedAgent"
|
|
743
747
|
}),
|
|
744
|
-
toolRelations: many(agentToolRelations)
|
|
748
|
+
toolRelations: many(agentToolRelations),
|
|
749
|
+
// Data component relations
|
|
750
|
+
dataComponentRelations: many(agentDataComponents),
|
|
751
|
+
// Artifact component relations
|
|
752
|
+
artifactComponentRelations: many(agentArtifactComponents)
|
|
745
753
|
}));
|
|
746
754
|
var agentGraphRelations = relations(agentGraph, ({ one }) => ({
|
|
747
755
|
// An agent graph belongs to one project
|
|
@@ -749,7 +757,7 @@ var agentGraphRelations = relations(agentGraph, ({ one }) => ({
|
|
|
749
757
|
fields: [agentGraph.tenantId, agentGraph.projectId],
|
|
750
758
|
references: [projects.tenantId, projects.id]
|
|
751
759
|
}),
|
|
752
|
-
// An agent graph
|
|
760
|
+
// An agent graph may have one default agent (optional)
|
|
753
761
|
defaultAgent: one(agents, {
|
|
754
762
|
fields: [agentGraph.defaultAgentId],
|
|
755
763
|
references: [agents.id]
|
|
@@ -897,6 +905,39 @@ var agentArtifactComponentsRelations = relations(agentArtifactComponents, ({ one
|
|
|
897
905
|
references: [artifactComponents.id]
|
|
898
906
|
})
|
|
899
907
|
}));
|
|
908
|
+
var dataComponentsRelations = relations(dataComponents, ({ many, one }) => ({
|
|
909
|
+
// A data component belongs to one project
|
|
910
|
+
project: one(projects, {
|
|
911
|
+
fields: [dataComponents.tenantId, dataComponents.projectId],
|
|
912
|
+
references: [projects.tenantId, projects.id]
|
|
913
|
+
}),
|
|
914
|
+
// A data component can be associated with many agents
|
|
915
|
+
agentRelations: many(agentDataComponents)
|
|
916
|
+
}));
|
|
917
|
+
var agentDataComponentsRelations = relations(agentDataComponents, ({ one }) => ({
|
|
918
|
+
// An agent-data component relation belongs to one agent
|
|
919
|
+
agent: one(agents, {
|
|
920
|
+
fields: [agentDataComponents.agentId],
|
|
921
|
+
references: [agents.id]
|
|
922
|
+
}),
|
|
923
|
+
// An agent-data component relation belongs to one data component
|
|
924
|
+
dataComponent: one(dataComponents, {
|
|
925
|
+
fields: [agentDataComponents.dataComponentId],
|
|
926
|
+
references: [dataComponents.id]
|
|
927
|
+
})
|
|
928
|
+
}));
|
|
929
|
+
var ledgerArtifactsRelations = relations(ledgerArtifacts, ({ one }) => ({
|
|
930
|
+
// A ledger artifact belongs to one project
|
|
931
|
+
project: one(projects, {
|
|
932
|
+
fields: [ledgerArtifacts.tenantId, ledgerArtifacts.projectId],
|
|
933
|
+
references: [projects.tenantId, projects.id]
|
|
934
|
+
}),
|
|
935
|
+
// A ledger artifact may be associated with one task
|
|
936
|
+
task: one(tasks, {
|
|
937
|
+
fields: [ledgerArtifacts.taskId],
|
|
938
|
+
references: [tasks.id]
|
|
939
|
+
})
|
|
940
|
+
}));
|
|
900
941
|
var agentRelationsRelations = relations(agentRelations, ({ one }) => ({
|
|
901
942
|
// An agent relation belongs to one graph
|
|
902
943
|
graph: one(agentGraph, {
|
|
@@ -922,4 +963,4 @@ var agentRelationsRelations = relations(agentRelations, ({ one }) => ({
|
|
|
922
963
|
})
|
|
923
964
|
}));
|
|
924
965
|
|
|
925
|
-
export { agentArtifactComponents, agentArtifactComponentsRelations, agentDataComponents, agentGraph, agentGraphRelations, agentRelations, agentRelationsRelations, agentToolRelations, agentToolRelationsRelations, agents, agentsRelations, apiKeys, apiKeysRelations, artifactComponents, artifactComponentsRelations, contextCache, contextCacheRelations, contextConfigs, contextConfigsRelations, conversations, conversationsRelations, credentialReferences, credentialReferencesRelations, dataComponents, externalAgents, externalAgentsRelations, ledgerArtifacts, ledgerArtifactsContextIdIdx, ledgerArtifactsTaskContextNameUnique, ledgerArtifactsTaskIdIdx, messages, messagesRelations, projects, projectsRelations, schema_exports, taskRelations, taskRelationsRelations, tasks, tasksRelations, tools, toolsRelations };
|
|
966
|
+
export { agentArtifactComponents, agentArtifactComponentsRelations, agentDataComponents, agentDataComponentsRelations, agentGraph, agentGraphRelations, agentRelations, agentRelationsRelations, agentToolRelations, agentToolRelationsRelations, agents, agentsRelations, apiKeys, apiKeysRelations, artifactComponents, artifactComponentsRelations, contextCache, contextCacheRelations, contextConfigs, contextConfigsRelations, conversations, conversationsRelations, credentialReferences, credentialReferencesRelations, dataComponents, dataComponentsRelations, externalAgents, externalAgentsRelations, ledgerArtifacts, ledgerArtifactsContextIdIdx, ledgerArtifactsRelations, ledgerArtifactsTaskContextNameUnique, ledgerArtifactsTaskIdIdx, messages, messagesRelations, projects, projectsRelations, schema_exports, taskRelations, taskRelationsRelations, tasks, tasksRelations, tools, toolsRelations };
|