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