@inkeep/agents-core 0.17.0 → 0.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/{chunk-TO2HNKGP.js → chunk-E4SFK6AI.js} +143 -157
- package/dist/chunk-H6PMWHNV.js +278 -0
- package/dist/{chunk-VPJ6Z5QZ.js → chunk-ID4CFGVF.js} +202 -131
- package/dist/chunk-JTHQYGCX.js +173 -0
- package/dist/client-exports.cjs +628 -272
- package/dist/client-exports.d.cts +6 -5
- package/dist/client-exports.d.ts +6 -5
- package/dist/client-exports.js +5 -4
- package/dist/db/schema.cjs +201 -130
- package/dist/db/schema.d.cts +2 -2
- package/dist/db/schema.d.ts +2 -2
- package/dist/db/schema.js +1 -1
- package/dist/index.cjs +2740 -1831
- package/dist/index.d.cts +1664 -1544
- package/dist/index.d.ts +1664 -1544
- package/dist/index.js +1953 -1467
- package/dist/{schema-Ct2NlO81.d.cts → schema-ULFEZCOL.d.cts} +475 -174
- package/dist/{schema-BQk_FMBV.d.ts → schema-wbZXiVWb.d.ts} +475 -174
- package/dist/signoz-queries-BuiipZTk.d.cts +274 -0
- package/dist/signoz-queries-BuiipZTk.d.ts +274 -0
- package/dist/types/index.d.cts +2 -2
- package/dist/types/index.d.ts +2 -2
- package/dist/{utility-s9c5CVOe.d.cts → utility-CyPQ1tC_.d.cts} +591 -390
- package/dist/{utility-s9c5CVOe.d.ts → utility-CyPQ1tC_.d.ts} +591 -390
- package/dist/validation/index.cjs +429 -325
- package/dist/validation/index.d.cts +76 -4
- package/dist/validation/index.d.ts +76 -4
- package/dist/validation/index.js +2 -2
- package/drizzle/0005_wide_shriek.sql +127 -0
- package/drizzle/0006_damp_lenny_balinger.sql +52 -0
- package/drizzle/meta/0005_snapshot.json +2558 -0
- package/drizzle/meta/0006_snapshot.json +2751 -0
- package/drizzle/meta/_journal.json +14 -0
- package/package.json +1 -1
- package/dist/chunk-L53XWAYG.js +0 -134
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { GraphWithinContextOfProjectSchema, resourceIdSchema, MAX_ID_LENGTH } from './chunk-E4SFK6AI.js';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
var TransferDataSchema = z.object({
|
|
5
|
+
fromSubAgent: z.string().describe("ID of the sub-agent transferring control"),
|
|
6
|
+
targetSubAgent: z.string().describe("ID of the sub-agent receiving control"),
|
|
7
|
+
reason: z.string().optional().describe("Reason for the transfer"),
|
|
8
|
+
context: z.any().optional().describe("Additional context data")
|
|
9
|
+
});
|
|
10
|
+
var DelegationSentDataSchema = z.object({
|
|
11
|
+
delegationId: z.string().describe("Unique identifier for this delegation"),
|
|
12
|
+
fromSubAgent: z.string().describe("ID of the delegating sub-agent"),
|
|
13
|
+
targetSubAgent: z.string().describe("ID of the sub-agent receiving the delegation"),
|
|
14
|
+
taskDescription: z.string().describe("Description of the delegated task"),
|
|
15
|
+
context: z.any().optional().describe("Additional context data")
|
|
16
|
+
});
|
|
17
|
+
var DelegationReturnedDataSchema = z.object({
|
|
18
|
+
delegationId: z.string().describe("Unique identifier matching the original delegation"),
|
|
19
|
+
fromSubAgent: z.string().describe("ID of the sub-agent that completed the task"),
|
|
20
|
+
targetSubAgent: z.string().describe("ID of the sub-agent receiving the result"),
|
|
21
|
+
result: z.any().optional().describe("Result data from the delegated task")
|
|
22
|
+
});
|
|
23
|
+
var DataOperationDetailsSchema = z.object({
|
|
24
|
+
timestamp: z.number().describe("Unix timestamp in milliseconds"),
|
|
25
|
+
subAgentId: z.string().describe("ID of the sub-agent that generated this data"),
|
|
26
|
+
data: z.any().describe("The actual data payload")
|
|
27
|
+
});
|
|
28
|
+
var DataOperationEventSchema = z.object({
|
|
29
|
+
type: z.string().describe("Event type identifier"),
|
|
30
|
+
label: z.string().describe("Human-readable label for the event"),
|
|
31
|
+
details: DataOperationDetailsSchema
|
|
32
|
+
});
|
|
33
|
+
var A2AMessageMetadataSchema = z.object({
|
|
34
|
+
fromSubAgentId: z.string().optional().describe("ID of the sending sub-agent"),
|
|
35
|
+
toSubAgentId: z.string().optional().describe("ID of the receiving sub-agent"),
|
|
36
|
+
fromExternalAgentId: z.string().optional().describe("ID of the sending external agent"),
|
|
37
|
+
toExternalAgentId: z.string().optional().describe("ID of the receiving external agent"),
|
|
38
|
+
taskId: z.string().optional().describe("Associated task ID"),
|
|
39
|
+
a2aTaskId: z.string().optional().describe("A2A-specific task ID")
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
// src/validation/graphFull.ts
|
|
43
|
+
function isInternalAgent(agent) {
|
|
44
|
+
return "prompt" in agent;
|
|
45
|
+
}
|
|
46
|
+
function isExternalAgent(agent) {
|
|
47
|
+
return "baseUrl" in agent;
|
|
48
|
+
}
|
|
49
|
+
function validateAndTypeGraphData(data) {
|
|
50
|
+
return GraphWithinContextOfProjectSchema.parse(data);
|
|
51
|
+
}
|
|
52
|
+
function validateToolReferences(graphData, availableToolIds) {
|
|
53
|
+
if (!availableToolIds) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
const errors = [];
|
|
57
|
+
for (const [subAgentId, agentData] of Object.entries(graphData.subAgents)) {
|
|
58
|
+
if (isInternalAgent(agentData) && agentData.canUse && Array.isArray(agentData.canUse)) {
|
|
59
|
+
for (const canUseItem of agentData.canUse) {
|
|
60
|
+
if (!availableToolIds.has(canUseItem.toolId)) {
|
|
61
|
+
errors.push(`Agent '${subAgentId}' references non-existent tool '${canUseItem.toolId}'`);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
if (errors.length > 0) {
|
|
67
|
+
throw new Error(`Tool reference validation failed:
|
|
68
|
+
${errors.join("\n")}`);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
function validateDataComponentReferences(graphData, availableDataComponentIds) {
|
|
72
|
+
if (!availableDataComponentIds) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
const errors = [];
|
|
76
|
+
for (const [subAgentId, agentData] of Object.entries(graphData.subAgents)) {
|
|
77
|
+
if (isInternalAgent(agentData) && agentData.dataComponents) {
|
|
78
|
+
for (const dataComponentId of agentData.dataComponents) {
|
|
79
|
+
if (!availableDataComponentIds.has(dataComponentId)) {
|
|
80
|
+
errors.push(
|
|
81
|
+
`Agent '${subAgentId}' references non-existent dataComponent '${dataComponentId}'`
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
if (errors.length > 0) {
|
|
88
|
+
throw new Error(`DataComponent reference validation failed:
|
|
89
|
+
${errors.join("\n")}`);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
function validateArtifactComponentReferences(graphData, availableArtifactComponentIds) {
|
|
93
|
+
if (!availableArtifactComponentIds) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
const errors = [];
|
|
97
|
+
for (const [subAgentId, agentData] of Object.entries(graphData.subAgents)) {
|
|
98
|
+
if (isInternalAgent(agentData) && agentData.artifactComponents) {
|
|
99
|
+
for (const artifactComponentId of agentData.artifactComponents) {
|
|
100
|
+
if (!availableArtifactComponentIds.has(artifactComponentId)) {
|
|
101
|
+
errors.push(
|
|
102
|
+
`Agent '${subAgentId}' references non-existent artifactComponent '${artifactComponentId}'`
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
if (errors.length > 0) {
|
|
109
|
+
throw new Error(`ArtifactComponent reference validation failed:
|
|
110
|
+
${errors.join("\n")}`);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
function validateAgentRelationships(graphData) {
|
|
114
|
+
const errors = [];
|
|
115
|
+
const availableAgentIds = new Set(Object.keys(graphData.subAgents));
|
|
116
|
+
for (const [subAgentId, agentData] of Object.entries(graphData.subAgents)) {
|
|
117
|
+
if (isInternalAgent(agentData)) {
|
|
118
|
+
if (agentData.canTransferTo && Array.isArray(agentData.canTransferTo)) {
|
|
119
|
+
for (const targetId of agentData.canTransferTo) {
|
|
120
|
+
if (!availableAgentIds.has(targetId)) {
|
|
121
|
+
errors.push(
|
|
122
|
+
`Agent '${subAgentId}' has transfer target '${targetId}' that doesn't exist in graph`
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
if (agentData.canDelegateTo && Array.isArray(agentData.canDelegateTo)) {
|
|
128
|
+
for (const targetId of agentData.canDelegateTo) {
|
|
129
|
+
if (!availableAgentIds.has(targetId)) {
|
|
130
|
+
errors.push(
|
|
131
|
+
`Agent '${subAgentId}' has delegation target '${targetId}' that doesn't exist in graph`
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
if (errors.length > 0) {
|
|
139
|
+
throw new Error(`Agent relationship validation failed:
|
|
140
|
+
${errors.join("\n")}`);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
function validateGraphStructure(graphData, projectResources) {
|
|
144
|
+
if (graphData.defaultSubAgentId && !graphData.subAgents[graphData.defaultSubAgentId]) {
|
|
145
|
+
throw new Error(`Default agent '${graphData.defaultSubAgentId}' does not exist in agents`);
|
|
146
|
+
}
|
|
147
|
+
if (projectResources) {
|
|
148
|
+
validateToolReferences(graphData, projectResources.toolIds);
|
|
149
|
+
validateDataComponentReferences(graphData, projectResources.dataComponentIds);
|
|
150
|
+
validateArtifactComponentReferences(graphData, projectResources.artifactComponentIds);
|
|
151
|
+
}
|
|
152
|
+
validateAgentRelationships(graphData);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// src/validation/id-validation.ts
|
|
156
|
+
function isValidResourceId(id) {
|
|
157
|
+
const result = resourceIdSchema.safeParse(id);
|
|
158
|
+
return result.success;
|
|
159
|
+
}
|
|
160
|
+
function generateIdFromName(name) {
|
|
161
|
+
const id = name.toLowerCase().replace(/[^a-z0-9_-]+/g, "-").replace(/^-+|-+$/g, "").replace(/-{2,}/g, "-");
|
|
162
|
+
if (!id) {
|
|
163
|
+
throw new Error("Cannot generate valid ID from provided name");
|
|
164
|
+
}
|
|
165
|
+
const truncatedId = id.substring(0, MAX_ID_LENGTH);
|
|
166
|
+
const result = resourceIdSchema.safeParse(truncatedId);
|
|
167
|
+
if (!result.success) {
|
|
168
|
+
throw new Error(`Generated ID "${truncatedId}" is not valid: ${result.error.message}`);
|
|
169
|
+
}
|
|
170
|
+
return truncatedId;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export { A2AMessageMetadataSchema, DataOperationDetailsSchema, DataOperationEventSchema, DelegationReturnedDataSchema, DelegationSentDataSchema, TransferDataSchema, generateIdFromName, isExternalAgent, isInternalAgent, isValidResourceId, validateAgentRelationships, validateAndTypeGraphData, validateArtifactComponentReferences, validateDataComponentReferences, validateGraphStructure, validateToolReferences };
|