@inkeep/agents-core 0.1.4 → 0.1.7
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/SUPPLEMENTAL_TERMS.md +40 -0
- package/dist/chunk-BMKWVKI2.js +126 -0
- package/dist/chunk-H2F72PDA.js +15 -0
- package/dist/chunk-MKBO26DX.js +9 -0
- package/dist/chunk-MXQKLGQK.js +925 -0
- package/dist/chunk-R3VVJXX7.js +575 -0
- package/dist/chunk-SVGQSPW4.js +24 -0
- package/dist/client-exports.cjs +1702 -0
- package/dist/client-exports.js +202 -246
- package/dist/db/schema.cjs +922 -0
- package/dist/db/schema.js +1 -696
- package/dist/index.cjs +10122 -0
- package/dist/index.js +7989 -13
- package/dist/types/index.cjs +45 -0
- package/dist/types/index.js +2 -6
- package/dist/validation/index.cjs +1772 -0
- package/dist/validation/index.js +2 -5
- package/package.json +11 -6
- package/dist/__tests__/integration/helpers.d.ts +0 -5
- package/dist/__tests__/integration/helpers.d.ts.map +0 -1
- package/dist/__tests__/integration/helpers.js +0 -37
- package/dist/__tests__/integration/helpers.js.map +0 -1
- package/dist/__tests__/setup.d.ts +0 -3
- package/dist/__tests__/setup.d.ts.map +0 -1
- package/dist/__tests__/setup.js +0 -29
- package/dist/__tests__/setup.js.map +0 -1
- package/dist/client-exports.d.ts +0 -300
- package/dist/client-exports.d.ts.map +0 -1
- package/dist/client-exports.js.map +0 -1
- package/dist/context/ContextConfig.d.ts +0 -54
- package/dist/context/ContextConfig.d.ts.map +0 -1
- package/dist/context/ContextConfig.js +0 -302
- package/dist/context/ContextConfig.js.map +0 -1
- package/dist/context/ContextFetcher.d.ts +0 -64
- package/dist/context/ContextFetcher.d.ts.map +0 -1
- package/dist/context/ContextFetcher.js +0 -325
- package/dist/context/ContextFetcher.js.map +0 -1
- package/dist/context/ContextResolver.d.ts +0 -52
- package/dist/context/ContextResolver.d.ts.map +0 -1
- package/dist/context/ContextResolver.js +0 -298
- package/dist/context/ContextResolver.js.map +0 -1
- package/dist/context/TemplateEngine.d.ts +0 -46
- package/dist/context/TemplateEngine.d.ts.map +0 -1
- package/dist/context/TemplateEngine.js +0 -175
- package/dist/context/TemplateEngine.js.map +0 -1
- package/dist/context/context.d.ts +0 -8
- package/dist/context/context.d.ts.map +0 -1
- package/dist/context/context.js +0 -157
- package/dist/context/context.js.map +0 -1
- package/dist/context/contextCache.d.ts +0 -50
- package/dist/context/contextCache.d.ts.map +0 -1
- package/dist/context/contextCache.js +0 -175
- package/dist/context/contextCache.js.map +0 -1
- package/dist/context/index.d.ts +0 -11
- package/dist/context/index.d.ts.map +0 -1
- package/dist/context/index.js +0 -8
- package/dist/context/index.js.map +0 -1
- package/dist/credential-stores/CredentialStoreRegistry.d.ts +0 -39
- package/dist/credential-stores/CredentialStoreRegistry.d.ts.map +0 -1
- package/dist/credential-stores/CredentialStoreRegistry.js +0 -65
- package/dist/credential-stores/CredentialStoreRegistry.js.map +0 -1
- package/dist/credential-stores/defaults.d.ts +0 -6
- package/dist/credential-stores/defaults.d.ts.map +0 -1
- package/dist/credential-stores/defaults.js +0 -22
- package/dist/credential-stores/defaults.js.map +0 -1
- package/dist/credential-stores/index.d.ts +0 -6
- package/dist/credential-stores/index.d.ts.map +0 -1
- package/dist/credential-stores/index.js +0 -6
- package/dist/credential-stores/index.js.map +0 -1
- package/dist/credential-stores/keychain-store.d.ts +0 -100
- package/dist/credential-stores/keychain-store.d.ts.map +0 -1
- package/dist/credential-stores/keychain-store.js +0 -225
- package/dist/credential-stores/keychain-store.js.map +0 -1
- package/dist/credential-stores/memory-store.d.ts +0 -39
- package/dist/credential-stores/memory-store.d.ts.map +0 -1
- package/dist/credential-stores/memory-store.js +0 -58
- package/dist/credential-stores/memory-store.js.map +0 -1
- package/dist/credential-stores/nango-store.d.ts +0 -59
- package/dist/credential-stores/nango-store.d.ts.map +0 -1
- package/dist/credential-stores/nango-store.js +0 -264
- package/dist/credential-stores/nango-store.js.map +0 -1
- package/dist/credential-stuffer/CredentialStuffer.d.ts +0 -80
- package/dist/credential-stuffer/CredentialStuffer.d.ts.map +0 -1
- package/dist/credential-stuffer/CredentialStuffer.js +0 -186
- package/dist/credential-stuffer/CredentialStuffer.js.map +0 -1
- package/dist/credential-stuffer/index.d.ts +0 -2
- package/dist/credential-stuffer/index.d.ts.map +0 -1
- package/dist/credential-stuffer/index.js +0 -2
- package/dist/credential-stuffer/index.js.map +0 -1
- package/dist/data-access/agentDataComponents.d.ts +0 -1
- package/dist/data-access/agentDataComponents.d.ts.map +0 -1
- package/dist/data-access/agentDataComponents.js +0 -2
- package/dist/data-access/agentDataComponents.js.map +0 -1
- package/dist/data-access/agentGraphs.d.ts +0 -406
- package/dist/data-access/agentGraphs.d.ts.map +0 -1
- package/dist/data-access/agentGraphs.js +0 -551
- package/dist/data-access/agentGraphs.js.map +0 -1
- package/dist/data-access/agentRelations.d.ts +0 -456
- package/dist/data-access/agentRelations.d.ts.map +0 -1
- package/dist/data-access/agentRelations.js +0 -471
- package/dist/data-access/agentRelations.js.map +0 -1
- package/dist/data-access/agents.d.ts +0 -218
- package/dist/data-access/agents.d.ts.map +0 -1
- package/dist/data-access/agents.js +0 -130
- package/dist/data-access/agents.js.map +0 -1
- package/dist/data-access/apiKeys.d.ts +0 -114
- package/dist/data-access/apiKeys.d.ts.map +0 -1
- package/dist/data-access/apiKeys.js +0 -185
- package/dist/data-access/apiKeys.js.map +0 -1
- package/dist/data-access/artifactComponents.d.ts +0 -152
- package/dist/data-access/artifactComponents.d.ts.map +0 -1
- package/dist/data-access/artifactComponents.js +0 -214
- package/dist/data-access/artifactComponents.js.map +0 -1
- package/dist/data-access/contextCache.d.ts +0 -68
- package/dist/data-access/contextCache.d.ts.map +0 -1
- package/dist/data-access/contextCache.js +0 -160
- package/dist/data-access/contextCache.js.map +0 -1
- package/dist/data-access/contextConfigs.d.ts +0 -110
- package/dist/data-access/contextConfigs.d.ts.map +0 -1
- package/dist/data-access/contextConfigs.js +0 -156
- package/dist/data-access/contextConfigs.js.map +0 -1
- package/dist/data-access/conversations.d.ts +0 -125
- package/dist/data-access/conversations.d.ts.map +0 -1
- package/dist/data-access/conversations.js +0 -244
- package/dist/data-access/conversations.js.map +0 -1
- package/dist/data-access/credentialReferences.d.ts +0 -86
- package/dist/data-access/credentialReferences.d.ts.map +0 -1
- package/dist/data-access/credentialReferences.js +0 -175
- package/dist/data-access/credentialReferences.js.map +0 -1
- package/dist/data-access/dataComponents.d.ts +0 -129
- package/dist/data-access/dataComponents.d.ts.map +0 -1
- package/dist/data-access/dataComponents.js +0 -213
- package/dist/data-access/dataComponents.js.map +0 -1
- package/dist/data-access/externalAgents.d.ts +0 -83
- package/dist/data-access/externalAgents.d.ts.map +0 -1
- package/dist/data-access/externalAgents.js +0 -163
- package/dist/data-access/externalAgents.js.map +0 -1
- package/dist/data-access/graphFull.d.ts +0 -32
- package/dist/data-access/graphFull.d.ts.map +0 -1
- package/dist/data-access/graphFull.js +0 -996
- package/dist/data-access/graphFull.js.map +0 -1
- package/dist/data-access/index.d.ts +0 -21
- package/dist/data-access/index.d.ts.map +0 -1
- package/dist/data-access/index.js +0 -22
- package/dist/data-access/index.js.map +0 -1
- package/dist/data-access/ledgerArtifacts.d.ts +0 -49
- package/dist/data-access/ledgerArtifacts.d.ts.map +0 -1
- package/dist/data-access/ledgerArtifacts.js +0 -112
- package/dist/data-access/ledgerArtifacts.js.map +0 -1
- package/dist/data-access/messages.d.ts +0 -209
- package/dist/data-access/messages.d.ts.map +0 -1
- package/dist/data-access/messages.js +0 -100
- package/dist/data-access/messages.js.map +0 -1
- package/dist/data-access/projects.d.ts +0 -67
- package/dist/data-access/projects.d.ts.map +0 -1
- package/dist/data-access/projects.js +0 -337
- package/dist/data-access/projects.js.map +0 -1
- package/dist/data-access/tasks.d.ts +0 -37
- package/dist/data-access/tasks.d.ts.map +0 -1
- package/dist/data-access/tasks.js +0 -40
- package/dist/data-access/tasks.js.map +0 -1
- package/dist/data-access/tools.d.ts +0 -277
- package/dist/data-access/tools.d.ts.map +0 -1
- package/dist/data-access/tools.js +0 -183
- package/dist/data-access/tools.js.map +0 -1
- package/dist/data-access/validation.d.ts +0 -17
- package/dist/data-access/validation.d.ts.map +0 -1
- package/dist/data-access/validation.js +0 -52
- package/dist/data-access/validation.js.map +0 -1
- package/dist/db/clean.d.ts +0 -6
- package/dist/db/clean.d.ts.map +0 -1
- package/dist/db/clean.js +0 -81
- package/dist/db/clean.js.map +0 -1
- package/dist/db/client.d.ts +0 -19
- package/dist/db/client.d.ts.map +0 -1
- package/dist/db/client.js +0 -24
- package/dist/db/client.js.map +0 -1
- package/dist/db/schema.d.ts +0 -4337
- package/dist/db/schema.d.ts.map +0 -1
- package/dist/db/schema.js.map +0 -1
- package/dist/db/test-client.d.ts +0 -25
- package/dist/db/test-client.d.ts.map +0 -1
- package/dist/db/test-client.js +0 -136
- package/dist/db/test-client.js.map +0 -1
- package/dist/env.d.ts +0 -19
- package/dist/env.d.ts.map +0 -1
- package/dist/env.js +0 -49
- package/dist/env.js.map +0 -1
- package/dist/index.d.ts +0 -12
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/middleware/contextValidation.d.ts +0 -49
- package/dist/middleware/contextValidation.d.ts.map +0 -1
- package/dist/middleware/contextValidation.js +0 -473
- package/dist/middleware/contextValidation.js.map +0 -1
- package/dist/middleware/index.d.ts +0 -2
- package/dist/middleware/index.d.ts.map +0 -1
- package/dist/middleware/index.js +0 -2
- package/dist/middleware/index.js.map +0 -1
- package/dist/server/BaseServer.d.ts +0 -83
- package/dist/server/BaseServer.d.ts.map +0 -1
- package/dist/server/BaseServer.js +0 -218
- package/dist/server/BaseServer.js.map +0 -1
- package/dist/types/a2a.d.ts +0 -373
- package/dist/types/a2a.d.ts.map +0 -1
- package/dist/types/a2a.js +0 -14
- package/dist/types/a2a.js.map +0 -1
- package/dist/types/entities.d.ts +0 -147
- package/dist/types/entities.d.ts.map +0 -1
- package/dist/types/entities.js +0 -2
- package/dist/types/entities.js.map +0 -1
- package/dist/types/index.d.ts +0 -5
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js.map +0 -1
- package/dist/types/server.d.ts +0 -116
- package/dist/types/server.d.ts.map +0 -1
- package/dist/types/server.js +0 -2
- package/dist/types/server.js.map +0 -1
- package/dist/types/utility.d.ts +0 -213
- package/dist/types/utility.d.ts.map +0 -1
- package/dist/types/utility.js +0 -9
- package/dist/types/utility.js.map +0 -1
- package/dist/utils/apiKeys.d.ts +0 -32
- package/dist/utils/apiKeys.d.ts.map +0 -1
- package/dist/utils/apiKeys.js +0 -117
- package/dist/utils/apiKeys.js.map +0 -1
- package/dist/utils/auth-detection.d.ts +0 -23
- package/dist/utils/auth-detection.d.ts.map +0 -1
- package/dist/utils/auth-detection.js +0 -148
- package/dist/utils/auth-detection.js.map +0 -1
- package/dist/utils/credential-store-utils.d.ts +0 -11
- package/dist/utils/credential-store-utils.d.ts.map +0 -1
- package/dist/utils/credential-store-utils.js +0 -19
- package/dist/utils/credential-store-utils.js.map +0 -1
- package/dist/utils/error.d.ts +0 -526
- package/dist/utils/error.d.ts.map +0 -1
- package/dist/utils/error.js +0 -282
- package/dist/utils/error.js.map +0 -1
- package/dist/utils/execution.d.ts +0 -18
- package/dist/utils/execution.d.ts.map +0 -1
- package/dist/utils/execution.js +0 -25
- package/dist/utils/execution.js.map +0 -1
- package/dist/utils/index.d.ts +0 -9
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/index.js +0 -9
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/logger.d.ts +0 -79
- package/dist/utils/logger.d.ts.map +0 -1
- package/dist/utils/logger.js +0 -102
- package/dist/utils/logger.js.map +0 -1
- package/dist/utils/logging.d.ts +0 -11
- package/dist/utils/logging.d.ts.map +0 -1
- package/dist/utils/logging.js +0 -6
- package/dist/utils/logging.js.map +0 -1
- package/dist/utils/mcp-client.d.ts +0 -48
- package/dist/utils/mcp-client.d.ts.map +0 -1
- package/dist/utils/mcp-client.js +0 -174
- package/dist/utils/mcp-client.js.map +0 -1
- package/dist/utils/tracer.d.ts +0 -24
- package/dist/utils/tracer.d.ts.map +0 -1
- package/dist/utils/tracer.js +0 -110
- package/dist/utils/tracer.js.map +0 -1
- package/dist/validation/graphFull.d.ts +0 -36
- package/dist/validation/graphFull.d.ts.map +0 -1
- package/dist/validation/graphFull.js +0 -128
- package/dist/validation/graphFull.js.map +0 -1
- package/dist/validation/id-validation.d.ts +0 -38
- package/dist/validation/id-validation.d.ts.map +0 -1
- package/dist/validation/id-validation.js +0 -60
- package/dist/validation/id-validation.js.map +0 -1
- package/dist/validation/index.d.ts +0 -4
- package/dist/validation/index.d.ts.map +0 -1
- package/dist/validation/index.js.map +0 -1
- package/dist/validation/schemas.d.ts +0 -7238
- package/dist/validation/schemas.d.ts.map +0 -1
- package/dist/validation/schemas.js +0 -575
- package/dist/validation/schemas.js.map +0 -1
package/README.md
CHANGED
|
@@ -170,14 +170,14 @@ Tests use in-memory SQLite databases for isolation and speed.
|
|
|
170
170
|
|
|
171
171
|
This package is designed to support a multi-service architecture:
|
|
172
172
|
|
|
173
|
-
###
|
|
173
|
+
### Agents Manage API
|
|
174
174
|
Handles CRUD operations and entity management:
|
|
175
175
|
- Creating/updating agents
|
|
176
176
|
- Managing agent relationships
|
|
177
177
|
- Configuring tools
|
|
178
178
|
- Database migrations
|
|
179
179
|
|
|
180
|
-
###
|
|
180
|
+
### Agents Run API
|
|
181
181
|
Handles runtime operations:
|
|
182
182
|
- Processing conversations
|
|
183
183
|
- Executing tasks
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
AUTO-GENERATED FILE - DO NOT EDIT DIRECTLY
|
|
3
|
+
Source: ./SUPPLEMENTAL_TERMS.md
|
|
4
|
+
This file is automatically copied from the root SUPPLEMENTAL_TERMS.md during build.
|
|
5
|
+
Any changes should be made to the root SUPPLEMENTAL_TERMS.md file.
|
|
6
|
+
-->
|
|
7
|
+
|
|
8
|
+
# Inkeep SDK – Elastic License 2.0 with Supplemental Terms
|
|
9
|
+
|
|
10
|
+
The Inkeep [SDK] (the "Software") is licensed under the Elastic License 2.0 ("ELv2"), available at [https://www.elastic.co/licensing/elastic-license](https://www.elastic.co/licensing/elastic-license), subject to the supplemental terms below. By using the Software, you, your company, and your licensees agree to both ELv2 and these Supplemental Terms – for purposes of these Supplemental Terms, references to "you" have the same meaning as in ELv2 and include your company and contractors acting on your behalf. In the event of conflict, these Supplemental Terms control.
|
|
11
|
+
|
|
12
|
+
Any copy or redistribution of the Software must include both the ELv2 license reference and these Supplemental Terms.
|
|
13
|
+
|
|
14
|
+
## 1. Restrictions
|
|
15
|
+
|
|
16
|
+
### 1.1
|
|
17
|
+
You may not use the Software, directly or indirectly, to offer, enable, operate, or provide any Agent Builder.
|
|
18
|
+
|
|
19
|
+
### 1.2
|
|
20
|
+
You may not repackage, rebrand, or otherwise expose the Software's agent-creation or orchestration functionality for third-party use, including in specialized or verticalized offerings that present substantially similar functionality to the Software.
|
|
21
|
+
|
|
22
|
+
### 1.3
|
|
23
|
+
For clarity, the foregoing restrictions do not prohibit your use of the Software as Embedded Assistants or Professional Services, provided neither allow third parties to create, configure, train, orchestrate, deploy, or manage their own agents or agent workflows.
|
|
24
|
+
|
|
25
|
+
## 2. Definitions
|
|
26
|
+
|
|
27
|
+
### 2.1 Inkeep
|
|
28
|
+
**"Inkeep"** means Inkeep, Inc., a Delaware corporation with principal offices at 169 Madison Ave, Ste 2544, New York, NY, 10016, the licensor (as defined in ELv2) of the Software.
|
|
29
|
+
|
|
30
|
+
### 2.2 Agent Builder
|
|
31
|
+
**"Agent Builder"** means any hosted or on-premise product, platform, UI or API that allows third parties (e.g., customers, developers, or community users other than your personnel) to create, configure, compose, train, orchestrate, deploy, or manage their own Agents using the Software, or that otherwise exposes a substantial set of the Agent-creation and orchestration functionality of the Software.
|
|
32
|
+
|
|
33
|
+
### 2.3 Agents
|
|
34
|
+
**"Agents"** means autonomous, semi-autonomous, or automated systems — including assistants, copilots, workflows, orchestrations, or other systems powered by or incorporating artificial intelligence, machine learning, large language models, or related technologies.
|
|
35
|
+
|
|
36
|
+
### 2.4 Embedded Assistant
|
|
37
|
+
**"Embedded Assistant"** means embedding the Software in your own products or services to power a specific assistant/copilot/agent experience for you or your end users (e.g., a support bot in your app or an internal helpdesk agent), where end users do not receive access to any substantial set of the Software's agent-creation or orchestration features.
|
|
38
|
+
|
|
39
|
+
### 2.5 Professional Services
|
|
40
|
+
**"Professional Services"** means using the Software to deliver a bespoke solution to a single client where only your personnel operate the Software, the client receives access solely to the resulting assistant within the client's environment and not to the agent-creation/orchestration features of the Software, and no multi-tenant or self-service builder is provided.
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { FullGraphDefinitionSchema, resourceIdSchema, MAX_ID_LENGTH } from './chunk-R3VVJXX7.js';
|
|
2
|
+
|
|
3
|
+
// src/validation/graphFull.ts
|
|
4
|
+
function isInternalAgent(agent) {
|
|
5
|
+
return "prompt" in agent;
|
|
6
|
+
}
|
|
7
|
+
function isExternalAgent(agent) {
|
|
8
|
+
return "baseUrl" in agent;
|
|
9
|
+
}
|
|
10
|
+
function validateAndTypeGraphData(data) {
|
|
11
|
+
return FullGraphDefinitionSchema.parse(data);
|
|
12
|
+
}
|
|
13
|
+
function validateToolReferences(graphData) {
|
|
14
|
+
const errors = [];
|
|
15
|
+
const availableToolIds = new Set(Object.keys(graphData.tools || {}));
|
|
16
|
+
for (const [agentId, agentData] of Object.entries(graphData.agents)) {
|
|
17
|
+
if (isInternalAgent(agentData) && agentData.tools && Array.isArray(agentData.tools)) {
|
|
18
|
+
for (const toolId of agentData.tools) {
|
|
19
|
+
if (!availableToolIds.has(toolId)) {
|
|
20
|
+
errors.push(`Agent '${agentId}' references non-existent tool '${toolId}'`);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (errors.length > 0) {
|
|
26
|
+
throw new Error(`Tool reference validation failed:
|
|
27
|
+
${errors.join("\n")}`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function validateDataComponentReferences(graphData) {
|
|
31
|
+
const errors = [];
|
|
32
|
+
const availableDataComponentIds = new Set(Object.keys(graphData.dataComponents || {}));
|
|
33
|
+
for (const [agentId, agentData] of Object.entries(graphData.agents)) {
|
|
34
|
+
if (isInternalAgent(agentData) && agentData.dataComponents) {
|
|
35
|
+
for (const dataComponentId of agentData.dataComponents) {
|
|
36
|
+
if (!availableDataComponentIds.has(dataComponentId)) {
|
|
37
|
+
errors.push(
|
|
38
|
+
`Agent '${agentId}' references non-existent dataComponent '${dataComponentId}'`
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (errors.length > 0) {
|
|
45
|
+
throw new Error(`DataComponent reference validation failed:
|
|
46
|
+
${errors.join("\n")}`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function validateArtifactComponentReferences(graphData) {
|
|
50
|
+
const errors = [];
|
|
51
|
+
const availableArtifactComponentIds = new Set(Object.keys(graphData.artifactComponents || {}));
|
|
52
|
+
for (const [agentId, agentData] of Object.entries(graphData.agents)) {
|
|
53
|
+
if (isInternalAgent(agentData) && agentData.artifactComponents) {
|
|
54
|
+
for (const artifactComponentId of agentData.artifactComponents) {
|
|
55
|
+
if (!availableArtifactComponentIds.has(artifactComponentId)) {
|
|
56
|
+
errors.push(
|
|
57
|
+
`Agent '${agentId}' references non-existent artifactComponent '${artifactComponentId}'`
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if (errors.length > 0) {
|
|
64
|
+
throw new Error(`ArtifactComponent reference validation failed:
|
|
65
|
+
${errors.join("\n")}`);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
function validateAgentRelationships(graphData) {
|
|
69
|
+
const errors = [];
|
|
70
|
+
const availableAgentIds = new Set(Object.keys(graphData.agents));
|
|
71
|
+
for (const [agentId, agentData] of Object.entries(graphData.agents)) {
|
|
72
|
+
if (isInternalAgent(agentData)) {
|
|
73
|
+
if (agentData.canTransferTo && Array.isArray(agentData.canTransferTo)) {
|
|
74
|
+
for (const targetId of agentData.canTransferTo) {
|
|
75
|
+
if (!availableAgentIds.has(targetId)) {
|
|
76
|
+
errors.push(
|
|
77
|
+
`Agent '${agentId}' has transfer target '${targetId}' that doesn't exist in graph`
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
if (agentData.canDelegateTo && Array.isArray(agentData.canDelegateTo)) {
|
|
83
|
+
for (const targetId of agentData.canDelegateTo) {
|
|
84
|
+
if (!availableAgentIds.has(targetId)) {
|
|
85
|
+
errors.push(
|
|
86
|
+
`Agent '${agentId}' has delegation target '${targetId}' that doesn't exist in graph`
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
if (errors.length > 0) {
|
|
94
|
+
throw new Error(`Agent relationship validation failed:
|
|
95
|
+
${errors.join("\n")}`);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
function validateGraphStructure(graphData) {
|
|
99
|
+
if (!graphData.agents[graphData.defaultAgentId]) {
|
|
100
|
+
throw new Error(`Default agent '${graphData.defaultAgentId}' does not exist in agents`);
|
|
101
|
+
}
|
|
102
|
+
validateToolReferences(graphData);
|
|
103
|
+
validateDataComponentReferences(graphData);
|
|
104
|
+
validateArtifactComponentReferences(graphData);
|
|
105
|
+
validateAgentRelationships(graphData);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// src/validation/id-validation.ts
|
|
109
|
+
function isValidResourceId(id) {
|
|
110
|
+
const result = resourceIdSchema.safeParse(id);
|
|
111
|
+
return result.success;
|
|
112
|
+
}
|
|
113
|
+
function generateIdFromName(name) {
|
|
114
|
+
const id = name.toLowerCase().replace(/[^a-z0-9_-]+/g, "-").replace(/^-+|-+$/g, "").replace(/-{2,}/g, "-");
|
|
115
|
+
if (!id) {
|
|
116
|
+
throw new Error("Cannot generate valid ID from provided name");
|
|
117
|
+
}
|
|
118
|
+
const truncatedId = id.substring(0, MAX_ID_LENGTH);
|
|
119
|
+
const result = resourceIdSchema.safeParse(truncatedId);
|
|
120
|
+
if (!result.success) {
|
|
121
|
+
throw new Error(`Generated ID "${truncatedId}" is not valid: ${result.error.message}`);
|
|
122
|
+
}
|
|
123
|
+
return truncatedId;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export { generateIdFromName, isExternalAgent, isInternalAgent, isValidResourceId, validateAgentRelationships, validateAndTypeGraphData, validateArtifactComponentReferences, validateDataComponentReferences, validateGraphStructure, validateToolReferences };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// src/types/a2a.ts
|
|
2
|
+
var TaskState = /* @__PURE__ */ ((TaskState2) => {
|
|
3
|
+
TaskState2["Submitted"] = "submitted";
|
|
4
|
+
TaskState2["Working"] = "working";
|
|
5
|
+
TaskState2["InputRequired"] = "input-required";
|
|
6
|
+
TaskState2["Completed"] = "completed";
|
|
7
|
+
TaskState2["Canceled"] = "canceled";
|
|
8
|
+
TaskState2["Failed"] = "failed";
|
|
9
|
+
TaskState2["Rejected"] = "rejected";
|
|
10
|
+
TaskState2["AuthRequired"] = "auth-required";
|
|
11
|
+
TaskState2["Unknown"] = "unknown";
|
|
12
|
+
return TaskState2;
|
|
13
|
+
})(TaskState || {});
|
|
14
|
+
|
|
15
|
+
export { TaskState };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __export = (target, all) => {
|
|
4
|
+
for (var name in all)
|
|
5
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
6
|
+
};
|
|
7
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
8
|
+
|
|
9
|
+
export { __export, __publicField };
|