@inkeep/agents-core 0.35.1 → 0.35.2
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/auth/auth-schema.d.ts +1097 -0
- package/dist/auth/auth-schema.js +1 -0
- package/dist/auth/auth-validation-schemas.d.ts +1881 -0
- package/dist/auth/auth-validation-schemas.js +39 -0
- package/dist/auth/auth.d.ts +118 -0
- package/dist/auth/auth.js +95 -0
- package/dist/auth/permissions.d.ts +273 -0
- package/dist/auth/permissions.js +1 -0
- package/dist/chunk-4JZT4QEE.js +162 -0
- package/dist/chunk-F5WWOOIX.js +62 -0
- package/dist/{chunk-YZ5ZBVHJ.js → chunk-NFYCSHD3.js} +3 -81
- package/dist/chunk-NOPEANIU.js +82 -0
- package/dist/{chunk-J5AHY6M2.js → chunk-SPRTYWRV.js} +1 -1
- package/dist/{chunk-OP3KPT4T.js → chunk-TGESM3JG.js} +1 -160
- package/dist/{chunk-DYGTCLJO.js → chunk-VBCCPAZK.js} +1 -1
- package/dist/chunk-ZYSTJ4XY.js +948 -0
- package/dist/client-CPYOMZF2.d.ts +19 -0
- package/dist/client-exports.js +4 -3
- package/dist/db/schema.d.ts +2 -1
- package/dist/db/schema.js +2 -1
- package/dist/index.d.ts +9 -154
- package/dist/index.js +1565 -2498
- package/dist/{schema-BWd551GM.d.ts → schema-5N2lPWNV.d.ts} +2 -1095
- package/dist/validation/index.js +2 -2
- package/package.json +17 -1
- package/dist/auth-detection-CGqhPDnj.d.cts +0 -435
- package/dist/client-exports.cjs +0 -2833
- package/dist/client-exports.d.cts +0 -289
- package/dist/constants/models.cjs +0 -40
- package/dist/constants/models.d.cts +0 -42
- package/dist/db/schema.cjs +0 -1090
- package/dist/db/schema.d.cts +0 -7
- package/dist/index.cjs +0 -227898
- package/dist/index.d.cts +0 -4893
- package/dist/props-validation-BMR1qNiy.d.cts +0 -15
- package/dist/schema-D4WR42em.d.cts +0 -6352
- package/dist/types/index.cjs +0 -39
- package/dist/types/index.d.cts +0 -132
- package/dist/utility-DbltUp2Q.d.cts +0 -17079
- package/dist/utils/schema-conversion.cjs +0 -232
- package/dist/utils/schema-conversion.d.cts +0 -26
- package/dist/validation/index.cjs +0 -2930
- package/dist/validation/index.d.cts +0 -279
|
@@ -1,2930 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var zodOpenapi = require('@hono/zod-openapi');
|
|
4
|
-
var drizzleOrm = require('drizzle-orm');
|
|
5
|
-
var pgCore = require('drizzle-orm/pg-core');
|
|
6
|
-
var drizzleZod = require('drizzle-zod');
|
|
7
|
-
var zod = require('zod');
|
|
8
|
-
var Ajv = require('ajv');
|
|
9
|
-
|
|
10
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
-
|
|
12
|
-
var Ajv__default = /*#__PURE__*/_interopDefault(Ajv);
|
|
13
|
-
|
|
14
|
-
// src/validation/cycleDetection.ts
|
|
15
|
-
function detectDelegationCycles(agentData) {
|
|
16
|
-
const graph = buildDelegationGraph(agentData);
|
|
17
|
-
const cycles = [];
|
|
18
|
-
const visited = /* @__PURE__ */ new Set();
|
|
19
|
-
const stack = /* @__PURE__ */ new Set();
|
|
20
|
-
const path = [];
|
|
21
|
-
function dfs(node) {
|
|
22
|
-
visited.add(node);
|
|
23
|
-
stack.add(node);
|
|
24
|
-
path.push(node);
|
|
25
|
-
for (const neighbor of graph.get(node) || []) {
|
|
26
|
-
if (!visited.has(neighbor)) {
|
|
27
|
-
if (dfs(neighbor)) return true;
|
|
28
|
-
} else if (stack.has(neighbor)) {
|
|
29
|
-
const cycleStart = path.indexOf(neighbor);
|
|
30
|
-
cycles.push(
|
|
31
|
-
`Circular delegation detected: ${[...path.slice(cycleStart), neighbor].join(" \u2192 ")}`
|
|
32
|
-
);
|
|
33
|
-
return true;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
stack.delete(node);
|
|
37
|
-
path.pop();
|
|
38
|
-
return false;
|
|
39
|
-
}
|
|
40
|
-
for (const node of graph.keys()) {
|
|
41
|
-
if (!visited.has(node)) {
|
|
42
|
-
path.length = 0;
|
|
43
|
-
dfs(node);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
return cycles;
|
|
47
|
-
}
|
|
48
|
-
function buildDelegationGraph(agentData) {
|
|
49
|
-
const graph = /* @__PURE__ */ new Map();
|
|
50
|
-
for (const [subAgentId, subAgent] of Object.entries(agentData.subAgents)) {
|
|
51
|
-
const delegates = subAgent.canDelegateTo?.filter((d) => typeof d === "string");
|
|
52
|
-
if (delegates?.length) {
|
|
53
|
-
graph.set(subAgentId, delegates);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
return graph;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
// src/constants/schema-validation/defaults.ts
|
|
60
|
-
var schemaValidationDefaults = {
|
|
61
|
-
// Agent Execution Transfer Count
|
|
62
|
-
// Controls how many times an agent can transfer control to sub-agents in a single conversation turn.
|
|
63
|
-
// This prevents infinite transfer loops while allowing multi-agent collaboration workflows.
|
|
64
|
-
AGENT_EXECUTION_TRANSFER_COUNT_MIN: 1,
|
|
65
|
-
AGENT_EXECUTION_TRANSFER_COUNT_MAX: 1e3,
|
|
66
|
-
// Sub-Agent Turn Generation Steps
|
|
67
|
-
// Limits how many AI generation steps a sub-agent can perform within a single turn.
|
|
68
|
-
// Each generation step typically involves sending a prompt to the LLM and processing its response.
|
|
69
|
-
// This prevents runaway token usage while allowing complex multi-step reasoning.
|
|
70
|
-
SUB_AGENT_TURN_GENERATION_STEPS_MIN: 1,
|
|
71
|
-
SUB_AGENT_TURN_GENERATION_STEPS_MAX: 1e3,
|
|
72
|
-
// Status Update Thresholds
|
|
73
|
-
// Real-time status updates are triggered when either threshold is exceeded during longer operations.
|
|
74
|
-
// MAX_NUM_EVENTS: Maximum number of internal events before forcing a status update to the client.
|
|
75
|
-
// MAX_INTERVAL_SECONDS: Maximum time between status updates regardless of event count.
|
|
76
|
-
STATUS_UPDATE_MAX_NUM_EVENTS: 100,
|
|
77
|
-
STATUS_UPDATE_MAX_INTERVAL_SECONDS: 600,
|
|
78
|
-
// 10 minutes
|
|
79
|
-
// Prompt Text Length Validation
|
|
80
|
-
// Maximum character limits for agent and sub-agent system prompts to prevent excessive token usage.
|
|
81
|
-
// Enforced during agent configuration to ensure prompts remain focused and manageable.
|
|
82
|
-
VALIDATION_SUB_AGENT_PROMPT_MAX_CHARS: 2e3,
|
|
83
|
-
VALIDATION_AGENT_PROMPT_MAX_CHARS: 5e3,
|
|
84
|
-
// Context Fetcher HTTP Timeout
|
|
85
|
-
// Maximum time allowed for HTTP requests made by Context Fetchers (e.g., CRM lookups, external API calls).
|
|
86
|
-
// Context Fetchers automatically retrieve external data at the start of a conversation to enrich agent context.
|
|
87
|
-
CONTEXT_FETCHER_HTTP_TIMEOUT_MS_DEFAULT: 1e4
|
|
88
|
-
// 10 seconds
|
|
89
|
-
};
|
|
90
|
-
var user = pgCore.pgTable("user", {
|
|
91
|
-
id: pgCore.text("id").primaryKey(),
|
|
92
|
-
name: pgCore.text("name").notNull(),
|
|
93
|
-
email: pgCore.text("email").notNull().unique(),
|
|
94
|
-
emailVerified: pgCore.boolean("email_verified").default(false).notNull(),
|
|
95
|
-
image: pgCore.text("image"),
|
|
96
|
-
createdAt: pgCore.timestamp("created_at").defaultNow().notNull(),
|
|
97
|
-
updatedAt: pgCore.timestamp("updated_at").defaultNow().$onUpdate(() => /* @__PURE__ */ new Date()).notNull()
|
|
98
|
-
});
|
|
99
|
-
pgCore.pgTable("session", {
|
|
100
|
-
id: pgCore.text("id").primaryKey(),
|
|
101
|
-
expiresAt: pgCore.timestamp("expires_at").notNull(),
|
|
102
|
-
token: pgCore.text("token").notNull().unique(),
|
|
103
|
-
createdAt: pgCore.timestamp("created_at").defaultNow().notNull(),
|
|
104
|
-
updatedAt: pgCore.timestamp("updated_at").$onUpdate(() => /* @__PURE__ */ new Date()).notNull(),
|
|
105
|
-
ipAddress: pgCore.text("ip_address"),
|
|
106
|
-
userAgent: pgCore.text("user_agent"),
|
|
107
|
-
userId: pgCore.text("user_id").notNull().references(() => user.id, { onDelete: "cascade" }),
|
|
108
|
-
activeOrganizationId: pgCore.text("active_organization_id")
|
|
109
|
-
});
|
|
110
|
-
pgCore.pgTable("account", {
|
|
111
|
-
id: pgCore.text("id").primaryKey(),
|
|
112
|
-
accountId: pgCore.text("account_id").notNull(),
|
|
113
|
-
providerId: pgCore.text("provider_id").notNull(),
|
|
114
|
-
userId: pgCore.text("user_id").notNull().references(() => user.id, { onDelete: "cascade" }),
|
|
115
|
-
accessToken: pgCore.text("access_token"),
|
|
116
|
-
refreshToken: pgCore.text("refresh_token"),
|
|
117
|
-
idToken: pgCore.text("id_token"),
|
|
118
|
-
accessTokenExpiresAt: pgCore.timestamp("access_token_expires_at"),
|
|
119
|
-
refreshTokenExpiresAt: pgCore.timestamp("refresh_token_expires_at"),
|
|
120
|
-
scope: pgCore.text("scope"),
|
|
121
|
-
password: pgCore.text("password"),
|
|
122
|
-
createdAt: pgCore.timestamp("created_at").defaultNow().notNull(),
|
|
123
|
-
updatedAt: pgCore.timestamp("updated_at").$onUpdate(() => /* @__PURE__ */ new Date()).notNull()
|
|
124
|
-
});
|
|
125
|
-
pgCore.pgTable("verification", {
|
|
126
|
-
id: pgCore.text("id").primaryKey(),
|
|
127
|
-
identifier: pgCore.text("identifier").notNull(),
|
|
128
|
-
value: pgCore.text("value").notNull(),
|
|
129
|
-
expiresAt: pgCore.timestamp("expires_at").notNull(),
|
|
130
|
-
createdAt: pgCore.timestamp("created_at").defaultNow().notNull(),
|
|
131
|
-
updatedAt: pgCore.timestamp("updated_at").defaultNow().$onUpdate(() => /* @__PURE__ */ new Date()).notNull()
|
|
132
|
-
});
|
|
133
|
-
pgCore.pgTable("sso_provider", {
|
|
134
|
-
id: pgCore.text("id").primaryKey(),
|
|
135
|
-
issuer: pgCore.text("issuer").notNull(),
|
|
136
|
-
oidcConfig: pgCore.text("oidc_config"),
|
|
137
|
-
samlConfig: pgCore.text("saml_config"),
|
|
138
|
-
userId: pgCore.text("user_id").references(() => user.id, { onDelete: "cascade" }),
|
|
139
|
-
providerId: pgCore.text("provider_id").notNull().unique(),
|
|
140
|
-
organizationId: pgCore.text("organization_id"),
|
|
141
|
-
domain: pgCore.text("domain").notNull()
|
|
142
|
-
});
|
|
143
|
-
var organization = pgCore.pgTable("organization", {
|
|
144
|
-
id: pgCore.text("id").primaryKey(),
|
|
145
|
-
name: pgCore.text("name").notNull(),
|
|
146
|
-
slug: pgCore.text("slug").notNull().unique(),
|
|
147
|
-
logo: pgCore.text("logo"),
|
|
148
|
-
createdAt: pgCore.timestamp("created_at").notNull(),
|
|
149
|
-
metadata: pgCore.text("metadata")
|
|
150
|
-
});
|
|
151
|
-
pgCore.pgTable("member", {
|
|
152
|
-
id: pgCore.text("id").primaryKey(),
|
|
153
|
-
organizationId: pgCore.text("organization_id").notNull().references(() => organization.id, { onDelete: "cascade" }),
|
|
154
|
-
userId: pgCore.text("user_id").notNull().references(() => user.id, { onDelete: "cascade" }),
|
|
155
|
-
role: pgCore.text("role").default("member").notNull(),
|
|
156
|
-
createdAt: pgCore.timestamp("created_at").notNull()
|
|
157
|
-
});
|
|
158
|
-
pgCore.pgTable("invitation", {
|
|
159
|
-
id: pgCore.text("id").primaryKey(),
|
|
160
|
-
organizationId: pgCore.text("organization_id").notNull().references(() => organization.id, { onDelete: "cascade" }),
|
|
161
|
-
email: pgCore.text("email").notNull(),
|
|
162
|
-
role: pgCore.text("role"),
|
|
163
|
-
status: pgCore.text("status").default("pending").notNull(),
|
|
164
|
-
expiresAt: pgCore.timestamp("expires_at").notNull(),
|
|
165
|
-
inviterId: pgCore.text("inviter_id").notNull().references(() => user.id, { onDelete: "cascade" })
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
// src/db/schema.ts
|
|
169
|
-
var tenantScoped = {
|
|
170
|
-
tenantId: pgCore.varchar("tenant_id", { length: 256 }).notNull(),
|
|
171
|
-
id: pgCore.varchar("id", { length: 256 }).notNull()
|
|
172
|
-
};
|
|
173
|
-
var projectScoped = {
|
|
174
|
-
...tenantScoped,
|
|
175
|
-
projectId: pgCore.varchar("project_id", { length: 256 }).notNull()
|
|
176
|
-
};
|
|
177
|
-
var agentScoped = {
|
|
178
|
-
...projectScoped,
|
|
179
|
-
agentId: pgCore.varchar("agent_id", { length: 256 }).notNull()
|
|
180
|
-
};
|
|
181
|
-
var subAgentScoped = {
|
|
182
|
-
...agentScoped,
|
|
183
|
-
subAgentId: pgCore.varchar("sub_agent_id", { length: 256 }).notNull()
|
|
184
|
-
};
|
|
185
|
-
var uiProperties = {
|
|
186
|
-
name: pgCore.varchar("name", { length: 256 }).notNull(),
|
|
187
|
-
description: pgCore.text("description").notNull()
|
|
188
|
-
};
|
|
189
|
-
var timestamps = {
|
|
190
|
-
createdAt: pgCore.timestamp("created_at", { mode: "string" }).notNull().defaultNow(),
|
|
191
|
-
updatedAt: pgCore.timestamp("updated_at", { mode: "string" }).notNull().defaultNow()
|
|
192
|
-
};
|
|
193
|
-
var projects = pgCore.pgTable(
|
|
194
|
-
"projects",
|
|
195
|
-
{
|
|
196
|
-
...tenantScoped,
|
|
197
|
-
...uiProperties,
|
|
198
|
-
models: pgCore.jsonb("models").$type(),
|
|
199
|
-
stopWhen: pgCore.jsonb("stop_when").$type(),
|
|
200
|
-
...timestamps
|
|
201
|
-
},
|
|
202
|
-
(table) => [
|
|
203
|
-
pgCore.primaryKey({ columns: [table.tenantId, table.id] }),
|
|
204
|
-
pgCore.foreignKey({
|
|
205
|
-
columns: [table.tenantId],
|
|
206
|
-
foreignColumns: [organization.id],
|
|
207
|
-
name: "projects_tenant_id_fk"
|
|
208
|
-
}).onDelete("cascade")
|
|
209
|
-
]
|
|
210
|
-
);
|
|
211
|
-
var agents = pgCore.pgTable(
|
|
212
|
-
"agent",
|
|
213
|
-
{
|
|
214
|
-
...projectScoped,
|
|
215
|
-
name: pgCore.varchar("name", { length: 256 }).notNull(),
|
|
216
|
-
description: pgCore.text("description"),
|
|
217
|
-
defaultSubAgentId: pgCore.varchar("default_sub_agent_id", { length: 256 }),
|
|
218
|
-
contextConfigId: pgCore.varchar("context_config_id", { length: 256 }),
|
|
219
|
-
models: pgCore.jsonb("models").$type(),
|
|
220
|
-
statusUpdates: pgCore.jsonb("status_updates").$type(),
|
|
221
|
-
prompt: pgCore.text("prompt"),
|
|
222
|
-
stopWhen: pgCore.jsonb("stop_when").$type(),
|
|
223
|
-
...timestamps
|
|
224
|
-
},
|
|
225
|
-
(table) => [
|
|
226
|
-
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
227
|
-
pgCore.foreignKey({
|
|
228
|
-
columns: [table.tenantId, table.projectId],
|
|
229
|
-
foreignColumns: [projects.tenantId, projects.id],
|
|
230
|
-
name: "agent_project_fk"
|
|
231
|
-
}).onDelete("cascade")
|
|
232
|
-
]
|
|
233
|
-
);
|
|
234
|
-
var contextConfigs = pgCore.pgTable(
|
|
235
|
-
"context_configs",
|
|
236
|
-
{
|
|
237
|
-
...agentScoped,
|
|
238
|
-
headersSchema: pgCore.jsonb("headers_schema").$type(),
|
|
239
|
-
contextVariables: pgCore.jsonb("context_variables").$type(),
|
|
240
|
-
...timestamps
|
|
241
|
-
},
|
|
242
|
-
(table) => [
|
|
243
|
-
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.agentId, table.id] }),
|
|
244
|
-
pgCore.foreignKey({
|
|
245
|
-
columns: [table.tenantId, table.projectId, table.agentId],
|
|
246
|
-
foreignColumns: [agents.tenantId, agents.projectId, agents.id],
|
|
247
|
-
name: "context_configs_agent_fk"
|
|
248
|
-
}).onDelete("cascade")
|
|
249
|
-
]
|
|
250
|
-
);
|
|
251
|
-
var contextCache = pgCore.pgTable(
|
|
252
|
-
"context_cache",
|
|
253
|
-
{
|
|
254
|
-
...projectScoped,
|
|
255
|
-
conversationId: pgCore.varchar("conversation_id", { length: 256 }).notNull(),
|
|
256
|
-
contextConfigId: pgCore.varchar("context_config_id", { length: 256 }).notNull(),
|
|
257
|
-
contextVariableKey: pgCore.varchar("context_variable_key", { length: 256 }).notNull(),
|
|
258
|
-
value: pgCore.jsonb("value").$type().notNull(),
|
|
259
|
-
requestHash: pgCore.varchar("request_hash", { length: 256 }),
|
|
260
|
-
fetchedAt: pgCore.timestamp("fetched_at", { mode: "string" }).notNull().defaultNow(),
|
|
261
|
-
fetchSource: pgCore.varchar("fetch_source", { length: 256 }),
|
|
262
|
-
fetchDurationMs: pgCore.integer("fetch_duration_ms"),
|
|
263
|
-
...timestamps
|
|
264
|
-
},
|
|
265
|
-
(table) => [
|
|
266
|
-
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
267
|
-
pgCore.foreignKey({
|
|
268
|
-
columns: [table.tenantId, table.projectId],
|
|
269
|
-
foreignColumns: [projects.tenantId, projects.id],
|
|
270
|
-
name: "context_cache_project_fk"
|
|
271
|
-
}).onDelete("cascade"),
|
|
272
|
-
pgCore.index("context_cache_lookup_idx").on(
|
|
273
|
-
table.conversationId,
|
|
274
|
-
table.contextConfigId,
|
|
275
|
-
table.contextVariableKey
|
|
276
|
-
)
|
|
277
|
-
]
|
|
278
|
-
);
|
|
279
|
-
var subAgents = pgCore.pgTable(
|
|
280
|
-
"sub_agents",
|
|
281
|
-
{
|
|
282
|
-
...agentScoped,
|
|
283
|
-
...uiProperties,
|
|
284
|
-
prompt: pgCore.text("prompt").notNull(),
|
|
285
|
-
conversationHistoryConfig: pgCore.jsonb("conversation_history_config").$type().default({
|
|
286
|
-
mode: "full",
|
|
287
|
-
limit: 50,
|
|
288
|
-
maxOutputTokens: 4e3,
|
|
289
|
-
includeInternal: false,
|
|
290
|
-
messageTypes: ["chat", "tool-result"]
|
|
291
|
-
}),
|
|
292
|
-
models: pgCore.jsonb("models").$type(),
|
|
293
|
-
stopWhen: pgCore.jsonb("stop_when").$type(),
|
|
294
|
-
...timestamps
|
|
295
|
-
},
|
|
296
|
-
(table) => [
|
|
297
|
-
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.agentId, table.id] }),
|
|
298
|
-
pgCore.foreignKey({
|
|
299
|
-
columns: [table.tenantId, table.projectId, table.agentId],
|
|
300
|
-
foreignColumns: [agents.tenantId, agents.projectId, agents.id],
|
|
301
|
-
name: "sub_agents_agents_fk"
|
|
302
|
-
}).onDelete("cascade")
|
|
303
|
-
]
|
|
304
|
-
);
|
|
305
|
-
var subAgentRelations = pgCore.pgTable(
|
|
306
|
-
"sub_agent_relations",
|
|
307
|
-
{
|
|
308
|
-
...agentScoped,
|
|
309
|
-
sourceSubAgentId: pgCore.varchar("source_sub_agent_id", { length: 256 }).notNull(),
|
|
310
|
-
targetSubAgentId: pgCore.varchar("target_sub_agent_id", { length: 256 }),
|
|
311
|
-
relationType: pgCore.varchar("relation_type", { length: 256 }),
|
|
312
|
-
...timestamps
|
|
313
|
-
},
|
|
314
|
-
(table) => [
|
|
315
|
-
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.agentId, table.id] }),
|
|
316
|
-
pgCore.foreignKey({
|
|
317
|
-
columns: [table.tenantId, table.projectId, table.agentId],
|
|
318
|
-
foreignColumns: [agents.tenantId, agents.projectId, agents.id],
|
|
319
|
-
name: "sub_agent_relations_agent_fk"
|
|
320
|
-
}).onDelete("cascade")
|
|
321
|
-
]
|
|
322
|
-
);
|
|
323
|
-
var externalAgents = pgCore.pgTable(
|
|
324
|
-
"external_agents",
|
|
325
|
-
{
|
|
326
|
-
...projectScoped,
|
|
327
|
-
...uiProperties,
|
|
328
|
-
baseUrl: pgCore.text("base_url").notNull(),
|
|
329
|
-
credentialReferenceId: pgCore.varchar("credential_reference_id", { length: 256 }),
|
|
330
|
-
...timestamps
|
|
331
|
-
},
|
|
332
|
-
(table) => [
|
|
333
|
-
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
334
|
-
pgCore.foreignKey({
|
|
335
|
-
columns: [table.tenantId, table.projectId],
|
|
336
|
-
foreignColumns: [projects.tenantId, projects.id],
|
|
337
|
-
name: "external_agents_project_fk"
|
|
338
|
-
}).onDelete("cascade"),
|
|
339
|
-
pgCore.foreignKey({
|
|
340
|
-
columns: [table.tenantId, table.projectId, table.credentialReferenceId],
|
|
341
|
-
foreignColumns: [
|
|
342
|
-
credentialReferences.tenantId,
|
|
343
|
-
credentialReferences.projectId,
|
|
344
|
-
credentialReferences.id
|
|
345
|
-
],
|
|
346
|
-
name: "external_agents_credential_reference_fk"
|
|
347
|
-
}).onDelete("cascade")
|
|
348
|
-
]
|
|
349
|
-
);
|
|
350
|
-
var tasks = pgCore.pgTable(
|
|
351
|
-
"tasks",
|
|
352
|
-
{
|
|
353
|
-
...subAgentScoped,
|
|
354
|
-
contextId: pgCore.varchar("context_id", { length: 256 }).notNull(),
|
|
355
|
-
status: pgCore.varchar("status", { length: 256 }).notNull(),
|
|
356
|
-
metadata: pgCore.jsonb("metadata").$type(),
|
|
357
|
-
...timestamps
|
|
358
|
-
},
|
|
359
|
-
(table) => [
|
|
360
|
-
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
361
|
-
pgCore.foreignKey({
|
|
362
|
-
columns: [table.tenantId, table.projectId, table.agentId, table.subAgentId],
|
|
363
|
-
foreignColumns: [subAgents.tenantId, subAgents.projectId, subAgents.agentId, subAgents.id],
|
|
364
|
-
name: "tasks_sub_agent_fk"
|
|
365
|
-
}).onDelete("cascade")
|
|
366
|
-
]
|
|
367
|
-
);
|
|
368
|
-
var taskRelations = pgCore.pgTable(
|
|
369
|
-
"task_relations",
|
|
370
|
-
{
|
|
371
|
-
...projectScoped,
|
|
372
|
-
parentTaskId: pgCore.varchar("parent_task_id", { length: 256 }).notNull(),
|
|
373
|
-
childTaskId: pgCore.varchar("child_task_id", { length: 256 }).notNull(),
|
|
374
|
-
relationType: pgCore.varchar("relation_type", { length: 256 }).default("parent_child"),
|
|
375
|
-
...timestamps
|
|
376
|
-
},
|
|
377
|
-
(table) => [
|
|
378
|
-
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
379
|
-
pgCore.foreignKey({
|
|
380
|
-
columns: [table.tenantId, table.projectId],
|
|
381
|
-
foreignColumns: [projects.tenantId, projects.id],
|
|
382
|
-
name: "task_relations_project_fk"
|
|
383
|
-
}).onDelete("cascade")
|
|
384
|
-
]
|
|
385
|
-
);
|
|
386
|
-
var dataComponents = pgCore.pgTable(
|
|
387
|
-
"data_components",
|
|
388
|
-
{
|
|
389
|
-
...projectScoped,
|
|
390
|
-
...uiProperties,
|
|
391
|
-
props: pgCore.jsonb("props").$type(),
|
|
392
|
-
render: pgCore.jsonb("render").$type(),
|
|
393
|
-
...timestamps
|
|
394
|
-
},
|
|
395
|
-
(table) => [
|
|
396
|
-
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
397
|
-
pgCore.foreignKey({
|
|
398
|
-
columns: [table.tenantId, table.projectId],
|
|
399
|
-
foreignColumns: [projects.tenantId, projects.id],
|
|
400
|
-
name: "data_components_project_fk"
|
|
401
|
-
}).onDelete("cascade")
|
|
402
|
-
]
|
|
403
|
-
);
|
|
404
|
-
var subAgentDataComponents = pgCore.pgTable(
|
|
405
|
-
"sub_agent_data_components",
|
|
406
|
-
{
|
|
407
|
-
...subAgentScoped,
|
|
408
|
-
dataComponentId: pgCore.varchar("data_component_id", { length: 256 }).notNull(),
|
|
409
|
-
createdAt: pgCore.timestamp("created_at", { mode: "string" }).notNull().defaultNow()
|
|
410
|
-
},
|
|
411
|
-
(table) => [
|
|
412
|
-
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
413
|
-
pgCore.foreignKey({
|
|
414
|
-
columns: [table.tenantId, table.projectId, table.agentId, table.subAgentId],
|
|
415
|
-
foreignColumns: [subAgents.tenantId, subAgents.projectId, subAgents.agentId, subAgents.id],
|
|
416
|
-
name: "sub_agent_data_components_sub_agent_fk"
|
|
417
|
-
}).onDelete("cascade"),
|
|
418
|
-
pgCore.foreignKey({
|
|
419
|
-
columns: [table.tenantId, table.projectId, table.dataComponentId],
|
|
420
|
-
foreignColumns: [dataComponents.tenantId, dataComponents.projectId, dataComponents.id],
|
|
421
|
-
name: "sub_agent_data_components_data_component_fk"
|
|
422
|
-
}).onDelete("cascade")
|
|
423
|
-
]
|
|
424
|
-
);
|
|
425
|
-
var artifactComponents = pgCore.pgTable(
|
|
426
|
-
"artifact_components",
|
|
427
|
-
{
|
|
428
|
-
...projectScoped,
|
|
429
|
-
...uiProperties,
|
|
430
|
-
props: pgCore.jsonb("props").$type(),
|
|
431
|
-
...timestamps
|
|
432
|
-
},
|
|
433
|
-
(table) => [
|
|
434
|
-
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
435
|
-
pgCore.foreignKey({
|
|
436
|
-
columns: [table.tenantId, table.projectId],
|
|
437
|
-
foreignColumns: [projects.tenantId, projects.id],
|
|
438
|
-
name: "artifact_components_project_fk"
|
|
439
|
-
}).onDelete("cascade")
|
|
440
|
-
]
|
|
441
|
-
);
|
|
442
|
-
var subAgentArtifactComponents = pgCore.pgTable(
|
|
443
|
-
"sub_agent_artifact_components",
|
|
444
|
-
{
|
|
445
|
-
...subAgentScoped,
|
|
446
|
-
artifactComponentId: pgCore.varchar("artifact_component_id", { length: 256 }).notNull(),
|
|
447
|
-
createdAt: pgCore.timestamp("created_at", { mode: "string" }).notNull().defaultNow()
|
|
448
|
-
},
|
|
449
|
-
(table) => [
|
|
450
|
-
pgCore.primaryKey({
|
|
451
|
-
columns: [table.tenantId, table.projectId, table.agentId, table.subAgentId, table.id]
|
|
452
|
-
}),
|
|
453
|
-
pgCore.foreignKey({
|
|
454
|
-
columns: [table.tenantId, table.projectId, table.agentId, table.subAgentId],
|
|
455
|
-
foreignColumns: [subAgents.tenantId, subAgents.projectId, subAgents.agentId, subAgents.id],
|
|
456
|
-
name: "sub_agent_artifact_components_sub_agent_fk"
|
|
457
|
-
}).onDelete("cascade"),
|
|
458
|
-
pgCore.foreignKey({
|
|
459
|
-
columns: [table.tenantId, table.projectId, table.artifactComponentId],
|
|
460
|
-
foreignColumns: [
|
|
461
|
-
artifactComponents.tenantId,
|
|
462
|
-
artifactComponents.projectId,
|
|
463
|
-
artifactComponents.id
|
|
464
|
-
],
|
|
465
|
-
name: "sub_agent_artifact_components_artifact_component_fk"
|
|
466
|
-
}).onDelete("cascade")
|
|
467
|
-
]
|
|
468
|
-
);
|
|
469
|
-
var tools = pgCore.pgTable(
|
|
470
|
-
"tools",
|
|
471
|
-
{
|
|
472
|
-
...projectScoped,
|
|
473
|
-
name: pgCore.varchar("name", { length: 256 }).notNull(),
|
|
474
|
-
description: pgCore.text("description"),
|
|
475
|
-
config: pgCore.jsonb("config").$type().notNull(),
|
|
476
|
-
credentialReferenceId: pgCore.varchar("credential_reference_id", { length: 256 }),
|
|
477
|
-
headers: pgCore.jsonb("headers").$type(),
|
|
478
|
-
imageUrl: pgCore.text("image_url"),
|
|
479
|
-
capabilities: pgCore.jsonb("capabilities").$type(),
|
|
480
|
-
lastError: pgCore.text("last_error"),
|
|
481
|
-
...timestamps
|
|
482
|
-
},
|
|
483
|
-
(table) => [
|
|
484
|
-
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
485
|
-
pgCore.foreignKey({
|
|
486
|
-
columns: [table.tenantId, table.projectId],
|
|
487
|
-
foreignColumns: [projects.tenantId, projects.id],
|
|
488
|
-
name: "tools_project_fk"
|
|
489
|
-
}).onDelete("cascade")
|
|
490
|
-
]
|
|
491
|
-
);
|
|
492
|
-
var functionTools = pgCore.pgTable(
|
|
493
|
-
"function_tools",
|
|
494
|
-
{
|
|
495
|
-
...agentScoped,
|
|
496
|
-
name: pgCore.varchar("name", { length: 256 }).notNull(),
|
|
497
|
-
description: pgCore.text("description"),
|
|
498
|
-
functionId: pgCore.varchar("function_id", { length: 256 }).notNull(),
|
|
499
|
-
...timestamps
|
|
500
|
-
},
|
|
501
|
-
(table) => [
|
|
502
|
-
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.agentId, table.id] }),
|
|
503
|
-
pgCore.foreignKey({
|
|
504
|
-
columns: [table.tenantId, table.projectId, table.agentId],
|
|
505
|
-
foreignColumns: [agents.tenantId, agents.projectId, agents.id],
|
|
506
|
-
name: "function_tools_agent_fk"
|
|
507
|
-
}).onDelete("cascade"),
|
|
508
|
-
pgCore.foreignKey({
|
|
509
|
-
columns: [table.tenantId, table.projectId, table.functionId],
|
|
510
|
-
foreignColumns: [functions.tenantId, functions.projectId, functions.id],
|
|
511
|
-
name: "function_tools_function_fk"
|
|
512
|
-
}).onDelete("cascade")
|
|
513
|
-
]
|
|
514
|
-
);
|
|
515
|
-
var functions = pgCore.pgTable(
|
|
516
|
-
"functions",
|
|
517
|
-
{
|
|
518
|
-
...projectScoped,
|
|
519
|
-
inputSchema: pgCore.jsonb("input_schema").$type(),
|
|
520
|
-
executeCode: pgCore.text("execute_code").notNull(),
|
|
521
|
-
dependencies: pgCore.jsonb("dependencies").$type(),
|
|
522
|
-
...timestamps
|
|
523
|
-
},
|
|
524
|
-
(table) => [
|
|
525
|
-
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
526
|
-
pgCore.foreignKey({
|
|
527
|
-
columns: [table.tenantId, table.projectId],
|
|
528
|
-
foreignColumns: [projects.tenantId, projects.id],
|
|
529
|
-
name: "functions_project_fk"
|
|
530
|
-
}).onDelete("cascade")
|
|
531
|
-
]
|
|
532
|
-
);
|
|
533
|
-
var subAgentToolRelations = pgCore.pgTable(
|
|
534
|
-
"sub_agent_tool_relations",
|
|
535
|
-
{
|
|
536
|
-
...subAgentScoped,
|
|
537
|
-
toolId: pgCore.varchar("tool_id", { length: 256 }).notNull(),
|
|
538
|
-
selectedTools: pgCore.jsonb("selected_tools").$type(),
|
|
539
|
-
headers: pgCore.jsonb("headers").$type(),
|
|
540
|
-
...timestamps
|
|
541
|
-
},
|
|
542
|
-
(table) => [
|
|
543
|
-
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.agentId, table.id] }),
|
|
544
|
-
pgCore.foreignKey({
|
|
545
|
-
columns: [table.tenantId, table.projectId, table.agentId, table.subAgentId],
|
|
546
|
-
foreignColumns: [subAgents.tenantId, subAgents.projectId, subAgents.agentId, subAgents.id],
|
|
547
|
-
name: "sub_agent_tool_relations_agent_fk"
|
|
548
|
-
}).onDelete("cascade"),
|
|
549
|
-
pgCore.foreignKey({
|
|
550
|
-
columns: [table.tenantId, table.projectId, table.toolId],
|
|
551
|
-
foreignColumns: [tools.tenantId, tools.projectId, tools.id],
|
|
552
|
-
name: "sub_agent_tool_relations_tool_fk"
|
|
553
|
-
}).onDelete("cascade")
|
|
554
|
-
]
|
|
555
|
-
);
|
|
556
|
-
var subAgentExternalAgentRelations = pgCore.pgTable(
|
|
557
|
-
"sub_agent_external_agent_relations",
|
|
558
|
-
{
|
|
559
|
-
...subAgentScoped,
|
|
560
|
-
externalAgentId: pgCore.varchar("external_agent_id", { length: 256 }).notNull(),
|
|
561
|
-
headers: pgCore.jsonb("headers").$type(),
|
|
562
|
-
...timestamps
|
|
563
|
-
},
|
|
564
|
-
(table) => [
|
|
565
|
-
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.agentId, table.id] }),
|
|
566
|
-
pgCore.foreignKey({
|
|
567
|
-
columns: [table.tenantId, table.projectId, table.agentId, table.subAgentId],
|
|
568
|
-
foreignColumns: [subAgents.tenantId, subAgents.projectId, subAgents.agentId, subAgents.id],
|
|
569
|
-
name: "sub_agent_external_agent_relations_sub_agent_fk"
|
|
570
|
-
}).onDelete("cascade"),
|
|
571
|
-
pgCore.foreignKey({
|
|
572
|
-
columns: [table.tenantId, table.projectId, table.externalAgentId],
|
|
573
|
-
foreignColumns: [externalAgents.tenantId, externalAgents.projectId, externalAgents.id],
|
|
574
|
-
name: "sub_agent_external_agent_relations_external_agent_fk"
|
|
575
|
-
}).onDelete("cascade")
|
|
576
|
-
]
|
|
577
|
-
);
|
|
578
|
-
var subAgentTeamAgentRelations = pgCore.pgTable(
|
|
579
|
-
"sub_agent_team_agent_relations",
|
|
580
|
-
{
|
|
581
|
-
...subAgentScoped,
|
|
582
|
-
targetAgentId: pgCore.varchar("target_agent_id", { length: 256 }).notNull(),
|
|
583
|
-
headers: pgCore.jsonb("headers").$type(),
|
|
584
|
-
...timestamps
|
|
585
|
-
},
|
|
586
|
-
(table) => [
|
|
587
|
-
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.agentId, table.id] }),
|
|
588
|
-
pgCore.foreignKey({
|
|
589
|
-
columns: [table.tenantId, table.projectId, table.agentId, table.subAgentId],
|
|
590
|
-
foreignColumns: [subAgents.tenantId, subAgents.projectId, subAgents.agentId, subAgents.id],
|
|
591
|
-
name: "sub_agent_team_agent_relations_sub_agent_fk"
|
|
592
|
-
}).onDelete("cascade"),
|
|
593
|
-
pgCore.foreignKey({
|
|
594
|
-
columns: [table.tenantId, table.projectId, table.targetAgentId],
|
|
595
|
-
foreignColumns: [agents.tenantId, agents.projectId, agents.id],
|
|
596
|
-
name: "sub_agent_team_agent_relations_target_agent_fk"
|
|
597
|
-
}).onDelete("cascade")
|
|
598
|
-
]
|
|
599
|
-
);
|
|
600
|
-
var subAgentFunctionToolRelations = pgCore.pgTable(
|
|
601
|
-
"sub_agent_function_tool_relations",
|
|
602
|
-
{
|
|
603
|
-
...subAgentScoped,
|
|
604
|
-
functionToolId: pgCore.varchar("function_tool_id", { length: 256 }).notNull(),
|
|
605
|
-
...timestamps
|
|
606
|
-
},
|
|
607
|
-
(table) => [
|
|
608
|
-
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.agentId, table.id] }),
|
|
609
|
-
pgCore.foreignKey({
|
|
610
|
-
columns: [table.tenantId, table.projectId, table.agentId, table.subAgentId],
|
|
611
|
-
foreignColumns: [subAgents.tenantId, subAgents.projectId, subAgents.agentId, subAgents.id],
|
|
612
|
-
name: "sub_agent_function_tool_relations_sub_agent_fk"
|
|
613
|
-
}).onDelete("cascade"),
|
|
614
|
-
pgCore.foreignKey({
|
|
615
|
-
columns: [table.tenantId, table.projectId, table.agentId, table.functionToolId],
|
|
616
|
-
foreignColumns: [
|
|
617
|
-
functionTools.tenantId,
|
|
618
|
-
functionTools.projectId,
|
|
619
|
-
functionTools.agentId,
|
|
620
|
-
functionTools.id
|
|
621
|
-
],
|
|
622
|
-
name: "sub_agent_function_tool_relations_function_tool_fk"
|
|
623
|
-
}).onDelete("cascade")
|
|
624
|
-
]
|
|
625
|
-
);
|
|
626
|
-
var conversations = pgCore.pgTable(
|
|
627
|
-
"conversations",
|
|
628
|
-
{
|
|
629
|
-
...projectScoped,
|
|
630
|
-
userId: pgCore.varchar("user_id", { length: 256 }),
|
|
631
|
-
activeSubAgentId: pgCore.varchar("active_sub_agent_id", { length: 256 }).notNull(),
|
|
632
|
-
title: pgCore.text("title"),
|
|
633
|
-
lastContextResolution: pgCore.timestamp("last_context_resolution", { mode: "string" }),
|
|
634
|
-
metadata: pgCore.jsonb("metadata").$type(),
|
|
635
|
-
...timestamps
|
|
636
|
-
},
|
|
637
|
-
(table) => [
|
|
638
|
-
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
639
|
-
pgCore.foreignKey({
|
|
640
|
-
columns: [table.tenantId, table.projectId],
|
|
641
|
-
foreignColumns: [projects.tenantId, projects.id],
|
|
642
|
-
name: "conversations_project_fk"
|
|
643
|
-
}).onDelete("cascade")
|
|
644
|
-
]
|
|
645
|
-
);
|
|
646
|
-
var messages = pgCore.pgTable(
|
|
647
|
-
"messages",
|
|
648
|
-
{
|
|
649
|
-
...projectScoped,
|
|
650
|
-
conversationId: pgCore.varchar("conversation_id", { length: 256 }).notNull(),
|
|
651
|
-
role: pgCore.varchar("role", { length: 256 }).notNull(),
|
|
652
|
-
fromSubAgentId: pgCore.varchar("from_sub_agent_id", { length: 256 }),
|
|
653
|
-
toSubAgentId: pgCore.varchar("to_sub_agent_id", { length: 256 }),
|
|
654
|
-
fromExternalAgentId: pgCore.varchar("from_external_sub_agent_id", { length: 256 }),
|
|
655
|
-
toExternalAgentId: pgCore.varchar("to_external_sub_agent_id", { length: 256 }),
|
|
656
|
-
fromTeamAgentId: pgCore.varchar("from_team_agent_id", { length: 256 }),
|
|
657
|
-
toTeamAgentId: pgCore.varchar("to_team_agent_id", { length: 256 }),
|
|
658
|
-
content: pgCore.jsonb("content").$type().notNull(),
|
|
659
|
-
visibility: pgCore.varchar("visibility", { length: 256 }).notNull().default("user-facing"),
|
|
660
|
-
messageType: pgCore.varchar("message_type", { length: 256 }).notNull().default("chat"),
|
|
661
|
-
taskId: pgCore.varchar("task_id", { length: 256 }),
|
|
662
|
-
parentMessageId: pgCore.varchar("parent_message_id", { length: 256 }),
|
|
663
|
-
a2aTaskId: pgCore.varchar("a2a_task_id", { length: 256 }),
|
|
664
|
-
a2aSessionId: pgCore.varchar("a2a_session_id", { length: 256 }),
|
|
665
|
-
metadata: pgCore.jsonb("metadata").$type(),
|
|
666
|
-
...timestamps
|
|
667
|
-
},
|
|
668
|
-
(table) => [
|
|
669
|
-
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id] }),
|
|
670
|
-
pgCore.foreignKey({
|
|
671
|
-
columns: [table.tenantId, table.projectId],
|
|
672
|
-
foreignColumns: [projects.tenantId, projects.id],
|
|
673
|
-
name: "messages_project_fk"
|
|
674
|
-
}).onDelete("cascade")
|
|
675
|
-
]
|
|
676
|
-
);
|
|
677
|
-
var ledgerArtifacts = pgCore.pgTable(
|
|
678
|
-
"ledger_artifacts",
|
|
679
|
-
{
|
|
680
|
-
...projectScoped,
|
|
681
|
-
taskId: pgCore.varchar("task_id", { length: 256 }).notNull(),
|
|
682
|
-
toolCallId: pgCore.varchar("tool_call_id", { length: 256 }),
|
|
683
|
-
contextId: pgCore.varchar("context_id", { length: 256 }).notNull(),
|
|
684
|
-
type: pgCore.varchar("type", { length: 256 }).notNull().default("source"),
|
|
685
|
-
name: pgCore.varchar("name", { length: 256 }),
|
|
686
|
-
description: pgCore.text("description"),
|
|
687
|
-
parts: pgCore.jsonb("parts").$type(),
|
|
688
|
-
metadata: pgCore.jsonb("metadata").$type(),
|
|
689
|
-
summary: pgCore.text("summary"),
|
|
690
|
-
mime: pgCore.jsonb("mime").$type(),
|
|
691
|
-
visibility: pgCore.varchar("visibility", { length: 256 }).default("context"),
|
|
692
|
-
allowedAgents: pgCore.jsonb("allowed_agents").$type(),
|
|
693
|
-
derivedFrom: pgCore.varchar("derived_from", { length: 256 }),
|
|
694
|
-
...timestamps
|
|
695
|
-
},
|
|
696
|
-
(table) => [
|
|
697
|
-
pgCore.primaryKey({ columns: [table.tenantId, table.projectId, table.id, table.taskId] }),
|
|
698
|
-
pgCore.foreignKey({
|
|
699
|
-
columns: [table.tenantId, table.projectId],
|
|
700
|
-
foreignColumns: [projects.tenantId, projects.id],
|
|
701
|
-
name: "ledger_artifacts_project_fk"
|
|
702
|
-
}).onDelete("cascade"),
|
|
703
|
-
pgCore.index("ledger_artifacts_task_id_idx").on(table.taskId),
|
|
704
|
-
pgCore.index("ledger_artifacts_tool_call_id_idx").on(table.toolCallId),
|
|
705
|
-
pgCore.index("ledger_artifacts_context_id_idx").on(table.contextId),
|
|
706
|
-
pgCore.unique("ledger_artifacts_task_context_name_unique").on(
|
|
707
|
-
table.taskId,
|
|
708
|
-
table.contextId,
|
|
709
|
-
table.name
|
|
710
|
-
)
|
|
711
|
-
]
|
|
712
|
-
);
|
|
713
|
-
var apiKeys = pgCore.pgTable(
|
|
714
|
-
"api_keys",
|
|
715
|
-
{
|
|
716
|
-
...agentScoped,
|
|
717
|
-
publicId: pgCore.varchar("public_id", { length: 256 }).notNull().unique(),
|
|
718
|
-
keyHash: pgCore.varchar("key_hash", { length: 256 }).notNull(),
|
|
719
|
-
keyPrefix: pgCore.varchar("key_prefix", { length: 256 }).notNull(),
|
|
720
|
-
name: pgCore.varchar("name", { length: 256 }),
|
|
721
|
-
lastUsedAt: pgCore.timestamp("last_used_at", { mode: "string" }),
|
|
722
|
-
expiresAt: pgCore.timestamp("expires_at", { mode: "string" }),
|
|
723
|
-
...timestamps
|
|
724
|
-
},
|
|
725
|
-
(t) => [
|
|
726
|
-
pgCore.foreignKey({
|
|
727
|
-
columns: [t.tenantId],
|
|
728
|
-
foreignColumns: [organization.id],
|
|
729
|
-
name: "api_keys_organization_fk"
|
|
730
|
-
}).onDelete("cascade"),
|
|
731
|
-
pgCore.foreignKey({
|
|
732
|
-
columns: [t.tenantId, t.projectId],
|
|
733
|
-
foreignColumns: [projects.tenantId, projects.id],
|
|
734
|
-
name: "api_keys_project_fk"
|
|
735
|
-
}).onDelete("cascade"),
|
|
736
|
-
pgCore.foreignKey({
|
|
737
|
-
columns: [t.tenantId, t.projectId, t.agentId],
|
|
738
|
-
foreignColumns: [agents.tenantId, agents.projectId, agents.id],
|
|
739
|
-
name: "api_keys_agent_fk"
|
|
740
|
-
}).onDelete("cascade"),
|
|
741
|
-
pgCore.index("api_keys_tenant_agent_idx").on(t.tenantId, t.agentId),
|
|
742
|
-
pgCore.index("api_keys_prefix_idx").on(t.keyPrefix),
|
|
743
|
-
pgCore.index("api_keys_public_id_idx").on(t.publicId)
|
|
744
|
-
]
|
|
745
|
-
);
|
|
746
|
-
var credentialReferences = pgCore.pgTable(
|
|
747
|
-
"credential_references",
|
|
748
|
-
{
|
|
749
|
-
...projectScoped,
|
|
750
|
-
name: pgCore.varchar("name", { length: 256 }).notNull(),
|
|
751
|
-
type: pgCore.varchar("type", { length: 256 }).notNull(),
|
|
752
|
-
credentialStoreId: pgCore.varchar("credential_store_id", { length: 256 }).notNull(),
|
|
753
|
-
retrievalParams: pgCore.jsonb("retrieval_params").$type(),
|
|
754
|
-
...timestamps
|
|
755
|
-
},
|
|
756
|
-
(t) => [
|
|
757
|
-
pgCore.primaryKey({ columns: [t.tenantId, t.projectId, t.id] }),
|
|
758
|
-
pgCore.foreignKey({
|
|
759
|
-
columns: [t.tenantId, t.projectId],
|
|
760
|
-
foreignColumns: [projects.tenantId, projects.id],
|
|
761
|
-
name: "credential_references_project_fk"
|
|
762
|
-
}).onDelete("cascade")
|
|
763
|
-
]
|
|
764
|
-
);
|
|
765
|
-
drizzleOrm.relations(tasks, ({ one, many }) => ({
|
|
766
|
-
project: one(projects, {
|
|
767
|
-
fields: [tasks.tenantId, tasks.projectId],
|
|
768
|
-
references: [projects.tenantId, projects.id]
|
|
769
|
-
}),
|
|
770
|
-
// A task can have many parent relationships (where it's the child)
|
|
771
|
-
parentRelations: many(taskRelations, {
|
|
772
|
-
relationName: "childTask"
|
|
773
|
-
}),
|
|
774
|
-
// A task can have many child relationships (where it's the parent)
|
|
775
|
-
childRelations: many(taskRelations, {
|
|
776
|
-
relationName: "parentTask"
|
|
777
|
-
}),
|
|
778
|
-
subAgent: one(subAgents, {
|
|
779
|
-
fields: [tasks.subAgentId],
|
|
780
|
-
references: [subAgents.id]
|
|
781
|
-
}),
|
|
782
|
-
messages: many(messages),
|
|
783
|
-
ledgerArtifacts: many(ledgerArtifacts)
|
|
784
|
-
}));
|
|
785
|
-
drizzleOrm.relations(projects, ({ many }) => ({
|
|
786
|
-
subAgents: many(subAgents),
|
|
787
|
-
agents: many(agents),
|
|
788
|
-
tools: many(tools),
|
|
789
|
-
functions: many(functions),
|
|
790
|
-
contextConfigs: many(contextConfigs),
|
|
791
|
-
externalAgents: many(externalAgents),
|
|
792
|
-
conversations: many(conversations),
|
|
793
|
-
tasks: many(tasks),
|
|
794
|
-
dataComponents: many(dataComponents),
|
|
795
|
-
artifactComponents: many(artifactComponents),
|
|
796
|
-
ledgerArtifacts: many(ledgerArtifacts),
|
|
797
|
-
credentialReferences: many(credentialReferences)
|
|
798
|
-
}));
|
|
799
|
-
drizzleOrm.relations(taskRelations, ({ one }) => ({
|
|
800
|
-
parentTask: one(tasks, {
|
|
801
|
-
fields: [taskRelations.parentTaskId],
|
|
802
|
-
references: [tasks.id],
|
|
803
|
-
relationName: "parentTask"
|
|
804
|
-
}),
|
|
805
|
-
childTask: one(tasks, {
|
|
806
|
-
fields: [taskRelations.childTaskId],
|
|
807
|
-
references: [tasks.id],
|
|
808
|
-
relationName: "childTask"
|
|
809
|
-
})
|
|
810
|
-
}));
|
|
811
|
-
drizzleOrm.relations(contextConfigs, ({ many, one }) => ({
|
|
812
|
-
project: one(projects, {
|
|
813
|
-
fields: [contextConfigs.tenantId, contextConfigs.projectId],
|
|
814
|
-
references: [projects.tenantId, projects.id]
|
|
815
|
-
}),
|
|
816
|
-
agents: many(agents),
|
|
817
|
-
cache: many(contextCache)
|
|
818
|
-
}));
|
|
819
|
-
drizzleOrm.relations(contextCache, ({ one }) => ({
|
|
820
|
-
contextConfig: one(contextConfigs, {
|
|
821
|
-
fields: [contextCache.contextConfigId],
|
|
822
|
-
references: [contextConfigs.id]
|
|
823
|
-
})
|
|
824
|
-
}));
|
|
825
|
-
drizzleOrm.relations(subAgents, ({ many, one }) => ({
|
|
826
|
-
project: one(projects, {
|
|
827
|
-
fields: [subAgents.tenantId, subAgents.projectId],
|
|
828
|
-
references: [projects.tenantId, projects.id]
|
|
829
|
-
}),
|
|
830
|
-
tasks: many(tasks),
|
|
831
|
-
defaultForAgents: many(agents),
|
|
832
|
-
sourceRelations: many(subAgentRelations, {
|
|
833
|
-
relationName: "sourceRelations"
|
|
834
|
-
}),
|
|
835
|
-
targetRelations: many(subAgentRelations, {
|
|
836
|
-
relationName: "targetRelations"
|
|
837
|
-
}),
|
|
838
|
-
sentMessages: many(messages, {
|
|
839
|
-
relationName: "sentMessages"
|
|
840
|
-
}),
|
|
841
|
-
receivedMessages: many(messages, {
|
|
842
|
-
relationName: "receivedMessages"
|
|
843
|
-
}),
|
|
844
|
-
toolRelations: many(subAgentToolRelations),
|
|
845
|
-
functionToolRelations: many(subAgentFunctionToolRelations),
|
|
846
|
-
dataComponentRelations: many(subAgentDataComponents),
|
|
847
|
-
artifactComponentRelations: many(subAgentArtifactComponents)
|
|
848
|
-
}));
|
|
849
|
-
drizzleOrm.relations(agents, ({ one, many }) => ({
|
|
850
|
-
project: one(projects, {
|
|
851
|
-
fields: [agents.tenantId, agents.projectId],
|
|
852
|
-
references: [projects.tenantId, projects.id]
|
|
853
|
-
}),
|
|
854
|
-
defaultSubAgent: one(subAgents, {
|
|
855
|
-
fields: [agents.defaultSubAgentId],
|
|
856
|
-
references: [subAgents.id]
|
|
857
|
-
}),
|
|
858
|
-
contextConfig: one(contextConfigs, {
|
|
859
|
-
fields: [agents.contextConfigId],
|
|
860
|
-
references: [contextConfigs.id]
|
|
861
|
-
}),
|
|
862
|
-
functionTools: many(functionTools)
|
|
863
|
-
}));
|
|
864
|
-
drizzleOrm.relations(externalAgents, ({ one, many }) => ({
|
|
865
|
-
project: one(projects, {
|
|
866
|
-
fields: [externalAgents.tenantId, externalAgents.projectId],
|
|
867
|
-
references: [projects.tenantId, projects.id]
|
|
868
|
-
}),
|
|
869
|
-
subAgentExternalAgentRelations: many(subAgentExternalAgentRelations),
|
|
870
|
-
credentialReference: one(credentialReferences, {
|
|
871
|
-
fields: [externalAgents.credentialReferenceId],
|
|
872
|
-
references: [credentialReferences.id]
|
|
873
|
-
})
|
|
874
|
-
}));
|
|
875
|
-
drizzleOrm.relations(apiKeys, ({ one }) => ({
|
|
876
|
-
project: one(projects, {
|
|
877
|
-
fields: [apiKeys.tenantId, apiKeys.projectId],
|
|
878
|
-
references: [projects.tenantId, projects.id]
|
|
879
|
-
}),
|
|
880
|
-
agent: one(agents, {
|
|
881
|
-
fields: [apiKeys.agentId],
|
|
882
|
-
references: [agents.id]
|
|
883
|
-
})
|
|
884
|
-
}));
|
|
885
|
-
drizzleOrm.relations(subAgentToolRelations, ({ one }) => ({
|
|
886
|
-
subAgent: one(subAgents, {
|
|
887
|
-
fields: [subAgentToolRelations.subAgentId],
|
|
888
|
-
references: [subAgents.id]
|
|
889
|
-
}),
|
|
890
|
-
tool: one(tools, {
|
|
891
|
-
fields: [subAgentToolRelations.toolId],
|
|
892
|
-
references: [tools.id]
|
|
893
|
-
})
|
|
894
|
-
}));
|
|
895
|
-
drizzleOrm.relations(credentialReferences, ({ one, many }) => ({
|
|
896
|
-
project: one(projects, {
|
|
897
|
-
fields: [credentialReferences.tenantId, credentialReferences.projectId],
|
|
898
|
-
references: [projects.tenantId, projects.id]
|
|
899
|
-
}),
|
|
900
|
-
tools: many(tools),
|
|
901
|
-
externalAgents: many(externalAgents)
|
|
902
|
-
}));
|
|
903
|
-
drizzleOrm.relations(tools, ({ one, many }) => ({
|
|
904
|
-
project: one(projects, {
|
|
905
|
-
fields: [tools.tenantId, tools.projectId],
|
|
906
|
-
references: [projects.tenantId, projects.id]
|
|
907
|
-
}),
|
|
908
|
-
subAgentRelations: many(subAgentToolRelations),
|
|
909
|
-
credentialReference: one(credentialReferences, {
|
|
910
|
-
fields: [tools.credentialReferenceId],
|
|
911
|
-
references: [credentialReferences.id]
|
|
912
|
-
})
|
|
913
|
-
}));
|
|
914
|
-
drizzleOrm.relations(conversations, ({ one, many }) => ({
|
|
915
|
-
project: one(projects, {
|
|
916
|
-
fields: [conversations.tenantId, conversations.projectId],
|
|
917
|
-
references: [projects.tenantId, projects.id]
|
|
918
|
-
}),
|
|
919
|
-
messages: many(messages),
|
|
920
|
-
activeSubAgent: one(subAgents, {
|
|
921
|
-
fields: [conversations.activeSubAgentId],
|
|
922
|
-
references: [subAgents.id]
|
|
923
|
-
})
|
|
924
|
-
}));
|
|
925
|
-
drizzleOrm.relations(messages, ({ one, many }) => ({
|
|
926
|
-
conversation: one(conversations, {
|
|
927
|
-
fields: [messages.conversationId],
|
|
928
|
-
references: [conversations.id]
|
|
929
|
-
}),
|
|
930
|
-
fromSubAgent: one(subAgents, {
|
|
931
|
-
fields: [messages.fromSubAgentId],
|
|
932
|
-
references: [subAgents.id],
|
|
933
|
-
relationName: "sentMessages"
|
|
934
|
-
}),
|
|
935
|
-
toSubAgent: one(subAgents, {
|
|
936
|
-
fields: [messages.toSubAgentId],
|
|
937
|
-
references: [subAgents.id],
|
|
938
|
-
relationName: "receivedMessages"
|
|
939
|
-
}),
|
|
940
|
-
fromTeamAgent: one(agents, {
|
|
941
|
-
fields: [messages.fromTeamAgentId],
|
|
942
|
-
references: [agents.id],
|
|
943
|
-
relationName: "receivedTeamMessages"
|
|
944
|
-
}),
|
|
945
|
-
toTeamAgent: one(agents, {
|
|
946
|
-
fields: [messages.toTeamAgentId],
|
|
947
|
-
references: [agents.id],
|
|
948
|
-
relationName: "sentTeamMessages"
|
|
949
|
-
}),
|
|
950
|
-
fromExternalAgent: one(externalAgents, {
|
|
951
|
-
fields: [messages.tenantId, messages.projectId, messages.fromExternalAgentId],
|
|
952
|
-
references: [externalAgents.tenantId, externalAgents.projectId, externalAgents.id],
|
|
953
|
-
relationName: "receivedExternalMessages"
|
|
954
|
-
}),
|
|
955
|
-
toExternalAgent: one(externalAgents, {
|
|
956
|
-
fields: [messages.tenantId, messages.projectId, messages.toExternalAgentId],
|
|
957
|
-
references: [externalAgents.tenantId, externalAgents.projectId, externalAgents.id],
|
|
958
|
-
relationName: "sentExternalMessages"
|
|
959
|
-
}),
|
|
960
|
-
task: one(tasks, {
|
|
961
|
-
fields: [messages.taskId],
|
|
962
|
-
references: [tasks.id]
|
|
963
|
-
}),
|
|
964
|
-
parentMessage: one(messages, {
|
|
965
|
-
fields: [messages.parentMessageId],
|
|
966
|
-
references: [messages.id],
|
|
967
|
-
relationName: "parentChild"
|
|
968
|
-
}),
|
|
969
|
-
childMessages: many(messages, {
|
|
970
|
-
relationName: "parentChild"
|
|
971
|
-
})
|
|
972
|
-
}));
|
|
973
|
-
drizzleOrm.relations(artifactComponents, ({ many, one }) => ({
|
|
974
|
-
project: one(projects, {
|
|
975
|
-
fields: [artifactComponents.tenantId, artifactComponents.projectId],
|
|
976
|
-
references: [projects.tenantId, projects.id]
|
|
977
|
-
}),
|
|
978
|
-
subAgentRelations: many(subAgentArtifactComponents)
|
|
979
|
-
}));
|
|
980
|
-
drizzleOrm.relations(
|
|
981
|
-
subAgentArtifactComponents,
|
|
982
|
-
({ one }) => ({
|
|
983
|
-
subAgent: one(subAgents, {
|
|
984
|
-
fields: [subAgentArtifactComponents.subAgentId],
|
|
985
|
-
references: [subAgents.id]
|
|
986
|
-
}),
|
|
987
|
-
artifactComponent: one(artifactComponents, {
|
|
988
|
-
fields: [subAgentArtifactComponents.artifactComponentId],
|
|
989
|
-
references: [artifactComponents.id]
|
|
990
|
-
})
|
|
991
|
-
})
|
|
992
|
-
);
|
|
993
|
-
drizzleOrm.relations(dataComponents, ({ many, one }) => ({
|
|
994
|
-
project: one(projects, {
|
|
995
|
-
fields: [dataComponents.tenantId, dataComponents.projectId],
|
|
996
|
-
references: [projects.tenantId, projects.id]
|
|
997
|
-
}),
|
|
998
|
-
subAgentRelations: many(subAgentDataComponents)
|
|
999
|
-
}));
|
|
1000
|
-
drizzleOrm.relations(subAgentDataComponents, ({ one }) => ({
|
|
1001
|
-
subAgent: one(subAgents, {
|
|
1002
|
-
fields: [subAgentDataComponents.subAgentId],
|
|
1003
|
-
references: [subAgents.id]
|
|
1004
|
-
}),
|
|
1005
|
-
dataComponent: one(dataComponents, {
|
|
1006
|
-
fields: [subAgentDataComponents.dataComponentId],
|
|
1007
|
-
references: [dataComponents.id]
|
|
1008
|
-
})
|
|
1009
|
-
}));
|
|
1010
|
-
drizzleOrm.relations(ledgerArtifacts, ({ one }) => ({
|
|
1011
|
-
project: one(projects, {
|
|
1012
|
-
fields: [ledgerArtifacts.tenantId, ledgerArtifacts.projectId],
|
|
1013
|
-
references: [projects.tenantId, projects.id]
|
|
1014
|
-
}),
|
|
1015
|
-
task: one(tasks, {
|
|
1016
|
-
fields: [ledgerArtifacts.taskId],
|
|
1017
|
-
references: [tasks.id]
|
|
1018
|
-
})
|
|
1019
|
-
}));
|
|
1020
|
-
drizzleOrm.relations(functions, ({ many, one }) => ({
|
|
1021
|
-
functionTools: many(functionTools),
|
|
1022
|
-
project: one(projects, {
|
|
1023
|
-
fields: [functions.tenantId, functions.projectId],
|
|
1024
|
-
references: [projects.tenantId, projects.id]
|
|
1025
|
-
})
|
|
1026
|
-
}));
|
|
1027
|
-
drizzleOrm.relations(subAgentRelations, ({ one }) => ({
|
|
1028
|
-
agent: one(agents, {
|
|
1029
|
-
fields: [subAgentRelations.agentId],
|
|
1030
|
-
references: [agents.id]
|
|
1031
|
-
}),
|
|
1032
|
-
sourceSubAgent: one(subAgents, {
|
|
1033
|
-
fields: [subAgentRelations.sourceSubAgentId],
|
|
1034
|
-
references: [subAgents.id],
|
|
1035
|
-
relationName: "sourceRelations"
|
|
1036
|
-
}),
|
|
1037
|
-
targetSubAgent: one(subAgents, {
|
|
1038
|
-
fields: [subAgentRelations.targetSubAgentId],
|
|
1039
|
-
references: [subAgents.id],
|
|
1040
|
-
relationName: "targetRelations"
|
|
1041
|
-
})
|
|
1042
|
-
}));
|
|
1043
|
-
drizzleOrm.relations(functionTools, ({ one, many }) => ({
|
|
1044
|
-
project: one(projects, {
|
|
1045
|
-
fields: [functionTools.tenantId, functionTools.projectId],
|
|
1046
|
-
references: [projects.tenantId, projects.id]
|
|
1047
|
-
}),
|
|
1048
|
-
agent: one(agents, {
|
|
1049
|
-
fields: [functionTools.tenantId, functionTools.projectId, functionTools.agentId],
|
|
1050
|
-
references: [agents.tenantId, agents.projectId, agents.id]
|
|
1051
|
-
}),
|
|
1052
|
-
function: one(functions, {
|
|
1053
|
-
fields: [functionTools.tenantId, functionTools.projectId, functionTools.functionId],
|
|
1054
|
-
references: [functions.tenantId, functions.projectId, functions.id]
|
|
1055
|
-
}),
|
|
1056
|
-
subAgentRelations: many(subAgentFunctionToolRelations)
|
|
1057
|
-
}));
|
|
1058
|
-
drizzleOrm.relations(
|
|
1059
|
-
subAgentFunctionToolRelations,
|
|
1060
|
-
({ one }) => ({
|
|
1061
|
-
subAgent: one(subAgents, {
|
|
1062
|
-
fields: [subAgentFunctionToolRelations.subAgentId],
|
|
1063
|
-
references: [subAgents.id]
|
|
1064
|
-
}),
|
|
1065
|
-
functionTool: one(functionTools, {
|
|
1066
|
-
fields: [subAgentFunctionToolRelations.functionToolId],
|
|
1067
|
-
references: [functionTools.id]
|
|
1068
|
-
})
|
|
1069
|
-
})
|
|
1070
|
-
);
|
|
1071
|
-
drizzleOrm.relations(
|
|
1072
|
-
subAgentExternalAgentRelations,
|
|
1073
|
-
({ one }) => ({
|
|
1074
|
-
subAgent: one(subAgents, {
|
|
1075
|
-
fields: [
|
|
1076
|
-
subAgentExternalAgentRelations.tenantId,
|
|
1077
|
-
subAgentExternalAgentRelations.projectId,
|
|
1078
|
-
subAgentExternalAgentRelations.agentId,
|
|
1079
|
-
subAgentExternalAgentRelations.subAgentId
|
|
1080
|
-
],
|
|
1081
|
-
references: [subAgents.tenantId, subAgents.projectId, subAgents.agentId, subAgents.id]
|
|
1082
|
-
}),
|
|
1083
|
-
externalAgent: one(externalAgents, {
|
|
1084
|
-
fields: [
|
|
1085
|
-
subAgentExternalAgentRelations.tenantId,
|
|
1086
|
-
subAgentExternalAgentRelations.projectId,
|
|
1087
|
-
subAgentExternalAgentRelations.externalAgentId
|
|
1088
|
-
],
|
|
1089
|
-
references: [externalAgents.tenantId, externalAgents.projectId, externalAgents.id]
|
|
1090
|
-
})
|
|
1091
|
-
})
|
|
1092
|
-
);
|
|
1093
|
-
drizzleOrm.relations(
|
|
1094
|
-
subAgentTeamAgentRelations,
|
|
1095
|
-
({ one }) => ({
|
|
1096
|
-
subAgent: one(subAgents, {
|
|
1097
|
-
fields: [
|
|
1098
|
-
subAgentTeamAgentRelations.tenantId,
|
|
1099
|
-
subAgentTeamAgentRelations.projectId,
|
|
1100
|
-
subAgentTeamAgentRelations.agentId,
|
|
1101
|
-
subAgentTeamAgentRelations.subAgentId
|
|
1102
|
-
],
|
|
1103
|
-
references: [subAgents.tenantId, subAgents.projectId, subAgents.agentId, subAgents.id]
|
|
1104
|
-
}),
|
|
1105
|
-
targetAgent: one(agents, {
|
|
1106
|
-
fields: [
|
|
1107
|
-
subAgentTeamAgentRelations.tenantId,
|
|
1108
|
-
subAgentTeamAgentRelations.projectId,
|
|
1109
|
-
subAgentTeamAgentRelations.targetAgentId
|
|
1110
|
-
],
|
|
1111
|
-
references: [agents.tenantId, agents.projectId, agents.id]
|
|
1112
|
-
})
|
|
1113
|
-
})
|
|
1114
|
-
);
|
|
1115
|
-
|
|
1116
|
-
// src/types/utility.ts
|
|
1117
|
-
var TOOL_STATUS_VALUES = ["healthy", "unhealthy", "unknown", "needs_auth"];
|
|
1118
|
-
var VALID_RELATION_TYPES = ["transfer", "delegate"];
|
|
1119
|
-
var MCPTransportType = {
|
|
1120
|
-
streamableHttp: "streamable_http",
|
|
1121
|
-
sse: "sse"
|
|
1122
|
-
};
|
|
1123
|
-
var MCPServerType = {
|
|
1124
|
-
nango: "nango",
|
|
1125
|
-
generic: "generic"
|
|
1126
|
-
};
|
|
1127
|
-
var CredentialStoreType = {
|
|
1128
|
-
memory: "memory",
|
|
1129
|
-
keychain: "keychain",
|
|
1130
|
-
nango: "nango"
|
|
1131
|
-
};
|
|
1132
|
-
var MIN_ID_LENGTH = 1;
|
|
1133
|
-
var MAX_ID_LENGTH = 255;
|
|
1134
|
-
var URL_SAFE_ID_PATTERN = /^[a-zA-Z0-9\-_.]+$/;
|
|
1135
|
-
var resourceIdSchema = zodOpenapi.z.string().min(MIN_ID_LENGTH).max(MAX_ID_LENGTH).describe("Resource identifier").regex(URL_SAFE_ID_PATTERN, {
|
|
1136
|
-
message: "ID must contain only letters, numbers, hyphens, underscores, and dots"
|
|
1137
|
-
}).openapi({
|
|
1138
|
-
description: "Resource identifier",
|
|
1139
|
-
example: "resource_789"
|
|
1140
|
-
});
|
|
1141
|
-
resourceIdSchema.meta({
|
|
1142
|
-
description: "Resource identifier"
|
|
1143
|
-
});
|
|
1144
|
-
var FIELD_MODIFIERS = {
|
|
1145
|
-
id: (schema) => {
|
|
1146
|
-
const modified = schema.min(MIN_ID_LENGTH).max(MAX_ID_LENGTH).describe("Resource identifier").regex(URL_SAFE_ID_PATTERN, {
|
|
1147
|
-
message: "ID must contain only letters, numbers, hyphens, underscores, and dots"
|
|
1148
|
-
}).openapi({
|
|
1149
|
-
description: "Resource identifier",
|
|
1150
|
-
example: "resource_789"
|
|
1151
|
-
});
|
|
1152
|
-
modified.meta({
|
|
1153
|
-
description: "Resource identifier"
|
|
1154
|
-
});
|
|
1155
|
-
return modified;
|
|
1156
|
-
},
|
|
1157
|
-
name: (_schema) => {
|
|
1158
|
-
const modified = zodOpenapi.z.string().describe("Name");
|
|
1159
|
-
modified.meta({ description: "Name" });
|
|
1160
|
-
return modified;
|
|
1161
|
-
},
|
|
1162
|
-
description: (_schema) => {
|
|
1163
|
-
const modified = zodOpenapi.z.string().describe("Description");
|
|
1164
|
-
modified.meta({ description: "Description" });
|
|
1165
|
-
return modified;
|
|
1166
|
-
},
|
|
1167
|
-
tenantId: (schema) => {
|
|
1168
|
-
const modified = schema.describe("Tenant identifier");
|
|
1169
|
-
modified.meta({ description: "Tenant identifier" });
|
|
1170
|
-
return modified;
|
|
1171
|
-
},
|
|
1172
|
-
projectId: (schema) => {
|
|
1173
|
-
const modified = schema.describe("Project identifier");
|
|
1174
|
-
modified.meta({ description: "Project identifier" });
|
|
1175
|
-
return modified;
|
|
1176
|
-
},
|
|
1177
|
-
agentId: (schema) => {
|
|
1178
|
-
const modified = schema.describe("Agent identifier");
|
|
1179
|
-
modified.meta({ description: "Agent identifier" });
|
|
1180
|
-
return modified;
|
|
1181
|
-
},
|
|
1182
|
-
subAgentId: (schema) => {
|
|
1183
|
-
const modified = schema.describe("Sub-agent identifier");
|
|
1184
|
-
modified.meta({ description: "Sub-agent identifier" });
|
|
1185
|
-
return modified;
|
|
1186
|
-
},
|
|
1187
|
-
createdAt: (schema) => {
|
|
1188
|
-
const modified = schema.describe("Creation timestamp");
|
|
1189
|
-
modified.meta({ description: "Creation timestamp" });
|
|
1190
|
-
return modified;
|
|
1191
|
-
},
|
|
1192
|
-
updatedAt: (schema) => {
|
|
1193
|
-
const modified = schema.describe("Last update timestamp");
|
|
1194
|
-
modified.meta({ description: "Last update timestamp" });
|
|
1195
|
-
return modified;
|
|
1196
|
-
}
|
|
1197
|
-
};
|
|
1198
|
-
function createSelectSchemaWithModifiers(table, overrides) {
|
|
1199
|
-
const tableColumns = table._?.columns;
|
|
1200
|
-
if (!tableColumns) {
|
|
1201
|
-
return drizzleZod.createSelectSchema(table, overrides);
|
|
1202
|
-
}
|
|
1203
|
-
const tableFieldNames = Object.keys(tableColumns);
|
|
1204
|
-
const modifiers = {};
|
|
1205
|
-
for (const fieldName of tableFieldNames) {
|
|
1206
|
-
const fieldNameStr = String(fieldName);
|
|
1207
|
-
if (fieldNameStr in FIELD_MODIFIERS) {
|
|
1208
|
-
modifiers[fieldNameStr] = FIELD_MODIFIERS[fieldNameStr];
|
|
1209
|
-
}
|
|
1210
|
-
}
|
|
1211
|
-
const mergedModifiers = { ...modifiers, ...overrides };
|
|
1212
|
-
return drizzleZod.createSelectSchema(table, mergedModifiers);
|
|
1213
|
-
}
|
|
1214
|
-
function createInsertSchemaWithModifiers(table, overrides) {
|
|
1215
|
-
const tableColumns = table._?.columns;
|
|
1216
|
-
if (!tableColumns) {
|
|
1217
|
-
return drizzleZod.createInsertSchema(table, overrides);
|
|
1218
|
-
}
|
|
1219
|
-
const tableFieldNames = Object.keys(tableColumns);
|
|
1220
|
-
const modifiers = {};
|
|
1221
|
-
for (const fieldName of tableFieldNames) {
|
|
1222
|
-
const fieldNameStr = String(fieldName);
|
|
1223
|
-
if (fieldNameStr in FIELD_MODIFIERS) {
|
|
1224
|
-
modifiers[fieldNameStr] = FIELD_MODIFIERS[fieldNameStr];
|
|
1225
|
-
}
|
|
1226
|
-
}
|
|
1227
|
-
const mergedModifiers = { ...modifiers, ...overrides };
|
|
1228
|
-
return drizzleZod.createInsertSchema(table, mergedModifiers);
|
|
1229
|
-
}
|
|
1230
|
-
var createSelectSchema = createSelectSchemaWithModifiers;
|
|
1231
|
-
var createInsertSchema = createInsertSchemaWithModifiers;
|
|
1232
|
-
function registerFieldSchemas(schema) {
|
|
1233
|
-
if (!(schema instanceof zodOpenapi.z.ZodObject)) {
|
|
1234
|
-
return schema;
|
|
1235
|
-
}
|
|
1236
|
-
const shape = schema.shape;
|
|
1237
|
-
const fieldMetadata = {
|
|
1238
|
-
id: { description: "Resource identifier" },
|
|
1239
|
-
name: { description: "Name" },
|
|
1240
|
-
description: { description: "Description" },
|
|
1241
|
-
tenantId: { description: "Tenant identifier" },
|
|
1242
|
-
projectId: { description: "Project identifier" },
|
|
1243
|
-
agentId: { description: "Agent identifier" },
|
|
1244
|
-
subAgentId: { description: "Sub-agent identifier" },
|
|
1245
|
-
createdAt: { description: "Creation timestamp" },
|
|
1246
|
-
updatedAt: { description: "Last update timestamp" }
|
|
1247
|
-
};
|
|
1248
|
-
for (const [fieldName, fieldSchema] of Object.entries(shape)) {
|
|
1249
|
-
if (fieldName in fieldMetadata && fieldSchema) {
|
|
1250
|
-
let zodFieldSchema = fieldSchema;
|
|
1251
|
-
let innerSchema = null;
|
|
1252
|
-
if (zodFieldSchema instanceof zodOpenapi.z.ZodOptional) {
|
|
1253
|
-
innerSchema = zodFieldSchema._def.innerType;
|
|
1254
|
-
zodFieldSchema = innerSchema;
|
|
1255
|
-
}
|
|
1256
|
-
zodFieldSchema.meta(fieldMetadata[fieldName]);
|
|
1257
|
-
if (fieldName === "id" && zodFieldSchema instanceof zodOpenapi.z.ZodString) {
|
|
1258
|
-
zodFieldSchema.openapi({
|
|
1259
|
-
description: "Resource identifier",
|
|
1260
|
-
minLength: MIN_ID_LENGTH,
|
|
1261
|
-
maxLength: MAX_ID_LENGTH,
|
|
1262
|
-
pattern: URL_SAFE_ID_PATTERN.source,
|
|
1263
|
-
example: "resource_789"
|
|
1264
|
-
});
|
|
1265
|
-
} else if (zodFieldSchema instanceof zodOpenapi.z.ZodString) {
|
|
1266
|
-
zodFieldSchema.openapi({
|
|
1267
|
-
description: fieldMetadata[fieldName].description
|
|
1268
|
-
});
|
|
1269
|
-
}
|
|
1270
|
-
if (innerSchema && fieldSchema instanceof zodOpenapi.z.ZodOptional) {
|
|
1271
|
-
fieldSchema.meta(fieldMetadata[fieldName]);
|
|
1272
|
-
}
|
|
1273
|
-
}
|
|
1274
|
-
}
|
|
1275
|
-
return schema;
|
|
1276
|
-
}
|
|
1277
|
-
|
|
1278
|
-
// src/validation/schemas.ts
|
|
1279
|
-
var {
|
|
1280
|
-
AGENT_EXECUTION_TRANSFER_COUNT_MAX,
|
|
1281
|
-
AGENT_EXECUTION_TRANSFER_COUNT_MIN,
|
|
1282
|
-
CONTEXT_FETCHER_HTTP_TIMEOUT_MS_DEFAULT,
|
|
1283
|
-
STATUS_UPDATE_MAX_INTERVAL_SECONDS,
|
|
1284
|
-
STATUS_UPDATE_MAX_NUM_EVENTS,
|
|
1285
|
-
SUB_AGENT_TURN_GENERATION_STEPS_MAX,
|
|
1286
|
-
SUB_AGENT_TURN_GENERATION_STEPS_MIN,
|
|
1287
|
-
VALIDATION_AGENT_PROMPT_MAX_CHARS,
|
|
1288
|
-
VALIDATION_SUB_AGENT_PROMPT_MAX_CHARS
|
|
1289
|
-
} = schemaValidationDefaults;
|
|
1290
|
-
var StopWhenSchema = zodOpenapi.z.object({
|
|
1291
|
-
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."),
|
|
1292
|
-
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.")
|
|
1293
|
-
}).openapi("StopWhen");
|
|
1294
|
-
var AgentStopWhenSchema = StopWhenSchema.pick({ transferCountIs: true }).openapi(
|
|
1295
|
-
"AgentStopWhen"
|
|
1296
|
-
);
|
|
1297
|
-
var SubAgentStopWhenSchema = StopWhenSchema.pick({ stepCountIs: true }).openapi(
|
|
1298
|
-
"SubAgentStopWhen"
|
|
1299
|
-
);
|
|
1300
|
-
var pageNumber = zodOpenapi.z.coerce.number().min(1).default(1).openapi("PaginationPageQueryParam");
|
|
1301
|
-
var limitNumber = zodOpenapi.z.coerce.number().min(1).max(100).default(10).openapi("PaginationLimitQueryParam");
|
|
1302
|
-
var ModelSettingsSchema = zodOpenapi.z.object({
|
|
1303
|
-
model: zodOpenapi.z.string().optional().describe("The model to use for the project."),
|
|
1304
|
-
providerOptions: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.any()).optional().describe("The provider options to use for the project.")
|
|
1305
|
-
}).openapi("ModelSettings");
|
|
1306
|
-
var ModelSchema = zodOpenapi.z.object({
|
|
1307
|
-
base: ModelSettingsSchema.optional(),
|
|
1308
|
-
structuredOutput: ModelSettingsSchema.optional(),
|
|
1309
|
-
summarizer: ModelSettingsSchema.optional()
|
|
1310
|
-
}).openapi("Model");
|
|
1311
|
-
var ProjectModelSchema = zodOpenapi.z.object({
|
|
1312
|
-
base: ModelSettingsSchema,
|
|
1313
|
-
structuredOutput: ModelSettingsSchema.optional(),
|
|
1314
|
-
summarizer: ModelSettingsSchema.optional()
|
|
1315
|
-
}).openapi("ProjectModel");
|
|
1316
|
-
var FunctionToolConfigSchema = zodOpenapi.z.object({
|
|
1317
|
-
name: zodOpenapi.z.string(),
|
|
1318
|
-
description: zodOpenapi.z.string(),
|
|
1319
|
-
inputSchema: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.unknown()),
|
|
1320
|
-
dependencies: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.string()).optional(),
|
|
1321
|
-
execute: zodOpenapi.z.union([zodOpenapi.z.function(), zodOpenapi.z.string()])
|
|
1322
|
-
});
|
|
1323
|
-
var createApiSchema = (schema) => schema.omit({ tenantId: true, projectId: true });
|
|
1324
|
-
var createApiInsertSchema = (schema) => schema.omit({ tenantId: true, projectId: true });
|
|
1325
|
-
var createApiUpdateSchema = (schema) => schema.omit({ tenantId: true, projectId: true }).partial();
|
|
1326
|
-
var createAgentScopedApiSchema = (schema) => schema.omit({ tenantId: true, projectId: true, agentId: true });
|
|
1327
|
-
var createAgentScopedApiInsertSchema = (schema) => schema.omit({ tenantId: true, projectId: true, agentId: true });
|
|
1328
|
-
var createAgentScopedApiUpdateSchema = (schema) => schema.omit({ tenantId: true, projectId: true, agentId: true }).partial();
|
|
1329
|
-
var SubAgentSelectSchema = createSelectSchema(subAgents);
|
|
1330
|
-
var SubAgentInsertSchema = createInsertSchema(subAgents).extend({
|
|
1331
|
-
id: resourceIdSchema,
|
|
1332
|
-
models: ModelSchema.optional()
|
|
1333
|
-
});
|
|
1334
|
-
var SubAgentUpdateSchema = SubAgentInsertSchema.partial();
|
|
1335
|
-
var SubAgentApiSelectSchema = createAgentScopedApiSchema(SubAgentSelectSchema).openapi("SubAgent");
|
|
1336
|
-
var SubAgentApiInsertSchema = createAgentScopedApiInsertSchema(SubAgentInsertSchema).openapi("SubAgentCreate");
|
|
1337
|
-
var SubAgentApiUpdateSchema = createAgentScopedApiUpdateSchema(SubAgentUpdateSchema).openapi("SubAgentUpdate");
|
|
1338
|
-
var SubAgentRelationSelectSchema = createSelectSchema(subAgentRelations);
|
|
1339
|
-
var SubAgentRelationInsertSchema = createInsertSchema(subAgentRelations).extend({
|
|
1340
|
-
id: resourceIdSchema,
|
|
1341
|
-
agentId: resourceIdSchema,
|
|
1342
|
-
sourceSubAgentId: resourceIdSchema,
|
|
1343
|
-
targetSubAgentId: resourceIdSchema.optional(),
|
|
1344
|
-
externalSubAgentId: resourceIdSchema.optional(),
|
|
1345
|
-
teamSubAgentId: resourceIdSchema.optional()
|
|
1346
|
-
});
|
|
1347
|
-
var SubAgentRelationUpdateSchema = SubAgentRelationInsertSchema.partial();
|
|
1348
|
-
var SubAgentRelationApiSelectSchema = createAgentScopedApiSchema(
|
|
1349
|
-
SubAgentRelationSelectSchema
|
|
1350
|
-
).openapi("SubAgentRelation");
|
|
1351
|
-
var SubAgentRelationApiInsertSchema = createAgentScopedApiInsertSchema(
|
|
1352
|
-
SubAgentRelationInsertSchema
|
|
1353
|
-
).extend({
|
|
1354
|
-
relationType: zodOpenapi.z.enum(VALID_RELATION_TYPES)
|
|
1355
|
-
}).refine(
|
|
1356
|
-
(data) => {
|
|
1357
|
-
const hasTarget = data.targetSubAgentId != null;
|
|
1358
|
-
const hasExternal = data.externalSubAgentId != null;
|
|
1359
|
-
const hasTeam = data.teamSubAgentId != null;
|
|
1360
|
-
const count = [hasTarget, hasExternal, hasTeam].filter(Boolean).length;
|
|
1361
|
-
return count === 1;
|
|
1362
|
-
},
|
|
1363
|
-
{
|
|
1364
|
-
message: "Must specify exactly one of targetSubAgentId, externalSubAgentId, or teamSubAgentId",
|
|
1365
|
-
path: ["targetSubAgentId", "externalSubAgentId", "teamSubAgentId"]
|
|
1366
|
-
}
|
|
1367
|
-
).openapi("SubAgentRelationCreate");
|
|
1368
|
-
var SubAgentRelationApiUpdateSchema = createAgentScopedApiUpdateSchema(
|
|
1369
|
-
SubAgentRelationUpdateSchema
|
|
1370
|
-
).extend({
|
|
1371
|
-
relationType: zodOpenapi.z.enum(VALID_RELATION_TYPES).optional()
|
|
1372
|
-
}).refine(
|
|
1373
|
-
(data) => {
|
|
1374
|
-
const hasTarget = data.targetSubAgentId != null;
|
|
1375
|
-
const hasExternal = data.externalSubAgentId != null;
|
|
1376
|
-
const hasTeam = data.teamSubAgentId != null;
|
|
1377
|
-
const count = [hasTarget, hasExternal, hasTeam].filter(Boolean).length;
|
|
1378
|
-
if (count === 0) {
|
|
1379
|
-
return true;
|
|
1380
|
-
}
|
|
1381
|
-
return count === 1;
|
|
1382
|
-
},
|
|
1383
|
-
{
|
|
1384
|
-
message: "Must specify exactly one of targetSubAgentId, externalSubAgentId, or teamSubAgentId when updating sub-agent relationships",
|
|
1385
|
-
path: ["targetSubAgentId", "externalSubAgentId", "teamSubAgentId"]
|
|
1386
|
-
}
|
|
1387
|
-
).openapi("SubAgentRelationUpdate");
|
|
1388
|
-
var SubAgentRelationQuerySchema = zodOpenapi.z.object({
|
|
1389
|
-
sourceSubAgentId: zodOpenapi.z.string().optional(),
|
|
1390
|
-
targetSubAgentId: zodOpenapi.z.string().optional(),
|
|
1391
|
-
externalSubAgentId: zodOpenapi.z.string().optional(),
|
|
1392
|
-
teamSubAgentId: zodOpenapi.z.string().optional()
|
|
1393
|
-
});
|
|
1394
|
-
var ExternalSubAgentRelationInsertSchema = createInsertSchema(subAgentRelations).extend({
|
|
1395
|
-
id: resourceIdSchema,
|
|
1396
|
-
agentId: resourceIdSchema,
|
|
1397
|
-
sourceSubAgentId: resourceIdSchema,
|
|
1398
|
-
externalSubAgentId: resourceIdSchema
|
|
1399
|
-
});
|
|
1400
|
-
var ExternalSubAgentRelationApiInsertSchema = createApiInsertSchema(
|
|
1401
|
-
ExternalSubAgentRelationInsertSchema
|
|
1402
|
-
);
|
|
1403
|
-
var AgentSelectSchema = createSelectSchema(agents);
|
|
1404
|
-
var AgentInsertSchema = createInsertSchema(agents).extend({
|
|
1405
|
-
id: resourceIdSchema,
|
|
1406
|
-
name: zodOpenapi.z.string().trim().nonempty()
|
|
1407
|
-
});
|
|
1408
|
-
var AgentUpdateSchema = AgentInsertSchema.partial();
|
|
1409
|
-
var AgentApiSelectSchema = createApiSchema(AgentSelectSchema).openapi("Agent");
|
|
1410
|
-
var AgentApiInsertSchema = createApiInsertSchema(AgentInsertSchema).extend({
|
|
1411
|
-
id: resourceIdSchema
|
|
1412
|
-
}).openapi("AgentCreate");
|
|
1413
|
-
var AgentApiUpdateSchema = createApiUpdateSchema(AgentUpdateSchema).openapi("AgentUpdate");
|
|
1414
|
-
var TaskSelectSchema = createSelectSchema(tasks);
|
|
1415
|
-
var TaskInsertSchema = createInsertSchema(tasks).extend({
|
|
1416
|
-
id: resourceIdSchema,
|
|
1417
|
-
conversationId: resourceIdSchema.optional()
|
|
1418
|
-
});
|
|
1419
|
-
var TaskUpdateSchema = TaskInsertSchema.partial();
|
|
1420
|
-
var TaskApiSelectSchema = createApiSchema(TaskSelectSchema);
|
|
1421
|
-
var TaskApiInsertSchema = createApiInsertSchema(TaskInsertSchema);
|
|
1422
|
-
var TaskApiUpdateSchema = createApiUpdateSchema(TaskUpdateSchema);
|
|
1423
|
-
var TaskRelationSelectSchema = createSelectSchema(taskRelations);
|
|
1424
|
-
var TaskRelationInsertSchema = createInsertSchema(taskRelations).extend({
|
|
1425
|
-
id: resourceIdSchema,
|
|
1426
|
-
parentTaskId: resourceIdSchema,
|
|
1427
|
-
childTaskId: resourceIdSchema
|
|
1428
|
-
});
|
|
1429
|
-
var TaskRelationUpdateSchema = TaskRelationInsertSchema.partial();
|
|
1430
|
-
var TaskRelationApiSelectSchema = createApiSchema(TaskRelationSelectSchema);
|
|
1431
|
-
var TaskRelationApiInsertSchema = createApiInsertSchema(TaskRelationInsertSchema);
|
|
1432
|
-
var TaskRelationApiUpdateSchema = createApiUpdateSchema(TaskRelationUpdateSchema);
|
|
1433
|
-
var imageUrlSchema = zodOpenapi.z.string().optional().refine(
|
|
1434
|
-
(url) => {
|
|
1435
|
-
if (!url) return true;
|
|
1436
|
-
if (url.startsWith("data:image/")) {
|
|
1437
|
-
const base64Part = url.split(",")[1];
|
|
1438
|
-
if (!base64Part) return false;
|
|
1439
|
-
return base64Part.length < 14e5;
|
|
1440
|
-
}
|
|
1441
|
-
try {
|
|
1442
|
-
const parsed = new URL(url);
|
|
1443
|
-
return parsed.protocol === "http:" || parsed.protocol === "https:";
|
|
1444
|
-
} catch {
|
|
1445
|
-
return false;
|
|
1446
|
-
}
|
|
1447
|
-
},
|
|
1448
|
-
{
|
|
1449
|
-
message: "Image URL must be a valid HTTP(S) URL or a base64 data URL (max 1MB)"
|
|
1450
|
-
}
|
|
1451
|
-
);
|
|
1452
|
-
var McpTransportConfigSchema = zodOpenapi.z.object({
|
|
1453
|
-
type: zodOpenapi.z.enum(MCPTransportType),
|
|
1454
|
-
requestInit: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.unknown()).optional(),
|
|
1455
|
-
eventSourceInit: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.unknown()).optional(),
|
|
1456
|
-
reconnectionOptions: zodOpenapi.z.any().optional().openapi({
|
|
1457
|
-
type: "object",
|
|
1458
|
-
description: "Reconnection options for streamable HTTP transport"
|
|
1459
|
-
}),
|
|
1460
|
-
sessionId: zodOpenapi.z.string().optional()
|
|
1461
|
-
}).openapi("McpTransportConfig");
|
|
1462
|
-
var ToolStatusSchema = zodOpenapi.z.enum(TOOL_STATUS_VALUES);
|
|
1463
|
-
var McpToolDefinitionSchema = zodOpenapi.z.object({
|
|
1464
|
-
name: zodOpenapi.z.string(),
|
|
1465
|
-
description: zodOpenapi.z.string().optional(),
|
|
1466
|
-
inputSchema: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.unknown()).optional()
|
|
1467
|
-
});
|
|
1468
|
-
var ToolSelectSchema = createSelectSchema(tools);
|
|
1469
|
-
var ToolInsertSchema = createInsertSchema(tools).extend({
|
|
1470
|
-
id: resourceIdSchema,
|
|
1471
|
-
imageUrl: imageUrlSchema,
|
|
1472
|
-
config: zodOpenapi.z.object({
|
|
1473
|
-
type: zodOpenapi.z.literal("mcp"),
|
|
1474
|
-
mcp: zodOpenapi.z.object({
|
|
1475
|
-
server: zodOpenapi.z.object({
|
|
1476
|
-
url: zodOpenapi.z.url()
|
|
1477
|
-
}),
|
|
1478
|
-
transport: zodOpenapi.z.object({
|
|
1479
|
-
type: zodOpenapi.z.enum(MCPTransportType),
|
|
1480
|
-
requestInit: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.unknown()).optional(),
|
|
1481
|
-
eventSourceInit: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.unknown()).optional(),
|
|
1482
|
-
reconnectionOptions: zodOpenapi.z.any().optional().openapi({
|
|
1483
|
-
type: "object",
|
|
1484
|
-
description: "Reconnection options for streamable HTTP transport"
|
|
1485
|
-
}),
|
|
1486
|
-
sessionId: zodOpenapi.z.string().optional()
|
|
1487
|
-
}).optional(),
|
|
1488
|
-
activeTools: zodOpenapi.z.array(zodOpenapi.z.string()).optional()
|
|
1489
|
-
})
|
|
1490
|
-
})
|
|
1491
|
-
});
|
|
1492
|
-
var ConversationSelectSchema = createSelectSchema(conversations);
|
|
1493
|
-
var ConversationInsertSchema = createInsertSchema(conversations).extend({
|
|
1494
|
-
id: resourceIdSchema,
|
|
1495
|
-
contextConfigId: resourceIdSchema.optional()
|
|
1496
|
-
});
|
|
1497
|
-
var ConversationUpdateSchema = ConversationInsertSchema.partial();
|
|
1498
|
-
var ConversationApiSelectSchema = createApiSchema(ConversationSelectSchema).openapi("Conversation");
|
|
1499
|
-
var ConversationApiInsertSchema = createApiInsertSchema(ConversationInsertSchema).openapi("ConversationCreate");
|
|
1500
|
-
var ConversationApiUpdateSchema = createApiUpdateSchema(ConversationUpdateSchema).openapi("ConversationUpdate");
|
|
1501
|
-
var MessageSelectSchema = createSelectSchema(messages);
|
|
1502
|
-
var MessageInsertSchema = createInsertSchema(messages).extend({
|
|
1503
|
-
id: resourceIdSchema,
|
|
1504
|
-
conversationId: resourceIdSchema,
|
|
1505
|
-
taskId: resourceIdSchema.optional()
|
|
1506
|
-
});
|
|
1507
|
-
var MessageUpdateSchema = MessageInsertSchema.partial();
|
|
1508
|
-
var MessageApiSelectSchema = createApiSchema(MessageSelectSchema).openapi("Message");
|
|
1509
|
-
var MessageApiInsertSchema = createApiInsertSchema(MessageInsertSchema).openapi("MessageCreate");
|
|
1510
|
-
var MessageApiUpdateSchema = createApiUpdateSchema(MessageUpdateSchema).openapi("MessageUpdate");
|
|
1511
|
-
var ContextCacheSelectSchema = createSelectSchema(contextCache);
|
|
1512
|
-
var ContextCacheInsertSchema = createInsertSchema(contextCache);
|
|
1513
|
-
var ContextCacheUpdateSchema = ContextCacheInsertSchema.partial();
|
|
1514
|
-
var ContextCacheApiSelectSchema = createApiSchema(ContextCacheSelectSchema);
|
|
1515
|
-
var ContextCacheApiInsertSchema = createApiInsertSchema(ContextCacheInsertSchema);
|
|
1516
|
-
var ContextCacheApiUpdateSchema = createApiUpdateSchema(ContextCacheUpdateSchema);
|
|
1517
|
-
var DataComponentSelectSchema = createSelectSchema(dataComponents);
|
|
1518
|
-
var DataComponentInsertSchema = createInsertSchema(dataComponents).extend({
|
|
1519
|
-
id: resourceIdSchema
|
|
1520
|
-
});
|
|
1521
|
-
var DataComponentBaseSchema = DataComponentInsertSchema.omit({
|
|
1522
|
-
createdAt: true,
|
|
1523
|
-
updatedAt: true
|
|
1524
|
-
});
|
|
1525
|
-
var DataComponentUpdateSchema = DataComponentInsertSchema.partial();
|
|
1526
|
-
var DataComponentApiSelectSchema = createApiSchema(DataComponentSelectSchema).openapi("DataComponent");
|
|
1527
|
-
var DataComponentApiInsertSchema = createApiInsertSchema(DataComponentInsertSchema).openapi("DataComponentCreate");
|
|
1528
|
-
var DataComponentApiUpdateSchema = createApiUpdateSchema(DataComponentUpdateSchema).openapi("DataComponentUpdate");
|
|
1529
|
-
var SubAgentDataComponentSelectSchema = createSelectSchema(subAgentDataComponents);
|
|
1530
|
-
var SubAgentDataComponentInsertSchema = createInsertSchema(subAgentDataComponents);
|
|
1531
|
-
var SubAgentDataComponentUpdateSchema = SubAgentDataComponentInsertSchema.partial();
|
|
1532
|
-
var SubAgentDataComponentApiSelectSchema = createAgentScopedApiSchema(
|
|
1533
|
-
SubAgentDataComponentSelectSchema
|
|
1534
|
-
);
|
|
1535
|
-
var SubAgentDataComponentApiInsertSchema = SubAgentDataComponentInsertSchema.omit({
|
|
1536
|
-
tenantId: true,
|
|
1537
|
-
projectId: true,
|
|
1538
|
-
id: true,
|
|
1539
|
-
createdAt: true
|
|
1540
|
-
});
|
|
1541
|
-
var SubAgentDataComponentApiUpdateSchema = createAgentScopedApiUpdateSchema(
|
|
1542
|
-
SubAgentDataComponentUpdateSchema
|
|
1543
|
-
);
|
|
1544
|
-
var ArtifactComponentSelectSchema = createSelectSchema(artifactComponents);
|
|
1545
|
-
var ArtifactComponentInsertSchema = createInsertSchema(artifactComponents).extend({
|
|
1546
|
-
id: resourceIdSchema
|
|
1547
|
-
});
|
|
1548
|
-
var ArtifactComponentUpdateSchema = ArtifactComponentInsertSchema.partial();
|
|
1549
|
-
var ArtifactComponentApiSelectSchema = createApiSchema(
|
|
1550
|
-
ArtifactComponentSelectSchema
|
|
1551
|
-
).openapi("ArtifactComponent");
|
|
1552
|
-
var ArtifactComponentApiInsertSchema = ArtifactComponentInsertSchema.omit({
|
|
1553
|
-
tenantId: true,
|
|
1554
|
-
projectId: true,
|
|
1555
|
-
createdAt: true,
|
|
1556
|
-
updatedAt: true
|
|
1557
|
-
}).openapi("ArtifactComponentCreate");
|
|
1558
|
-
var ArtifactComponentApiUpdateSchema = createApiUpdateSchema(
|
|
1559
|
-
ArtifactComponentUpdateSchema
|
|
1560
|
-
).openapi("ArtifactComponentUpdate");
|
|
1561
|
-
var SubAgentArtifactComponentSelectSchema = createSelectSchema(subAgentArtifactComponents);
|
|
1562
|
-
var SubAgentArtifactComponentInsertSchema = createInsertSchema(
|
|
1563
|
-
subAgentArtifactComponents
|
|
1564
|
-
).extend({
|
|
1565
|
-
id: resourceIdSchema,
|
|
1566
|
-
subAgentId: resourceIdSchema,
|
|
1567
|
-
artifactComponentId: resourceIdSchema
|
|
1568
|
-
});
|
|
1569
|
-
var SubAgentArtifactComponentUpdateSchema = SubAgentArtifactComponentInsertSchema.partial();
|
|
1570
|
-
var SubAgentArtifactComponentApiSelectSchema = createAgentScopedApiSchema(
|
|
1571
|
-
SubAgentArtifactComponentSelectSchema
|
|
1572
|
-
);
|
|
1573
|
-
var SubAgentArtifactComponentApiInsertSchema = SubAgentArtifactComponentInsertSchema.omit({
|
|
1574
|
-
tenantId: true,
|
|
1575
|
-
projectId: true,
|
|
1576
|
-
id: true,
|
|
1577
|
-
createdAt: true
|
|
1578
|
-
});
|
|
1579
|
-
var SubAgentArtifactComponentApiUpdateSchema = createAgentScopedApiUpdateSchema(
|
|
1580
|
-
SubAgentArtifactComponentUpdateSchema
|
|
1581
|
-
);
|
|
1582
|
-
var ExternalAgentSelectSchema = createSelectSchema(externalAgents).extend({
|
|
1583
|
-
credentialReferenceId: zodOpenapi.z.string().nullable().optional()
|
|
1584
|
-
});
|
|
1585
|
-
var ExternalAgentInsertSchema = createInsertSchema(externalAgents).extend({
|
|
1586
|
-
id: resourceIdSchema
|
|
1587
|
-
});
|
|
1588
|
-
var ExternalAgentUpdateSchema = ExternalAgentInsertSchema.partial();
|
|
1589
|
-
var ExternalAgentApiSelectSchema = createApiSchema(ExternalAgentSelectSchema).openapi("ExternalAgent");
|
|
1590
|
-
var ExternalAgentApiInsertSchema = createApiInsertSchema(ExternalAgentInsertSchema).openapi("ExternalAgentCreate");
|
|
1591
|
-
var ExternalAgentApiUpdateSchema = createApiUpdateSchema(ExternalAgentUpdateSchema).openapi("ExternalAgentUpdate");
|
|
1592
|
-
var AllAgentSchema = zodOpenapi.z.discriminatedUnion("type", [
|
|
1593
|
-
SubAgentApiSelectSchema.extend({ type: zodOpenapi.z.literal("internal") }),
|
|
1594
|
-
ExternalAgentApiSelectSchema.extend({ type: zodOpenapi.z.literal("external") })
|
|
1595
|
-
]);
|
|
1596
|
-
var ApiKeySelectSchema = createSelectSchema(apiKeys);
|
|
1597
|
-
var ApiKeyInsertSchema = createInsertSchema(apiKeys).extend({
|
|
1598
|
-
id: resourceIdSchema,
|
|
1599
|
-
agentId: resourceIdSchema
|
|
1600
|
-
});
|
|
1601
|
-
var ApiKeyUpdateSchema = ApiKeyInsertSchema.partial().omit({
|
|
1602
|
-
tenantId: true,
|
|
1603
|
-
projectId: true,
|
|
1604
|
-
id: true,
|
|
1605
|
-
publicId: true,
|
|
1606
|
-
keyHash: true,
|
|
1607
|
-
keyPrefix: true,
|
|
1608
|
-
createdAt: true
|
|
1609
|
-
});
|
|
1610
|
-
var ApiKeyApiSelectSchema = ApiKeySelectSchema.omit({
|
|
1611
|
-
tenantId: true,
|
|
1612
|
-
projectId: true,
|
|
1613
|
-
keyHash: true
|
|
1614
|
-
// Never expose the hash
|
|
1615
|
-
}).openapi("ApiKey");
|
|
1616
|
-
var ApiKeyApiCreationResponseSchema = zodOpenapi.z.object({
|
|
1617
|
-
data: zodOpenapi.z.object({
|
|
1618
|
-
apiKey: ApiKeyApiSelectSchema,
|
|
1619
|
-
key: zodOpenapi.z.string().describe("The full API key (shown only once)")
|
|
1620
|
-
})
|
|
1621
|
-
});
|
|
1622
|
-
var ApiKeyApiInsertSchema = ApiKeyInsertSchema.omit({
|
|
1623
|
-
tenantId: true,
|
|
1624
|
-
projectId: true,
|
|
1625
|
-
id: true,
|
|
1626
|
-
// Auto-generated
|
|
1627
|
-
publicId: true,
|
|
1628
|
-
// Auto-generated
|
|
1629
|
-
keyHash: true,
|
|
1630
|
-
// Auto-generated
|
|
1631
|
-
keyPrefix: true,
|
|
1632
|
-
// Auto-generated
|
|
1633
|
-
lastUsedAt: true
|
|
1634
|
-
// Not set on creation
|
|
1635
|
-
}).openapi("ApiKeyCreate");
|
|
1636
|
-
var ApiKeyApiUpdateSchema = ApiKeyUpdateSchema.openapi("ApiKeyUpdate");
|
|
1637
|
-
var CredentialReferenceSelectSchema = zodOpenapi.z.object({
|
|
1638
|
-
id: zodOpenapi.z.string(),
|
|
1639
|
-
tenantId: zodOpenapi.z.string(),
|
|
1640
|
-
projectId: zodOpenapi.z.string(),
|
|
1641
|
-
name: zodOpenapi.z.string(),
|
|
1642
|
-
type: zodOpenapi.z.string(),
|
|
1643
|
-
credentialStoreId: zodOpenapi.z.string(),
|
|
1644
|
-
retrievalParams: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.unknown()).nullish(),
|
|
1645
|
-
createdAt: zodOpenapi.z.string(),
|
|
1646
|
-
updatedAt: zodOpenapi.z.string()
|
|
1647
|
-
});
|
|
1648
|
-
var CredentialReferenceInsertSchema = createInsertSchema(credentialReferences).extend({
|
|
1649
|
-
id: resourceIdSchema,
|
|
1650
|
-
type: zodOpenapi.z.string(),
|
|
1651
|
-
credentialStoreId: resourceIdSchema,
|
|
1652
|
-
retrievalParams: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.unknown()).nullish()
|
|
1653
|
-
});
|
|
1654
|
-
var CredentialReferenceUpdateSchema = CredentialReferenceInsertSchema.partial();
|
|
1655
|
-
var CredentialReferenceApiSelectSchema = createApiSchema(CredentialReferenceSelectSchema).extend({
|
|
1656
|
-
type: zodOpenapi.z.enum(CredentialStoreType),
|
|
1657
|
-
tools: zodOpenapi.z.array(ToolSelectSchema).optional(),
|
|
1658
|
-
externalAgents: zodOpenapi.z.array(ExternalAgentSelectSchema).optional()
|
|
1659
|
-
}).openapi("CredentialReference");
|
|
1660
|
-
var CredentialReferenceApiInsertSchema = createApiInsertSchema(
|
|
1661
|
-
CredentialReferenceInsertSchema
|
|
1662
|
-
).extend({
|
|
1663
|
-
type: zodOpenapi.z.enum(CredentialStoreType)
|
|
1664
|
-
}).openapi("CredentialReferenceCreate");
|
|
1665
|
-
var CredentialReferenceApiUpdateSchema = createApiUpdateSchema(
|
|
1666
|
-
CredentialReferenceUpdateSchema
|
|
1667
|
-
).extend({
|
|
1668
|
-
type: zodOpenapi.z.enum(CredentialStoreType).optional()
|
|
1669
|
-
}).openapi("CredentialReferenceUpdate");
|
|
1670
|
-
var CredentialStoreSchema = zodOpenapi.z.object({
|
|
1671
|
-
id: zodOpenapi.z.string().describe("Unique identifier of the credential store"),
|
|
1672
|
-
type: zodOpenapi.z.enum(CredentialStoreType),
|
|
1673
|
-
available: zodOpenapi.z.boolean().describe("Whether the store is functional and ready to use"),
|
|
1674
|
-
reason: zodOpenapi.z.string().nullable().describe("Reason why store is not available, if applicable")
|
|
1675
|
-
}).openapi("CredentialStore");
|
|
1676
|
-
var CredentialStoreListResponseSchema = zodOpenapi.z.object({
|
|
1677
|
-
data: zodOpenapi.z.array(CredentialStoreSchema).describe("List of credential stores")
|
|
1678
|
-
}).openapi("CredentialStoreListResponse");
|
|
1679
|
-
var CreateCredentialInStoreRequestSchema = zodOpenapi.z.object({
|
|
1680
|
-
key: zodOpenapi.z.string().describe("The credential key"),
|
|
1681
|
-
value: zodOpenapi.z.string().describe("The credential value"),
|
|
1682
|
-
metadata: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.string()).nullish().describe("The metadata for the credential")
|
|
1683
|
-
}).openapi("CreateCredentialInStoreRequest");
|
|
1684
|
-
var CreateCredentialInStoreResponseSchema = zodOpenapi.z.object({
|
|
1685
|
-
data: zodOpenapi.z.object({
|
|
1686
|
-
key: zodOpenapi.z.string().describe("The credential key"),
|
|
1687
|
-
storeId: zodOpenapi.z.string().describe("The store ID where credential was created"),
|
|
1688
|
-
createdAt: zodOpenapi.z.string().describe("ISO timestamp of creation")
|
|
1689
|
-
})
|
|
1690
|
-
}).openapi("CreateCredentialInStoreResponse");
|
|
1691
|
-
var RelatedAgentInfoSchema = zodOpenapi.z.object({
|
|
1692
|
-
id: zodOpenapi.z.string(),
|
|
1693
|
-
name: zodOpenapi.z.string(),
|
|
1694
|
-
description: zodOpenapi.z.string()
|
|
1695
|
-
}).openapi("RelatedAgentInfo");
|
|
1696
|
-
var ComponentAssociationSchema = zodOpenapi.z.object({
|
|
1697
|
-
subAgentId: zodOpenapi.z.string(),
|
|
1698
|
-
createdAt: zodOpenapi.z.string()
|
|
1699
|
-
}).openapi("ComponentAssociation");
|
|
1700
|
-
var OAuthLoginQuerySchema = zodOpenapi.z.object({
|
|
1701
|
-
tenantId: zodOpenapi.z.string().min(1, "Tenant ID is required"),
|
|
1702
|
-
projectId: zodOpenapi.z.string().min(1, "Project ID is required"),
|
|
1703
|
-
toolId: zodOpenapi.z.string().min(1, "Tool ID is required")
|
|
1704
|
-
}).openapi("OAuthLoginQuery");
|
|
1705
|
-
var OAuthCallbackQuerySchema = zodOpenapi.z.object({
|
|
1706
|
-
code: zodOpenapi.z.string().min(1, "Authorization code is required"),
|
|
1707
|
-
state: zodOpenapi.z.string().min(1, "State parameter is required"),
|
|
1708
|
-
error: zodOpenapi.z.string().optional(),
|
|
1709
|
-
error_description: zodOpenapi.z.string().optional()
|
|
1710
|
-
}).openapi("OAuthCallbackQuery");
|
|
1711
|
-
var McpToolSchema = ToolInsertSchema.extend({
|
|
1712
|
-
imageUrl: imageUrlSchema,
|
|
1713
|
-
availableTools: zodOpenapi.z.array(McpToolDefinitionSchema).optional(),
|
|
1714
|
-
status: ToolStatusSchema.default("unknown"),
|
|
1715
|
-
version: zodOpenapi.z.string().optional(),
|
|
1716
|
-
createdAt: zodOpenapi.z.date(),
|
|
1717
|
-
updatedAt: zodOpenapi.z.date(),
|
|
1718
|
-
expiresAt: zodOpenapi.z.date().optional(),
|
|
1719
|
-
relationshipId: zodOpenapi.z.string().optional()
|
|
1720
|
-
}).openapi("McpTool");
|
|
1721
|
-
var MCPToolConfigSchema = McpToolSchema.omit({
|
|
1722
|
-
config: true,
|
|
1723
|
-
tenantId: true,
|
|
1724
|
-
projectId: true,
|
|
1725
|
-
status: true,
|
|
1726
|
-
version: true,
|
|
1727
|
-
createdAt: true,
|
|
1728
|
-
updatedAt: true,
|
|
1729
|
-
credentialReferenceId: true
|
|
1730
|
-
}).extend({
|
|
1731
|
-
tenantId: zodOpenapi.z.string().optional(),
|
|
1732
|
-
projectId: zodOpenapi.z.string().optional(),
|
|
1733
|
-
description: zodOpenapi.z.string().optional(),
|
|
1734
|
-
serverUrl: zodOpenapi.z.url(),
|
|
1735
|
-
activeTools: zodOpenapi.z.array(zodOpenapi.z.string()).optional(),
|
|
1736
|
-
mcpType: zodOpenapi.z.enum(MCPServerType).optional(),
|
|
1737
|
-
transport: McpTransportConfigSchema.optional(),
|
|
1738
|
-
credential: CredentialReferenceApiInsertSchema.optional()
|
|
1739
|
-
});
|
|
1740
|
-
var ToolUpdateSchema = ToolInsertSchema.partial();
|
|
1741
|
-
var ToolApiSelectSchema = createApiSchema(ToolSelectSchema).openapi("Tool");
|
|
1742
|
-
var ToolApiInsertSchema = createApiInsertSchema(ToolInsertSchema).openapi("ToolCreate");
|
|
1743
|
-
var ToolApiUpdateSchema = createApiUpdateSchema(ToolUpdateSchema).openapi("ToolUpdate");
|
|
1744
|
-
var FunctionToolSelectSchema = createSelectSchema(functionTools);
|
|
1745
|
-
var FunctionToolInsertSchema = createInsertSchema(functionTools).extend({
|
|
1746
|
-
id: resourceIdSchema
|
|
1747
|
-
});
|
|
1748
|
-
var FunctionToolUpdateSchema = FunctionToolInsertSchema.partial();
|
|
1749
|
-
var FunctionToolApiSelectSchema = createApiSchema(FunctionToolSelectSchema).openapi("FunctionTool");
|
|
1750
|
-
var FunctionToolApiInsertSchema = createAgentScopedApiInsertSchema(FunctionToolInsertSchema).openapi("FunctionToolCreate");
|
|
1751
|
-
var FunctionToolApiUpdateSchema = createApiUpdateSchema(FunctionToolUpdateSchema).openapi("FunctionToolUpdate");
|
|
1752
|
-
var FunctionSelectSchema = createSelectSchema(functions);
|
|
1753
|
-
var FunctionInsertSchema = createInsertSchema(functions).extend({
|
|
1754
|
-
id: resourceIdSchema
|
|
1755
|
-
});
|
|
1756
|
-
var FunctionUpdateSchema = FunctionInsertSchema.partial();
|
|
1757
|
-
var FunctionApiSelectSchema = createApiSchema(FunctionSelectSchema).openapi("Function");
|
|
1758
|
-
var FunctionApiInsertSchema = createApiInsertSchema(FunctionInsertSchema).openapi("FunctionCreate");
|
|
1759
|
-
var FunctionApiUpdateSchema = createApiUpdateSchema(FunctionUpdateSchema).openapi("FunctionUpdate");
|
|
1760
|
-
var FetchConfigSchema = zodOpenapi.z.object({
|
|
1761
|
-
url: zodOpenapi.z.string().min(1, "URL is required"),
|
|
1762
|
-
method: zodOpenapi.z.enum(["GET", "POST", "PUT", "DELETE", "PATCH"]).optional().default("GET"),
|
|
1763
|
-
headers: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.string()).optional(),
|
|
1764
|
-
body: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.unknown()).optional(),
|
|
1765
|
-
transform: zodOpenapi.z.string().optional(),
|
|
1766
|
-
// JSONPath or JS transform function
|
|
1767
|
-
timeout: zodOpenapi.z.number().min(0).optional().default(CONTEXT_FETCHER_HTTP_TIMEOUT_MS_DEFAULT).optional()
|
|
1768
|
-
}).openapi("FetchConfig");
|
|
1769
|
-
var FetchDefinitionSchema = zodOpenapi.z.object({
|
|
1770
|
-
id: zodOpenapi.z.string().min(1, "Fetch definition ID is required"),
|
|
1771
|
-
name: zodOpenapi.z.string().optional(),
|
|
1772
|
-
trigger: zodOpenapi.z.enum(["initialization", "invocation"]),
|
|
1773
|
-
fetchConfig: FetchConfigSchema,
|
|
1774
|
-
responseSchema: zodOpenapi.z.any().optional(),
|
|
1775
|
-
// JSON Schema for validating HTTP response
|
|
1776
|
-
defaultValue: zodOpenapi.z.any().optional().openapi({
|
|
1777
|
-
description: "Default value if fetch fails"
|
|
1778
|
-
}),
|
|
1779
|
-
credential: CredentialReferenceApiInsertSchema.optional()
|
|
1780
|
-
}).openapi("FetchDefinition");
|
|
1781
|
-
var ContextConfigSelectSchema = createSelectSchema(contextConfigs).extend({
|
|
1782
|
-
headersSchema: zodOpenapi.z.any().optional().openapi({
|
|
1783
|
-
type: "object",
|
|
1784
|
-
description: "JSON Schema for validating request headers"
|
|
1785
|
-
})
|
|
1786
|
-
});
|
|
1787
|
-
var ContextConfigInsertSchema = createInsertSchema(contextConfigs).extend({
|
|
1788
|
-
id: resourceIdSchema.optional(),
|
|
1789
|
-
headersSchema: zodOpenapi.z.any().nullable().optional().openapi({
|
|
1790
|
-
type: "object",
|
|
1791
|
-
description: "JSON Schema for validating request headers"
|
|
1792
|
-
}),
|
|
1793
|
-
contextVariables: zodOpenapi.z.any().nullable().optional().openapi({
|
|
1794
|
-
type: "object",
|
|
1795
|
-
description: "Context variables configuration with fetch definitions"
|
|
1796
|
-
})
|
|
1797
|
-
}).omit({
|
|
1798
|
-
createdAt: true,
|
|
1799
|
-
updatedAt: true
|
|
1800
|
-
});
|
|
1801
|
-
var ContextConfigUpdateSchema = ContextConfigInsertSchema.partial();
|
|
1802
|
-
var ContextConfigApiSelectSchema = createApiSchema(ContextConfigSelectSchema).omit({
|
|
1803
|
-
agentId: true
|
|
1804
|
-
}).openapi("ContextConfig");
|
|
1805
|
-
var ContextConfigApiInsertSchema = createApiInsertSchema(ContextConfigInsertSchema).omit({
|
|
1806
|
-
agentId: true
|
|
1807
|
-
}).openapi("ContextConfigCreate");
|
|
1808
|
-
var ContextConfigApiUpdateSchema = createApiUpdateSchema(ContextConfigUpdateSchema).omit({
|
|
1809
|
-
agentId: true
|
|
1810
|
-
}).openapi("ContextConfigUpdate");
|
|
1811
|
-
var SubAgentToolRelationSelectSchema = createSelectSchema(subAgentToolRelations);
|
|
1812
|
-
var SubAgentToolRelationInsertSchema = createInsertSchema(subAgentToolRelations).extend({
|
|
1813
|
-
id: resourceIdSchema,
|
|
1814
|
-
subAgentId: resourceIdSchema,
|
|
1815
|
-
toolId: resourceIdSchema,
|
|
1816
|
-
selectedTools: zodOpenapi.z.array(zodOpenapi.z.string()).nullish(),
|
|
1817
|
-
headers: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.string()).nullish()
|
|
1818
|
-
});
|
|
1819
|
-
var SubAgentToolRelationUpdateSchema = SubAgentToolRelationInsertSchema.partial();
|
|
1820
|
-
var SubAgentToolRelationApiSelectSchema = createAgentScopedApiSchema(
|
|
1821
|
-
SubAgentToolRelationSelectSchema
|
|
1822
|
-
).openapi("SubAgentToolRelation");
|
|
1823
|
-
var SubAgentToolRelationApiInsertSchema = createAgentScopedApiInsertSchema(
|
|
1824
|
-
SubAgentToolRelationInsertSchema
|
|
1825
|
-
).openapi("SubAgentToolRelationCreate");
|
|
1826
|
-
var SubAgentToolRelationApiUpdateSchema = createAgentScopedApiUpdateSchema(
|
|
1827
|
-
SubAgentToolRelationUpdateSchema
|
|
1828
|
-
).openapi("SubAgentToolRelationUpdate");
|
|
1829
|
-
var SubAgentExternalAgentRelationSelectSchema = createSelectSchema(
|
|
1830
|
-
subAgentExternalAgentRelations
|
|
1831
|
-
);
|
|
1832
|
-
var SubAgentExternalAgentRelationInsertSchema = createInsertSchema(
|
|
1833
|
-
subAgentExternalAgentRelations
|
|
1834
|
-
).extend({
|
|
1835
|
-
id: resourceIdSchema,
|
|
1836
|
-
subAgentId: resourceIdSchema,
|
|
1837
|
-
externalAgentId: resourceIdSchema,
|
|
1838
|
-
headers: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.string()).nullish()
|
|
1839
|
-
});
|
|
1840
|
-
var SubAgentExternalAgentRelationUpdateSchema = SubAgentExternalAgentRelationInsertSchema.partial();
|
|
1841
|
-
var SubAgentExternalAgentRelationApiSelectSchema = createAgentScopedApiSchema(
|
|
1842
|
-
SubAgentExternalAgentRelationSelectSchema
|
|
1843
|
-
).openapi("SubAgentExternalAgentRelation");
|
|
1844
|
-
var SubAgentExternalAgentRelationApiInsertSchema = createAgentScopedApiInsertSchema(
|
|
1845
|
-
SubAgentExternalAgentRelationInsertSchema
|
|
1846
|
-
).omit({ id: true, subAgentId: true }).openapi("SubAgentExternalAgentRelationCreate");
|
|
1847
|
-
var SubAgentExternalAgentRelationApiUpdateSchema = createAgentScopedApiUpdateSchema(
|
|
1848
|
-
SubAgentExternalAgentRelationUpdateSchema
|
|
1849
|
-
).openapi("SubAgentExternalAgentRelationUpdate");
|
|
1850
|
-
var SubAgentTeamAgentRelationSelectSchema = createSelectSchema(subAgentTeamAgentRelations);
|
|
1851
|
-
var SubAgentTeamAgentRelationInsertSchema = createInsertSchema(
|
|
1852
|
-
subAgentTeamAgentRelations
|
|
1853
|
-
).extend({
|
|
1854
|
-
id: resourceIdSchema,
|
|
1855
|
-
subAgentId: resourceIdSchema,
|
|
1856
|
-
targetAgentId: resourceIdSchema,
|
|
1857
|
-
headers: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.string()).nullish()
|
|
1858
|
-
});
|
|
1859
|
-
var SubAgentTeamAgentRelationUpdateSchema = SubAgentTeamAgentRelationInsertSchema.partial();
|
|
1860
|
-
var SubAgentTeamAgentRelationApiSelectSchema = createAgentScopedApiSchema(
|
|
1861
|
-
SubAgentTeamAgentRelationSelectSchema
|
|
1862
|
-
).openapi("SubAgentTeamAgentRelation");
|
|
1863
|
-
var SubAgentTeamAgentRelationApiInsertSchema = createAgentScopedApiInsertSchema(
|
|
1864
|
-
SubAgentTeamAgentRelationInsertSchema
|
|
1865
|
-
).omit({ id: true, subAgentId: true }).openapi("SubAgentTeamAgentRelationCreate");
|
|
1866
|
-
var SubAgentTeamAgentRelationApiUpdateSchema = createAgentScopedApiUpdateSchema(
|
|
1867
|
-
SubAgentTeamAgentRelationUpdateSchema
|
|
1868
|
-
).openapi("SubAgentTeamAgentRelationUpdate");
|
|
1869
|
-
var LedgerArtifactSelectSchema = createSelectSchema(ledgerArtifacts);
|
|
1870
|
-
var LedgerArtifactInsertSchema = createInsertSchema(ledgerArtifacts);
|
|
1871
|
-
var LedgerArtifactUpdateSchema = LedgerArtifactInsertSchema.partial();
|
|
1872
|
-
var LedgerArtifactApiSelectSchema = createApiSchema(LedgerArtifactSelectSchema);
|
|
1873
|
-
var LedgerArtifactApiInsertSchema = createApiInsertSchema(LedgerArtifactInsertSchema);
|
|
1874
|
-
var LedgerArtifactApiUpdateSchema = createApiUpdateSchema(LedgerArtifactUpdateSchema);
|
|
1875
|
-
var StatusComponentSchema = zodOpenapi.z.object({
|
|
1876
|
-
type: zodOpenapi.z.string(),
|
|
1877
|
-
description: zodOpenapi.z.string().optional(),
|
|
1878
|
-
detailsSchema: zodOpenapi.z.object({
|
|
1879
|
-
type: zodOpenapi.z.literal("object"),
|
|
1880
|
-
properties: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.any()),
|
|
1881
|
-
required: zodOpenapi.z.array(zodOpenapi.z.string()).optional()
|
|
1882
|
-
}).optional()
|
|
1883
|
-
}).openapi("StatusComponent");
|
|
1884
|
-
var StatusUpdateSchema = zodOpenapi.z.object({
|
|
1885
|
-
enabled: zodOpenapi.z.boolean().optional(),
|
|
1886
|
-
numEvents: zodOpenapi.z.number().min(1).max(STATUS_UPDATE_MAX_NUM_EVENTS).optional(),
|
|
1887
|
-
timeInSeconds: zodOpenapi.z.number().min(1).max(STATUS_UPDATE_MAX_INTERVAL_SECONDS).optional(),
|
|
1888
|
-
prompt: zodOpenapi.z.string().max(
|
|
1889
|
-
VALIDATION_SUB_AGENT_PROMPT_MAX_CHARS,
|
|
1890
|
-
`Custom prompt cannot exceed ${VALIDATION_SUB_AGENT_PROMPT_MAX_CHARS} characters`
|
|
1891
|
-
).optional(),
|
|
1892
|
-
statusComponents: zodOpenapi.z.array(StatusComponentSchema).optional()
|
|
1893
|
-
}).openapi("StatusUpdate");
|
|
1894
|
-
var CanUseItemSchema = zodOpenapi.z.object({
|
|
1895
|
-
agentToolRelationId: zodOpenapi.z.string().optional(),
|
|
1896
|
-
toolId: zodOpenapi.z.string(),
|
|
1897
|
-
toolSelection: zodOpenapi.z.array(zodOpenapi.z.string()).nullish(),
|
|
1898
|
-
headers: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.string()).nullish()
|
|
1899
|
-
}).openapi("CanUseItem");
|
|
1900
|
-
var canDelegateToExternalAgentSchema = zodOpenapi.z.object({
|
|
1901
|
-
externalAgentId: zodOpenapi.z.string(),
|
|
1902
|
-
subAgentExternalAgentRelationId: zodOpenapi.z.string().optional(),
|
|
1903
|
-
headers: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.string()).nullish()
|
|
1904
|
-
}).openapi("CanDelegateToExternalAgent");
|
|
1905
|
-
var canDelegateToTeamAgentSchema = zodOpenapi.z.object({
|
|
1906
|
-
agentId: zodOpenapi.z.string(),
|
|
1907
|
-
subAgentTeamAgentRelationId: zodOpenapi.z.string().optional(),
|
|
1908
|
-
headers: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.string()).nullish()
|
|
1909
|
-
}).openapi("CanDelegateToTeamAgent");
|
|
1910
|
-
var TeamAgentSchema = zodOpenapi.z.object({
|
|
1911
|
-
id: zodOpenapi.z.string(),
|
|
1912
|
-
name: zodOpenapi.z.string(),
|
|
1913
|
-
description: zodOpenapi.z.string()
|
|
1914
|
-
}).openapi("TeamAgent");
|
|
1915
|
-
var FullAgentAgentInsertSchema = SubAgentApiInsertSchema.extend({
|
|
1916
|
-
type: zodOpenapi.z.literal("internal"),
|
|
1917
|
-
canUse: zodOpenapi.z.array(CanUseItemSchema),
|
|
1918
|
-
// All tools (both MCP and function tools)
|
|
1919
|
-
dataComponents: zodOpenapi.z.array(zodOpenapi.z.string()).optional(),
|
|
1920
|
-
artifactComponents: zodOpenapi.z.array(zodOpenapi.z.string()).optional(),
|
|
1921
|
-
canTransferTo: zodOpenapi.z.array(zodOpenapi.z.string()).optional(),
|
|
1922
|
-
prompt: zodOpenapi.z.string().trim().nonempty(),
|
|
1923
|
-
canDelegateTo: zodOpenapi.z.array(
|
|
1924
|
-
zodOpenapi.z.union([
|
|
1925
|
-
zodOpenapi.z.string(),
|
|
1926
|
-
// Internal subAgent ID
|
|
1927
|
-
canDelegateToExternalAgentSchema,
|
|
1928
|
-
// External agent with headers
|
|
1929
|
-
canDelegateToTeamAgentSchema
|
|
1930
|
-
// Team agent with headers
|
|
1931
|
-
])
|
|
1932
|
-
).optional()
|
|
1933
|
-
}).openapi("FullAgentAgentInsert");
|
|
1934
|
-
var AgentWithinContextOfProjectSchema = AgentApiInsertSchema.extend({
|
|
1935
|
-
subAgents: zodOpenapi.z.record(zodOpenapi.z.string(), FullAgentAgentInsertSchema),
|
|
1936
|
-
// Lookup maps for UI to resolve canUse items
|
|
1937
|
-
tools: zodOpenapi.z.record(zodOpenapi.z.string(), ToolApiInsertSchema).optional(),
|
|
1938
|
-
// MCP tools (project-scoped)
|
|
1939
|
-
externalAgents: zodOpenapi.z.record(zodOpenapi.z.string(), ExternalAgentApiInsertSchema).optional(),
|
|
1940
|
-
// External agents (project-scoped)
|
|
1941
|
-
teamAgents: zodOpenapi.z.record(zodOpenapi.z.string(), TeamAgentSchema).optional(),
|
|
1942
|
-
// Team agents contain basic metadata for the agent to be delegated to
|
|
1943
|
-
functionTools: zodOpenapi.z.record(zodOpenapi.z.string(), FunctionToolApiInsertSchema).optional(),
|
|
1944
|
-
// Function tools (agent-scoped)
|
|
1945
|
-
functions: zodOpenapi.z.record(zodOpenapi.z.string(), FunctionApiInsertSchema).optional(),
|
|
1946
|
-
// Get function code for function tools
|
|
1947
|
-
contextConfig: zodOpenapi.z.optional(ContextConfigApiInsertSchema),
|
|
1948
|
-
statusUpdates: zodOpenapi.z.optional(StatusUpdateSchema),
|
|
1949
|
-
models: ModelSchema.optional(),
|
|
1950
|
-
stopWhen: AgentStopWhenSchema.optional(),
|
|
1951
|
-
prompt: zodOpenapi.z.string().max(
|
|
1952
|
-
VALIDATION_AGENT_PROMPT_MAX_CHARS,
|
|
1953
|
-
`Agent prompt cannot exceed ${VALIDATION_AGENT_PROMPT_MAX_CHARS} characters`
|
|
1954
|
-
).optional()
|
|
1955
|
-
}).openapi("AgentWithinContextOfProject");
|
|
1956
|
-
var PaginationSchema = zodOpenapi.z.object({
|
|
1957
|
-
page: pageNumber,
|
|
1958
|
-
limit: limitNumber,
|
|
1959
|
-
total: zodOpenapi.z.number(),
|
|
1960
|
-
pages: zodOpenapi.z.number()
|
|
1961
|
-
}).openapi("Pagination");
|
|
1962
|
-
var ListResponseSchema = (itemSchema) => zodOpenapi.z.object({
|
|
1963
|
-
data: zodOpenapi.z.array(itemSchema),
|
|
1964
|
-
pagination: PaginationSchema
|
|
1965
|
-
});
|
|
1966
|
-
var SingleResponseSchema = (itemSchema) => zodOpenapi.z.object({
|
|
1967
|
-
data: itemSchema
|
|
1968
|
-
});
|
|
1969
|
-
var ErrorResponseSchema = zodOpenapi.z.object({
|
|
1970
|
-
error: zodOpenapi.z.string(),
|
|
1971
|
-
message: zodOpenapi.z.string().optional(),
|
|
1972
|
-
details: zodOpenapi.z.any().optional().openapi({
|
|
1973
|
-
description: "Additional error details"
|
|
1974
|
-
})
|
|
1975
|
-
}).openapi("ErrorResponse");
|
|
1976
|
-
var ExistsResponseSchema = zodOpenapi.z.object({
|
|
1977
|
-
exists: zodOpenapi.z.boolean()
|
|
1978
|
-
}).openapi("ExistsResponse");
|
|
1979
|
-
var RemovedResponseSchema = zodOpenapi.z.object({
|
|
1980
|
-
message: zodOpenapi.z.string(),
|
|
1981
|
-
removed: zodOpenapi.z.boolean()
|
|
1982
|
-
}).openapi("RemovedResponse");
|
|
1983
|
-
var ProjectSelectSchema = registerFieldSchemas(
|
|
1984
|
-
createSelectSchema(projects).extend({
|
|
1985
|
-
models: ProjectModelSchema.nullable(),
|
|
1986
|
-
stopWhen: StopWhenSchema.nullable()
|
|
1987
|
-
})
|
|
1988
|
-
);
|
|
1989
|
-
var ProjectInsertSchema = createInsertSchema(projects).extend({
|
|
1990
|
-
models: ProjectModelSchema,
|
|
1991
|
-
stopWhen: StopWhenSchema.optional()
|
|
1992
|
-
}).omit({
|
|
1993
|
-
createdAt: true,
|
|
1994
|
-
updatedAt: true
|
|
1995
|
-
});
|
|
1996
|
-
var ProjectUpdateSchema = ProjectInsertSchema.partial().omit({
|
|
1997
|
-
id: true,
|
|
1998
|
-
tenantId: true
|
|
1999
|
-
});
|
|
2000
|
-
var ProjectApiSelectSchema = ProjectSelectSchema.omit({ tenantId: true }).openapi(
|
|
2001
|
-
"Project"
|
|
2002
|
-
);
|
|
2003
|
-
var ProjectApiInsertSchema = ProjectInsertSchema.omit({ tenantId: true }).openapi(
|
|
2004
|
-
"ProjectCreate"
|
|
2005
|
-
);
|
|
2006
|
-
var ProjectApiUpdateSchema = ProjectUpdateSchema.openapi("ProjectUpdate");
|
|
2007
|
-
var FullProjectDefinitionSchema = ProjectApiInsertSchema.extend({
|
|
2008
|
-
agents: zodOpenapi.z.record(zodOpenapi.z.string(), AgentWithinContextOfProjectSchema),
|
|
2009
|
-
tools: zodOpenapi.z.record(zodOpenapi.z.string(), ToolApiInsertSchema),
|
|
2010
|
-
functionTools: zodOpenapi.z.record(zodOpenapi.z.string(), FunctionToolApiInsertSchema).optional(),
|
|
2011
|
-
functions: zodOpenapi.z.record(zodOpenapi.z.string(), FunctionApiInsertSchema).optional(),
|
|
2012
|
-
dataComponents: zodOpenapi.z.record(zodOpenapi.z.string(), DataComponentApiInsertSchema).optional(),
|
|
2013
|
-
artifactComponents: zodOpenapi.z.record(zodOpenapi.z.string(), ArtifactComponentApiInsertSchema).optional(),
|
|
2014
|
-
externalAgents: zodOpenapi.z.record(zodOpenapi.z.string(), ExternalAgentApiInsertSchema).optional(),
|
|
2015
|
-
statusUpdates: zodOpenapi.z.optional(StatusUpdateSchema),
|
|
2016
|
-
credentialReferences: zodOpenapi.z.record(zodOpenapi.z.string(), CredentialReferenceApiInsertSchema).optional(),
|
|
2017
|
-
createdAt: zodOpenapi.z.string().optional(),
|
|
2018
|
-
updatedAt: zodOpenapi.z.string().optional()
|
|
2019
|
-
}).openapi("FullProjectDefinition");
|
|
2020
|
-
var ProjectResponse = zodOpenapi.z.object({ data: ProjectApiSelectSchema }).openapi("ProjectResponse");
|
|
2021
|
-
var SubAgentResponse = zodOpenapi.z.object({ data: SubAgentApiSelectSchema }).openapi("SubAgentResponse");
|
|
2022
|
-
var AgentResponse = zodOpenapi.z.object({ data: AgentApiSelectSchema }).openapi("AgentResponse");
|
|
2023
|
-
var ToolResponse = zodOpenapi.z.object({ data: ToolApiSelectSchema }).openapi("ToolResponse");
|
|
2024
|
-
var ExternalAgentResponse = zodOpenapi.z.object({ data: ExternalAgentApiSelectSchema }).openapi("ExternalAgentResponse");
|
|
2025
|
-
var ContextConfigResponse = zodOpenapi.z.object({ data: ContextConfigApiSelectSchema }).openapi("ContextConfigResponse");
|
|
2026
|
-
var ApiKeyResponse = zodOpenapi.z.object({ data: ApiKeyApiSelectSchema }).openapi("ApiKeyResponse");
|
|
2027
|
-
var CredentialReferenceResponse = zodOpenapi.z.object({ data: CredentialReferenceApiSelectSchema }).openapi("CredentialReferenceResponse");
|
|
2028
|
-
var FunctionResponse = zodOpenapi.z.object({ data: FunctionApiSelectSchema }).openapi("FunctionResponse");
|
|
2029
|
-
var FunctionToolResponse = zodOpenapi.z.object({ data: FunctionToolApiSelectSchema }).openapi("FunctionToolResponse");
|
|
2030
|
-
var DataComponentResponse = zodOpenapi.z.object({ data: DataComponentApiSelectSchema }).openapi("DataComponentResponse");
|
|
2031
|
-
var ArtifactComponentResponse = zodOpenapi.z.object({ data: ArtifactComponentApiSelectSchema }).openapi("ArtifactComponentResponse");
|
|
2032
|
-
var SubAgentRelationResponse = zodOpenapi.z.object({ data: SubAgentRelationApiSelectSchema }).openapi("SubAgentRelationResponse");
|
|
2033
|
-
var SubAgentToolRelationResponse = zodOpenapi.z.object({ data: SubAgentToolRelationApiSelectSchema }).openapi("SubAgentToolRelationResponse");
|
|
2034
|
-
var ConversationResponse = zodOpenapi.z.object({ data: ConversationApiSelectSchema }).openapi("ConversationResponse");
|
|
2035
|
-
var MessageResponse = zodOpenapi.z.object({ data: MessageApiSelectSchema }).openapi("MessageResponse");
|
|
2036
|
-
var ProjectListResponse = zodOpenapi.z.object({
|
|
2037
|
-
data: zodOpenapi.z.array(ProjectApiSelectSchema),
|
|
2038
|
-
pagination: PaginationSchema
|
|
2039
|
-
}).openapi("ProjectListResponse");
|
|
2040
|
-
var SubAgentListResponse = zodOpenapi.z.object({
|
|
2041
|
-
data: zodOpenapi.z.array(SubAgentApiSelectSchema),
|
|
2042
|
-
pagination: PaginationSchema
|
|
2043
|
-
}).openapi("SubAgentListResponse");
|
|
2044
|
-
var AgentListResponse = zodOpenapi.z.object({
|
|
2045
|
-
data: zodOpenapi.z.array(AgentApiSelectSchema),
|
|
2046
|
-
pagination: PaginationSchema
|
|
2047
|
-
}).openapi("AgentListResponse");
|
|
2048
|
-
var ToolListResponse = zodOpenapi.z.object({
|
|
2049
|
-
data: zodOpenapi.z.array(ToolApiSelectSchema),
|
|
2050
|
-
pagination: PaginationSchema
|
|
2051
|
-
}).openapi("ToolListResponse");
|
|
2052
|
-
var ExternalAgentListResponse = zodOpenapi.z.object({
|
|
2053
|
-
data: zodOpenapi.z.array(ExternalAgentApiSelectSchema),
|
|
2054
|
-
pagination: PaginationSchema
|
|
2055
|
-
}).openapi("ExternalAgentListResponse");
|
|
2056
|
-
var ContextConfigListResponse = zodOpenapi.z.object({
|
|
2057
|
-
data: zodOpenapi.z.array(ContextConfigApiSelectSchema),
|
|
2058
|
-
pagination: PaginationSchema
|
|
2059
|
-
}).openapi("ContextConfigListResponse");
|
|
2060
|
-
var ApiKeyListResponse = zodOpenapi.z.object({
|
|
2061
|
-
data: zodOpenapi.z.array(ApiKeyApiSelectSchema),
|
|
2062
|
-
pagination: PaginationSchema
|
|
2063
|
-
}).openapi("ApiKeyListResponse");
|
|
2064
|
-
var CredentialReferenceListResponse = zodOpenapi.z.object({
|
|
2065
|
-
data: zodOpenapi.z.array(CredentialReferenceApiSelectSchema),
|
|
2066
|
-
pagination: PaginationSchema
|
|
2067
|
-
}).openapi("CredentialReferenceListResponse");
|
|
2068
|
-
var FunctionListResponse = zodOpenapi.z.object({
|
|
2069
|
-
data: zodOpenapi.z.array(FunctionApiSelectSchema),
|
|
2070
|
-
pagination: PaginationSchema
|
|
2071
|
-
}).openapi("FunctionListResponse");
|
|
2072
|
-
var FunctionToolListResponse = zodOpenapi.z.object({
|
|
2073
|
-
data: zodOpenapi.z.array(FunctionToolApiSelectSchema),
|
|
2074
|
-
pagination: PaginationSchema
|
|
2075
|
-
}).openapi("FunctionToolListResponse");
|
|
2076
|
-
var DataComponentListResponse = zodOpenapi.z.object({
|
|
2077
|
-
data: zodOpenapi.z.array(DataComponentApiSelectSchema),
|
|
2078
|
-
pagination: PaginationSchema
|
|
2079
|
-
}).openapi("DataComponentListResponse");
|
|
2080
|
-
var ArtifactComponentListResponse = zodOpenapi.z.object({
|
|
2081
|
-
data: zodOpenapi.z.array(ArtifactComponentApiSelectSchema),
|
|
2082
|
-
pagination: PaginationSchema
|
|
2083
|
-
}).openapi("ArtifactComponentListResponse");
|
|
2084
|
-
var SubAgentRelationListResponse = zodOpenapi.z.object({
|
|
2085
|
-
data: zodOpenapi.z.array(SubAgentRelationApiSelectSchema),
|
|
2086
|
-
pagination: PaginationSchema
|
|
2087
|
-
}).openapi("SubAgentRelationListResponse");
|
|
2088
|
-
var SubAgentToolRelationListResponse = zodOpenapi.z.object({
|
|
2089
|
-
data: zodOpenapi.z.array(SubAgentToolRelationApiSelectSchema),
|
|
2090
|
-
pagination: PaginationSchema
|
|
2091
|
-
}).openapi("SubAgentToolRelationListResponse");
|
|
2092
|
-
var ConversationListResponse = zodOpenapi.z.object({
|
|
2093
|
-
data: zodOpenapi.z.array(ConversationApiSelectSchema),
|
|
2094
|
-
pagination: PaginationSchema
|
|
2095
|
-
}).openapi("ConversationListResponse");
|
|
2096
|
-
var MessageListResponse = zodOpenapi.z.object({
|
|
2097
|
-
data: zodOpenapi.z.array(MessageApiSelectSchema),
|
|
2098
|
-
pagination: PaginationSchema
|
|
2099
|
-
}).openapi("MessageListResponse");
|
|
2100
|
-
var SubAgentDataComponentResponse = zodOpenapi.z.object({ data: SubAgentDataComponentApiSelectSchema }).openapi("SubAgentDataComponentResponse");
|
|
2101
|
-
var SubAgentArtifactComponentResponse = zodOpenapi.z.object({ data: SubAgentArtifactComponentApiSelectSchema }).openapi("SubAgentArtifactComponentResponse");
|
|
2102
|
-
var SubAgentDataComponentListResponse = zodOpenapi.z.object({
|
|
2103
|
-
data: zodOpenapi.z.array(SubAgentDataComponentApiSelectSchema),
|
|
2104
|
-
pagination: PaginationSchema
|
|
2105
|
-
}).openapi("SubAgentDataComponentListResponse");
|
|
2106
|
-
var SubAgentArtifactComponentListResponse = zodOpenapi.z.object({
|
|
2107
|
-
data: zodOpenapi.z.array(SubAgentArtifactComponentApiSelectSchema),
|
|
2108
|
-
pagination: PaginationSchema
|
|
2109
|
-
}).openapi("SubAgentArtifactComponentListResponse");
|
|
2110
|
-
var FullProjectDefinitionResponse = zodOpenapi.z.object({ data: FullProjectDefinitionSchema }).openapi("FullProjectDefinitionResponse");
|
|
2111
|
-
var AgentWithinContextOfProjectResponse = zodOpenapi.z.object({ data: AgentWithinContextOfProjectSchema }).openapi("AgentWithinContextOfProjectResponse");
|
|
2112
|
-
var RelatedAgentInfoListResponse = zodOpenapi.z.object({
|
|
2113
|
-
data: zodOpenapi.z.array(RelatedAgentInfoSchema),
|
|
2114
|
-
pagination: PaginationSchema
|
|
2115
|
-
}).openapi("RelatedAgentInfoListResponse");
|
|
2116
|
-
var ComponentAssociationListResponse = zodOpenapi.z.object({ data: zodOpenapi.z.array(ComponentAssociationSchema) }).openapi("ComponentAssociationListResponse");
|
|
2117
|
-
var McpToolResponse = zodOpenapi.z.object({ data: McpToolSchema }).openapi("McpToolResponse");
|
|
2118
|
-
var McpToolListResponse = zodOpenapi.z.object({
|
|
2119
|
-
data: zodOpenapi.z.array(McpToolSchema),
|
|
2120
|
-
pagination: PaginationSchema
|
|
2121
|
-
}).openapi("McpToolListResponse");
|
|
2122
|
-
var SubAgentTeamAgentRelationResponse = zodOpenapi.z.object({ data: SubAgentTeamAgentRelationApiSelectSchema }).openapi("SubAgentTeamAgentRelationResponse");
|
|
2123
|
-
var SubAgentTeamAgentRelationListResponse = zodOpenapi.z.object({
|
|
2124
|
-
data: zodOpenapi.z.array(SubAgentTeamAgentRelationApiSelectSchema),
|
|
2125
|
-
pagination: PaginationSchema
|
|
2126
|
-
}).openapi("SubAgentTeamAgentRelationListResponse");
|
|
2127
|
-
var SubAgentExternalAgentRelationResponse = zodOpenapi.z.object({ data: SubAgentExternalAgentRelationApiSelectSchema }).openapi("SubAgentExternalAgentRelationResponse");
|
|
2128
|
-
var SubAgentExternalAgentRelationListResponse = zodOpenapi.z.object({
|
|
2129
|
-
data: zodOpenapi.z.array(SubAgentExternalAgentRelationApiSelectSchema),
|
|
2130
|
-
pagination: PaginationSchema
|
|
2131
|
-
}).openapi("SubAgentExternalAgentRelationListResponse");
|
|
2132
|
-
var DataComponentArrayResponse = zodOpenapi.z.object({ data: zodOpenapi.z.array(DataComponentApiSelectSchema) }).openapi("DataComponentArrayResponse");
|
|
2133
|
-
var ArtifactComponentArrayResponse = zodOpenapi.z.object({ data: zodOpenapi.z.array(ArtifactComponentApiSelectSchema) }).openapi("ArtifactComponentArrayResponse");
|
|
2134
|
-
var HeadersScopeSchema = zodOpenapi.z.object({
|
|
2135
|
-
"x-inkeep-tenant-id": zodOpenapi.z.string().optional().openapi({
|
|
2136
|
-
description: "Tenant identifier",
|
|
2137
|
-
example: "tenant_123"
|
|
2138
|
-
}),
|
|
2139
|
-
"x-inkeep-project-id": zodOpenapi.z.string().optional().openapi({
|
|
2140
|
-
description: "Project identifier",
|
|
2141
|
-
example: "project_456"
|
|
2142
|
-
}),
|
|
2143
|
-
"x-inkeep-agent-id": zodOpenapi.z.string().optional().openapi({
|
|
2144
|
-
description: "Agent identifier",
|
|
2145
|
-
example: "agent_789"
|
|
2146
|
-
})
|
|
2147
|
-
});
|
|
2148
|
-
var TenantId = zodOpenapi.z.string().openapi("TenantIdPathParam", {
|
|
2149
|
-
param: {
|
|
2150
|
-
name: "tenantId",
|
|
2151
|
-
in: "path"
|
|
2152
|
-
},
|
|
2153
|
-
description: "Tenant identifier",
|
|
2154
|
-
example: "tenant_123"
|
|
2155
|
-
});
|
|
2156
|
-
var ProjectId = zodOpenapi.z.string().openapi("ProjectIdPathParam", {
|
|
2157
|
-
param: {
|
|
2158
|
-
name: "projectId",
|
|
2159
|
-
in: "path"
|
|
2160
|
-
},
|
|
2161
|
-
description: "Project identifier",
|
|
2162
|
-
example: "project_456"
|
|
2163
|
-
});
|
|
2164
|
-
var AgentId = zodOpenapi.z.string().openapi("AgentIdPathParam", {
|
|
2165
|
-
param: {
|
|
2166
|
-
name: "agentId",
|
|
2167
|
-
in: "path"
|
|
2168
|
-
},
|
|
2169
|
-
description: "Agent identifier",
|
|
2170
|
-
example: "agent_789"
|
|
2171
|
-
});
|
|
2172
|
-
var SubAgentId = zodOpenapi.z.string().openapi("SubAgentIdPathParam", {
|
|
2173
|
-
param: {
|
|
2174
|
-
name: "subAgentId",
|
|
2175
|
-
in: "path"
|
|
2176
|
-
},
|
|
2177
|
-
description: "Sub-agent identifier",
|
|
2178
|
-
example: "sub_agent_123"
|
|
2179
|
-
});
|
|
2180
|
-
var TenantParamsSchema = zodOpenapi.z.object({
|
|
2181
|
-
tenantId: TenantId
|
|
2182
|
-
});
|
|
2183
|
-
var TenantIdParamsSchema = TenantParamsSchema.extend({
|
|
2184
|
-
id: resourceIdSchema
|
|
2185
|
-
});
|
|
2186
|
-
var TenantProjectParamsSchema = TenantParamsSchema.extend({
|
|
2187
|
-
projectId: ProjectId
|
|
2188
|
-
});
|
|
2189
|
-
var TenantProjectIdParamsSchema = TenantProjectParamsSchema.extend({
|
|
2190
|
-
id: resourceIdSchema
|
|
2191
|
-
});
|
|
2192
|
-
var TenantProjectAgentParamsSchema = TenantProjectParamsSchema.extend({
|
|
2193
|
-
agentId: AgentId
|
|
2194
|
-
});
|
|
2195
|
-
var TenantProjectAgentIdParamsSchema = TenantProjectAgentParamsSchema.extend({
|
|
2196
|
-
id: resourceIdSchema
|
|
2197
|
-
});
|
|
2198
|
-
var TenantProjectAgentSubAgentParamsSchema = TenantProjectAgentParamsSchema.extend({
|
|
2199
|
-
subAgentId: SubAgentId
|
|
2200
|
-
});
|
|
2201
|
-
var TenantProjectAgentSubAgentIdParamsSchema = TenantProjectAgentSubAgentParamsSchema.extend({
|
|
2202
|
-
id: resourceIdSchema
|
|
2203
|
-
});
|
|
2204
|
-
var PaginationQueryParamsSchema = zodOpenapi.z.object({
|
|
2205
|
-
page: pageNumber,
|
|
2206
|
-
limit: limitNumber
|
|
2207
|
-
}).openapi("PaginationQueryParams");
|
|
2208
|
-
|
|
2209
|
-
// src/validation/agentFull.ts
|
|
2210
|
-
function validateAndTypeAgentData(data) {
|
|
2211
|
-
return AgentWithinContextOfProjectSchema.parse(data);
|
|
2212
|
-
}
|
|
2213
|
-
function validateToolReferences(agentData, availableToolIds) {
|
|
2214
|
-
if (!availableToolIds) {
|
|
2215
|
-
return;
|
|
2216
|
-
}
|
|
2217
|
-
const errors = [];
|
|
2218
|
-
for (const [subAgentId, subAgent] of Object.entries(agentData.subAgents)) {
|
|
2219
|
-
if (subAgent.canUse && Array.isArray(subAgent.canUse)) {
|
|
2220
|
-
for (const canUseItem of subAgent.canUse) {
|
|
2221
|
-
if (!availableToolIds.has(canUseItem.toolId)) {
|
|
2222
|
-
errors.push(`Agent '${subAgentId}' references non-existent tool '${canUseItem.toolId}'`);
|
|
2223
|
-
}
|
|
2224
|
-
}
|
|
2225
|
-
}
|
|
2226
|
-
}
|
|
2227
|
-
if (errors.length > 0) {
|
|
2228
|
-
throw new Error(`Tool reference validation failed:
|
|
2229
|
-
${errors.join("\n")}`);
|
|
2230
|
-
}
|
|
2231
|
-
}
|
|
2232
|
-
function validateDataComponentReferences(agentData, availableDataComponentIds) {
|
|
2233
|
-
if (!availableDataComponentIds) {
|
|
2234
|
-
return;
|
|
2235
|
-
}
|
|
2236
|
-
const errors = [];
|
|
2237
|
-
for (const [subAgentId, subAgent] of Object.entries(agentData.subAgents)) {
|
|
2238
|
-
if (subAgent.dataComponents) {
|
|
2239
|
-
for (const dataComponentId of subAgent.dataComponents) {
|
|
2240
|
-
if (!availableDataComponentIds.has(dataComponentId)) {
|
|
2241
|
-
errors.push(
|
|
2242
|
-
`Agent '${subAgentId}' references non-existent dataComponent '${dataComponentId}'`
|
|
2243
|
-
);
|
|
2244
|
-
}
|
|
2245
|
-
}
|
|
2246
|
-
}
|
|
2247
|
-
}
|
|
2248
|
-
if (errors.length > 0) {
|
|
2249
|
-
throw new Error(`DataComponent reference validation failed:
|
|
2250
|
-
${errors.join("\n")}`);
|
|
2251
|
-
}
|
|
2252
|
-
}
|
|
2253
|
-
function validateArtifactComponentReferences(agentData, availableArtifactComponentIds) {
|
|
2254
|
-
if (!availableArtifactComponentIds) {
|
|
2255
|
-
return;
|
|
2256
|
-
}
|
|
2257
|
-
const errors = [];
|
|
2258
|
-
for (const [subAgentId, subAgent] of Object.entries(agentData.subAgents)) {
|
|
2259
|
-
if (subAgent.artifactComponents) {
|
|
2260
|
-
for (const artifactComponentId of subAgent.artifactComponents) {
|
|
2261
|
-
if (!availableArtifactComponentIds.has(artifactComponentId)) {
|
|
2262
|
-
errors.push(
|
|
2263
|
-
`Agent '${subAgentId}' references non-existent artifactComponent '${artifactComponentId}'`
|
|
2264
|
-
);
|
|
2265
|
-
}
|
|
2266
|
-
}
|
|
2267
|
-
}
|
|
2268
|
-
}
|
|
2269
|
-
if (errors.length > 0) {
|
|
2270
|
-
throw new Error(`ArtifactComponent reference validation failed:
|
|
2271
|
-
${errors.join("\n")}`);
|
|
2272
|
-
}
|
|
2273
|
-
}
|
|
2274
|
-
function validateAgentRelationships(agentData) {
|
|
2275
|
-
const errors = [];
|
|
2276
|
-
const availableAgentIds = new Set(Object.keys(agentData.subAgents));
|
|
2277
|
-
const availableExternalAgentIds = new Set(Object.keys(agentData.externalAgents ?? {}));
|
|
2278
|
-
for (const [subAgentId, subAgent] of Object.entries(agentData.subAgents)) {
|
|
2279
|
-
if (subAgent.canTransferTo && Array.isArray(subAgent.canTransferTo)) {
|
|
2280
|
-
for (const targetId of subAgent.canTransferTo) {
|
|
2281
|
-
if (!availableAgentIds.has(targetId)) {
|
|
2282
|
-
errors.push(
|
|
2283
|
-
`Agent '${subAgentId}' has transfer target '${targetId}' that doesn't exist in agent`
|
|
2284
|
-
);
|
|
2285
|
-
}
|
|
2286
|
-
}
|
|
2287
|
-
}
|
|
2288
|
-
if (subAgent.canDelegateTo && Array.isArray(subAgent.canDelegateTo)) {
|
|
2289
|
-
for (const targetItem of subAgent.canDelegateTo) {
|
|
2290
|
-
console.log("targetItem", targetItem);
|
|
2291
|
-
if (typeof targetItem === "string") {
|
|
2292
|
-
console.log("targetItem is string", targetItem);
|
|
2293
|
-
if (!availableAgentIds.has(targetItem) && !availableExternalAgentIds.has(targetItem)) {
|
|
2294
|
-
errors.push(
|
|
2295
|
-
`Agent '${subAgentId}' has delegation target '${targetItem}' that doesn't exist in agent`
|
|
2296
|
-
);
|
|
2297
|
-
}
|
|
2298
|
-
}
|
|
2299
|
-
}
|
|
2300
|
-
}
|
|
2301
|
-
}
|
|
2302
|
-
const cycles = detectDelegationCycles(agentData);
|
|
2303
|
-
if (cycles.length > 0) {
|
|
2304
|
-
errors.push(...cycles);
|
|
2305
|
-
}
|
|
2306
|
-
if (errors.length > 0)
|
|
2307
|
-
throw new Error(`Agent relationship validation failed:
|
|
2308
|
-
${errors.join("\n")}`);
|
|
2309
|
-
}
|
|
2310
|
-
function validateSubAgentExternalAgentRelations(agentData, availableExternalAgentIds) {
|
|
2311
|
-
if (!availableExternalAgentIds) {
|
|
2312
|
-
return;
|
|
2313
|
-
}
|
|
2314
|
-
const errors = [];
|
|
2315
|
-
for (const [subAgentId, subAgent] of Object.entries(agentData.subAgents)) {
|
|
2316
|
-
if (subAgent.canDelegateTo && Array.isArray(subAgent.canDelegateTo)) {
|
|
2317
|
-
for (const targetItem of subAgent.canDelegateTo) {
|
|
2318
|
-
if (typeof targetItem === "object" && "externalAgentId" in targetItem) {
|
|
2319
|
-
if (!availableExternalAgentIds.has(targetItem.externalAgentId)) {
|
|
2320
|
-
errors.push(
|
|
2321
|
-
`Agent '${subAgentId}' has delegation target '${targetItem.externalAgentId}' that doesn't exist in agent`
|
|
2322
|
-
);
|
|
2323
|
-
}
|
|
2324
|
-
}
|
|
2325
|
-
}
|
|
2326
|
-
}
|
|
2327
|
-
}
|
|
2328
|
-
if (errors.length > 0)
|
|
2329
|
-
throw new Error(`Sub agent external agent relation validation failed:
|
|
2330
|
-
${errors.join("\n")}`);
|
|
2331
|
-
}
|
|
2332
|
-
function validateAgentStructure(agentData, projectResources) {
|
|
2333
|
-
if (agentData.defaultSubAgentId && !agentData.subAgents[agentData.defaultSubAgentId]) {
|
|
2334
|
-
throw new Error(`Default agent '${agentData.defaultSubAgentId}' does not exist in agents`);
|
|
2335
|
-
}
|
|
2336
|
-
if (projectResources) {
|
|
2337
|
-
validateToolReferences(agentData, projectResources.toolIds);
|
|
2338
|
-
validateDataComponentReferences(agentData, projectResources.dataComponentIds);
|
|
2339
|
-
validateArtifactComponentReferences(agentData, projectResources.artifactComponentIds);
|
|
2340
|
-
validateSubAgentExternalAgentRelations(agentData, projectResources.externalAgentIds);
|
|
2341
|
-
}
|
|
2342
|
-
validateAgentRelationships(agentData);
|
|
2343
|
-
}
|
|
2344
|
-
var TransferDataSchema = zod.z.object({
|
|
2345
|
-
fromSubAgent: zod.z.string().describe("ID of the sub-agent transferring control"),
|
|
2346
|
-
targetSubAgent: zod.z.string().describe("ID of the sub-agent receiving control"),
|
|
2347
|
-
reason: zod.z.string().optional().describe("Reason for the transfer"),
|
|
2348
|
-
context: zod.z.any().optional().describe("Additional context data")
|
|
2349
|
-
});
|
|
2350
|
-
var DelegationSentDataSchema = zod.z.object({
|
|
2351
|
-
delegationId: zod.z.string().describe("Unique identifier for this delegation"),
|
|
2352
|
-
fromSubAgent: zod.z.string().describe("ID of the delegating sub-agent"),
|
|
2353
|
-
targetSubAgent: zod.z.string().describe("ID of the sub-agent receiving the delegation"),
|
|
2354
|
-
taskDescription: zod.z.string().describe("Description of the delegated task"),
|
|
2355
|
-
context: zod.z.any().optional().describe("Additional context data")
|
|
2356
|
-
});
|
|
2357
|
-
var DelegationReturnedDataSchema = zod.z.object({
|
|
2358
|
-
delegationId: zod.z.string().describe("Unique identifier matching the original delegation"),
|
|
2359
|
-
fromSubAgent: zod.z.string().describe("ID of the sub-agent that completed the task"),
|
|
2360
|
-
targetSubAgent: zod.z.string().describe("ID of the sub-agent receiving the result"),
|
|
2361
|
-
result: zod.z.any().optional().describe("Result data from the delegated task")
|
|
2362
|
-
});
|
|
2363
|
-
var DataOperationDetailsSchema = zod.z.object({
|
|
2364
|
-
timestamp: zod.z.number().describe("Unix timestamp in milliseconds"),
|
|
2365
|
-
subAgentId: zod.z.string().describe("ID of the sub-agent that generated this data"),
|
|
2366
|
-
data: zod.z.any().describe("The actual data payload")
|
|
2367
|
-
});
|
|
2368
|
-
var DataOperationEventSchema = zod.z.object({
|
|
2369
|
-
type: zod.z.string().describe("Event type identifier"),
|
|
2370
|
-
label: zod.z.string().describe("Human-readable label for the event"),
|
|
2371
|
-
details: DataOperationDetailsSchema
|
|
2372
|
-
});
|
|
2373
|
-
var A2AMessageMetadataSchema = zod.z.object({
|
|
2374
|
-
fromSubAgentId: zod.z.string().optional().describe("ID of the sending sub-agent"),
|
|
2375
|
-
toSubAgentId: zod.z.string().optional().describe("ID of the receiving sub-agent"),
|
|
2376
|
-
fromExternalAgentId: zod.z.string().optional().describe("ID of the sending external agent"),
|
|
2377
|
-
toExternalAgentId: zod.z.string().optional().describe("ID of the receiving external agent"),
|
|
2378
|
-
taskId: zod.z.string().optional().describe("Associated task ID"),
|
|
2379
|
-
a2aTaskId: zod.z.string().optional().describe("A2A-specific task ID")
|
|
2380
|
-
});
|
|
2381
|
-
|
|
2382
|
-
// src/validation/id-validation.ts
|
|
2383
|
-
function isValidResourceId(id) {
|
|
2384
|
-
const result = resourceIdSchema.safeParse(id);
|
|
2385
|
-
return result.success;
|
|
2386
|
-
}
|
|
2387
|
-
function generateIdFromName(name) {
|
|
2388
|
-
const id = name.toLowerCase().replace(/[^a-z0-9_-]+/g, "-").replace(/^-+|-+$/g, "").replace(/-{2,}/g, "-");
|
|
2389
|
-
if (!id) {
|
|
2390
|
-
throw new Error("Cannot generate valid ID from provided name");
|
|
2391
|
-
}
|
|
2392
|
-
const truncatedId = id.substring(0, MAX_ID_LENGTH);
|
|
2393
|
-
const result = resourceIdSchema.safeParse(truncatedId);
|
|
2394
|
-
if (!result.success) {
|
|
2395
|
-
throw new Error(`Generated ID "${truncatedId}" is not valid: ${result.error.message}`);
|
|
2396
|
-
}
|
|
2397
|
-
return truncatedId;
|
|
2398
|
-
}
|
|
2399
|
-
function validatePropsAsJsonSchema(props) {
|
|
2400
|
-
if (!props || typeof props === "object" && Object.keys(props).length === 0) {
|
|
2401
|
-
return {
|
|
2402
|
-
isValid: true,
|
|
2403
|
-
errors: []
|
|
2404
|
-
};
|
|
2405
|
-
}
|
|
2406
|
-
if (typeof props !== "object" || Array.isArray(props)) {
|
|
2407
|
-
return {
|
|
2408
|
-
isValid: false,
|
|
2409
|
-
errors: [
|
|
2410
|
-
{
|
|
2411
|
-
field: "props",
|
|
2412
|
-
message: "Props must be a valid JSON Schema object",
|
|
2413
|
-
value: props
|
|
2414
|
-
}
|
|
2415
|
-
]
|
|
2416
|
-
};
|
|
2417
|
-
}
|
|
2418
|
-
if (!props.type) {
|
|
2419
|
-
return {
|
|
2420
|
-
isValid: false,
|
|
2421
|
-
errors: [
|
|
2422
|
-
{
|
|
2423
|
-
field: "props.type",
|
|
2424
|
-
message: 'JSON Schema must have a "type" field'
|
|
2425
|
-
}
|
|
2426
|
-
]
|
|
2427
|
-
};
|
|
2428
|
-
}
|
|
2429
|
-
if (props.type !== "object") {
|
|
2430
|
-
return {
|
|
2431
|
-
isValid: false,
|
|
2432
|
-
errors: [
|
|
2433
|
-
{
|
|
2434
|
-
field: "props.type",
|
|
2435
|
-
message: 'JSON Schema type must be "object" for component props',
|
|
2436
|
-
value: props.type
|
|
2437
|
-
}
|
|
2438
|
-
]
|
|
2439
|
-
};
|
|
2440
|
-
}
|
|
2441
|
-
if (!props.properties || typeof props.properties !== "object") {
|
|
2442
|
-
return {
|
|
2443
|
-
isValid: false,
|
|
2444
|
-
errors: [
|
|
2445
|
-
{
|
|
2446
|
-
field: "props.properties",
|
|
2447
|
-
message: 'JSON Schema must have a "properties" object'
|
|
2448
|
-
}
|
|
2449
|
-
]
|
|
2450
|
-
};
|
|
2451
|
-
}
|
|
2452
|
-
if (props.required !== void 0 && !Array.isArray(props.required)) {
|
|
2453
|
-
return {
|
|
2454
|
-
isValid: false,
|
|
2455
|
-
errors: [
|
|
2456
|
-
{
|
|
2457
|
-
field: "props.required",
|
|
2458
|
-
message: 'If present, "required" must be an array'
|
|
2459
|
-
}
|
|
2460
|
-
]
|
|
2461
|
-
};
|
|
2462
|
-
}
|
|
2463
|
-
try {
|
|
2464
|
-
const schemaToValidate = { ...props };
|
|
2465
|
-
delete schemaToValidate.$schema;
|
|
2466
|
-
const schemaValidator = new Ajv__default.default({
|
|
2467
|
-
strict: false,
|
|
2468
|
-
// Allow unknown keywords like inPreview
|
|
2469
|
-
validateSchema: true,
|
|
2470
|
-
// Validate the schema itself
|
|
2471
|
-
addUsedSchema: false
|
|
2472
|
-
// Don't add schemas to the instance
|
|
2473
|
-
});
|
|
2474
|
-
const isValid = schemaValidator.validateSchema(schemaToValidate);
|
|
2475
|
-
if (!isValid) {
|
|
2476
|
-
const errors = schemaValidator.errors || [];
|
|
2477
|
-
return {
|
|
2478
|
-
isValid: false,
|
|
2479
|
-
errors: errors.map((error) => ({
|
|
2480
|
-
field: `props${error.instancePath || ""}`,
|
|
2481
|
-
message: error.message || "Invalid schema"
|
|
2482
|
-
}))
|
|
2483
|
-
};
|
|
2484
|
-
}
|
|
2485
|
-
return {
|
|
2486
|
-
isValid: true,
|
|
2487
|
-
errors: []
|
|
2488
|
-
};
|
|
2489
|
-
} catch (error) {
|
|
2490
|
-
return {
|
|
2491
|
-
isValid: false,
|
|
2492
|
-
errors: [
|
|
2493
|
-
{
|
|
2494
|
-
field: "props",
|
|
2495
|
-
message: `Schema validation failed: ${error instanceof Error ? error.message : "Unknown error"}`
|
|
2496
|
-
}
|
|
2497
|
-
]
|
|
2498
|
-
};
|
|
2499
|
-
}
|
|
2500
|
-
}
|
|
2501
|
-
|
|
2502
|
-
// src/validation/render-validation.ts
|
|
2503
|
-
var MAX_CODE_SIZE = 5e4;
|
|
2504
|
-
var MAX_DATA_SIZE = 1e4;
|
|
2505
|
-
var DANGEROUS_PATTERNS = [
|
|
2506
|
-
{
|
|
2507
|
-
pattern: /\beval\s*\(/i,
|
|
2508
|
-
message: "eval() is not allowed"
|
|
2509
|
-
},
|
|
2510
|
-
{
|
|
2511
|
-
pattern: /\bFunction\s*\(/i,
|
|
2512
|
-
message: "Function constructor is not allowed"
|
|
2513
|
-
},
|
|
2514
|
-
{
|
|
2515
|
-
pattern: /dangerouslySetInnerHTML/i,
|
|
2516
|
-
message: "dangerouslySetInnerHTML is not allowed"
|
|
2517
|
-
},
|
|
2518
|
-
{
|
|
2519
|
-
pattern: /<script\b/i,
|
|
2520
|
-
message: "Script tags are not allowed"
|
|
2521
|
-
},
|
|
2522
|
-
{
|
|
2523
|
-
pattern: /\bon\w+\s*=/i,
|
|
2524
|
-
message: "Inline event handlers (onClick=, onLoad=, etc.) are not allowed"
|
|
2525
|
-
},
|
|
2526
|
-
{
|
|
2527
|
-
pattern: /document\.write/i,
|
|
2528
|
-
message: "document.write is not allowed"
|
|
2529
|
-
},
|
|
2530
|
-
{
|
|
2531
|
-
pattern: /window\.location/i,
|
|
2532
|
-
message: "window.location is not allowed"
|
|
2533
|
-
},
|
|
2534
|
-
{
|
|
2535
|
-
pattern: /\.innerHTML\s*=/i,
|
|
2536
|
-
message: "innerHTML manipulation is not allowed"
|
|
2537
|
-
}
|
|
2538
|
-
];
|
|
2539
|
-
var ALLOWED_IMPORTS = ["lucide-react", "react"];
|
|
2540
|
-
function validateRender(render) {
|
|
2541
|
-
const errors = [];
|
|
2542
|
-
if (!render.component || typeof render.component !== "string") {
|
|
2543
|
-
return {
|
|
2544
|
-
isValid: false,
|
|
2545
|
-
errors: [{ field: "render.component", message: "Component must be a non-empty string" }]
|
|
2546
|
-
};
|
|
2547
|
-
}
|
|
2548
|
-
if (!render.mockData || typeof render.mockData !== "object") {
|
|
2549
|
-
return {
|
|
2550
|
-
isValid: false,
|
|
2551
|
-
errors: [{ field: "render.mockData", message: "MockData must be an object" }]
|
|
2552
|
-
};
|
|
2553
|
-
}
|
|
2554
|
-
if (render.component.length > MAX_CODE_SIZE) {
|
|
2555
|
-
errors.push({
|
|
2556
|
-
field: "render.component",
|
|
2557
|
-
message: `Component size exceeds maximum allowed (${MAX_CODE_SIZE} characters)`
|
|
2558
|
-
});
|
|
2559
|
-
}
|
|
2560
|
-
const dataString = JSON.stringify(render.mockData);
|
|
2561
|
-
if (dataString.length > MAX_DATA_SIZE) {
|
|
2562
|
-
errors.push({
|
|
2563
|
-
field: "render.mockData",
|
|
2564
|
-
message: `MockData size exceeds maximum allowed (${MAX_DATA_SIZE} characters)`
|
|
2565
|
-
});
|
|
2566
|
-
}
|
|
2567
|
-
for (const { pattern, message } of DANGEROUS_PATTERNS) {
|
|
2568
|
-
if (pattern.test(render.component)) {
|
|
2569
|
-
errors.push({
|
|
2570
|
-
field: "render.component",
|
|
2571
|
-
message: `Component contains potentially dangerous pattern: ${message}`
|
|
2572
|
-
});
|
|
2573
|
-
}
|
|
2574
|
-
}
|
|
2575
|
-
const importMatches = render.component.matchAll(/import\s+.*?\s+from\s+['"]([^'"]+)['"]/g);
|
|
2576
|
-
for (const match of importMatches) {
|
|
2577
|
-
const importPath = match[1];
|
|
2578
|
-
if (!ALLOWED_IMPORTS.includes(importPath) && !importPath.startsWith(".")) {
|
|
2579
|
-
errors.push({
|
|
2580
|
-
field: "render.component",
|
|
2581
|
-
message: `Import from "${importPath}" is not allowed. Only imports from ${ALLOWED_IMPORTS.join(", ")} are permitted`
|
|
2582
|
-
});
|
|
2583
|
-
}
|
|
2584
|
-
}
|
|
2585
|
-
const hasFunctionDeclaration = /function\s+\w+\s*\(/.test(render.component);
|
|
2586
|
-
if (!hasFunctionDeclaration) {
|
|
2587
|
-
errors.push({
|
|
2588
|
-
field: "render.component",
|
|
2589
|
-
message: "Component must contain a function declaration"
|
|
2590
|
-
});
|
|
2591
|
-
}
|
|
2592
|
-
const hasReturn = /return\s*\(?\s*</.test(render.component);
|
|
2593
|
-
if (!hasReturn) {
|
|
2594
|
-
errors.push({
|
|
2595
|
-
field: "render.component",
|
|
2596
|
-
message: "Component function must have a return statement with JSX"
|
|
2597
|
-
});
|
|
2598
|
-
}
|
|
2599
|
-
return {
|
|
2600
|
-
isValid: errors.length === 0,
|
|
2601
|
-
errors
|
|
2602
|
-
};
|
|
2603
|
-
}
|
|
2604
|
-
var TextStartEventSchema = zod.z.object({
|
|
2605
|
-
type: zod.z.literal("text-start"),
|
|
2606
|
-
id: zod.z.string()
|
|
2607
|
-
});
|
|
2608
|
-
var TextDeltaEventSchema = zod.z.object({
|
|
2609
|
-
type: zod.z.literal("text-delta"),
|
|
2610
|
-
id: zod.z.string(),
|
|
2611
|
-
delta: zod.z.string()
|
|
2612
|
-
});
|
|
2613
|
-
var TextEndEventSchema = zod.z.object({
|
|
2614
|
-
type: zod.z.literal("text-end"),
|
|
2615
|
-
id: zod.z.string()
|
|
2616
|
-
});
|
|
2617
|
-
var DataComponentStreamEventSchema = zod.z.object({
|
|
2618
|
-
type: zod.z.literal("data-component"),
|
|
2619
|
-
id: zod.z.string(),
|
|
2620
|
-
data: zod.z.any()
|
|
2621
|
-
});
|
|
2622
|
-
var DataOperationStreamEventSchema = zod.z.object({
|
|
2623
|
-
type: zod.z.literal("data-operation"),
|
|
2624
|
-
data: zod.z.any()
|
|
2625
|
-
// Contains OperationEvent types (AgentInitializingEvent, CompletionEvent, etc.)
|
|
2626
|
-
});
|
|
2627
|
-
var DataSummaryStreamEventSchema = zod.z.object({
|
|
2628
|
-
type: zod.z.literal("data-summary"),
|
|
2629
|
-
data: zod.z.any()
|
|
2630
|
-
// Contains SummaryEvent from entities.ts
|
|
2631
|
-
});
|
|
2632
|
-
var StreamErrorEventSchema = zod.z.object({
|
|
2633
|
-
type: zod.z.literal("error"),
|
|
2634
|
-
error: zod.z.string()
|
|
2635
|
-
});
|
|
2636
|
-
var StreamFinishEventSchema = zod.z.object({
|
|
2637
|
-
type: zod.z.literal("finish"),
|
|
2638
|
-
finishReason: zod.z.string().optional(),
|
|
2639
|
-
usage: zod.z.object({
|
|
2640
|
-
promptTokens: zod.z.number().optional(),
|
|
2641
|
-
completionTokens: zod.z.number().optional(),
|
|
2642
|
-
totalTokens: zod.z.number().optional()
|
|
2643
|
-
}).optional()
|
|
2644
|
-
});
|
|
2645
|
-
var StreamEventSchema = zod.z.discriminatedUnion("type", [
|
|
2646
|
-
TextStartEventSchema,
|
|
2647
|
-
TextDeltaEventSchema,
|
|
2648
|
-
TextEndEventSchema,
|
|
2649
|
-
DataComponentStreamEventSchema,
|
|
2650
|
-
DataOperationStreamEventSchema,
|
|
2651
|
-
DataSummaryStreamEventSchema,
|
|
2652
|
-
StreamErrorEventSchema,
|
|
2653
|
-
StreamFinishEventSchema
|
|
2654
|
-
]);
|
|
2655
|
-
|
|
2656
|
-
exports.A2AMessageMetadataSchema = A2AMessageMetadataSchema;
|
|
2657
|
-
exports.AgentApiInsertSchema = AgentApiInsertSchema;
|
|
2658
|
-
exports.AgentApiSelectSchema = AgentApiSelectSchema;
|
|
2659
|
-
exports.AgentApiUpdateSchema = AgentApiUpdateSchema;
|
|
2660
|
-
exports.AgentInsertSchema = AgentInsertSchema;
|
|
2661
|
-
exports.AgentListResponse = AgentListResponse;
|
|
2662
|
-
exports.AgentResponse = AgentResponse;
|
|
2663
|
-
exports.AgentSelectSchema = AgentSelectSchema;
|
|
2664
|
-
exports.AgentStopWhenSchema = AgentStopWhenSchema;
|
|
2665
|
-
exports.AgentUpdateSchema = AgentUpdateSchema;
|
|
2666
|
-
exports.AgentWithinContextOfProjectResponse = AgentWithinContextOfProjectResponse;
|
|
2667
|
-
exports.AgentWithinContextOfProjectSchema = AgentWithinContextOfProjectSchema;
|
|
2668
|
-
exports.AllAgentSchema = AllAgentSchema;
|
|
2669
|
-
exports.ApiKeyApiCreationResponseSchema = ApiKeyApiCreationResponseSchema;
|
|
2670
|
-
exports.ApiKeyApiInsertSchema = ApiKeyApiInsertSchema;
|
|
2671
|
-
exports.ApiKeyApiSelectSchema = ApiKeyApiSelectSchema;
|
|
2672
|
-
exports.ApiKeyApiUpdateSchema = ApiKeyApiUpdateSchema;
|
|
2673
|
-
exports.ApiKeyInsertSchema = ApiKeyInsertSchema;
|
|
2674
|
-
exports.ApiKeyListResponse = ApiKeyListResponse;
|
|
2675
|
-
exports.ApiKeyResponse = ApiKeyResponse;
|
|
2676
|
-
exports.ApiKeySelectSchema = ApiKeySelectSchema;
|
|
2677
|
-
exports.ApiKeyUpdateSchema = ApiKeyUpdateSchema;
|
|
2678
|
-
exports.ArtifactComponentApiInsertSchema = ArtifactComponentApiInsertSchema;
|
|
2679
|
-
exports.ArtifactComponentApiSelectSchema = ArtifactComponentApiSelectSchema;
|
|
2680
|
-
exports.ArtifactComponentApiUpdateSchema = ArtifactComponentApiUpdateSchema;
|
|
2681
|
-
exports.ArtifactComponentArrayResponse = ArtifactComponentArrayResponse;
|
|
2682
|
-
exports.ArtifactComponentInsertSchema = ArtifactComponentInsertSchema;
|
|
2683
|
-
exports.ArtifactComponentListResponse = ArtifactComponentListResponse;
|
|
2684
|
-
exports.ArtifactComponentResponse = ArtifactComponentResponse;
|
|
2685
|
-
exports.ArtifactComponentSelectSchema = ArtifactComponentSelectSchema;
|
|
2686
|
-
exports.ArtifactComponentUpdateSchema = ArtifactComponentUpdateSchema;
|
|
2687
|
-
exports.CanUseItemSchema = CanUseItemSchema;
|
|
2688
|
-
exports.ComponentAssociationListResponse = ComponentAssociationListResponse;
|
|
2689
|
-
exports.ComponentAssociationSchema = ComponentAssociationSchema;
|
|
2690
|
-
exports.ContextCacheApiInsertSchema = ContextCacheApiInsertSchema;
|
|
2691
|
-
exports.ContextCacheApiSelectSchema = ContextCacheApiSelectSchema;
|
|
2692
|
-
exports.ContextCacheApiUpdateSchema = ContextCacheApiUpdateSchema;
|
|
2693
|
-
exports.ContextCacheInsertSchema = ContextCacheInsertSchema;
|
|
2694
|
-
exports.ContextCacheSelectSchema = ContextCacheSelectSchema;
|
|
2695
|
-
exports.ContextCacheUpdateSchema = ContextCacheUpdateSchema;
|
|
2696
|
-
exports.ContextConfigApiInsertSchema = ContextConfigApiInsertSchema;
|
|
2697
|
-
exports.ContextConfigApiSelectSchema = ContextConfigApiSelectSchema;
|
|
2698
|
-
exports.ContextConfigApiUpdateSchema = ContextConfigApiUpdateSchema;
|
|
2699
|
-
exports.ContextConfigInsertSchema = ContextConfigInsertSchema;
|
|
2700
|
-
exports.ContextConfigListResponse = ContextConfigListResponse;
|
|
2701
|
-
exports.ContextConfigResponse = ContextConfigResponse;
|
|
2702
|
-
exports.ContextConfigSelectSchema = ContextConfigSelectSchema;
|
|
2703
|
-
exports.ContextConfigUpdateSchema = ContextConfigUpdateSchema;
|
|
2704
|
-
exports.ConversationApiInsertSchema = ConversationApiInsertSchema;
|
|
2705
|
-
exports.ConversationApiSelectSchema = ConversationApiSelectSchema;
|
|
2706
|
-
exports.ConversationApiUpdateSchema = ConversationApiUpdateSchema;
|
|
2707
|
-
exports.ConversationInsertSchema = ConversationInsertSchema;
|
|
2708
|
-
exports.ConversationListResponse = ConversationListResponse;
|
|
2709
|
-
exports.ConversationResponse = ConversationResponse;
|
|
2710
|
-
exports.ConversationSelectSchema = ConversationSelectSchema;
|
|
2711
|
-
exports.ConversationUpdateSchema = ConversationUpdateSchema;
|
|
2712
|
-
exports.CreateCredentialInStoreRequestSchema = CreateCredentialInStoreRequestSchema;
|
|
2713
|
-
exports.CreateCredentialInStoreResponseSchema = CreateCredentialInStoreResponseSchema;
|
|
2714
|
-
exports.CredentialReferenceApiInsertSchema = CredentialReferenceApiInsertSchema;
|
|
2715
|
-
exports.CredentialReferenceApiSelectSchema = CredentialReferenceApiSelectSchema;
|
|
2716
|
-
exports.CredentialReferenceApiUpdateSchema = CredentialReferenceApiUpdateSchema;
|
|
2717
|
-
exports.CredentialReferenceInsertSchema = CredentialReferenceInsertSchema;
|
|
2718
|
-
exports.CredentialReferenceListResponse = CredentialReferenceListResponse;
|
|
2719
|
-
exports.CredentialReferenceResponse = CredentialReferenceResponse;
|
|
2720
|
-
exports.CredentialReferenceSelectSchema = CredentialReferenceSelectSchema;
|
|
2721
|
-
exports.CredentialReferenceUpdateSchema = CredentialReferenceUpdateSchema;
|
|
2722
|
-
exports.CredentialStoreListResponseSchema = CredentialStoreListResponseSchema;
|
|
2723
|
-
exports.CredentialStoreSchema = CredentialStoreSchema;
|
|
2724
|
-
exports.DataComponentApiInsertSchema = DataComponentApiInsertSchema;
|
|
2725
|
-
exports.DataComponentApiSelectSchema = DataComponentApiSelectSchema;
|
|
2726
|
-
exports.DataComponentApiUpdateSchema = DataComponentApiUpdateSchema;
|
|
2727
|
-
exports.DataComponentArrayResponse = DataComponentArrayResponse;
|
|
2728
|
-
exports.DataComponentBaseSchema = DataComponentBaseSchema;
|
|
2729
|
-
exports.DataComponentInsertSchema = DataComponentInsertSchema;
|
|
2730
|
-
exports.DataComponentListResponse = DataComponentListResponse;
|
|
2731
|
-
exports.DataComponentResponse = DataComponentResponse;
|
|
2732
|
-
exports.DataComponentSelectSchema = DataComponentSelectSchema;
|
|
2733
|
-
exports.DataComponentStreamEventSchema = DataComponentStreamEventSchema;
|
|
2734
|
-
exports.DataComponentUpdateSchema = DataComponentUpdateSchema;
|
|
2735
|
-
exports.DataOperationDetailsSchema = DataOperationDetailsSchema;
|
|
2736
|
-
exports.DataOperationEventSchema = DataOperationEventSchema;
|
|
2737
|
-
exports.DataOperationStreamEventSchema = DataOperationStreamEventSchema;
|
|
2738
|
-
exports.DataSummaryStreamEventSchema = DataSummaryStreamEventSchema;
|
|
2739
|
-
exports.DelegationReturnedDataSchema = DelegationReturnedDataSchema;
|
|
2740
|
-
exports.DelegationSentDataSchema = DelegationSentDataSchema;
|
|
2741
|
-
exports.ErrorResponseSchema = ErrorResponseSchema;
|
|
2742
|
-
exports.ExistsResponseSchema = ExistsResponseSchema;
|
|
2743
|
-
exports.ExternalAgentApiInsertSchema = ExternalAgentApiInsertSchema;
|
|
2744
|
-
exports.ExternalAgentApiSelectSchema = ExternalAgentApiSelectSchema;
|
|
2745
|
-
exports.ExternalAgentApiUpdateSchema = ExternalAgentApiUpdateSchema;
|
|
2746
|
-
exports.ExternalAgentInsertSchema = ExternalAgentInsertSchema;
|
|
2747
|
-
exports.ExternalAgentListResponse = ExternalAgentListResponse;
|
|
2748
|
-
exports.ExternalAgentResponse = ExternalAgentResponse;
|
|
2749
|
-
exports.ExternalAgentSelectSchema = ExternalAgentSelectSchema;
|
|
2750
|
-
exports.ExternalAgentUpdateSchema = ExternalAgentUpdateSchema;
|
|
2751
|
-
exports.ExternalSubAgentRelationApiInsertSchema = ExternalSubAgentRelationApiInsertSchema;
|
|
2752
|
-
exports.ExternalSubAgentRelationInsertSchema = ExternalSubAgentRelationInsertSchema;
|
|
2753
|
-
exports.FetchConfigSchema = FetchConfigSchema;
|
|
2754
|
-
exports.FetchDefinitionSchema = FetchDefinitionSchema;
|
|
2755
|
-
exports.FullAgentAgentInsertSchema = FullAgentAgentInsertSchema;
|
|
2756
|
-
exports.FullProjectDefinitionResponse = FullProjectDefinitionResponse;
|
|
2757
|
-
exports.FullProjectDefinitionSchema = FullProjectDefinitionSchema;
|
|
2758
|
-
exports.FunctionApiInsertSchema = FunctionApiInsertSchema;
|
|
2759
|
-
exports.FunctionApiSelectSchema = FunctionApiSelectSchema;
|
|
2760
|
-
exports.FunctionApiUpdateSchema = FunctionApiUpdateSchema;
|
|
2761
|
-
exports.FunctionInsertSchema = FunctionInsertSchema;
|
|
2762
|
-
exports.FunctionListResponse = FunctionListResponse;
|
|
2763
|
-
exports.FunctionResponse = FunctionResponse;
|
|
2764
|
-
exports.FunctionSelectSchema = FunctionSelectSchema;
|
|
2765
|
-
exports.FunctionToolApiInsertSchema = FunctionToolApiInsertSchema;
|
|
2766
|
-
exports.FunctionToolApiSelectSchema = FunctionToolApiSelectSchema;
|
|
2767
|
-
exports.FunctionToolApiUpdateSchema = FunctionToolApiUpdateSchema;
|
|
2768
|
-
exports.FunctionToolConfigSchema = FunctionToolConfigSchema;
|
|
2769
|
-
exports.FunctionToolInsertSchema = FunctionToolInsertSchema;
|
|
2770
|
-
exports.FunctionToolListResponse = FunctionToolListResponse;
|
|
2771
|
-
exports.FunctionToolResponse = FunctionToolResponse;
|
|
2772
|
-
exports.FunctionToolSelectSchema = FunctionToolSelectSchema;
|
|
2773
|
-
exports.FunctionToolUpdateSchema = FunctionToolUpdateSchema;
|
|
2774
|
-
exports.FunctionUpdateSchema = FunctionUpdateSchema;
|
|
2775
|
-
exports.HeadersScopeSchema = HeadersScopeSchema;
|
|
2776
|
-
exports.LedgerArtifactApiInsertSchema = LedgerArtifactApiInsertSchema;
|
|
2777
|
-
exports.LedgerArtifactApiSelectSchema = LedgerArtifactApiSelectSchema;
|
|
2778
|
-
exports.LedgerArtifactApiUpdateSchema = LedgerArtifactApiUpdateSchema;
|
|
2779
|
-
exports.LedgerArtifactInsertSchema = LedgerArtifactInsertSchema;
|
|
2780
|
-
exports.LedgerArtifactSelectSchema = LedgerArtifactSelectSchema;
|
|
2781
|
-
exports.LedgerArtifactUpdateSchema = LedgerArtifactUpdateSchema;
|
|
2782
|
-
exports.ListResponseSchema = ListResponseSchema;
|
|
2783
|
-
exports.MAX_ID_LENGTH = MAX_ID_LENGTH;
|
|
2784
|
-
exports.MCPToolConfigSchema = MCPToolConfigSchema;
|
|
2785
|
-
exports.MIN_ID_LENGTH = MIN_ID_LENGTH;
|
|
2786
|
-
exports.McpToolDefinitionSchema = McpToolDefinitionSchema;
|
|
2787
|
-
exports.McpToolListResponse = McpToolListResponse;
|
|
2788
|
-
exports.McpToolResponse = McpToolResponse;
|
|
2789
|
-
exports.McpToolSchema = McpToolSchema;
|
|
2790
|
-
exports.McpTransportConfigSchema = McpTransportConfigSchema;
|
|
2791
|
-
exports.MessageApiInsertSchema = MessageApiInsertSchema;
|
|
2792
|
-
exports.MessageApiSelectSchema = MessageApiSelectSchema;
|
|
2793
|
-
exports.MessageApiUpdateSchema = MessageApiUpdateSchema;
|
|
2794
|
-
exports.MessageInsertSchema = MessageInsertSchema;
|
|
2795
|
-
exports.MessageListResponse = MessageListResponse;
|
|
2796
|
-
exports.MessageResponse = MessageResponse;
|
|
2797
|
-
exports.MessageSelectSchema = MessageSelectSchema;
|
|
2798
|
-
exports.MessageUpdateSchema = MessageUpdateSchema;
|
|
2799
|
-
exports.ModelSchema = ModelSchema;
|
|
2800
|
-
exports.ModelSettingsSchema = ModelSettingsSchema;
|
|
2801
|
-
exports.OAuthCallbackQuerySchema = OAuthCallbackQuerySchema;
|
|
2802
|
-
exports.OAuthLoginQuerySchema = OAuthLoginQuerySchema;
|
|
2803
|
-
exports.PaginationQueryParamsSchema = PaginationQueryParamsSchema;
|
|
2804
|
-
exports.PaginationSchema = PaginationSchema;
|
|
2805
|
-
exports.ProjectApiInsertSchema = ProjectApiInsertSchema;
|
|
2806
|
-
exports.ProjectApiSelectSchema = ProjectApiSelectSchema;
|
|
2807
|
-
exports.ProjectApiUpdateSchema = ProjectApiUpdateSchema;
|
|
2808
|
-
exports.ProjectInsertSchema = ProjectInsertSchema;
|
|
2809
|
-
exports.ProjectListResponse = ProjectListResponse;
|
|
2810
|
-
exports.ProjectModelSchema = ProjectModelSchema;
|
|
2811
|
-
exports.ProjectResponse = ProjectResponse;
|
|
2812
|
-
exports.ProjectSelectSchema = ProjectSelectSchema;
|
|
2813
|
-
exports.ProjectUpdateSchema = ProjectUpdateSchema;
|
|
2814
|
-
exports.RelatedAgentInfoListResponse = RelatedAgentInfoListResponse;
|
|
2815
|
-
exports.RelatedAgentInfoSchema = RelatedAgentInfoSchema;
|
|
2816
|
-
exports.RemovedResponseSchema = RemovedResponseSchema;
|
|
2817
|
-
exports.SingleResponseSchema = SingleResponseSchema;
|
|
2818
|
-
exports.StatusComponentSchema = StatusComponentSchema;
|
|
2819
|
-
exports.StatusUpdateSchema = StatusUpdateSchema;
|
|
2820
|
-
exports.StopWhenSchema = StopWhenSchema;
|
|
2821
|
-
exports.StreamErrorEventSchema = StreamErrorEventSchema;
|
|
2822
|
-
exports.StreamEventSchema = StreamEventSchema;
|
|
2823
|
-
exports.StreamFinishEventSchema = StreamFinishEventSchema;
|
|
2824
|
-
exports.SubAgentApiInsertSchema = SubAgentApiInsertSchema;
|
|
2825
|
-
exports.SubAgentApiSelectSchema = SubAgentApiSelectSchema;
|
|
2826
|
-
exports.SubAgentApiUpdateSchema = SubAgentApiUpdateSchema;
|
|
2827
|
-
exports.SubAgentArtifactComponentApiInsertSchema = SubAgentArtifactComponentApiInsertSchema;
|
|
2828
|
-
exports.SubAgentArtifactComponentApiSelectSchema = SubAgentArtifactComponentApiSelectSchema;
|
|
2829
|
-
exports.SubAgentArtifactComponentApiUpdateSchema = SubAgentArtifactComponentApiUpdateSchema;
|
|
2830
|
-
exports.SubAgentArtifactComponentInsertSchema = SubAgentArtifactComponentInsertSchema;
|
|
2831
|
-
exports.SubAgentArtifactComponentListResponse = SubAgentArtifactComponentListResponse;
|
|
2832
|
-
exports.SubAgentArtifactComponentResponse = SubAgentArtifactComponentResponse;
|
|
2833
|
-
exports.SubAgentArtifactComponentSelectSchema = SubAgentArtifactComponentSelectSchema;
|
|
2834
|
-
exports.SubAgentArtifactComponentUpdateSchema = SubAgentArtifactComponentUpdateSchema;
|
|
2835
|
-
exports.SubAgentDataComponentApiInsertSchema = SubAgentDataComponentApiInsertSchema;
|
|
2836
|
-
exports.SubAgentDataComponentApiSelectSchema = SubAgentDataComponentApiSelectSchema;
|
|
2837
|
-
exports.SubAgentDataComponentApiUpdateSchema = SubAgentDataComponentApiUpdateSchema;
|
|
2838
|
-
exports.SubAgentDataComponentInsertSchema = SubAgentDataComponentInsertSchema;
|
|
2839
|
-
exports.SubAgentDataComponentListResponse = SubAgentDataComponentListResponse;
|
|
2840
|
-
exports.SubAgentDataComponentResponse = SubAgentDataComponentResponse;
|
|
2841
|
-
exports.SubAgentDataComponentSelectSchema = SubAgentDataComponentSelectSchema;
|
|
2842
|
-
exports.SubAgentDataComponentUpdateSchema = SubAgentDataComponentUpdateSchema;
|
|
2843
|
-
exports.SubAgentExternalAgentRelationApiInsertSchema = SubAgentExternalAgentRelationApiInsertSchema;
|
|
2844
|
-
exports.SubAgentExternalAgentRelationApiSelectSchema = SubAgentExternalAgentRelationApiSelectSchema;
|
|
2845
|
-
exports.SubAgentExternalAgentRelationApiUpdateSchema = SubAgentExternalAgentRelationApiUpdateSchema;
|
|
2846
|
-
exports.SubAgentExternalAgentRelationInsertSchema = SubAgentExternalAgentRelationInsertSchema;
|
|
2847
|
-
exports.SubAgentExternalAgentRelationListResponse = SubAgentExternalAgentRelationListResponse;
|
|
2848
|
-
exports.SubAgentExternalAgentRelationResponse = SubAgentExternalAgentRelationResponse;
|
|
2849
|
-
exports.SubAgentExternalAgentRelationSelectSchema = SubAgentExternalAgentRelationSelectSchema;
|
|
2850
|
-
exports.SubAgentExternalAgentRelationUpdateSchema = SubAgentExternalAgentRelationUpdateSchema;
|
|
2851
|
-
exports.SubAgentInsertSchema = SubAgentInsertSchema;
|
|
2852
|
-
exports.SubAgentListResponse = SubAgentListResponse;
|
|
2853
|
-
exports.SubAgentRelationApiInsertSchema = SubAgentRelationApiInsertSchema;
|
|
2854
|
-
exports.SubAgentRelationApiSelectSchema = SubAgentRelationApiSelectSchema;
|
|
2855
|
-
exports.SubAgentRelationApiUpdateSchema = SubAgentRelationApiUpdateSchema;
|
|
2856
|
-
exports.SubAgentRelationInsertSchema = SubAgentRelationInsertSchema;
|
|
2857
|
-
exports.SubAgentRelationListResponse = SubAgentRelationListResponse;
|
|
2858
|
-
exports.SubAgentRelationQuerySchema = SubAgentRelationQuerySchema;
|
|
2859
|
-
exports.SubAgentRelationResponse = SubAgentRelationResponse;
|
|
2860
|
-
exports.SubAgentRelationSelectSchema = SubAgentRelationSelectSchema;
|
|
2861
|
-
exports.SubAgentRelationUpdateSchema = SubAgentRelationUpdateSchema;
|
|
2862
|
-
exports.SubAgentResponse = SubAgentResponse;
|
|
2863
|
-
exports.SubAgentSelectSchema = SubAgentSelectSchema;
|
|
2864
|
-
exports.SubAgentStopWhenSchema = SubAgentStopWhenSchema;
|
|
2865
|
-
exports.SubAgentTeamAgentRelationApiInsertSchema = SubAgentTeamAgentRelationApiInsertSchema;
|
|
2866
|
-
exports.SubAgentTeamAgentRelationApiSelectSchema = SubAgentTeamAgentRelationApiSelectSchema;
|
|
2867
|
-
exports.SubAgentTeamAgentRelationApiUpdateSchema = SubAgentTeamAgentRelationApiUpdateSchema;
|
|
2868
|
-
exports.SubAgentTeamAgentRelationInsertSchema = SubAgentTeamAgentRelationInsertSchema;
|
|
2869
|
-
exports.SubAgentTeamAgentRelationListResponse = SubAgentTeamAgentRelationListResponse;
|
|
2870
|
-
exports.SubAgentTeamAgentRelationResponse = SubAgentTeamAgentRelationResponse;
|
|
2871
|
-
exports.SubAgentTeamAgentRelationSelectSchema = SubAgentTeamAgentRelationSelectSchema;
|
|
2872
|
-
exports.SubAgentTeamAgentRelationUpdateSchema = SubAgentTeamAgentRelationUpdateSchema;
|
|
2873
|
-
exports.SubAgentToolRelationApiInsertSchema = SubAgentToolRelationApiInsertSchema;
|
|
2874
|
-
exports.SubAgentToolRelationApiSelectSchema = SubAgentToolRelationApiSelectSchema;
|
|
2875
|
-
exports.SubAgentToolRelationApiUpdateSchema = SubAgentToolRelationApiUpdateSchema;
|
|
2876
|
-
exports.SubAgentToolRelationInsertSchema = SubAgentToolRelationInsertSchema;
|
|
2877
|
-
exports.SubAgentToolRelationListResponse = SubAgentToolRelationListResponse;
|
|
2878
|
-
exports.SubAgentToolRelationResponse = SubAgentToolRelationResponse;
|
|
2879
|
-
exports.SubAgentToolRelationSelectSchema = SubAgentToolRelationSelectSchema;
|
|
2880
|
-
exports.SubAgentToolRelationUpdateSchema = SubAgentToolRelationUpdateSchema;
|
|
2881
|
-
exports.SubAgentUpdateSchema = SubAgentUpdateSchema;
|
|
2882
|
-
exports.TaskApiInsertSchema = TaskApiInsertSchema;
|
|
2883
|
-
exports.TaskApiSelectSchema = TaskApiSelectSchema;
|
|
2884
|
-
exports.TaskApiUpdateSchema = TaskApiUpdateSchema;
|
|
2885
|
-
exports.TaskInsertSchema = TaskInsertSchema;
|
|
2886
|
-
exports.TaskRelationApiInsertSchema = TaskRelationApiInsertSchema;
|
|
2887
|
-
exports.TaskRelationApiSelectSchema = TaskRelationApiSelectSchema;
|
|
2888
|
-
exports.TaskRelationApiUpdateSchema = TaskRelationApiUpdateSchema;
|
|
2889
|
-
exports.TaskRelationInsertSchema = TaskRelationInsertSchema;
|
|
2890
|
-
exports.TaskRelationSelectSchema = TaskRelationSelectSchema;
|
|
2891
|
-
exports.TaskRelationUpdateSchema = TaskRelationUpdateSchema;
|
|
2892
|
-
exports.TaskSelectSchema = TaskSelectSchema;
|
|
2893
|
-
exports.TaskUpdateSchema = TaskUpdateSchema;
|
|
2894
|
-
exports.TeamAgentSchema = TeamAgentSchema;
|
|
2895
|
-
exports.TenantIdParamsSchema = TenantIdParamsSchema;
|
|
2896
|
-
exports.TenantParamsSchema = TenantParamsSchema;
|
|
2897
|
-
exports.TenantProjectAgentIdParamsSchema = TenantProjectAgentIdParamsSchema;
|
|
2898
|
-
exports.TenantProjectAgentParamsSchema = TenantProjectAgentParamsSchema;
|
|
2899
|
-
exports.TenantProjectAgentSubAgentIdParamsSchema = TenantProjectAgentSubAgentIdParamsSchema;
|
|
2900
|
-
exports.TenantProjectAgentSubAgentParamsSchema = TenantProjectAgentSubAgentParamsSchema;
|
|
2901
|
-
exports.TenantProjectIdParamsSchema = TenantProjectIdParamsSchema;
|
|
2902
|
-
exports.TenantProjectParamsSchema = TenantProjectParamsSchema;
|
|
2903
|
-
exports.TextDeltaEventSchema = TextDeltaEventSchema;
|
|
2904
|
-
exports.TextEndEventSchema = TextEndEventSchema;
|
|
2905
|
-
exports.TextStartEventSchema = TextStartEventSchema;
|
|
2906
|
-
exports.ToolApiInsertSchema = ToolApiInsertSchema;
|
|
2907
|
-
exports.ToolApiSelectSchema = ToolApiSelectSchema;
|
|
2908
|
-
exports.ToolApiUpdateSchema = ToolApiUpdateSchema;
|
|
2909
|
-
exports.ToolInsertSchema = ToolInsertSchema;
|
|
2910
|
-
exports.ToolListResponse = ToolListResponse;
|
|
2911
|
-
exports.ToolResponse = ToolResponse;
|
|
2912
|
-
exports.ToolSelectSchema = ToolSelectSchema;
|
|
2913
|
-
exports.ToolStatusSchema = ToolStatusSchema;
|
|
2914
|
-
exports.ToolUpdateSchema = ToolUpdateSchema;
|
|
2915
|
-
exports.TransferDataSchema = TransferDataSchema;
|
|
2916
|
-
exports.URL_SAFE_ID_PATTERN = URL_SAFE_ID_PATTERN;
|
|
2917
|
-
exports.canDelegateToExternalAgentSchema = canDelegateToExternalAgentSchema;
|
|
2918
|
-
exports.canDelegateToTeamAgentSchema = canDelegateToTeamAgentSchema;
|
|
2919
|
-
exports.generateIdFromName = generateIdFromName;
|
|
2920
|
-
exports.isValidResourceId = isValidResourceId;
|
|
2921
|
-
exports.resourceIdSchema = resourceIdSchema;
|
|
2922
|
-
exports.validateAgentRelationships = validateAgentRelationships;
|
|
2923
|
-
exports.validateAgentStructure = validateAgentStructure;
|
|
2924
|
-
exports.validateAndTypeAgentData = validateAndTypeAgentData;
|
|
2925
|
-
exports.validateArtifactComponentReferences = validateArtifactComponentReferences;
|
|
2926
|
-
exports.validateDataComponentReferences = validateDataComponentReferences;
|
|
2927
|
-
exports.validatePropsAsJsonSchema = validatePropsAsJsonSchema;
|
|
2928
|
-
exports.validateRender = validateRender;
|
|
2929
|
-
exports.validateSubAgentExternalAgentRelations = validateSubAgentExternalAgentRelations;
|
|
2930
|
-
exports.validateToolReferences = validateToolReferences;
|