@inkeep/agents-core 0.0.0-chat-to-edit-20251119071712
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/LICENSE.md +56 -0
- package/README.md +458 -0
- package/SUPPLEMENTAL_TERMS.md +40 -0
- package/dist/auth-detection-CGqhPDnj.d.cts +435 -0
- package/dist/auth-detection-CGqhPDnj.d.ts +435 -0
- package/dist/chunk-7CLFCY6J.js +36 -0
- package/dist/chunk-A6JWG7FI.js +1689 -0
- package/dist/chunk-CMNLBV2A.js +39 -0
- package/dist/chunk-E6R6PML7.js +19 -0
- package/dist/chunk-OP3KPT4T.js +442 -0
- package/dist/chunk-TLSKVSBR.js +1234 -0
- package/dist/chunk-WG46C2WU.js +394 -0
- package/dist/chunk-YECQCT5N.js +223 -0
- package/dist/chunk-YFHT5M2R.js +18 -0
- package/dist/client-exports.cjs +3421 -0
- package/dist/client-exports.d.cts +292 -0
- package/dist/client-exports.d.ts +292 -0
- package/dist/client-exports.js +178 -0
- package/dist/constants/models.cjs +40 -0
- package/dist/constants/models.d.cts +42 -0
- package/dist/constants/models.d.ts +42 -0
- package/dist/constants/models.js +1 -0
- package/dist/db/schema.cjs +1686 -0
- package/dist/db/schema.d.cts +7 -0
- package/dist/db/schema.d.ts +7 -0
- package/dist/db/schema.js +1 -0
- package/dist/index.cjs +229792 -0
- package/dist/index.d.cts +5138 -0
- package/dist/index.d.ts +5138 -0
- package/dist/index.js +224908 -0
- package/dist/props-validation-BMR1qNiy.d.cts +15 -0
- package/dist/props-validation-BMR1qNiy.d.ts +15 -0
- package/dist/schema-C90zXlqp.d.ts +8012 -0
- package/dist/schema-keglUDw0.d.cts +8012 -0
- package/dist/types/index.cjs +64 -0
- package/dist/types/index.d.cts +175 -0
- package/dist/types/index.d.ts +175 -0
- package/dist/types/index.js +2 -0
- package/dist/utility-CXEG5391.d.cts +17265 -0
- package/dist/utility-CXEG5391.d.ts +17265 -0
- package/dist/utils/schema-conversion.cjs +236 -0
- package/dist/utils/schema-conversion.d.cts +26 -0
- package/dist/utils/schema-conversion.d.ts +26 -0
- package/dist/utils/schema-conversion.js +1 -0
- package/dist/validation/index.cjs +3521 -0
- package/dist/validation/index.d.cts +279 -0
- package/dist/validation/index.d.ts +279 -0
- package/dist/validation/index.js +2 -0
- package/drizzle/0000_exotic_mysterio.sql +398 -0
- package/drizzle/0001_greedy_the_phantom.sql +4 -0
- package/drizzle/0002_add_evaluation_features.sql +252 -0
- package/drizzle/0003_brave_micromax.sql +2 -0
- package/drizzle/meta/0000_snapshot.json +2519 -0
- package/drizzle/meta/0001_snapshot.json +2892 -0
- package/drizzle/meta/0002_snapshot.json +4485 -0
- package/drizzle/meta/_journal.json +34 -0
- package/package.json +133 -0
|
@@ -0,0 +1,1234 @@
|
|
|
1
|
+
import { subAgents, subAgentRelations, agents, tasks, taskRelations, conversations, messages, contextCache, dataComponents, subAgentDataComponents, artifactComponents, subAgentArtifactComponents, externalAgents, apiKeys, credentialReferences, tools, functionTools, functions, contextConfigs, subAgentToolRelations, subAgentExternalAgentRelations, subAgentTeamAgentRelations, ledgerArtifacts, projects } from './chunk-A6JWG7FI.js';
|
|
2
|
+
import { VALID_RELATION_TYPES, MCPTransportType, TOOL_STATUS_VALUES, CredentialStoreType, MCPServerType } from './chunk-YFHT5M2R.js';
|
|
3
|
+
import { z } from '@hono/zod-openapi';
|
|
4
|
+
import { createSelectSchema as createSelectSchema$1, createInsertSchema as createInsertSchema$1 } from 'drizzle-zod';
|
|
5
|
+
import Ajv from 'ajv';
|
|
6
|
+
|
|
7
|
+
// src/constants/schema-validation/defaults.ts
|
|
8
|
+
var schemaValidationDefaults = {
|
|
9
|
+
// Agent Execution Transfer Count
|
|
10
|
+
// Controls how many times an agent can transfer control to sub-agents in a single conversation turn.
|
|
11
|
+
// This prevents infinite transfer loops while allowing multi-agent collaboration workflows.
|
|
12
|
+
AGENT_EXECUTION_TRANSFER_COUNT_MIN: 1,
|
|
13
|
+
AGENT_EXECUTION_TRANSFER_COUNT_MAX: 1e3,
|
|
14
|
+
AGENT_EXECUTION_TRANSFER_COUNT_DEFAULT: 10,
|
|
15
|
+
// Sub-Agent Turn Generation Steps
|
|
16
|
+
// Limits how many AI generation steps a sub-agent can perform within a single turn.
|
|
17
|
+
// Each generation step typically involves sending a prompt to the LLM and processing its response.
|
|
18
|
+
// This prevents runaway token usage while allowing complex multi-step reasoning.
|
|
19
|
+
SUB_AGENT_TURN_GENERATION_STEPS_MIN: 1,
|
|
20
|
+
SUB_AGENT_TURN_GENERATION_STEPS_MAX: 1e3,
|
|
21
|
+
SUB_AGENT_TURN_GENERATION_STEPS_DEFAULT: 12,
|
|
22
|
+
// Status Update Thresholds
|
|
23
|
+
// Real-time status updates are triggered when either threshold is exceeded during longer operations.
|
|
24
|
+
// MAX_NUM_EVENTS: Maximum number of internal events before forcing a status update to the client.
|
|
25
|
+
// MAX_INTERVAL_SECONDS: Maximum time between status updates regardless of event count.
|
|
26
|
+
STATUS_UPDATE_MAX_NUM_EVENTS: 100,
|
|
27
|
+
STATUS_UPDATE_MAX_INTERVAL_SECONDS: 600,
|
|
28
|
+
// 10 minutes
|
|
29
|
+
// Prompt Text Length Validation
|
|
30
|
+
// Maximum character limits for agent and sub-agent system prompts to prevent excessive token usage.
|
|
31
|
+
// Enforced during agent configuration to ensure prompts remain focused and manageable.
|
|
32
|
+
VALIDATION_SUB_AGENT_PROMPT_MAX_CHARS: 2e3,
|
|
33
|
+
VALIDATION_AGENT_PROMPT_MAX_CHARS: 5e3,
|
|
34
|
+
// Context Fetcher HTTP Timeout
|
|
35
|
+
// Maximum time allowed for HTTP requests made by Context Fetchers (e.g., CRM lookups, external API calls).
|
|
36
|
+
// Context Fetchers automatically retrieve external data at the start of a conversation to enrich agent context.
|
|
37
|
+
CONTEXT_FETCHER_HTTP_TIMEOUT_MS_DEFAULT: 1e4
|
|
38
|
+
// 10 seconds
|
|
39
|
+
};
|
|
40
|
+
var MIN_ID_LENGTH = 1;
|
|
41
|
+
var MAX_ID_LENGTH = 255;
|
|
42
|
+
var URL_SAFE_ID_PATTERN = /^[a-zA-Z0-9\-_.]+$/;
|
|
43
|
+
var resourceIdSchema = z.string().min(MIN_ID_LENGTH).max(MAX_ID_LENGTH).describe("Resource identifier").regex(URL_SAFE_ID_PATTERN, {
|
|
44
|
+
message: "ID must contain only letters, numbers, hyphens, underscores, and dots"
|
|
45
|
+
}).openapi({
|
|
46
|
+
description: "Resource identifier",
|
|
47
|
+
example: "resource_789"
|
|
48
|
+
});
|
|
49
|
+
resourceIdSchema.meta({
|
|
50
|
+
description: "Resource identifier"
|
|
51
|
+
});
|
|
52
|
+
var FIELD_MODIFIERS = {
|
|
53
|
+
id: (schema) => {
|
|
54
|
+
const modified = schema.min(MIN_ID_LENGTH).max(MAX_ID_LENGTH).describe("Resource identifier").regex(URL_SAFE_ID_PATTERN, {
|
|
55
|
+
message: "ID must contain only letters, numbers, hyphens, underscores, and dots"
|
|
56
|
+
}).openapi({
|
|
57
|
+
description: "Resource identifier",
|
|
58
|
+
example: "resource_789"
|
|
59
|
+
});
|
|
60
|
+
modified.meta({
|
|
61
|
+
description: "Resource identifier"
|
|
62
|
+
});
|
|
63
|
+
return modified;
|
|
64
|
+
},
|
|
65
|
+
name: (_schema) => {
|
|
66
|
+
const modified = z.string().describe("Name");
|
|
67
|
+
modified.meta({ description: "Name" });
|
|
68
|
+
return modified;
|
|
69
|
+
},
|
|
70
|
+
description: (_schema) => {
|
|
71
|
+
const modified = z.string().describe("Description");
|
|
72
|
+
modified.meta({ description: "Description" });
|
|
73
|
+
return modified;
|
|
74
|
+
},
|
|
75
|
+
tenantId: (schema) => {
|
|
76
|
+
const modified = schema.describe("Tenant identifier");
|
|
77
|
+
modified.meta({ description: "Tenant identifier" });
|
|
78
|
+
return modified;
|
|
79
|
+
},
|
|
80
|
+
projectId: (schema) => {
|
|
81
|
+
const modified = schema.describe("Project identifier");
|
|
82
|
+
modified.meta({ description: "Project identifier" });
|
|
83
|
+
return modified;
|
|
84
|
+
},
|
|
85
|
+
agentId: (schema) => {
|
|
86
|
+
const modified = schema.describe("Agent identifier");
|
|
87
|
+
modified.meta({ description: "Agent identifier" });
|
|
88
|
+
return modified;
|
|
89
|
+
},
|
|
90
|
+
subAgentId: (schema) => {
|
|
91
|
+
const modified = schema.describe("Sub-agent identifier");
|
|
92
|
+
modified.meta({ description: "Sub-agent identifier" });
|
|
93
|
+
return modified;
|
|
94
|
+
},
|
|
95
|
+
createdAt: (schema) => {
|
|
96
|
+
const modified = schema.describe("Creation timestamp");
|
|
97
|
+
modified.meta({ description: "Creation timestamp" });
|
|
98
|
+
return modified;
|
|
99
|
+
},
|
|
100
|
+
updatedAt: (schema) => {
|
|
101
|
+
const modified = schema.describe("Last update timestamp");
|
|
102
|
+
modified.meta({ description: "Last update timestamp" });
|
|
103
|
+
return modified;
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
function createSelectSchemaWithModifiers(table, overrides) {
|
|
107
|
+
const tableColumns = table._?.columns;
|
|
108
|
+
if (!tableColumns) {
|
|
109
|
+
return createSelectSchema$1(table, overrides);
|
|
110
|
+
}
|
|
111
|
+
const tableFieldNames = Object.keys(tableColumns);
|
|
112
|
+
const modifiers = {};
|
|
113
|
+
for (const fieldName of tableFieldNames) {
|
|
114
|
+
const fieldNameStr = String(fieldName);
|
|
115
|
+
if (fieldNameStr in FIELD_MODIFIERS) {
|
|
116
|
+
modifiers[fieldNameStr] = FIELD_MODIFIERS[fieldNameStr];
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
const mergedModifiers = { ...modifiers, ...overrides };
|
|
120
|
+
return createSelectSchema$1(table, mergedModifiers);
|
|
121
|
+
}
|
|
122
|
+
function createInsertSchemaWithModifiers(table, overrides) {
|
|
123
|
+
const tableColumns = table._?.columns;
|
|
124
|
+
if (!tableColumns) {
|
|
125
|
+
return createInsertSchema$1(table, overrides);
|
|
126
|
+
}
|
|
127
|
+
const tableFieldNames = Object.keys(tableColumns);
|
|
128
|
+
const modifiers = {};
|
|
129
|
+
for (const fieldName of tableFieldNames) {
|
|
130
|
+
const fieldNameStr = String(fieldName);
|
|
131
|
+
if (fieldNameStr in FIELD_MODIFIERS) {
|
|
132
|
+
modifiers[fieldNameStr] = FIELD_MODIFIERS[fieldNameStr];
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
const mergedModifiers = { ...modifiers, ...overrides };
|
|
136
|
+
return createInsertSchema$1(table, mergedModifiers);
|
|
137
|
+
}
|
|
138
|
+
var createSelectSchema = createSelectSchemaWithModifiers;
|
|
139
|
+
var createInsertSchema = createInsertSchemaWithModifiers;
|
|
140
|
+
function registerFieldSchemas(schema) {
|
|
141
|
+
if (!(schema instanceof z.ZodObject)) {
|
|
142
|
+
return schema;
|
|
143
|
+
}
|
|
144
|
+
const shape = schema.shape;
|
|
145
|
+
const fieldMetadata = {
|
|
146
|
+
id: { description: "Resource identifier" },
|
|
147
|
+
name: { description: "Name" },
|
|
148
|
+
description: { description: "Description" },
|
|
149
|
+
tenantId: { description: "Tenant identifier" },
|
|
150
|
+
projectId: { description: "Project identifier" },
|
|
151
|
+
agentId: { description: "Agent identifier" },
|
|
152
|
+
subAgentId: { description: "Sub-agent identifier" },
|
|
153
|
+
createdAt: { description: "Creation timestamp" },
|
|
154
|
+
updatedAt: { description: "Last update timestamp" }
|
|
155
|
+
};
|
|
156
|
+
for (const [fieldName, fieldSchema] of Object.entries(shape)) {
|
|
157
|
+
if (fieldName in fieldMetadata && fieldSchema) {
|
|
158
|
+
let zodFieldSchema = fieldSchema;
|
|
159
|
+
let innerSchema = null;
|
|
160
|
+
if (zodFieldSchema instanceof z.ZodOptional) {
|
|
161
|
+
innerSchema = zodFieldSchema._def.innerType;
|
|
162
|
+
zodFieldSchema = innerSchema;
|
|
163
|
+
}
|
|
164
|
+
zodFieldSchema.meta(fieldMetadata[fieldName]);
|
|
165
|
+
if (fieldName === "id" && zodFieldSchema instanceof z.ZodString) {
|
|
166
|
+
zodFieldSchema.openapi({
|
|
167
|
+
description: "Resource identifier",
|
|
168
|
+
minLength: MIN_ID_LENGTH,
|
|
169
|
+
maxLength: MAX_ID_LENGTH,
|
|
170
|
+
pattern: URL_SAFE_ID_PATTERN.source,
|
|
171
|
+
example: "resource_789"
|
|
172
|
+
});
|
|
173
|
+
} else if (zodFieldSchema instanceof z.ZodString) {
|
|
174
|
+
zodFieldSchema.openapi({
|
|
175
|
+
description: fieldMetadata[fieldName].description
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
if (innerSchema && fieldSchema instanceof z.ZodOptional) {
|
|
179
|
+
fieldSchema.meta(fieldMetadata[fieldName]);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
return schema;
|
|
184
|
+
}
|
|
185
|
+
var {
|
|
186
|
+
AGENT_EXECUTION_TRANSFER_COUNT_MAX,
|
|
187
|
+
AGENT_EXECUTION_TRANSFER_COUNT_MIN,
|
|
188
|
+
CONTEXT_FETCHER_HTTP_TIMEOUT_MS_DEFAULT,
|
|
189
|
+
STATUS_UPDATE_MAX_INTERVAL_SECONDS,
|
|
190
|
+
STATUS_UPDATE_MAX_NUM_EVENTS,
|
|
191
|
+
SUB_AGENT_TURN_GENERATION_STEPS_MAX,
|
|
192
|
+
SUB_AGENT_TURN_GENERATION_STEPS_MIN,
|
|
193
|
+
VALIDATION_AGENT_PROMPT_MAX_CHARS,
|
|
194
|
+
VALIDATION_SUB_AGENT_PROMPT_MAX_CHARS
|
|
195
|
+
} = schemaValidationDefaults;
|
|
196
|
+
var StopWhenSchema = z.object({
|
|
197
|
+
transferCountIs: 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."),
|
|
198
|
+
stepCountIs: 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.")
|
|
199
|
+
}).openapi("StopWhen");
|
|
200
|
+
var AgentStopWhenSchema = StopWhenSchema.pick({ transferCountIs: true }).openapi(
|
|
201
|
+
"AgentStopWhen"
|
|
202
|
+
);
|
|
203
|
+
var SubAgentStopWhenSchema = StopWhenSchema.pick({ stepCountIs: true }).openapi(
|
|
204
|
+
"SubAgentStopWhen"
|
|
205
|
+
);
|
|
206
|
+
var pageNumber = z.coerce.number().min(1).default(1).openapi("PaginationPageQueryParam");
|
|
207
|
+
var limitNumber = z.coerce.number().min(1).max(100).default(10).openapi("PaginationLimitQueryParam");
|
|
208
|
+
var ModelSettingsSchema = z.object({
|
|
209
|
+
model: z.string().optional().describe("The model to use for the project."),
|
|
210
|
+
providerOptions: z.record(z.string(), z.any()).optional().describe("The provider options to use for the project.")
|
|
211
|
+
}).openapi("ModelSettings");
|
|
212
|
+
var ModelSchema = z.object({
|
|
213
|
+
base: ModelSettingsSchema.optional(),
|
|
214
|
+
structuredOutput: ModelSettingsSchema.optional(),
|
|
215
|
+
summarizer: ModelSettingsSchema.optional()
|
|
216
|
+
}).openapi("Model");
|
|
217
|
+
var ProjectModelSchema = z.object({
|
|
218
|
+
base: ModelSettingsSchema,
|
|
219
|
+
structuredOutput: ModelSettingsSchema.optional(),
|
|
220
|
+
summarizer: ModelSettingsSchema.optional()
|
|
221
|
+
}).openapi("ProjectModel");
|
|
222
|
+
var FunctionToolConfigSchema = z.object({
|
|
223
|
+
name: z.string(),
|
|
224
|
+
description: z.string(),
|
|
225
|
+
inputSchema: z.record(z.string(), z.unknown()),
|
|
226
|
+
dependencies: z.record(z.string(), z.string()).optional(),
|
|
227
|
+
execute: z.union([z.function(), z.string()])
|
|
228
|
+
});
|
|
229
|
+
var createApiSchema = (schema) => schema.omit({ tenantId: true, projectId: true });
|
|
230
|
+
var createApiInsertSchema = (schema) => schema.omit({ tenantId: true, projectId: true });
|
|
231
|
+
var createApiUpdateSchema = (schema) => schema.omit({ tenantId: true, projectId: true }).partial();
|
|
232
|
+
var createAgentScopedApiSchema = (schema) => schema.omit({ tenantId: true, projectId: true, agentId: true });
|
|
233
|
+
var createAgentScopedApiInsertSchema = (schema) => schema.omit({ tenantId: true, projectId: true, agentId: true });
|
|
234
|
+
var createAgentScopedApiUpdateSchema = (schema) => schema.omit({ tenantId: true, projectId: true, agentId: true }).partial();
|
|
235
|
+
var SubAgentSelectSchema = createSelectSchema(subAgents);
|
|
236
|
+
var SubAgentInsertSchema = createInsertSchema(subAgents).extend({
|
|
237
|
+
id: resourceIdSchema,
|
|
238
|
+
models: ModelSchema.optional()
|
|
239
|
+
});
|
|
240
|
+
var SubAgentUpdateSchema = SubAgentInsertSchema.partial();
|
|
241
|
+
var SubAgentApiSelectSchema = createAgentScopedApiSchema(SubAgentSelectSchema).openapi("SubAgent");
|
|
242
|
+
var SubAgentApiInsertSchema = createAgentScopedApiInsertSchema(SubAgentInsertSchema).openapi("SubAgentCreate");
|
|
243
|
+
var SubAgentApiUpdateSchema = createAgentScopedApiUpdateSchema(SubAgentUpdateSchema).openapi("SubAgentUpdate");
|
|
244
|
+
var SubAgentRelationSelectSchema = createSelectSchema(subAgentRelations);
|
|
245
|
+
var SubAgentRelationInsertSchema = createInsertSchema(subAgentRelations).extend({
|
|
246
|
+
id: resourceIdSchema,
|
|
247
|
+
agentId: resourceIdSchema,
|
|
248
|
+
sourceSubAgentId: resourceIdSchema,
|
|
249
|
+
targetSubAgentId: resourceIdSchema.optional(),
|
|
250
|
+
externalSubAgentId: resourceIdSchema.optional(),
|
|
251
|
+
teamSubAgentId: resourceIdSchema.optional()
|
|
252
|
+
});
|
|
253
|
+
var SubAgentRelationUpdateSchema = SubAgentRelationInsertSchema.partial();
|
|
254
|
+
var SubAgentRelationApiSelectSchema = createAgentScopedApiSchema(
|
|
255
|
+
SubAgentRelationSelectSchema
|
|
256
|
+
).openapi("SubAgentRelation");
|
|
257
|
+
var SubAgentRelationApiInsertSchema = createAgentScopedApiInsertSchema(
|
|
258
|
+
SubAgentRelationInsertSchema
|
|
259
|
+
).extend({
|
|
260
|
+
relationType: z.enum(VALID_RELATION_TYPES)
|
|
261
|
+
}).refine(
|
|
262
|
+
(data) => {
|
|
263
|
+
const hasTarget = data.targetSubAgentId != null;
|
|
264
|
+
const hasExternal = data.externalSubAgentId != null;
|
|
265
|
+
const hasTeam = data.teamSubAgentId != null;
|
|
266
|
+
const count = [hasTarget, hasExternal, hasTeam].filter(Boolean).length;
|
|
267
|
+
return count === 1;
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
message: "Must specify exactly one of targetSubAgentId, externalSubAgentId, or teamSubAgentId",
|
|
271
|
+
path: ["targetSubAgentId", "externalSubAgentId", "teamSubAgentId"]
|
|
272
|
+
}
|
|
273
|
+
).openapi("SubAgentRelationCreate");
|
|
274
|
+
var SubAgentRelationApiUpdateSchema = createAgentScopedApiUpdateSchema(
|
|
275
|
+
SubAgentRelationUpdateSchema
|
|
276
|
+
).extend({
|
|
277
|
+
relationType: z.enum(VALID_RELATION_TYPES).optional()
|
|
278
|
+
}).refine(
|
|
279
|
+
(data) => {
|
|
280
|
+
const hasTarget = data.targetSubAgentId != null;
|
|
281
|
+
const hasExternal = data.externalSubAgentId != null;
|
|
282
|
+
const hasTeam = data.teamSubAgentId != null;
|
|
283
|
+
const count = [hasTarget, hasExternal, hasTeam].filter(Boolean).length;
|
|
284
|
+
if (count === 0) {
|
|
285
|
+
return true;
|
|
286
|
+
}
|
|
287
|
+
return count === 1;
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
message: "Must specify exactly one of targetSubAgentId, externalSubAgentId, or teamSubAgentId when updating sub-agent relationships",
|
|
291
|
+
path: ["targetSubAgentId", "externalSubAgentId", "teamSubAgentId"]
|
|
292
|
+
}
|
|
293
|
+
).openapi("SubAgentRelationUpdate");
|
|
294
|
+
var SubAgentRelationQuerySchema = z.object({
|
|
295
|
+
sourceSubAgentId: z.string().optional(),
|
|
296
|
+
targetSubAgentId: z.string().optional(),
|
|
297
|
+
externalSubAgentId: z.string().optional(),
|
|
298
|
+
teamSubAgentId: z.string().optional()
|
|
299
|
+
});
|
|
300
|
+
var ExternalSubAgentRelationInsertSchema = createInsertSchema(subAgentRelations).extend({
|
|
301
|
+
id: resourceIdSchema,
|
|
302
|
+
agentId: resourceIdSchema,
|
|
303
|
+
sourceSubAgentId: resourceIdSchema,
|
|
304
|
+
externalSubAgentId: resourceIdSchema
|
|
305
|
+
});
|
|
306
|
+
var ExternalSubAgentRelationApiInsertSchema = createApiInsertSchema(
|
|
307
|
+
ExternalSubAgentRelationInsertSchema
|
|
308
|
+
);
|
|
309
|
+
var AgentSelectSchema = createSelectSchema(agents);
|
|
310
|
+
var AgentInsertSchema = createInsertSchema(agents).extend({
|
|
311
|
+
id: resourceIdSchema,
|
|
312
|
+
name: z.string().trim().nonempty()
|
|
313
|
+
});
|
|
314
|
+
var AgentUpdateSchema = AgentInsertSchema.partial();
|
|
315
|
+
var AgentApiSelectSchema = createApiSchema(AgentSelectSchema).openapi("Agent");
|
|
316
|
+
var AgentApiInsertSchema = createApiInsertSchema(AgentInsertSchema).extend({
|
|
317
|
+
id: resourceIdSchema
|
|
318
|
+
}).openapi("AgentCreate");
|
|
319
|
+
var AgentApiUpdateSchema = createApiUpdateSchema(AgentUpdateSchema).openapi("AgentUpdate");
|
|
320
|
+
var TaskSelectSchema = createSelectSchema(tasks);
|
|
321
|
+
var TaskInsertSchema = createInsertSchema(tasks).extend({
|
|
322
|
+
id: resourceIdSchema,
|
|
323
|
+
conversationId: resourceIdSchema.optional()
|
|
324
|
+
});
|
|
325
|
+
var TaskUpdateSchema = TaskInsertSchema.partial();
|
|
326
|
+
var TaskApiSelectSchema = createApiSchema(TaskSelectSchema);
|
|
327
|
+
var TaskApiInsertSchema = createApiInsertSchema(TaskInsertSchema);
|
|
328
|
+
var TaskApiUpdateSchema = createApiUpdateSchema(TaskUpdateSchema);
|
|
329
|
+
var TaskRelationSelectSchema = createSelectSchema(taskRelations);
|
|
330
|
+
var TaskRelationInsertSchema = createInsertSchema(taskRelations).extend({
|
|
331
|
+
id: resourceIdSchema,
|
|
332
|
+
parentTaskId: resourceIdSchema,
|
|
333
|
+
childTaskId: resourceIdSchema
|
|
334
|
+
});
|
|
335
|
+
var TaskRelationUpdateSchema = TaskRelationInsertSchema.partial();
|
|
336
|
+
var TaskRelationApiSelectSchema = createApiSchema(TaskRelationSelectSchema);
|
|
337
|
+
var TaskRelationApiInsertSchema = createApiInsertSchema(TaskRelationInsertSchema);
|
|
338
|
+
var TaskRelationApiUpdateSchema = createApiUpdateSchema(TaskRelationUpdateSchema);
|
|
339
|
+
var imageUrlSchema = z.string().optional().refine(
|
|
340
|
+
(url) => {
|
|
341
|
+
if (!url) return true;
|
|
342
|
+
if (url.startsWith("data:image/")) {
|
|
343
|
+
const base64Part = url.split(",")[1];
|
|
344
|
+
if (!base64Part) return false;
|
|
345
|
+
return base64Part.length < 14e5;
|
|
346
|
+
}
|
|
347
|
+
try {
|
|
348
|
+
const parsed = new URL(url);
|
|
349
|
+
return parsed.protocol === "http:" || parsed.protocol === "https:";
|
|
350
|
+
} catch {
|
|
351
|
+
return false;
|
|
352
|
+
}
|
|
353
|
+
},
|
|
354
|
+
{
|
|
355
|
+
message: "Image URL must be a valid HTTP(S) URL or a base64 data URL (max 1MB)"
|
|
356
|
+
}
|
|
357
|
+
);
|
|
358
|
+
var McpTransportConfigSchema = z.object({
|
|
359
|
+
type: z.enum(MCPTransportType),
|
|
360
|
+
requestInit: z.record(z.string(), z.unknown()).optional(),
|
|
361
|
+
eventSourceInit: z.record(z.string(), z.unknown()).optional(),
|
|
362
|
+
reconnectionOptions: z.any().optional().openapi({
|
|
363
|
+
type: "object",
|
|
364
|
+
description: "Reconnection options for streamable HTTP transport"
|
|
365
|
+
}),
|
|
366
|
+
sessionId: z.string().optional()
|
|
367
|
+
}).openapi("McpTransportConfig");
|
|
368
|
+
var ToolStatusSchema = z.enum(TOOL_STATUS_VALUES);
|
|
369
|
+
var McpToolDefinitionSchema = z.object({
|
|
370
|
+
name: z.string(),
|
|
371
|
+
description: z.string().optional(),
|
|
372
|
+
inputSchema: z.record(z.string(), z.unknown()).optional()
|
|
373
|
+
});
|
|
374
|
+
var ToolSelectSchema = createSelectSchema(tools);
|
|
375
|
+
var ToolInsertSchema = createInsertSchema(tools).extend({
|
|
376
|
+
id: resourceIdSchema,
|
|
377
|
+
imageUrl: imageUrlSchema,
|
|
378
|
+
config: z.object({
|
|
379
|
+
type: z.literal("mcp"),
|
|
380
|
+
mcp: z.object({
|
|
381
|
+
server: z.object({
|
|
382
|
+
url: z.url()
|
|
383
|
+
}),
|
|
384
|
+
transport: z.object({
|
|
385
|
+
type: z.enum(MCPTransportType),
|
|
386
|
+
requestInit: z.record(z.string(), z.unknown()).optional(),
|
|
387
|
+
eventSourceInit: z.record(z.string(), z.unknown()).optional(),
|
|
388
|
+
reconnectionOptions: z.any().optional().openapi({
|
|
389
|
+
type: "object",
|
|
390
|
+
description: "Reconnection options for streamable HTTP transport"
|
|
391
|
+
}),
|
|
392
|
+
sessionId: z.string().optional()
|
|
393
|
+
}).optional(),
|
|
394
|
+
activeTools: z.array(z.string()).optional()
|
|
395
|
+
})
|
|
396
|
+
})
|
|
397
|
+
});
|
|
398
|
+
var ConversationSelectSchema = createSelectSchema(conversations);
|
|
399
|
+
var ConversationInsertSchema = createInsertSchema(conversations).extend({
|
|
400
|
+
id: resourceIdSchema,
|
|
401
|
+
contextConfigId: resourceIdSchema.optional()
|
|
402
|
+
});
|
|
403
|
+
var ConversationUpdateSchema = ConversationInsertSchema.partial();
|
|
404
|
+
var ConversationApiSelectSchema = createApiSchema(ConversationSelectSchema).openapi("Conversation");
|
|
405
|
+
var ConversationApiInsertSchema = createApiInsertSchema(ConversationInsertSchema).openapi("ConversationCreate");
|
|
406
|
+
var ConversationApiUpdateSchema = createApiUpdateSchema(ConversationUpdateSchema).openapi("ConversationUpdate");
|
|
407
|
+
var MessageSelectSchema = createSelectSchema(messages);
|
|
408
|
+
var MessageInsertSchema = createInsertSchema(messages).extend({
|
|
409
|
+
id: resourceIdSchema,
|
|
410
|
+
conversationId: resourceIdSchema,
|
|
411
|
+
taskId: resourceIdSchema.optional()
|
|
412
|
+
});
|
|
413
|
+
var MessageUpdateSchema = MessageInsertSchema.partial();
|
|
414
|
+
var MessageApiSelectSchema = createApiSchema(MessageSelectSchema).openapi("Message");
|
|
415
|
+
var MessageApiInsertSchema = createApiInsertSchema(MessageInsertSchema).openapi("MessageCreate");
|
|
416
|
+
var MessageApiUpdateSchema = createApiUpdateSchema(MessageUpdateSchema).openapi("MessageUpdate");
|
|
417
|
+
var ContextCacheSelectSchema = createSelectSchema(contextCache);
|
|
418
|
+
var ContextCacheInsertSchema = createInsertSchema(contextCache);
|
|
419
|
+
var ContextCacheUpdateSchema = ContextCacheInsertSchema.partial();
|
|
420
|
+
var ContextCacheApiSelectSchema = createApiSchema(ContextCacheSelectSchema);
|
|
421
|
+
var ContextCacheApiInsertSchema = createApiInsertSchema(ContextCacheInsertSchema);
|
|
422
|
+
var ContextCacheApiUpdateSchema = createApiUpdateSchema(ContextCacheUpdateSchema);
|
|
423
|
+
var DataComponentSelectSchema = createSelectSchema(dataComponents);
|
|
424
|
+
var DataComponentInsertSchema = createInsertSchema(dataComponents).extend({
|
|
425
|
+
id: resourceIdSchema
|
|
426
|
+
});
|
|
427
|
+
var DataComponentBaseSchema = DataComponentInsertSchema.omit({
|
|
428
|
+
createdAt: true,
|
|
429
|
+
updatedAt: true
|
|
430
|
+
});
|
|
431
|
+
var DataComponentUpdateSchema = DataComponentInsertSchema.partial();
|
|
432
|
+
var DataComponentApiSelectSchema = createApiSchema(DataComponentSelectSchema).openapi("DataComponent");
|
|
433
|
+
var DataComponentApiInsertSchema = createApiInsertSchema(DataComponentInsertSchema).openapi("DataComponentCreate");
|
|
434
|
+
var DataComponentApiUpdateSchema = createApiUpdateSchema(DataComponentUpdateSchema).openapi("DataComponentUpdate");
|
|
435
|
+
var SubAgentDataComponentSelectSchema = createSelectSchema(subAgentDataComponents);
|
|
436
|
+
var SubAgentDataComponentInsertSchema = createInsertSchema(subAgentDataComponents);
|
|
437
|
+
var SubAgentDataComponentUpdateSchema = SubAgentDataComponentInsertSchema.partial();
|
|
438
|
+
var SubAgentDataComponentApiSelectSchema = createAgentScopedApiSchema(
|
|
439
|
+
SubAgentDataComponentSelectSchema
|
|
440
|
+
);
|
|
441
|
+
var SubAgentDataComponentApiInsertSchema = SubAgentDataComponentInsertSchema.omit({
|
|
442
|
+
tenantId: true,
|
|
443
|
+
projectId: true,
|
|
444
|
+
id: true,
|
|
445
|
+
createdAt: true
|
|
446
|
+
});
|
|
447
|
+
var SubAgentDataComponentApiUpdateSchema = createAgentScopedApiUpdateSchema(
|
|
448
|
+
SubAgentDataComponentUpdateSchema
|
|
449
|
+
);
|
|
450
|
+
var ArtifactComponentSelectSchema = createSelectSchema(artifactComponents);
|
|
451
|
+
var ArtifactComponentInsertSchema = createInsertSchema(artifactComponents).extend({
|
|
452
|
+
id: resourceIdSchema
|
|
453
|
+
});
|
|
454
|
+
var ArtifactComponentUpdateSchema = ArtifactComponentInsertSchema.partial();
|
|
455
|
+
var ArtifactComponentApiSelectSchema = createApiSchema(
|
|
456
|
+
ArtifactComponentSelectSchema
|
|
457
|
+
).openapi("ArtifactComponent");
|
|
458
|
+
var ArtifactComponentApiInsertSchema = ArtifactComponentInsertSchema.omit({
|
|
459
|
+
tenantId: true,
|
|
460
|
+
projectId: true,
|
|
461
|
+
createdAt: true,
|
|
462
|
+
updatedAt: true
|
|
463
|
+
}).openapi("ArtifactComponentCreate");
|
|
464
|
+
var ArtifactComponentApiUpdateSchema = createApiUpdateSchema(
|
|
465
|
+
ArtifactComponentUpdateSchema
|
|
466
|
+
).openapi("ArtifactComponentUpdate");
|
|
467
|
+
var SubAgentArtifactComponentSelectSchema = createSelectSchema(subAgentArtifactComponents);
|
|
468
|
+
var SubAgentArtifactComponentInsertSchema = createInsertSchema(
|
|
469
|
+
subAgentArtifactComponents
|
|
470
|
+
).extend({
|
|
471
|
+
id: resourceIdSchema,
|
|
472
|
+
subAgentId: resourceIdSchema,
|
|
473
|
+
artifactComponentId: resourceIdSchema
|
|
474
|
+
});
|
|
475
|
+
var SubAgentArtifactComponentUpdateSchema = SubAgentArtifactComponentInsertSchema.partial();
|
|
476
|
+
var SubAgentArtifactComponentApiSelectSchema = createAgentScopedApiSchema(
|
|
477
|
+
SubAgentArtifactComponentSelectSchema
|
|
478
|
+
);
|
|
479
|
+
var SubAgentArtifactComponentApiInsertSchema = SubAgentArtifactComponentInsertSchema.omit({
|
|
480
|
+
tenantId: true,
|
|
481
|
+
projectId: true,
|
|
482
|
+
id: true,
|
|
483
|
+
createdAt: true
|
|
484
|
+
});
|
|
485
|
+
var SubAgentArtifactComponentApiUpdateSchema = createAgentScopedApiUpdateSchema(
|
|
486
|
+
SubAgentArtifactComponentUpdateSchema
|
|
487
|
+
);
|
|
488
|
+
var ExternalAgentSelectSchema = createSelectSchema(externalAgents).extend({
|
|
489
|
+
credentialReferenceId: z.string().nullable().optional()
|
|
490
|
+
});
|
|
491
|
+
var ExternalAgentInsertSchema = createInsertSchema(externalAgents).extend({
|
|
492
|
+
id: resourceIdSchema
|
|
493
|
+
});
|
|
494
|
+
var ExternalAgentUpdateSchema = ExternalAgentInsertSchema.partial();
|
|
495
|
+
var ExternalAgentApiSelectSchema = createApiSchema(ExternalAgentSelectSchema).openapi("ExternalAgent");
|
|
496
|
+
var ExternalAgentApiInsertSchema = createApiInsertSchema(ExternalAgentInsertSchema).openapi("ExternalAgentCreate");
|
|
497
|
+
var ExternalAgentApiUpdateSchema = createApiUpdateSchema(ExternalAgentUpdateSchema).openapi("ExternalAgentUpdate");
|
|
498
|
+
var AllAgentSchema = z.discriminatedUnion("type", [
|
|
499
|
+
SubAgentApiSelectSchema.extend({ type: z.literal("internal") }),
|
|
500
|
+
ExternalAgentApiSelectSchema.extend({ type: z.literal("external") })
|
|
501
|
+
]);
|
|
502
|
+
var ApiKeySelectSchema = createSelectSchema(apiKeys);
|
|
503
|
+
var ApiKeyInsertSchema = createInsertSchema(apiKeys).extend({
|
|
504
|
+
id: resourceIdSchema,
|
|
505
|
+
agentId: resourceIdSchema
|
|
506
|
+
});
|
|
507
|
+
var ApiKeyUpdateSchema = ApiKeyInsertSchema.partial().omit({
|
|
508
|
+
tenantId: true,
|
|
509
|
+
projectId: true,
|
|
510
|
+
id: true,
|
|
511
|
+
publicId: true,
|
|
512
|
+
keyHash: true,
|
|
513
|
+
keyPrefix: true,
|
|
514
|
+
createdAt: true
|
|
515
|
+
});
|
|
516
|
+
var ApiKeyApiSelectSchema = ApiKeySelectSchema.omit({
|
|
517
|
+
tenantId: true,
|
|
518
|
+
projectId: true,
|
|
519
|
+
keyHash: true
|
|
520
|
+
// Never expose the hash
|
|
521
|
+
}).openapi("ApiKey");
|
|
522
|
+
var ApiKeyApiCreationResponseSchema = z.object({
|
|
523
|
+
data: z.object({
|
|
524
|
+
apiKey: ApiKeyApiSelectSchema,
|
|
525
|
+
key: z.string().describe("The full API key (shown only once)")
|
|
526
|
+
})
|
|
527
|
+
});
|
|
528
|
+
var ApiKeyApiInsertSchema = ApiKeyInsertSchema.omit({
|
|
529
|
+
tenantId: true,
|
|
530
|
+
projectId: true,
|
|
531
|
+
id: true,
|
|
532
|
+
// Auto-generated
|
|
533
|
+
publicId: true,
|
|
534
|
+
// Auto-generated
|
|
535
|
+
keyHash: true,
|
|
536
|
+
// Auto-generated
|
|
537
|
+
keyPrefix: true,
|
|
538
|
+
// Auto-generated
|
|
539
|
+
lastUsedAt: true
|
|
540
|
+
// Not set on creation
|
|
541
|
+
}).openapi("ApiKeyCreate");
|
|
542
|
+
var ApiKeyApiUpdateSchema = ApiKeyUpdateSchema.openapi("ApiKeyUpdate");
|
|
543
|
+
var CredentialReferenceSelectSchema = z.object({
|
|
544
|
+
id: z.string(),
|
|
545
|
+
tenantId: z.string(),
|
|
546
|
+
projectId: z.string(),
|
|
547
|
+
name: z.string(),
|
|
548
|
+
type: z.string(),
|
|
549
|
+
credentialStoreId: z.string(),
|
|
550
|
+
retrievalParams: z.record(z.string(), z.unknown()).nullish(),
|
|
551
|
+
createdAt: z.string(),
|
|
552
|
+
updatedAt: z.string()
|
|
553
|
+
});
|
|
554
|
+
var CredentialReferenceInsertSchema = createInsertSchema(credentialReferences).extend({
|
|
555
|
+
id: resourceIdSchema,
|
|
556
|
+
type: z.string(),
|
|
557
|
+
credentialStoreId: resourceIdSchema,
|
|
558
|
+
retrievalParams: z.record(z.string(), z.unknown()).nullish()
|
|
559
|
+
});
|
|
560
|
+
var CredentialReferenceUpdateSchema = CredentialReferenceInsertSchema.partial();
|
|
561
|
+
var CredentialReferenceApiSelectSchema = createApiSchema(CredentialReferenceSelectSchema).extend({
|
|
562
|
+
type: z.enum(CredentialStoreType),
|
|
563
|
+
tools: z.array(ToolSelectSchema).optional(),
|
|
564
|
+
externalAgents: z.array(ExternalAgentSelectSchema).optional()
|
|
565
|
+
}).openapi("CredentialReference");
|
|
566
|
+
var CredentialReferenceApiInsertSchema = createApiInsertSchema(
|
|
567
|
+
CredentialReferenceInsertSchema
|
|
568
|
+
).extend({
|
|
569
|
+
type: z.enum(CredentialStoreType)
|
|
570
|
+
}).openapi("CredentialReferenceCreate");
|
|
571
|
+
var CredentialReferenceApiUpdateSchema = createApiUpdateSchema(
|
|
572
|
+
CredentialReferenceUpdateSchema
|
|
573
|
+
).extend({
|
|
574
|
+
type: z.enum(CredentialStoreType).optional()
|
|
575
|
+
}).openapi("CredentialReferenceUpdate");
|
|
576
|
+
var CredentialStoreSchema = z.object({
|
|
577
|
+
id: z.string().describe("Unique identifier of the credential store"),
|
|
578
|
+
type: z.enum(CredentialStoreType),
|
|
579
|
+
available: z.boolean().describe("Whether the store is functional and ready to use"),
|
|
580
|
+
reason: z.string().nullable().describe("Reason why store is not available, if applicable")
|
|
581
|
+
}).openapi("CredentialStore");
|
|
582
|
+
var CredentialStoreListResponseSchema = z.object({
|
|
583
|
+
data: z.array(CredentialStoreSchema).describe("List of credential stores")
|
|
584
|
+
}).openapi("CredentialStoreListResponse");
|
|
585
|
+
var CreateCredentialInStoreRequestSchema = z.object({
|
|
586
|
+
key: z.string().describe("The credential key"),
|
|
587
|
+
value: z.string().describe("The credential value"),
|
|
588
|
+
metadata: z.record(z.string(), z.string()).nullish().describe("The metadata for the credential")
|
|
589
|
+
}).openapi("CreateCredentialInStoreRequest");
|
|
590
|
+
var CreateCredentialInStoreResponseSchema = z.object({
|
|
591
|
+
data: z.object({
|
|
592
|
+
key: z.string().describe("The credential key"),
|
|
593
|
+
storeId: z.string().describe("The store ID where credential was created"),
|
|
594
|
+
createdAt: z.string().describe("ISO timestamp of creation")
|
|
595
|
+
})
|
|
596
|
+
}).openapi("CreateCredentialInStoreResponse");
|
|
597
|
+
var RelatedAgentInfoSchema = z.object({
|
|
598
|
+
id: z.string(),
|
|
599
|
+
name: z.string(),
|
|
600
|
+
description: z.string()
|
|
601
|
+
}).openapi("RelatedAgentInfo");
|
|
602
|
+
var ComponentAssociationSchema = z.object({
|
|
603
|
+
subAgentId: z.string(),
|
|
604
|
+
createdAt: z.string()
|
|
605
|
+
}).openapi("ComponentAssociation");
|
|
606
|
+
var OAuthLoginQuerySchema = z.object({
|
|
607
|
+
tenantId: z.string().min(1, "Tenant ID is required"),
|
|
608
|
+
projectId: z.string().min(1, "Project ID is required"),
|
|
609
|
+
toolId: z.string().min(1, "Tool ID is required")
|
|
610
|
+
}).openapi("OAuthLoginQuery");
|
|
611
|
+
var OAuthCallbackQuerySchema = z.object({
|
|
612
|
+
code: z.string().min(1, "Authorization code is required"),
|
|
613
|
+
state: z.string().min(1, "State parameter is required"),
|
|
614
|
+
error: z.string().optional(),
|
|
615
|
+
error_description: z.string().optional()
|
|
616
|
+
}).openapi("OAuthCallbackQuery");
|
|
617
|
+
var McpToolSchema = ToolInsertSchema.extend({
|
|
618
|
+
imageUrl: imageUrlSchema,
|
|
619
|
+
availableTools: z.array(McpToolDefinitionSchema).optional(),
|
|
620
|
+
status: ToolStatusSchema.default("unknown"),
|
|
621
|
+
version: z.string().optional(),
|
|
622
|
+
expiresAt: z.string().optional(),
|
|
623
|
+
relationshipId: z.string().optional()
|
|
624
|
+
}).openapi("McpTool");
|
|
625
|
+
var MCPToolConfigSchema = McpToolSchema.omit({
|
|
626
|
+
config: true,
|
|
627
|
+
tenantId: true,
|
|
628
|
+
projectId: true,
|
|
629
|
+
status: true,
|
|
630
|
+
version: true,
|
|
631
|
+
createdAt: true,
|
|
632
|
+
updatedAt: true,
|
|
633
|
+
credentialReferenceId: true
|
|
634
|
+
}).extend({
|
|
635
|
+
tenantId: z.string().optional(),
|
|
636
|
+
projectId: z.string().optional(),
|
|
637
|
+
description: z.string().optional(),
|
|
638
|
+
serverUrl: z.url(),
|
|
639
|
+
activeTools: z.array(z.string()).optional(),
|
|
640
|
+
mcpType: z.enum(MCPServerType).optional(),
|
|
641
|
+
transport: McpTransportConfigSchema.optional(),
|
|
642
|
+
credential: CredentialReferenceApiInsertSchema.optional()
|
|
643
|
+
});
|
|
644
|
+
var ToolUpdateSchema = ToolInsertSchema.partial();
|
|
645
|
+
var ToolApiSelectSchema = createApiSchema(ToolSelectSchema).openapi("Tool");
|
|
646
|
+
var ToolApiInsertSchema = createApiInsertSchema(ToolInsertSchema).openapi("ToolCreate");
|
|
647
|
+
var ToolApiUpdateSchema = createApiUpdateSchema(ToolUpdateSchema).openapi("ToolUpdate");
|
|
648
|
+
var FunctionToolSelectSchema = createSelectSchema(functionTools);
|
|
649
|
+
var FunctionToolInsertSchema = createInsertSchema(functionTools).extend({
|
|
650
|
+
id: resourceIdSchema
|
|
651
|
+
});
|
|
652
|
+
var FunctionToolUpdateSchema = FunctionToolInsertSchema.partial();
|
|
653
|
+
var FunctionToolApiSelectSchema = createApiSchema(FunctionToolSelectSchema).openapi("FunctionTool");
|
|
654
|
+
var FunctionToolApiInsertSchema = createAgentScopedApiInsertSchema(FunctionToolInsertSchema).openapi("FunctionToolCreate");
|
|
655
|
+
var FunctionToolApiUpdateSchema = createApiUpdateSchema(FunctionToolUpdateSchema).openapi("FunctionToolUpdate");
|
|
656
|
+
var FunctionSelectSchema = createSelectSchema(functions);
|
|
657
|
+
var FunctionInsertSchema = createInsertSchema(functions).extend({
|
|
658
|
+
id: resourceIdSchema
|
|
659
|
+
});
|
|
660
|
+
var FunctionUpdateSchema = FunctionInsertSchema.partial();
|
|
661
|
+
var FunctionApiSelectSchema = createApiSchema(FunctionSelectSchema).openapi("Function");
|
|
662
|
+
var FunctionApiInsertSchema = createApiInsertSchema(FunctionInsertSchema).openapi("FunctionCreate");
|
|
663
|
+
var FunctionApiUpdateSchema = createApiUpdateSchema(FunctionUpdateSchema).openapi("FunctionUpdate");
|
|
664
|
+
var FetchConfigSchema = z.object({
|
|
665
|
+
url: z.string().min(1, "URL is required"),
|
|
666
|
+
method: z.enum(["GET", "POST", "PUT", "DELETE", "PATCH"]).optional().default("GET"),
|
|
667
|
+
headers: z.record(z.string(), z.string()).optional(),
|
|
668
|
+
body: z.record(z.string(), z.unknown()).optional(),
|
|
669
|
+
transform: z.string().optional(),
|
|
670
|
+
// JSONPath or JS transform function
|
|
671
|
+
timeout: z.number().min(0).optional().default(CONTEXT_FETCHER_HTTP_TIMEOUT_MS_DEFAULT).optional()
|
|
672
|
+
}).openapi("FetchConfig");
|
|
673
|
+
var FetchDefinitionSchema = z.object({
|
|
674
|
+
id: z.string().min(1, "Fetch definition ID is required"),
|
|
675
|
+
name: z.string().optional(),
|
|
676
|
+
trigger: z.enum(["initialization", "invocation"]),
|
|
677
|
+
fetchConfig: FetchConfigSchema,
|
|
678
|
+
responseSchema: z.any().optional(),
|
|
679
|
+
// JSON Schema for validating HTTP response
|
|
680
|
+
defaultValue: z.any().optional().openapi({
|
|
681
|
+
description: "Default value if fetch fails"
|
|
682
|
+
}),
|
|
683
|
+
credential: CredentialReferenceApiInsertSchema.optional()
|
|
684
|
+
}).openapi("FetchDefinition");
|
|
685
|
+
var ContextConfigSelectSchema = createSelectSchema(contextConfigs).extend({
|
|
686
|
+
headersSchema: z.any().optional().openapi({
|
|
687
|
+
type: "object",
|
|
688
|
+
description: "JSON Schema for validating request headers"
|
|
689
|
+
})
|
|
690
|
+
});
|
|
691
|
+
var ContextConfigInsertSchema = createInsertSchema(contextConfigs).extend({
|
|
692
|
+
id: resourceIdSchema.optional(),
|
|
693
|
+
headersSchema: z.any().nullable().optional().openapi({
|
|
694
|
+
type: "object",
|
|
695
|
+
description: "JSON Schema for validating request headers"
|
|
696
|
+
}),
|
|
697
|
+
contextVariables: z.any().nullable().optional().openapi({
|
|
698
|
+
type: "object",
|
|
699
|
+
description: "Context variables configuration with fetch definitions"
|
|
700
|
+
})
|
|
701
|
+
}).omit({
|
|
702
|
+
createdAt: true,
|
|
703
|
+
updatedAt: true
|
|
704
|
+
});
|
|
705
|
+
var ContextConfigUpdateSchema = ContextConfigInsertSchema.partial();
|
|
706
|
+
var ContextConfigApiSelectSchema = createApiSchema(ContextConfigSelectSchema).omit({
|
|
707
|
+
agentId: true
|
|
708
|
+
}).openapi("ContextConfig");
|
|
709
|
+
var ContextConfigApiInsertSchema = createApiInsertSchema(ContextConfigInsertSchema).omit({
|
|
710
|
+
agentId: true
|
|
711
|
+
}).openapi("ContextConfigCreate");
|
|
712
|
+
var ContextConfigApiUpdateSchema = createApiUpdateSchema(ContextConfigUpdateSchema).omit({
|
|
713
|
+
agentId: true
|
|
714
|
+
}).openapi("ContextConfigUpdate");
|
|
715
|
+
var SubAgentToolRelationSelectSchema = createSelectSchema(subAgentToolRelations);
|
|
716
|
+
var SubAgentToolRelationInsertSchema = createInsertSchema(subAgentToolRelations).extend({
|
|
717
|
+
id: resourceIdSchema,
|
|
718
|
+
subAgentId: resourceIdSchema,
|
|
719
|
+
toolId: resourceIdSchema,
|
|
720
|
+
selectedTools: z.array(z.string()).nullish(),
|
|
721
|
+
headers: z.record(z.string(), z.string()).nullish(),
|
|
722
|
+
toolPolicies: z.record(z.string(), z.object({ needsApproval: z.boolean().optional() })).nullish()
|
|
723
|
+
});
|
|
724
|
+
var SubAgentToolRelationUpdateSchema = SubAgentToolRelationInsertSchema.partial();
|
|
725
|
+
var SubAgentToolRelationApiSelectSchema = createAgentScopedApiSchema(
|
|
726
|
+
SubAgentToolRelationSelectSchema
|
|
727
|
+
).openapi("SubAgentToolRelation");
|
|
728
|
+
var SubAgentToolRelationApiInsertSchema = createAgentScopedApiInsertSchema(
|
|
729
|
+
SubAgentToolRelationInsertSchema
|
|
730
|
+
).openapi("SubAgentToolRelationCreate");
|
|
731
|
+
var SubAgentToolRelationApiUpdateSchema = createAgentScopedApiUpdateSchema(
|
|
732
|
+
SubAgentToolRelationUpdateSchema
|
|
733
|
+
).openapi("SubAgentToolRelationUpdate");
|
|
734
|
+
var SubAgentExternalAgentRelationSelectSchema = createSelectSchema(
|
|
735
|
+
subAgentExternalAgentRelations
|
|
736
|
+
);
|
|
737
|
+
var SubAgentExternalAgentRelationInsertSchema = createInsertSchema(
|
|
738
|
+
subAgentExternalAgentRelations
|
|
739
|
+
).extend({
|
|
740
|
+
id: resourceIdSchema,
|
|
741
|
+
subAgentId: resourceIdSchema,
|
|
742
|
+
externalAgentId: resourceIdSchema,
|
|
743
|
+
headers: z.record(z.string(), z.string()).nullish()
|
|
744
|
+
});
|
|
745
|
+
var SubAgentExternalAgentRelationUpdateSchema = SubAgentExternalAgentRelationInsertSchema.partial();
|
|
746
|
+
var SubAgentExternalAgentRelationApiSelectSchema = createAgentScopedApiSchema(
|
|
747
|
+
SubAgentExternalAgentRelationSelectSchema
|
|
748
|
+
).openapi("SubAgentExternalAgentRelation");
|
|
749
|
+
var SubAgentExternalAgentRelationApiInsertSchema = createAgentScopedApiInsertSchema(
|
|
750
|
+
SubAgentExternalAgentRelationInsertSchema
|
|
751
|
+
).omit({ id: true, subAgentId: true }).openapi("SubAgentExternalAgentRelationCreate");
|
|
752
|
+
var SubAgentExternalAgentRelationApiUpdateSchema = createAgentScopedApiUpdateSchema(
|
|
753
|
+
SubAgentExternalAgentRelationUpdateSchema
|
|
754
|
+
).openapi("SubAgentExternalAgentRelationUpdate");
|
|
755
|
+
var SubAgentTeamAgentRelationSelectSchema = createSelectSchema(subAgentTeamAgentRelations);
|
|
756
|
+
var SubAgentTeamAgentRelationInsertSchema = createInsertSchema(
|
|
757
|
+
subAgentTeamAgentRelations
|
|
758
|
+
).extend({
|
|
759
|
+
id: resourceIdSchema,
|
|
760
|
+
subAgentId: resourceIdSchema,
|
|
761
|
+
targetAgentId: resourceIdSchema,
|
|
762
|
+
headers: z.record(z.string(), z.string()).nullish()
|
|
763
|
+
});
|
|
764
|
+
var SubAgentTeamAgentRelationUpdateSchema = SubAgentTeamAgentRelationInsertSchema.partial();
|
|
765
|
+
var SubAgentTeamAgentRelationApiSelectSchema = createAgentScopedApiSchema(
|
|
766
|
+
SubAgentTeamAgentRelationSelectSchema
|
|
767
|
+
).openapi("SubAgentTeamAgentRelation");
|
|
768
|
+
var SubAgentTeamAgentRelationApiInsertSchema = createAgentScopedApiInsertSchema(
|
|
769
|
+
SubAgentTeamAgentRelationInsertSchema
|
|
770
|
+
).omit({ id: true, subAgentId: true }).openapi("SubAgentTeamAgentRelationCreate");
|
|
771
|
+
var SubAgentTeamAgentRelationApiUpdateSchema = createAgentScopedApiUpdateSchema(
|
|
772
|
+
SubAgentTeamAgentRelationUpdateSchema
|
|
773
|
+
).openapi("SubAgentTeamAgentRelationUpdate");
|
|
774
|
+
var LedgerArtifactSelectSchema = createSelectSchema(ledgerArtifacts);
|
|
775
|
+
var LedgerArtifactInsertSchema = createInsertSchema(ledgerArtifacts);
|
|
776
|
+
var LedgerArtifactUpdateSchema = LedgerArtifactInsertSchema.partial();
|
|
777
|
+
var LedgerArtifactApiSelectSchema = createApiSchema(LedgerArtifactSelectSchema);
|
|
778
|
+
var LedgerArtifactApiInsertSchema = createApiInsertSchema(LedgerArtifactInsertSchema);
|
|
779
|
+
var LedgerArtifactApiUpdateSchema = createApiUpdateSchema(LedgerArtifactUpdateSchema);
|
|
780
|
+
var StatusComponentSchema = z.object({
|
|
781
|
+
type: z.string(),
|
|
782
|
+
description: z.string().optional(),
|
|
783
|
+
detailsSchema: z.object({
|
|
784
|
+
type: z.literal("object"),
|
|
785
|
+
properties: z.record(z.string(), z.any()),
|
|
786
|
+
required: z.array(z.string()).optional()
|
|
787
|
+
}).optional()
|
|
788
|
+
}).openapi("StatusComponent");
|
|
789
|
+
var StatusUpdateSchema = z.object({
|
|
790
|
+
enabled: z.boolean().optional(),
|
|
791
|
+
numEvents: z.number().min(1).max(STATUS_UPDATE_MAX_NUM_EVENTS).optional(),
|
|
792
|
+
timeInSeconds: z.number().min(1).max(STATUS_UPDATE_MAX_INTERVAL_SECONDS).optional(),
|
|
793
|
+
prompt: z.string().max(
|
|
794
|
+
VALIDATION_SUB_AGENT_PROMPT_MAX_CHARS,
|
|
795
|
+
`Custom prompt cannot exceed ${VALIDATION_SUB_AGENT_PROMPT_MAX_CHARS} characters`
|
|
796
|
+
).optional(),
|
|
797
|
+
statusComponents: z.array(StatusComponentSchema).optional()
|
|
798
|
+
}).openapi("StatusUpdate");
|
|
799
|
+
var CanUseItemSchema = z.object({
|
|
800
|
+
agentToolRelationId: z.string().optional(),
|
|
801
|
+
toolId: z.string(),
|
|
802
|
+
toolSelection: z.array(z.string()).nullish(),
|
|
803
|
+
headers: z.record(z.string(), z.string()).nullish(),
|
|
804
|
+
toolPolicies: z.record(z.string(), z.object({ needsApproval: z.boolean().optional() })).nullish()
|
|
805
|
+
}).openapi("CanUseItem");
|
|
806
|
+
var canDelegateToExternalAgentSchema = z.object({
|
|
807
|
+
externalAgentId: z.string(),
|
|
808
|
+
subAgentExternalAgentRelationId: z.string().optional(),
|
|
809
|
+
headers: z.record(z.string(), z.string()).nullish()
|
|
810
|
+
}).openapi("CanDelegateToExternalAgent");
|
|
811
|
+
var canDelegateToTeamAgentSchema = z.object({
|
|
812
|
+
agentId: z.string(),
|
|
813
|
+
subAgentTeamAgentRelationId: z.string().optional(),
|
|
814
|
+
headers: z.record(z.string(), z.string()).nullish()
|
|
815
|
+
}).openapi("CanDelegateToTeamAgent");
|
|
816
|
+
var TeamAgentSchema = z.object({
|
|
817
|
+
id: z.string(),
|
|
818
|
+
name: z.string(),
|
|
819
|
+
description: z.string()
|
|
820
|
+
}).openapi("TeamAgent");
|
|
821
|
+
var FullAgentAgentInsertSchema = SubAgentApiInsertSchema.extend({
|
|
822
|
+
type: z.literal("internal"),
|
|
823
|
+
canUse: z.array(CanUseItemSchema),
|
|
824
|
+
// All tools (both MCP and function tools)
|
|
825
|
+
dataComponents: z.array(z.string()).optional(),
|
|
826
|
+
artifactComponents: z.array(z.string()).optional(),
|
|
827
|
+
canTransferTo: z.array(z.string()).optional(),
|
|
828
|
+
prompt: z.string().trim().nonempty(),
|
|
829
|
+
canDelegateTo: z.array(
|
|
830
|
+
z.union([
|
|
831
|
+
z.string(),
|
|
832
|
+
// Internal subAgent ID
|
|
833
|
+
canDelegateToExternalAgentSchema,
|
|
834
|
+
// External agent with headers
|
|
835
|
+
canDelegateToTeamAgentSchema
|
|
836
|
+
// Team agent with headers
|
|
837
|
+
])
|
|
838
|
+
).optional()
|
|
839
|
+
}).openapi("FullAgentAgentInsert");
|
|
840
|
+
var AgentWithinContextOfProjectSchema = AgentApiInsertSchema.extend({
|
|
841
|
+
subAgents: z.record(z.string(), FullAgentAgentInsertSchema),
|
|
842
|
+
// Lookup maps for UI to resolve canUse items
|
|
843
|
+
tools: z.record(z.string(), ToolApiInsertSchema).optional(),
|
|
844
|
+
// MCP tools (project-scoped)
|
|
845
|
+
externalAgents: z.record(z.string(), ExternalAgentApiInsertSchema).optional(),
|
|
846
|
+
// External agents (project-scoped)
|
|
847
|
+
teamAgents: z.record(z.string(), TeamAgentSchema).optional(),
|
|
848
|
+
// Team agents contain basic metadata for the agent to be delegated to
|
|
849
|
+
functionTools: z.record(z.string(), FunctionToolApiInsertSchema).optional(),
|
|
850
|
+
// Function tools (agent-scoped)
|
|
851
|
+
functions: z.record(z.string(), FunctionApiInsertSchema).optional(),
|
|
852
|
+
// Get function code for function tools
|
|
853
|
+
contextConfig: z.optional(ContextConfigApiInsertSchema),
|
|
854
|
+
statusUpdates: z.optional(StatusUpdateSchema),
|
|
855
|
+
models: ModelSchema.optional(),
|
|
856
|
+
stopWhen: AgentStopWhenSchema.optional(),
|
|
857
|
+
prompt: z.string().max(
|
|
858
|
+
VALIDATION_AGENT_PROMPT_MAX_CHARS,
|
|
859
|
+
`Agent prompt cannot exceed ${VALIDATION_AGENT_PROMPT_MAX_CHARS} characters`
|
|
860
|
+
).optional()
|
|
861
|
+
}).openapi("AgentWithinContextOfProject");
|
|
862
|
+
var PaginationSchema = z.object({
|
|
863
|
+
page: pageNumber,
|
|
864
|
+
limit: limitNumber,
|
|
865
|
+
total: z.number(),
|
|
866
|
+
pages: z.number()
|
|
867
|
+
}).openapi("Pagination");
|
|
868
|
+
var ListResponseSchema = (itemSchema) => z.object({
|
|
869
|
+
data: z.array(itemSchema),
|
|
870
|
+
pagination: PaginationSchema
|
|
871
|
+
});
|
|
872
|
+
var SingleResponseSchema = (itemSchema) => z.object({
|
|
873
|
+
data: itemSchema
|
|
874
|
+
});
|
|
875
|
+
var ErrorResponseSchema = z.object({
|
|
876
|
+
error: z.string(),
|
|
877
|
+
message: z.string().optional(),
|
|
878
|
+
details: z.any().optional().openapi({
|
|
879
|
+
description: "Additional error details"
|
|
880
|
+
})
|
|
881
|
+
}).openapi("ErrorResponse");
|
|
882
|
+
var ExistsResponseSchema = z.object({
|
|
883
|
+
exists: z.boolean()
|
|
884
|
+
}).openapi("ExistsResponse");
|
|
885
|
+
var RemovedResponseSchema = z.object({
|
|
886
|
+
message: z.string(),
|
|
887
|
+
removed: z.boolean()
|
|
888
|
+
}).openapi("RemovedResponse");
|
|
889
|
+
var ProjectSelectSchema = registerFieldSchemas(
|
|
890
|
+
createSelectSchema(projects).extend({
|
|
891
|
+
models: ProjectModelSchema.nullable(),
|
|
892
|
+
stopWhen: StopWhenSchema.nullable()
|
|
893
|
+
})
|
|
894
|
+
);
|
|
895
|
+
var ProjectInsertSchema = createInsertSchema(projects).extend({
|
|
896
|
+
models: ProjectModelSchema,
|
|
897
|
+
stopWhen: StopWhenSchema.optional()
|
|
898
|
+
}).omit({
|
|
899
|
+
createdAt: true,
|
|
900
|
+
updatedAt: true
|
|
901
|
+
});
|
|
902
|
+
var ProjectUpdateSchema = ProjectInsertSchema.partial().omit({
|
|
903
|
+
id: true,
|
|
904
|
+
tenantId: true
|
|
905
|
+
});
|
|
906
|
+
var ProjectApiSelectSchema = ProjectSelectSchema.omit({ tenantId: true }).openapi(
|
|
907
|
+
"Project"
|
|
908
|
+
);
|
|
909
|
+
var ProjectApiInsertSchema = ProjectInsertSchema.omit({ tenantId: true }).openapi(
|
|
910
|
+
"ProjectCreate"
|
|
911
|
+
);
|
|
912
|
+
var ProjectApiUpdateSchema = ProjectUpdateSchema.openapi("ProjectUpdate");
|
|
913
|
+
var FullProjectDefinitionSchema = ProjectApiInsertSchema.extend({
|
|
914
|
+
agents: z.record(z.string(), AgentWithinContextOfProjectSchema),
|
|
915
|
+
tools: z.record(z.string(), ToolApiInsertSchema),
|
|
916
|
+
functionTools: z.record(z.string(), FunctionToolApiInsertSchema).optional(),
|
|
917
|
+
functions: z.record(z.string(), FunctionApiInsertSchema).optional(),
|
|
918
|
+
dataComponents: z.record(z.string(), DataComponentApiInsertSchema).optional(),
|
|
919
|
+
artifactComponents: z.record(z.string(), ArtifactComponentApiInsertSchema).optional(),
|
|
920
|
+
externalAgents: z.record(z.string(), ExternalAgentApiInsertSchema).optional(),
|
|
921
|
+
statusUpdates: z.optional(StatusUpdateSchema),
|
|
922
|
+
credentialReferences: z.record(z.string(), CredentialReferenceApiInsertSchema).optional(),
|
|
923
|
+
createdAt: z.string().optional(),
|
|
924
|
+
updatedAt: z.string().optional()
|
|
925
|
+
}).openapi("FullProjectDefinition");
|
|
926
|
+
var ProjectResponse = z.object({ data: ProjectApiSelectSchema }).openapi("ProjectResponse");
|
|
927
|
+
var SubAgentResponse = z.object({ data: SubAgentApiSelectSchema }).openapi("SubAgentResponse");
|
|
928
|
+
var AgentResponse = z.object({ data: AgentApiSelectSchema }).openapi("AgentResponse");
|
|
929
|
+
var ToolResponse = z.object({ data: ToolApiSelectSchema }).openapi("ToolResponse");
|
|
930
|
+
var ExternalAgentResponse = z.object({ data: ExternalAgentApiSelectSchema }).openapi("ExternalAgentResponse");
|
|
931
|
+
var ContextConfigResponse = z.object({ data: ContextConfigApiSelectSchema }).openapi("ContextConfigResponse");
|
|
932
|
+
var ApiKeyResponse = z.object({ data: ApiKeyApiSelectSchema }).openapi("ApiKeyResponse");
|
|
933
|
+
var CredentialReferenceResponse = z.object({ data: CredentialReferenceApiSelectSchema }).openapi("CredentialReferenceResponse");
|
|
934
|
+
var FunctionResponse = z.object({ data: FunctionApiSelectSchema }).openapi("FunctionResponse");
|
|
935
|
+
var FunctionToolResponse = z.object({ data: FunctionToolApiSelectSchema }).openapi("FunctionToolResponse");
|
|
936
|
+
var DataComponentResponse = z.object({ data: DataComponentApiSelectSchema }).openapi("DataComponentResponse");
|
|
937
|
+
var ArtifactComponentResponse = z.object({ data: ArtifactComponentApiSelectSchema }).openapi("ArtifactComponentResponse");
|
|
938
|
+
var SubAgentRelationResponse = z.object({ data: SubAgentRelationApiSelectSchema }).openapi("SubAgentRelationResponse");
|
|
939
|
+
var SubAgentToolRelationResponse = z.object({ data: SubAgentToolRelationApiSelectSchema }).openapi("SubAgentToolRelationResponse");
|
|
940
|
+
var ConversationResponse = z.object({ data: ConversationApiSelectSchema }).openapi("ConversationResponse");
|
|
941
|
+
var MessageResponse = z.object({ data: MessageApiSelectSchema }).openapi("MessageResponse");
|
|
942
|
+
var ProjectListResponse = z.object({
|
|
943
|
+
data: z.array(ProjectApiSelectSchema),
|
|
944
|
+
pagination: PaginationSchema
|
|
945
|
+
}).openapi("ProjectListResponse");
|
|
946
|
+
var SubAgentListResponse = z.object({
|
|
947
|
+
data: z.array(SubAgentApiSelectSchema),
|
|
948
|
+
pagination: PaginationSchema
|
|
949
|
+
}).openapi("SubAgentListResponse");
|
|
950
|
+
var AgentListResponse = z.object({
|
|
951
|
+
data: z.array(AgentApiSelectSchema),
|
|
952
|
+
pagination: PaginationSchema
|
|
953
|
+
}).openapi("AgentListResponse");
|
|
954
|
+
var ToolListResponse = z.object({
|
|
955
|
+
data: z.array(ToolApiSelectSchema),
|
|
956
|
+
pagination: PaginationSchema
|
|
957
|
+
}).openapi("ToolListResponse");
|
|
958
|
+
var ExternalAgentListResponse = z.object({
|
|
959
|
+
data: z.array(ExternalAgentApiSelectSchema),
|
|
960
|
+
pagination: PaginationSchema
|
|
961
|
+
}).openapi("ExternalAgentListResponse");
|
|
962
|
+
var ContextConfigListResponse = z.object({
|
|
963
|
+
data: z.array(ContextConfigApiSelectSchema),
|
|
964
|
+
pagination: PaginationSchema
|
|
965
|
+
}).openapi("ContextConfigListResponse");
|
|
966
|
+
var ApiKeyListResponse = z.object({
|
|
967
|
+
data: z.array(ApiKeyApiSelectSchema),
|
|
968
|
+
pagination: PaginationSchema
|
|
969
|
+
}).openapi("ApiKeyListResponse");
|
|
970
|
+
var CredentialReferenceListResponse = z.object({
|
|
971
|
+
data: z.array(CredentialReferenceApiSelectSchema),
|
|
972
|
+
pagination: PaginationSchema
|
|
973
|
+
}).openapi("CredentialReferenceListResponse");
|
|
974
|
+
var FunctionListResponse = z.object({
|
|
975
|
+
data: z.array(FunctionApiSelectSchema),
|
|
976
|
+
pagination: PaginationSchema
|
|
977
|
+
}).openapi("FunctionListResponse");
|
|
978
|
+
var FunctionToolListResponse = z.object({
|
|
979
|
+
data: z.array(FunctionToolApiSelectSchema),
|
|
980
|
+
pagination: PaginationSchema
|
|
981
|
+
}).openapi("FunctionToolListResponse");
|
|
982
|
+
var DataComponentListResponse = z.object({
|
|
983
|
+
data: z.array(DataComponentApiSelectSchema),
|
|
984
|
+
pagination: PaginationSchema
|
|
985
|
+
}).openapi("DataComponentListResponse");
|
|
986
|
+
var ArtifactComponentListResponse = z.object({
|
|
987
|
+
data: z.array(ArtifactComponentApiSelectSchema),
|
|
988
|
+
pagination: PaginationSchema
|
|
989
|
+
}).openapi("ArtifactComponentListResponse");
|
|
990
|
+
var SubAgentRelationListResponse = z.object({
|
|
991
|
+
data: z.array(SubAgentRelationApiSelectSchema),
|
|
992
|
+
pagination: PaginationSchema
|
|
993
|
+
}).openapi("SubAgentRelationListResponse");
|
|
994
|
+
var SubAgentToolRelationListResponse = z.object({
|
|
995
|
+
data: z.array(SubAgentToolRelationApiSelectSchema),
|
|
996
|
+
pagination: PaginationSchema
|
|
997
|
+
}).openapi("SubAgentToolRelationListResponse");
|
|
998
|
+
var ConversationListResponse = z.object({
|
|
999
|
+
data: z.array(ConversationApiSelectSchema),
|
|
1000
|
+
pagination: PaginationSchema
|
|
1001
|
+
}).openapi("ConversationListResponse");
|
|
1002
|
+
var MessageListResponse = z.object({
|
|
1003
|
+
data: z.array(MessageApiSelectSchema),
|
|
1004
|
+
pagination: PaginationSchema
|
|
1005
|
+
}).openapi("MessageListResponse");
|
|
1006
|
+
var SubAgentDataComponentResponse = z.object({ data: SubAgentDataComponentApiSelectSchema }).openapi("SubAgentDataComponentResponse");
|
|
1007
|
+
var SubAgentArtifactComponentResponse = z.object({ data: SubAgentArtifactComponentApiSelectSchema }).openapi("SubAgentArtifactComponentResponse");
|
|
1008
|
+
var SubAgentDataComponentListResponse = z.object({
|
|
1009
|
+
data: z.array(SubAgentDataComponentApiSelectSchema),
|
|
1010
|
+
pagination: PaginationSchema
|
|
1011
|
+
}).openapi("SubAgentDataComponentListResponse");
|
|
1012
|
+
var SubAgentArtifactComponentListResponse = z.object({
|
|
1013
|
+
data: z.array(SubAgentArtifactComponentApiSelectSchema),
|
|
1014
|
+
pagination: PaginationSchema
|
|
1015
|
+
}).openapi("SubAgentArtifactComponentListResponse");
|
|
1016
|
+
var FullProjectDefinitionResponse = z.object({ data: FullProjectDefinitionSchema }).openapi("FullProjectDefinitionResponse");
|
|
1017
|
+
var AgentWithinContextOfProjectResponse = z.object({ data: AgentWithinContextOfProjectSchema }).openapi("AgentWithinContextOfProjectResponse");
|
|
1018
|
+
var RelatedAgentInfoListResponse = z.object({
|
|
1019
|
+
data: z.array(RelatedAgentInfoSchema),
|
|
1020
|
+
pagination: PaginationSchema
|
|
1021
|
+
}).openapi("RelatedAgentInfoListResponse");
|
|
1022
|
+
var ComponentAssociationListResponse = z.object({ data: z.array(ComponentAssociationSchema) }).openapi("ComponentAssociationListResponse");
|
|
1023
|
+
var McpToolResponse = z.object({ data: McpToolSchema }).openapi("McpToolResponse");
|
|
1024
|
+
var McpToolListResponse = z.object({
|
|
1025
|
+
data: z.array(McpToolSchema),
|
|
1026
|
+
pagination: PaginationSchema
|
|
1027
|
+
}).openapi("McpToolListResponse");
|
|
1028
|
+
var SubAgentTeamAgentRelationResponse = z.object({ data: SubAgentTeamAgentRelationApiSelectSchema }).openapi("SubAgentTeamAgentRelationResponse");
|
|
1029
|
+
var SubAgentTeamAgentRelationListResponse = z.object({
|
|
1030
|
+
data: z.array(SubAgentTeamAgentRelationApiSelectSchema),
|
|
1031
|
+
pagination: PaginationSchema
|
|
1032
|
+
}).openapi("SubAgentTeamAgentRelationListResponse");
|
|
1033
|
+
var SubAgentExternalAgentRelationResponse = z.object({ data: SubAgentExternalAgentRelationApiSelectSchema }).openapi("SubAgentExternalAgentRelationResponse");
|
|
1034
|
+
var SubAgentExternalAgentRelationListResponse = z.object({
|
|
1035
|
+
data: z.array(SubAgentExternalAgentRelationApiSelectSchema),
|
|
1036
|
+
pagination: PaginationSchema
|
|
1037
|
+
}).openapi("SubAgentExternalAgentRelationListResponse");
|
|
1038
|
+
var DataComponentArrayResponse = z.object({ data: z.array(DataComponentApiSelectSchema) }).openapi("DataComponentArrayResponse");
|
|
1039
|
+
var ArtifactComponentArrayResponse = z.object({ data: z.array(ArtifactComponentApiSelectSchema) }).openapi("ArtifactComponentArrayResponse");
|
|
1040
|
+
var HeadersScopeSchema = z.object({
|
|
1041
|
+
"x-inkeep-tenant-id": z.string().optional().openapi({
|
|
1042
|
+
description: "Tenant identifier",
|
|
1043
|
+
example: "tenant_123"
|
|
1044
|
+
}),
|
|
1045
|
+
"x-inkeep-project-id": z.string().optional().openapi({
|
|
1046
|
+
description: "Project identifier",
|
|
1047
|
+
example: "project_456"
|
|
1048
|
+
}),
|
|
1049
|
+
"x-inkeep-agent-id": z.string().optional().openapi({
|
|
1050
|
+
description: "Agent identifier",
|
|
1051
|
+
example: "agent_789"
|
|
1052
|
+
})
|
|
1053
|
+
});
|
|
1054
|
+
var TenantId = z.string().openapi("TenantIdPathParam", {
|
|
1055
|
+
param: {
|
|
1056
|
+
name: "tenantId",
|
|
1057
|
+
in: "path"
|
|
1058
|
+
},
|
|
1059
|
+
description: "Tenant identifier",
|
|
1060
|
+
example: "tenant_123"
|
|
1061
|
+
});
|
|
1062
|
+
var ProjectId = z.string().openapi("ProjectIdPathParam", {
|
|
1063
|
+
param: {
|
|
1064
|
+
name: "projectId",
|
|
1065
|
+
in: "path"
|
|
1066
|
+
},
|
|
1067
|
+
description: "Project identifier",
|
|
1068
|
+
example: "project_456"
|
|
1069
|
+
});
|
|
1070
|
+
var AgentId = z.string().openapi("AgentIdPathParam", {
|
|
1071
|
+
param: {
|
|
1072
|
+
name: "agentId",
|
|
1073
|
+
in: "path"
|
|
1074
|
+
},
|
|
1075
|
+
description: "Agent identifier",
|
|
1076
|
+
example: "agent_789"
|
|
1077
|
+
});
|
|
1078
|
+
var SubAgentId = z.string().openapi("SubAgentIdPathParam", {
|
|
1079
|
+
param: {
|
|
1080
|
+
name: "subAgentId",
|
|
1081
|
+
in: "path"
|
|
1082
|
+
},
|
|
1083
|
+
description: "Sub-agent identifier",
|
|
1084
|
+
example: "sub_agent_123"
|
|
1085
|
+
});
|
|
1086
|
+
var TenantParamsSchema = z.object({
|
|
1087
|
+
tenantId: TenantId
|
|
1088
|
+
});
|
|
1089
|
+
var TenantIdParamsSchema = TenantParamsSchema.extend({
|
|
1090
|
+
id: resourceIdSchema
|
|
1091
|
+
});
|
|
1092
|
+
var TenantProjectParamsSchema = TenantParamsSchema.extend({
|
|
1093
|
+
projectId: ProjectId
|
|
1094
|
+
});
|
|
1095
|
+
var TenantProjectIdParamsSchema = TenantProjectParamsSchema.extend({
|
|
1096
|
+
id: resourceIdSchema
|
|
1097
|
+
});
|
|
1098
|
+
var TenantProjectAgentParamsSchema = TenantProjectParamsSchema.extend({
|
|
1099
|
+
agentId: AgentId
|
|
1100
|
+
});
|
|
1101
|
+
var TenantProjectAgentIdParamsSchema = TenantProjectAgentParamsSchema.extend({
|
|
1102
|
+
id: resourceIdSchema
|
|
1103
|
+
});
|
|
1104
|
+
var TenantProjectAgentSubAgentParamsSchema = TenantProjectAgentParamsSchema.extend({
|
|
1105
|
+
subAgentId: SubAgentId
|
|
1106
|
+
});
|
|
1107
|
+
var TenantProjectAgentSubAgentIdParamsSchema = TenantProjectAgentSubAgentParamsSchema.extend({
|
|
1108
|
+
id: resourceIdSchema
|
|
1109
|
+
});
|
|
1110
|
+
var PaginationQueryParamsSchema = z.object({
|
|
1111
|
+
page: pageNumber,
|
|
1112
|
+
limit: limitNumber
|
|
1113
|
+
}).openapi("PaginationQueryParams");
|
|
1114
|
+
var PrebuiltMCPServerSchema = z.object({
|
|
1115
|
+
id: z.string().describe("Unique identifier for the MCP server"),
|
|
1116
|
+
name: z.string().describe("Display name of the MCP server"),
|
|
1117
|
+
url: z.url().describe("URL endpoint for the MCP server"),
|
|
1118
|
+
transport: z.enum(MCPTransportType).describe("Transport protocol type"),
|
|
1119
|
+
imageUrl: z.url().optional().describe("Logo/icon URL for the MCP server"),
|
|
1120
|
+
isOpen: z.boolean().optional().describe("Whether the MCP server is open (doesn't require authentication)"),
|
|
1121
|
+
category: z.string().optional().describe("Category of the MCP server (e.g., communication, project_management)"),
|
|
1122
|
+
description: z.string().optional().describe("Brief description of what the MCP server does"),
|
|
1123
|
+
thirdPartyConnectAccountUrl: z.url().optional().describe("URL to connect to the third party account")
|
|
1124
|
+
});
|
|
1125
|
+
var MCPCatalogListResponse = z.object({
|
|
1126
|
+
data: z.array(PrebuiltMCPServerSchema)
|
|
1127
|
+
}).openapi("MCPCatalogListResponse");
|
|
1128
|
+
var ThirdPartyMCPServerResponse = z.object({
|
|
1129
|
+
data: PrebuiltMCPServerSchema.nullable()
|
|
1130
|
+
}).openapi("ThirdPartyMCPServerResponse");
|
|
1131
|
+
function validatePropsAsJsonSchema(props) {
|
|
1132
|
+
if (!props || typeof props === "object" && Object.keys(props).length === 0) {
|
|
1133
|
+
return {
|
|
1134
|
+
isValid: true,
|
|
1135
|
+
errors: []
|
|
1136
|
+
};
|
|
1137
|
+
}
|
|
1138
|
+
if (typeof props !== "object" || Array.isArray(props)) {
|
|
1139
|
+
return {
|
|
1140
|
+
isValid: false,
|
|
1141
|
+
errors: [
|
|
1142
|
+
{
|
|
1143
|
+
field: "props",
|
|
1144
|
+
message: "Props must be a valid JSON Schema object",
|
|
1145
|
+
value: props
|
|
1146
|
+
}
|
|
1147
|
+
]
|
|
1148
|
+
};
|
|
1149
|
+
}
|
|
1150
|
+
if (!props.type) {
|
|
1151
|
+
return {
|
|
1152
|
+
isValid: false,
|
|
1153
|
+
errors: [
|
|
1154
|
+
{
|
|
1155
|
+
field: "props.type",
|
|
1156
|
+
message: 'JSON Schema must have a "type" field'
|
|
1157
|
+
}
|
|
1158
|
+
]
|
|
1159
|
+
};
|
|
1160
|
+
}
|
|
1161
|
+
if (props.type !== "object") {
|
|
1162
|
+
return {
|
|
1163
|
+
isValid: false,
|
|
1164
|
+
errors: [
|
|
1165
|
+
{
|
|
1166
|
+
field: "props.type",
|
|
1167
|
+
message: 'JSON Schema type must be "object" for component props',
|
|
1168
|
+
value: props.type
|
|
1169
|
+
}
|
|
1170
|
+
]
|
|
1171
|
+
};
|
|
1172
|
+
}
|
|
1173
|
+
if (!props.properties || typeof props.properties !== "object") {
|
|
1174
|
+
return {
|
|
1175
|
+
isValid: false,
|
|
1176
|
+
errors: [
|
|
1177
|
+
{
|
|
1178
|
+
field: "props.properties",
|
|
1179
|
+
message: 'JSON Schema must have a "properties" object'
|
|
1180
|
+
}
|
|
1181
|
+
]
|
|
1182
|
+
};
|
|
1183
|
+
}
|
|
1184
|
+
if (props.required !== void 0 && !Array.isArray(props.required)) {
|
|
1185
|
+
return {
|
|
1186
|
+
isValid: false,
|
|
1187
|
+
errors: [
|
|
1188
|
+
{
|
|
1189
|
+
field: "props.required",
|
|
1190
|
+
message: 'If present, "required" must be an array'
|
|
1191
|
+
}
|
|
1192
|
+
]
|
|
1193
|
+
};
|
|
1194
|
+
}
|
|
1195
|
+
try {
|
|
1196
|
+
const schemaToValidate = { ...props };
|
|
1197
|
+
delete schemaToValidate.$schema;
|
|
1198
|
+
const schemaValidator = new Ajv({
|
|
1199
|
+
strict: false,
|
|
1200
|
+
// Allow unknown keywords like inPreview
|
|
1201
|
+
validateSchema: true,
|
|
1202
|
+
// Validate the schema itself
|
|
1203
|
+
addUsedSchema: false
|
|
1204
|
+
// Don't add schemas to the instance
|
|
1205
|
+
});
|
|
1206
|
+
const isValid = schemaValidator.validateSchema(schemaToValidate);
|
|
1207
|
+
if (!isValid) {
|
|
1208
|
+
const errors = schemaValidator.errors || [];
|
|
1209
|
+
return {
|
|
1210
|
+
isValid: false,
|
|
1211
|
+
errors: errors.map((error) => ({
|
|
1212
|
+
field: `props${error.instancePath || ""}`,
|
|
1213
|
+
message: error.message || "Invalid schema"
|
|
1214
|
+
}))
|
|
1215
|
+
};
|
|
1216
|
+
}
|
|
1217
|
+
return {
|
|
1218
|
+
isValid: true,
|
|
1219
|
+
errors: []
|
|
1220
|
+
};
|
|
1221
|
+
} catch (error) {
|
|
1222
|
+
return {
|
|
1223
|
+
isValid: false,
|
|
1224
|
+
errors: [
|
|
1225
|
+
{
|
|
1226
|
+
field: "props",
|
|
1227
|
+
message: `Schema validation failed: ${error instanceof Error ? error.message : "Unknown error"}`
|
|
1228
|
+
}
|
|
1229
|
+
]
|
|
1230
|
+
};
|
|
1231
|
+
}
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1234
|
+
export { AgentApiInsertSchema, AgentApiSelectSchema, AgentApiUpdateSchema, AgentInsertSchema, AgentListResponse, AgentResponse, AgentSelectSchema, AgentStopWhenSchema, AgentUpdateSchema, AgentWithinContextOfProjectResponse, AgentWithinContextOfProjectSchema, AllAgentSchema, ApiKeyApiCreationResponseSchema, ApiKeyApiInsertSchema, ApiKeyApiSelectSchema, ApiKeyApiUpdateSchema, ApiKeyInsertSchema, ApiKeyListResponse, ApiKeyResponse, ApiKeySelectSchema, ApiKeyUpdateSchema, ArtifactComponentApiInsertSchema, ArtifactComponentApiSelectSchema, ArtifactComponentApiUpdateSchema, ArtifactComponentArrayResponse, ArtifactComponentInsertSchema, ArtifactComponentListResponse, ArtifactComponentResponse, ArtifactComponentSelectSchema, ArtifactComponentUpdateSchema, CanUseItemSchema, ComponentAssociationListResponse, ComponentAssociationSchema, ContextCacheApiInsertSchema, ContextCacheApiSelectSchema, ContextCacheApiUpdateSchema, ContextCacheInsertSchema, ContextCacheSelectSchema, ContextCacheUpdateSchema, ContextConfigApiInsertSchema, ContextConfigApiSelectSchema, ContextConfigApiUpdateSchema, ContextConfigInsertSchema, ContextConfigListResponse, ContextConfigResponse, ContextConfigSelectSchema, ContextConfigUpdateSchema, ConversationApiInsertSchema, ConversationApiSelectSchema, ConversationApiUpdateSchema, ConversationInsertSchema, ConversationListResponse, ConversationResponse, ConversationSelectSchema, ConversationUpdateSchema, CreateCredentialInStoreRequestSchema, CreateCredentialInStoreResponseSchema, CredentialReferenceApiInsertSchema, CredentialReferenceApiSelectSchema, CredentialReferenceApiUpdateSchema, CredentialReferenceInsertSchema, CredentialReferenceListResponse, CredentialReferenceResponse, CredentialReferenceSelectSchema, CredentialReferenceUpdateSchema, CredentialStoreListResponseSchema, CredentialStoreSchema, DataComponentApiInsertSchema, DataComponentApiSelectSchema, DataComponentApiUpdateSchema, DataComponentArrayResponse, DataComponentBaseSchema, DataComponentInsertSchema, DataComponentListResponse, DataComponentResponse, DataComponentSelectSchema, DataComponentUpdateSchema, ErrorResponseSchema, ExistsResponseSchema, ExternalAgentApiInsertSchema, ExternalAgentApiSelectSchema, ExternalAgentApiUpdateSchema, ExternalAgentInsertSchema, ExternalAgentListResponse, ExternalAgentResponse, ExternalAgentSelectSchema, ExternalAgentUpdateSchema, ExternalSubAgentRelationApiInsertSchema, ExternalSubAgentRelationInsertSchema, FetchConfigSchema, FetchDefinitionSchema, FullAgentAgentInsertSchema, FullProjectDefinitionResponse, FullProjectDefinitionSchema, FunctionApiInsertSchema, FunctionApiSelectSchema, FunctionApiUpdateSchema, FunctionInsertSchema, FunctionListResponse, FunctionResponse, FunctionSelectSchema, FunctionToolApiInsertSchema, FunctionToolApiSelectSchema, FunctionToolApiUpdateSchema, FunctionToolConfigSchema, FunctionToolInsertSchema, FunctionToolListResponse, FunctionToolResponse, FunctionToolSelectSchema, FunctionToolUpdateSchema, FunctionUpdateSchema, HeadersScopeSchema, LedgerArtifactApiInsertSchema, LedgerArtifactApiSelectSchema, LedgerArtifactApiUpdateSchema, LedgerArtifactInsertSchema, LedgerArtifactSelectSchema, LedgerArtifactUpdateSchema, ListResponseSchema, MAX_ID_LENGTH, MCPCatalogListResponse, MCPToolConfigSchema, MIN_ID_LENGTH, McpToolDefinitionSchema, McpToolListResponse, McpToolResponse, McpToolSchema, McpTransportConfigSchema, MessageApiInsertSchema, MessageApiSelectSchema, MessageApiUpdateSchema, MessageInsertSchema, MessageListResponse, MessageResponse, MessageSelectSchema, MessageUpdateSchema, ModelSchema, ModelSettingsSchema, OAuthCallbackQuerySchema, OAuthLoginQuerySchema, PaginationQueryParamsSchema, PaginationSchema, PrebuiltMCPServerSchema, ProjectApiInsertSchema, ProjectApiSelectSchema, ProjectApiUpdateSchema, ProjectInsertSchema, ProjectListResponse, ProjectModelSchema, ProjectResponse, ProjectSelectSchema, ProjectUpdateSchema, RelatedAgentInfoListResponse, RelatedAgentInfoSchema, RemovedResponseSchema, SingleResponseSchema, StatusComponentSchema, StatusUpdateSchema, StopWhenSchema, SubAgentApiInsertSchema, SubAgentApiSelectSchema, SubAgentApiUpdateSchema, SubAgentArtifactComponentApiInsertSchema, SubAgentArtifactComponentApiSelectSchema, SubAgentArtifactComponentApiUpdateSchema, SubAgentArtifactComponentInsertSchema, SubAgentArtifactComponentListResponse, SubAgentArtifactComponentResponse, SubAgentArtifactComponentSelectSchema, SubAgentArtifactComponentUpdateSchema, SubAgentDataComponentApiInsertSchema, SubAgentDataComponentApiSelectSchema, SubAgentDataComponentApiUpdateSchema, SubAgentDataComponentInsertSchema, SubAgentDataComponentListResponse, SubAgentDataComponentResponse, SubAgentDataComponentSelectSchema, SubAgentDataComponentUpdateSchema, SubAgentExternalAgentRelationApiInsertSchema, SubAgentExternalAgentRelationApiSelectSchema, SubAgentExternalAgentRelationApiUpdateSchema, SubAgentExternalAgentRelationInsertSchema, SubAgentExternalAgentRelationListResponse, SubAgentExternalAgentRelationResponse, SubAgentExternalAgentRelationSelectSchema, SubAgentExternalAgentRelationUpdateSchema, SubAgentInsertSchema, SubAgentListResponse, SubAgentRelationApiInsertSchema, SubAgentRelationApiSelectSchema, SubAgentRelationApiUpdateSchema, SubAgentRelationInsertSchema, SubAgentRelationListResponse, SubAgentRelationQuerySchema, SubAgentRelationResponse, SubAgentRelationSelectSchema, SubAgentRelationUpdateSchema, SubAgentResponse, SubAgentSelectSchema, SubAgentStopWhenSchema, SubAgentTeamAgentRelationApiInsertSchema, SubAgentTeamAgentRelationApiSelectSchema, SubAgentTeamAgentRelationApiUpdateSchema, SubAgentTeamAgentRelationInsertSchema, SubAgentTeamAgentRelationListResponse, SubAgentTeamAgentRelationResponse, SubAgentTeamAgentRelationSelectSchema, SubAgentTeamAgentRelationUpdateSchema, SubAgentToolRelationApiInsertSchema, SubAgentToolRelationApiSelectSchema, SubAgentToolRelationApiUpdateSchema, SubAgentToolRelationInsertSchema, SubAgentToolRelationListResponse, SubAgentToolRelationResponse, SubAgentToolRelationSelectSchema, SubAgentToolRelationUpdateSchema, SubAgentUpdateSchema, TaskApiInsertSchema, TaskApiSelectSchema, TaskApiUpdateSchema, TaskInsertSchema, TaskRelationApiInsertSchema, TaskRelationApiSelectSchema, TaskRelationApiUpdateSchema, TaskRelationInsertSchema, TaskRelationSelectSchema, TaskRelationUpdateSchema, TaskSelectSchema, TaskUpdateSchema, TeamAgentSchema, TenantIdParamsSchema, TenantParamsSchema, TenantProjectAgentIdParamsSchema, TenantProjectAgentParamsSchema, TenantProjectAgentSubAgentIdParamsSchema, TenantProjectAgentSubAgentParamsSchema, TenantProjectIdParamsSchema, TenantProjectParamsSchema, ThirdPartyMCPServerResponse, ToolApiInsertSchema, ToolApiSelectSchema, ToolApiUpdateSchema, ToolInsertSchema, ToolListResponse, ToolResponse, ToolSelectSchema, ToolStatusSchema, ToolUpdateSchema, URL_SAFE_ID_PATTERN, canDelegateToExternalAgentSchema, canDelegateToTeamAgentSchema, resourceIdSchema, schemaValidationDefaults, validatePropsAsJsonSchema };
|