@inkeep/agents-core 0.31.7 → 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 +7 -7
- package/dist/client-exports.d.ts +7 -7
- 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 +409 -352
- package/dist/index.d.ts +409 -352
- package/dist/index.js +16250 -11076
- package/dist/nodefs-X2JO4ZHZ.js +21 -0
- package/dist/opfs-ahp-2UFDGV73.js +318 -0
- package/dist/{schema-lEFnfOQ-.d.ts → schema-CuEjPQt7.d.ts} +876 -1014
- package/dist/{schema-ztSm-Iv6.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-qLyZ45lb.d.cts → utility-DF5IUC9K.d.cts} +1230 -1394
- package/dist/{utility-qLyZ45lb.d.ts → utility-DF5IUC9K.d.ts} +1230 -1394
- 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/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
|
|
|
@@ -14,6 +14,38 @@ var Ajv__default = /*#__PURE__*/_interopDefault(Ajv);
|
|
|
14
14
|
|
|
15
15
|
// src/client-exports.ts
|
|
16
16
|
|
|
17
|
+
// src/constants/schema-validation/defaults.ts
|
|
18
|
+
var schemaValidationDefaults = {
|
|
19
|
+
// Agent Execution Transfer Count
|
|
20
|
+
// Controls how many times an agent can transfer control to sub-agents in a single conversation turn.
|
|
21
|
+
// This prevents infinite transfer loops while allowing multi-agent collaboration workflows.
|
|
22
|
+
AGENT_EXECUTION_TRANSFER_COUNT_MIN: 1,
|
|
23
|
+
AGENT_EXECUTION_TRANSFER_COUNT_MAX: 1e3,
|
|
24
|
+
// Sub-Agent Turn Generation Steps
|
|
25
|
+
// Limits how many AI generation steps a sub-agent can perform within a single turn.
|
|
26
|
+
// Each generation step typically involves sending a prompt to the LLM and processing its response.
|
|
27
|
+
// This prevents runaway token usage while allowing complex multi-step reasoning.
|
|
28
|
+
SUB_AGENT_TURN_GENERATION_STEPS_MIN: 1,
|
|
29
|
+
SUB_AGENT_TURN_GENERATION_STEPS_MAX: 1e3,
|
|
30
|
+
// Status Update Thresholds
|
|
31
|
+
// Real-time status updates are triggered when either threshold is exceeded during longer operations.
|
|
32
|
+
// MAX_NUM_EVENTS: Maximum number of internal events before forcing a status update to the client.
|
|
33
|
+
// MAX_INTERVAL_SECONDS: Maximum time between status updates regardless of event count.
|
|
34
|
+
STATUS_UPDATE_MAX_NUM_EVENTS: 100,
|
|
35
|
+
STATUS_UPDATE_MAX_INTERVAL_SECONDS: 600,
|
|
36
|
+
// 10 minutes
|
|
37
|
+
// Prompt Text Length Validation
|
|
38
|
+
// Maximum character limits for agent and sub-agent system prompts to prevent excessive token usage.
|
|
39
|
+
// Enforced during agent configuration to ensure prompts remain focused and manageable.
|
|
40
|
+
VALIDATION_SUB_AGENT_PROMPT_MAX_CHARS: 2e3,
|
|
41
|
+
VALIDATION_AGENT_PROMPT_MAX_CHARS: 5e3,
|
|
42
|
+
// Context Fetcher HTTP Timeout
|
|
43
|
+
// Maximum time allowed for HTTP requests made by Context Fetchers (e.g., CRM lookups, external API calls).
|
|
44
|
+
// Context Fetchers automatically retrieve external data at the start of a conversation to enrich agent context.
|
|
45
|
+
CONTEXT_FETCHER_HTTP_TIMEOUT_MS_DEFAULT: 1e4
|
|
46
|
+
// 10 seconds
|
|
47
|
+
};
|
|
48
|
+
|
|
17
49
|
// src/types/utility.ts
|
|
18
50
|
var TOOL_STATUS_VALUES = ["healthy", "unhealthy", "unknown", "needs_auth"];
|
|
19
51
|
var VALID_RELATION_TYPES = ["transfer", "delegate"];
|
|
@@ -31,165 +63,165 @@ var CredentialStoreType = {
|
|
|
31
63
|
nango: "nango"
|
|
32
64
|
};
|
|
33
65
|
var tenantScoped = {
|
|
34
|
-
tenantId:
|
|
35
|
-
id:
|
|
66
|
+
tenantId: pgCore.varchar("tenant_id", { length: 256 }).notNull(),
|
|
67
|
+
id: pgCore.varchar("id", { length: 256 }).notNull()
|
|
36
68
|
};
|
|
37
69
|
var projectScoped = {
|
|
38
70
|
...tenantScoped,
|
|
39
|
-
projectId:
|
|
71
|
+
projectId: pgCore.varchar("project_id", { length: 256 }).notNull()
|
|
40
72
|
};
|
|
41
73
|
var agentScoped = {
|
|
42
74
|
...projectScoped,
|
|
43
|
-
agentId:
|
|
75
|
+
agentId: pgCore.varchar("agent_id", { length: 256 }).notNull()
|
|
44
76
|
};
|
|
45
77
|
var subAgentScoped = {
|
|
46
78
|
...agentScoped,
|
|
47
|
-
subAgentId:
|
|
79
|
+
subAgentId: pgCore.varchar("sub_agent_id", { length: 256 }).notNull()
|
|
48
80
|
};
|
|
49
81
|
var uiProperties = {
|
|
50
|
-
name:
|
|
51
|
-
description:
|
|
82
|
+
name: pgCore.varchar("name", { length: 256 }).notNull(),
|
|
83
|
+
description: pgCore.text("description").notNull()
|
|
52
84
|
};
|
|
53
85
|
var timestamps = {
|
|
54
|
-
createdAt:
|
|
55
|
-
updatedAt:
|
|
86
|
+
createdAt: pgCore.timestamp("created_at", { mode: "string" }).notNull().defaultNow(),
|
|
87
|
+
updatedAt: pgCore.timestamp("updated_at", { mode: "string" }).notNull().defaultNow()
|
|
56
88
|
};
|
|
57
|
-
var projects =
|
|
89
|
+
var projects = pgCore.pgTable(
|
|
58
90
|
"projects",
|
|
59
91
|
{
|
|
60
92
|
...tenantScoped,
|
|
61
93
|
...uiProperties,
|
|
62
|
-
models:
|
|
63
|
-
stopWhen:
|
|
94
|
+
models: pgCore.jsonb("models").$type(),
|
|
95
|
+
stopWhen: pgCore.jsonb("stop_when").$type(),
|
|
64
96
|
...timestamps
|
|
65
97
|
},
|
|
66
|
-
(table) => [
|
|
98
|
+
(table) => [pgCore.primaryKey({ columns: [table.tenantId, table.id] })]
|
|
67
99
|
);
|
|
68
|
-
var agents =
|
|
100
|
+
var agents = pgCore.pgTable(
|
|
69
101
|
"agent",
|
|
70
102
|
{
|
|
71
103
|
...projectScoped,
|
|
72
|
-
name:
|
|
73
|
-
description:
|
|
74
|
-
defaultSubAgentId:
|
|
75
|
-
contextConfigId:
|
|
76
|
-
models:
|
|
77
|
-
statusUpdates:
|
|
78
|
-
prompt:
|
|
79
|
-
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(),
|
|
80
112
|
...timestamps
|
|
81
113
|
},
|
|
82
114
|
(table) => [
|
|
83
|
-
|
|
84
|
-
|
|
115
|
+
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
116
|
+
pgCore.foreignKey({
|
|
85
117
|
columns: [table.tenantId, table.projectId],
|
|
86
118
|
foreignColumns: [projects.tenantId, projects.id],
|
|
87
119
|
name: "agent_project_fk"
|
|
88
120
|
}).onDelete("cascade")
|
|
89
121
|
]
|
|
90
122
|
);
|
|
91
|
-
var contextConfigs =
|
|
123
|
+
var contextConfigs = pgCore.pgTable(
|
|
92
124
|
"context_configs",
|
|
93
125
|
{
|
|
94
126
|
...agentScoped,
|
|
95
|
-
headersSchema:
|
|
96
|
-
contextVariables:
|
|
127
|
+
headersSchema: pgCore.jsonb("headers_schema").$type(),
|
|
128
|
+
contextVariables: pgCore.jsonb("context_variables").$type(),
|
|
97
129
|
...timestamps
|
|
98
130
|
},
|
|
99
131
|
(table) => [
|
|
100
|
-
|
|
101
|
-
|
|
132
|
+
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.agentId, table.id] }),
|
|
133
|
+
pgCore.foreignKey({
|
|
102
134
|
columns: [table.tenantId, table.projectId, table.agentId],
|
|
103
135
|
foreignColumns: [agents.tenantId, agents.projectId, agents.id],
|
|
104
136
|
name: "context_configs_agent_fk"
|
|
105
137
|
}).onDelete("cascade")
|
|
106
138
|
]
|
|
107
139
|
);
|
|
108
|
-
var contextCache =
|
|
140
|
+
var contextCache = pgCore.pgTable(
|
|
109
141
|
"context_cache",
|
|
110
142
|
{
|
|
111
143
|
...projectScoped,
|
|
112
|
-
conversationId:
|
|
113
|
-
contextConfigId:
|
|
114
|
-
contextVariableKey:
|
|
115
|
-
value:
|
|
116
|
-
requestHash:
|
|
117
|
-
fetchedAt:
|
|
118
|
-
fetchSource:
|
|
119
|
-
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"),
|
|
120
152
|
...timestamps
|
|
121
153
|
},
|
|
122
154
|
(table) => [
|
|
123
|
-
|
|
124
|
-
|
|
155
|
+
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
156
|
+
pgCore.foreignKey({
|
|
125
157
|
columns: [table.tenantId, table.projectId],
|
|
126
158
|
foreignColumns: [projects.tenantId, projects.id],
|
|
127
159
|
name: "context_cache_project_fk"
|
|
128
160
|
}).onDelete("cascade"),
|
|
129
|
-
|
|
161
|
+
pgCore.index("context_cache_lookup_idx").on(
|
|
130
162
|
table.conversationId,
|
|
131
163
|
table.contextConfigId,
|
|
132
164
|
table.contextVariableKey
|
|
133
165
|
)
|
|
134
166
|
]
|
|
135
167
|
);
|
|
136
|
-
var subAgents =
|
|
168
|
+
var subAgents = pgCore.pgTable(
|
|
137
169
|
"sub_agents",
|
|
138
170
|
{
|
|
139
171
|
...agentScoped,
|
|
140
172
|
...uiProperties,
|
|
141
|
-
prompt:
|
|
142
|
-
conversationHistoryConfig:
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
models:
|
|
146
|
-
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(),
|
|
147
179
|
...timestamps
|
|
148
180
|
},
|
|
149
181
|
(table) => [
|
|
150
|
-
|
|
151
|
-
|
|
182
|
+
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.agentId, table.id] }),
|
|
183
|
+
pgCore.foreignKey({
|
|
152
184
|
columns: [table.tenantId, table.projectId, table.agentId],
|
|
153
185
|
foreignColumns: [agents.tenantId, agents.projectId, agents.id],
|
|
154
186
|
name: "sub_agents_agents_fk"
|
|
155
187
|
}).onDelete("cascade")
|
|
156
188
|
]
|
|
157
189
|
);
|
|
158
|
-
var subAgentRelations =
|
|
190
|
+
var subAgentRelations = pgCore.pgTable(
|
|
159
191
|
"sub_agent_relations",
|
|
160
192
|
{
|
|
161
193
|
...agentScoped,
|
|
162
|
-
sourceSubAgentId:
|
|
163
|
-
targetSubAgentId:
|
|
164
|
-
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 }),
|
|
165
197
|
...timestamps
|
|
166
198
|
},
|
|
167
199
|
(table) => [
|
|
168
|
-
|
|
169
|
-
|
|
200
|
+
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.agentId, table.id] }),
|
|
201
|
+
pgCore.foreignKey({
|
|
170
202
|
columns: [table.tenantId, table.projectId, table.agentId],
|
|
171
203
|
foreignColumns: [agents.tenantId, agents.projectId, agents.id],
|
|
172
204
|
name: "sub_agent_relations_agent_fk"
|
|
173
205
|
}).onDelete("cascade")
|
|
174
206
|
]
|
|
175
207
|
);
|
|
176
|
-
var externalAgents =
|
|
208
|
+
var externalAgents = pgCore.pgTable(
|
|
177
209
|
"external_agents",
|
|
178
210
|
{
|
|
179
211
|
...projectScoped,
|
|
180
212
|
...uiProperties,
|
|
181
|
-
baseUrl:
|
|
182
|
-
credentialReferenceId:
|
|
213
|
+
baseUrl: pgCore.text("base_url").notNull(),
|
|
214
|
+
credentialReferenceId: pgCore.varchar("credential_reference_id", { length: 256 }),
|
|
183
215
|
...timestamps
|
|
184
216
|
},
|
|
185
217
|
(table) => [
|
|
186
|
-
|
|
187
|
-
|
|
218
|
+
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
219
|
+
pgCore.foreignKey({
|
|
188
220
|
columns: [table.tenantId, table.projectId],
|
|
189
221
|
foreignColumns: [projects.tenantId, projects.id],
|
|
190
222
|
name: "external_agents_project_fk"
|
|
191
223
|
}).onDelete("cascade"),
|
|
192
|
-
|
|
224
|
+
pgCore.foreignKey({
|
|
193
225
|
columns: [table.tenantId, table.projectId, table.credentialReferenceId],
|
|
194
226
|
foreignColumns: [
|
|
195
227
|
credentialReferences.tenantId,
|
|
@@ -197,118 +229,118 @@ var externalAgents = sqliteCore.sqliteTable(
|
|
|
197
229
|
credentialReferences.id
|
|
198
230
|
],
|
|
199
231
|
name: "external_agents_credential_reference_fk"
|
|
200
|
-
}).onDelete("
|
|
232
|
+
}).onDelete("cascade")
|
|
201
233
|
]
|
|
202
234
|
);
|
|
203
|
-
var tasks =
|
|
235
|
+
var tasks = pgCore.pgTable(
|
|
204
236
|
"tasks",
|
|
205
237
|
{
|
|
206
238
|
...subAgentScoped,
|
|
207
|
-
contextId:
|
|
208
|
-
status:
|
|
209
|
-
metadata:
|
|
239
|
+
contextId: pgCore.varchar("context_id", { length: 256 }).notNull(),
|
|
240
|
+
status: pgCore.varchar("status", { length: 256 }).notNull(),
|
|
241
|
+
metadata: pgCore.jsonb("metadata").$type(),
|
|
210
242
|
...timestamps
|
|
211
243
|
},
|
|
212
244
|
(table) => [
|
|
213
|
-
|
|
214
|
-
|
|
245
|
+
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
246
|
+
pgCore.foreignKey({
|
|
215
247
|
columns: [table.tenantId, table.projectId, table.agentId, table.subAgentId],
|
|
216
248
|
foreignColumns: [subAgents.tenantId, subAgents.projectId, subAgents.agentId, subAgents.id],
|
|
217
249
|
name: "tasks_sub_agent_fk"
|
|
218
250
|
}).onDelete("cascade")
|
|
219
251
|
]
|
|
220
252
|
);
|
|
221
|
-
var taskRelations =
|
|
253
|
+
var taskRelations = pgCore.pgTable(
|
|
222
254
|
"task_relations",
|
|
223
255
|
{
|
|
224
256
|
...projectScoped,
|
|
225
|
-
parentTaskId:
|
|
226
|
-
childTaskId:
|
|
227
|
-
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"),
|
|
228
260
|
...timestamps
|
|
229
261
|
},
|
|
230
262
|
(table) => [
|
|
231
|
-
|
|
232
|
-
|
|
263
|
+
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
264
|
+
pgCore.foreignKey({
|
|
233
265
|
columns: [table.tenantId, table.projectId],
|
|
234
266
|
foreignColumns: [projects.tenantId, projects.id],
|
|
235
267
|
name: "task_relations_project_fk"
|
|
236
268
|
}).onDelete("cascade")
|
|
237
269
|
]
|
|
238
270
|
);
|
|
239
|
-
var dataComponents =
|
|
271
|
+
var dataComponents = pgCore.pgTable(
|
|
240
272
|
"data_components",
|
|
241
273
|
{
|
|
242
274
|
...projectScoped,
|
|
243
275
|
...uiProperties,
|
|
244
|
-
props:
|
|
245
|
-
render:
|
|
276
|
+
props: pgCore.jsonb("props").$type(),
|
|
277
|
+
render: pgCore.jsonb("render").$type(),
|
|
246
278
|
...timestamps
|
|
247
279
|
},
|
|
248
280
|
(table) => [
|
|
249
|
-
|
|
250
|
-
|
|
281
|
+
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
282
|
+
pgCore.foreignKey({
|
|
251
283
|
columns: [table.tenantId, table.projectId],
|
|
252
284
|
foreignColumns: [projects.tenantId, projects.id],
|
|
253
285
|
name: "data_components_project_fk"
|
|
254
286
|
}).onDelete("cascade")
|
|
255
287
|
]
|
|
256
288
|
);
|
|
257
|
-
var subAgentDataComponents =
|
|
289
|
+
var subAgentDataComponents = pgCore.pgTable(
|
|
258
290
|
"sub_agent_data_components",
|
|
259
291
|
{
|
|
260
292
|
...subAgentScoped,
|
|
261
|
-
dataComponentId:
|
|
262
|
-
createdAt:
|
|
293
|
+
dataComponentId: pgCore.varchar("data_component_id", { length: 256 }).notNull(),
|
|
294
|
+
createdAt: pgCore.timestamp("created_at", { mode: "string" }).notNull().defaultNow()
|
|
263
295
|
},
|
|
264
296
|
(table) => [
|
|
265
|
-
|
|
266
|
-
|
|
297
|
+
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
298
|
+
pgCore.foreignKey({
|
|
267
299
|
columns: [table.tenantId, table.projectId, table.agentId, table.subAgentId],
|
|
268
300
|
foreignColumns: [subAgents.tenantId, subAgents.projectId, subAgents.agentId, subAgents.id],
|
|
269
301
|
name: "sub_agent_data_components_sub_agent_fk"
|
|
270
302
|
}).onDelete("cascade"),
|
|
271
|
-
|
|
303
|
+
pgCore.foreignKey({
|
|
272
304
|
columns: [table.tenantId, table.projectId, table.dataComponentId],
|
|
273
305
|
foreignColumns: [dataComponents.tenantId, dataComponents.projectId, dataComponents.id],
|
|
274
306
|
name: "sub_agent_data_components_data_component_fk"
|
|
275
307
|
}).onDelete("cascade")
|
|
276
308
|
]
|
|
277
309
|
);
|
|
278
|
-
var artifactComponents =
|
|
310
|
+
var artifactComponents = pgCore.pgTable(
|
|
279
311
|
"artifact_components",
|
|
280
312
|
{
|
|
281
313
|
...projectScoped,
|
|
282
314
|
...uiProperties,
|
|
283
|
-
props:
|
|
315
|
+
props: pgCore.jsonb("props").$type(),
|
|
284
316
|
...timestamps
|
|
285
317
|
},
|
|
286
318
|
(table) => [
|
|
287
|
-
|
|
288
|
-
|
|
319
|
+
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
320
|
+
pgCore.foreignKey({
|
|
289
321
|
columns: [table.tenantId, table.projectId],
|
|
290
322
|
foreignColumns: [projects.tenantId, projects.id],
|
|
291
323
|
name: "artifact_components_project_fk"
|
|
292
324
|
}).onDelete("cascade")
|
|
293
325
|
]
|
|
294
326
|
);
|
|
295
|
-
var subAgentArtifactComponents =
|
|
327
|
+
var subAgentArtifactComponents = pgCore.pgTable(
|
|
296
328
|
"sub_agent_artifact_components",
|
|
297
329
|
{
|
|
298
330
|
...subAgentScoped,
|
|
299
|
-
artifactComponentId:
|
|
300
|
-
createdAt:
|
|
331
|
+
artifactComponentId: pgCore.varchar("artifact_component_id", { length: 256 }).notNull(),
|
|
332
|
+
createdAt: pgCore.timestamp("created_at", { mode: "string" }).notNull().defaultNow()
|
|
301
333
|
},
|
|
302
334
|
(table) => [
|
|
303
|
-
|
|
335
|
+
pgCore.primaryKey({
|
|
304
336
|
columns: [table.tenantId, table.projectId, table.agentId, table.subAgentId, table.id]
|
|
305
337
|
}),
|
|
306
|
-
|
|
338
|
+
pgCore.foreignKey({
|
|
307
339
|
columns: [table.tenantId, table.projectId, table.agentId, table.subAgentId],
|
|
308
340
|
foreignColumns: [subAgents.tenantId, subAgents.projectId, subAgents.agentId, subAgents.id],
|
|
309
341
|
name: "sub_agent_artifact_components_sub_agent_fk"
|
|
310
342
|
}).onDelete("cascade"),
|
|
311
|
-
|
|
343
|
+
pgCore.foreignKey({
|
|
312
344
|
columns: [table.tenantId, table.projectId, table.artifactComponentId],
|
|
313
345
|
foreignColumns: [
|
|
314
346
|
artifactComponents.tenantId,
|
|
@@ -319,152 +351,152 @@ var subAgentArtifactComponents = sqliteCore.sqliteTable(
|
|
|
319
351
|
}).onDelete("cascade")
|
|
320
352
|
]
|
|
321
353
|
);
|
|
322
|
-
var tools =
|
|
354
|
+
var tools = pgCore.pgTable(
|
|
323
355
|
"tools",
|
|
324
356
|
{
|
|
325
357
|
...projectScoped,
|
|
326
|
-
name:
|
|
327
|
-
description:
|
|
328
|
-
config:
|
|
329
|
-
credentialReferenceId:
|
|
330
|
-
headers:
|
|
331
|
-
imageUrl:
|
|
332
|
-
capabilities:
|
|
333
|
-
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"),
|
|
334
366
|
...timestamps
|
|
335
367
|
},
|
|
336
368
|
(table) => [
|
|
337
|
-
|
|
338
|
-
|
|
369
|
+
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
370
|
+
pgCore.foreignKey({
|
|
339
371
|
columns: [table.tenantId, table.projectId],
|
|
340
372
|
foreignColumns: [projects.tenantId, projects.id],
|
|
341
373
|
name: "tools_project_fk"
|
|
342
374
|
}).onDelete("cascade")
|
|
343
375
|
]
|
|
344
376
|
);
|
|
345
|
-
var functionTools =
|
|
377
|
+
var functionTools = pgCore.pgTable(
|
|
346
378
|
"function_tools",
|
|
347
379
|
{
|
|
348
380
|
...agentScoped,
|
|
349
|
-
name:
|
|
350
|
-
description:
|
|
351
|
-
functionId:
|
|
381
|
+
name: pgCore.varchar("name", { length: 256 }).notNull(),
|
|
382
|
+
description: pgCore.text("description"),
|
|
383
|
+
functionId: pgCore.varchar("function_id", { length: 256 }).notNull(),
|
|
352
384
|
...timestamps
|
|
353
385
|
},
|
|
354
386
|
(table) => [
|
|
355
|
-
|
|
356
|
-
|
|
387
|
+
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.agentId, table.id] }),
|
|
388
|
+
pgCore.foreignKey({
|
|
357
389
|
columns: [table.tenantId, table.projectId, table.agentId],
|
|
358
390
|
foreignColumns: [agents.tenantId, agents.projectId, agents.id],
|
|
359
391
|
name: "function_tools_agent_fk"
|
|
360
392
|
}).onDelete("cascade"),
|
|
361
|
-
|
|
393
|
+
pgCore.foreignKey({
|
|
362
394
|
columns: [table.tenantId, table.projectId, table.functionId],
|
|
363
395
|
foreignColumns: [functions.tenantId, functions.projectId, functions.id],
|
|
364
396
|
name: "function_tools_function_fk"
|
|
365
397
|
}).onDelete("cascade")
|
|
366
398
|
]
|
|
367
399
|
);
|
|
368
|
-
var functions =
|
|
400
|
+
var functions = pgCore.pgTable(
|
|
369
401
|
"functions",
|
|
370
402
|
{
|
|
371
403
|
...projectScoped,
|
|
372
|
-
inputSchema:
|
|
373
|
-
executeCode:
|
|
374
|
-
dependencies:
|
|
404
|
+
inputSchema: pgCore.jsonb("input_schema").$type(),
|
|
405
|
+
executeCode: pgCore.text("execute_code").notNull(),
|
|
406
|
+
dependencies: pgCore.jsonb("dependencies").$type(),
|
|
375
407
|
...timestamps
|
|
376
408
|
},
|
|
377
409
|
(table) => [
|
|
378
|
-
|
|
379
|
-
|
|
410
|
+
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
411
|
+
pgCore.foreignKey({
|
|
380
412
|
columns: [table.tenantId, table.projectId],
|
|
381
413
|
foreignColumns: [projects.tenantId, projects.id],
|
|
382
414
|
name: "functions_project_fk"
|
|
383
415
|
}).onDelete("cascade")
|
|
384
416
|
]
|
|
385
417
|
);
|
|
386
|
-
var subAgentToolRelations =
|
|
418
|
+
var subAgentToolRelations = pgCore.pgTable(
|
|
387
419
|
"sub_agent_tool_relations",
|
|
388
420
|
{
|
|
389
421
|
...subAgentScoped,
|
|
390
|
-
toolId:
|
|
391
|
-
selectedTools:
|
|
392
|
-
headers:
|
|
422
|
+
toolId: pgCore.varchar("tool_id", { length: 256 }).notNull(),
|
|
423
|
+
selectedTools: pgCore.jsonb("selected_tools").$type(),
|
|
424
|
+
headers: pgCore.jsonb("headers").$type(),
|
|
393
425
|
...timestamps
|
|
394
426
|
},
|
|
395
427
|
(table) => [
|
|
396
|
-
|
|
397
|
-
|
|
428
|
+
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.agentId, table.id] }),
|
|
429
|
+
pgCore.foreignKey({
|
|
398
430
|
columns: [table.tenantId, table.projectId, table.agentId, table.subAgentId],
|
|
399
431
|
foreignColumns: [subAgents.tenantId, subAgents.projectId, subAgents.agentId, subAgents.id],
|
|
400
432
|
name: "sub_agent_tool_relations_agent_fk"
|
|
401
433
|
}).onDelete("cascade"),
|
|
402
|
-
|
|
434
|
+
pgCore.foreignKey({
|
|
403
435
|
columns: [table.tenantId, table.projectId, table.toolId],
|
|
404
436
|
foreignColumns: [tools.tenantId, tools.projectId, tools.id],
|
|
405
437
|
name: "sub_agent_tool_relations_tool_fk"
|
|
406
438
|
}).onDelete("cascade")
|
|
407
439
|
]
|
|
408
440
|
);
|
|
409
|
-
var subAgentExternalAgentRelations =
|
|
441
|
+
var subAgentExternalAgentRelations = pgCore.pgTable(
|
|
410
442
|
"sub_agent_external_agent_relations",
|
|
411
443
|
{
|
|
412
444
|
...subAgentScoped,
|
|
413
|
-
externalAgentId:
|
|
414
|
-
headers:
|
|
445
|
+
externalAgentId: pgCore.varchar("external_agent_id", { length: 256 }).notNull(),
|
|
446
|
+
headers: pgCore.jsonb("headers").$type(),
|
|
415
447
|
...timestamps
|
|
416
448
|
},
|
|
417
449
|
(table) => [
|
|
418
|
-
|
|
419
|
-
|
|
450
|
+
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.agentId, table.id] }),
|
|
451
|
+
pgCore.foreignKey({
|
|
420
452
|
columns: [table.tenantId, table.projectId, table.agentId, table.subAgentId],
|
|
421
453
|
foreignColumns: [subAgents.tenantId, subAgents.projectId, subAgents.agentId, subAgents.id],
|
|
422
454
|
name: "sub_agent_external_agent_relations_sub_agent_fk"
|
|
423
455
|
}).onDelete("cascade"),
|
|
424
|
-
|
|
456
|
+
pgCore.foreignKey({
|
|
425
457
|
columns: [table.tenantId, table.projectId, table.externalAgentId],
|
|
426
458
|
foreignColumns: [externalAgents.tenantId, externalAgents.projectId, externalAgents.id],
|
|
427
459
|
name: "sub_agent_external_agent_relations_external_agent_fk"
|
|
428
460
|
}).onDelete("cascade")
|
|
429
461
|
]
|
|
430
462
|
);
|
|
431
|
-
var subAgentTeamAgentRelations =
|
|
463
|
+
var subAgentTeamAgentRelations = pgCore.pgTable(
|
|
432
464
|
"sub_agent_team_agent_relations",
|
|
433
465
|
{
|
|
434
466
|
...subAgentScoped,
|
|
435
|
-
targetAgentId:
|
|
436
|
-
headers:
|
|
467
|
+
targetAgentId: pgCore.varchar("target_agent_id", { length: 256 }).notNull(),
|
|
468
|
+
headers: pgCore.jsonb("headers").$type(),
|
|
437
469
|
...timestamps
|
|
438
470
|
},
|
|
439
471
|
(table) => [
|
|
440
|
-
|
|
441
|
-
|
|
472
|
+
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.agentId, table.id] }),
|
|
473
|
+
pgCore.foreignKey({
|
|
442
474
|
columns: [table.tenantId, table.projectId, table.agentId, table.subAgentId],
|
|
443
475
|
foreignColumns: [subAgents.tenantId, subAgents.projectId, subAgents.agentId, subAgents.id],
|
|
444
476
|
name: "sub_agent_team_agent_relations_sub_agent_fk"
|
|
445
477
|
}).onDelete("cascade"),
|
|
446
|
-
|
|
478
|
+
pgCore.foreignKey({
|
|
447
479
|
columns: [table.tenantId, table.projectId, table.targetAgentId],
|
|
448
480
|
foreignColumns: [agents.tenantId, agents.projectId, agents.id],
|
|
449
481
|
name: "sub_agent_team_agent_relations_target_agent_fk"
|
|
450
482
|
}).onDelete("cascade")
|
|
451
483
|
]
|
|
452
484
|
);
|
|
453
|
-
var subAgentFunctionToolRelations =
|
|
485
|
+
var subAgentFunctionToolRelations = pgCore.pgTable(
|
|
454
486
|
"sub_agent_function_tool_relations",
|
|
455
487
|
{
|
|
456
488
|
...subAgentScoped,
|
|
457
|
-
functionToolId:
|
|
489
|
+
functionToolId: pgCore.varchar("function_tool_id", { length: 256 }).notNull(),
|
|
458
490
|
...timestamps
|
|
459
491
|
},
|
|
460
492
|
(table) => [
|
|
461
|
-
|
|
462
|
-
|
|
493
|
+
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.agentId, table.id] }),
|
|
494
|
+
pgCore.foreignKey({
|
|
463
495
|
columns: [table.tenantId, table.projectId, table.agentId, table.subAgentId],
|
|
464
496
|
foreignColumns: [subAgents.tenantId, subAgents.projectId, subAgents.agentId, subAgents.id],
|
|
465
497
|
name: "sub_agent_function_tool_relations_sub_agent_fk"
|
|
466
498
|
}).onDelete("cascade"),
|
|
467
|
-
|
|
499
|
+
pgCore.foreignKey({
|
|
468
500
|
columns: [table.tenantId, table.projectId, table.agentId, table.functionToolId],
|
|
469
501
|
foreignColumns: [
|
|
470
502
|
functionTools.tenantId,
|
|
@@ -476,134 +508,134 @@ var subAgentFunctionToolRelations = sqliteCore.sqliteTable(
|
|
|
476
508
|
}).onDelete("cascade")
|
|
477
509
|
]
|
|
478
510
|
);
|
|
479
|
-
var conversations =
|
|
511
|
+
var conversations = pgCore.pgTable(
|
|
480
512
|
"conversations",
|
|
481
513
|
{
|
|
482
514
|
...projectScoped,
|
|
483
|
-
userId:
|
|
484
|
-
activeSubAgentId:
|
|
485
|
-
title:
|
|
486
|
-
lastContextResolution:
|
|
487
|
-
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(),
|
|
488
520
|
...timestamps
|
|
489
521
|
},
|
|
490
522
|
(table) => [
|
|
491
|
-
|
|
492
|
-
|
|
523
|
+
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
524
|
+
pgCore.foreignKey({
|
|
493
525
|
columns: [table.tenantId, table.projectId],
|
|
494
526
|
foreignColumns: [projects.tenantId, projects.id],
|
|
495
527
|
name: "conversations_project_fk"
|
|
496
528
|
}).onDelete("cascade")
|
|
497
529
|
]
|
|
498
530
|
);
|
|
499
|
-
var messages =
|
|
531
|
+
var messages = pgCore.pgTable(
|
|
500
532
|
"messages",
|
|
501
533
|
{
|
|
502
534
|
...projectScoped,
|
|
503
|
-
conversationId:
|
|
504
|
-
role:
|
|
505
|
-
fromSubAgentId:
|
|
506
|
-
toSubAgentId:
|
|
507
|
-
fromExternalAgentId:
|
|
508
|
-
toExternalAgentId:
|
|
509
|
-
fromTeamAgentId:
|
|
510
|
-
toTeamAgentId:
|
|
511
|
-
content:
|
|
512
|
-
visibility:
|
|
513
|
-
messageType:
|
|
514
|
-
taskId:
|
|
515
|
-
parentMessageId:
|
|
516
|
-
a2aTaskId:
|
|
517
|
-
a2aSessionId:
|
|
518
|
-
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(),
|
|
519
551
|
...timestamps
|
|
520
552
|
},
|
|
521
553
|
(table) => [
|
|
522
|
-
|
|
523
|
-
|
|
554
|
+
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
555
|
+
pgCore.foreignKey({
|
|
524
556
|
columns: [table.tenantId, table.projectId],
|
|
525
557
|
foreignColumns: [projects.tenantId, projects.id],
|
|
526
558
|
name: "messages_project_fk"
|
|
527
559
|
}).onDelete("cascade")
|
|
528
560
|
]
|
|
529
561
|
);
|
|
530
|
-
var ledgerArtifacts =
|
|
562
|
+
var ledgerArtifacts = pgCore.pgTable(
|
|
531
563
|
"ledger_artifacts",
|
|
532
564
|
{
|
|
533
565
|
...projectScoped,
|
|
534
|
-
taskId:
|
|
535
|
-
toolCallId:
|
|
536
|
-
contextId:
|
|
537
|
-
type:
|
|
538
|
-
name:
|
|
539
|
-
description:
|
|
540
|
-
parts:
|
|
541
|
-
metadata:
|
|
542
|
-
summary:
|
|
543
|
-
mime:
|
|
544
|
-
visibility:
|
|
545
|
-
allowedAgents:
|
|
546
|
-
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 }),
|
|
547
579
|
...timestamps
|
|
548
580
|
},
|
|
549
581
|
(table) => [
|
|
550
|
-
|
|
551
|
-
|
|
582
|
+
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id, table.taskId] }),
|
|
583
|
+
pgCore.foreignKey({
|
|
552
584
|
columns: [table.tenantId, table.projectId],
|
|
553
585
|
foreignColumns: [projects.tenantId, projects.id],
|
|
554
586
|
name: "ledger_artifacts_project_fk"
|
|
555
587
|
}).onDelete("cascade"),
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
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(
|
|
560
592
|
table.taskId,
|
|
561
593
|
table.contextId,
|
|
562
594
|
table.name
|
|
563
595
|
)
|
|
564
596
|
]
|
|
565
597
|
);
|
|
566
|
-
var apiKeys =
|
|
598
|
+
var apiKeys = pgCore.pgTable(
|
|
567
599
|
"api_keys",
|
|
568
600
|
{
|
|
569
601
|
...agentScoped,
|
|
570
|
-
publicId:
|
|
571
|
-
keyHash:
|
|
572
|
-
keyPrefix:
|
|
573
|
-
name:
|
|
574
|
-
lastUsedAt:
|
|
575
|
-
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" }),
|
|
576
608
|
...timestamps
|
|
577
609
|
},
|
|
578
610
|
(t) => [
|
|
579
|
-
|
|
611
|
+
pgCore.foreignKey({
|
|
580
612
|
columns: [t.tenantId, t.projectId],
|
|
581
613
|
foreignColumns: [projects.tenantId, projects.id],
|
|
582
614
|
name: "api_keys_project_fk"
|
|
583
615
|
}).onDelete("cascade"),
|
|
584
|
-
|
|
616
|
+
pgCore.foreignKey({
|
|
585
617
|
columns: [t.tenantId, t.projectId, t.agentId],
|
|
586
618
|
foreignColumns: [agents.tenantId, agents.projectId, agents.id],
|
|
587
619
|
name: "api_keys_agent_fk"
|
|
588
620
|
}).onDelete("cascade"),
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
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)
|
|
592
624
|
]
|
|
593
625
|
);
|
|
594
|
-
var credentialReferences =
|
|
626
|
+
var credentialReferences = pgCore.pgTable(
|
|
595
627
|
"credential_references",
|
|
596
628
|
{
|
|
597
629
|
...projectScoped,
|
|
598
|
-
name:
|
|
599
|
-
type:
|
|
600
|
-
credentialStoreId:
|
|
601
|
-
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(),
|
|
602
634
|
...timestamps
|
|
603
635
|
},
|
|
604
636
|
(t) => [
|
|
605
|
-
|
|
606
|
-
|
|
637
|
+
pgCore.primaryKey({ columns: [t.tenantId, t.projectId, t.id] }),
|
|
638
|
+
pgCore.foreignKey({
|
|
607
639
|
columns: [t.tenantId, t.projectId],
|
|
608
640
|
foreignColumns: [projects.tenantId, projects.id],
|
|
609
641
|
name: "credential_references_project_fk"
|
|
@@ -962,9 +994,20 @@ drizzleOrm.relations(
|
|
|
962
994
|
);
|
|
963
995
|
|
|
964
996
|
// src/validation/schemas.ts
|
|
997
|
+
var {
|
|
998
|
+
AGENT_EXECUTION_TRANSFER_COUNT_MAX,
|
|
999
|
+
AGENT_EXECUTION_TRANSFER_COUNT_MIN,
|
|
1000
|
+
CONTEXT_FETCHER_HTTP_TIMEOUT_MS_DEFAULT,
|
|
1001
|
+
STATUS_UPDATE_MAX_INTERVAL_SECONDS,
|
|
1002
|
+
STATUS_UPDATE_MAX_NUM_EVENTS,
|
|
1003
|
+
SUB_AGENT_TURN_GENERATION_STEPS_MAX,
|
|
1004
|
+
SUB_AGENT_TURN_GENERATION_STEPS_MIN,
|
|
1005
|
+
VALIDATION_AGENT_PROMPT_MAX_CHARS,
|
|
1006
|
+
VALIDATION_SUB_AGENT_PROMPT_MAX_CHARS
|
|
1007
|
+
} = schemaValidationDefaults;
|
|
965
1008
|
var StopWhenSchema = zodOpenapi.z.object({
|
|
966
|
-
transferCountIs: zodOpenapi.z.number().min(
|
|
967
|
-
stepCountIs: zodOpenapi.z.number().min(
|
|
1009
|
+
transferCountIs: zodOpenapi.z.number().min(AGENT_EXECUTION_TRANSFER_COUNT_MIN).max(AGENT_EXECUTION_TRANSFER_COUNT_MAX).optional().describe("The maximum number of transfers to trigger the stop condition."),
|
|
1010
|
+
stepCountIs: zodOpenapi.z.number().min(SUB_AGENT_TURN_GENERATION_STEPS_MIN).max(SUB_AGENT_TURN_GENERATION_STEPS_MAX).optional().describe("The maximum number of steps to trigger the stop condition.")
|
|
968
1011
|
}).openapi("StopWhen");
|
|
969
1012
|
var AgentStopWhenSchema = StopWhenSchema.pick({ transferCountIs: true }).openapi(
|
|
970
1013
|
"AgentStopWhen"
|
|
@@ -1083,7 +1126,8 @@ createApiInsertSchema(
|
|
|
1083
1126
|
);
|
|
1084
1127
|
var AgentSelectSchema = drizzleZod.createSelectSchema(agents);
|
|
1085
1128
|
var AgentInsertSchema = drizzleZod.createInsertSchema(agents).extend({
|
|
1086
|
-
id: resourceIdSchema
|
|
1129
|
+
id: resourceIdSchema,
|
|
1130
|
+
name: zodOpenapi.z.string().trim().nonempty()
|
|
1087
1131
|
});
|
|
1088
1132
|
var AgentUpdateSchema = AgentInsertSchema.partial();
|
|
1089
1133
|
var AgentApiSelectSchema = createApiSchema(AgentSelectSchema).openapi("Agent");
|
|
@@ -1443,7 +1487,7 @@ var FetchConfigSchema = zodOpenapi.z.object({
|
|
|
1443
1487
|
body: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.unknown()).optional(),
|
|
1444
1488
|
transform: zodOpenapi.z.string().optional(),
|
|
1445
1489
|
// JSONPath or JS transform function
|
|
1446
|
-
timeout: zodOpenapi.z.number().min(0).optional().default(
|
|
1490
|
+
timeout: zodOpenapi.z.number().min(0).optional().default(CONTEXT_FETCHER_HTTP_TIMEOUT_MS_DEFAULT).optional()
|
|
1447
1491
|
}).openapi("FetchConfig");
|
|
1448
1492
|
zodOpenapi.z.object({
|
|
1449
1493
|
id: zodOpenapi.z.string().min(1, "Fetch definition ID is required"),
|
|
@@ -1562,9 +1606,12 @@ var StatusComponentSchema = zodOpenapi.z.object({
|
|
|
1562
1606
|
}).openapi("StatusComponent");
|
|
1563
1607
|
var StatusUpdateSchema = zodOpenapi.z.object({
|
|
1564
1608
|
enabled: zodOpenapi.z.boolean().optional(),
|
|
1565
|
-
numEvents: zodOpenapi.z.number().min(1).max(
|
|
1566
|
-
timeInSeconds: zodOpenapi.z.number().min(1).max(
|
|
1567
|
-
prompt: zodOpenapi.z.string().max(
|
|
1609
|
+
numEvents: zodOpenapi.z.number().min(1).max(STATUS_UPDATE_MAX_NUM_EVENTS).optional(),
|
|
1610
|
+
timeInSeconds: zodOpenapi.z.number().min(1).max(STATUS_UPDATE_MAX_INTERVAL_SECONDS).optional(),
|
|
1611
|
+
prompt: zodOpenapi.z.string().max(
|
|
1612
|
+
VALIDATION_SUB_AGENT_PROMPT_MAX_CHARS,
|
|
1613
|
+
`Custom prompt cannot exceed ${VALIDATION_SUB_AGENT_PROMPT_MAX_CHARS} characters`
|
|
1614
|
+
).optional(),
|
|
1568
1615
|
statusComponents: zodOpenapi.z.array(StatusComponentSchema).optional()
|
|
1569
1616
|
}).openapi("StatusUpdate");
|
|
1570
1617
|
var CanUseItemSchema = zodOpenapi.z.object({
|
|
@@ -1595,6 +1642,7 @@ var FullAgentAgentInsertSchema = SubAgentApiInsertSchema.extend({
|
|
|
1595
1642
|
dataComponents: zodOpenapi.z.array(zodOpenapi.z.string()).optional(),
|
|
1596
1643
|
artifactComponents: zodOpenapi.z.array(zodOpenapi.z.string()).optional(),
|
|
1597
1644
|
canTransferTo: zodOpenapi.z.array(zodOpenapi.z.string()).optional(),
|
|
1645
|
+
prompt: zodOpenapi.z.string().trim().nonempty(),
|
|
1598
1646
|
canDelegateTo: zodOpenapi.z.array(
|
|
1599
1647
|
zodOpenapi.z.union([
|
|
1600
1648
|
zodOpenapi.z.string(),
|
|
@@ -1623,7 +1671,10 @@ var AgentWithinContextOfProjectSchema = AgentApiInsertSchema.extend({
|
|
|
1623
1671
|
statusUpdates: zodOpenapi.z.optional(StatusUpdateSchema),
|
|
1624
1672
|
models: ModelSchema.optional(),
|
|
1625
1673
|
stopWhen: AgentStopWhenSchema.optional(),
|
|
1626
|
-
prompt: zodOpenapi.z.string().max(
|
|
1674
|
+
prompt: zodOpenapi.z.string().max(
|
|
1675
|
+
VALIDATION_AGENT_PROMPT_MAX_CHARS,
|
|
1676
|
+
`Agent prompt cannot exceed ${VALIDATION_AGENT_PROMPT_MAX_CHARS} characters`
|
|
1677
|
+
).optional()
|
|
1627
1678
|
});
|
|
1628
1679
|
var PaginationSchema = zodOpenapi.z.object({
|
|
1629
1680
|
page: zodOpenapi.z.coerce.number().min(1).default(1),
|
|
@@ -2268,6 +2319,14 @@ var detectAuthenticationRequired = async ({
|
|
|
2268
2319
|
};
|
|
2269
2320
|
|
|
2270
2321
|
// src/client-exports.ts
|
|
2322
|
+
var {
|
|
2323
|
+
AGENT_EXECUTION_TRANSFER_COUNT_MAX: AGENT_EXECUTION_TRANSFER_COUNT_MAX2,
|
|
2324
|
+
AGENT_EXECUTION_TRANSFER_COUNT_MIN: AGENT_EXECUTION_TRANSFER_COUNT_MIN2,
|
|
2325
|
+
STATUS_UPDATE_MAX_INTERVAL_SECONDS: STATUS_UPDATE_MAX_INTERVAL_SECONDS2,
|
|
2326
|
+
STATUS_UPDATE_MAX_NUM_EVENTS: STATUS_UPDATE_MAX_NUM_EVENTS2,
|
|
2327
|
+
VALIDATION_AGENT_PROMPT_MAX_CHARS: VALIDATION_AGENT_PROMPT_MAX_CHARS2,
|
|
2328
|
+
VALIDATION_SUB_AGENT_PROMPT_MAX_CHARS: VALIDATION_SUB_AGENT_PROMPT_MAX_CHARS2
|
|
2329
|
+
} = schemaValidationDefaults;
|
|
2271
2330
|
var TenantParamsSchema2 = zod.z.object({
|
|
2272
2331
|
tenantId: zod.z.string()
|
|
2273
2332
|
});
|
|
@@ -2399,14 +2458,14 @@ var FullAgentDefinitionSchema = AgentAgentApiInsertSchema.extend({
|
|
|
2399
2458
|
}).optional()
|
|
2400
2459
|
}).optional(),
|
|
2401
2460
|
stopWhen: zod.z.object({
|
|
2402
|
-
transferCountIs: zod.z.number().min(
|
|
2461
|
+
transferCountIs: zod.z.number().min(AGENT_EXECUTION_TRANSFER_COUNT_MIN2).max(AGENT_EXECUTION_TRANSFER_COUNT_MAX2).optional()
|
|
2403
2462
|
}).optional(),
|
|
2404
|
-
prompt: zod.z.string().max(
|
|
2463
|
+
prompt: zod.z.string().max(VALIDATION_AGENT_PROMPT_MAX_CHARS2).optional(),
|
|
2405
2464
|
statusUpdates: zod.z.object({
|
|
2406
2465
|
enabled: zod.z.boolean().optional(),
|
|
2407
|
-
numEvents: zod.z.number().min(1).max(
|
|
2408
|
-
timeInSeconds: zod.z.number().min(1).max(
|
|
2409
|
-
prompt: zod.z.string().max(
|
|
2466
|
+
numEvents: zod.z.number().min(1).max(STATUS_UPDATE_MAX_NUM_EVENTS2).optional(),
|
|
2467
|
+
timeInSeconds: zod.z.number().min(1).max(STATUS_UPDATE_MAX_INTERVAL_SECONDS2).optional(),
|
|
2468
|
+
prompt: zod.z.string().max(VALIDATION_SUB_AGENT_PROMPT_MAX_CHARS2).optional(),
|
|
2410
2469
|
statusComponents: zod.z.array(
|
|
2411
2470
|
zod.z.object({
|
|
2412
2471
|
type: zod.z.string(),
|