@inkeep/agents-core 0.18.1 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/{chunk-E4SFK6AI.js → chunk-3GZBRBXP.js} +84 -87
- package/dist/{chunk-JTHQYGCX.js → chunk-3XUV5Q4D.js} +34 -34
- package/dist/{chunk-ID4CFGVF.js → chunk-B6F3RF4T.js} +87 -120
- package/dist/chunk-E6R6PML7.js +19 -0
- package/dist/chunk-HYS7HUYJ.js +27 -0
- package/dist/{chunk-H6PMWHNV.js → chunk-SLL6V3AE.js} +12 -12
- package/dist/{chunk-R2EERZSW.js → chunk-YECQCT5N.js} +1 -1
- package/dist/client-exports.cjs +189 -225
- package/dist/client-exports.d.cts +13 -14
- package/dist/client-exports.d.ts +13 -14
- package/dist/client-exports.js +10 -10
- package/dist/constants/models.cjs +31 -0
- package/dist/constants/models.d.cts +33 -0
- package/dist/constants/models.d.ts +33 -0
- package/dist/constants/models.js +1 -0
- package/dist/db/schema.cjs +85 -118
- package/dist/db/schema.d.cts +2 -3
- package/dist/db/schema.d.ts +2 -3
- package/dist/db/schema.js +1 -1
- package/dist/index.cjs +213931 -1040
- package/dist/index.d.cts +209 -208
- package/dist/index.d.ts +209 -208
- package/dist/index.js +213657 -767
- package/dist/{schema-ULFEZCOL.d.cts → schema-Dp-qgdBT.d.ts} +54 -52
- package/dist/{schema-wbZXiVWb.d.ts → schema-DrDaCn6H.d.cts} +54 -52
- package/dist/{signoz-queries-BuiipZTk.d.cts → signoz-queries-CuWMQh1H.d.cts} +10 -10
- package/dist/{signoz-queries-BuiipZTk.d.ts → signoz-queries-CuWMQh1H.d.ts} +10 -10
- package/dist/types/index.d.cts +2 -3
- package/dist/types/index.d.ts +2 -3
- package/dist/{utility-CyPQ1tC_.d.cts → utility-BxbySenH.d.cts} +152 -301
- package/dist/{utility-CyPQ1tC_.d.ts → utility-BxbySenH.d.ts} +152 -301
- package/dist/utils/schema-conversion.js +1 -1
- package/dist/validation/index.cjs +212 -249
- package/dist/validation/index.d.cts +12 -13
- package/dist/validation/index.d.ts +12 -13
- package/dist/validation/index.js +2 -2
- package/drizzle/0007_mighty_typhoid_mary.sql +227 -0
- package/drizzle/meta/0007_snapshot.json +2766 -0
- package/drizzle/meta/_journal.json +7 -0
- package/package.json +6 -1
- package/dist/chunk-MKBO26DX.js +0 -9
package/README.md
CHANGED
|
@@ -245,10 +245,10 @@ Define any relationships with existing tables:
|
|
|
245
245
|
|
|
246
246
|
```typescript
|
|
247
247
|
export const workflowRelations = relations(workflows, ({ one, many }) => ({
|
|
248
|
-
// Example: A workflow belongs to an agent
|
|
249
|
-
|
|
250
|
-
fields: [workflows.
|
|
251
|
-
references: [
|
|
248
|
+
// Example: A workflow belongs to an agent
|
|
249
|
+
agent: one(agents, {
|
|
250
|
+
fields: [workflows.agentId],
|
|
251
|
+
references: [agents.id],
|
|
252
252
|
}),
|
|
253
253
|
// Example: A workflow can have many tasks
|
|
254
254
|
tasks: many(tasks),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { subAgents, subAgentRelations,
|
|
1
|
+
import { subAgents, subAgentRelations, agents, tasks, taskRelations, tools, conversations, messages, contextCache, dataComponents, subAgentDataComponents, artifactComponents, subAgentArtifactComponents, externalAgents, apiKeys, credentialReferences, functionTools, functions, contextConfigs, subAgentToolRelations, ledgerArtifacts, projects } from './chunk-B6F3RF4T.js';
|
|
2
2
|
import { VALID_RELATION_TYPES, MCPTransportType, TOOL_STATUS_VALUES, CredentialStoreType, MCPServerType } from './chunk-YFHT5M2R.js';
|
|
3
3
|
import { z } from '@hono/zod-openapi';
|
|
4
4
|
import { createSelectSchema, createInsertSchema } from 'drizzle-zod';
|
|
@@ -8,7 +8,7 @@ var StopWhenSchema = z.object({
|
|
|
8
8
|
transferCountIs: z.number().min(1).max(100).optional(),
|
|
9
9
|
stepCountIs: z.number().min(1).max(1e3).optional()
|
|
10
10
|
});
|
|
11
|
-
var
|
|
11
|
+
var AgentStopWhenSchema = StopWhenSchema.pick({ transferCountIs: true });
|
|
12
12
|
var SubAgentStopWhenSchema = StopWhenSchema.pick({ stepCountIs: true });
|
|
13
13
|
var MIN_ID_LENGTH = 1;
|
|
14
14
|
var MAX_ID_LENGTH = 255;
|
|
@@ -49,31 +49,31 @@ var FunctionToolConfigSchema = z.object({
|
|
|
49
49
|
var createApiSchema = (schema) => schema.omit({ tenantId: true, projectId: true });
|
|
50
50
|
var createApiInsertSchema = (schema) => schema.omit({ tenantId: true, projectId: true });
|
|
51
51
|
var createApiUpdateSchema = (schema) => schema.omit({ tenantId: true, projectId: true }).partial();
|
|
52
|
-
var
|
|
53
|
-
var
|
|
54
|
-
var
|
|
52
|
+
var createAgentScopedApiSchema = (schema) => schema.omit({ tenantId: true, projectId: true, agentId: true });
|
|
53
|
+
var createAgentScopedApiInsertSchema = (schema) => schema.omit({ tenantId: true, projectId: true, agentId: true });
|
|
54
|
+
var createAgentScopedApiUpdateSchema = (schema) => schema.omit({ tenantId: true, projectId: true, agentId: true }).partial();
|
|
55
55
|
var SubAgentSelectSchema = createSelectSchema(subAgents);
|
|
56
56
|
var SubAgentInsertSchema = createInsertSchema(subAgents).extend({
|
|
57
57
|
id: resourceIdSchema,
|
|
58
58
|
models: ModelSchema.optional()
|
|
59
59
|
});
|
|
60
60
|
var SubAgentUpdateSchema = SubAgentInsertSchema.partial();
|
|
61
|
-
var SubAgentApiSelectSchema =
|
|
62
|
-
var SubAgentApiInsertSchema =
|
|
63
|
-
var SubAgentApiUpdateSchema =
|
|
61
|
+
var SubAgentApiSelectSchema = createAgentScopedApiSchema(SubAgentSelectSchema);
|
|
62
|
+
var SubAgentApiInsertSchema = createAgentScopedApiInsertSchema(SubAgentInsertSchema);
|
|
63
|
+
var SubAgentApiUpdateSchema = createAgentScopedApiUpdateSchema(SubAgentUpdateSchema);
|
|
64
64
|
var SubAgentRelationSelectSchema = createSelectSchema(subAgentRelations);
|
|
65
65
|
var SubAgentRelationInsertSchema = createInsertSchema(subAgentRelations).extend({
|
|
66
66
|
id: resourceIdSchema,
|
|
67
|
-
|
|
67
|
+
agentId: resourceIdSchema,
|
|
68
68
|
sourceSubAgentId: resourceIdSchema,
|
|
69
69
|
targetSubAgentId: resourceIdSchema.optional(),
|
|
70
70
|
externalSubAgentId: resourceIdSchema.optional()
|
|
71
71
|
});
|
|
72
72
|
var SubAgentRelationUpdateSchema = SubAgentRelationInsertSchema.partial();
|
|
73
|
-
var SubAgentRelationApiSelectSchema =
|
|
73
|
+
var SubAgentRelationApiSelectSchema = createAgentScopedApiSchema(
|
|
74
74
|
SubAgentRelationSelectSchema
|
|
75
75
|
);
|
|
76
|
-
var SubAgentRelationApiInsertSchema =
|
|
76
|
+
var SubAgentRelationApiInsertSchema = createAgentScopedApiInsertSchema(
|
|
77
77
|
SubAgentRelationInsertSchema
|
|
78
78
|
).extend({
|
|
79
79
|
relationType: z.enum(VALID_RELATION_TYPES)
|
|
@@ -88,7 +88,7 @@ var SubAgentRelationApiInsertSchema = createGraphScopedApiInsertSchema(
|
|
|
88
88
|
path: ["targetSubAgentId", "externalSubAgentId"]
|
|
89
89
|
}
|
|
90
90
|
);
|
|
91
|
-
var SubAgentRelationApiUpdateSchema =
|
|
91
|
+
var SubAgentRelationApiUpdateSchema = createAgentScopedApiUpdateSchema(
|
|
92
92
|
SubAgentRelationUpdateSchema
|
|
93
93
|
).extend({
|
|
94
94
|
relationType: z.enum(VALID_RELATION_TYPES).optional()
|
|
@@ -113,23 +113,23 @@ var SubAgentRelationQuerySchema = z.object({
|
|
|
113
113
|
});
|
|
114
114
|
var ExternalSubAgentRelationInsertSchema = createInsertSchema(subAgentRelations).extend({
|
|
115
115
|
id: resourceIdSchema,
|
|
116
|
-
|
|
116
|
+
agentId: resourceIdSchema,
|
|
117
117
|
sourceSubAgentId: resourceIdSchema,
|
|
118
118
|
externalSubAgentId: resourceIdSchema
|
|
119
119
|
});
|
|
120
120
|
var ExternalSubAgentRelationApiInsertSchema = createApiInsertSchema(
|
|
121
121
|
ExternalSubAgentRelationInsertSchema
|
|
122
122
|
);
|
|
123
|
-
var
|
|
124
|
-
var
|
|
123
|
+
var AgentSelectSchema = createSelectSchema(agents);
|
|
124
|
+
var AgentInsertSchema = createInsertSchema(agents).extend({
|
|
125
125
|
id: resourceIdSchema
|
|
126
126
|
});
|
|
127
|
-
var
|
|
128
|
-
var
|
|
129
|
-
var
|
|
127
|
+
var AgentUpdateSchema = AgentInsertSchema.partial();
|
|
128
|
+
var AgentApiSelectSchema = createApiSchema(AgentSelectSchema);
|
|
129
|
+
var AgentApiInsertSchema = createApiInsertSchema(AgentInsertSchema).extend({
|
|
130
130
|
id: resourceIdSchema
|
|
131
131
|
});
|
|
132
|
-
var
|
|
132
|
+
var AgentApiUpdateSchema = createApiUpdateSchema(AgentUpdateSchema);
|
|
133
133
|
var TaskSelectSchema = createSelectSchema(tasks);
|
|
134
134
|
var TaskInsertSchema = createInsertSchema(tasks).extend({
|
|
135
135
|
id: resourceIdSchema,
|
|
@@ -172,7 +172,10 @@ var McpTransportConfigSchema = z.object({
|
|
|
172
172
|
type: z.enum(MCPTransportType),
|
|
173
173
|
requestInit: z.record(z.string(), z.unknown()).optional(),
|
|
174
174
|
eventSourceInit: z.record(z.string(), z.unknown()).optional(),
|
|
175
|
-
reconnectionOptions: z.
|
|
175
|
+
reconnectionOptions: z.any().optional().openapi({
|
|
176
|
+
type: "object",
|
|
177
|
+
description: "Reconnection options for streamable HTTP transport"
|
|
178
|
+
}),
|
|
176
179
|
sessionId: z.string().optional()
|
|
177
180
|
});
|
|
178
181
|
var ToolStatusSchema = z.enum(TOOL_STATUS_VALUES);
|
|
@@ -189,13 +192,16 @@ var ToolInsertSchema = createInsertSchema(tools).extend({
|
|
|
189
192
|
type: z.literal("mcp"),
|
|
190
193
|
mcp: z.object({
|
|
191
194
|
server: z.object({
|
|
192
|
-
url: z.
|
|
195
|
+
url: z.url()
|
|
193
196
|
}),
|
|
194
197
|
transport: z.object({
|
|
195
198
|
type: z.enum(MCPTransportType),
|
|
196
199
|
requestInit: z.record(z.string(), z.unknown()).optional(),
|
|
197
200
|
eventSourceInit: z.record(z.string(), z.unknown()).optional(),
|
|
198
|
-
reconnectionOptions: z.
|
|
201
|
+
reconnectionOptions: z.any().optional().openapi({
|
|
202
|
+
type: "object",
|
|
203
|
+
description: "Reconnection options for streamable HTTP transport"
|
|
204
|
+
}),
|
|
199
205
|
sessionId: z.string().optional()
|
|
200
206
|
}).optional(),
|
|
201
207
|
activeTools: z.array(z.string()).optional()
|
|
@@ -242,7 +248,7 @@ var DataComponentApiUpdateSchema = createApiUpdateSchema(DataComponentUpdateSche
|
|
|
242
248
|
var SubAgentDataComponentSelectSchema = createSelectSchema(subAgentDataComponents);
|
|
243
249
|
var SubAgentDataComponentInsertSchema = createInsertSchema(subAgentDataComponents);
|
|
244
250
|
var SubAgentDataComponentUpdateSchema = SubAgentDataComponentInsertSchema.partial();
|
|
245
|
-
var SubAgentDataComponentApiSelectSchema =
|
|
251
|
+
var SubAgentDataComponentApiSelectSchema = createAgentScopedApiSchema(
|
|
246
252
|
SubAgentDataComponentSelectSchema
|
|
247
253
|
);
|
|
248
254
|
var SubAgentDataComponentApiInsertSchema = SubAgentDataComponentInsertSchema.omit({
|
|
@@ -251,7 +257,7 @@ var SubAgentDataComponentApiInsertSchema = SubAgentDataComponentInsertSchema.omi
|
|
|
251
257
|
id: true,
|
|
252
258
|
createdAt: true
|
|
253
259
|
});
|
|
254
|
-
var SubAgentDataComponentApiUpdateSchema =
|
|
260
|
+
var SubAgentDataComponentApiUpdateSchema = createAgentScopedApiUpdateSchema(
|
|
255
261
|
SubAgentDataComponentUpdateSchema
|
|
256
262
|
);
|
|
257
263
|
var ArtifactComponentSelectSchema = createSelectSchema(artifactComponents);
|
|
@@ -278,7 +284,7 @@ var SubAgentArtifactComponentInsertSchema = createInsertSchema(
|
|
|
278
284
|
artifactComponentId: resourceIdSchema
|
|
279
285
|
});
|
|
280
286
|
var SubAgentArtifactComponentUpdateSchema = SubAgentArtifactComponentInsertSchema.partial();
|
|
281
|
-
var SubAgentArtifactComponentApiSelectSchema =
|
|
287
|
+
var SubAgentArtifactComponentApiSelectSchema = createAgentScopedApiSchema(
|
|
282
288
|
SubAgentArtifactComponentSelectSchema
|
|
283
289
|
);
|
|
284
290
|
var SubAgentArtifactComponentApiInsertSchema = SubAgentArtifactComponentInsertSchema.omit({
|
|
@@ -287,7 +293,7 @@ var SubAgentArtifactComponentApiInsertSchema = SubAgentArtifactComponentInsertSc
|
|
|
287
293
|
id: true,
|
|
288
294
|
createdAt: true
|
|
289
295
|
});
|
|
290
|
-
var SubAgentArtifactComponentApiUpdateSchema =
|
|
296
|
+
var SubAgentArtifactComponentApiUpdateSchema = createAgentScopedApiUpdateSchema(
|
|
291
297
|
SubAgentArtifactComponentUpdateSchema
|
|
292
298
|
);
|
|
293
299
|
var ExternalAgentSelectSchema = createSelectSchema(externalAgents).extend({
|
|
@@ -298,9 +304,9 @@ var ExternalAgentInsertSchema = createInsertSchema(externalAgents).extend({
|
|
|
298
304
|
id: resourceIdSchema
|
|
299
305
|
});
|
|
300
306
|
var ExternalAgentUpdateSchema = ExternalAgentInsertSchema.partial();
|
|
301
|
-
var ExternalAgentApiSelectSchema =
|
|
302
|
-
var ExternalAgentApiInsertSchema =
|
|
303
|
-
var ExternalAgentApiUpdateSchema =
|
|
307
|
+
var ExternalAgentApiSelectSchema = createAgentScopedApiSchema(ExternalAgentSelectSchema);
|
|
308
|
+
var ExternalAgentApiInsertSchema = createAgentScopedApiInsertSchema(ExternalAgentInsertSchema);
|
|
309
|
+
var ExternalAgentApiUpdateSchema = createAgentScopedApiUpdateSchema(ExternalAgentUpdateSchema);
|
|
304
310
|
var AllAgentSchema = z.discriminatedUnion("type", [
|
|
305
311
|
SubAgentApiSelectSchema.extend({ type: z.literal("internal") }),
|
|
306
312
|
ExternalAgentApiSelectSchema.extend({ type: z.literal("external") })
|
|
@@ -308,7 +314,7 @@ var AllAgentSchema = z.discriminatedUnion("type", [
|
|
|
308
314
|
var ApiKeySelectSchema = createSelectSchema(apiKeys);
|
|
309
315
|
var ApiKeyInsertSchema = createInsertSchema(apiKeys).extend({
|
|
310
316
|
id: resourceIdSchema,
|
|
311
|
-
|
|
317
|
+
agentId: resourceIdSchema
|
|
312
318
|
});
|
|
313
319
|
var ApiKeyUpdateSchema = ApiKeyInsertSchema.partial().omit({
|
|
314
320
|
tenantId: true,
|
|
@@ -416,7 +422,7 @@ var FunctionToolInsertSchema = createInsertSchema(functionTools).extend({
|
|
|
416
422
|
});
|
|
417
423
|
var FunctionToolUpdateSchema = FunctionToolInsertSchema.partial();
|
|
418
424
|
var FunctionToolApiSelectSchema = createApiSchema(FunctionToolSelectSchema);
|
|
419
|
-
var FunctionToolApiInsertSchema =
|
|
425
|
+
var FunctionToolApiInsertSchema = createAgentScopedApiInsertSchema(FunctionToolInsertSchema);
|
|
420
426
|
var FunctionToolApiUpdateSchema = createApiUpdateSchema(FunctionToolUpdateSchema);
|
|
421
427
|
var FunctionSelectSchema = createSelectSchema(functions);
|
|
422
428
|
var FunctionInsertSchema = createInsertSchema(functions).extend({
|
|
@@ -442,28 +448,40 @@ var FetchDefinitionSchema = z.object({
|
|
|
442
448
|
fetchConfig: FetchConfigSchema,
|
|
443
449
|
responseSchema: z.any().optional(),
|
|
444
450
|
// JSON Schema for validating HTTP response
|
|
445
|
-
defaultValue: z.
|
|
451
|
+
defaultValue: z.any().optional().openapi({
|
|
452
|
+
description: "Default value if fetch fails"
|
|
453
|
+
}),
|
|
446
454
|
credential: CredentialReferenceApiInsertSchema.optional()
|
|
447
455
|
});
|
|
448
456
|
var ContextConfigSelectSchema = createSelectSchema(contextConfigs).extend({
|
|
449
|
-
headersSchema: z.
|
|
457
|
+
headersSchema: z.any().optional().openapi({
|
|
458
|
+
type: "object",
|
|
459
|
+
description: "JSON Schema for validating request headers"
|
|
460
|
+
})
|
|
450
461
|
});
|
|
451
462
|
var ContextConfigInsertSchema = createInsertSchema(contextConfigs).extend({
|
|
452
463
|
id: resourceIdSchema.optional(),
|
|
453
|
-
headersSchema: z.
|
|
464
|
+
headersSchema: z.any().nullable().optional().openapi({
|
|
465
|
+
type: "object",
|
|
466
|
+
description: "JSON Schema for validating request headers"
|
|
467
|
+
}),
|
|
468
|
+
contextVariables: z.any().nullable().optional().openapi({
|
|
469
|
+
type: "object",
|
|
470
|
+
description: "Context variables configuration with fetch definitions"
|
|
471
|
+
})
|
|
454
472
|
}).omit({
|
|
455
473
|
createdAt: true,
|
|
456
474
|
updatedAt: true
|
|
457
475
|
});
|
|
458
476
|
var ContextConfigUpdateSchema = ContextConfigInsertSchema.partial();
|
|
459
477
|
var ContextConfigApiSelectSchema = createApiSchema(ContextConfigSelectSchema).omit({
|
|
460
|
-
|
|
478
|
+
agentId: true
|
|
461
479
|
});
|
|
462
480
|
var ContextConfigApiInsertSchema = createApiInsertSchema(ContextConfigInsertSchema).omit({
|
|
463
|
-
|
|
481
|
+
agentId: true
|
|
464
482
|
});
|
|
465
483
|
var ContextConfigApiUpdateSchema = createApiUpdateSchema(ContextConfigUpdateSchema).omit({
|
|
466
|
-
|
|
484
|
+
agentId: true
|
|
467
485
|
});
|
|
468
486
|
var SubAgentToolRelationSelectSchema = createSelectSchema(subAgentToolRelations);
|
|
469
487
|
var SubAgentToolRelationInsertSchema = createInsertSchema(subAgentToolRelations).extend({
|
|
@@ -474,13 +492,13 @@ var SubAgentToolRelationInsertSchema = createInsertSchema(subAgentToolRelations)
|
|
|
474
492
|
headers: z.record(z.string(), z.string()).nullish()
|
|
475
493
|
});
|
|
476
494
|
var SubAgentToolRelationUpdateSchema = SubAgentToolRelationInsertSchema.partial();
|
|
477
|
-
var SubAgentToolRelationApiSelectSchema =
|
|
495
|
+
var SubAgentToolRelationApiSelectSchema = createAgentScopedApiSchema(
|
|
478
496
|
SubAgentToolRelationSelectSchema
|
|
479
497
|
);
|
|
480
|
-
var SubAgentToolRelationApiInsertSchema =
|
|
498
|
+
var SubAgentToolRelationApiInsertSchema = createAgentScopedApiInsertSchema(
|
|
481
499
|
SubAgentToolRelationInsertSchema
|
|
482
500
|
);
|
|
483
|
-
var SubAgentToolRelationApiUpdateSchema =
|
|
501
|
+
var SubAgentToolRelationApiUpdateSchema = createAgentScopedApiUpdateSchema(
|
|
484
502
|
SubAgentToolRelationUpdateSchema
|
|
485
503
|
);
|
|
486
504
|
var LedgerArtifactSelectSchema = createSelectSchema(ledgerArtifacts);
|
|
@@ -511,7 +529,7 @@ var CanUseItemSchema = z.object({
|
|
|
511
529
|
toolSelection: z.array(z.string()).nullish(),
|
|
512
530
|
headers: z.record(z.string(), z.string()).nullish()
|
|
513
531
|
});
|
|
514
|
-
var
|
|
532
|
+
var FullAgentAgentInsertSchema = SubAgentApiInsertSchema.extend({
|
|
515
533
|
type: z.literal("internal"),
|
|
516
534
|
canUse: z.array(CanUseItemSchema),
|
|
517
535
|
// All tools (both MCP and function tools)
|
|
@@ -520,44 +538,23 @@ var FullGraphAgentInsertSchema = SubAgentApiInsertSchema.extend({
|
|
|
520
538
|
canTransferTo: z.array(z.string()).optional(),
|
|
521
539
|
canDelegateTo: z.array(z.string()).optional()
|
|
522
540
|
});
|
|
523
|
-
var
|
|
524
|
-
subAgents: z.record(
|
|
525
|
-
z.string(),
|
|
526
|
-
z.union([FullGraphAgentInsertSchema, ExternalAgentApiInsertSchema])
|
|
527
|
-
),
|
|
528
|
-
// Lookup maps for UI to resolve canUse items
|
|
529
|
-
tools: z.record(z.string(), ToolApiInsertSchema).optional(),
|
|
530
|
-
// MCP tools (project-scoped)
|
|
531
|
-
functionTools: z.record(z.string(), FunctionToolApiInsertSchema).optional(),
|
|
532
|
-
// Function tools (graph-scoped)
|
|
533
|
-
functions: z.record(z.string(), FunctionApiInsertSchema).optional(),
|
|
534
|
-
// Get function code for function tools
|
|
535
|
-
contextConfig: z.optional(ContextConfigApiInsertSchema),
|
|
536
|
-
statusUpdates: z.optional(StatusUpdateSchema),
|
|
537
|
-
models: ModelSchema.optional(),
|
|
538
|
-
stopWhen: GraphStopWhenSchema.optional(),
|
|
539
|
-
graphPrompt: z.string().max(5e3, "Graph prompt cannot exceed 5000 characters").optional()
|
|
540
|
-
});
|
|
541
|
-
var GraphWithinContextOfProjectSchema = AgentGraphApiInsertSchema.extend({
|
|
541
|
+
var AgentWithinContextOfProjectSchema = AgentApiInsertSchema.extend({
|
|
542
542
|
subAgents: z.record(
|
|
543
543
|
z.string(),
|
|
544
|
-
z.
|
|
545
|
-
FullGraphAgentInsertSchema,
|
|
546
|
-
ExternalAgentApiInsertSchema.extend({ type: z.literal("external") })
|
|
547
|
-
])
|
|
544
|
+
z.union([FullAgentAgentInsertSchema, ExternalAgentApiInsertSchema])
|
|
548
545
|
),
|
|
549
546
|
// Lookup maps for UI to resolve canUse items
|
|
550
547
|
tools: z.record(z.string(), ToolApiInsertSchema).optional(),
|
|
551
548
|
// MCP tools (project-scoped)
|
|
552
549
|
functionTools: z.record(z.string(), FunctionToolApiInsertSchema).optional(),
|
|
553
|
-
// Function tools (
|
|
550
|
+
// Function tools (agent-scoped)
|
|
554
551
|
functions: z.record(z.string(), FunctionApiInsertSchema).optional(),
|
|
555
552
|
// Get function code for function tools
|
|
556
553
|
contextConfig: z.optional(ContextConfigApiInsertSchema),
|
|
557
554
|
statusUpdates: z.optional(StatusUpdateSchema),
|
|
558
555
|
models: ModelSchema.optional(),
|
|
559
|
-
stopWhen:
|
|
560
|
-
|
|
556
|
+
stopWhen: AgentStopWhenSchema.optional(),
|
|
557
|
+
prompt: z.string().max(5e3, "Agent prompt cannot exceed 5000 characters").optional()
|
|
561
558
|
});
|
|
562
559
|
var PaginationSchema = z.object({
|
|
563
560
|
page: z.coerce.number().min(1).default(1),
|
|
@@ -575,7 +572,9 @@ var SingleResponseSchema = (itemSchema) => z.object({
|
|
|
575
572
|
var ErrorResponseSchema = z.object({
|
|
576
573
|
error: z.string(),
|
|
577
574
|
message: z.string().optional(),
|
|
578
|
-
details: z.
|
|
575
|
+
details: z.any().optional().openapi({
|
|
576
|
+
description: "Additional error details"
|
|
577
|
+
})
|
|
579
578
|
});
|
|
580
579
|
var ExistsResponseSchema = z.object({
|
|
581
580
|
exists: z.boolean()
|
|
@@ -598,11 +597,9 @@ var ProjectApiSelectSchema = ProjectSelectSchema.omit({ tenantId: true });
|
|
|
598
597
|
var ProjectApiInsertSchema = ProjectInsertSchema.omit({ tenantId: true });
|
|
599
598
|
var ProjectApiUpdateSchema = ProjectUpdateSchema.omit({ tenantId: true });
|
|
600
599
|
var FullProjectDefinitionSchema = ProjectApiInsertSchema.extend({
|
|
601
|
-
|
|
600
|
+
agents: z.record(z.string(), AgentWithinContextOfProjectSchema),
|
|
602
601
|
tools: z.record(z.string(), ToolApiInsertSchema),
|
|
603
|
-
// MCP tools (project-scoped)
|
|
604
602
|
functions: z.record(z.string(), FunctionApiInsertSchema).optional(),
|
|
605
|
-
// Functions (project-scoped)
|
|
606
603
|
dataComponents: z.record(z.string(), DataComponentApiInsertSchema).optional(),
|
|
607
604
|
artifactComponents: z.record(z.string(), ArtifactComponentApiInsertSchema).optional(),
|
|
608
605
|
statusUpdates: z.optional(StatusUpdateSchema),
|
|
@@ -619,9 +616,9 @@ var HeadersScopeSchema = z.object({
|
|
|
619
616
|
description: "Project identifier",
|
|
620
617
|
example: "project_456"
|
|
621
618
|
}),
|
|
622
|
-
"x-inkeep-
|
|
623
|
-
description: "
|
|
624
|
-
example: "
|
|
619
|
+
"x-inkeep-agent-id": z.string().optional().openapi({
|
|
620
|
+
description: "Agent identifier",
|
|
621
|
+
example: "agent_789"
|
|
625
622
|
})
|
|
626
623
|
});
|
|
627
624
|
var TenantId = z.string().openapi({
|
|
@@ -632,9 +629,9 @@ var ProjectId = z.string().openapi({
|
|
|
632
629
|
description: "Project identifier",
|
|
633
630
|
example: "project_456"
|
|
634
631
|
});
|
|
635
|
-
var
|
|
636
|
-
description: "
|
|
637
|
-
example: "
|
|
632
|
+
var AgentId = z.string().openapi({
|
|
633
|
+
description: "Agent identifier",
|
|
634
|
+
example: "agent_789"
|
|
638
635
|
});
|
|
639
636
|
var SubAgentId = z.string().openapi({
|
|
640
637
|
description: "Sub-agent identifier",
|
|
@@ -652,18 +649,18 @@ var TenantProjectParamsSchema = TenantParamsSchema.extend({
|
|
|
652
649
|
var TenantProjectIdParamsSchema = TenantProjectParamsSchema.extend({
|
|
653
650
|
id: resourceIdSchema
|
|
654
651
|
}).openapi("TenantProjectIdParams");
|
|
655
|
-
var
|
|
656
|
-
|
|
657
|
-
}).openapi("
|
|
658
|
-
var
|
|
652
|
+
var TenantProjectAgentParamsSchema = TenantProjectParamsSchema.extend({
|
|
653
|
+
agentId: AgentId
|
|
654
|
+
}).openapi("TenantProjectAgentParams");
|
|
655
|
+
var TenantProjectAgentIdParamsSchema = TenantProjectAgentParamsSchema.extend({
|
|
659
656
|
id: resourceIdSchema
|
|
660
|
-
}).openapi("
|
|
661
|
-
var
|
|
657
|
+
}).openapi("TenantProjectAgentIdParams");
|
|
658
|
+
var TenantProjectAgentSubAgentParamsSchema = TenantProjectAgentParamsSchema.extend({
|
|
662
659
|
subAgentId: SubAgentId
|
|
663
|
-
}).openapi("
|
|
664
|
-
var
|
|
660
|
+
}).openapi("TenantProjectAgentSubAgentParams");
|
|
661
|
+
var TenantProjectAgentSubAgentIdParamsSchema = TenantProjectAgentSubAgentParamsSchema.extend({
|
|
665
662
|
id: resourceIdSchema
|
|
666
|
-
}).openapi("
|
|
663
|
+
}).openapi("TenantProjectAgentSubAgentIdParams");
|
|
667
664
|
var PaginationQueryParamsSchema = z.object({
|
|
668
665
|
page: z.coerce.number().min(1).default(1),
|
|
669
666
|
limit: z.coerce.number().min(1).max(100).default(10)
|
|
@@ -771,4 +768,4 @@ function validatePropsAsJsonSchema(props) {
|
|
|
771
768
|
}
|
|
772
769
|
}
|
|
773
770
|
|
|
774
|
-
export {
|
|
771
|
+
export { AgentApiInsertSchema, AgentApiSelectSchema, AgentApiUpdateSchema, AgentInsertSchema, AgentSelectSchema, AgentStopWhenSchema, AgentUpdateSchema, AgentWithinContextOfProjectSchema, AllAgentSchema, ApiKeyApiCreationResponseSchema, ApiKeyApiInsertSchema, ApiKeyApiSelectSchema, ApiKeyApiUpdateSchema, ApiKeyInsertSchema, ApiKeySelectSchema, ApiKeyUpdateSchema, ArtifactComponentApiInsertSchema, ArtifactComponentApiSelectSchema, ArtifactComponentApiUpdateSchema, ArtifactComponentInsertSchema, ArtifactComponentSelectSchema, ArtifactComponentUpdateSchema, CanUseItemSchema, ContextCacheApiInsertSchema, ContextCacheApiSelectSchema, ContextCacheApiUpdateSchema, ContextCacheInsertSchema, ContextCacheSelectSchema, ContextCacheUpdateSchema, ContextConfigApiInsertSchema, ContextConfigApiSelectSchema, ContextConfigApiUpdateSchema, ContextConfigInsertSchema, ContextConfigSelectSchema, ContextConfigUpdateSchema, ConversationApiInsertSchema, ConversationApiSelectSchema, ConversationApiUpdateSchema, ConversationInsertSchema, ConversationSelectSchema, ConversationUpdateSchema, CredentialReferenceApiInsertSchema, CredentialReferenceApiSelectSchema, CredentialReferenceApiUpdateSchema, CredentialReferenceInsertSchema, CredentialReferenceSelectSchema, CredentialReferenceUpdateSchema, DataComponentApiInsertSchema, DataComponentApiSelectSchema, DataComponentApiUpdateSchema, DataComponentBaseSchema, DataComponentInsertSchema, DataComponentSelectSchema, DataComponentUpdateSchema, ErrorResponseSchema, ExistsResponseSchema, ExternalAgentApiInsertSchema, ExternalAgentApiSelectSchema, ExternalAgentApiUpdateSchema, ExternalAgentInsertSchema, ExternalAgentSelectSchema, ExternalAgentUpdateSchema, ExternalSubAgentRelationApiInsertSchema, ExternalSubAgentRelationInsertSchema, FetchConfigSchema, FetchDefinitionSchema, FullAgentAgentInsertSchema, FullProjectDefinitionSchema, FunctionApiInsertSchema, FunctionApiSelectSchema, FunctionApiUpdateSchema, FunctionInsertSchema, FunctionSelectSchema, FunctionToolApiInsertSchema, FunctionToolApiSelectSchema, FunctionToolApiUpdateSchema, FunctionToolConfigSchema, FunctionToolInsertSchema, FunctionToolSelectSchema, FunctionToolUpdateSchema, FunctionUpdateSchema, HeadersScopeSchema, LedgerArtifactApiInsertSchema, LedgerArtifactApiSelectSchema, LedgerArtifactApiUpdateSchema, LedgerArtifactInsertSchema, LedgerArtifactSelectSchema, LedgerArtifactUpdateSchema, ListResponseSchema, MAX_ID_LENGTH, MCPToolConfigSchema, MIN_ID_LENGTH, McpToolDefinitionSchema, McpToolSchema, McpTransportConfigSchema, MessageApiInsertSchema, MessageApiSelectSchema, MessageApiUpdateSchema, MessageInsertSchema, MessageSelectSchema, MessageUpdateSchema, ModelSchema, ModelSettingsSchema, PaginationQueryParamsSchema, PaginationSchema, ProjectApiInsertSchema, ProjectApiSelectSchema, ProjectApiUpdateSchema, ProjectInsertSchema, ProjectModelSchema, ProjectSelectSchema, ProjectUpdateSchema, RemovedResponseSchema, SandboxConfigSchema, SingleResponseSchema, StatusComponentSchema, StatusUpdateSchema, StopWhenSchema, SubAgentApiInsertSchema, SubAgentApiSelectSchema, SubAgentApiUpdateSchema, SubAgentArtifactComponentApiInsertSchema, SubAgentArtifactComponentApiSelectSchema, SubAgentArtifactComponentApiUpdateSchema, SubAgentArtifactComponentInsertSchema, SubAgentArtifactComponentSelectSchema, SubAgentArtifactComponentUpdateSchema, SubAgentDataComponentApiInsertSchema, SubAgentDataComponentApiSelectSchema, SubAgentDataComponentApiUpdateSchema, SubAgentDataComponentInsertSchema, SubAgentDataComponentSelectSchema, SubAgentDataComponentUpdateSchema, SubAgentInsertSchema, SubAgentRelationApiInsertSchema, SubAgentRelationApiSelectSchema, SubAgentRelationApiUpdateSchema, SubAgentRelationInsertSchema, SubAgentRelationQuerySchema, SubAgentRelationSelectSchema, SubAgentRelationUpdateSchema, SubAgentSelectSchema, SubAgentStopWhenSchema, SubAgentToolRelationApiInsertSchema, SubAgentToolRelationApiSelectSchema, SubAgentToolRelationApiUpdateSchema, SubAgentToolRelationInsertSchema, SubAgentToolRelationSelectSchema, SubAgentToolRelationUpdateSchema, SubAgentUpdateSchema, TaskApiInsertSchema, TaskApiSelectSchema, TaskApiUpdateSchema, TaskInsertSchema, TaskRelationApiInsertSchema, TaskRelationApiSelectSchema, TaskRelationApiUpdateSchema, TaskRelationInsertSchema, TaskRelationSelectSchema, TaskRelationUpdateSchema, TaskSelectSchema, TaskUpdateSchema, TenantIdParamsSchema, TenantParamsSchema, TenantProjectAgentIdParamsSchema, TenantProjectAgentParamsSchema, TenantProjectAgentSubAgentIdParamsSchema, TenantProjectAgentSubAgentParamsSchema, TenantProjectIdParamsSchema, TenantProjectParamsSchema, ToolApiInsertSchema, ToolApiSelectSchema, ToolApiUpdateSchema, ToolInsertSchema, ToolSelectSchema, ToolStatusSchema, ToolUpdateSchema, URL_SAFE_ID_PATTERN, resourceIdSchema, validatePropsAsJsonSchema };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AgentWithinContextOfProjectSchema, resourceIdSchema, MAX_ID_LENGTH } from './chunk-3GZBRBXP.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
|
|
4
4
|
var TransferDataSchema = z.object({
|
|
@@ -39,24 +39,24 @@ var A2AMessageMetadataSchema = z.object({
|
|
|
39
39
|
a2aTaskId: z.string().optional().describe("A2A-specific task ID")
|
|
40
40
|
});
|
|
41
41
|
|
|
42
|
-
// src/validation/
|
|
42
|
+
// src/validation/agentFull.ts
|
|
43
43
|
function isInternalAgent(agent) {
|
|
44
44
|
return "prompt" in agent;
|
|
45
45
|
}
|
|
46
46
|
function isExternalAgent(agent) {
|
|
47
47
|
return "baseUrl" in agent;
|
|
48
48
|
}
|
|
49
|
-
function
|
|
50
|
-
return
|
|
49
|
+
function validateAndTypeAgentData(data) {
|
|
50
|
+
return AgentWithinContextOfProjectSchema.parse(data);
|
|
51
51
|
}
|
|
52
|
-
function validateToolReferences(
|
|
52
|
+
function validateToolReferences(agentData, availableToolIds) {
|
|
53
53
|
if (!availableToolIds) {
|
|
54
54
|
return;
|
|
55
55
|
}
|
|
56
56
|
const errors = [];
|
|
57
|
-
for (const [subAgentId,
|
|
58
|
-
if (isInternalAgent(
|
|
59
|
-
for (const canUseItem of
|
|
57
|
+
for (const [subAgentId, subAgent] of Object.entries(agentData.subAgents)) {
|
|
58
|
+
if (isInternalAgent(subAgent) && subAgent.canUse && Array.isArray(subAgent.canUse)) {
|
|
59
|
+
for (const canUseItem of subAgent.canUse) {
|
|
60
60
|
if (!availableToolIds.has(canUseItem.toolId)) {
|
|
61
61
|
errors.push(`Agent '${subAgentId}' references non-existent tool '${canUseItem.toolId}'`);
|
|
62
62
|
}
|
|
@@ -68,14 +68,14 @@ function validateToolReferences(graphData, availableToolIds) {
|
|
|
68
68
|
${errors.join("\n")}`);
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
-
function validateDataComponentReferences(
|
|
71
|
+
function validateDataComponentReferences(agentData, availableDataComponentIds) {
|
|
72
72
|
if (!availableDataComponentIds) {
|
|
73
73
|
return;
|
|
74
74
|
}
|
|
75
75
|
const errors = [];
|
|
76
|
-
for (const [subAgentId,
|
|
77
|
-
if (isInternalAgent(
|
|
78
|
-
for (const dataComponentId of
|
|
76
|
+
for (const [subAgentId, subAgent] of Object.entries(agentData.subAgents)) {
|
|
77
|
+
if (isInternalAgent(subAgent) && subAgent.dataComponents) {
|
|
78
|
+
for (const dataComponentId of subAgent.dataComponents) {
|
|
79
79
|
if (!availableDataComponentIds.has(dataComponentId)) {
|
|
80
80
|
errors.push(
|
|
81
81
|
`Agent '${subAgentId}' references non-existent dataComponent '${dataComponentId}'`
|
|
@@ -89,14 +89,14 @@ function validateDataComponentReferences(graphData, availableDataComponentIds) {
|
|
|
89
89
|
${errors.join("\n")}`);
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
|
-
function validateArtifactComponentReferences(
|
|
92
|
+
function validateArtifactComponentReferences(agentData, availableArtifactComponentIds) {
|
|
93
93
|
if (!availableArtifactComponentIds) {
|
|
94
94
|
return;
|
|
95
95
|
}
|
|
96
96
|
const errors = [];
|
|
97
|
-
for (const [subAgentId,
|
|
98
|
-
if (isInternalAgent(
|
|
99
|
-
for (const artifactComponentId of
|
|
97
|
+
for (const [subAgentId, subAgent] of Object.entries(agentData.subAgents)) {
|
|
98
|
+
if (isInternalAgent(subAgent) && subAgent.artifactComponents) {
|
|
99
|
+
for (const artifactComponentId of subAgent.artifactComponents) {
|
|
100
100
|
if (!availableArtifactComponentIds.has(artifactComponentId)) {
|
|
101
101
|
errors.push(
|
|
102
102
|
`Agent '${subAgentId}' references non-existent artifactComponent '${artifactComponentId}'`
|
|
@@ -110,25 +110,25 @@ function validateArtifactComponentReferences(graphData, availableArtifactCompone
|
|
|
110
110
|
${errors.join("\n")}`);
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
|
-
function validateAgentRelationships(
|
|
113
|
+
function validateAgentRelationships(agentData) {
|
|
114
114
|
const errors = [];
|
|
115
|
-
const availableAgentIds = new Set(Object.keys(
|
|
116
|
-
for (const [subAgentId,
|
|
117
|
-
if (isInternalAgent(
|
|
118
|
-
if (
|
|
119
|
-
for (const targetId of
|
|
115
|
+
const availableAgentIds = new Set(Object.keys(agentData.subAgents));
|
|
116
|
+
for (const [subAgentId, subAgent] of Object.entries(agentData.subAgents)) {
|
|
117
|
+
if (isInternalAgent(subAgent)) {
|
|
118
|
+
if (subAgent.canTransferTo && Array.isArray(subAgent.canTransferTo)) {
|
|
119
|
+
for (const targetId of subAgent.canTransferTo) {
|
|
120
120
|
if (!availableAgentIds.has(targetId)) {
|
|
121
121
|
errors.push(
|
|
122
|
-
`Agent '${subAgentId}' has transfer target '${targetId}' that doesn't exist in
|
|
122
|
+
`Agent '${subAgentId}' has transfer target '${targetId}' that doesn't exist in agent`
|
|
123
123
|
);
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
|
-
if (
|
|
128
|
-
for (const targetId of
|
|
127
|
+
if (subAgent.canDelegateTo && Array.isArray(subAgent.canDelegateTo)) {
|
|
128
|
+
for (const targetId of subAgent.canDelegateTo) {
|
|
129
129
|
if (!availableAgentIds.has(targetId)) {
|
|
130
130
|
errors.push(
|
|
131
|
-
`Agent '${subAgentId}' has delegation target '${targetId}' that doesn't exist in
|
|
131
|
+
`Agent '${subAgentId}' has delegation target '${targetId}' that doesn't exist in agent`
|
|
132
132
|
);
|
|
133
133
|
}
|
|
134
134
|
}
|
|
@@ -140,16 +140,16 @@ function validateAgentRelationships(graphData) {
|
|
|
140
140
|
${errors.join("\n")}`);
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
|
-
function
|
|
144
|
-
if (
|
|
145
|
-
throw new Error(`Default agent '${
|
|
143
|
+
function validateAgentStructure(agentData, projectResources) {
|
|
144
|
+
if (agentData.defaultSubAgentId && !agentData.subAgents[agentData.defaultSubAgentId]) {
|
|
145
|
+
throw new Error(`Default agent '${agentData.defaultSubAgentId}' does not exist in agents`);
|
|
146
146
|
}
|
|
147
147
|
if (projectResources) {
|
|
148
|
-
validateToolReferences(
|
|
149
|
-
validateDataComponentReferences(
|
|
150
|
-
validateArtifactComponentReferences(
|
|
148
|
+
validateToolReferences(agentData, projectResources.toolIds);
|
|
149
|
+
validateDataComponentReferences(agentData, projectResources.dataComponentIds);
|
|
150
|
+
validateArtifactComponentReferences(agentData, projectResources.artifactComponentIds);
|
|
151
151
|
}
|
|
152
|
-
validateAgentRelationships(
|
|
152
|
+
validateAgentRelationships(agentData);
|
|
153
153
|
}
|
|
154
154
|
|
|
155
155
|
// src/validation/id-validation.ts
|
|
@@ -170,4 +170,4 @@ function generateIdFromName(name) {
|
|
|
170
170
|
return truncatedId;
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
-
export { A2AMessageMetadataSchema, DataOperationDetailsSchema, DataOperationEventSchema, DelegationReturnedDataSchema, DelegationSentDataSchema, TransferDataSchema, generateIdFromName, isExternalAgent, isInternalAgent, isValidResourceId, validateAgentRelationships,
|
|
173
|
+
export { A2AMessageMetadataSchema, DataOperationDetailsSchema, DataOperationEventSchema, DelegationReturnedDataSchema, DelegationSentDataSchema, TransferDataSchema, generateIdFromName, isExternalAgent, isInternalAgent, isValidResourceId, validateAgentRelationships, validateAgentStructure, validateAndTypeAgentData, validateArtifactComponentReferences, validateDataComponentReferences, validateToolReferences };
|