@inkeep/agents-core 0.0.0-dev-20251111165914 → 0.0.0-dev-20251111211113
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-FSGS4BXB.js → chunk-FUJJ4OQ2.js} +1 -1
- package/dist/chunk-SVXWB2HF.js +592 -0
- package/dist/{chunk-T5TTDZ6L.js → chunk-VSQY72K5.js} +133 -133
- package/dist/{chunk-OFKWNZQL.js → chunk-X6ZMJ3G6.js} +1 -1
- package/dist/client-exports.cjs +211 -211
- package/dist/client-exports.d.cts +3 -3
- package/dist/client-exports.d.ts +3 -3
- package/dist/client-exports.js +2 -2
- package/dist/db/schema.cjs +211 -211
- package/dist/db/schema.d.cts +3 -3
- package/dist/db/schema.d.ts +3 -3
- package/dist/db/schema.js +1 -1
- package/dist/index.cjs +18286 -12238
- package/dist/index.d.cts +109 -104
- package/dist/index.d.ts +109 -104
- package/dist/index.js +16076 -10990
- package/dist/nodefs-X2JO4ZHZ.js +21 -0
- package/dist/opfs-ahp-2UFDGV73.js +318 -0
- package/dist/{schema-lPPu5F4P.d.ts → schema-CuEjPQt7.d.ts} +876 -1014
- package/dist/{schema-WwzWCq2K.d.cts → schema-D1P8r3qm.d.cts} +876 -1014
- package/dist/types/index.d.cts +3 -3
- package/dist/types/index.d.ts +3 -3
- package/dist/{utility-DJc47Ab9.d.cts → utility-DF5IUC9K.d.cts} +962 -1126
- package/dist/{utility-DJc47Ab9.d.ts → utility-DF5IUC9K.d.ts} +962 -1126
- package/dist/validation/index.cjs +211 -211
- package/dist/validation/index.d.cts +3 -3
- package/dist/validation/index.d.ts +3 -3
- package/dist/validation/index.js +2 -2
- package/drizzle/0000_exotic_mysterio.sql +398 -0
- package/drizzle/meta/0000_snapshot.json +1683 -1223
- package/drizzle/meta/_journal.json +4 -102
- package/package.json +6 -3
- package/drizzle/0000_material_menace.sql +0 -326
- package/drizzle/0001_eminent_fixer.sql +0 -43
- package/drizzle/0002_bumpy_romulus.sql +0 -3
- package/drizzle/0003_soft_forgotten_one.sql +0 -39
- package/drizzle/0004_melted_omega_flight.sql +0 -3
- package/drizzle/0005_wide_shriek.sql +0 -127
- package/drizzle/0006_damp_lenny_balinger.sql +0 -52
- package/drizzle/0007_mighty_typhoid_mary.sql +0 -227
- package/drizzle/0008_mysterious_crusher_hogan.sql +0 -20
- package/drizzle/0009_old_black_cat.sql +0 -1
- package/drizzle/0010_wet_vampiro.sql +0 -2
- package/drizzle/0011_slippery_korg.sql +0 -36
- package/drizzle/0012_salty_psynapse.sql +0 -17
- package/drizzle/0013_shocking_blur.sql +0 -19
- package/drizzle/0014_broad_hellfire_club.sql +0 -29
- package/drizzle/meta/0001_snapshot.json +0 -2435
- package/drizzle/meta/0002_snapshot.json +0 -2428
- package/drizzle/meta/0003_snapshot.json +0 -2559
- package/drizzle/meta/0004_snapshot.json +0 -2547
- package/drizzle/meta/0005_snapshot.json +0 -2558
- package/drizzle/meta/0006_snapshot.json +0 -2751
- package/drizzle/meta/0007_snapshot.json +0 -2766
- package/drizzle/meta/0008_snapshot.json +0 -2753
- package/drizzle/meta/0009_snapshot.json +0 -2744
- package/drizzle/meta/0010_snapshot.json +0 -2751
- package/drizzle/meta/0011_snapshot.json +0 -2849
- package/drizzle/meta/0012_snapshot.json +0 -2985
- package/drizzle/meta/0013_snapshot.json +0 -2988
- package/drizzle/meta/0014_snapshot.json +0 -2992
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var zodOpenapi = require('@hono/zod-openapi');
|
|
4
4
|
var drizzleZod = require('drizzle-zod');
|
|
5
5
|
var drizzleOrm = require('drizzle-orm');
|
|
6
|
-
var
|
|
6
|
+
var pgCore = require('drizzle-orm/pg-core');
|
|
7
7
|
var zod = require('zod');
|
|
8
8
|
var Ajv = require('ajv');
|
|
9
9
|
|
|
@@ -88,165 +88,165 @@ var schemaValidationDefaults = {
|
|
|
88
88
|
// 10 seconds
|
|
89
89
|
};
|
|
90
90
|
var tenantScoped = {
|
|
91
|
-
tenantId:
|
|
92
|
-
id:
|
|
91
|
+
tenantId: pgCore.varchar("tenant_id", { length: 256 }).notNull(),
|
|
92
|
+
id: pgCore.varchar("id", { length: 256 }).notNull()
|
|
93
93
|
};
|
|
94
94
|
var projectScoped = {
|
|
95
95
|
...tenantScoped,
|
|
96
|
-
projectId:
|
|
96
|
+
projectId: pgCore.varchar("project_id", { length: 256 }).notNull()
|
|
97
97
|
};
|
|
98
98
|
var agentScoped = {
|
|
99
99
|
...projectScoped,
|
|
100
|
-
agentId:
|
|
100
|
+
agentId: pgCore.varchar("agent_id", { length: 256 }).notNull()
|
|
101
101
|
};
|
|
102
102
|
var subAgentScoped = {
|
|
103
103
|
...agentScoped,
|
|
104
|
-
subAgentId:
|
|
104
|
+
subAgentId: pgCore.varchar("sub_agent_id", { length: 256 }).notNull()
|
|
105
105
|
};
|
|
106
106
|
var uiProperties = {
|
|
107
|
-
name:
|
|
108
|
-
description:
|
|
107
|
+
name: pgCore.varchar("name", { length: 256 }).notNull(),
|
|
108
|
+
description: pgCore.text("description").notNull()
|
|
109
109
|
};
|
|
110
110
|
var timestamps = {
|
|
111
|
-
createdAt:
|
|
112
|
-
updatedAt:
|
|
111
|
+
createdAt: pgCore.timestamp("created_at", { mode: "string" }).notNull().defaultNow(),
|
|
112
|
+
updatedAt: pgCore.timestamp("updated_at", { mode: "string" }).notNull().defaultNow()
|
|
113
113
|
};
|
|
114
|
-
var projects =
|
|
114
|
+
var projects = pgCore.pgTable(
|
|
115
115
|
"projects",
|
|
116
116
|
{
|
|
117
117
|
...tenantScoped,
|
|
118
118
|
...uiProperties,
|
|
119
|
-
models:
|
|
120
|
-
stopWhen:
|
|
119
|
+
models: pgCore.jsonb("models").$type(),
|
|
120
|
+
stopWhen: pgCore.jsonb("stop_when").$type(),
|
|
121
121
|
...timestamps
|
|
122
122
|
},
|
|
123
|
-
(table) => [
|
|
123
|
+
(table) => [pgCore.primaryKey({ columns: [table.tenantId, table.id] })]
|
|
124
124
|
);
|
|
125
|
-
var agents =
|
|
125
|
+
var agents = pgCore.pgTable(
|
|
126
126
|
"agent",
|
|
127
127
|
{
|
|
128
128
|
...projectScoped,
|
|
129
|
-
name:
|
|
130
|
-
description:
|
|
131
|
-
defaultSubAgentId:
|
|
132
|
-
contextConfigId:
|
|
133
|
-
models:
|
|
134
|
-
statusUpdates:
|
|
135
|
-
prompt:
|
|
136
|
-
stopWhen:
|
|
129
|
+
name: pgCore.varchar("name", { length: 256 }).notNull(),
|
|
130
|
+
description: pgCore.text("description"),
|
|
131
|
+
defaultSubAgentId: pgCore.varchar("default_sub_agent_id", { length: 256 }),
|
|
132
|
+
contextConfigId: pgCore.varchar("context_config_id", { length: 256 }),
|
|
133
|
+
models: pgCore.jsonb("models").$type(),
|
|
134
|
+
statusUpdates: pgCore.jsonb("status_updates").$type(),
|
|
135
|
+
prompt: pgCore.text("prompt"),
|
|
136
|
+
stopWhen: pgCore.jsonb("stop_when").$type(),
|
|
137
137
|
...timestamps
|
|
138
138
|
},
|
|
139
139
|
(table) => [
|
|
140
|
-
|
|
141
|
-
|
|
140
|
+
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
141
|
+
pgCore.foreignKey({
|
|
142
142
|
columns: [table.tenantId, table.projectId],
|
|
143
143
|
foreignColumns: [projects.tenantId, projects.id],
|
|
144
144
|
name: "agent_project_fk"
|
|
145
145
|
}).onDelete("cascade")
|
|
146
146
|
]
|
|
147
147
|
);
|
|
148
|
-
var contextConfigs =
|
|
148
|
+
var contextConfigs = pgCore.pgTable(
|
|
149
149
|
"context_configs",
|
|
150
150
|
{
|
|
151
151
|
...agentScoped,
|
|
152
|
-
headersSchema:
|
|
153
|
-
contextVariables:
|
|
152
|
+
headersSchema: pgCore.jsonb("headers_schema").$type(),
|
|
153
|
+
contextVariables: pgCore.jsonb("context_variables").$type(),
|
|
154
154
|
...timestamps
|
|
155
155
|
},
|
|
156
156
|
(table) => [
|
|
157
|
-
|
|
158
|
-
|
|
157
|
+
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.agentId, table.id] }),
|
|
158
|
+
pgCore.foreignKey({
|
|
159
159
|
columns: [table.tenantId, table.projectId, table.agentId],
|
|
160
160
|
foreignColumns: [agents.tenantId, agents.projectId, agents.id],
|
|
161
161
|
name: "context_configs_agent_fk"
|
|
162
162
|
}).onDelete("cascade")
|
|
163
163
|
]
|
|
164
164
|
);
|
|
165
|
-
var contextCache =
|
|
165
|
+
var contextCache = pgCore.pgTable(
|
|
166
166
|
"context_cache",
|
|
167
167
|
{
|
|
168
168
|
...projectScoped,
|
|
169
|
-
conversationId:
|
|
170
|
-
contextConfigId:
|
|
171
|
-
contextVariableKey:
|
|
172
|
-
value:
|
|
173
|
-
requestHash:
|
|
174
|
-
fetchedAt:
|
|
175
|
-
fetchSource:
|
|
176
|
-
fetchDurationMs:
|
|
169
|
+
conversationId: pgCore.varchar("conversation_id", { length: 256 }).notNull(),
|
|
170
|
+
contextConfigId: pgCore.varchar("context_config_id", { length: 256 }).notNull(),
|
|
171
|
+
contextVariableKey: pgCore.varchar("context_variable_key", { length: 256 }).notNull(),
|
|
172
|
+
value: pgCore.jsonb("value").$type().notNull(),
|
|
173
|
+
requestHash: pgCore.varchar("request_hash", { length: 256 }),
|
|
174
|
+
fetchedAt: pgCore.timestamp("fetched_at", { mode: "string" }).notNull().defaultNow(),
|
|
175
|
+
fetchSource: pgCore.varchar("fetch_source", { length: 256 }),
|
|
176
|
+
fetchDurationMs: pgCore.integer("fetch_duration_ms"),
|
|
177
177
|
...timestamps
|
|
178
178
|
},
|
|
179
179
|
(table) => [
|
|
180
|
-
|
|
181
|
-
|
|
180
|
+
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
181
|
+
pgCore.foreignKey({
|
|
182
182
|
columns: [table.tenantId, table.projectId],
|
|
183
183
|
foreignColumns: [projects.tenantId, projects.id],
|
|
184
184
|
name: "context_cache_project_fk"
|
|
185
185
|
}).onDelete("cascade"),
|
|
186
|
-
|
|
186
|
+
pgCore.index("context_cache_lookup_idx").on(
|
|
187
187
|
table.conversationId,
|
|
188
188
|
table.contextConfigId,
|
|
189
189
|
table.contextVariableKey
|
|
190
190
|
)
|
|
191
191
|
]
|
|
192
192
|
);
|
|
193
|
-
var subAgents =
|
|
193
|
+
var subAgents = pgCore.pgTable(
|
|
194
194
|
"sub_agents",
|
|
195
195
|
{
|
|
196
196
|
...agentScoped,
|
|
197
197
|
...uiProperties,
|
|
198
|
-
prompt:
|
|
199
|
-
conversationHistoryConfig:
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
models:
|
|
203
|
-
stopWhen:
|
|
198
|
+
prompt: pgCore.text("prompt").notNull(),
|
|
199
|
+
conversationHistoryConfig: pgCore.jsonb(
|
|
200
|
+
"conversation_history_config"
|
|
201
|
+
).$type(),
|
|
202
|
+
models: pgCore.jsonb("models").$type(),
|
|
203
|
+
stopWhen: pgCore.jsonb("stop_when").$type(),
|
|
204
204
|
...timestamps
|
|
205
205
|
},
|
|
206
206
|
(table) => [
|
|
207
|
-
|
|
208
|
-
|
|
207
|
+
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.agentId, table.id] }),
|
|
208
|
+
pgCore.foreignKey({
|
|
209
209
|
columns: [table.tenantId, table.projectId, table.agentId],
|
|
210
210
|
foreignColumns: [agents.tenantId, agents.projectId, agents.id],
|
|
211
211
|
name: "sub_agents_agents_fk"
|
|
212
212
|
}).onDelete("cascade")
|
|
213
213
|
]
|
|
214
214
|
);
|
|
215
|
-
var subAgentRelations =
|
|
215
|
+
var subAgentRelations = pgCore.pgTable(
|
|
216
216
|
"sub_agent_relations",
|
|
217
217
|
{
|
|
218
218
|
...agentScoped,
|
|
219
|
-
sourceSubAgentId:
|
|
220
|
-
targetSubAgentId:
|
|
221
|
-
relationType:
|
|
219
|
+
sourceSubAgentId: pgCore.varchar("source_sub_agent_id", { length: 256 }).notNull(),
|
|
220
|
+
targetSubAgentId: pgCore.varchar("target_sub_agent_id", { length: 256 }),
|
|
221
|
+
relationType: pgCore.varchar("relation_type", { length: 256 }),
|
|
222
222
|
...timestamps
|
|
223
223
|
},
|
|
224
224
|
(table) => [
|
|
225
|
-
|
|
226
|
-
|
|
225
|
+
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.agentId, table.id] }),
|
|
226
|
+
pgCore.foreignKey({
|
|
227
227
|
columns: [table.tenantId, table.projectId, table.agentId],
|
|
228
228
|
foreignColumns: [agents.tenantId, agents.projectId, agents.id],
|
|
229
229
|
name: "sub_agent_relations_agent_fk"
|
|
230
230
|
}).onDelete("cascade")
|
|
231
231
|
]
|
|
232
232
|
);
|
|
233
|
-
var externalAgents =
|
|
233
|
+
var externalAgents = pgCore.pgTable(
|
|
234
234
|
"external_agents",
|
|
235
235
|
{
|
|
236
236
|
...projectScoped,
|
|
237
237
|
...uiProperties,
|
|
238
|
-
baseUrl:
|
|
239
|
-
credentialReferenceId:
|
|
238
|
+
baseUrl: pgCore.text("base_url").notNull(),
|
|
239
|
+
credentialReferenceId: pgCore.varchar("credential_reference_id", { length: 256 }),
|
|
240
240
|
...timestamps
|
|
241
241
|
},
|
|
242
242
|
(table) => [
|
|
243
|
-
|
|
244
|
-
|
|
243
|
+
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
244
|
+
pgCore.foreignKey({
|
|
245
245
|
columns: [table.tenantId, table.projectId],
|
|
246
246
|
foreignColumns: [projects.tenantId, projects.id],
|
|
247
247
|
name: "external_agents_project_fk"
|
|
248
248
|
}).onDelete("cascade"),
|
|
249
|
-
|
|
249
|
+
pgCore.foreignKey({
|
|
250
250
|
columns: [table.tenantId, table.projectId, table.credentialReferenceId],
|
|
251
251
|
foreignColumns: [
|
|
252
252
|
credentialReferences.tenantId,
|
|
@@ -254,118 +254,118 @@ var externalAgents = sqliteCore.sqliteTable(
|
|
|
254
254
|
credentialReferences.id
|
|
255
255
|
],
|
|
256
256
|
name: "external_agents_credential_reference_fk"
|
|
257
|
-
}).onDelete("
|
|
257
|
+
}).onDelete("cascade")
|
|
258
258
|
]
|
|
259
259
|
);
|
|
260
|
-
var tasks =
|
|
260
|
+
var tasks = pgCore.pgTable(
|
|
261
261
|
"tasks",
|
|
262
262
|
{
|
|
263
263
|
...subAgentScoped,
|
|
264
|
-
contextId:
|
|
265
|
-
status:
|
|
266
|
-
metadata:
|
|
264
|
+
contextId: pgCore.varchar("context_id", { length: 256 }).notNull(),
|
|
265
|
+
status: pgCore.varchar("status", { length: 256 }).notNull(),
|
|
266
|
+
metadata: pgCore.jsonb("metadata").$type(),
|
|
267
267
|
...timestamps
|
|
268
268
|
},
|
|
269
269
|
(table) => [
|
|
270
|
-
|
|
271
|
-
|
|
270
|
+
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
271
|
+
pgCore.foreignKey({
|
|
272
272
|
columns: [table.tenantId, table.projectId, table.agentId, table.subAgentId],
|
|
273
273
|
foreignColumns: [subAgents.tenantId, subAgents.projectId, subAgents.agentId, subAgents.id],
|
|
274
274
|
name: "tasks_sub_agent_fk"
|
|
275
275
|
}).onDelete("cascade")
|
|
276
276
|
]
|
|
277
277
|
);
|
|
278
|
-
var taskRelations =
|
|
278
|
+
var taskRelations = pgCore.pgTable(
|
|
279
279
|
"task_relations",
|
|
280
280
|
{
|
|
281
281
|
...projectScoped,
|
|
282
|
-
parentTaskId:
|
|
283
|
-
childTaskId:
|
|
284
|
-
relationType:
|
|
282
|
+
parentTaskId: pgCore.varchar("parent_task_id", { length: 256 }).notNull(),
|
|
283
|
+
childTaskId: pgCore.varchar("child_task_id", { length: 256 }).notNull(),
|
|
284
|
+
relationType: pgCore.varchar("relation_type", { length: 256 }).default("parent_child"),
|
|
285
285
|
...timestamps
|
|
286
286
|
},
|
|
287
287
|
(table) => [
|
|
288
|
-
|
|
289
|
-
|
|
288
|
+
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
289
|
+
pgCore.foreignKey({
|
|
290
290
|
columns: [table.tenantId, table.projectId],
|
|
291
291
|
foreignColumns: [projects.tenantId, projects.id],
|
|
292
292
|
name: "task_relations_project_fk"
|
|
293
293
|
}).onDelete("cascade")
|
|
294
294
|
]
|
|
295
295
|
);
|
|
296
|
-
var dataComponents =
|
|
296
|
+
var dataComponents = pgCore.pgTable(
|
|
297
297
|
"data_components",
|
|
298
298
|
{
|
|
299
299
|
...projectScoped,
|
|
300
300
|
...uiProperties,
|
|
301
|
-
props:
|
|
302
|
-
render:
|
|
301
|
+
props: pgCore.jsonb("props").$type(),
|
|
302
|
+
render: pgCore.jsonb("render").$type(),
|
|
303
303
|
...timestamps
|
|
304
304
|
},
|
|
305
305
|
(table) => [
|
|
306
|
-
|
|
307
|
-
|
|
306
|
+
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
307
|
+
pgCore.foreignKey({
|
|
308
308
|
columns: [table.tenantId, table.projectId],
|
|
309
309
|
foreignColumns: [projects.tenantId, projects.id],
|
|
310
310
|
name: "data_components_project_fk"
|
|
311
311
|
}).onDelete("cascade")
|
|
312
312
|
]
|
|
313
313
|
);
|
|
314
|
-
var subAgentDataComponents =
|
|
314
|
+
var subAgentDataComponents = pgCore.pgTable(
|
|
315
315
|
"sub_agent_data_components",
|
|
316
316
|
{
|
|
317
317
|
...subAgentScoped,
|
|
318
|
-
dataComponentId:
|
|
319
|
-
createdAt:
|
|
318
|
+
dataComponentId: pgCore.varchar("data_component_id", { length: 256 }).notNull(),
|
|
319
|
+
createdAt: pgCore.timestamp("created_at", { mode: "string" }).notNull().defaultNow()
|
|
320
320
|
},
|
|
321
321
|
(table) => [
|
|
322
|
-
|
|
323
|
-
|
|
322
|
+
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
323
|
+
pgCore.foreignKey({
|
|
324
324
|
columns: [table.tenantId, table.projectId, table.agentId, table.subAgentId],
|
|
325
325
|
foreignColumns: [subAgents.tenantId, subAgents.projectId, subAgents.agentId, subAgents.id],
|
|
326
326
|
name: "sub_agent_data_components_sub_agent_fk"
|
|
327
327
|
}).onDelete("cascade"),
|
|
328
|
-
|
|
328
|
+
pgCore.foreignKey({
|
|
329
329
|
columns: [table.tenantId, table.projectId, table.dataComponentId],
|
|
330
330
|
foreignColumns: [dataComponents.tenantId, dataComponents.projectId, dataComponents.id],
|
|
331
331
|
name: "sub_agent_data_components_data_component_fk"
|
|
332
332
|
}).onDelete("cascade")
|
|
333
333
|
]
|
|
334
334
|
);
|
|
335
|
-
var artifactComponents =
|
|
335
|
+
var artifactComponents = pgCore.pgTable(
|
|
336
336
|
"artifact_components",
|
|
337
337
|
{
|
|
338
338
|
...projectScoped,
|
|
339
339
|
...uiProperties,
|
|
340
|
-
props:
|
|
340
|
+
props: pgCore.jsonb("props").$type(),
|
|
341
341
|
...timestamps
|
|
342
342
|
},
|
|
343
343
|
(table) => [
|
|
344
|
-
|
|
345
|
-
|
|
344
|
+
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
345
|
+
pgCore.foreignKey({
|
|
346
346
|
columns: [table.tenantId, table.projectId],
|
|
347
347
|
foreignColumns: [projects.tenantId, projects.id],
|
|
348
348
|
name: "artifact_components_project_fk"
|
|
349
349
|
}).onDelete("cascade")
|
|
350
350
|
]
|
|
351
351
|
);
|
|
352
|
-
var subAgentArtifactComponents =
|
|
352
|
+
var subAgentArtifactComponents = pgCore.pgTable(
|
|
353
353
|
"sub_agent_artifact_components",
|
|
354
354
|
{
|
|
355
355
|
...subAgentScoped,
|
|
356
|
-
artifactComponentId:
|
|
357
|
-
createdAt:
|
|
356
|
+
artifactComponentId: pgCore.varchar("artifact_component_id", { length: 256 }).notNull(),
|
|
357
|
+
createdAt: pgCore.timestamp("created_at", { mode: "string" }).notNull().defaultNow()
|
|
358
358
|
},
|
|
359
359
|
(table) => [
|
|
360
|
-
|
|
360
|
+
pgCore.primaryKey({
|
|
361
361
|
columns: [table.tenantId, table.projectId, table.agentId, table.subAgentId, table.id]
|
|
362
362
|
}),
|
|
363
|
-
|
|
363
|
+
pgCore.foreignKey({
|
|
364
364
|
columns: [table.tenantId, table.projectId, table.agentId, table.subAgentId],
|
|
365
365
|
foreignColumns: [subAgents.tenantId, subAgents.projectId, subAgents.agentId, subAgents.id],
|
|
366
366
|
name: "sub_agent_artifact_components_sub_agent_fk"
|
|
367
367
|
}).onDelete("cascade"),
|
|
368
|
-
|
|
368
|
+
pgCore.foreignKey({
|
|
369
369
|
columns: [table.tenantId, table.projectId, table.artifactComponentId],
|
|
370
370
|
foreignColumns: [
|
|
371
371
|
artifactComponents.tenantId,
|
|
@@ -376,152 +376,152 @@ var subAgentArtifactComponents = sqliteCore.sqliteTable(
|
|
|
376
376
|
}).onDelete("cascade")
|
|
377
377
|
]
|
|
378
378
|
);
|
|
379
|
-
var tools =
|
|
379
|
+
var tools = pgCore.pgTable(
|
|
380
380
|
"tools",
|
|
381
381
|
{
|
|
382
382
|
...projectScoped,
|
|
383
|
-
name:
|
|
384
|
-
description:
|
|
385
|
-
config:
|
|
386
|
-
credentialReferenceId:
|
|
387
|
-
headers:
|
|
388
|
-
imageUrl:
|
|
389
|
-
capabilities:
|
|
390
|
-
lastError:
|
|
383
|
+
name: pgCore.varchar("name", { length: 256 }).notNull(),
|
|
384
|
+
description: pgCore.text("description"),
|
|
385
|
+
config: pgCore.jsonb("config").$type().notNull(),
|
|
386
|
+
credentialReferenceId: pgCore.varchar("credential_reference_id", { length: 256 }),
|
|
387
|
+
headers: pgCore.jsonb("headers").$type(),
|
|
388
|
+
imageUrl: pgCore.text("image_url"),
|
|
389
|
+
capabilities: pgCore.jsonb("capabilities").$type(),
|
|
390
|
+
lastError: pgCore.text("last_error"),
|
|
391
391
|
...timestamps
|
|
392
392
|
},
|
|
393
393
|
(table) => [
|
|
394
|
-
|
|
395
|
-
|
|
394
|
+
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
395
|
+
pgCore.foreignKey({
|
|
396
396
|
columns: [table.tenantId, table.projectId],
|
|
397
397
|
foreignColumns: [projects.tenantId, projects.id],
|
|
398
398
|
name: "tools_project_fk"
|
|
399
399
|
}).onDelete("cascade")
|
|
400
400
|
]
|
|
401
401
|
);
|
|
402
|
-
var functionTools =
|
|
402
|
+
var functionTools = pgCore.pgTable(
|
|
403
403
|
"function_tools",
|
|
404
404
|
{
|
|
405
405
|
...agentScoped,
|
|
406
|
-
name:
|
|
407
|
-
description:
|
|
408
|
-
functionId:
|
|
406
|
+
name: pgCore.varchar("name", { length: 256 }).notNull(),
|
|
407
|
+
description: pgCore.text("description"),
|
|
408
|
+
functionId: pgCore.varchar("function_id", { length: 256 }).notNull(),
|
|
409
409
|
...timestamps
|
|
410
410
|
},
|
|
411
411
|
(table) => [
|
|
412
|
-
|
|
413
|
-
|
|
412
|
+
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.agentId, table.id] }),
|
|
413
|
+
pgCore.foreignKey({
|
|
414
414
|
columns: [table.tenantId, table.projectId, table.agentId],
|
|
415
415
|
foreignColumns: [agents.tenantId, agents.projectId, agents.id],
|
|
416
416
|
name: "function_tools_agent_fk"
|
|
417
417
|
}).onDelete("cascade"),
|
|
418
|
-
|
|
418
|
+
pgCore.foreignKey({
|
|
419
419
|
columns: [table.tenantId, table.projectId, table.functionId],
|
|
420
420
|
foreignColumns: [functions.tenantId, functions.projectId, functions.id],
|
|
421
421
|
name: "function_tools_function_fk"
|
|
422
422
|
}).onDelete("cascade")
|
|
423
423
|
]
|
|
424
424
|
);
|
|
425
|
-
var functions =
|
|
425
|
+
var functions = pgCore.pgTable(
|
|
426
426
|
"functions",
|
|
427
427
|
{
|
|
428
428
|
...projectScoped,
|
|
429
|
-
inputSchema:
|
|
430
|
-
executeCode:
|
|
431
|
-
dependencies:
|
|
429
|
+
inputSchema: pgCore.jsonb("input_schema").$type(),
|
|
430
|
+
executeCode: pgCore.text("execute_code").notNull(),
|
|
431
|
+
dependencies: pgCore.jsonb("dependencies").$type(),
|
|
432
432
|
...timestamps
|
|
433
433
|
},
|
|
434
434
|
(table) => [
|
|
435
|
-
|
|
436
|
-
|
|
435
|
+
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
436
|
+
pgCore.foreignKey({
|
|
437
437
|
columns: [table.tenantId, table.projectId],
|
|
438
438
|
foreignColumns: [projects.tenantId, projects.id],
|
|
439
439
|
name: "functions_project_fk"
|
|
440
440
|
}).onDelete("cascade")
|
|
441
441
|
]
|
|
442
442
|
);
|
|
443
|
-
var subAgentToolRelations =
|
|
443
|
+
var subAgentToolRelations = pgCore.pgTable(
|
|
444
444
|
"sub_agent_tool_relations",
|
|
445
445
|
{
|
|
446
446
|
...subAgentScoped,
|
|
447
|
-
toolId:
|
|
448
|
-
selectedTools:
|
|
449
|
-
headers:
|
|
447
|
+
toolId: pgCore.varchar("tool_id", { length: 256 }).notNull(),
|
|
448
|
+
selectedTools: pgCore.jsonb("selected_tools").$type(),
|
|
449
|
+
headers: pgCore.jsonb("headers").$type(),
|
|
450
450
|
...timestamps
|
|
451
451
|
},
|
|
452
452
|
(table) => [
|
|
453
|
-
|
|
454
|
-
|
|
453
|
+
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.agentId, table.id] }),
|
|
454
|
+
pgCore.foreignKey({
|
|
455
455
|
columns: [table.tenantId, table.projectId, table.agentId, table.subAgentId],
|
|
456
456
|
foreignColumns: [subAgents.tenantId, subAgents.projectId, subAgents.agentId, subAgents.id],
|
|
457
457
|
name: "sub_agent_tool_relations_agent_fk"
|
|
458
458
|
}).onDelete("cascade"),
|
|
459
|
-
|
|
459
|
+
pgCore.foreignKey({
|
|
460
460
|
columns: [table.tenantId, table.projectId, table.toolId],
|
|
461
461
|
foreignColumns: [tools.tenantId, tools.projectId, tools.id],
|
|
462
462
|
name: "sub_agent_tool_relations_tool_fk"
|
|
463
463
|
}).onDelete("cascade")
|
|
464
464
|
]
|
|
465
465
|
);
|
|
466
|
-
var subAgentExternalAgentRelations =
|
|
466
|
+
var subAgentExternalAgentRelations = pgCore.pgTable(
|
|
467
467
|
"sub_agent_external_agent_relations",
|
|
468
468
|
{
|
|
469
469
|
...subAgentScoped,
|
|
470
|
-
externalAgentId:
|
|
471
|
-
headers:
|
|
470
|
+
externalAgentId: pgCore.varchar("external_agent_id", { length: 256 }).notNull(),
|
|
471
|
+
headers: pgCore.jsonb("headers").$type(),
|
|
472
472
|
...timestamps
|
|
473
473
|
},
|
|
474
474
|
(table) => [
|
|
475
|
-
|
|
476
|
-
|
|
475
|
+
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.agentId, table.id] }),
|
|
476
|
+
pgCore.foreignKey({
|
|
477
477
|
columns: [table.tenantId, table.projectId, table.agentId, table.subAgentId],
|
|
478
478
|
foreignColumns: [subAgents.tenantId, subAgents.projectId, subAgents.agentId, subAgents.id],
|
|
479
479
|
name: "sub_agent_external_agent_relations_sub_agent_fk"
|
|
480
480
|
}).onDelete("cascade"),
|
|
481
|
-
|
|
481
|
+
pgCore.foreignKey({
|
|
482
482
|
columns: [table.tenantId, table.projectId, table.externalAgentId],
|
|
483
483
|
foreignColumns: [externalAgents.tenantId, externalAgents.projectId, externalAgents.id],
|
|
484
484
|
name: "sub_agent_external_agent_relations_external_agent_fk"
|
|
485
485
|
}).onDelete("cascade")
|
|
486
486
|
]
|
|
487
487
|
);
|
|
488
|
-
var subAgentTeamAgentRelations =
|
|
488
|
+
var subAgentTeamAgentRelations = pgCore.pgTable(
|
|
489
489
|
"sub_agent_team_agent_relations",
|
|
490
490
|
{
|
|
491
491
|
...subAgentScoped,
|
|
492
|
-
targetAgentId:
|
|
493
|
-
headers:
|
|
492
|
+
targetAgentId: pgCore.varchar("target_agent_id", { length: 256 }).notNull(),
|
|
493
|
+
headers: pgCore.jsonb("headers").$type(),
|
|
494
494
|
...timestamps
|
|
495
495
|
},
|
|
496
496
|
(table) => [
|
|
497
|
-
|
|
498
|
-
|
|
497
|
+
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.agentId, table.id] }),
|
|
498
|
+
pgCore.foreignKey({
|
|
499
499
|
columns: [table.tenantId, table.projectId, table.agentId, table.subAgentId],
|
|
500
500
|
foreignColumns: [subAgents.tenantId, subAgents.projectId, subAgents.agentId, subAgents.id],
|
|
501
501
|
name: "sub_agent_team_agent_relations_sub_agent_fk"
|
|
502
502
|
}).onDelete("cascade"),
|
|
503
|
-
|
|
503
|
+
pgCore.foreignKey({
|
|
504
504
|
columns: [table.tenantId, table.projectId, table.targetAgentId],
|
|
505
505
|
foreignColumns: [agents.tenantId, agents.projectId, agents.id],
|
|
506
506
|
name: "sub_agent_team_agent_relations_target_agent_fk"
|
|
507
507
|
}).onDelete("cascade")
|
|
508
508
|
]
|
|
509
509
|
);
|
|
510
|
-
var subAgentFunctionToolRelations =
|
|
510
|
+
var subAgentFunctionToolRelations = pgCore.pgTable(
|
|
511
511
|
"sub_agent_function_tool_relations",
|
|
512
512
|
{
|
|
513
513
|
...subAgentScoped,
|
|
514
|
-
functionToolId:
|
|
514
|
+
functionToolId: pgCore.varchar("function_tool_id", { length: 256 }).notNull(),
|
|
515
515
|
...timestamps
|
|
516
516
|
},
|
|
517
517
|
(table) => [
|
|
518
|
-
|
|
519
|
-
|
|
518
|
+
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.agentId, table.id] }),
|
|
519
|
+
pgCore.foreignKey({
|
|
520
520
|
columns: [table.tenantId, table.projectId, table.agentId, table.subAgentId],
|
|
521
521
|
foreignColumns: [subAgents.tenantId, subAgents.projectId, subAgents.agentId, subAgents.id],
|
|
522
522
|
name: "sub_agent_function_tool_relations_sub_agent_fk"
|
|
523
523
|
}).onDelete("cascade"),
|
|
524
|
-
|
|
524
|
+
pgCore.foreignKey({
|
|
525
525
|
columns: [table.tenantId, table.projectId, table.agentId, table.functionToolId],
|
|
526
526
|
foreignColumns: [
|
|
527
527
|
functionTools.tenantId,
|
|
@@ -533,134 +533,134 @@ var subAgentFunctionToolRelations = sqliteCore.sqliteTable(
|
|
|
533
533
|
}).onDelete("cascade")
|
|
534
534
|
]
|
|
535
535
|
);
|
|
536
|
-
var conversations =
|
|
536
|
+
var conversations = pgCore.pgTable(
|
|
537
537
|
"conversations",
|
|
538
538
|
{
|
|
539
539
|
...projectScoped,
|
|
540
|
-
userId:
|
|
541
|
-
activeSubAgentId:
|
|
542
|
-
title:
|
|
543
|
-
lastContextResolution:
|
|
544
|
-
metadata:
|
|
540
|
+
userId: pgCore.varchar("user_id", { length: 256 }),
|
|
541
|
+
activeSubAgentId: pgCore.varchar("active_sub_agent_id", { length: 256 }).notNull(),
|
|
542
|
+
title: pgCore.text("title"),
|
|
543
|
+
lastContextResolution: pgCore.timestamp("last_context_resolution", { mode: "string" }),
|
|
544
|
+
metadata: pgCore.jsonb("metadata").$type(),
|
|
545
545
|
...timestamps
|
|
546
546
|
},
|
|
547
547
|
(table) => [
|
|
548
|
-
|
|
549
|
-
|
|
548
|
+
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
549
|
+
pgCore.foreignKey({
|
|
550
550
|
columns: [table.tenantId, table.projectId],
|
|
551
551
|
foreignColumns: [projects.tenantId, projects.id],
|
|
552
552
|
name: "conversations_project_fk"
|
|
553
553
|
}).onDelete("cascade")
|
|
554
554
|
]
|
|
555
555
|
);
|
|
556
|
-
var messages =
|
|
556
|
+
var messages = pgCore.pgTable(
|
|
557
557
|
"messages",
|
|
558
558
|
{
|
|
559
559
|
...projectScoped,
|
|
560
|
-
conversationId:
|
|
561
|
-
role:
|
|
562
|
-
fromSubAgentId:
|
|
563
|
-
toSubAgentId:
|
|
564
|
-
fromExternalAgentId:
|
|
565
|
-
toExternalAgentId:
|
|
566
|
-
fromTeamAgentId:
|
|
567
|
-
toTeamAgentId:
|
|
568
|
-
content:
|
|
569
|
-
visibility:
|
|
570
|
-
messageType:
|
|
571
|
-
taskId:
|
|
572
|
-
parentMessageId:
|
|
573
|
-
a2aTaskId:
|
|
574
|
-
a2aSessionId:
|
|
575
|
-
metadata:
|
|
560
|
+
conversationId: pgCore.varchar("conversation_id", { length: 256 }).notNull(),
|
|
561
|
+
role: pgCore.varchar("role", { length: 256 }).notNull(),
|
|
562
|
+
fromSubAgentId: pgCore.varchar("from_sub_agent_id", { length: 256 }),
|
|
563
|
+
toSubAgentId: pgCore.varchar("to_sub_agent_id", { length: 256 }),
|
|
564
|
+
fromExternalAgentId: pgCore.varchar("from_external_sub_agent_id", { length: 256 }),
|
|
565
|
+
toExternalAgentId: pgCore.varchar("to_external_sub_agent_id", { length: 256 }),
|
|
566
|
+
fromTeamAgentId: pgCore.varchar("from_team_agent_id", { length: 256 }),
|
|
567
|
+
toTeamAgentId: pgCore.varchar("to_team_agent_id", { length: 256 }),
|
|
568
|
+
content: pgCore.jsonb("content").$type().notNull(),
|
|
569
|
+
visibility: pgCore.varchar("visibility", { length: 256 }).notNull().default("user-facing"),
|
|
570
|
+
messageType: pgCore.varchar("message_type", { length: 256 }).notNull().default("chat"),
|
|
571
|
+
taskId: pgCore.varchar("task_id", { length: 256 }),
|
|
572
|
+
parentMessageId: pgCore.varchar("parent_message_id", { length: 256 }),
|
|
573
|
+
a2aTaskId: pgCore.varchar("a2a_task_id", { length: 256 }),
|
|
574
|
+
a2aSessionId: pgCore.varchar("a2a_session_id", { length: 256 }),
|
|
575
|
+
metadata: pgCore.jsonb("metadata").$type(),
|
|
576
576
|
...timestamps
|
|
577
577
|
},
|
|
578
578
|
(table) => [
|
|
579
|
-
|
|
580
|
-
|
|
579
|
+
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
580
|
+
pgCore.foreignKey({
|
|
581
581
|
columns: [table.tenantId, table.projectId],
|
|
582
582
|
foreignColumns: [projects.tenantId, projects.id],
|
|
583
583
|
name: "messages_project_fk"
|
|
584
584
|
}).onDelete("cascade")
|
|
585
585
|
]
|
|
586
586
|
);
|
|
587
|
-
var ledgerArtifacts =
|
|
587
|
+
var ledgerArtifacts = pgCore.pgTable(
|
|
588
588
|
"ledger_artifacts",
|
|
589
589
|
{
|
|
590
590
|
...projectScoped,
|
|
591
|
-
taskId:
|
|
592
|
-
toolCallId:
|
|
593
|
-
contextId:
|
|
594
|
-
type:
|
|
595
|
-
name:
|
|
596
|
-
description:
|
|
597
|
-
parts:
|
|
598
|
-
metadata:
|
|
599
|
-
summary:
|
|
600
|
-
mime:
|
|
601
|
-
visibility:
|
|
602
|
-
allowedAgents:
|
|
603
|
-
derivedFrom:
|
|
591
|
+
taskId: pgCore.varchar("task_id", { length: 256 }).notNull(),
|
|
592
|
+
toolCallId: pgCore.varchar("tool_call_id", { length: 256 }),
|
|
593
|
+
contextId: pgCore.varchar("context_id", { length: 256 }).notNull(),
|
|
594
|
+
type: pgCore.varchar("type", { length: 256 }).notNull().default("source"),
|
|
595
|
+
name: pgCore.varchar("name", { length: 256 }),
|
|
596
|
+
description: pgCore.text("description"),
|
|
597
|
+
parts: pgCore.jsonb("parts").$type(),
|
|
598
|
+
metadata: pgCore.jsonb("metadata").$type(),
|
|
599
|
+
summary: pgCore.text("summary"),
|
|
600
|
+
mime: pgCore.jsonb("mime").$type(),
|
|
601
|
+
visibility: pgCore.varchar("visibility", { length: 256 }).default("context"),
|
|
602
|
+
allowedAgents: pgCore.jsonb("allowed_agents").$type(),
|
|
603
|
+
derivedFrom: pgCore.varchar("derived_from", { length: 256 }),
|
|
604
604
|
...timestamps
|
|
605
605
|
},
|
|
606
606
|
(table) => [
|
|
607
|
-
|
|
608
|
-
|
|
607
|
+
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id, table.taskId] }),
|
|
608
|
+
pgCore.foreignKey({
|
|
609
609
|
columns: [table.tenantId, table.projectId],
|
|
610
610
|
foreignColumns: [projects.tenantId, projects.id],
|
|
611
611
|
name: "ledger_artifacts_project_fk"
|
|
612
612
|
}).onDelete("cascade"),
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
613
|
+
pgCore.index("ledger_artifacts_task_id_idx").on(table.taskId),
|
|
614
|
+
pgCore.index("ledger_artifacts_tool_call_id_idx").on(table.toolCallId),
|
|
615
|
+
pgCore.index("ledger_artifacts_context_id_idx").on(table.contextId),
|
|
616
|
+
pgCore.unique("ledger_artifacts_task_context_name_unique").on(
|
|
617
617
|
table.taskId,
|
|
618
618
|
table.contextId,
|
|
619
619
|
table.name
|
|
620
620
|
)
|
|
621
621
|
]
|
|
622
622
|
);
|
|
623
|
-
var apiKeys =
|
|
623
|
+
var apiKeys = pgCore.pgTable(
|
|
624
624
|
"api_keys",
|
|
625
625
|
{
|
|
626
626
|
...agentScoped,
|
|
627
|
-
publicId:
|
|
628
|
-
keyHash:
|
|
629
|
-
keyPrefix:
|
|
630
|
-
name:
|
|
631
|
-
lastUsedAt:
|
|
632
|
-
expiresAt:
|
|
627
|
+
publicId: pgCore.varchar("public_id", { length: 256 }).notNull().unique(),
|
|
628
|
+
keyHash: pgCore.varchar("key_hash", { length: 256 }).notNull(),
|
|
629
|
+
keyPrefix: pgCore.varchar("key_prefix", { length: 256 }).notNull(),
|
|
630
|
+
name: pgCore.varchar("name", { length: 256 }),
|
|
631
|
+
lastUsedAt: pgCore.timestamp("last_used_at", { mode: "string" }),
|
|
632
|
+
expiresAt: pgCore.timestamp("expires_at", { mode: "string" }),
|
|
633
633
|
...timestamps
|
|
634
634
|
},
|
|
635
635
|
(t) => [
|
|
636
|
-
|
|
636
|
+
pgCore.foreignKey({
|
|
637
637
|
columns: [t.tenantId, t.projectId],
|
|
638
638
|
foreignColumns: [projects.tenantId, projects.id],
|
|
639
639
|
name: "api_keys_project_fk"
|
|
640
640
|
}).onDelete("cascade"),
|
|
641
|
-
|
|
641
|
+
pgCore.foreignKey({
|
|
642
642
|
columns: [t.tenantId, t.projectId, t.agentId],
|
|
643
643
|
foreignColumns: [agents.tenantId, agents.projectId, agents.id],
|
|
644
644
|
name: "api_keys_agent_fk"
|
|
645
645
|
}).onDelete("cascade"),
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
646
|
+
pgCore.index("api_keys_tenant_agent_idx").on(t.tenantId, t.agentId),
|
|
647
|
+
pgCore.index("api_keys_prefix_idx").on(t.keyPrefix),
|
|
648
|
+
pgCore.index("api_keys_public_id_idx").on(t.publicId)
|
|
649
649
|
]
|
|
650
650
|
);
|
|
651
|
-
var credentialReferences =
|
|
651
|
+
var credentialReferences = pgCore.pgTable(
|
|
652
652
|
"credential_references",
|
|
653
653
|
{
|
|
654
654
|
...projectScoped,
|
|
655
|
-
name:
|
|
656
|
-
type:
|
|
657
|
-
credentialStoreId:
|
|
658
|
-
retrievalParams:
|
|
655
|
+
name: pgCore.varchar("name", { length: 256 }).notNull(),
|
|
656
|
+
type: pgCore.varchar("type", { length: 256 }).notNull(),
|
|
657
|
+
credentialStoreId: pgCore.varchar("credential_store_id", { length: 256 }).notNull(),
|
|
658
|
+
retrievalParams: pgCore.jsonb("retrieval_params").$type(),
|
|
659
659
|
...timestamps
|
|
660
660
|
},
|
|
661
661
|
(t) => [
|
|
662
|
-
|
|
663
|
-
|
|
662
|
+
pgCore.primaryKey({ columns: [t.tenantId, t.projectId, t.id] }),
|
|
663
|
+
pgCore.foreignKey({
|
|
664
664
|
columns: [t.tenantId, t.projectId],
|
|
665
665
|
foreignColumns: [projects.tenantId, projects.id],
|
|
666
666
|
name: "credential_references_project_fk"
|