@inkeep/agents-sdk 0.0.0-dev-20250911210702 → 0.0.0-dev-20250911221549
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/SUPPLEMENTAL_TERMS.md +40 -0
- package/dist/index.cjs +116 -104
- package/dist/index.d.cts +230 -183
- package/dist/index.d.ts +230 -183
- package/dist/index.js +116 -104
- package/package.json +4 -3
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getLogger, generateIdFromName,
|
|
1
|
+
import { getLogger, generateIdFromName, CredentialReferenceApiInsertSchema, MCPToolConfigSchema, createDatabaseClient, getProject } from '@inkeep/agents-core';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -968,84 +968,6 @@ var Agent = class {
|
|
|
968
968
|
}
|
|
969
969
|
}
|
|
970
970
|
};
|
|
971
|
-
var TransferConfigSchema = z.object({
|
|
972
|
-
agent: z.instanceof(Agent),
|
|
973
|
-
description: z.string().optional()
|
|
974
|
-
});
|
|
975
|
-
function validateFunction(value, name) {
|
|
976
|
-
if (typeof value !== "function") {
|
|
977
|
-
throw new Error(`${name} must be a function`);
|
|
978
|
-
}
|
|
979
|
-
}
|
|
980
|
-
function agent(config) {
|
|
981
|
-
if (!config.id) {
|
|
982
|
-
throw new Error(
|
|
983
|
-
"Agent ID is required. Agents must have stable IDs for consistency across deployments."
|
|
984
|
-
);
|
|
985
|
-
}
|
|
986
|
-
return new Agent(config);
|
|
987
|
-
}
|
|
988
|
-
function mcpTool(config) {
|
|
989
|
-
const validatedConfig = MCPToolConfigSchema.parse(config);
|
|
990
|
-
return new Tool(validatedConfig);
|
|
991
|
-
}
|
|
992
|
-
function credential(config) {
|
|
993
|
-
return CredentialReferenceApiInsertSchema.parse(config);
|
|
994
|
-
}
|
|
995
|
-
function transfer(targetAgent, description, condition) {
|
|
996
|
-
if (condition !== void 0) {
|
|
997
|
-
validateFunction(condition, "condition");
|
|
998
|
-
}
|
|
999
|
-
const config = {
|
|
1000
|
-
agent: targetAgent,
|
|
1001
|
-
description: description || `Hand off to ${targetAgent.getName()}`,
|
|
1002
|
-
condition
|
|
1003
|
-
};
|
|
1004
|
-
TransferConfigSchema.parse({
|
|
1005
|
-
agent: config.agent,
|
|
1006
|
-
description: config.description
|
|
1007
|
-
});
|
|
1008
|
-
return config;
|
|
1009
|
-
}
|
|
1010
|
-
function artifactComponent(config) {
|
|
1011
|
-
return new ArtifactComponent({
|
|
1012
|
-
...config,
|
|
1013
|
-
tenantId: config.tenantId || "default",
|
|
1014
|
-
projectId: config.projectId || "default"
|
|
1015
|
-
});
|
|
1016
|
-
}
|
|
1017
|
-
function dataComponent(config) {
|
|
1018
|
-
return new DataComponent({
|
|
1019
|
-
...config,
|
|
1020
|
-
tenantId: config.tenantId || "default",
|
|
1021
|
-
projectId: config.projectId || "default"
|
|
1022
|
-
});
|
|
1023
|
-
}
|
|
1024
|
-
|
|
1025
|
-
// src/environment-settings.ts
|
|
1026
|
-
function createEnvironmentSettings(environments) {
|
|
1027
|
-
return {
|
|
1028
|
-
getEnvironmentSetting: async (key) => {
|
|
1029
|
-
const currentEnv = process.env.INKEEP_ENV || "development";
|
|
1030
|
-
const env = environments[currentEnv];
|
|
1031
|
-
if (!env) {
|
|
1032
|
-
throw new Error(
|
|
1033
|
-
`Environment '${currentEnv}' not found. Available: ${Object.keys(environments).join(", ")}`
|
|
1034
|
-
);
|
|
1035
|
-
}
|
|
1036
|
-
const credential2 = env.credentials?.[key];
|
|
1037
|
-
if (!credential2) {
|
|
1038
|
-
throw new Error(
|
|
1039
|
-
`Credential '${String(key)}' not found in environment '${currentEnv}'`
|
|
1040
|
-
);
|
|
1041
|
-
}
|
|
1042
|
-
return credential2;
|
|
1043
|
-
}
|
|
1044
|
-
};
|
|
1045
|
-
}
|
|
1046
|
-
function registerEnvironmentSettings(config) {
|
|
1047
|
-
return config;
|
|
1048
|
-
}
|
|
1049
971
|
var logger5 = getLogger("external-agent-builder");
|
|
1050
972
|
var ExternalAgent = class {
|
|
1051
973
|
constructor(config) {
|
|
@@ -2593,35 +2515,125 @@ var AgentGraph = class {
|
|
|
2593
2515
|
}
|
|
2594
2516
|
}
|
|
2595
2517
|
};
|
|
2518
|
+
|
|
2519
|
+
// src/utils/generateIdFromName.ts
|
|
2520
|
+
function generateIdFromName3(name) {
|
|
2521
|
+
return name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
2522
|
+
}
|
|
2523
|
+
|
|
2524
|
+
// src/builderFunctions.ts
|
|
2596
2525
|
function agentGraph(config) {
|
|
2597
2526
|
return new AgentGraph(config);
|
|
2598
2527
|
}
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
const graphConfig = config.default || config;
|
|
2604
|
-
const graph = agentGraph(graphConfig);
|
|
2605
|
-
await graph.init();
|
|
2606
|
-
logger7.info(
|
|
2607
|
-
{
|
|
2608
|
-
configPath,
|
|
2609
|
-
graphId: graph.getStats().graphId,
|
|
2610
|
-
agentCount: graph.getStats().agentCount
|
|
2611
|
-
},
|
|
2612
|
-
"Graph generated successfully"
|
|
2613
|
-
);
|
|
2614
|
-
return graph;
|
|
2615
|
-
} catch (error) {
|
|
2616
|
-
logger7.error(
|
|
2617
|
-
{
|
|
2618
|
-
configPath,
|
|
2619
|
-
error: error instanceof Error ? error.message : "Unknown error"
|
|
2620
|
-
},
|
|
2621
|
-
"Failed to generate graph from configuration"
|
|
2528
|
+
function agent(config) {
|
|
2529
|
+
if (!config.id) {
|
|
2530
|
+
throw new Error(
|
|
2531
|
+
"Agent ID is required. Agents must have stable IDs for consistency across deployments."
|
|
2622
2532
|
);
|
|
2623
|
-
throw error;
|
|
2624
2533
|
}
|
|
2534
|
+
return new Agent(config);
|
|
2535
|
+
}
|
|
2536
|
+
function credential(config) {
|
|
2537
|
+
return CredentialReferenceApiInsertSchema.parse(config);
|
|
2538
|
+
}
|
|
2539
|
+
function mcpServer(config) {
|
|
2540
|
+
if (!config.serverUrl) {
|
|
2541
|
+
throw new Error("MCP server requires a serverUrl");
|
|
2542
|
+
}
|
|
2543
|
+
const id = config.id || generateIdFromName3(config.name);
|
|
2544
|
+
return new Tool({
|
|
2545
|
+
id,
|
|
2546
|
+
name: config.name,
|
|
2547
|
+
description: config.description,
|
|
2548
|
+
serverUrl: config.serverUrl,
|
|
2549
|
+
tenantId: config.tenantId,
|
|
2550
|
+
credential: config.credential,
|
|
2551
|
+
activeTools: config.activeTools,
|
|
2552
|
+
headers: config.headers,
|
|
2553
|
+
imageUrl: config.imageUrl,
|
|
2554
|
+
transport: config.transport ? { type: config.transport } : void 0
|
|
2555
|
+
});
|
|
2556
|
+
}
|
|
2557
|
+
function mcpTool(config) {
|
|
2558
|
+
const configWithId = {
|
|
2559
|
+
...config,
|
|
2560
|
+
id: config.id || generateIdFromName3(config.name)
|
|
2561
|
+
};
|
|
2562
|
+
const validatedConfig = MCPToolConfigSchema.parse(configWithId);
|
|
2563
|
+
return new Tool(validatedConfig);
|
|
2564
|
+
}
|
|
2565
|
+
function artifactComponent(config) {
|
|
2566
|
+
return new ArtifactComponent({
|
|
2567
|
+
...config,
|
|
2568
|
+
tenantId: config.tenantId || "default",
|
|
2569
|
+
projectId: config.projectId || "default"
|
|
2570
|
+
});
|
|
2571
|
+
}
|
|
2572
|
+
function dataComponent(config) {
|
|
2573
|
+
return new DataComponent({
|
|
2574
|
+
...config,
|
|
2575
|
+
tenantId: config.tenantId || "default",
|
|
2576
|
+
projectId: config.projectId || "default"
|
|
2577
|
+
});
|
|
2578
|
+
}
|
|
2579
|
+
function agentMcp(config) {
|
|
2580
|
+
return {
|
|
2581
|
+
server: config.server,
|
|
2582
|
+
selectedTools: config.selectedTools
|
|
2583
|
+
};
|
|
2584
|
+
}
|
|
2585
|
+
|
|
2586
|
+
// src/utils/validateFunction.ts
|
|
2587
|
+
function validateFunction(value, name) {
|
|
2588
|
+
if (typeof value !== "function") {
|
|
2589
|
+
throw new Error(`${name} must be a function`);
|
|
2590
|
+
}
|
|
2591
|
+
}
|
|
2592
|
+
|
|
2593
|
+
// src/builders.ts
|
|
2594
|
+
var TransferConfigSchema = z.object({
|
|
2595
|
+
agent: z.instanceof(Agent),
|
|
2596
|
+
description: z.string().optional()
|
|
2597
|
+
});
|
|
2598
|
+
function transfer(targetAgent, description, condition) {
|
|
2599
|
+
if (condition !== void 0) {
|
|
2600
|
+
validateFunction(condition, "condition");
|
|
2601
|
+
}
|
|
2602
|
+
const config = {
|
|
2603
|
+
agent: targetAgent,
|
|
2604
|
+
description: description || `Hand off to ${targetAgent.getName()}`,
|
|
2605
|
+
condition
|
|
2606
|
+
};
|
|
2607
|
+
TransferConfigSchema.parse({
|
|
2608
|
+
agent: config.agent,
|
|
2609
|
+
description: config.description
|
|
2610
|
+
});
|
|
2611
|
+
return config;
|
|
2612
|
+
}
|
|
2613
|
+
|
|
2614
|
+
// src/environment-settings.ts
|
|
2615
|
+
function createEnvironmentSettings(environments) {
|
|
2616
|
+
return {
|
|
2617
|
+
getEnvironmentSetting: async (key) => {
|
|
2618
|
+
const currentEnv = process.env.INKEEP_ENV || "development";
|
|
2619
|
+
const env = environments[currentEnv];
|
|
2620
|
+
if (!env) {
|
|
2621
|
+
throw new Error(
|
|
2622
|
+
`Environment '${currentEnv}' not found. Available: ${Object.keys(environments).join(", ")}`
|
|
2623
|
+
);
|
|
2624
|
+
}
|
|
2625
|
+
const credential2 = env.credentials?.[key];
|
|
2626
|
+
if (!credential2) {
|
|
2627
|
+
throw new Error(
|
|
2628
|
+
`Credential '${String(key)}' not found in environment '${currentEnv}'`
|
|
2629
|
+
);
|
|
2630
|
+
}
|
|
2631
|
+
return credential2;
|
|
2632
|
+
}
|
|
2633
|
+
};
|
|
2634
|
+
}
|
|
2635
|
+
function registerEnvironmentSettings(config) {
|
|
2636
|
+
return config;
|
|
2625
2637
|
}
|
|
2626
2638
|
z.object({
|
|
2627
2639
|
model: z.string().optional(),
|
|
@@ -2825,4 +2837,4 @@ var run = Runner.run.bind(Runner);
|
|
|
2825
2837
|
var stream = Runner.stream.bind(Runner);
|
|
2826
2838
|
var raceGraphs = Runner.raceGraphs.bind(Runner);
|
|
2827
2839
|
|
|
2828
|
-
export { Agent,
|
|
2840
|
+
export { Agent, ArtifactComponent, DataComponent, ExternalAgent, Runner, Tool, agent, agentGraph, agentMcp, artifactComponent, createEnvironmentSettings, credential, dataComponent, externalAgent, externalAgents, mcpServer, mcpTool, raceGraphs, registerEnvironmentSettings, run, stream, transfer };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/agents-sdk",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20250911221549",
|
|
4
4
|
"description": "SDK for building and managing agents in the Inkeep Agent Framework",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"nanoid": "^5.1.5",
|
|
10
10
|
"zod": "^4.1.5",
|
|
11
|
-
"@inkeep/agents-core": "^0.0.0-dev-
|
|
11
|
+
"@inkeep/agents-core": "^0.0.0-dev-20250911221549"
|
|
12
12
|
},
|
|
13
13
|
"devDependencies": {
|
|
14
14
|
"@types/node": "^20.11.24",
|
|
@@ -28,7 +28,8 @@
|
|
|
28
28
|
"files": [
|
|
29
29
|
"dist",
|
|
30
30
|
"README.md",
|
|
31
|
-
"LICENSE.md"
|
|
31
|
+
"LICENSE.md",
|
|
32
|
+
"SUPPLEMENTAL_TERMS.md"
|
|
32
33
|
],
|
|
33
34
|
"repository": {
|
|
34
35
|
"type": "git",
|