@inkeep/agents-core 0.1.4 → 0.1.6
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/SUPPLEMENTAL_TERMS.md +40 -0
- package/dist/chunk-H2F72PDA.js +15 -0
- package/dist/chunk-M4JXMAG7.js +822 -0
- package/dist/chunk-MKBO26DX.js +9 -0
- package/dist/chunk-RZPLS4MU.js +676 -0
- package/dist/chunk-SVGQSPW4.js +24 -0
- package/dist/client-exports.cjs +246 -0
- package/dist/client-exports.d.cts +315 -0
- package/dist/client-exports.d.ts +64 -49
- package/dist/client-exports.js +201 -246
- package/dist/db/schema.cjs +819 -0
- package/dist/db/schema.d.cts +8 -0
- package/dist/db/schema.d.ts +8 -4337
- package/dist/db/schema.js +1 -696
- package/dist/entities-CNJaf-rG.d.cts +7849 -0
- package/dist/entities-CNJaf-rG.d.ts +7849 -0
- package/dist/index.cjs +9647 -0
- package/dist/index.d.cts +3991 -0
- package/dist/index.d.ts +3991 -12
- package/dist/index.js +7646 -13
- package/dist/schema-DFDqtBpV.d.ts +4401 -0
- package/dist/schema-Dbc3UMpd.d.cts +4401 -0
- package/dist/types/index.cjs +45 -0
- package/dist/types/index.d.cts +125 -0
- package/dist/types/index.d.ts +125 -5
- package/dist/types/index.js +2 -6
- package/dist/validation/index.cjs +1642 -0
- package/dist/validation/index.d.cts +64 -0
- package/dist/validation/index.d.ts +64 -4
- package/dist/validation/index.js +1 -5
- package/package.json +6 -4
- package/dist/__tests__/integration/helpers.d.ts +0 -5
- package/dist/__tests__/integration/helpers.d.ts.map +0 -1
- package/dist/__tests__/integration/helpers.js +0 -37
- package/dist/__tests__/integration/helpers.js.map +0 -1
- package/dist/__tests__/setup.d.ts +0 -3
- package/dist/__tests__/setup.d.ts.map +0 -1
- package/dist/__tests__/setup.js +0 -29
- package/dist/__tests__/setup.js.map +0 -1
- package/dist/client-exports.d.ts.map +0 -1
- package/dist/client-exports.js.map +0 -1
- package/dist/context/ContextConfig.d.ts +0 -54
- package/dist/context/ContextConfig.d.ts.map +0 -1
- package/dist/context/ContextConfig.js +0 -302
- package/dist/context/ContextConfig.js.map +0 -1
- package/dist/context/ContextFetcher.d.ts +0 -64
- package/dist/context/ContextFetcher.d.ts.map +0 -1
- package/dist/context/ContextFetcher.js +0 -325
- package/dist/context/ContextFetcher.js.map +0 -1
- package/dist/context/ContextResolver.d.ts +0 -52
- package/dist/context/ContextResolver.d.ts.map +0 -1
- package/dist/context/ContextResolver.js +0 -298
- package/dist/context/ContextResolver.js.map +0 -1
- package/dist/context/TemplateEngine.d.ts +0 -46
- package/dist/context/TemplateEngine.d.ts.map +0 -1
- package/dist/context/TemplateEngine.js +0 -175
- package/dist/context/TemplateEngine.js.map +0 -1
- package/dist/context/context.d.ts +0 -8
- package/dist/context/context.d.ts.map +0 -1
- package/dist/context/context.js +0 -157
- package/dist/context/context.js.map +0 -1
- package/dist/context/contextCache.d.ts +0 -50
- package/dist/context/contextCache.d.ts.map +0 -1
- package/dist/context/contextCache.js +0 -175
- package/dist/context/contextCache.js.map +0 -1
- package/dist/context/index.d.ts +0 -11
- package/dist/context/index.d.ts.map +0 -1
- package/dist/context/index.js +0 -8
- package/dist/context/index.js.map +0 -1
- package/dist/credential-stores/CredentialStoreRegistry.d.ts +0 -39
- package/dist/credential-stores/CredentialStoreRegistry.d.ts.map +0 -1
- package/dist/credential-stores/CredentialStoreRegistry.js +0 -65
- package/dist/credential-stores/CredentialStoreRegistry.js.map +0 -1
- package/dist/credential-stores/defaults.d.ts +0 -6
- package/dist/credential-stores/defaults.d.ts.map +0 -1
- package/dist/credential-stores/defaults.js +0 -22
- package/dist/credential-stores/defaults.js.map +0 -1
- package/dist/credential-stores/index.d.ts +0 -6
- package/dist/credential-stores/index.d.ts.map +0 -1
- package/dist/credential-stores/index.js +0 -6
- package/dist/credential-stores/index.js.map +0 -1
- package/dist/credential-stores/keychain-store.d.ts +0 -100
- package/dist/credential-stores/keychain-store.d.ts.map +0 -1
- package/dist/credential-stores/keychain-store.js +0 -225
- package/dist/credential-stores/keychain-store.js.map +0 -1
- package/dist/credential-stores/memory-store.d.ts +0 -39
- package/dist/credential-stores/memory-store.d.ts.map +0 -1
- package/dist/credential-stores/memory-store.js +0 -58
- package/dist/credential-stores/memory-store.js.map +0 -1
- package/dist/credential-stores/nango-store.d.ts +0 -59
- package/dist/credential-stores/nango-store.d.ts.map +0 -1
- package/dist/credential-stores/nango-store.js +0 -264
- package/dist/credential-stores/nango-store.js.map +0 -1
- package/dist/credential-stuffer/CredentialStuffer.d.ts +0 -80
- package/dist/credential-stuffer/CredentialStuffer.d.ts.map +0 -1
- package/dist/credential-stuffer/CredentialStuffer.js +0 -186
- package/dist/credential-stuffer/CredentialStuffer.js.map +0 -1
- package/dist/credential-stuffer/index.d.ts +0 -2
- package/dist/credential-stuffer/index.d.ts.map +0 -1
- package/dist/credential-stuffer/index.js +0 -2
- package/dist/credential-stuffer/index.js.map +0 -1
- package/dist/data-access/agentDataComponents.d.ts +0 -1
- package/dist/data-access/agentDataComponents.d.ts.map +0 -1
- package/dist/data-access/agentDataComponents.js +0 -2
- package/dist/data-access/agentDataComponents.js.map +0 -1
- package/dist/data-access/agentGraphs.d.ts +0 -406
- package/dist/data-access/agentGraphs.d.ts.map +0 -1
- package/dist/data-access/agentGraphs.js +0 -551
- package/dist/data-access/agentGraphs.js.map +0 -1
- package/dist/data-access/agentRelations.d.ts +0 -456
- package/dist/data-access/agentRelations.d.ts.map +0 -1
- package/dist/data-access/agentRelations.js +0 -471
- package/dist/data-access/agentRelations.js.map +0 -1
- package/dist/data-access/agents.d.ts +0 -218
- package/dist/data-access/agents.d.ts.map +0 -1
- package/dist/data-access/agents.js +0 -130
- package/dist/data-access/agents.js.map +0 -1
- package/dist/data-access/apiKeys.d.ts +0 -114
- package/dist/data-access/apiKeys.d.ts.map +0 -1
- package/dist/data-access/apiKeys.js +0 -185
- package/dist/data-access/apiKeys.js.map +0 -1
- package/dist/data-access/artifactComponents.d.ts +0 -152
- package/dist/data-access/artifactComponents.d.ts.map +0 -1
- package/dist/data-access/artifactComponents.js +0 -214
- package/dist/data-access/artifactComponents.js.map +0 -1
- package/dist/data-access/contextCache.d.ts +0 -68
- package/dist/data-access/contextCache.d.ts.map +0 -1
- package/dist/data-access/contextCache.js +0 -160
- package/dist/data-access/contextCache.js.map +0 -1
- package/dist/data-access/contextConfigs.d.ts +0 -110
- package/dist/data-access/contextConfigs.d.ts.map +0 -1
- package/dist/data-access/contextConfigs.js +0 -156
- package/dist/data-access/contextConfigs.js.map +0 -1
- package/dist/data-access/conversations.d.ts +0 -125
- package/dist/data-access/conversations.d.ts.map +0 -1
- package/dist/data-access/conversations.js +0 -244
- package/dist/data-access/conversations.js.map +0 -1
- package/dist/data-access/credentialReferences.d.ts +0 -86
- package/dist/data-access/credentialReferences.d.ts.map +0 -1
- package/dist/data-access/credentialReferences.js +0 -175
- package/dist/data-access/credentialReferences.js.map +0 -1
- package/dist/data-access/dataComponents.d.ts +0 -129
- package/dist/data-access/dataComponents.d.ts.map +0 -1
- package/dist/data-access/dataComponents.js +0 -213
- package/dist/data-access/dataComponents.js.map +0 -1
- package/dist/data-access/externalAgents.d.ts +0 -83
- package/dist/data-access/externalAgents.d.ts.map +0 -1
- package/dist/data-access/externalAgents.js +0 -163
- package/dist/data-access/externalAgents.js.map +0 -1
- package/dist/data-access/graphFull.d.ts +0 -32
- package/dist/data-access/graphFull.d.ts.map +0 -1
- package/dist/data-access/graphFull.js +0 -996
- package/dist/data-access/graphFull.js.map +0 -1
- package/dist/data-access/index.d.ts +0 -21
- package/dist/data-access/index.d.ts.map +0 -1
- package/dist/data-access/index.js +0 -22
- package/dist/data-access/index.js.map +0 -1
- package/dist/data-access/ledgerArtifacts.d.ts +0 -49
- package/dist/data-access/ledgerArtifacts.d.ts.map +0 -1
- package/dist/data-access/ledgerArtifacts.js +0 -112
- package/dist/data-access/ledgerArtifacts.js.map +0 -1
- package/dist/data-access/messages.d.ts +0 -209
- package/dist/data-access/messages.d.ts.map +0 -1
- package/dist/data-access/messages.js +0 -100
- package/dist/data-access/messages.js.map +0 -1
- package/dist/data-access/projects.d.ts +0 -67
- package/dist/data-access/projects.d.ts.map +0 -1
- package/dist/data-access/projects.js +0 -337
- package/dist/data-access/projects.js.map +0 -1
- package/dist/data-access/tasks.d.ts +0 -37
- package/dist/data-access/tasks.d.ts.map +0 -1
- package/dist/data-access/tasks.js +0 -40
- package/dist/data-access/tasks.js.map +0 -1
- package/dist/data-access/tools.d.ts +0 -277
- package/dist/data-access/tools.d.ts.map +0 -1
- package/dist/data-access/tools.js +0 -183
- package/dist/data-access/tools.js.map +0 -1
- package/dist/data-access/validation.d.ts +0 -17
- package/dist/data-access/validation.d.ts.map +0 -1
- package/dist/data-access/validation.js +0 -52
- package/dist/data-access/validation.js.map +0 -1
- package/dist/db/clean.d.ts +0 -6
- package/dist/db/clean.d.ts.map +0 -1
- package/dist/db/clean.js +0 -81
- package/dist/db/clean.js.map +0 -1
- package/dist/db/client.d.ts +0 -19
- package/dist/db/client.d.ts.map +0 -1
- package/dist/db/client.js +0 -24
- package/dist/db/client.js.map +0 -1
- package/dist/db/schema.d.ts.map +0 -1
- package/dist/db/schema.js.map +0 -1
- package/dist/db/test-client.d.ts +0 -25
- package/dist/db/test-client.d.ts.map +0 -1
- package/dist/db/test-client.js +0 -136
- package/dist/db/test-client.js.map +0 -1
- package/dist/env.d.ts +0 -19
- package/dist/env.d.ts.map +0 -1
- package/dist/env.js +0 -49
- package/dist/env.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/middleware/contextValidation.d.ts +0 -49
- package/dist/middleware/contextValidation.d.ts.map +0 -1
- package/dist/middleware/contextValidation.js +0 -473
- package/dist/middleware/contextValidation.js.map +0 -1
- package/dist/middleware/index.d.ts +0 -2
- package/dist/middleware/index.d.ts.map +0 -1
- package/dist/middleware/index.js +0 -2
- package/dist/middleware/index.js.map +0 -1
- package/dist/server/BaseServer.d.ts +0 -83
- package/dist/server/BaseServer.d.ts.map +0 -1
- package/dist/server/BaseServer.js +0 -218
- package/dist/server/BaseServer.js.map +0 -1
- package/dist/types/a2a.d.ts +0 -373
- package/dist/types/a2a.d.ts.map +0 -1
- package/dist/types/a2a.js +0 -14
- package/dist/types/a2a.js.map +0 -1
- package/dist/types/entities.d.ts +0 -147
- package/dist/types/entities.d.ts.map +0 -1
- package/dist/types/entities.js +0 -2
- package/dist/types/entities.js.map +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js.map +0 -1
- package/dist/types/server.d.ts +0 -116
- package/dist/types/server.d.ts.map +0 -1
- package/dist/types/server.js +0 -2
- package/dist/types/server.js.map +0 -1
- package/dist/types/utility.d.ts +0 -213
- package/dist/types/utility.d.ts.map +0 -1
- package/dist/types/utility.js +0 -9
- package/dist/types/utility.js.map +0 -1
- package/dist/utils/apiKeys.d.ts +0 -32
- package/dist/utils/apiKeys.d.ts.map +0 -1
- package/dist/utils/apiKeys.js +0 -117
- package/dist/utils/apiKeys.js.map +0 -1
- package/dist/utils/auth-detection.d.ts +0 -23
- package/dist/utils/auth-detection.d.ts.map +0 -1
- package/dist/utils/auth-detection.js +0 -148
- package/dist/utils/auth-detection.js.map +0 -1
- package/dist/utils/credential-store-utils.d.ts +0 -11
- package/dist/utils/credential-store-utils.d.ts.map +0 -1
- package/dist/utils/credential-store-utils.js +0 -19
- package/dist/utils/credential-store-utils.js.map +0 -1
- package/dist/utils/error.d.ts +0 -526
- package/dist/utils/error.d.ts.map +0 -1
- package/dist/utils/error.js +0 -282
- package/dist/utils/error.js.map +0 -1
- package/dist/utils/execution.d.ts +0 -18
- package/dist/utils/execution.d.ts.map +0 -1
- package/dist/utils/execution.js +0 -25
- package/dist/utils/execution.js.map +0 -1
- package/dist/utils/index.d.ts +0 -9
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/index.js +0 -9
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/logger.d.ts +0 -79
- package/dist/utils/logger.d.ts.map +0 -1
- package/dist/utils/logger.js +0 -102
- package/dist/utils/logger.js.map +0 -1
- package/dist/utils/logging.d.ts +0 -11
- package/dist/utils/logging.d.ts.map +0 -1
- package/dist/utils/logging.js +0 -6
- package/dist/utils/logging.js.map +0 -1
- package/dist/utils/mcp-client.d.ts +0 -48
- package/dist/utils/mcp-client.d.ts.map +0 -1
- package/dist/utils/mcp-client.js +0 -174
- package/dist/utils/mcp-client.js.map +0 -1
- package/dist/utils/tracer.d.ts +0 -24
- package/dist/utils/tracer.d.ts.map +0 -1
- package/dist/utils/tracer.js +0 -110
- package/dist/utils/tracer.js.map +0 -1
- package/dist/validation/graphFull.d.ts +0 -36
- package/dist/validation/graphFull.d.ts.map +0 -1
- package/dist/validation/graphFull.js +0 -128
- package/dist/validation/graphFull.js.map +0 -1
- package/dist/validation/id-validation.d.ts +0 -38
- package/dist/validation/id-validation.d.ts.map +0 -1
- package/dist/validation/id-validation.js +0 -60
- package/dist/validation/id-validation.js.map +0 -1
- package/dist/validation/index.d.ts.map +0 -1
- package/dist/validation/index.js.map +0 -1
- package/dist/validation/schemas.d.ts +0 -7238
- package/dist/validation/schemas.d.ts.map +0 -1
- package/dist/validation/schemas.js +0 -575
- package/dist/validation/schemas.js.map +0 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __export = (target, all) => {
|
|
4
|
+
for (var name in all)
|
|
5
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
6
|
+
};
|
|
7
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
8
|
+
|
|
9
|
+
export { __export, __publicField };
|
|
@@ -0,0 +1,676 @@
|
|
|
1
|
+
import { VALID_RELATION_TYPES, MCPTransportType, TOOL_STATUS_VALUES, CredentialStoreType, MCPServerType } from './chunk-SVGQSPW4.js';
|
|
2
|
+
import { agents, agentRelations, agentGraph, tasks, taskRelations, tools, conversations, messages, contextCache, dataComponents, agentDataComponents, artifactComponents, agentArtifactComponents, externalAgents, apiKeys, contextConfigs, agentToolRelations, ledgerArtifacts, projects } from './chunk-M4JXMAG7.js';
|
|
3
|
+
import { z } from '@hono/zod-openapi';
|
|
4
|
+
import { createSelectSchema, createInsertSchema } from 'drizzle-zod';
|
|
5
|
+
|
|
6
|
+
var MIN_ID_LENGTH = 1;
|
|
7
|
+
var MAX_ID_LENGTH = 255;
|
|
8
|
+
var URL_SAFE_ID_PATTERN = /^[a-zA-Z0-9\-_.]+$/;
|
|
9
|
+
var resourceIdSchema = z.string().min(MIN_ID_LENGTH).max(MAX_ID_LENGTH).regex(URL_SAFE_ID_PATTERN, {
|
|
10
|
+
message: "ID must contain only letters, numbers, hyphens, underscores, and dots"
|
|
11
|
+
}).openapi({
|
|
12
|
+
description: "Resource identifier",
|
|
13
|
+
example: "resource_789"
|
|
14
|
+
});
|
|
15
|
+
var ModelSettingsSchema = z.object({
|
|
16
|
+
model: z.string().optional(),
|
|
17
|
+
providerOptions: z.record(z.string(), z.unknown()).optional()
|
|
18
|
+
});
|
|
19
|
+
var ModelSchema = z.object({
|
|
20
|
+
base: ModelSettingsSchema.optional(),
|
|
21
|
+
structuredOutput: ModelSettingsSchema.optional(),
|
|
22
|
+
summarizer: ModelSettingsSchema.optional()
|
|
23
|
+
});
|
|
24
|
+
var ProjectModelSchema = z.object({
|
|
25
|
+
base: ModelSettingsSchema,
|
|
26
|
+
structuredOutput: ModelSettingsSchema.optional(),
|
|
27
|
+
summarizer: ModelSettingsSchema.optional()
|
|
28
|
+
});
|
|
29
|
+
var createApiSchema = (schema) => schema.omit({ tenantId: true, projectId: true });
|
|
30
|
+
var createApiInsertSchema = (schema) => schema.omit({ tenantId: true, projectId: true });
|
|
31
|
+
var createApiUpdateSchema = (schema) => schema.omit({ tenantId: true, projectId: true }).partial();
|
|
32
|
+
var AgentSelectSchema = createSelectSchema(agents);
|
|
33
|
+
var AgentInsertSchema = createInsertSchema(agents).extend({
|
|
34
|
+
id: resourceIdSchema,
|
|
35
|
+
models: ModelSchema.optional()
|
|
36
|
+
});
|
|
37
|
+
var AgentUpdateSchema = AgentInsertSchema.partial();
|
|
38
|
+
var AgentApiSelectSchema = createApiSchema(AgentSelectSchema);
|
|
39
|
+
var AgentApiInsertSchema = createApiInsertSchema(AgentInsertSchema);
|
|
40
|
+
var AgentApiUpdateSchema = createApiUpdateSchema(AgentUpdateSchema);
|
|
41
|
+
var AgentRelationSelectSchema = createSelectSchema(agentRelations);
|
|
42
|
+
var AgentRelationInsertSchema = createInsertSchema(agentRelations).extend({
|
|
43
|
+
id: resourceIdSchema,
|
|
44
|
+
graphId: resourceIdSchema,
|
|
45
|
+
sourceAgentId: resourceIdSchema,
|
|
46
|
+
targetAgentId: resourceIdSchema.optional(),
|
|
47
|
+
externalAgentId: resourceIdSchema.optional()
|
|
48
|
+
});
|
|
49
|
+
var AgentRelationUpdateSchema = AgentRelationInsertSchema.partial();
|
|
50
|
+
var AgentRelationApiSelectSchema = createApiSchema(AgentRelationSelectSchema);
|
|
51
|
+
var AgentRelationApiInsertSchema = createApiInsertSchema(AgentRelationInsertSchema).extend({
|
|
52
|
+
relationType: z.enum(VALID_RELATION_TYPES)
|
|
53
|
+
}).refine(
|
|
54
|
+
(data) => {
|
|
55
|
+
const hasTarget = data.targetAgentId != null;
|
|
56
|
+
const hasExternal = data.externalAgentId != null;
|
|
57
|
+
return hasTarget !== hasExternal;
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
message: "Must specify exactly one of targetAgentId or externalAgentId",
|
|
61
|
+
path: ["targetAgentId", "externalAgentId"]
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
var AgentRelationApiUpdateSchema = createApiUpdateSchema(AgentRelationUpdateSchema).extend({
|
|
65
|
+
relationType: z.enum(VALID_RELATION_TYPES).optional()
|
|
66
|
+
}).refine(
|
|
67
|
+
(data) => {
|
|
68
|
+
const hasTarget = data.targetAgentId != null;
|
|
69
|
+
const hasExternal = data.externalAgentId != null;
|
|
70
|
+
if (!hasTarget && !hasExternal) {
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
return hasTarget !== hasExternal;
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
message: "Must specify exactly one of targetAgentId or externalAgentId when updating agent relationships",
|
|
77
|
+
path: ["targetAgentId", "externalAgentId"]
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
var AgentRelationQuerySchema = z.object({
|
|
81
|
+
sourceAgentId: z.string().optional(),
|
|
82
|
+
targetAgentId: z.string().optional(),
|
|
83
|
+
externalAgentId: z.string().optional()
|
|
84
|
+
});
|
|
85
|
+
var ExternalAgentRelationInsertSchema = createInsertSchema(agentRelations).extend({
|
|
86
|
+
id: resourceIdSchema,
|
|
87
|
+
graphId: resourceIdSchema,
|
|
88
|
+
sourceAgentId: resourceIdSchema,
|
|
89
|
+
externalAgentId: resourceIdSchema
|
|
90
|
+
});
|
|
91
|
+
var ExternalAgentRelationApiInsertSchema = createApiInsertSchema(
|
|
92
|
+
ExternalAgentRelationInsertSchema
|
|
93
|
+
);
|
|
94
|
+
var AgentGraphSelectSchema = createSelectSchema(agentGraph);
|
|
95
|
+
var AgentGraphInsertSchema = createInsertSchema(agentGraph).extend({
|
|
96
|
+
id: resourceIdSchema
|
|
97
|
+
});
|
|
98
|
+
var AgentGraphUpdateSchema = AgentGraphInsertSchema.partial();
|
|
99
|
+
var AgentGraphApiSelectSchema = createApiSchema(AgentGraphSelectSchema);
|
|
100
|
+
var AgentGraphApiInsertSchema = createApiInsertSchema(AgentGraphInsertSchema).extend({
|
|
101
|
+
id: resourceIdSchema.optional()
|
|
102
|
+
});
|
|
103
|
+
var AgentGraphApiUpdateSchema = createApiUpdateSchema(AgentGraphUpdateSchema);
|
|
104
|
+
var TaskSelectSchema = createSelectSchema(tasks);
|
|
105
|
+
var TaskInsertSchema = createInsertSchema(tasks).extend({
|
|
106
|
+
id: resourceIdSchema,
|
|
107
|
+
conversationId: resourceIdSchema.optional()
|
|
108
|
+
});
|
|
109
|
+
var TaskUpdateSchema = TaskInsertSchema.partial();
|
|
110
|
+
var TaskApiSelectSchema = createApiSchema(TaskSelectSchema);
|
|
111
|
+
var TaskApiInsertSchema = createApiInsertSchema(TaskInsertSchema);
|
|
112
|
+
var TaskApiUpdateSchema = createApiUpdateSchema(TaskUpdateSchema);
|
|
113
|
+
var TaskRelationSelectSchema = createSelectSchema(taskRelations);
|
|
114
|
+
var TaskRelationInsertSchema = createInsertSchema(taskRelations).extend({
|
|
115
|
+
id: resourceIdSchema,
|
|
116
|
+
parentTaskId: resourceIdSchema,
|
|
117
|
+
childTaskId: resourceIdSchema
|
|
118
|
+
});
|
|
119
|
+
var TaskRelationUpdateSchema = TaskRelationInsertSchema.partial();
|
|
120
|
+
var TaskRelationApiSelectSchema = createApiSchema(TaskRelationSelectSchema);
|
|
121
|
+
var TaskRelationApiInsertSchema = createApiInsertSchema(TaskRelationInsertSchema);
|
|
122
|
+
var TaskRelationApiUpdateSchema = createApiUpdateSchema(TaskRelationUpdateSchema);
|
|
123
|
+
var imageUrlSchema = z.string().optional().refine(
|
|
124
|
+
(url) => {
|
|
125
|
+
if (!url) return true;
|
|
126
|
+
if (url.startsWith("data:image/")) {
|
|
127
|
+
const base64Part = url.split(",")[1];
|
|
128
|
+
if (!base64Part) return false;
|
|
129
|
+
return base64Part.length < 14e5;
|
|
130
|
+
}
|
|
131
|
+
try {
|
|
132
|
+
const parsed = new URL(url);
|
|
133
|
+
return parsed.protocol === "http:" || parsed.protocol === "https:";
|
|
134
|
+
} catch {
|
|
135
|
+
return false;
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
message: "Image URL must be a valid HTTP(S) URL or a base64 data URL (max 1MB)"
|
|
140
|
+
}
|
|
141
|
+
);
|
|
142
|
+
var McpTransportConfigSchema = z.object({
|
|
143
|
+
type: z.enum(MCPTransportType),
|
|
144
|
+
requestInit: z.record(z.string(), z.unknown()).optional(),
|
|
145
|
+
eventSourceInit: z.record(z.string(), z.unknown()).optional(),
|
|
146
|
+
reconnectionOptions: z.custom().optional(),
|
|
147
|
+
sessionId: z.string().optional()
|
|
148
|
+
});
|
|
149
|
+
var ToolStatusSchema = z.enum(TOOL_STATUS_VALUES);
|
|
150
|
+
var McpToolDefinitionSchema = z.object({
|
|
151
|
+
name: z.string(),
|
|
152
|
+
description: z.string().optional(),
|
|
153
|
+
inputSchema: z.record(z.string(), z.unknown()).optional()
|
|
154
|
+
});
|
|
155
|
+
var ToolSelectSchema = createSelectSchema(tools);
|
|
156
|
+
var ToolInsertSchema = createInsertSchema(tools).extend({
|
|
157
|
+
id: resourceIdSchema,
|
|
158
|
+
imageUrl: imageUrlSchema
|
|
159
|
+
});
|
|
160
|
+
var ConversationSelectSchema = createSelectSchema(conversations);
|
|
161
|
+
var ConversationInsertSchema = createInsertSchema(conversations).extend({
|
|
162
|
+
id: resourceIdSchema,
|
|
163
|
+
contextConfigId: resourceIdSchema.optional()
|
|
164
|
+
});
|
|
165
|
+
var ConversationUpdateSchema = ConversationInsertSchema.partial();
|
|
166
|
+
var ConversationApiSelectSchema = createApiSchema(ConversationSelectSchema);
|
|
167
|
+
var ConversationApiInsertSchema = createApiInsertSchema(ConversationInsertSchema);
|
|
168
|
+
var ConversationApiUpdateSchema = createApiUpdateSchema(ConversationUpdateSchema);
|
|
169
|
+
var MessageSelectSchema = createSelectSchema(messages);
|
|
170
|
+
var MessageInsertSchema = createInsertSchema(messages).extend({
|
|
171
|
+
id: resourceIdSchema,
|
|
172
|
+
conversationId: resourceIdSchema,
|
|
173
|
+
taskId: resourceIdSchema.optional()
|
|
174
|
+
});
|
|
175
|
+
var MessageUpdateSchema = MessageInsertSchema.partial();
|
|
176
|
+
var MessageApiSelectSchema = createApiSchema(MessageSelectSchema);
|
|
177
|
+
var MessageApiInsertSchema = createApiInsertSchema(MessageInsertSchema);
|
|
178
|
+
var MessageApiUpdateSchema = createApiUpdateSchema(MessageUpdateSchema);
|
|
179
|
+
var ContextCacheSelectSchema = createSelectSchema(contextCache);
|
|
180
|
+
var ContextCacheInsertSchema = createInsertSchema(contextCache);
|
|
181
|
+
var ContextCacheUpdateSchema = ContextCacheInsertSchema.partial();
|
|
182
|
+
var ContextCacheApiSelectSchema = createApiSchema(ContextCacheSelectSchema);
|
|
183
|
+
var ContextCacheApiInsertSchema = createApiInsertSchema(ContextCacheInsertSchema);
|
|
184
|
+
var ContextCacheApiUpdateSchema = createApiUpdateSchema(ContextCacheUpdateSchema);
|
|
185
|
+
var DataComponentSelectSchema = createSelectSchema(dataComponents);
|
|
186
|
+
var DataComponentInsertSchema = createInsertSchema(dataComponents).extend({
|
|
187
|
+
id: resourceIdSchema
|
|
188
|
+
});
|
|
189
|
+
var DataComponentBaseSchema = DataComponentInsertSchema.omit({
|
|
190
|
+
createdAt: true,
|
|
191
|
+
updatedAt: true
|
|
192
|
+
});
|
|
193
|
+
var DataComponentUpdateSchema = DataComponentInsertSchema.partial();
|
|
194
|
+
var DataComponentApiSelectSchema = createApiSchema(DataComponentSelectSchema);
|
|
195
|
+
var DataComponentApiInsertSchema = createApiInsertSchema(DataComponentInsertSchema);
|
|
196
|
+
var DataComponentApiUpdateSchema = createApiUpdateSchema(DataComponentUpdateSchema);
|
|
197
|
+
var AgentDataComponentSelectSchema = createSelectSchema(agentDataComponents);
|
|
198
|
+
var AgentDataComponentInsertSchema = createInsertSchema(agentDataComponents);
|
|
199
|
+
var AgentDataComponentUpdateSchema = AgentDataComponentInsertSchema.partial();
|
|
200
|
+
var AgentDataComponentApiSelectSchema = createApiSchema(AgentDataComponentSelectSchema);
|
|
201
|
+
var AgentDataComponentApiInsertSchema = createApiInsertSchema(
|
|
202
|
+
AgentDataComponentInsertSchema
|
|
203
|
+
);
|
|
204
|
+
var AgentDataComponentApiUpdateSchema = createApiUpdateSchema(
|
|
205
|
+
AgentDataComponentUpdateSchema
|
|
206
|
+
);
|
|
207
|
+
var ArtifactComponentSelectSchema = createSelectSchema(artifactComponents);
|
|
208
|
+
var ArtifactComponentInsertSchema = createInsertSchema(artifactComponents).extend({
|
|
209
|
+
id: resourceIdSchema
|
|
210
|
+
});
|
|
211
|
+
var ArtifactComponentUpdateSchema = ArtifactComponentInsertSchema.partial();
|
|
212
|
+
var ArtifactComponentApiSelectSchema = createApiSchema(ArtifactComponentSelectSchema);
|
|
213
|
+
var ArtifactComponentApiInsertSchema = ArtifactComponentInsertSchema.omit({
|
|
214
|
+
tenantId: true,
|
|
215
|
+
projectId: true,
|
|
216
|
+
createdAt: true,
|
|
217
|
+
updatedAt: true
|
|
218
|
+
}).extend({
|
|
219
|
+
id: resourceIdSchema.optional()
|
|
220
|
+
});
|
|
221
|
+
var ArtifactComponentApiUpdateSchema = createApiUpdateSchema(
|
|
222
|
+
ArtifactComponentUpdateSchema
|
|
223
|
+
);
|
|
224
|
+
var AgentArtifactComponentSelectSchema = createSelectSchema(agentArtifactComponents);
|
|
225
|
+
var AgentArtifactComponentInsertSchema = createInsertSchema(
|
|
226
|
+
agentArtifactComponents
|
|
227
|
+
).extend({
|
|
228
|
+
id: resourceIdSchema,
|
|
229
|
+
agentId: resourceIdSchema,
|
|
230
|
+
artifactComponentId: resourceIdSchema
|
|
231
|
+
});
|
|
232
|
+
var AgentArtifactComponentUpdateSchema = AgentArtifactComponentInsertSchema.partial();
|
|
233
|
+
var AgentArtifactComponentApiSelectSchema = createApiSchema(
|
|
234
|
+
AgentArtifactComponentSelectSchema
|
|
235
|
+
);
|
|
236
|
+
var AgentArtifactComponentApiInsertSchema = AgentArtifactComponentInsertSchema.omit({
|
|
237
|
+
tenantId: true,
|
|
238
|
+
projectId: true,
|
|
239
|
+
id: true,
|
|
240
|
+
createdAt: true
|
|
241
|
+
});
|
|
242
|
+
var AgentArtifactComponentApiUpdateSchema = createApiUpdateSchema(
|
|
243
|
+
AgentArtifactComponentUpdateSchema
|
|
244
|
+
);
|
|
245
|
+
var ExternalAgentSelectSchema = createSelectSchema(externalAgents).extend({
|
|
246
|
+
credentialReferenceId: z.string().nullable().optional(),
|
|
247
|
+
headers: z.record(z.string(), z.string()).nullable().optional()
|
|
248
|
+
});
|
|
249
|
+
var ExternalAgentInsertSchema = createInsertSchema(externalAgents).extend({
|
|
250
|
+
id: resourceIdSchema
|
|
251
|
+
});
|
|
252
|
+
var ExternalAgentUpdateSchema = ExternalAgentInsertSchema.partial();
|
|
253
|
+
var ExternalAgentApiSelectSchema = createApiSchema(ExternalAgentSelectSchema);
|
|
254
|
+
var ExternalAgentApiInsertSchema = createApiInsertSchema(ExternalAgentInsertSchema);
|
|
255
|
+
var ExternalAgentApiUpdateSchema = createApiUpdateSchema(ExternalAgentUpdateSchema);
|
|
256
|
+
var AllAgentSchema = z.discriminatedUnion("type", [
|
|
257
|
+
AgentApiSelectSchema.extend({ type: z.literal("internal") }),
|
|
258
|
+
ExternalAgentApiSelectSchema.extend({ type: z.literal("external") })
|
|
259
|
+
]);
|
|
260
|
+
var ApiKeySelectSchema = createSelectSchema(apiKeys);
|
|
261
|
+
var ApiKeyInsertSchema = createInsertSchema(apiKeys).extend({
|
|
262
|
+
id: resourceIdSchema,
|
|
263
|
+
graphId: resourceIdSchema
|
|
264
|
+
});
|
|
265
|
+
var ApiKeyUpdateSchema = ApiKeyInsertSchema.partial().omit({
|
|
266
|
+
tenantId: true,
|
|
267
|
+
projectId: true,
|
|
268
|
+
id: true,
|
|
269
|
+
publicId: true,
|
|
270
|
+
keyHash: true,
|
|
271
|
+
keyPrefix: true,
|
|
272
|
+
createdAt: true
|
|
273
|
+
});
|
|
274
|
+
var ApiKeyApiSelectSchema = ApiKeySelectSchema.omit({
|
|
275
|
+
tenantId: true,
|
|
276
|
+
projectId: true,
|
|
277
|
+
keyHash: true
|
|
278
|
+
// Never expose the hash
|
|
279
|
+
});
|
|
280
|
+
var ApiKeyApiCreationResponseSchema = z.object({
|
|
281
|
+
data: z.object({
|
|
282
|
+
apiKey: ApiKeyApiSelectSchema,
|
|
283
|
+
key: z.string().describe("The full API key (shown only once)")
|
|
284
|
+
})
|
|
285
|
+
});
|
|
286
|
+
var ApiKeyApiInsertSchema = ApiKeyInsertSchema.omit({
|
|
287
|
+
tenantId: true,
|
|
288
|
+
projectId: true,
|
|
289
|
+
id: true,
|
|
290
|
+
// Auto-generated
|
|
291
|
+
publicId: true,
|
|
292
|
+
// Auto-generated
|
|
293
|
+
keyHash: true,
|
|
294
|
+
// Auto-generated
|
|
295
|
+
keyPrefix: true,
|
|
296
|
+
// Auto-generated
|
|
297
|
+
lastUsedAt: true
|
|
298
|
+
// Not set on creation
|
|
299
|
+
});
|
|
300
|
+
var ApiKeyApiUpdateSchema = ApiKeyUpdateSchema;
|
|
301
|
+
var CredentialReferenceSelectSchema = z.object({
|
|
302
|
+
id: z.string(),
|
|
303
|
+
tenantId: z.string(),
|
|
304
|
+
projectId: z.string(),
|
|
305
|
+
type: z.string(),
|
|
306
|
+
credentialStoreId: z.string(),
|
|
307
|
+
retrievalParams: z.record(z.string(), z.unknown()).nullish(),
|
|
308
|
+
createdAt: z.string(),
|
|
309
|
+
updatedAt: z.string()
|
|
310
|
+
});
|
|
311
|
+
var CredentialReferenceInsertSchema = z.object({
|
|
312
|
+
id: resourceIdSchema,
|
|
313
|
+
tenantId: z.string(),
|
|
314
|
+
projectId: z.string(),
|
|
315
|
+
type: z.string(),
|
|
316
|
+
credentialStoreId: resourceIdSchema,
|
|
317
|
+
retrievalParams: z.record(z.string(), z.unknown()).nullish()
|
|
318
|
+
});
|
|
319
|
+
var CredentialReferenceUpdateSchema = CredentialReferenceInsertSchema.partial();
|
|
320
|
+
var CredentialReferenceApiSelectSchema = createApiSchema(
|
|
321
|
+
CredentialReferenceSelectSchema
|
|
322
|
+
).extend({
|
|
323
|
+
type: z.enum(CredentialStoreType)
|
|
324
|
+
});
|
|
325
|
+
var CredentialReferenceApiInsertSchema = createApiInsertSchema(
|
|
326
|
+
CredentialReferenceInsertSchema
|
|
327
|
+
).extend({
|
|
328
|
+
type: z.enum(CredentialStoreType)
|
|
329
|
+
});
|
|
330
|
+
var CredentialReferenceApiUpdateSchema = createApiUpdateSchema(
|
|
331
|
+
CredentialReferenceUpdateSchema
|
|
332
|
+
).extend({
|
|
333
|
+
type: z.enum(CredentialStoreType).optional()
|
|
334
|
+
});
|
|
335
|
+
var McpToolSchema = ToolInsertSchema.extend({
|
|
336
|
+
imageUrl: imageUrlSchema,
|
|
337
|
+
status: ToolStatusSchema.default("unknown"),
|
|
338
|
+
lastHealthCheck: z.date().optional(),
|
|
339
|
+
lastToolsSync: z.date().optional(),
|
|
340
|
+
version: z.string().optional(),
|
|
341
|
+
createdAt: z.date(),
|
|
342
|
+
updatedAt: z.date()
|
|
343
|
+
});
|
|
344
|
+
var MCPToolConfigSchema = McpToolSchema.omit({
|
|
345
|
+
config: true,
|
|
346
|
+
tenantId: true,
|
|
347
|
+
projectId: true,
|
|
348
|
+
status: true,
|
|
349
|
+
lastHealthCheck: true,
|
|
350
|
+
lastToolsSync: true,
|
|
351
|
+
version: true,
|
|
352
|
+
createdAt: true,
|
|
353
|
+
updatedAt: true,
|
|
354
|
+
credentialReferenceId: true
|
|
355
|
+
}).extend({
|
|
356
|
+
tenantId: z.string().optional(),
|
|
357
|
+
projectId: z.string().optional(),
|
|
358
|
+
description: z.string().optional(),
|
|
359
|
+
serverUrl: z.url(),
|
|
360
|
+
activeTools: z.array(z.string()).optional(),
|
|
361
|
+
mcpType: z.enum(MCPServerType).optional(),
|
|
362
|
+
transport: McpTransportConfigSchema.optional(),
|
|
363
|
+
credential: CredentialReferenceApiInsertSchema.optional()
|
|
364
|
+
});
|
|
365
|
+
var ToolUpdateSchema = ToolInsertSchema.partial();
|
|
366
|
+
var ToolApiSelectSchema = createApiSchema(ToolSelectSchema);
|
|
367
|
+
var ToolApiInsertSchema = createApiInsertSchema(ToolInsertSchema);
|
|
368
|
+
var ToolApiUpdateSchema = createApiUpdateSchema(ToolUpdateSchema);
|
|
369
|
+
var FetchConfigSchema = z.object({
|
|
370
|
+
url: z.string().min(1, "URL is required"),
|
|
371
|
+
method: z.enum(["GET", "POST", "PUT", "DELETE", "PATCH"]).optional().default("GET"),
|
|
372
|
+
headers: z.record(z.string(), z.string()).optional(),
|
|
373
|
+
body: z.record(z.string(), z.unknown()).optional(),
|
|
374
|
+
transform: z.string().optional(),
|
|
375
|
+
// JSONPath or JS transform function
|
|
376
|
+
timeout: z.number().min(0).optional().default(1e4).optional()
|
|
377
|
+
});
|
|
378
|
+
var FetchDefinitionSchema = z.object({
|
|
379
|
+
id: z.string().min(1, "Fetch definition ID is required"),
|
|
380
|
+
name: z.string().optional(),
|
|
381
|
+
trigger: z.enum(["initialization", "invocation"]),
|
|
382
|
+
fetchConfig: FetchConfigSchema,
|
|
383
|
+
responseSchema: z.any().optional(),
|
|
384
|
+
// JSON Schema for validating HTTP response
|
|
385
|
+
defaultValue: z.unknown().optional(),
|
|
386
|
+
credential: CredentialReferenceApiInsertSchema.optional()
|
|
387
|
+
});
|
|
388
|
+
var ContextConfigSelectSchema = createSelectSchema(contextConfigs).extend({
|
|
389
|
+
requestContextSchema: z.unknown().optional()
|
|
390
|
+
});
|
|
391
|
+
var ContextConfigInsertSchema = createInsertSchema(contextConfigs).extend({
|
|
392
|
+
id: resourceIdSchema,
|
|
393
|
+
requestContextSchema: z.unknown().optional()
|
|
394
|
+
}).omit({
|
|
395
|
+
createdAt: true,
|
|
396
|
+
updatedAt: true
|
|
397
|
+
});
|
|
398
|
+
var ContextConfigUpdateSchema = ContextConfigInsertSchema.partial();
|
|
399
|
+
var ContextConfigApiSelectSchema = createApiSchema(ContextConfigSelectSchema);
|
|
400
|
+
var ContextConfigApiInsertSchema = createApiInsertSchema(ContextConfigInsertSchema);
|
|
401
|
+
var ContextConfigApiUpdateSchema = createApiUpdateSchema(ContextConfigUpdateSchema);
|
|
402
|
+
var AgentToolRelationSelectSchema = createSelectSchema(agentToolRelations);
|
|
403
|
+
var AgentToolRelationInsertSchema = createInsertSchema(agentToolRelations).extend({
|
|
404
|
+
id: resourceIdSchema,
|
|
405
|
+
agentId: resourceIdSchema,
|
|
406
|
+
toolId: resourceIdSchema,
|
|
407
|
+
selectedTools: z.array(z.string()).nullish()
|
|
408
|
+
});
|
|
409
|
+
var AgentToolRelationUpdateSchema = AgentToolRelationInsertSchema.partial();
|
|
410
|
+
var AgentToolRelationApiSelectSchema = createApiSchema(AgentToolRelationSelectSchema);
|
|
411
|
+
var AgentToolRelationApiInsertSchema = createApiInsertSchema(
|
|
412
|
+
AgentToolRelationInsertSchema
|
|
413
|
+
);
|
|
414
|
+
var AgentToolRelationApiUpdateSchema = createApiUpdateSchema(
|
|
415
|
+
AgentToolRelationUpdateSchema
|
|
416
|
+
);
|
|
417
|
+
var LedgerArtifactSelectSchema = createSelectSchema(ledgerArtifacts);
|
|
418
|
+
var LedgerArtifactInsertSchema = createInsertSchema(ledgerArtifacts);
|
|
419
|
+
var LedgerArtifactUpdateSchema = LedgerArtifactInsertSchema.partial();
|
|
420
|
+
var LedgerArtifactApiSelectSchema = createApiSchema(LedgerArtifactSelectSchema);
|
|
421
|
+
var LedgerArtifactApiInsertSchema = createApiInsertSchema(LedgerArtifactInsertSchema);
|
|
422
|
+
var LedgerArtifactApiUpdateSchema = createApiUpdateSchema(LedgerArtifactUpdateSchema);
|
|
423
|
+
var StatusComponentSchema = z.object({
|
|
424
|
+
type: z.string(),
|
|
425
|
+
description: z.string().optional(),
|
|
426
|
+
detailsSchema: z.object({
|
|
427
|
+
type: z.literal("object"),
|
|
428
|
+
properties: z.record(z.string(), z.any()),
|
|
429
|
+
required: z.array(z.string()).optional()
|
|
430
|
+
}).optional()
|
|
431
|
+
});
|
|
432
|
+
var StatusUpdateSchema = z.object({
|
|
433
|
+
enabled: z.boolean().optional(),
|
|
434
|
+
numEvents: z.number().min(1).max(100).optional(),
|
|
435
|
+
timeInSeconds: z.number().min(1).max(600).optional(),
|
|
436
|
+
prompt: z.string().max(2e3, "Custom prompt cannot exceed 2000 characters").optional(),
|
|
437
|
+
statusComponents: z.array(StatusComponentSchema).optional()
|
|
438
|
+
});
|
|
439
|
+
var FullGraphAgentInsertSchema = AgentApiInsertSchema.extend({
|
|
440
|
+
tools: z.array(z.string()),
|
|
441
|
+
selectedTools: z.record(z.string(), z.array(z.string())).optional(),
|
|
442
|
+
dataComponents: z.array(z.string()).optional(),
|
|
443
|
+
artifactComponents: z.array(z.string()).optional(),
|
|
444
|
+
canTransferTo: z.array(z.string()).optional(),
|
|
445
|
+
canDelegateTo: z.array(z.string()).optional()
|
|
446
|
+
});
|
|
447
|
+
var FullGraphDefinitionSchema = AgentGraphApiInsertSchema.extend({
|
|
448
|
+
agents: z.record(z.string(), z.union([FullGraphAgentInsertSchema, ExternalAgentApiInsertSchema])),
|
|
449
|
+
tools: z.record(z.string(), ToolApiInsertSchema),
|
|
450
|
+
credentialReferences: z.array(CredentialReferenceApiInsertSchema).optional(),
|
|
451
|
+
dataComponents: z.record(z.string(), DataComponentApiInsertSchema).optional(),
|
|
452
|
+
artifactComponents: z.record(z.string(), ArtifactComponentApiInsertSchema).optional(),
|
|
453
|
+
contextConfig: z.optional(ContextConfigApiInsertSchema),
|
|
454
|
+
statusUpdates: z.optional(StatusUpdateSchema),
|
|
455
|
+
models: ModelSchema.optional(),
|
|
456
|
+
stopWhen: z.object({
|
|
457
|
+
transferCountIs: z.number().min(1).max(100).optional()
|
|
458
|
+
}).optional(),
|
|
459
|
+
graphPrompt: z.string().max(5e3, "Graph prompt cannot exceed 5000 characters").optional()
|
|
460
|
+
});
|
|
461
|
+
var PaginationSchema = z.object({
|
|
462
|
+
page: z.coerce.number().min(1).default(1),
|
|
463
|
+
limit: z.coerce.number().min(1).max(100).default(10),
|
|
464
|
+
total: z.number(),
|
|
465
|
+
pages: z.number()
|
|
466
|
+
});
|
|
467
|
+
var ListResponseSchema = (itemSchema) => z.object({
|
|
468
|
+
data: z.array(itemSchema),
|
|
469
|
+
pagination: PaginationSchema
|
|
470
|
+
});
|
|
471
|
+
var SingleResponseSchema = (itemSchema) => z.object({
|
|
472
|
+
data: itemSchema
|
|
473
|
+
});
|
|
474
|
+
var ErrorResponseSchema = z.object({
|
|
475
|
+
error: z.string(),
|
|
476
|
+
message: z.string().optional(),
|
|
477
|
+
details: z.unknown().optional()
|
|
478
|
+
});
|
|
479
|
+
var ExistsResponseSchema = z.object({
|
|
480
|
+
exists: z.boolean()
|
|
481
|
+
});
|
|
482
|
+
var RemovedResponseSchema = z.object({
|
|
483
|
+
message: z.string(),
|
|
484
|
+
removed: z.boolean()
|
|
485
|
+
});
|
|
486
|
+
var ProjectSelectSchema = createSelectSchema(projects);
|
|
487
|
+
var ProjectInsertSchema = createInsertSchema(projects).extend({
|
|
488
|
+
models: ProjectModelSchema.optional()
|
|
489
|
+
}).omit({
|
|
490
|
+
createdAt: true,
|
|
491
|
+
updatedAt: true
|
|
492
|
+
});
|
|
493
|
+
var ProjectUpdateSchema = ProjectInsertSchema.partial();
|
|
494
|
+
var ProjectApiSelectSchema = ProjectSelectSchema.omit({ tenantId: true });
|
|
495
|
+
var ProjectApiInsertSchema = ProjectInsertSchema.omit({ tenantId: true });
|
|
496
|
+
var ProjectApiUpdateSchema = ProjectUpdateSchema.omit({ tenantId: true });
|
|
497
|
+
var HeadersScopeSchema = z.object({
|
|
498
|
+
"x-inkeep-tenant-id": z.string().optional().openapi({
|
|
499
|
+
description: "Tenant identifier",
|
|
500
|
+
example: "tenant_123"
|
|
501
|
+
}),
|
|
502
|
+
"x-inkeep-project-id": z.string().optional().openapi({
|
|
503
|
+
description: "Project identifier",
|
|
504
|
+
example: "project_456"
|
|
505
|
+
}),
|
|
506
|
+
"x-inkeep-graph-id": z.string().optional().openapi({
|
|
507
|
+
description: "Graph identifier",
|
|
508
|
+
example: "graph_789"
|
|
509
|
+
})
|
|
510
|
+
});
|
|
511
|
+
var TenantParamsSchema = z.object({
|
|
512
|
+
tenantId: z.string().openapi({
|
|
513
|
+
description: "Tenant identifier",
|
|
514
|
+
example: "tenant_123"
|
|
515
|
+
})
|
|
516
|
+
}).openapi("TenantParams");
|
|
517
|
+
var TenantProjectParamsSchema = z.object({
|
|
518
|
+
tenantId: z.string().openapi({
|
|
519
|
+
description: "Tenant identifier",
|
|
520
|
+
example: "tenant_123"
|
|
521
|
+
}),
|
|
522
|
+
projectId: z.string().openapi({
|
|
523
|
+
description: "Project identifier",
|
|
524
|
+
example: "project_456"
|
|
525
|
+
})
|
|
526
|
+
}).openapi("TenantProjectParams");
|
|
527
|
+
var TenantProjectIdParamsSchema = z.object({
|
|
528
|
+
tenantId: z.string().openapi({
|
|
529
|
+
description: "Tenant identifier",
|
|
530
|
+
example: "tenant_123"
|
|
531
|
+
}),
|
|
532
|
+
projectId: z.string().openapi({
|
|
533
|
+
description: "Project identifier",
|
|
534
|
+
example: "project_456"
|
|
535
|
+
}),
|
|
536
|
+
id: resourceIdSchema
|
|
537
|
+
}).openapi("TenantProjectIdParams");
|
|
538
|
+
var TenantIdParamsSchema = z.object({
|
|
539
|
+
tenantId: z.string().openapi({
|
|
540
|
+
description: "Tenant identifier",
|
|
541
|
+
example: "tenant_123"
|
|
542
|
+
}),
|
|
543
|
+
id: resourceIdSchema
|
|
544
|
+
}).openapi("TenantIdParams");
|
|
545
|
+
var IdParamsSchema = z.object({
|
|
546
|
+
id: resourceIdSchema
|
|
547
|
+
}).openapi("IdParams");
|
|
548
|
+
var PaginationQueryParamsSchema = z.object({
|
|
549
|
+
page: z.coerce.number().min(1).default(1),
|
|
550
|
+
limit: z.coerce.number().min(1).max(100).default(10)
|
|
551
|
+
});
|
|
552
|
+
|
|
553
|
+
// src/validation/graphFull.ts
|
|
554
|
+
function isInternalAgent(agent) {
|
|
555
|
+
return "prompt" in agent;
|
|
556
|
+
}
|
|
557
|
+
function isExternalAgent(agent) {
|
|
558
|
+
return "baseUrl" in agent;
|
|
559
|
+
}
|
|
560
|
+
function validateAndTypeGraphData(data) {
|
|
561
|
+
return FullGraphDefinitionSchema.parse(data);
|
|
562
|
+
}
|
|
563
|
+
function validateToolReferences(graphData) {
|
|
564
|
+
const errors = [];
|
|
565
|
+
const availableToolIds = new Set(Object.keys(graphData.tools));
|
|
566
|
+
for (const [agentId, agentData] of Object.entries(graphData.agents)) {
|
|
567
|
+
if (isInternalAgent(agentData) && agentData.tools && Array.isArray(agentData.tools)) {
|
|
568
|
+
for (const toolId of agentData.tools) {
|
|
569
|
+
if (!availableToolIds.has(toolId)) {
|
|
570
|
+
errors.push(`Agent '${agentId}' references non-existent tool '${toolId}'`);
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
if (errors.length > 0) {
|
|
576
|
+
throw new Error(`Tool reference validation failed:
|
|
577
|
+
${errors.join("\n")}`);
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
function validateDataComponentReferences(graphData) {
|
|
581
|
+
const errors = [];
|
|
582
|
+
const availableDataComponentIds = new Set(Object.keys(graphData.dataComponents || {}));
|
|
583
|
+
for (const [agentId, agentData] of Object.entries(graphData.agents)) {
|
|
584
|
+
if (isInternalAgent(agentData) && agentData.dataComponents) {
|
|
585
|
+
for (const dataComponentId of agentData.dataComponents) {
|
|
586
|
+
if (!availableDataComponentIds.has(dataComponentId)) {
|
|
587
|
+
errors.push(
|
|
588
|
+
`Agent '${agentId}' references non-existent dataComponent '${dataComponentId}'`
|
|
589
|
+
);
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
if (errors.length > 0) {
|
|
595
|
+
throw new Error(`DataComponent reference validation failed:
|
|
596
|
+
${errors.join("\n")}`);
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
function validateArtifactComponentReferences(graphData) {
|
|
600
|
+
const errors = [];
|
|
601
|
+
const availableArtifactComponentIds = new Set(Object.keys(graphData.artifactComponents || {}));
|
|
602
|
+
for (const [agentId, agentData] of Object.entries(graphData.agents)) {
|
|
603
|
+
if (isInternalAgent(agentData) && agentData.artifactComponents) {
|
|
604
|
+
for (const artifactComponentId of agentData.artifactComponents) {
|
|
605
|
+
if (!availableArtifactComponentIds.has(artifactComponentId)) {
|
|
606
|
+
errors.push(
|
|
607
|
+
`Agent '${agentId}' references non-existent artifactComponent '${artifactComponentId}'`
|
|
608
|
+
);
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
if (errors.length > 0) {
|
|
614
|
+
throw new Error(`ArtifactComponent reference validation failed:
|
|
615
|
+
${errors.join("\n")}`);
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
function validateAgentRelationships(graphData) {
|
|
619
|
+
const errors = [];
|
|
620
|
+
const availableAgentIds = new Set(Object.keys(graphData.agents));
|
|
621
|
+
for (const [agentId, agentData] of Object.entries(graphData.agents)) {
|
|
622
|
+
if (isInternalAgent(agentData)) {
|
|
623
|
+
if (agentData.canTransferTo && Array.isArray(agentData.canTransferTo)) {
|
|
624
|
+
for (const targetId of agentData.canTransferTo) {
|
|
625
|
+
if (!availableAgentIds.has(targetId)) {
|
|
626
|
+
errors.push(
|
|
627
|
+
`Agent '${agentId}' has transfer target '${targetId}' that doesn't exist in graph`
|
|
628
|
+
);
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
if (agentData.canDelegateTo && Array.isArray(agentData.canDelegateTo)) {
|
|
633
|
+
for (const targetId of agentData.canDelegateTo) {
|
|
634
|
+
if (!availableAgentIds.has(targetId)) {
|
|
635
|
+
errors.push(
|
|
636
|
+
`Agent '${agentId}' has delegation target '${targetId}' that doesn't exist in graph`
|
|
637
|
+
);
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
if (errors.length > 0) {
|
|
644
|
+
throw new Error(`Agent relationship validation failed:
|
|
645
|
+
${errors.join("\n")}`);
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
function validateGraphStructure(graphData) {
|
|
649
|
+
if (!graphData.agents[graphData.defaultAgentId]) {
|
|
650
|
+
throw new Error(`Default agent '${graphData.defaultAgentId}' does not exist in agents`);
|
|
651
|
+
}
|
|
652
|
+
validateToolReferences(graphData);
|
|
653
|
+
validateDataComponentReferences(graphData);
|
|
654
|
+
validateArtifactComponentReferences(graphData);
|
|
655
|
+
validateAgentRelationships(graphData);
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
// src/validation/id-validation.ts
|
|
659
|
+
function isValidResourceId(id) {
|
|
660
|
+
const result = resourceIdSchema.safeParse(id);
|
|
661
|
+
return result.success;
|
|
662
|
+
}
|
|
663
|
+
function generateIdFromName(name) {
|
|
664
|
+
const id = name.toLowerCase().replace(/[^a-z0-9_-]+/g, "-").replace(/^-+|-+$/g, "").replace(/-{2,}/g, "-");
|
|
665
|
+
if (!id) {
|
|
666
|
+
throw new Error("Cannot generate valid ID from provided name");
|
|
667
|
+
}
|
|
668
|
+
const truncatedId = id.substring(0, MAX_ID_LENGTH);
|
|
669
|
+
const result = resourceIdSchema.safeParse(truncatedId);
|
|
670
|
+
if (!result.success) {
|
|
671
|
+
throw new Error(`Generated ID "${truncatedId}" is not valid: ${result.error.message}`);
|
|
672
|
+
}
|
|
673
|
+
return truncatedId;
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
export { AgentApiInsertSchema, AgentApiSelectSchema, AgentApiUpdateSchema, AgentArtifactComponentApiInsertSchema, AgentArtifactComponentApiSelectSchema, AgentArtifactComponentApiUpdateSchema, AgentArtifactComponentInsertSchema, AgentArtifactComponentSelectSchema, AgentArtifactComponentUpdateSchema, AgentDataComponentApiInsertSchema, AgentDataComponentApiSelectSchema, AgentDataComponentApiUpdateSchema, AgentDataComponentInsertSchema, AgentDataComponentSelectSchema, AgentDataComponentUpdateSchema, AgentGraphApiInsertSchema, AgentGraphApiSelectSchema, AgentGraphApiUpdateSchema, AgentGraphInsertSchema, AgentGraphSelectSchema, AgentGraphUpdateSchema, AgentInsertSchema, AgentRelationApiInsertSchema, AgentRelationApiSelectSchema, AgentRelationApiUpdateSchema, AgentRelationInsertSchema, AgentRelationQuerySchema, AgentRelationSelectSchema, AgentRelationUpdateSchema, AgentSelectSchema, AgentToolRelationApiInsertSchema, AgentToolRelationApiSelectSchema, AgentToolRelationApiUpdateSchema, AgentToolRelationInsertSchema, AgentToolRelationSelectSchema, AgentToolRelationUpdateSchema, AgentUpdateSchema, AllAgentSchema, ApiKeyApiCreationResponseSchema, ApiKeyApiInsertSchema, ApiKeyApiSelectSchema, ApiKeyApiUpdateSchema, ApiKeyInsertSchema, ApiKeySelectSchema, ApiKeyUpdateSchema, ArtifactComponentApiInsertSchema, ArtifactComponentApiSelectSchema, ArtifactComponentApiUpdateSchema, ArtifactComponentInsertSchema, ArtifactComponentSelectSchema, ArtifactComponentUpdateSchema, 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, ExternalAgentRelationApiInsertSchema, ExternalAgentRelationInsertSchema, ExternalAgentSelectSchema, ExternalAgentUpdateSchema, FetchConfigSchema, FetchDefinitionSchema, FullGraphAgentInsertSchema, FullGraphDefinitionSchema, HeadersScopeSchema, IdParamsSchema, 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, SingleResponseSchema, StatusComponentSchema, StatusUpdateSchema, TaskApiInsertSchema, TaskApiSelectSchema, TaskApiUpdateSchema, TaskInsertSchema, TaskRelationApiInsertSchema, TaskRelationApiSelectSchema, TaskRelationApiUpdateSchema, TaskRelationInsertSchema, TaskRelationSelectSchema, TaskRelationUpdateSchema, TaskSelectSchema, TaskUpdateSchema, TenantIdParamsSchema, TenantParamsSchema, TenantProjectIdParamsSchema, TenantProjectParamsSchema, ToolApiInsertSchema, ToolApiSelectSchema, ToolApiUpdateSchema, ToolInsertSchema, ToolSelectSchema, ToolStatusSchema, ToolUpdateSchema, URL_SAFE_ID_PATTERN, generateIdFromName, isExternalAgent, isInternalAgent, isValidResourceId, resourceIdSchema, validateAgentRelationships, validateAndTypeGraphData, validateArtifactComponentReferences, validateDataComponentReferences, validateGraphStructure, validateToolReferences };
|