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