@inkeep/agents-core 0.2.2 → 0.5.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/{chunk-MXQKLGQK.js → chunk-LFWFXR4O.js} +123 -82
- package/dist/{chunk-KNC2AOJM.js → chunk-LPIKPCE5.js} +76 -29
- package/dist/{chunk-BAPMUHVN.js → chunk-XQRFKXVV.js} +20 -12
- 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 +650 -644
- package/dist/index.js +436 -527
- package/dist/validation/index.cjs +213 -118
- package/dist/validation/index.js +2 -2
- package/package.json +3 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FullGraphDefinitionSchema, resourceIdSchema, MAX_ID_LENGTH } from './chunk-
|
|
1
|
+
import { FullGraphDefinitionSchema, resourceIdSchema, MAX_ID_LENGTH } from './chunk-LPIKPCE5.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
|
|
package/dist/client-exports.cjs
CHANGED
|
@@ -47,11 +47,44 @@ var projects = sqliteCore.sqliteTable(
|
|
|
47
47
|
},
|
|
48
48
|
(table) => [sqliteCore.primaryKey({ columns: [table.tenantId, table.id] })]
|
|
49
49
|
);
|
|
50
|
+
var agentGraph = sqliteCore.sqliteTable(
|
|
51
|
+
"agent_graph",
|
|
52
|
+
{
|
|
53
|
+
tenantId: sqliteCore.text("tenant_id").notNull(),
|
|
54
|
+
projectId: sqliteCore.text("project_id").notNull(),
|
|
55
|
+
id: sqliteCore.text("id").notNull(),
|
|
56
|
+
name: sqliteCore.text("name").notNull(),
|
|
57
|
+
description: sqliteCore.text("description"),
|
|
58
|
+
defaultAgentId: sqliteCore.text("default_agent_id"),
|
|
59
|
+
// Reference to shared context configuration for all agents in this graph
|
|
60
|
+
contextConfigId: sqliteCore.text("context_config_id"),
|
|
61
|
+
// add fk relationship
|
|
62
|
+
// Graph-level model settingsuration that can be inherited by agents
|
|
63
|
+
models: sqliteCore.text("models", { mode: "json" }).$type(),
|
|
64
|
+
// Status updates configuration for intelligent progress summaries
|
|
65
|
+
statusUpdates: sqliteCore.text("status_updates", { mode: "json" }).$type(),
|
|
66
|
+
// Graph-level prompt that can be used as additional context for agents
|
|
67
|
+
graphPrompt: sqliteCore.text("graph_prompt"),
|
|
68
|
+
// Graph-level stopWhen configuration that can be inherited by agents
|
|
69
|
+
stopWhen: sqliteCore.text("stop_when", { mode: "json" }).$type(),
|
|
70
|
+
createdAt: sqliteCore.text("created_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`),
|
|
71
|
+
updatedAt: sqliteCore.text("updated_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`)
|
|
72
|
+
},
|
|
73
|
+
(table) => [
|
|
74
|
+
sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
75
|
+
sqliteCore.foreignKey({
|
|
76
|
+
columns: [table.tenantId, table.projectId],
|
|
77
|
+
foreignColumns: [projects.tenantId, projects.id],
|
|
78
|
+
name: "agent_graph_project_fk"
|
|
79
|
+
}).onDelete("cascade")
|
|
80
|
+
]
|
|
81
|
+
);
|
|
50
82
|
var contextConfigs = sqliteCore.sqliteTable(
|
|
51
83
|
"context_configs",
|
|
52
84
|
{
|
|
53
85
|
tenantId: sqliteCore.text("tenant_id").notNull(),
|
|
54
86
|
projectId: sqliteCore.text("project_id").notNull(),
|
|
87
|
+
// Add graph level scoping
|
|
55
88
|
id: sqliteCore.text("id").notNull(),
|
|
56
89
|
name: sqliteCore.text("name").notNull(),
|
|
57
90
|
description: sqliteCore.text("description").notNull(),
|
|
@@ -116,6 +149,7 @@ var agents = sqliteCore.sqliteTable(
|
|
|
116
149
|
{
|
|
117
150
|
tenantId: sqliteCore.text("tenant_id").notNull(),
|
|
118
151
|
projectId: sqliteCore.text("project_id").notNull(),
|
|
152
|
+
graphId: sqliteCore.text("graph_id").notNull(),
|
|
119
153
|
id: sqliteCore.text("id").notNull(),
|
|
120
154
|
name: sqliteCore.text("name").notNull(),
|
|
121
155
|
description: sqliteCore.text("description").notNull(),
|
|
@@ -130,11 +164,11 @@ var agents = sqliteCore.sqliteTable(
|
|
|
130
164
|
updatedAt: sqliteCore.text("updated_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`)
|
|
131
165
|
},
|
|
132
166
|
(table) => [
|
|
133
|
-
sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
167
|
+
sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.graphId, table.id] }),
|
|
134
168
|
sqliteCore.foreignKey({
|
|
135
|
-
columns: [table.tenantId, table.projectId],
|
|
136
|
-
foreignColumns: [
|
|
137
|
-
name: "
|
|
169
|
+
columns: [table.tenantId, table.projectId, table.graphId],
|
|
170
|
+
foreignColumns: [agentGraph.tenantId, agentGraph.projectId, agentGraph.id],
|
|
171
|
+
name: "agents_graph_fk"
|
|
138
172
|
}).onDelete("cascade")
|
|
139
173
|
]
|
|
140
174
|
);
|
|
@@ -143,8 +177,8 @@ var agentRelations = sqliteCore.sqliteTable(
|
|
|
143
177
|
{
|
|
144
178
|
tenantId: sqliteCore.text("tenant_id").notNull(),
|
|
145
179
|
projectId: sqliteCore.text("project_id").notNull(),
|
|
146
|
-
id: sqliteCore.text("id").notNull(),
|
|
147
180
|
graphId: sqliteCore.text("graph_id").notNull(),
|
|
181
|
+
id: sqliteCore.text("id").notNull(),
|
|
148
182
|
sourceAgentId: sqliteCore.text("source_agent_id").notNull(),
|
|
149
183
|
// For internal relationships
|
|
150
184
|
targetAgentId: sqliteCore.text("target_agent_id"),
|
|
@@ -156,11 +190,11 @@ var agentRelations = sqliteCore.sqliteTable(
|
|
|
156
190
|
updatedAt: sqliteCore.text("updated_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`)
|
|
157
191
|
},
|
|
158
192
|
(table) => [
|
|
159
|
-
sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
193
|
+
sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.graphId, table.id] }),
|
|
160
194
|
sqliteCore.foreignKey({
|
|
161
|
-
columns: [table.tenantId, table.projectId],
|
|
162
|
-
foreignColumns: [
|
|
163
|
-
name: "
|
|
195
|
+
columns: [table.tenantId, table.projectId, table.graphId],
|
|
196
|
+
foreignColumns: [agentGraph.tenantId, agentGraph.projectId, agentGraph.id],
|
|
197
|
+
name: "agent_relations_graph_fk"
|
|
164
198
|
}).onDelete("cascade")
|
|
165
199
|
]
|
|
166
200
|
);
|
|
@@ -169,6 +203,7 @@ var externalAgents = sqliteCore.sqliteTable(
|
|
|
169
203
|
{
|
|
170
204
|
tenantId: sqliteCore.text("tenant_id").notNull(),
|
|
171
205
|
projectId: sqliteCore.text("project_id").notNull(),
|
|
206
|
+
graphId: sqliteCore.text("graph_id").notNull(),
|
|
172
207
|
id: sqliteCore.text("id").notNull(),
|
|
173
208
|
name: sqliteCore.text("name").notNull(),
|
|
174
209
|
description: sqliteCore.text("description").notNull(),
|
|
@@ -180,11 +215,11 @@ var externalAgents = sqliteCore.sqliteTable(
|
|
|
180
215
|
updatedAt: sqliteCore.text("updated_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`)
|
|
181
216
|
},
|
|
182
217
|
(table) => [
|
|
183
|
-
sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
218
|
+
sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.graphId, table.id] }),
|
|
184
219
|
sqliteCore.foreignKey({
|
|
185
|
-
columns: [table.tenantId, table.projectId],
|
|
186
|
-
foreignColumns: [
|
|
187
|
-
name: "
|
|
220
|
+
columns: [table.tenantId, table.projectId, table.graphId],
|
|
221
|
+
foreignColumns: [agentGraph.tenantId, agentGraph.projectId, agentGraph.id],
|
|
222
|
+
name: "external_agents_graph_fk"
|
|
188
223
|
}).onDelete("cascade"),
|
|
189
224
|
sqliteCore.foreignKey({
|
|
190
225
|
columns: [table.tenantId, table.projectId, table.credentialReferenceId],
|
|
@@ -197,37 +232,6 @@ var externalAgents = sqliteCore.sqliteTable(
|
|
|
197
232
|
}).onDelete("set null")
|
|
198
233
|
]
|
|
199
234
|
);
|
|
200
|
-
var agentGraph = sqliteCore.sqliteTable(
|
|
201
|
-
"agent_graph",
|
|
202
|
-
{
|
|
203
|
-
tenantId: sqliteCore.text("tenant_id").notNull(),
|
|
204
|
-
projectId: sqliteCore.text("project_id").notNull(),
|
|
205
|
-
id: sqliteCore.text("id").notNull(),
|
|
206
|
-
name: sqliteCore.text("name").notNull(),
|
|
207
|
-
description: sqliteCore.text("description"),
|
|
208
|
-
defaultAgentId: sqliteCore.text("default_agent_id").notNull(),
|
|
209
|
-
// Reference to shared context configuration for all agents in this graph
|
|
210
|
-
contextConfigId: sqliteCore.text("context_config_id"),
|
|
211
|
-
// Graph-level model settingsuration that can be inherited by agents
|
|
212
|
-
models: sqliteCore.text("models", { mode: "json" }).$type(),
|
|
213
|
-
// Status updates configuration for intelligent progress summaries
|
|
214
|
-
statusUpdates: sqliteCore.text("status_updates", { mode: "json" }).$type(),
|
|
215
|
-
// Graph-level prompt that can be used as additional context for agents
|
|
216
|
-
graphPrompt: sqliteCore.text("graph_prompt"),
|
|
217
|
-
// Graph-level stopWhen configuration that can be inherited by agents
|
|
218
|
-
stopWhen: sqliteCore.text("stop_when", { mode: "json" }).$type(),
|
|
219
|
-
createdAt: sqliteCore.text("created_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`),
|
|
220
|
-
updatedAt: sqliteCore.text("updated_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`)
|
|
221
|
-
},
|
|
222
|
-
(table) => [
|
|
223
|
-
sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
224
|
-
sqliteCore.foreignKey({
|
|
225
|
-
columns: [table.tenantId, table.projectId],
|
|
226
|
-
foreignColumns: [projects.tenantId, projects.id],
|
|
227
|
-
name: "agent_graph_project_fk"
|
|
228
|
-
}).onDelete("cascade")
|
|
229
|
-
]
|
|
230
|
-
);
|
|
231
235
|
var tasks = sqliteCore.sqliteTable(
|
|
232
236
|
"tasks",
|
|
233
237
|
{
|
|
@@ -298,23 +302,18 @@ var agentDataComponents = sqliteCore.sqliteTable(
|
|
|
298
302
|
{
|
|
299
303
|
tenantId: sqliteCore.text("tenant_id").notNull(),
|
|
300
304
|
projectId: sqliteCore.text("project_id").notNull(),
|
|
301
|
-
|
|
305
|
+
graphId: sqliteCore.text("graph_id").notNull(),
|
|
302
306
|
agentId: sqliteCore.text("agent_id").notNull(),
|
|
307
|
+
id: sqliteCore.text("id").notNull(),
|
|
303
308
|
dataComponentId: sqliteCore.text("data_component_id").notNull(),
|
|
304
309
|
createdAt: sqliteCore.text("created_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`)
|
|
305
310
|
},
|
|
306
311
|
(table) => [
|
|
307
312
|
sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
308
|
-
// Foreign key constraint to
|
|
309
|
-
sqliteCore.foreignKey({
|
|
310
|
-
columns: [table.tenantId, table.projectId],
|
|
311
|
-
foreignColumns: [projects.tenantId, projects.id],
|
|
312
|
-
name: "agent_data_components_project_fk"
|
|
313
|
-
}).onDelete("cascade"),
|
|
314
|
-
// Foreign key constraint to agents table
|
|
313
|
+
// Foreign key constraint to agents table (ensures graph and project exist via cascade)
|
|
315
314
|
sqliteCore.foreignKey({
|
|
316
|
-
columns: [table.tenantId, table.projectId, table.agentId],
|
|
317
|
-
foreignColumns: [agents.tenantId, agents.projectId, agents.id],
|
|
315
|
+
columns: [table.tenantId, table.projectId, table.graphId, table.agentId],
|
|
316
|
+
foreignColumns: [agents.tenantId, agents.projectId, agents.graphId, agents.id],
|
|
318
317
|
name: "agent_data_components_agent_fk"
|
|
319
318
|
}).onDelete("cascade"),
|
|
320
319
|
// Foreign key constraint to data_components table
|
|
@@ -352,23 +351,20 @@ var agentArtifactComponents = sqliteCore.sqliteTable(
|
|
|
352
351
|
{
|
|
353
352
|
tenantId: sqliteCore.text("tenant_id").notNull(),
|
|
354
353
|
projectId: sqliteCore.text("project_id").notNull(),
|
|
355
|
-
|
|
354
|
+
graphId: sqliteCore.text("graph_id").notNull(),
|
|
356
355
|
agentId: sqliteCore.text("agent_id").notNull(),
|
|
356
|
+
id: sqliteCore.text("id").notNull(),
|
|
357
357
|
artifactComponentId: sqliteCore.text("artifact_component_id").notNull(),
|
|
358
358
|
createdAt: sqliteCore.text("created_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`)
|
|
359
359
|
},
|
|
360
360
|
(table) => [
|
|
361
|
-
sqliteCore.primaryKey({
|
|
362
|
-
|
|
361
|
+
sqliteCore.primaryKey({
|
|
362
|
+
columns: [table.tenantId, table.projectId, table.graphId, table.agentId, table.id]
|
|
363
|
+
}),
|
|
364
|
+
// Foreign key constraint to agents table (ensures graph and project exist via cascade)
|
|
363
365
|
sqliteCore.foreignKey({
|
|
364
|
-
columns: [table.tenantId, table.projectId],
|
|
365
|
-
foreignColumns: [
|
|
366
|
-
name: "agent_artifact_components_project_fk"
|
|
367
|
-
}).onDelete("cascade"),
|
|
368
|
-
// Foreign key constraint to agents table
|
|
369
|
-
sqliteCore.foreignKey({
|
|
370
|
-
columns: [table.tenantId, table.projectId, table.agentId],
|
|
371
|
-
foreignColumns: [agents.tenantId, agents.projectId, agents.id],
|
|
366
|
+
columns: [table.tenantId, table.projectId, table.graphId, table.agentId],
|
|
367
|
+
foreignColumns: [agents.tenantId, agents.projectId, agents.graphId, agents.id],
|
|
372
368
|
name: "agent_artifact_components_agent_fk"
|
|
373
369
|
}).onDelete("cascade"),
|
|
374
370
|
// Foreign key constraint to artifact_components table
|
|
@@ -422,25 +418,20 @@ var agentToolRelations = sqliteCore.sqliteTable(
|
|
|
422
418
|
{
|
|
423
419
|
tenantId: sqliteCore.text("tenant_id").notNull(),
|
|
424
420
|
projectId: sqliteCore.text("project_id").notNull(),
|
|
425
|
-
|
|
421
|
+
graphId: sqliteCore.text("graph_id").notNull(),
|
|
426
422
|
agentId: sqliteCore.text("agent_id").notNull(),
|
|
423
|
+
id: sqliteCore.text("id").notNull(),
|
|
427
424
|
toolId: sqliteCore.text("tool_id").notNull(),
|
|
428
425
|
selectedTools: sqliteCore.blob("selected_tools", { mode: "json" }).$type(),
|
|
429
426
|
createdAt: sqliteCore.text("created_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`),
|
|
430
427
|
updatedAt: sqliteCore.text("updated_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`)
|
|
431
428
|
},
|
|
432
429
|
(table) => [
|
|
433
|
-
sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
434
|
-
// Foreign key constraint to
|
|
435
|
-
sqliteCore.foreignKey({
|
|
436
|
-
columns: [table.tenantId, table.projectId],
|
|
437
|
-
foreignColumns: [projects.tenantId, projects.id],
|
|
438
|
-
name: "agent_tool_relations_project_fk"
|
|
439
|
-
}).onDelete("cascade"),
|
|
440
|
-
// Foreign key constraint to agents table
|
|
430
|
+
sqliteCore.primaryKey({ columns: [table.tenantId, table.projectId, table.graphId, table.id] }),
|
|
431
|
+
// Foreign key constraint to agents table (which includes project and graph scope)
|
|
441
432
|
sqliteCore.foreignKey({
|
|
442
|
-
columns: [table.tenantId, table.projectId, table.agentId],
|
|
443
|
-
foreignColumns: [agents.tenantId, agents.projectId, agents.id],
|
|
433
|
+
columns: [table.tenantId, table.projectId, table.graphId, table.agentId],
|
|
434
|
+
foreignColumns: [agents.tenantId, agents.projectId, agents.graphId, agents.id],
|
|
444
435
|
name: "agent_tool_relations_agent_fk"
|
|
445
436
|
}).onDelete("cascade"),
|
|
446
437
|
// Foreign key constraint to tools table
|
|
@@ -647,7 +638,9 @@ drizzleOrm.relations(tasks, ({ one, many }) => ({
|
|
|
647
638
|
references: [agents.id]
|
|
648
639
|
}),
|
|
649
640
|
// A task can have many messages associated with it
|
|
650
|
-
messages: many(messages)
|
|
641
|
+
messages: many(messages),
|
|
642
|
+
// A task can have many ledger artifacts
|
|
643
|
+
ledgerArtifacts: many(ledgerArtifacts)
|
|
651
644
|
}));
|
|
652
645
|
drizzleOrm.relations(projects, ({ many }) => ({
|
|
653
646
|
// A project can have many agents
|
|
@@ -663,7 +656,15 @@ drizzleOrm.relations(projects, ({ many }) => ({
|
|
|
663
656
|
// A project can have many conversations
|
|
664
657
|
conversations: many(conversations),
|
|
665
658
|
// A project can have many tasks
|
|
666
|
-
tasks: many(tasks)
|
|
659
|
+
tasks: many(tasks),
|
|
660
|
+
// A project can have many data components
|
|
661
|
+
dataComponents: many(dataComponents),
|
|
662
|
+
// A project can have many artifact components
|
|
663
|
+
artifactComponents: many(artifactComponents),
|
|
664
|
+
// A project can have many ledger artifacts
|
|
665
|
+
ledgerArtifacts: many(ledgerArtifacts),
|
|
666
|
+
// A project can have many credential references
|
|
667
|
+
credentialReferences: many(credentialReferences)
|
|
667
668
|
}));
|
|
668
669
|
drizzleOrm.relations(taskRelations, ({ one }) => ({
|
|
669
670
|
// Each relation has one parent task
|
|
@@ -725,7 +726,11 @@ drizzleOrm.relations(agents, ({ many, one }) => ({
|
|
|
725
726
|
associatedMessages: many(messages, {
|
|
726
727
|
relationName: "associatedAgent"
|
|
727
728
|
}),
|
|
728
|
-
toolRelations: many(agentToolRelations)
|
|
729
|
+
toolRelations: many(agentToolRelations),
|
|
730
|
+
// Data component relations
|
|
731
|
+
dataComponentRelations: many(agentDataComponents),
|
|
732
|
+
// Artifact component relations
|
|
733
|
+
artifactComponentRelations: many(agentArtifactComponents)
|
|
729
734
|
}));
|
|
730
735
|
drizzleOrm.relations(agentGraph, ({ one }) => ({
|
|
731
736
|
// An agent graph belongs to one project
|
|
@@ -733,7 +738,7 @@ drizzleOrm.relations(agentGraph, ({ one }) => ({
|
|
|
733
738
|
fields: [agentGraph.tenantId, agentGraph.projectId],
|
|
734
739
|
references: [projects.tenantId, projects.id]
|
|
735
740
|
}),
|
|
736
|
-
// An agent graph
|
|
741
|
+
// An agent graph may have one default agent (optional)
|
|
737
742
|
defaultAgent: one(agents, {
|
|
738
743
|
fields: [agentGraph.defaultAgentId],
|
|
739
744
|
references: [agents.id]
|
|
@@ -881,6 +886,39 @@ drizzleOrm.relations(agentArtifactComponents, ({ one }) => ({
|
|
|
881
886
|
references: [artifactComponents.id]
|
|
882
887
|
})
|
|
883
888
|
}));
|
|
889
|
+
drizzleOrm.relations(dataComponents, ({ many, one }) => ({
|
|
890
|
+
// A data component belongs to one project
|
|
891
|
+
project: one(projects, {
|
|
892
|
+
fields: [dataComponents.tenantId, dataComponents.projectId],
|
|
893
|
+
references: [projects.tenantId, projects.id]
|
|
894
|
+
}),
|
|
895
|
+
// A data component can be associated with many agents
|
|
896
|
+
agentRelations: many(agentDataComponents)
|
|
897
|
+
}));
|
|
898
|
+
drizzleOrm.relations(agentDataComponents, ({ one }) => ({
|
|
899
|
+
// An agent-data component relation belongs to one agent
|
|
900
|
+
agent: one(agents, {
|
|
901
|
+
fields: [agentDataComponents.agentId],
|
|
902
|
+
references: [agents.id]
|
|
903
|
+
}),
|
|
904
|
+
// An agent-data component relation belongs to one data component
|
|
905
|
+
dataComponent: one(dataComponents, {
|
|
906
|
+
fields: [agentDataComponents.dataComponentId],
|
|
907
|
+
references: [dataComponents.id]
|
|
908
|
+
})
|
|
909
|
+
}));
|
|
910
|
+
drizzleOrm.relations(ledgerArtifacts, ({ one }) => ({
|
|
911
|
+
// A ledger artifact belongs to one project
|
|
912
|
+
project: one(projects, {
|
|
913
|
+
fields: [ledgerArtifacts.tenantId, ledgerArtifacts.projectId],
|
|
914
|
+
references: [projects.tenantId, projects.id]
|
|
915
|
+
}),
|
|
916
|
+
// A ledger artifact may be associated with one task
|
|
917
|
+
task: one(tasks, {
|
|
918
|
+
fields: [ledgerArtifacts.taskId],
|
|
919
|
+
references: [tasks.id]
|
|
920
|
+
})
|
|
921
|
+
}));
|
|
884
922
|
drizzleOrm.relations(agentRelations, ({ one }) => ({
|
|
885
923
|
// An agent relation belongs to one graph
|
|
886
924
|
graph: one(agentGraph, {
|
|
@@ -939,15 +977,18 @@ var ProjectModelSchema = zodOpenapi.z.object({
|
|
|
939
977
|
var createApiSchema = (schema) => schema.omit({ tenantId: true, projectId: true });
|
|
940
978
|
var createApiInsertSchema = (schema) => schema.omit({ tenantId: true, projectId: true });
|
|
941
979
|
var createApiUpdateSchema = (schema) => schema.omit({ tenantId: true, projectId: true }).partial();
|
|
980
|
+
var createGraphScopedApiSchema = (schema) => schema.omit({ tenantId: true, projectId: true, graphId: true });
|
|
981
|
+
var createGraphScopedApiInsertSchema = (schema) => schema.omit({ tenantId: true, projectId: true, graphId: true });
|
|
982
|
+
var createGraphScopedApiUpdateSchema = (schema) => schema.omit({ tenantId: true, projectId: true, graphId: true }).partial();
|
|
942
983
|
var AgentSelectSchema = drizzleZod.createSelectSchema(agents);
|
|
943
984
|
var AgentInsertSchema = drizzleZod.createInsertSchema(agents).extend({
|
|
944
985
|
id: resourceIdSchema,
|
|
945
986
|
models: ModelSchema.optional()
|
|
946
987
|
});
|
|
947
988
|
var AgentUpdateSchema = AgentInsertSchema.partial();
|
|
948
|
-
var AgentApiSelectSchema =
|
|
949
|
-
var AgentApiInsertSchema =
|
|
950
|
-
|
|
989
|
+
var AgentApiSelectSchema = createGraphScopedApiSchema(AgentSelectSchema);
|
|
990
|
+
var AgentApiInsertSchema = createGraphScopedApiInsertSchema(AgentInsertSchema);
|
|
991
|
+
createGraphScopedApiUpdateSchema(AgentUpdateSchema);
|
|
951
992
|
var AgentRelationSelectSchema = drizzleZod.createSelectSchema(agentRelations);
|
|
952
993
|
var AgentRelationInsertSchema = drizzleZod.createInsertSchema(agentRelations).extend({
|
|
953
994
|
id: resourceIdSchema,
|
|
@@ -957,8 +998,10 @@ var AgentRelationInsertSchema = drizzleZod.createInsertSchema(agentRelations).ex
|
|
|
957
998
|
externalAgentId: resourceIdSchema.optional()
|
|
958
999
|
});
|
|
959
1000
|
var AgentRelationUpdateSchema = AgentRelationInsertSchema.partial();
|
|
960
|
-
|
|
961
|
-
|
|
1001
|
+
createGraphScopedApiSchema(AgentRelationSelectSchema);
|
|
1002
|
+
createGraphScopedApiInsertSchema(
|
|
1003
|
+
AgentRelationInsertSchema
|
|
1004
|
+
).extend({
|
|
962
1005
|
relationType: zodOpenapi.z.enum(VALID_RELATION_TYPES)
|
|
963
1006
|
}).refine(
|
|
964
1007
|
(data) => {
|
|
@@ -971,7 +1014,9 @@ createApiInsertSchema(AgentRelationInsertSchema).extend({
|
|
|
971
1014
|
path: ["targetAgentId", "externalAgentId"]
|
|
972
1015
|
}
|
|
973
1016
|
);
|
|
974
|
-
|
|
1017
|
+
createGraphScopedApiUpdateSchema(
|
|
1018
|
+
AgentRelationUpdateSchema
|
|
1019
|
+
).extend({
|
|
975
1020
|
relationType: zodOpenapi.z.enum(VALID_RELATION_TYPES).optional()
|
|
976
1021
|
}).refine(
|
|
977
1022
|
(data) => {
|
|
@@ -1008,7 +1053,7 @@ var AgentGraphInsertSchema = drizzleZod.createInsertSchema(agentGraph).extend({
|
|
|
1008
1053
|
var AgentGraphUpdateSchema = AgentGraphInsertSchema.partial();
|
|
1009
1054
|
createApiSchema(AgentGraphSelectSchema);
|
|
1010
1055
|
var AgentGraphApiInsertSchema = createApiInsertSchema(AgentGraphInsertSchema).extend({
|
|
1011
|
-
id: resourceIdSchema
|
|
1056
|
+
id: resourceIdSchema
|
|
1012
1057
|
});
|
|
1013
1058
|
createApiUpdateSchema(AgentGraphUpdateSchema);
|
|
1014
1059
|
var TaskSelectSchema = drizzleZod.createSelectSchema(tasks);
|
|
@@ -1107,11 +1152,16 @@ createApiUpdateSchema(DataComponentUpdateSchema);
|
|
|
1107
1152
|
var AgentDataComponentSelectSchema = drizzleZod.createSelectSchema(agentDataComponents);
|
|
1108
1153
|
var AgentDataComponentInsertSchema = drizzleZod.createInsertSchema(agentDataComponents);
|
|
1109
1154
|
var AgentDataComponentUpdateSchema = AgentDataComponentInsertSchema.partial();
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
AgentDataComponentInsertSchema
|
|
1155
|
+
createGraphScopedApiSchema(
|
|
1156
|
+
AgentDataComponentSelectSchema
|
|
1113
1157
|
);
|
|
1114
|
-
|
|
1158
|
+
AgentDataComponentInsertSchema.omit({
|
|
1159
|
+
tenantId: true,
|
|
1160
|
+
projectId: true,
|
|
1161
|
+
id: true,
|
|
1162
|
+
createdAt: true
|
|
1163
|
+
});
|
|
1164
|
+
createGraphScopedApiUpdateSchema(
|
|
1115
1165
|
AgentDataComponentUpdateSchema
|
|
1116
1166
|
);
|
|
1117
1167
|
var ArtifactComponentSelectSchema = drizzleZod.createSelectSchema(artifactComponents);
|
|
@@ -1140,7 +1190,7 @@ var AgentArtifactComponentInsertSchema = drizzleZod.createInsertSchema(
|
|
|
1140
1190
|
artifactComponentId: resourceIdSchema
|
|
1141
1191
|
});
|
|
1142
1192
|
var AgentArtifactComponentUpdateSchema = AgentArtifactComponentInsertSchema.partial();
|
|
1143
|
-
|
|
1193
|
+
createGraphScopedApiSchema(
|
|
1144
1194
|
AgentArtifactComponentSelectSchema
|
|
1145
1195
|
);
|
|
1146
1196
|
AgentArtifactComponentInsertSchema.omit({
|
|
@@ -1149,7 +1199,7 @@ AgentArtifactComponentInsertSchema.omit({
|
|
|
1149
1199
|
id: true,
|
|
1150
1200
|
createdAt: true
|
|
1151
1201
|
});
|
|
1152
|
-
|
|
1202
|
+
createGraphScopedApiUpdateSchema(
|
|
1153
1203
|
AgentArtifactComponentUpdateSchema
|
|
1154
1204
|
);
|
|
1155
1205
|
var ExternalAgentSelectSchema = drizzleZod.createSelectSchema(externalAgents).extend({
|
|
@@ -1160,9 +1210,9 @@ var ExternalAgentInsertSchema = drizzleZod.createInsertSchema(externalAgents).ex
|
|
|
1160
1210
|
id: resourceIdSchema
|
|
1161
1211
|
});
|
|
1162
1212
|
var ExternalAgentUpdateSchema = ExternalAgentInsertSchema.partial();
|
|
1163
|
-
var ExternalAgentApiSelectSchema =
|
|
1164
|
-
var ExternalAgentApiInsertSchema =
|
|
1165
|
-
|
|
1213
|
+
var ExternalAgentApiSelectSchema = createGraphScopedApiSchema(ExternalAgentSelectSchema);
|
|
1214
|
+
var ExternalAgentApiInsertSchema = createGraphScopedApiInsertSchema(ExternalAgentInsertSchema);
|
|
1215
|
+
createGraphScopedApiUpdateSchema(ExternalAgentUpdateSchema);
|
|
1166
1216
|
zodOpenapi.z.discriminatedUnion("type", [
|
|
1167
1217
|
AgentApiSelectSchema.extend({ type: zodOpenapi.z.literal("internal") }),
|
|
1168
1218
|
ExternalAgentApiSelectSchema.extend({ type: zodOpenapi.z.literal("external") })
|
|
@@ -1217,10 +1267,8 @@ var CredentialReferenceSelectSchema = zodOpenapi.z.object({
|
|
|
1217
1267
|
createdAt: zodOpenapi.z.string(),
|
|
1218
1268
|
updatedAt: zodOpenapi.z.string()
|
|
1219
1269
|
});
|
|
1220
|
-
var CredentialReferenceInsertSchema =
|
|
1270
|
+
var CredentialReferenceInsertSchema = drizzleZod.createInsertSchema(credentialReferences).extend({
|
|
1221
1271
|
id: resourceIdSchema,
|
|
1222
|
-
tenantId: zodOpenapi.z.string(),
|
|
1223
|
-
projectId: zodOpenapi.z.string(),
|
|
1224
1272
|
type: zodOpenapi.z.string(),
|
|
1225
1273
|
credentialStoreId: resourceIdSchema,
|
|
1226
1274
|
retrievalParams: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.unknown()).nullish()
|
|
@@ -1316,11 +1364,13 @@ var AgentToolRelationInsertSchema = drizzleZod.createInsertSchema(agentToolRelat
|
|
|
1316
1364
|
selectedTools: zodOpenapi.z.array(zodOpenapi.z.string()).nullish()
|
|
1317
1365
|
});
|
|
1318
1366
|
var AgentToolRelationUpdateSchema = AgentToolRelationInsertSchema.partial();
|
|
1319
|
-
|
|
1320
|
-
|
|
1367
|
+
createGraphScopedApiSchema(
|
|
1368
|
+
AgentToolRelationSelectSchema
|
|
1369
|
+
);
|
|
1370
|
+
createGraphScopedApiInsertSchema(
|
|
1321
1371
|
AgentToolRelationInsertSchema
|
|
1322
1372
|
);
|
|
1323
|
-
|
|
1373
|
+
createGraphScopedApiUpdateSchema(
|
|
1324
1374
|
AgentToolRelationUpdateSchema
|
|
1325
1375
|
);
|
|
1326
1376
|
var LedgerArtifactSelectSchema = drizzleZod.createSelectSchema(ledgerArtifacts);
|
|
@@ -1346,6 +1396,7 @@ var StatusUpdateSchema = zodOpenapi.z.object({
|
|
|
1346
1396
|
statusComponents: zodOpenapi.z.array(StatusComponentSchema).optional()
|
|
1347
1397
|
});
|
|
1348
1398
|
var FullGraphAgentInsertSchema = AgentApiInsertSchema.extend({
|
|
1399
|
+
type: zodOpenapi.z.literal("internal"),
|
|
1349
1400
|
tools: zodOpenapi.z.array(zodOpenapi.z.string()),
|
|
1350
1401
|
selectedTools: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.array(zodOpenapi.z.string())).optional(),
|
|
1351
1402
|
dataComponents: zodOpenapi.z.array(zodOpenapi.z.string()).optional(),
|
|
@@ -1355,10 +1406,9 @@ var FullGraphAgentInsertSchema = AgentApiInsertSchema.extend({
|
|
|
1355
1406
|
});
|
|
1356
1407
|
AgentGraphApiInsertSchema.extend({
|
|
1357
1408
|
agents: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.union([FullGraphAgentInsertSchema, ExternalAgentApiInsertSchema])),
|
|
1358
|
-
|
|
1359
|
-
credentialReferences
|
|
1360
|
-
|
|
1361
|
-
artifactComponents: zodOpenapi.z.record(zodOpenapi.z.string(), ArtifactComponentApiInsertSchema).optional(),
|
|
1409
|
+
// Removed project-scoped resources - these are now managed at project level:
|
|
1410
|
+
// tools, credentialReferences, dataComponents, artifactComponents
|
|
1411
|
+
// Agent relationships to these resources are maintained via agent.tools, agent.dataComponents, etc.
|
|
1362
1412
|
contextConfig: zodOpenapi.z.optional(ContextConfigApiInsertSchema),
|
|
1363
1413
|
statusUpdates: zodOpenapi.z.optional(StatusUpdateSchema),
|
|
1364
1414
|
models: ModelSchema.optional(),
|
|
@@ -1366,7 +1416,13 @@ AgentGraphApiInsertSchema.extend({
|
|
|
1366
1416
|
graphPrompt: zodOpenapi.z.string().max(5e3, "Graph prompt cannot exceed 5000 characters").optional()
|
|
1367
1417
|
});
|
|
1368
1418
|
var GraphWithinContextOfProjectSchema = AgentGraphApiInsertSchema.extend({
|
|
1369
|
-
agents: zodOpenapi.z.record(
|
|
1419
|
+
agents: zodOpenapi.z.record(
|
|
1420
|
+
zodOpenapi.z.string(),
|
|
1421
|
+
zodOpenapi.z.discriminatedUnion("type", [
|
|
1422
|
+
FullGraphAgentInsertSchema,
|
|
1423
|
+
ExternalAgentApiInsertSchema.extend({ type: zodOpenapi.z.literal("external") })
|
|
1424
|
+
])
|
|
1425
|
+
),
|
|
1370
1426
|
models: ModelSchema.optional(),
|
|
1371
1427
|
stopWhen: GraphStopWhenSchema.optional(),
|
|
1372
1428
|
graphPrompt: zodOpenapi.z.string().max(5e3, "Graph prompt cannot exceed 5000 characters").optional()
|
|
@@ -1442,6 +1498,35 @@ zodOpenapi.z.object({
|
|
|
1442
1498
|
example: "project_456"
|
|
1443
1499
|
})
|
|
1444
1500
|
}).openapi("TenantProjectParams");
|
|
1501
|
+
zodOpenapi.z.object({
|
|
1502
|
+
tenantId: zodOpenapi.z.string().openapi({
|
|
1503
|
+
description: "Tenant identifier",
|
|
1504
|
+
example: "tenant_123"
|
|
1505
|
+
}),
|
|
1506
|
+
projectId: zodOpenapi.z.string().openapi({
|
|
1507
|
+
description: "Project identifier",
|
|
1508
|
+
example: "project_456"
|
|
1509
|
+
}),
|
|
1510
|
+
graphId: zodOpenapi.z.string().openapi({
|
|
1511
|
+
description: "Graph identifier",
|
|
1512
|
+
example: "graph_789"
|
|
1513
|
+
})
|
|
1514
|
+
}).openapi("TenantProjectGraphParams");
|
|
1515
|
+
zodOpenapi.z.object({
|
|
1516
|
+
tenantId: zodOpenapi.z.string().openapi({
|
|
1517
|
+
description: "Tenant identifier",
|
|
1518
|
+
example: "tenant_123"
|
|
1519
|
+
}),
|
|
1520
|
+
projectId: zodOpenapi.z.string().openapi({
|
|
1521
|
+
description: "Project identifier",
|
|
1522
|
+
example: "project_456"
|
|
1523
|
+
}),
|
|
1524
|
+
graphId: zodOpenapi.z.string().openapi({
|
|
1525
|
+
description: "Graph identifier",
|
|
1526
|
+
example: "graph_789"
|
|
1527
|
+
}),
|
|
1528
|
+
id: resourceIdSchema
|
|
1529
|
+
}).openapi("TenantProjectGraphIdParams");
|
|
1445
1530
|
zodOpenapi.z.object({
|
|
1446
1531
|
tenantId: zodOpenapi.z.string().openapi({
|
|
1447
1532
|
description: "Tenant identifier",
|
|
@@ -1619,10 +1704,9 @@ var FullGraphDefinitionSchema2 = AgentGraphApiInsertSchema2.extend({
|
|
|
1619
1704
|
})
|
|
1620
1705
|
])
|
|
1621
1706
|
),
|
|
1622
|
-
|
|
1623
|
-
credentialReferences
|
|
1624
|
-
|
|
1625
|
-
artifactComponents: zod.z.record(zod.z.string(), ArtifactComponentApiInsertSchema2).optional(),
|
|
1707
|
+
// Removed project-scoped resources - these are now managed at project level:
|
|
1708
|
+
// tools, credentialReferences, dataComponents, artifactComponents
|
|
1709
|
+
// Agent relationships to these resources are maintained via agent.tools, agent.dataComponents, etc.
|
|
1626
1710
|
contextConfig: zod.z.optional(ContextConfigApiInsertSchema2),
|
|
1627
1711
|
models: zod.z.object({
|
|
1628
1712
|
base: zod.z.object({
|
package/dist/client-exports.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { AgentStopWhenSchema, GraphStopWhenSchema, StopWhenSchema } from './chunk-
|
|
1
|
+
export { AgentStopWhenSchema, GraphStopWhenSchema, StopWhenSchema } from './chunk-LPIKPCE5.js';
|
|
2
2
|
import { CredentialStoreType } from './chunk-SVGQSPW4.js';
|
|
3
3
|
export { CredentialStoreType, MCPTransportType } from './chunk-SVGQSPW4.js';
|
|
4
4
|
import { z } from 'zod';
|
|
@@ -153,10 +153,9 @@ var FullGraphDefinitionSchema = AgentGraphApiInsertSchema.extend({
|
|
|
153
153
|
})
|
|
154
154
|
])
|
|
155
155
|
),
|
|
156
|
-
|
|
157
|
-
credentialReferences
|
|
158
|
-
|
|
159
|
-
artifactComponents: z.record(z.string(), ArtifactComponentApiInsertSchema).optional(),
|
|
156
|
+
// Removed project-scoped resources - these are now managed at project level:
|
|
157
|
+
// tools, credentialReferences, dataComponents, artifactComponents
|
|
158
|
+
// Agent relationships to these resources are maintained via agent.tools, agent.dataComponents, etc.
|
|
160
159
|
contextConfig: z.optional(ContextConfigApiInsertSchema),
|
|
161
160
|
models: z.object({
|
|
162
161
|
base: z.object({
|