@inkeep/agents-core 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-LPIKPCE5.js → chunk-7OCPFKGI.js} +7 -6
- package/dist/{chunk-XQRFKXVV.js → chunk-T5JVBY6K.js} +5 -5
- package/dist/{chunk-LFWFXR4O.js → chunk-TNFWLVL6.js} +1 -0
- package/dist/client-exports.cjs +9 -29
- package/dist/client-exports.js +5 -26
- package/dist/db/schema.cjs +1 -0
- package/dist/db/schema.js +1 -1
- package/dist/index.cjs +106 -93
- package/dist/index.js +101 -91
- package/dist/validation/index.cjs +11 -8
- package/dist/validation/index.js +2 -2
- package/package.json +2 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { agents, agentRelations, agentGraph, tasks, taskRelations, tools, conversations, messages, contextCache, dataComponents, agentDataComponents, artifactComponents, agentArtifactComponents, externalAgents, apiKeys, credentialReferences, contextConfigs, agentToolRelations, ledgerArtifacts, projects } from './chunk-TNFWLVL6.js';
|
|
1
2
|
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, credentialReferences, contextConfigs, agentToolRelations, ledgerArtifacts, projects } from './chunk-LFWFXR4O.js';
|
|
3
3
|
import { z } from '@hono/zod-openapi';
|
|
4
4
|
import { createSelectSchema, createInsertSchema } from 'drizzle-zod';
|
|
5
5
|
|
|
@@ -233,8 +233,6 @@ var ArtifactComponentApiInsertSchema = ArtifactComponentInsertSchema.omit({
|
|
|
233
233
|
projectId: true,
|
|
234
234
|
createdAt: true,
|
|
235
235
|
updatedAt: true
|
|
236
|
-
}).extend({
|
|
237
|
-
id: resourceIdSchema.optional()
|
|
238
236
|
});
|
|
239
237
|
var ArtifactComponentApiUpdateSchema = createApiUpdateSchema(
|
|
240
238
|
ArtifactComponentUpdateSchema
|
|
@@ -454,10 +452,13 @@ var StatusUpdateSchema = z.object({
|
|
|
454
452
|
prompt: z.string().max(2e3, "Custom prompt cannot exceed 2000 characters").optional(),
|
|
455
453
|
statusComponents: z.array(StatusComponentSchema).optional()
|
|
456
454
|
});
|
|
455
|
+
var CanUseItemSchema = z.object({
|
|
456
|
+
toolId: z.string(),
|
|
457
|
+
toolSelection: z.array(z.string()).nullable().optional()
|
|
458
|
+
});
|
|
457
459
|
var FullGraphAgentInsertSchema = AgentApiInsertSchema.extend({
|
|
458
460
|
type: z.literal("internal"),
|
|
459
|
-
|
|
460
|
-
selectedTools: z.record(z.string(), z.array(z.string())).optional(),
|
|
461
|
+
canUse: z.array(CanUseItemSchema),
|
|
461
462
|
dataComponents: z.array(z.string()).optional(),
|
|
462
463
|
artifactComponents: z.array(z.string()).optional(),
|
|
463
464
|
canTransferTo: z.array(z.string()).optional(),
|
|
@@ -619,4 +620,4 @@ var PaginationQueryParamsSchema = z.object({
|
|
|
619
620
|
limit: z.coerce.number().min(1).max(100).default(10)
|
|
620
621
|
});
|
|
621
622
|
|
|
622
|
-
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, AgentStopWhenSchema, 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, FullProjectDefinitionSchema, GraphStopWhenSchema, GraphWithinContextOfProjectSchema, 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, StopWhenSchema, TaskApiInsertSchema, TaskApiSelectSchema, TaskApiUpdateSchema, TaskInsertSchema, TaskRelationApiInsertSchema, TaskRelationApiSelectSchema, TaskRelationApiUpdateSchema, TaskRelationInsertSchema, TaskRelationSelectSchema, TaskRelationUpdateSchema, TaskSelectSchema, TaskUpdateSchema, TenantIdParamsSchema, TenantParamsSchema, TenantProjectGraphIdParamsSchema, TenantProjectGraphParamsSchema, TenantProjectIdParamsSchema, TenantProjectParamsSchema, ToolApiInsertSchema, ToolApiSelectSchema, ToolApiUpdateSchema, ToolInsertSchema, ToolSelectSchema, ToolStatusSchema, ToolUpdateSchema, URL_SAFE_ID_PATTERN, resourceIdSchema };
|
|
623
|
+
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, AgentStopWhenSchema, AgentToolRelationApiInsertSchema, AgentToolRelationApiSelectSchema, AgentToolRelationApiUpdateSchema, AgentToolRelationInsertSchema, AgentToolRelationSelectSchema, AgentToolRelationUpdateSchema, AgentUpdateSchema, 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, ExternalAgentRelationApiInsertSchema, ExternalAgentRelationInsertSchema, ExternalAgentSelectSchema, ExternalAgentUpdateSchema, FetchConfigSchema, FetchDefinitionSchema, FullGraphAgentInsertSchema, FullGraphDefinitionSchema, FullProjectDefinitionSchema, GraphStopWhenSchema, GraphWithinContextOfProjectSchema, 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, StopWhenSchema, TaskApiInsertSchema, TaskApiSelectSchema, TaskApiUpdateSchema, TaskInsertSchema, TaskRelationApiInsertSchema, TaskRelationApiSelectSchema, TaskRelationApiUpdateSchema, TaskRelationInsertSchema, TaskRelationSelectSchema, TaskRelationUpdateSchema, TaskSelectSchema, TaskUpdateSchema, TenantIdParamsSchema, TenantParamsSchema, TenantProjectGraphIdParamsSchema, TenantProjectGraphParamsSchema, TenantProjectIdParamsSchema, TenantProjectParamsSchema, ToolApiInsertSchema, ToolApiSelectSchema, ToolApiUpdateSchema, ToolInsertSchema, ToolSelectSchema, ToolStatusSchema, ToolUpdateSchema, URL_SAFE_ID_PATTERN, resourceIdSchema };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FullGraphDefinitionSchema, resourceIdSchema, MAX_ID_LENGTH } from './chunk-
|
|
1
|
+
import { FullGraphDefinitionSchema, resourceIdSchema, MAX_ID_LENGTH } from './chunk-7OCPFKGI.js';
|
|
2
2
|
|
|
3
3
|
// src/validation/graphFull.ts
|
|
4
4
|
function isInternalAgent(agent) {
|
|
@@ -16,10 +16,10 @@ function validateToolReferences(graphData, availableToolIds) {
|
|
|
16
16
|
}
|
|
17
17
|
const errors = [];
|
|
18
18
|
for (const [agentId, agentData] of Object.entries(graphData.agents)) {
|
|
19
|
-
if (isInternalAgent(agentData) && agentData.
|
|
20
|
-
for (const
|
|
21
|
-
if (!availableToolIds.has(toolId)) {
|
|
22
|
-
errors.push(`Agent '${agentId}' references non-existent tool '${toolId}'`);
|
|
19
|
+
if (isInternalAgent(agentData) && agentData.canUse && Array.isArray(agentData.canUse)) {
|
|
20
|
+
for (const canUseItem of agentData.canUse) {
|
|
21
|
+
if (!availableToolIds.has(canUseItem.toolId)) {
|
|
22
|
+
errors.push(`Agent '${agentId}' references non-existent tool '${canUseItem.toolId}'`);
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -584,6 +584,7 @@ var apiKeys = sqliteTable(
|
|
|
584
584
|
// Hashed API key (never store plaintext)
|
|
585
585
|
keyPrefix: text("key_prefix").notNull(),
|
|
586
586
|
// First 8 chars for identification (e.g., "sk_live_abc...")
|
|
587
|
+
name: text("name"),
|
|
587
588
|
lastUsedAt: text("last_used_at"),
|
|
588
589
|
expiresAt: text("expires_at"),
|
|
589
590
|
createdAt: text("created_at").notNull().default(sql`CURRENT_TIMESTAMP`),
|
package/dist/client-exports.cjs
CHANGED
|
@@ -565,6 +565,7 @@ var apiKeys = sqliteCore.sqliteTable(
|
|
|
565
565
|
// Hashed API key (never store plaintext)
|
|
566
566
|
keyPrefix: sqliteCore.text("key_prefix").notNull(),
|
|
567
567
|
// First 8 chars for identification (e.g., "sk_live_abc...")
|
|
568
|
+
name: sqliteCore.text("name"),
|
|
568
569
|
lastUsedAt: sqliteCore.text("last_used_at"),
|
|
569
570
|
expiresAt: sqliteCore.text("expires_at"),
|
|
570
571
|
createdAt: sqliteCore.text("created_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`),
|
|
@@ -1175,8 +1176,6 @@ var ArtifactComponentApiInsertSchema = ArtifactComponentInsertSchema.omit({
|
|
|
1175
1176
|
projectId: true,
|
|
1176
1177
|
createdAt: true,
|
|
1177
1178
|
updatedAt: true
|
|
1178
|
-
}).extend({
|
|
1179
|
-
id: resourceIdSchema.optional()
|
|
1180
1179
|
});
|
|
1181
1180
|
createApiUpdateSchema(
|
|
1182
1181
|
ArtifactComponentUpdateSchema
|
|
@@ -1395,10 +1394,13 @@ var StatusUpdateSchema = zodOpenapi.z.object({
|
|
|
1395
1394
|
prompt: zodOpenapi.z.string().max(2e3, "Custom prompt cannot exceed 2000 characters").optional(),
|
|
1396
1395
|
statusComponents: zodOpenapi.z.array(StatusComponentSchema).optional()
|
|
1397
1396
|
});
|
|
1397
|
+
var CanUseItemSchema = zodOpenapi.z.object({
|
|
1398
|
+
toolId: zodOpenapi.z.string(),
|
|
1399
|
+
toolSelection: zodOpenapi.z.array(zodOpenapi.z.string()).nullable().optional()
|
|
1400
|
+
});
|
|
1398
1401
|
var FullGraphAgentInsertSchema = AgentApiInsertSchema.extend({
|
|
1399
1402
|
type: zodOpenapi.z.literal("internal"),
|
|
1400
|
-
|
|
1401
|
-
selectedTools: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.array(zodOpenapi.z.string())).optional(),
|
|
1403
|
+
canUse: zodOpenapi.z.array(CanUseItemSchema),
|
|
1402
1404
|
dataComponents: zodOpenapi.z.array(zodOpenapi.z.string()).optional(),
|
|
1403
1405
|
artifactComponents: zodOpenapi.z.array(zodOpenapi.z.string()).optional(),
|
|
1404
1406
|
canTransferTo: zodOpenapi.z.array(zodOpenapi.z.string()).optional(),
|
|
@@ -1640,13 +1642,13 @@ var CredentialReferenceApiInsertSchema2 = zod.z.object({
|
|
|
1640
1642
|
retrievalParams: zod.z.record(zod.z.string(), zod.z.unknown()).nullish()
|
|
1641
1643
|
});
|
|
1642
1644
|
var DataComponentApiInsertSchema2 = zod.z.object({
|
|
1643
|
-
id: zod.z.string()
|
|
1645
|
+
id: zod.z.string(),
|
|
1644
1646
|
name: zod.z.string(),
|
|
1645
1647
|
description: zod.z.string().optional(),
|
|
1646
1648
|
props: zod.z.record(zod.z.string(), zod.z.unknown())
|
|
1647
1649
|
});
|
|
1648
1650
|
var ArtifactComponentApiInsertSchema2 = zod.z.object({
|
|
1649
|
-
id: zod.z.string()
|
|
1651
|
+
id: zod.z.string(),
|
|
1650
1652
|
name: zod.z.string(),
|
|
1651
1653
|
description: zod.z.string().optional(),
|
|
1652
1654
|
summaryProps: zod.z.record(zod.z.string(), zod.z.unknown()),
|
|
@@ -1676,29 +1678,7 @@ var FullGraphDefinitionSchema2 = AgentGraphApiInsertSchema2.extend({
|
|
|
1676
1678
|
agents: zod.z.record(
|
|
1677
1679
|
zod.z.string(),
|
|
1678
1680
|
zod.z.union([
|
|
1679
|
-
|
|
1680
|
-
id: zod.z.string(),
|
|
1681
|
-
tools: zod.z.array(zod.z.string()),
|
|
1682
|
-
dataComponents: zod.z.array(zod.z.string()).optional(),
|
|
1683
|
-
artifactComponents: zod.z.array(zod.z.string()).optional(),
|
|
1684
|
-
canTransferTo: zod.z.array(zod.z.string()).optional(),
|
|
1685
|
-
canDelegateTo: zod.z.array(zod.z.string()).optional(),
|
|
1686
|
-
type: zod.z.enum(["internal", "external"]).optional(),
|
|
1687
|
-
models: zod.z.object({
|
|
1688
|
-
base: zod.z.object({
|
|
1689
|
-
model: zod.z.string(),
|
|
1690
|
-
providerOptions: zod.z.record(zod.z.string(), zod.z.record(zod.z.string(), zod.z.unknown())).optional()
|
|
1691
|
-
}).optional(),
|
|
1692
|
-
structuredOutput: zod.z.object({
|
|
1693
|
-
model: zod.z.string(),
|
|
1694
|
-
providerOptions: zod.z.record(zod.z.string(), zod.z.record(zod.z.string(), zod.z.unknown())).optional()
|
|
1695
|
-
}).optional(),
|
|
1696
|
-
summarizer: zod.z.object({
|
|
1697
|
-
model: zod.z.string(),
|
|
1698
|
-
providerOptions: zod.z.record(zod.z.string(), zod.z.record(zod.z.string(), zod.z.unknown())).optional()
|
|
1699
|
-
}).optional()
|
|
1700
|
-
}).optional()
|
|
1701
|
-
}),
|
|
1681
|
+
FullGraphAgentInsertSchema,
|
|
1702
1682
|
ExternalAgentApiInsertSchema2.extend({
|
|
1703
1683
|
id: zod.z.string()
|
|
1704
1684
|
})
|
package/dist/client-exports.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { FullGraphAgentInsertSchema } from './chunk-7OCPFKGI.js';
|
|
2
|
+
export { AgentStopWhenSchema, GraphStopWhenSchema, StopWhenSchema } from './chunk-7OCPFKGI.js';
|
|
2
3
|
import { CredentialStoreType } from './chunk-SVGQSPW4.js';
|
|
3
4
|
export { CredentialStoreType, MCPTransportType } from './chunk-SVGQSPW4.js';
|
|
4
5
|
import { z } from 'zod';
|
|
@@ -89,13 +90,13 @@ var CredentialReferenceApiInsertSchema = z.object({
|
|
|
89
90
|
retrievalParams: z.record(z.string(), z.unknown()).nullish()
|
|
90
91
|
});
|
|
91
92
|
var DataComponentApiInsertSchema = z.object({
|
|
92
|
-
id: z.string()
|
|
93
|
+
id: z.string(),
|
|
93
94
|
name: z.string(),
|
|
94
95
|
description: z.string().optional(),
|
|
95
96
|
props: z.record(z.string(), z.unknown())
|
|
96
97
|
});
|
|
97
98
|
var ArtifactComponentApiInsertSchema = z.object({
|
|
98
|
-
id: z.string()
|
|
99
|
+
id: z.string(),
|
|
99
100
|
name: z.string(),
|
|
100
101
|
description: z.string().optional(),
|
|
101
102
|
summaryProps: z.record(z.string(), z.unknown()),
|
|
@@ -125,29 +126,7 @@ var FullGraphDefinitionSchema = AgentGraphApiInsertSchema.extend({
|
|
|
125
126
|
agents: z.record(
|
|
126
127
|
z.string(),
|
|
127
128
|
z.union([
|
|
128
|
-
|
|
129
|
-
id: z.string(),
|
|
130
|
-
tools: z.array(z.string()),
|
|
131
|
-
dataComponents: z.array(z.string()).optional(),
|
|
132
|
-
artifactComponents: z.array(z.string()).optional(),
|
|
133
|
-
canTransferTo: z.array(z.string()).optional(),
|
|
134
|
-
canDelegateTo: z.array(z.string()).optional(),
|
|
135
|
-
type: z.enum(["internal", "external"]).optional(),
|
|
136
|
-
models: z.object({
|
|
137
|
-
base: z.object({
|
|
138
|
-
model: z.string(),
|
|
139
|
-
providerOptions: z.record(z.string(), z.record(z.string(), z.unknown())).optional()
|
|
140
|
-
}).optional(),
|
|
141
|
-
structuredOutput: z.object({
|
|
142
|
-
model: z.string(),
|
|
143
|
-
providerOptions: z.record(z.string(), z.record(z.string(), z.unknown())).optional()
|
|
144
|
-
}).optional(),
|
|
145
|
-
summarizer: z.object({
|
|
146
|
-
model: z.string(),
|
|
147
|
-
providerOptions: z.record(z.string(), z.record(z.string(), z.unknown())).optional()
|
|
148
|
-
}).optional()
|
|
149
|
-
}).optional()
|
|
150
|
-
}),
|
|
129
|
+
FullGraphAgentInsertSchema,
|
|
151
130
|
ExternalAgentApiInsertSchema.extend({
|
|
152
131
|
id: z.string()
|
|
153
132
|
})
|
package/dist/db/schema.cjs
CHANGED
|
@@ -539,6 +539,7 @@ var apiKeys = sqliteCore.sqliteTable(
|
|
|
539
539
|
// Hashed API key (never store plaintext)
|
|
540
540
|
keyPrefix: sqliteCore.text("key_prefix").notNull(),
|
|
541
541
|
// First 8 chars for identification (e.g., "sk_live_abc...")
|
|
542
|
+
name: sqliteCore.text("name"),
|
|
542
543
|
lastUsedAt: sqliteCore.text("last_used_at"),
|
|
543
544
|
expiresAt: sqliteCore.text("expires_at"),
|
|
544
545
|
createdAt: sqliteCore.text("created_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`),
|
package/dist/db/schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { agentArtifactComponents, agentArtifactComponentsRelations, agentDataComponents, agentDataComponentsRelations, agentGraph, agentGraphRelations, agentRelations, agentRelationsRelations, agentToolRelations, agentToolRelationsRelations, agents, agentsRelations, apiKeys, apiKeysRelations, artifactComponents, artifactComponentsRelations, contextCache, contextCacheRelations, contextConfigs, contextConfigsRelations, conversations, conversationsRelations, credentialReferences, credentialReferencesRelations, dataComponents, dataComponentsRelations, externalAgents, externalAgentsRelations, ledgerArtifacts, ledgerArtifactsContextIdIdx, ledgerArtifactsRelations, ledgerArtifactsTaskContextNameUnique, ledgerArtifactsTaskIdIdx, messages, messagesRelations, projects, projectsRelations, taskRelations, taskRelationsRelations, tasks, tasksRelations, tools, toolsRelations } from '../chunk-
|
|
1
|
+
export { agentArtifactComponents, agentArtifactComponentsRelations, agentDataComponents, agentDataComponentsRelations, agentGraph, agentGraphRelations, agentRelations, agentRelationsRelations, agentToolRelations, agentToolRelationsRelations, agents, agentsRelations, apiKeys, apiKeysRelations, artifactComponents, artifactComponentsRelations, contextCache, contextCacheRelations, contextConfigs, contextConfigsRelations, conversations, conversationsRelations, credentialReferences, credentialReferencesRelations, dataComponents, dataComponentsRelations, externalAgents, externalAgentsRelations, ledgerArtifacts, ledgerArtifactsContextIdIdx, ledgerArtifactsRelations, ledgerArtifactsTaskContextNameUnique, ledgerArtifactsTaskIdIdx, messages, messagesRelations, projects, projectsRelations, taskRelations, taskRelationsRelations, tasks, tasksRelations, tools, toolsRelations } from '../chunk-TNFWLVL6.js';
|
package/dist/index.cjs
CHANGED
|
@@ -790,6 +790,7 @@ var apiKeys = sqliteCore.sqliteTable(
|
|
|
790
790
|
// Hashed API key (never store plaintext)
|
|
791
791
|
keyPrefix: sqliteCore.text("key_prefix").notNull(),
|
|
792
792
|
// First 8 chars for identification (e.g., "sk_live_abc...")
|
|
793
|
+
name: sqliteCore.text("name"),
|
|
793
794
|
lastUsedAt: sqliteCore.text("last_used_at"),
|
|
794
795
|
expiresAt: sqliteCore.text("expires_at"),
|
|
795
796
|
createdAt: sqliteCore.text("created_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`),
|
|
@@ -1423,8 +1424,6 @@ var ArtifactComponentApiInsertSchema = ArtifactComponentInsertSchema.omit({
|
|
|
1423
1424
|
projectId: true,
|
|
1424
1425
|
createdAt: true,
|
|
1425
1426
|
updatedAt: true
|
|
1426
|
-
}).extend({
|
|
1427
|
-
id: resourceIdSchema.optional()
|
|
1428
1427
|
});
|
|
1429
1428
|
var ArtifactComponentApiUpdateSchema = createApiUpdateSchema(
|
|
1430
1429
|
ArtifactComponentUpdateSchema
|
|
@@ -1644,10 +1643,13 @@ var StatusUpdateSchema = zodOpenapi.z.object({
|
|
|
1644
1643
|
prompt: zodOpenapi.z.string().max(2e3, "Custom prompt cannot exceed 2000 characters").optional(),
|
|
1645
1644
|
statusComponents: zodOpenapi.z.array(StatusComponentSchema).optional()
|
|
1646
1645
|
});
|
|
1646
|
+
var CanUseItemSchema = zodOpenapi.z.object({
|
|
1647
|
+
toolId: zodOpenapi.z.string(),
|
|
1648
|
+
toolSelection: zodOpenapi.z.array(zodOpenapi.z.string()).nullable().optional()
|
|
1649
|
+
});
|
|
1647
1650
|
var FullGraphAgentInsertSchema = AgentApiInsertSchema.extend({
|
|
1648
1651
|
type: zodOpenapi.z.literal("internal"),
|
|
1649
|
-
|
|
1650
|
-
selectedTools: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.array(zodOpenapi.z.string())).optional(),
|
|
1652
|
+
canUse: zodOpenapi.z.array(CanUseItemSchema),
|
|
1651
1653
|
dataComponents: zodOpenapi.z.array(zodOpenapi.z.string()).optional(),
|
|
1652
1654
|
artifactComponents: zodOpenapi.z.array(zodOpenapi.z.string()).optional(),
|
|
1653
1655
|
canTransferTo: zodOpenapi.z.array(zodOpenapi.z.string()).optional(),
|
|
@@ -2609,16 +2611,21 @@ var getRelatedAgentsForGraph = (db) => async (params) => {
|
|
|
2609
2611
|
name: agents.name,
|
|
2610
2612
|
description: agents.description,
|
|
2611
2613
|
relationType: agentRelations.relationType
|
|
2612
|
-
}).from(agentRelations).innerJoin(
|
|
2614
|
+
}).from(agentRelations).innerJoin(
|
|
2615
|
+
agents,
|
|
2616
|
+
drizzleOrm.and(
|
|
2617
|
+
drizzleOrm.eq(agentRelations.targetAgentId, agents.id),
|
|
2618
|
+
drizzleOrm.eq(agentRelations.tenantId, agents.tenantId),
|
|
2619
|
+
drizzleOrm.eq(agentRelations.projectId, agents.projectId),
|
|
2620
|
+
drizzleOrm.eq(agentRelations.graphId, agents.graphId)
|
|
2621
|
+
)
|
|
2622
|
+
).where(
|
|
2613
2623
|
drizzleOrm.and(
|
|
2614
2624
|
drizzleOrm.eq(agentRelations.tenantId, params.scopes.tenantId),
|
|
2615
2625
|
drizzleOrm.eq(agentRelations.projectId, params.scopes.projectId),
|
|
2616
2626
|
drizzleOrm.eq(agentRelations.graphId, params.scopes.graphId),
|
|
2617
2627
|
drizzleOrm.eq(agentRelations.sourceAgentId, params.agentId),
|
|
2618
|
-
drizzleOrm.isNotNull(agentRelations.targetAgentId)
|
|
2619
|
-
drizzleOrm.eq(agents.tenantId, params.scopes.tenantId),
|
|
2620
|
-
drizzleOrm.eq(agents.projectId, params.scopes.projectId),
|
|
2621
|
-
drizzleOrm.eq(agents.graphId, params.scopes.graphId)
|
|
2628
|
+
drizzleOrm.isNotNull(agentRelations.targetAgentId)
|
|
2622
2629
|
)
|
|
2623
2630
|
);
|
|
2624
2631
|
const externalRelations = await db.select({
|
|
@@ -2630,16 +2637,21 @@ var getRelatedAgentsForGraph = (db) => async (params) => {
|
|
|
2630
2637
|
description: externalAgents.description,
|
|
2631
2638
|
baseUrl: externalAgents.baseUrl
|
|
2632
2639
|
}
|
|
2633
|
-
}).from(agentRelations).innerJoin(
|
|
2640
|
+
}).from(agentRelations).innerJoin(
|
|
2641
|
+
externalAgents,
|
|
2642
|
+
drizzleOrm.and(
|
|
2643
|
+
drizzleOrm.eq(agentRelations.externalAgentId, externalAgents.id),
|
|
2644
|
+
drizzleOrm.eq(agentRelations.tenantId, externalAgents.tenantId),
|
|
2645
|
+
drizzleOrm.eq(agentRelations.projectId, externalAgents.projectId),
|
|
2646
|
+
drizzleOrm.eq(agentRelations.graphId, externalAgents.graphId)
|
|
2647
|
+
)
|
|
2648
|
+
).where(
|
|
2634
2649
|
drizzleOrm.and(
|
|
2635
2650
|
drizzleOrm.eq(agentRelations.tenantId, params.scopes.tenantId),
|
|
2636
2651
|
drizzleOrm.eq(agentRelations.projectId, params.scopes.projectId),
|
|
2637
2652
|
drizzleOrm.eq(agentRelations.graphId, params.scopes.graphId),
|
|
2638
2653
|
drizzleOrm.eq(agentRelations.sourceAgentId, params.agentId),
|
|
2639
|
-
drizzleOrm.isNotNull(agentRelations.externalAgentId)
|
|
2640
|
-
drizzleOrm.eq(externalAgents.tenantId, params.scopes.tenantId),
|
|
2641
|
-
drizzleOrm.eq(externalAgents.projectId, params.scopes.projectId),
|
|
2642
|
-
drizzleOrm.eq(externalAgents.graphId, params.scopes.graphId)
|
|
2654
|
+
drizzleOrm.isNotNull(agentRelations.externalAgentId)
|
|
2643
2655
|
)
|
|
2644
2656
|
);
|
|
2645
2657
|
return {
|
|
@@ -2902,7 +2914,14 @@ var getToolsForAgent = (db) => async (params) => {
|
|
|
2902
2914
|
availableTools: tools.availableTools,
|
|
2903
2915
|
credentialReferenceId: tools.credentialReferenceId
|
|
2904
2916
|
}
|
|
2905
|
-
}).from(agentToolRelations).innerJoin(
|
|
2917
|
+
}).from(agentToolRelations).innerJoin(
|
|
2918
|
+
tools,
|
|
2919
|
+
drizzleOrm.and(
|
|
2920
|
+
drizzleOrm.eq(agentToolRelations.tenantId, tools.tenantId),
|
|
2921
|
+
drizzleOrm.eq(agentToolRelations.projectId, tools.projectId),
|
|
2922
|
+
drizzleOrm.eq(agentToolRelations.toolId, tools.id)
|
|
2923
|
+
)
|
|
2924
|
+
).where(
|
|
2906
2925
|
drizzleOrm.and(
|
|
2907
2926
|
drizzleOrm.eq(agentToolRelations.tenantId, params.scopes.tenantId),
|
|
2908
2927
|
drizzleOrm.eq(agentToolRelations.projectId, params.scopes.projectId),
|
|
@@ -2950,7 +2969,15 @@ var getAgentsForTool = (db) => async (params) => {
|
|
|
2950
2969
|
createdAt: agents.createdAt,
|
|
2951
2970
|
updatedAt: agents.updatedAt
|
|
2952
2971
|
}
|
|
2953
|
-
}).from(agentToolRelations).innerJoin(
|
|
2972
|
+
}).from(agentToolRelations).innerJoin(
|
|
2973
|
+
agents,
|
|
2974
|
+
drizzleOrm.and(
|
|
2975
|
+
drizzleOrm.eq(agentToolRelations.agentId, agents.id),
|
|
2976
|
+
drizzleOrm.eq(agentToolRelations.tenantId, agents.tenantId),
|
|
2977
|
+
drizzleOrm.eq(agentToolRelations.projectId, agents.projectId),
|
|
2978
|
+
drizzleOrm.eq(agentToolRelations.graphId, agents.graphId)
|
|
2979
|
+
)
|
|
2980
|
+
).where(
|
|
2954
2981
|
drizzleOrm.and(
|
|
2955
2982
|
drizzleOrm.eq(agentToolRelations.tenantId, params.scopes.tenantId),
|
|
2956
2983
|
drizzleOrm.eq(agentToolRelations.projectId, params.scopes.projectId),
|
|
@@ -3637,8 +3664,20 @@ var getFullGraphDefinition = (db) => async ({
|
|
|
3637
3664
|
availableTools: tools.availableTools,
|
|
3638
3665
|
lastToolsSync: tools.lastToolsSync,
|
|
3639
3666
|
selectedTools: agentToolRelations.selectedTools
|
|
3640
|
-
}).from(agentToolRelations).innerJoin(
|
|
3641
|
-
|
|
3667
|
+
}).from(agentToolRelations).innerJoin(
|
|
3668
|
+
tools,
|
|
3669
|
+
drizzleOrm.and(
|
|
3670
|
+
drizzleOrm.eq(agentToolRelations.toolId, tools.id),
|
|
3671
|
+
drizzleOrm.eq(agentToolRelations.tenantId, tools.tenantId),
|
|
3672
|
+
drizzleOrm.eq(agentToolRelations.projectId, tools.projectId)
|
|
3673
|
+
)
|
|
3674
|
+
).where(
|
|
3675
|
+
drizzleOrm.and(
|
|
3676
|
+
drizzleOrm.eq(agentToolRelations.tenantId, tenantId),
|
|
3677
|
+
drizzleOrm.eq(agentToolRelations.projectId, projectId),
|
|
3678
|
+
drizzleOrm.eq(agentToolRelations.graphId, graphId),
|
|
3679
|
+
drizzleOrm.eq(agentToolRelations.agentId, agent.id)
|
|
3680
|
+
)
|
|
3642
3681
|
);
|
|
3643
3682
|
const agentDataComponentRelations = await db.query.agentDataComponents.findMany({
|
|
3644
3683
|
where: drizzleOrm.and(
|
|
@@ -3656,12 +3695,10 @@ var getFullGraphDefinition = (db) => async ({
|
|
|
3656
3695
|
const agentArtifactComponentIds = agentArtifactComponentRelations.map(
|
|
3657
3696
|
(rel) => rel.artifactComponentId
|
|
3658
3697
|
);
|
|
3659
|
-
const
|
|
3660
|
-
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
}
|
|
3664
|
-
});
|
|
3698
|
+
const canUse = agentTools.map((tool2) => ({
|
|
3699
|
+
toolId: tool2.id,
|
|
3700
|
+
toolSelection: tool2.selectedTools || null
|
|
3701
|
+
}));
|
|
3665
3702
|
return {
|
|
3666
3703
|
id: agent.id,
|
|
3667
3704
|
name: agent.name,
|
|
@@ -3673,20 +3710,8 @@ var getFullGraphDefinition = (db) => async ({
|
|
|
3673
3710
|
canDelegateTo,
|
|
3674
3711
|
dataComponents: agentDataComponentIds,
|
|
3675
3712
|
artifactComponents: agentArtifactComponentIds,
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
id: tool2.id,
|
|
3679
|
-
name: tool2.name,
|
|
3680
|
-
config: tool2.config,
|
|
3681
|
-
imageUrl: tool2.imageUrl || void 0,
|
|
3682
|
-
status: tool2.status,
|
|
3683
|
-
capabilities: tool2.capabilities || void 0,
|
|
3684
|
-
lastHealthCheck: tool2.lastHealthCheck && !Number.isNaN(new Date(tool2.lastHealthCheck).getTime()) ? new Date(tool2.lastHealthCheck).toISOString() : void 0,
|
|
3685
|
-
lastError: tool2.lastError || void 0,
|
|
3686
|
-
availableTools: tool2.availableTools || void 0,
|
|
3687
|
-
activeTools: tool2.config?.mcp?.activeTools || void 0,
|
|
3688
|
-
lastToolsSync: tool2.lastToolsSync && !Number.isNaN(new Date(tool2.lastToolsSync).getTime()) ? new Date(tool2.lastToolsSync).toISOString() : void 0
|
|
3689
|
-
}))
|
|
3713
|
+
canUse
|
|
3714
|
+
// Use the new canUse structure
|
|
3690
3715
|
};
|
|
3691
3716
|
})
|
|
3692
3717
|
);
|
|
@@ -3709,7 +3734,6 @@ var getFullGraphDefinition = (db) => async ({
|
|
|
3709
3734
|
(agent) => agent !== null
|
|
3710
3735
|
);
|
|
3711
3736
|
const agentsObject = {};
|
|
3712
|
-
const toolsObject = {};
|
|
3713
3737
|
for (const agent of validAgents) {
|
|
3714
3738
|
const isExternalAgent2 = "baseUrl" in agent && agent.baseUrl;
|
|
3715
3739
|
if (isExternalAgent2) {
|
|
@@ -3720,22 +3744,7 @@ var getFullGraphDefinition = (db) => async ({
|
|
|
3720
3744
|
baseUrl: agent.baseUrl
|
|
3721
3745
|
};
|
|
3722
3746
|
} else {
|
|
3723
|
-
|
|
3724
|
-
const toolIds = [];
|
|
3725
|
-
const agentSelectedTools = {};
|
|
3726
|
-
for (const tool2 of toolsData) {
|
|
3727
|
-
toolsObject[tool2.id] = tool2;
|
|
3728
|
-
toolIds.push(tool2.id);
|
|
3729
|
-
if (tool2.selectedTools !== null && tool2.selectedTools !== void 0) {
|
|
3730
|
-
agentSelectedTools[tool2.id] = tool2.selectedTools;
|
|
3731
|
-
}
|
|
3732
|
-
}
|
|
3733
|
-
agentsObject[agent.id] = {
|
|
3734
|
-
...agent,
|
|
3735
|
-
tools: toolIds,
|
|
3736
|
-
// Replace tool objects with tool IDs
|
|
3737
|
-
...Object.keys(agentSelectedTools).length > 0 && { selectedTools: agentSelectedTools }
|
|
3738
|
-
};
|
|
3747
|
+
agentsObject[agent.id] = agent;
|
|
3739
3748
|
}
|
|
3740
3749
|
}
|
|
3741
3750
|
let contextConfig2 = null;
|
|
@@ -3749,11 +3758,10 @@ var getFullGraphDefinition = (db) => async ({
|
|
|
3749
3758
|
console.warn(`Failed to retrieve contextConfig ${graph.contextConfigId}:`, error);
|
|
3750
3759
|
}
|
|
3751
3760
|
}
|
|
3752
|
-
let dataComponentsObject = {};
|
|
3753
3761
|
try {
|
|
3754
3762
|
const internalAgentIds = graphAgents.map((agent) => agent.id);
|
|
3755
3763
|
const agentIds = Array.from(internalAgentIds);
|
|
3756
|
-
|
|
3764
|
+
await fetchComponentRelationships(db)(
|
|
3757
3765
|
{ tenantId, projectId },
|
|
3758
3766
|
agentIds,
|
|
3759
3767
|
{
|
|
@@ -3772,11 +3780,10 @@ var getFullGraphDefinition = (db) => async ({
|
|
|
3772
3780
|
} catch (error) {
|
|
3773
3781
|
console.warn("Failed to retrieve dataComponents:", error);
|
|
3774
3782
|
}
|
|
3775
|
-
let artifactComponentsObject = {};
|
|
3776
3783
|
try {
|
|
3777
3784
|
const internalAgentIds = graphAgents.map((agent) => agent.id);
|
|
3778
3785
|
const agentIds = Array.from(internalAgentIds);
|
|
3779
|
-
|
|
3786
|
+
await fetchComponentRelationships(db)(
|
|
3780
3787
|
{ tenantId, projectId },
|
|
3781
3788
|
agentIds,
|
|
3782
3789
|
{
|
|
@@ -3802,7 +3809,7 @@ var getFullGraphDefinition = (db) => async ({
|
|
|
3802
3809
|
description: graph.description,
|
|
3803
3810
|
defaultAgentId: graph.defaultAgentId,
|
|
3804
3811
|
agents: agentsObject,
|
|
3805
|
-
tools
|
|
3812
|
+
// No tools field - tools are defined at project level
|
|
3806
3813
|
createdAt: graph.createdAt && !Number.isNaN(new Date(graph.createdAt).getTime()) ? new Date(graph.createdAt).toISOString() : (/* @__PURE__ */ new Date()).toISOString(),
|
|
3807
3814
|
updatedAt: graph.updatedAt && !Number.isNaN(new Date(graph.updatedAt).getTime()) ? new Date(graph.updatedAt).toISOString() : (/* @__PURE__ */ new Date()).toISOString()
|
|
3808
3815
|
};
|
|
@@ -3827,12 +3834,6 @@ var getFullGraphDefinition = (db) => async ({
|
|
|
3827
3834
|
contextVariables: contextConfig2.contextVariables
|
|
3828
3835
|
};
|
|
3829
3836
|
}
|
|
3830
|
-
if (Object.keys(dataComponentsObject).length > 0) {
|
|
3831
|
-
result.dataComponents = dataComponentsObject;
|
|
3832
|
-
}
|
|
3833
|
-
if (Object.keys(artifactComponentsObject).length > 0) {
|
|
3834
|
-
result.artifactComponents = artifactComponentsObject;
|
|
3835
|
-
}
|
|
3836
3837
|
try {
|
|
3837
3838
|
if (!db.query?.projects?.findFirst) {
|
|
3838
3839
|
return result;
|
|
@@ -4035,6 +4036,7 @@ var createApiKey = (db) => async (params) => {
|
|
|
4035
4036
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
4036
4037
|
const [apiKey] = await db.insert(apiKeys).values({
|
|
4037
4038
|
id: params.id,
|
|
4039
|
+
name: params.name,
|
|
4038
4040
|
tenantId: params.tenantId,
|
|
4039
4041
|
projectId: params.projectId,
|
|
4040
4042
|
graphId: params.graphId,
|
|
@@ -4050,6 +4052,7 @@ var createApiKey = (db) => async (params) => {
|
|
|
4050
4052
|
var updateApiKey = (db) => async (params) => {
|
|
4051
4053
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
4052
4054
|
const [updatedKey] = await db.update(apiKeys).set({
|
|
4055
|
+
name: params.data.name,
|
|
4053
4056
|
expiresAt: params.data.expiresAt,
|
|
4054
4057
|
updatedAt: now
|
|
4055
4058
|
}).where(
|
|
@@ -4103,12 +4106,13 @@ var countApiKeys = (db) => async (params) => {
|
|
|
4103
4106
|
return typeof total === "string" ? Number.parseInt(total, 10) : total;
|
|
4104
4107
|
};
|
|
4105
4108
|
var generateAndCreateApiKey = async (params, db) => {
|
|
4106
|
-
const { tenantId, projectId, graphId, expiresAt } = params;
|
|
4109
|
+
const { tenantId, projectId, graphId, expiresAt, name } = params;
|
|
4107
4110
|
const keyData = await generateApiKey();
|
|
4108
4111
|
const apiKey = await createApiKey(db)({
|
|
4109
4112
|
tenantId,
|
|
4110
4113
|
projectId,
|
|
4111
4114
|
graphId,
|
|
4115
|
+
name,
|
|
4112
4116
|
expiresAt,
|
|
4113
4117
|
...keyData
|
|
4114
4118
|
});
|
|
@@ -4304,7 +4308,21 @@ var isArtifactComponentAssociatedWithAgent = (db) => async (params) => {
|
|
|
4304
4308
|
return result.length > 0;
|
|
4305
4309
|
};
|
|
4306
4310
|
var graphHasArtifactComponents = (db) => async (params) => {
|
|
4307
|
-
const result = await db.select({ count: drizzleOrm.count() }).from(agentArtifactComponents).innerJoin(
|
|
4311
|
+
const result = await db.select({ count: drizzleOrm.count() }).from(agentArtifactComponents).innerJoin(
|
|
4312
|
+
agents,
|
|
4313
|
+
drizzleOrm.and(
|
|
4314
|
+
drizzleOrm.eq(agentArtifactComponents.agentId, agents.id),
|
|
4315
|
+
drizzleOrm.eq(agentArtifactComponents.tenantId, agents.tenantId)
|
|
4316
|
+
)
|
|
4317
|
+
).innerJoin(
|
|
4318
|
+
agentRelations,
|
|
4319
|
+
drizzleOrm.and(
|
|
4320
|
+
drizzleOrm.eq(agents.id, agentRelations.sourceAgentId),
|
|
4321
|
+
drizzleOrm.eq(agents.tenantId, agentRelations.tenantId),
|
|
4322
|
+
drizzleOrm.eq(agents.projectId, agentRelations.projectId),
|
|
4323
|
+
drizzleOrm.eq(agents.graphId, agentRelations.graphId)
|
|
4324
|
+
)
|
|
4325
|
+
).where(
|
|
4308
4326
|
drizzleOrm.and(
|
|
4309
4327
|
drizzleOrm.eq(agentArtifactComponents.tenantId, params.scopes.tenantId),
|
|
4310
4328
|
drizzleOrm.eq(agentArtifactComponents.projectId, params.scopes.projectId),
|
|
@@ -5067,10 +5085,10 @@ function validateToolReferences(graphData, availableToolIds) {
|
|
|
5067
5085
|
}
|
|
5068
5086
|
const errors = [];
|
|
5069
5087
|
for (const [agentId, agentData] of Object.entries(graphData.agents)) {
|
|
5070
|
-
if (isInternalAgent(agentData) && agentData.
|
|
5071
|
-
for (const
|
|
5072
|
-
if (!availableToolIds.has(toolId)) {
|
|
5073
|
-
errors.push(`Agent '${agentId}' references non-existent tool '${toolId}'`);
|
|
5088
|
+
if (isInternalAgent(agentData) && agentData.canUse && Array.isArray(agentData.canUse)) {
|
|
5089
|
+
for (const canUseItem of agentData.canUse) {
|
|
5090
|
+
if (!availableToolIds.has(canUseItem.toolId)) {
|
|
5091
|
+
errors.push(`Agent '${agentId}' references non-existent tool '${canUseItem.toolId}'`);
|
|
5074
5092
|
}
|
|
5075
5093
|
}
|
|
5076
5094
|
}
|
|
@@ -5605,22 +5623,22 @@ var createFullGraphServerSide = (db, logger11 = defaultLogger) => async (scopes,
|
|
|
5605
5623
|
}
|
|
5606
5624
|
const agentToolPromises = [];
|
|
5607
5625
|
for (const [agentId, agentData] of Object.entries(typed.agents)) {
|
|
5608
|
-
if (isInternalAgent(agentData) && agentData.
|
|
5609
|
-
for (const
|
|
5626
|
+
if (isInternalAgent(agentData) && agentData.canUse && Array.isArray(agentData.canUse)) {
|
|
5627
|
+
for (const canUseItem of agentData.canUse) {
|
|
5610
5628
|
agentToolPromises.push(
|
|
5611
5629
|
(async () => {
|
|
5612
5630
|
try {
|
|
5613
|
-
const
|
|
5631
|
+
const { toolId, toolSelection } = canUseItem;
|
|
5614
5632
|
logger11.info({ agentId, toolId }, "Processing agent-tool relation");
|
|
5615
5633
|
await upsertAgentToolRelation(db)({
|
|
5616
5634
|
scopes: { tenantId, projectId, graphId: finalGraphId },
|
|
5617
5635
|
agentId,
|
|
5618
5636
|
toolId,
|
|
5619
|
-
selectedTools
|
|
5637
|
+
selectedTools: toolSelection || void 0
|
|
5620
5638
|
});
|
|
5621
5639
|
logger11.info({ agentId, toolId }, "Agent-tool relation processed successfully");
|
|
5622
5640
|
} catch (error) {
|
|
5623
|
-
logger11.error({ agentId, toolId, error }, "Failed to create agent-tool relation");
|
|
5641
|
+
logger11.error({ agentId, toolId: canUseItem.toolId, error }, "Failed to create agent-tool relation");
|
|
5624
5642
|
}
|
|
5625
5643
|
})()
|
|
5626
5644
|
);
|
|
@@ -5998,23 +6016,23 @@ var updateFullGraphServerSide = (db, logger11 = defaultLogger) => async (scopes,
|
|
|
5998
6016
|
}
|
|
5999
6017
|
const agentToolPromises = [];
|
|
6000
6018
|
for (const [agentId, agentData] of Object.entries(typedGraphDefinition.agents)) {
|
|
6001
|
-
if (isInternalAgent(agentData) && agentData.
|
|
6002
|
-
for (const
|
|
6019
|
+
if (isInternalAgent(agentData) && agentData.canUse && Array.isArray(agentData.canUse)) {
|
|
6020
|
+
for (const canUseItem of agentData.canUse) {
|
|
6003
6021
|
agentToolPromises.push(
|
|
6004
6022
|
(async () => {
|
|
6005
6023
|
try {
|
|
6006
|
-
const
|
|
6024
|
+
const { toolId, toolSelection } = canUseItem;
|
|
6007
6025
|
await createAgentToolRelation(db)({
|
|
6008
6026
|
scopes: { tenantId, projectId, graphId: finalGraphId },
|
|
6009
6027
|
data: {
|
|
6010
6028
|
agentId,
|
|
6011
6029
|
toolId,
|
|
6012
|
-
selectedTools
|
|
6030
|
+
selectedTools: toolSelection || void 0
|
|
6013
6031
|
}
|
|
6014
6032
|
});
|
|
6015
6033
|
logger11.info({ agentId, toolId }, "Agent-tool relation created");
|
|
6016
6034
|
} catch (error) {
|
|
6017
|
-
logger11.error({ agentId, toolId, error }, "Failed to create agent-tool relation");
|
|
6035
|
+
logger11.error({ agentId, toolId: canUseItem.toolId, error }, "Failed to create agent-tool relation");
|
|
6018
6036
|
}
|
|
6019
6037
|
})()
|
|
6020
6038
|
);
|
|
@@ -6878,7 +6896,6 @@ var createFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
|
|
|
6878
6896
|
);
|
|
6879
6897
|
await upsertArtifactComponent(db)({
|
|
6880
6898
|
data: {
|
|
6881
|
-
id: componentId,
|
|
6882
6899
|
...componentData,
|
|
6883
6900
|
tenantId,
|
|
6884
6901
|
projectId: typed.id
|
|
@@ -7184,7 +7201,6 @@ var updateFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
|
|
|
7184
7201
|
);
|
|
7185
7202
|
await upsertArtifactComponent(db)({
|
|
7186
7203
|
data: {
|
|
7187
|
-
id: componentId,
|
|
7188
7204
|
...componentData,
|
|
7189
7205
|
tenantId,
|
|
7190
7206
|
projectId: typed.id
|
|
@@ -7310,14 +7326,10 @@ var getFullProject = (db, logger11 = defaultLogger2) => async (params) => {
|
|
|
7310
7326
|
id: tool2.id,
|
|
7311
7327
|
name: tool2.name,
|
|
7312
7328
|
config: tool2.config,
|
|
7313
|
-
|
|
7314
|
-
|
|
7315
|
-
|
|
7316
|
-
|
|
7317
|
-
lastError: tool2.lastError || void 0,
|
|
7318
|
-
availableTools: tool2.availableTools || void 0,
|
|
7319
|
-
activeTools: tool2.config?.mcp?.activeTools || void 0,
|
|
7320
|
-
lastToolsSync: tool2.lastToolsSync && !Number.isNaN(new Date(tool2.lastToolsSync).getTime()) ? new Date(tool2.lastToolsSync).toISOString() : void 0
|
|
7329
|
+
credentialReferenceId: tool2.credentialReferenceId || void 0,
|
|
7330
|
+
imageUrl: tool2.imageUrl || void 0
|
|
7331
|
+
// Don't include runtime fields in configuration
|
|
7332
|
+
// status, capabilities, lastHealthCheck, lastError, availableTools, activeTools, lastToolsSync are all runtime
|
|
7321
7333
|
};
|
|
7322
7334
|
}
|
|
7323
7335
|
logger11.info(
|
|
@@ -10233,7 +10245,7 @@ var loadEnvironmentFiles = () => {
|
|
|
10233
10245
|
loadEnvironmentFiles();
|
|
10234
10246
|
var envSchema = zod.z.object({
|
|
10235
10247
|
ENVIRONMENT: zod.z.enum(["development", "production", "pentest", "test"]).optional(),
|
|
10236
|
-
DB_FILE_NAME: zod.z.string(),
|
|
10248
|
+
DB_FILE_NAME: zod.z.string().optional(),
|
|
10237
10249
|
OTEL_TRACES_FORCE_FLUSH_ENABLED: zod.z.coerce.boolean().optional()
|
|
10238
10250
|
});
|
|
10239
10251
|
var parseEnv = () => {
|
|
@@ -10323,6 +10335,7 @@ exports.ArtifactComponentApiUpdateSchema = ArtifactComponentApiUpdateSchema;
|
|
|
10323
10335
|
exports.ArtifactComponentInsertSchema = ArtifactComponentInsertSchema;
|
|
10324
10336
|
exports.ArtifactComponentSelectSchema = ArtifactComponentSelectSchema;
|
|
10325
10337
|
exports.ArtifactComponentUpdateSchema = ArtifactComponentUpdateSchema;
|
|
10338
|
+
exports.CanUseItemSchema = CanUseItemSchema;
|
|
10326
10339
|
exports.ContextCache = ContextCache;
|
|
10327
10340
|
exports.ContextCacheApiInsertSchema = ContextCacheApiInsertSchema;
|
|
10328
10341
|
exports.ContextCacheApiSelectSchema = ContextCacheApiSelectSchema;
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { validateAndTypeGraphData, validateGraphStructure, isInternalAgent, isExternalAgent } from './chunk-XQRFKXVV.js';
|
|
2
|
-
export { generateIdFromName, isExternalAgent, isInternalAgent, isValidResourceId, validateAgentRelationships, validateAndTypeGraphData, validateArtifactComponentReferences, validateDataComponentReferences, validateGraphStructure, validateToolReferences } from './chunk-XQRFKXVV.js';
|
|
3
|
-
import { ContextConfigApiUpdateSchema } from './chunk-LPIKPCE5.js';
|
|
4
|
-
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, AgentStopWhenSchema, 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, FullProjectDefinitionSchema, GraphStopWhenSchema, GraphWithinContextOfProjectSchema, 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, StopWhenSchema, TaskApiInsertSchema, TaskApiSelectSchema, TaskApiUpdateSchema, TaskInsertSchema, TaskRelationApiInsertSchema, TaskRelationApiSelectSchema, TaskRelationApiUpdateSchema, TaskRelationInsertSchema, TaskRelationSelectSchema, TaskRelationUpdateSchema, TaskSelectSchema, TaskUpdateSchema, TenantIdParamsSchema, TenantParamsSchema, TenantProjectGraphIdParamsSchema, TenantProjectGraphParamsSchema, TenantProjectIdParamsSchema, TenantProjectParamsSchema, ToolApiInsertSchema, ToolApiSelectSchema, ToolApiUpdateSchema, ToolInsertSchema, ToolSelectSchema, ToolStatusSchema, ToolUpdateSchema, URL_SAFE_ID_PATTERN, resourceIdSchema } from './chunk-LPIKPCE5.js';
|
|
5
1
|
export { TaskState } from './chunk-H2F72PDA.js';
|
|
2
|
+
import { validateAndTypeGraphData, validateGraphStructure, isInternalAgent, isExternalAgent } from './chunk-T5JVBY6K.js';
|
|
3
|
+
export { generateIdFromName, isExternalAgent, isInternalAgent, isValidResourceId, validateAgentRelationships, validateAndTypeGraphData, validateArtifactComponentReferences, validateDataComponentReferences, validateGraphStructure, validateToolReferences } from './chunk-T5JVBY6K.js';
|
|
4
|
+
import { ContextConfigApiUpdateSchema } from './chunk-7OCPFKGI.js';
|
|
5
|
+
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, AgentStopWhenSchema, AgentToolRelationApiInsertSchema, AgentToolRelationApiSelectSchema, AgentToolRelationApiUpdateSchema, AgentToolRelationInsertSchema, AgentToolRelationSelectSchema, AgentToolRelationUpdateSchema, AgentUpdateSchema, 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, ExternalAgentRelationApiInsertSchema, ExternalAgentRelationInsertSchema, ExternalAgentSelectSchema, ExternalAgentUpdateSchema, FetchConfigSchema, FetchDefinitionSchema, FullGraphAgentInsertSchema, FullGraphDefinitionSchema, FullProjectDefinitionSchema, GraphStopWhenSchema, GraphWithinContextOfProjectSchema, 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, StopWhenSchema, TaskApiInsertSchema, TaskApiSelectSchema, TaskApiUpdateSchema, TaskInsertSchema, TaskRelationApiInsertSchema, TaskRelationApiSelectSchema, TaskRelationApiUpdateSchema, TaskRelationInsertSchema, TaskRelationSelectSchema, TaskRelationUpdateSchema, TaskSelectSchema, TaskUpdateSchema, TenantIdParamsSchema, TenantParamsSchema, TenantProjectGraphIdParamsSchema, TenantProjectGraphParamsSchema, TenantProjectIdParamsSchema, TenantProjectParamsSchema, ToolApiInsertSchema, ToolApiSelectSchema, ToolApiUpdateSchema, ToolInsertSchema, ToolSelectSchema, ToolStatusSchema, ToolUpdateSchema, URL_SAFE_ID_PATTERN, resourceIdSchema } from './chunk-7OCPFKGI.js';
|
|
6
|
+
import { schema_exports, agentRelations, agents, externalAgents, agentToolRelations, tools, contextConfigs, agentGraph, agentDataComponents, agentArtifactComponents, dataComponents, artifactComponents, projects, apiKeys, contextCache, conversations, messages, credentialReferences, ledgerArtifacts, tasks, taskRelations } from './chunk-TNFWLVL6.js';
|
|
7
|
+
export { agentArtifactComponents, agentArtifactComponentsRelations, agentDataComponents, agentDataComponentsRelations, agentGraph, agentGraphRelations, agentRelations, agentRelationsRelations, agentToolRelations, agentToolRelationsRelations, agents, agentsRelations, apiKeys, apiKeysRelations, artifactComponents, artifactComponentsRelations, contextCache, contextCacheRelations, contextConfigs, contextConfigsRelations, conversations, conversationsRelations, credentialReferences, credentialReferencesRelations, dataComponents, dataComponentsRelations, externalAgents, externalAgentsRelations, ledgerArtifacts, ledgerArtifactsContextIdIdx, ledgerArtifactsRelations, ledgerArtifactsTaskContextNameUnique, ledgerArtifactsTaskIdIdx, messages, messagesRelations, projects, projectsRelations, taskRelations, taskRelationsRelations, tasks, tasksRelations, tools, toolsRelations } from './chunk-TNFWLVL6.js';
|
|
6
8
|
import { CredentialStoreType, MCPServerType, MCPTransportType } from './chunk-SVGQSPW4.js';
|
|
7
9
|
export { CredentialStoreType, MCPServerType, MCPTransportType, TOOL_STATUS_VALUES, VALID_RELATION_TYPES } from './chunk-SVGQSPW4.js';
|
|
8
|
-
import { schema_exports, agentRelations, agents, externalAgents, agentToolRelations, tools, contextConfigs, agentGraph, agentDataComponents, agentArtifactComponents, dataComponents, artifactComponents, projects, apiKeys, contextCache, conversations, messages, credentialReferences, ledgerArtifacts, tasks, taskRelations } from './chunk-LFWFXR4O.js';
|
|
9
|
-
export { agentArtifactComponents, agentArtifactComponentsRelations, agentDataComponents, agentDataComponentsRelations, agentGraph, agentGraphRelations, agentRelations, agentRelationsRelations, agentToolRelations, agentToolRelationsRelations, agents, agentsRelations, apiKeys, apiKeysRelations, artifactComponents, artifactComponentsRelations, contextCache, contextCacheRelations, contextConfigs, contextConfigsRelations, conversations, conversationsRelations, credentialReferences, credentialReferencesRelations, dataComponents, dataComponentsRelations, externalAgents, externalAgentsRelations, ledgerArtifacts, ledgerArtifactsContextIdIdx, ledgerArtifactsRelations, ledgerArtifactsTaskContextNameUnique, ledgerArtifactsTaskIdIdx, messages, messagesRelations, projects, projectsRelations, taskRelations, taskRelationsRelations, tasks, tasksRelations, tools, toolsRelations } from './chunk-LFWFXR4O.js';
|
|
10
10
|
import { __publicField } from './chunk-MKBO26DX.js';
|
|
11
11
|
import { z as z$1 } from 'zod';
|
|
12
12
|
import pino from 'pino';
|
|
@@ -981,16 +981,21 @@ var getRelatedAgentsForGraph = (db) => async (params) => {
|
|
|
981
981
|
name: agents.name,
|
|
982
982
|
description: agents.description,
|
|
983
983
|
relationType: agentRelations.relationType
|
|
984
|
-
}).from(agentRelations).innerJoin(
|
|
984
|
+
}).from(agentRelations).innerJoin(
|
|
985
|
+
agents,
|
|
986
|
+
and(
|
|
987
|
+
eq(agentRelations.targetAgentId, agents.id),
|
|
988
|
+
eq(agentRelations.tenantId, agents.tenantId),
|
|
989
|
+
eq(agentRelations.projectId, agents.projectId),
|
|
990
|
+
eq(agentRelations.graphId, agents.graphId)
|
|
991
|
+
)
|
|
992
|
+
).where(
|
|
985
993
|
and(
|
|
986
994
|
eq(agentRelations.tenantId, params.scopes.tenantId),
|
|
987
995
|
eq(agentRelations.projectId, params.scopes.projectId),
|
|
988
996
|
eq(agentRelations.graphId, params.scopes.graphId),
|
|
989
997
|
eq(agentRelations.sourceAgentId, params.agentId),
|
|
990
|
-
isNotNull(agentRelations.targetAgentId)
|
|
991
|
-
eq(agents.tenantId, params.scopes.tenantId),
|
|
992
|
-
eq(agents.projectId, params.scopes.projectId),
|
|
993
|
-
eq(agents.graphId, params.scopes.graphId)
|
|
998
|
+
isNotNull(agentRelations.targetAgentId)
|
|
994
999
|
)
|
|
995
1000
|
);
|
|
996
1001
|
const externalRelations = await db.select({
|
|
@@ -1002,16 +1007,21 @@ var getRelatedAgentsForGraph = (db) => async (params) => {
|
|
|
1002
1007
|
description: externalAgents.description,
|
|
1003
1008
|
baseUrl: externalAgents.baseUrl
|
|
1004
1009
|
}
|
|
1005
|
-
}).from(agentRelations).innerJoin(
|
|
1010
|
+
}).from(agentRelations).innerJoin(
|
|
1011
|
+
externalAgents,
|
|
1012
|
+
and(
|
|
1013
|
+
eq(agentRelations.externalAgentId, externalAgents.id),
|
|
1014
|
+
eq(agentRelations.tenantId, externalAgents.tenantId),
|
|
1015
|
+
eq(agentRelations.projectId, externalAgents.projectId),
|
|
1016
|
+
eq(agentRelations.graphId, externalAgents.graphId)
|
|
1017
|
+
)
|
|
1018
|
+
).where(
|
|
1006
1019
|
and(
|
|
1007
1020
|
eq(agentRelations.tenantId, params.scopes.tenantId),
|
|
1008
1021
|
eq(agentRelations.projectId, params.scopes.projectId),
|
|
1009
1022
|
eq(agentRelations.graphId, params.scopes.graphId),
|
|
1010
1023
|
eq(agentRelations.sourceAgentId, params.agentId),
|
|
1011
|
-
isNotNull(agentRelations.externalAgentId)
|
|
1012
|
-
eq(externalAgents.tenantId, params.scopes.tenantId),
|
|
1013
|
-
eq(externalAgents.projectId, params.scopes.projectId),
|
|
1014
|
-
eq(externalAgents.graphId, params.scopes.graphId)
|
|
1024
|
+
isNotNull(agentRelations.externalAgentId)
|
|
1015
1025
|
)
|
|
1016
1026
|
);
|
|
1017
1027
|
return {
|
|
@@ -1274,7 +1284,14 @@ var getToolsForAgent = (db) => async (params) => {
|
|
|
1274
1284
|
availableTools: tools.availableTools,
|
|
1275
1285
|
credentialReferenceId: tools.credentialReferenceId
|
|
1276
1286
|
}
|
|
1277
|
-
}).from(agentToolRelations).innerJoin(
|
|
1287
|
+
}).from(agentToolRelations).innerJoin(
|
|
1288
|
+
tools,
|
|
1289
|
+
and(
|
|
1290
|
+
eq(agentToolRelations.tenantId, tools.tenantId),
|
|
1291
|
+
eq(agentToolRelations.projectId, tools.projectId),
|
|
1292
|
+
eq(agentToolRelations.toolId, tools.id)
|
|
1293
|
+
)
|
|
1294
|
+
).where(
|
|
1278
1295
|
and(
|
|
1279
1296
|
eq(agentToolRelations.tenantId, params.scopes.tenantId),
|
|
1280
1297
|
eq(agentToolRelations.projectId, params.scopes.projectId),
|
|
@@ -1322,7 +1339,15 @@ var getAgentsForTool = (db) => async (params) => {
|
|
|
1322
1339
|
createdAt: agents.createdAt,
|
|
1323
1340
|
updatedAt: agents.updatedAt
|
|
1324
1341
|
}
|
|
1325
|
-
}).from(agentToolRelations).innerJoin(
|
|
1342
|
+
}).from(agentToolRelations).innerJoin(
|
|
1343
|
+
agents,
|
|
1344
|
+
and(
|
|
1345
|
+
eq(agentToolRelations.agentId, agents.id),
|
|
1346
|
+
eq(agentToolRelations.tenantId, agents.tenantId),
|
|
1347
|
+
eq(agentToolRelations.projectId, agents.projectId),
|
|
1348
|
+
eq(agentToolRelations.graphId, agents.graphId)
|
|
1349
|
+
)
|
|
1350
|
+
).where(
|
|
1326
1351
|
and(
|
|
1327
1352
|
eq(agentToolRelations.tenantId, params.scopes.tenantId),
|
|
1328
1353
|
eq(agentToolRelations.projectId, params.scopes.projectId),
|
|
@@ -2009,8 +2034,20 @@ var getFullGraphDefinition = (db) => async ({
|
|
|
2009
2034
|
availableTools: tools.availableTools,
|
|
2010
2035
|
lastToolsSync: tools.lastToolsSync,
|
|
2011
2036
|
selectedTools: agentToolRelations.selectedTools
|
|
2012
|
-
}).from(agentToolRelations).innerJoin(
|
|
2013
|
-
|
|
2037
|
+
}).from(agentToolRelations).innerJoin(
|
|
2038
|
+
tools,
|
|
2039
|
+
and(
|
|
2040
|
+
eq(agentToolRelations.toolId, tools.id),
|
|
2041
|
+
eq(agentToolRelations.tenantId, tools.tenantId),
|
|
2042
|
+
eq(agentToolRelations.projectId, tools.projectId)
|
|
2043
|
+
)
|
|
2044
|
+
).where(
|
|
2045
|
+
and(
|
|
2046
|
+
eq(agentToolRelations.tenantId, tenantId),
|
|
2047
|
+
eq(agentToolRelations.projectId, projectId),
|
|
2048
|
+
eq(agentToolRelations.graphId, graphId),
|
|
2049
|
+
eq(agentToolRelations.agentId, agent.id)
|
|
2050
|
+
)
|
|
2014
2051
|
);
|
|
2015
2052
|
const agentDataComponentRelations = await db.query.agentDataComponents.findMany({
|
|
2016
2053
|
where: and(
|
|
@@ -2028,12 +2065,10 @@ var getFullGraphDefinition = (db) => async ({
|
|
|
2028
2065
|
const agentArtifactComponentIds = agentArtifactComponentRelations.map(
|
|
2029
2066
|
(rel) => rel.artifactComponentId
|
|
2030
2067
|
);
|
|
2031
|
-
const
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
}
|
|
2036
|
-
});
|
|
2068
|
+
const canUse = agentTools.map((tool2) => ({
|
|
2069
|
+
toolId: tool2.id,
|
|
2070
|
+
toolSelection: tool2.selectedTools || null
|
|
2071
|
+
}));
|
|
2037
2072
|
return {
|
|
2038
2073
|
id: agent.id,
|
|
2039
2074
|
name: agent.name,
|
|
@@ -2045,20 +2080,8 @@ var getFullGraphDefinition = (db) => async ({
|
|
|
2045
2080
|
canDelegateTo,
|
|
2046
2081
|
dataComponents: agentDataComponentIds,
|
|
2047
2082
|
artifactComponents: agentArtifactComponentIds,
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
id: tool2.id,
|
|
2051
|
-
name: tool2.name,
|
|
2052
|
-
config: tool2.config,
|
|
2053
|
-
imageUrl: tool2.imageUrl || void 0,
|
|
2054
|
-
status: tool2.status,
|
|
2055
|
-
capabilities: tool2.capabilities || void 0,
|
|
2056
|
-
lastHealthCheck: tool2.lastHealthCheck && !Number.isNaN(new Date(tool2.lastHealthCheck).getTime()) ? new Date(tool2.lastHealthCheck).toISOString() : void 0,
|
|
2057
|
-
lastError: tool2.lastError || void 0,
|
|
2058
|
-
availableTools: tool2.availableTools || void 0,
|
|
2059
|
-
activeTools: tool2.config?.mcp?.activeTools || void 0,
|
|
2060
|
-
lastToolsSync: tool2.lastToolsSync && !Number.isNaN(new Date(tool2.lastToolsSync).getTime()) ? new Date(tool2.lastToolsSync).toISOString() : void 0
|
|
2061
|
-
}))
|
|
2083
|
+
canUse
|
|
2084
|
+
// Use the new canUse structure
|
|
2062
2085
|
};
|
|
2063
2086
|
})
|
|
2064
2087
|
);
|
|
@@ -2081,7 +2104,6 @@ var getFullGraphDefinition = (db) => async ({
|
|
|
2081
2104
|
(agent) => agent !== null
|
|
2082
2105
|
);
|
|
2083
2106
|
const agentsObject = {};
|
|
2084
|
-
const toolsObject = {};
|
|
2085
2107
|
for (const agent of validAgents) {
|
|
2086
2108
|
const isExternalAgent2 = "baseUrl" in agent && agent.baseUrl;
|
|
2087
2109
|
if (isExternalAgent2) {
|
|
@@ -2092,22 +2114,7 @@ var getFullGraphDefinition = (db) => async ({
|
|
|
2092
2114
|
baseUrl: agent.baseUrl
|
|
2093
2115
|
};
|
|
2094
2116
|
} else {
|
|
2095
|
-
|
|
2096
|
-
const toolIds = [];
|
|
2097
|
-
const agentSelectedTools = {};
|
|
2098
|
-
for (const tool2 of toolsData) {
|
|
2099
|
-
toolsObject[tool2.id] = tool2;
|
|
2100
|
-
toolIds.push(tool2.id);
|
|
2101
|
-
if (tool2.selectedTools !== null && tool2.selectedTools !== void 0) {
|
|
2102
|
-
agentSelectedTools[tool2.id] = tool2.selectedTools;
|
|
2103
|
-
}
|
|
2104
|
-
}
|
|
2105
|
-
agentsObject[agent.id] = {
|
|
2106
|
-
...agent,
|
|
2107
|
-
tools: toolIds,
|
|
2108
|
-
// Replace tool objects with tool IDs
|
|
2109
|
-
...Object.keys(agentSelectedTools).length > 0 && { selectedTools: agentSelectedTools }
|
|
2110
|
-
};
|
|
2117
|
+
agentsObject[agent.id] = agent;
|
|
2111
2118
|
}
|
|
2112
2119
|
}
|
|
2113
2120
|
let contextConfig2 = null;
|
|
@@ -2121,11 +2128,10 @@ var getFullGraphDefinition = (db) => async ({
|
|
|
2121
2128
|
console.warn(`Failed to retrieve contextConfig ${graph.contextConfigId}:`, error);
|
|
2122
2129
|
}
|
|
2123
2130
|
}
|
|
2124
|
-
let dataComponentsObject = {};
|
|
2125
2131
|
try {
|
|
2126
2132
|
const internalAgentIds = graphAgents.map((agent) => agent.id);
|
|
2127
2133
|
const agentIds = Array.from(internalAgentIds);
|
|
2128
|
-
|
|
2134
|
+
await fetchComponentRelationships(db)(
|
|
2129
2135
|
{ tenantId, projectId },
|
|
2130
2136
|
agentIds,
|
|
2131
2137
|
{
|
|
@@ -2144,11 +2150,10 @@ var getFullGraphDefinition = (db) => async ({
|
|
|
2144
2150
|
} catch (error) {
|
|
2145
2151
|
console.warn("Failed to retrieve dataComponents:", error);
|
|
2146
2152
|
}
|
|
2147
|
-
let artifactComponentsObject = {};
|
|
2148
2153
|
try {
|
|
2149
2154
|
const internalAgentIds = graphAgents.map((agent) => agent.id);
|
|
2150
2155
|
const agentIds = Array.from(internalAgentIds);
|
|
2151
|
-
|
|
2156
|
+
await fetchComponentRelationships(db)(
|
|
2152
2157
|
{ tenantId, projectId },
|
|
2153
2158
|
agentIds,
|
|
2154
2159
|
{
|
|
@@ -2174,7 +2179,7 @@ var getFullGraphDefinition = (db) => async ({
|
|
|
2174
2179
|
description: graph.description,
|
|
2175
2180
|
defaultAgentId: graph.defaultAgentId,
|
|
2176
2181
|
agents: agentsObject,
|
|
2177
|
-
tools
|
|
2182
|
+
// No tools field - tools are defined at project level
|
|
2178
2183
|
createdAt: graph.createdAt && !Number.isNaN(new Date(graph.createdAt).getTime()) ? new Date(graph.createdAt).toISOString() : (/* @__PURE__ */ new Date()).toISOString(),
|
|
2179
2184
|
updatedAt: graph.updatedAt && !Number.isNaN(new Date(graph.updatedAt).getTime()) ? new Date(graph.updatedAt).toISOString() : (/* @__PURE__ */ new Date()).toISOString()
|
|
2180
2185
|
};
|
|
@@ -2199,12 +2204,6 @@ var getFullGraphDefinition = (db) => async ({
|
|
|
2199
2204
|
contextVariables: contextConfig2.contextVariables
|
|
2200
2205
|
};
|
|
2201
2206
|
}
|
|
2202
|
-
if (Object.keys(dataComponentsObject).length > 0) {
|
|
2203
|
-
result.dataComponents = dataComponentsObject;
|
|
2204
|
-
}
|
|
2205
|
-
if (Object.keys(artifactComponentsObject).length > 0) {
|
|
2206
|
-
result.artifactComponents = artifactComponentsObject;
|
|
2207
|
-
}
|
|
2208
2207
|
try {
|
|
2209
2208
|
if (!db.query?.projects?.findFirst) {
|
|
2210
2209
|
return result;
|
|
@@ -2407,6 +2406,7 @@ var createApiKey = (db) => async (params) => {
|
|
|
2407
2406
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
2408
2407
|
const [apiKey] = await db.insert(apiKeys).values({
|
|
2409
2408
|
id: params.id,
|
|
2409
|
+
name: params.name,
|
|
2410
2410
|
tenantId: params.tenantId,
|
|
2411
2411
|
projectId: params.projectId,
|
|
2412
2412
|
graphId: params.graphId,
|
|
@@ -2422,6 +2422,7 @@ var createApiKey = (db) => async (params) => {
|
|
|
2422
2422
|
var updateApiKey = (db) => async (params) => {
|
|
2423
2423
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
2424
2424
|
const [updatedKey] = await db.update(apiKeys).set({
|
|
2425
|
+
name: params.data.name,
|
|
2425
2426
|
expiresAt: params.data.expiresAt,
|
|
2426
2427
|
updatedAt: now
|
|
2427
2428
|
}).where(
|
|
@@ -2475,12 +2476,13 @@ var countApiKeys = (db) => async (params) => {
|
|
|
2475
2476
|
return typeof total === "string" ? Number.parseInt(total, 10) : total;
|
|
2476
2477
|
};
|
|
2477
2478
|
var generateAndCreateApiKey = async (params, db) => {
|
|
2478
|
-
const { tenantId, projectId, graphId, expiresAt } = params;
|
|
2479
|
+
const { tenantId, projectId, graphId, expiresAt, name } = params;
|
|
2479
2480
|
const keyData = await generateApiKey();
|
|
2480
2481
|
const apiKey = await createApiKey(db)({
|
|
2481
2482
|
tenantId,
|
|
2482
2483
|
projectId,
|
|
2483
2484
|
graphId,
|
|
2485
|
+
name,
|
|
2484
2486
|
expiresAt,
|
|
2485
2487
|
...keyData
|
|
2486
2488
|
});
|
|
@@ -2676,7 +2678,21 @@ var isArtifactComponentAssociatedWithAgent = (db) => async (params) => {
|
|
|
2676
2678
|
return result.length > 0;
|
|
2677
2679
|
};
|
|
2678
2680
|
var graphHasArtifactComponents = (db) => async (params) => {
|
|
2679
|
-
const result = await db.select({ count: count() }).from(agentArtifactComponents).innerJoin(
|
|
2681
|
+
const result = await db.select({ count: count() }).from(agentArtifactComponents).innerJoin(
|
|
2682
|
+
agents,
|
|
2683
|
+
and(
|
|
2684
|
+
eq(agentArtifactComponents.agentId, agents.id),
|
|
2685
|
+
eq(agentArtifactComponents.tenantId, agents.tenantId)
|
|
2686
|
+
)
|
|
2687
|
+
).innerJoin(
|
|
2688
|
+
agentRelations,
|
|
2689
|
+
and(
|
|
2690
|
+
eq(agents.id, agentRelations.sourceAgentId),
|
|
2691
|
+
eq(agents.tenantId, agentRelations.tenantId),
|
|
2692
|
+
eq(agents.projectId, agentRelations.projectId),
|
|
2693
|
+
eq(agents.graphId, agentRelations.graphId)
|
|
2694
|
+
)
|
|
2695
|
+
).where(
|
|
2680
2696
|
and(
|
|
2681
2697
|
eq(agentArtifactComponents.tenantId, params.scopes.tenantId),
|
|
2682
2698
|
eq(agentArtifactComponents.projectId, params.scopes.projectId),
|
|
@@ -3864,22 +3880,22 @@ var createFullGraphServerSide = (db, logger11 = defaultLogger) => async (scopes,
|
|
|
3864
3880
|
}
|
|
3865
3881
|
const agentToolPromises = [];
|
|
3866
3882
|
for (const [agentId, agentData] of Object.entries(typed.agents)) {
|
|
3867
|
-
if (isInternalAgent(agentData) && agentData.
|
|
3868
|
-
for (const
|
|
3883
|
+
if (isInternalAgent(agentData) && agentData.canUse && Array.isArray(agentData.canUse)) {
|
|
3884
|
+
for (const canUseItem of agentData.canUse) {
|
|
3869
3885
|
agentToolPromises.push(
|
|
3870
3886
|
(async () => {
|
|
3871
3887
|
try {
|
|
3872
|
-
const
|
|
3888
|
+
const { toolId, toolSelection } = canUseItem;
|
|
3873
3889
|
logger11.info({ agentId, toolId }, "Processing agent-tool relation");
|
|
3874
3890
|
await upsertAgentToolRelation(db)({
|
|
3875
3891
|
scopes: { tenantId, projectId, graphId: finalGraphId },
|
|
3876
3892
|
agentId,
|
|
3877
3893
|
toolId,
|
|
3878
|
-
selectedTools
|
|
3894
|
+
selectedTools: toolSelection || void 0
|
|
3879
3895
|
});
|
|
3880
3896
|
logger11.info({ agentId, toolId }, "Agent-tool relation processed successfully");
|
|
3881
3897
|
} catch (error) {
|
|
3882
|
-
logger11.error({ agentId, toolId, error }, "Failed to create agent-tool relation");
|
|
3898
|
+
logger11.error({ agentId, toolId: canUseItem.toolId, error }, "Failed to create agent-tool relation");
|
|
3883
3899
|
}
|
|
3884
3900
|
})()
|
|
3885
3901
|
);
|
|
@@ -4257,23 +4273,23 @@ var updateFullGraphServerSide = (db, logger11 = defaultLogger) => async (scopes,
|
|
|
4257
4273
|
}
|
|
4258
4274
|
const agentToolPromises = [];
|
|
4259
4275
|
for (const [agentId, agentData] of Object.entries(typedGraphDefinition.agents)) {
|
|
4260
|
-
if (isInternalAgent(agentData) && agentData.
|
|
4261
|
-
for (const
|
|
4276
|
+
if (isInternalAgent(agentData) && agentData.canUse && Array.isArray(agentData.canUse)) {
|
|
4277
|
+
for (const canUseItem of agentData.canUse) {
|
|
4262
4278
|
agentToolPromises.push(
|
|
4263
4279
|
(async () => {
|
|
4264
4280
|
try {
|
|
4265
|
-
const
|
|
4281
|
+
const { toolId, toolSelection } = canUseItem;
|
|
4266
4282
|
await createAgentToolRelation(db)({
|
|
4267
4283
|
scopes: { tenantId, projectId, graphId: finalGraphId },
|
|
4268
4284
|
data: {
|
|
4269
4285
|
agentId,
|
|
4270
4286
|
toolId,
|
|
4271
|
-
selectedTools
|
|
4287
|
+
selectedTools: toolSelection || void 0
|
|
4272
4288
|
}
|
|
4273
4289
|
});
|
|
4274
4290
|
logger11.info({ agentId, toolId }, "Agent-tool relation created");
|
|
4275
4291
|
} catch (error) {
|
|
4276
|
-
logger11.error({ agentId, toolId, error }, "Failed to create agent-tool relation");
|
|
4292
|
+
logger11.error({ agentId, toolId: canUseItem.toolId, error }, "Failed to create agent-tool relation");
|
|
4277
4293
|
}
|
|
4278
4294
|
})()
|
|
4279
4295
|
);
|
|
@@ -5137,7 +5153,6 @@ var createFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
|
|
|
5137
5153
|
);
|
|
5138
5154
|
await upsertArtifactComponent(db)({
|
|
5139
5155
|
data: {
|
|
5140
|
-
id: componentId,
|
|
5141
5156
|
...componentData,
|
|
5142
5157
|
tenantId,
|
|
5143
5158
|
projectId: typed.id
|
|
@@ -5443,7 +5458,6 @@ var updateFullProjectServerSide = (db, logger11 = defaultLogger2) => async (scop
|
|
|
5443
5458
|
);
|
|
5444
5459
|
await upsertArtifactComponent(db)({
|
|
5445
5460
|
data: {
|
|
5446
|
-
id: componentId,
|
|
5447
5461
|
...componentData,
|
|
5448
5462
|
tenantId,
|
|
5449
5463
|
projectId: typed.id
|
|
@@ -5569,14 +5583,10 @@ var getFullProject = (db, logger11 = defaultLogger2) => async (params) => {
|
|
|
5569
5583
|
id: tool2.id,
|
|
5570
5584
|
name: tool2.name,
|
|
5571
5585
|
config: tool2.config,
|
|
5572
|
-
|
|
5573
|
-
|
|
5574
|
-
|
|
5575
|
-
|
|
5576
|
-
lastError: tool2.lastError || void 0,
|
|
5577
|
-
availableTools: tool2.availableTools || void 0,
|
|
5578
|
-
activeTools: tool2.config?.mcp?.activeTools || void 0,
|
|
5579
|
-
lastToolsSync: tool2.lastToolsSync && !Number.isNaN(new Date(tool2.lastToolsSync).getTime()) ? new Date(tool2.lastToolsSync).toISOString() : void 0
|
|
5586
|
+
credentialReferenceId: tool2.credentialReferenceId || void 0,
|
|
5587
|
+
imageUrl: tool2.imageUrl || void 0
|
|
5588
|
+
// Don't include runtime fields in configuration
|
|
5589
|
+
// status, capabilities, lastHealthCheck, lastError, availableTools, activeTools, lastToolsSync are all runtime
|
|
5580
5590
|
};
|
|
5581
5591
|
}
|
|
5582
5592
|
logger11.info(
|
|
@@ -8492,7 +8502,7 @@ var loadEnvironmentFiles = () => {
|
|
|
8492
8502
|
loadEnvironmentFiles();
|
|
8493
8503
|
var envSchema = z$1.object({
|
|
8494
8504
|
ENVIRONMENT: z$1.enum(["development", "production", "pentest", "test"]).optional(),
|
|
8495
|
-
DB_FILE_NAME: z$1.string(),
|
|
8505
|
+
DB_FILE_NAME: z$1.string().optional(),
|
|
8496
8506
|
OTEL_TRACES_FORCE_FLUSH_ENABLED: z$1.coerce.boolean().optional()
|
|
8497
8507
|
});
|
|
8498
8508
|
var parseEnv = () => {
|
|
@@ -541,6 +541,7 @@ var apiKeys = sqliteCore.sqliteTable(
|
|
|
541
541
|
// Hashed API key (never store plaintext)
|
|
542
542
|
keyPrefix: sqliteCore.text("key_prefix").notNull(),
|
|
543
543
|
// First 8 chars for identification (e.g., "sk_live_abc...")
|
|
544
|
+
name: sqliteCore.text("name"),
|
|
544
545
|
lastUsedAt: sqliteCore.text("last_used_at"),
|
|
545
546
|
expiresAt: sqliteCore.text("expires_at"),
|
|
546
547
|
createdAt: sqliteCore.text("created_at").notNull().default(drizzleOrm.sql`CURRENT_TIMESTAMP`),
|
|
@@ -1174,8 +1175,6 @@ var ArtifactComponentApiInsertSchema = ArtifactComponentInsertSchema.omit({
|
|
|
1174
1175
|
projectId: true,
|
|
1175
1176
|
createdAt: true,
|
|
1176
1177
|
updatedAt: true
|
|
1177
|
-
}).extend({
|
|
1178
|
-
id: resourceIdSchema.optional()
|
|
1179
1178
|
});
|
|
1180
1179
|
var ArtifactComponentApiUpdateSchema = createApiUpdateSchema(
|
|
1181
1180
|
ArtifactComponentUpdateSchema
|
|
@@ -1395,10 +1394,13 @@ var StatusUpdateSchema = zodOpenapi.z.object({
|
|
|
1395
1394
|
prompt: zodOpenapi.z.string().max(2e3, "Custom prompt cannot exceed 2000 characters").optional(),
|
|
1396
1395
|
statusComponents: zodOpenapi.z.array(StatusComponentSchema).optional()
|
|
1397
1396
|
});
|
|
1397
|
+
var CanUseItemSchema = zodOpenapi.z.object({
|
|
1398
|
+
toolId: zodOpenapi.z.string(),
|
|
1399
|
+
toolSelection: zodOpenapi.z.array(zodOpenapi.z.string()).nullable().optional()
|
|
1400
|
+
});
|
|
1398
1401
|
var FullGraphAgentInsertSchema = AgentApiInsertSchema.extend({
|
|
1399
1402
|
type: zodOpenapi.z.literal("internal"),
|
|
1400
|
-
|
|
1401
|
-
selectedTools: zodOpenapi.z.record(zodOpenapi.z.string(), zodOpenapi.z.array(zodOpenapi.z.string())).optional(),
|
|
1403
|
+
canUse: zodOpenapi.z.array(CanUseItemSchema),
|
|
1402
1404
|
dataComponents: zodOpenapi.z.array(zodOpenapi.z.string()).optional(),
|
|
1403
1405
|
artifactComponents: zodOpenapi.z.array(zodOpenapi.z.string()).optional(),
|
|
1404
1406
|
canTransferTo: zodOpenapi.z.array(zodOpenapi.z.string()).optional(),
|
|
@@ -1576,10 +1578,10 @@ function validateToolReferences(graphData, availableToolIds) {
|
|
|
1576
1578
|
}
|
|
1577
1579
|
const errors = [];
|
|
1578
1580
|
for (const [agentId, agentData] of Object.entries(graphData.agents)) {
|
|
1579
|
-
if (isInternalAgent(agentData) && agentData.
|
|
1580
|
-
for (const
|
|
1581
|
-
if (!availableToolIds.has(toolId)) {
|
|
1582
|
-
errors.push(`Agent '${agentId}' references non-existent tool '${toolId}'`);
|
|
1581
|
+
if (isInternalAgent(agentData) && agentData.canUse && Array.isArray(agentData.canUse)) {
|
|
1582
|
+
for (const canUseItem of agentData.canUse) {
|
|
1583
|
+
if (!availableToolIds.has(canUseItem.toolId)) {
|
|
1584
|
+
errors.push(`Agent '${agentId}' references non-existent tool '${canUseItem.toolId}'`);
|
|
1583
1585
|
}
|
|
1584
1586
|
}
|
|
1585
1587
|
}
|
|
@@ -1743,6 +1745,7 @@ exports.ArtifactComponentApiUpdateSchema = ArtifactComponentApiUpdateSchema;
|
|
|
1743
1745
|
exports.ArtifactComponentInsertSchema = ArtifactComponentInsertSchema;
|
|
1744
1746
|
exports.ArtifactComponentSelectSchema = ArtifactComponentSelectSchema;
|
|
1745
1747
|
exports.ArtifactComponentUpdateSchema = ArtifactComponentUpdateSchema;
|
|
1748
|
+
exports.CanUseItemSchema = CanUseItemSchema;
|
|
1746
1749
|
exports.ContextCacheApiInsertSchema = ContextCacheApiInsertSchema;
|
|
1747
1750
|
exports.ContextCacheApiSelectSchema = ContextCacheApiSelectSchema;
|
|
1748
1751
|
exports.ContextCacheApiUpdateSchema = ContextCacheApiUpdateSchema;
|
package/dist/validation/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { generateIdFromName, isExternalAgent, isInternalAgent, isValidResourceId, validateAgentRelationships, validateAndTypeGraphData, validateArtifactComponentReferences, validateDataComponentReferences, validateGraphStructure, validateToolReferences } from '../chunk-
|
|
2
|
-
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, AgentStopWhenSchema, 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, FullProjectDefinitionSchema, GraphStopWhenSchema, GraphWithinContextOfProjectSchema, 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, StopWhenSchema, TaskApiInsertSchema, TaskApiSelectSchema, TaskApiUpdateSchema, TaskInsertSchema, TaskRelationApiInsertSchema, TaskRelationApiSelectSchema, TaskRelationApiUpdateSchema, TaskRelationInsertSchema, TaskRelationSelectSchema, TaskRelationUpdateSchema, TaskSelectSchema, TaskUpdateSchema, TenantIdParamsSchema, TenantParamsSchema, TenantProjectGraphIdParamsSchema, TenantProjectGraphParamsSchema, TenantProjectIdParamsSchema, TenantProjectParamsSchema, ToolApiInsertSchema, ToolApiSelectSchema, ToolApiUpdateSchema, ToolInsertSchema, ToolSelectSchema, ToolStatusSchema, ToolUpdateSchema, URL_SAFE_ID_PATTERN, resourceIdSchema } from '../chunk-
|
|
1
|
+
export { generateIdFromName, isExternalAgent, isInternalAgent, isValidResourceId, validateAgentRelationships, validateAndTypeGraphData, validateArtifactComponentReferences, validateDataComponentReferences, validateGraphStructure, validateToolReferences } from '../chunk-T5JVBY6K.js';
|
|
2
|
+
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, AgentStopWhenSchema, AgentToolRelationApiInsertSchema, AgentToolRelationApiSelectSchema, AgentToolRelationApiUpdateSchema, AgentToolRelationInsertSchema, AgentToolRelationSelectSchema, AgentToolRelationUpdateSchema, AgentUpdateSchema, 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, ExternalAgentRelationApiInsertSchema, ExternalAgentRelationInsertSchema, ExternalAgentSelectSchema, ExternalAgentUpdateSchema, FetchConfigSchema, FetchDefinitionSchema, FullGraphAgentInsertSchema, FullGraphDefinitionSchema, FullProjectDefinitionSchema, GraphStopWhenSchema, GraphWithinContextOfProjectSchema, 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, StopWhenSchema, TaskApiInsertSchema, TaskApiSelectSchema, TaskApiUpdateSchema, TaskInsertSchema, TaskRelationApiInsertSchema, TaskRelationApiSelectSchema, TaskRelationApiUpdateSchema, TaskRelationInsertSchema, TaskRelationSelectSchema, TaskRelationUpdateSchema, TaskSelectSchema, TaskUpdateSchema, TenantIdParamsSchema, TenantParamsSchema, TenantProjectGraphIdParamsSchema, TenantProjectGraphParamsSchema, TenantProjectIdParamsSchema, TenantProjectParamsSchema, ToolApiInsertSchema, ToolApiSelectSchema, ToolApiUpdateSchema, ToolInsertSchema, ToolSelectSchema, ToolStatusSchema, ToolUpdateSchema, URL_SAFE_ID_PATTERN, resourceIdSchema } from '../chunk-7OCPFKGI.js';
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/agents-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Agents Core contains the database schema, types, and validation schemas for Inkeep Agent Framework, along with core components.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
8
9
|
"exports": {
|
|
9
10
|
".": "./dist/index.js",
|
|
10
11
|
"./schema": "./dist/schema/index.js",
|