@inkeep/agents-sdk 0.0.0-dev-20250911195722 → 0.0.0-dev-20250911212652
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/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 +2 -2
package/dist/index.cjs
CHANGED
|
@@ -970,84 +970,6 @@ var Agent = class {
|
|
|
970
970
|
}
|
|
971
971
|
}
|
|
972
972
|
};
|
|
973
|
-
var TransferConfigSchema = zod.z.object({
|
|
974
|
-
agent: zod.z.instanceof(Agent),
|
|
975
|
-
description: zod.z.string().optional()
|
|
976
|
-
});
|
|
977
|
-
function validateFunction(value, name) {
|
|
978
|
-
if (typeof value !== "function") {
|
|
979
|
-
throw new Error(`${name} must be a function`);
|
|
980
|
-
}
|
|
981
|
-
}
|
|
982
|
-
function agent(config) {
|
|
983
|
-
if (!config.id) {
|
|
984
|
-
throw new Error(
|
|
985
|
-
"Agent ID is required. Agents must have stable IDs for consistency across deployments."
|
|
986
|
-
);
|
|
987
|
-
}
|
|
988
|
-
return new Agent(config);
|
|
989
|
-
}
|
|
990
|
-
function mcpTool(config) {
|
|
991
|
-
const validatedConfig = agentsCore.MCPToolConfigSchema.parse(config);
|
|
992
|
-
return new Tool(validatedConfig);
|
|
993
|
-
}
|
|
994
|
-
function credential(config) {
|
|
995
|
-
return agentsCore.CredentialReferenceApiInsertSchema.parse(config);
|
|
996
|
-
}
|
|
997
|
-
function transfer(targetAgent, description, condition) {
|
|
998
|
-
if (condition !== void 0) {
|
|
999
|
-
validateFunction(condition, "condition");
|
|
1000
|
-
}
|
|
1001
|
-
const config = {
|
|
1002
|
-
agent: targetAgent,
|
|
1003
|
-
description: description || `Hand off to ${targetAgent.getName()}`,
|
|
1004
|
-
condition
|
|
1005
|
-
};
|
|
1006
|
-
TransferConfigSchema.parse({
|
|
1007
|
-
agent: config.agent,
|
|
1008
|
-
description: config.description
|
|
1009
|
-
});
|
|
1010
|
-
return config;
|
|
1011
|
-
}
|
|
1012
|
-
function artifactComponent(config) {
|
|
1013
|
-
return new ArtifactComponent({
|
|
1014
|
-
...config,
|
|
1015
|
-
tenantId: config.tenantId || "default",
|
|
1016
|
-
projectId: config.projectId || "default"
|
|
1017
|
-
});
|
|
1018
|
-
}
|
|
1019
|
-
function dataComponent(config) {
|
|
1020
|
-
return new DataComponent({
|
|
1021
|
-
...config,
|
|
1022
|
-
tenantId: config.tenantId || "default",
|
|
1023
|
-
projectId: config.projectId || "default"
|
|
1024
|
-
});
|
|
1025
|
-
}
|
|
1026
|
-
|
|
1027
|
-
// src/environment-settings.ts
|
|
1028
|
-
function createEnvironmentSettings(environments) {
|
|
1029
|
-
return {
|
|
1030
|
-
getEnvironmentSetting: async (key) => {
|
|
1031
|
-
const currentEnv = process.env.INKEEP_ENV || "development";
|
|
1032
|
-
const env = environments[currentEnv];
|
|
1033
|
-
if (!env) {
|
|
1034
|
-
throw new Error(
|
|
1035
|
-
`Environment '${currentEnv}' not found. Available: ${Object.keys(environments).join(", ")}`
|
|
1036
|
-
);
|
|
1037
|
-
}
|
|
1038
|
-
const credential2 = env.credentials?.[key];
|
|
1039
|
-
if (!credential2) {
|
|
1040
|
-
throw new Error(
|
|
1041
|
-
`Credential '${String(key)}' not found in environment '${currentEnv}'`
|
|
1042
|
-
);
|
|
1043
|
-
}
|
|
1044
|
-
return credential2;
|
|
1045
|
-
}
|
|
1046
|
-
};
|
|
1047
|
-
}
|
|
1048
|
-
function registerEnvironmentSettings(config) {
|
|
1049
|
-
return config;
|
|
1050
|
-
}
|
|
1051
973
|
var logger5 = agentsCore.getLogger("external-agent-builder");
|
|
1052
974
|
var ExternalAgent = class {
|
|
1053
975
|
constructor(config) {
|
|
@@ -2595,35 +2517,125 @@ var AgentGraph = class {
|
|
|
2595
2517
|
}
|
|
2596
2518
|
}
|
|
2597
2519
|
};
|
|
2520
|
+
|
|
2521
|
+
// src/utils/generateIdFromName.ts
|
|
2522
|
+
function generateIdFromName3(name) {
|
|
2523
|
+
return name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
2524
|
+
}
|
|
2525
|
+
|
|
2526
|
+
// src/builderFunctions.ts
|
|
2598
2527
|
function agentGraph(config) {
|
|
2599
2528
|
return new AgentGraph(config);
|
|
2600
2529
|
}
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
const graphConfig = config.default || config;
|
|
2606
|
-
const graph = agentGraph(graphConfig);
|
|
2607
|
-
await graph.init();
|
|
2608
|
-
logger7.info(
|
|
2609
|
-
{
|
|
2610
|
-
configPath,
|
|
2611
|
-
graphId: graph.getStats().graphId,
|
|
2612
|
-
agentCount: graph.getStats().agentCount
|
|
2613
|
-
},
|
|
2614
|
-
"Graph generated successfully"
|
|
2615
|
-
);
|
|
2616
|
-
return graph;
|
|
2617
|
-
} catch (error) {
|
|
2618
|
-
logger7.error(
|
|
2619
|
-
{
|
|
2620
|
-
configPath,
|
|
2621
|
-
error: error instanceof Error ? error.message : "Unknown error"
|
|
2622
|
-
},
|
|
2623
|
-
"Failed to generate graph from configuration"
|
|
2530
|
+
function agent(config) {
|
|
2531
|
+
if (!config.id) {
|
|
2532
|
+
throw new Error(
|
|
2533
|
+
"Agent ID is required. Agents must have stable IDs for consistency across deployments."
|
|
2624
2534
|
);
|
|
2625
|
-
throw error;
|
|
2626
2535
|
}
|
|
2536
|
+
return new Agent(config);
|
|
2537
|
+
}
|
|
2538
|
+
function credential(config) {
|
|
2539
|
+
return agentsCore.CredentialReferenceApiInsertSchema.parse(config);
|
|
2540
|
+
}
|
|
2541
|
+
function mcpServer(config) {
|
|
2542
|
+
if (!config.serverUrl) {
|
|
2543
|
+
throw new Error("MCP server requires a serverUrl");
|
|
2544
|
+
}
|
|
2545
|
+
const id = config.id || generateIdFromName3(config.name);
|
|
2546
|
+
return new Tool({
|
|
2547
|
+
id,
|
|
2548
|
+
name: config.name,
|
|
2549
|
+
description: config.description,
|
|
2550
|
+
serverUrl: config.serverUrl,
|
|
2551
|
+
tenantId: config.tenantId,
|
|
2552
|
+
credential: config.credential,
|
|
2553
|
+
activeTools: config.activeTools,
|
|
2554
|
+
headers: config.headers,
|
|
2555
|
+
imageUrl: config.imageUrl,
|
|
2556
|
+
transport: config.transport ? { type: config.transport } : void 0
|
|
2557
|
+
});
|
|
2558
|
+
}
|
|
2559
|
+
function mcpTool(config) {
|
|
2560
|
+
const configWithId = {
|
|
2561
|
+
...config,
|
|
2562
|
+
id: config.id || generateIdFromName3(config.name)
|
|
2563
|
+
};
|
|
2564
|
+
const validatedConfig = agentsCore.MCPToolConfigSchema.parse(configWithId);
|
|
2565
|
+
return new Tool(validatedConfig);
|
|
2566
|
+
}
|
|
2567
|
+
function artifactComponent(config) {
|
|
2568
|
+
return new ArtifactComponent({
|
|
2569
|
+
...config,
|
|
2570
|
+
tenantId: config.tenantId || "default",
|
|
2571
|
+
projectId: config.projectId || "default"
|
|
2572
|
+
});
|
|
2573
|
+
}
|
|
2574
|
+
function dataComponent(config) {
|
|
2575
|
+
return new DataComponent({
|
|
2576
|
+
...config,
|
|
2577
|
+
tenantId: config.tenantId || "default",
|
|
2578
|
+
projectId: config.projectId || "default"
|
|
2579
|
+
});
|
|
2580
|
+
}
|
|
2581
|
+
function agentMcp(config) {
|
|
2582
|
+
return {
|
|
2583
|
+
server: config.server,
|
|
2584
|
+
selectedTools: config.selectedTools
|
|
2585
|
+
};
|
|
2586
|
+
}
|
|
2587
|
+
|
|
2588
|
+
// src/utils/validateFunction.ts
|
|
2589
|
+
function validateFunction(value, name) {
|
|
2590
|
+
if (typeof value !== "function") {
|
|
2591
|
+
throw new Error(`${name} must be a function`);
|
|
2592
|
+
}
|
|
2593
|
+
}
|
|
2594
|
+
|
|
2595
|
+
// src/builders.ts
|
|
2596
|
+
var TransferConfigSchema = zod.z.object({
|
|
2597
|
+
agent: zod.z.instanceof(Agent),
|
|
2598
|
+
description: zod.z.string().optional()
|
|
2599
|
+
});
|
|
2600
|
+
function transfer(targetAgent, description, condition) {
|
|
2601
|
+
if (condition !== void 0) {
|
|
2602
|
+
validateFunction(condition, "condition");
|
|
2603
|
+
}
|
|
2604
|
+
const config = {
|
|
2605
|
+
agent: targetAgent,
|
|
2606
|
+
description: description || `Hand off to ${targetAgent.getName()}`,
|
|
2607
|
+
condition
|
|
2608
|
+
};
|
|
2609
|
+
TransferConfigSchema.parse({
|
|
2610
|
+
agent: config.agent,
|
|
2611
|
+
description: config.description
|
|
2612
|
+
});
|
|
2613
|
+
return config;
|
|
2614
|
+
}
|
|
2615
|
+
|
|
2616
|
+
// src/environment-settings.ts
|
|
2617
|
+
function createEnvironmentSettings(environments) {
|
|
2618
|
+
return {
|
|
2619
|
+
getEnvironmentSetting: async (key) => {
|
|
2620
|
+
const currentEnv = process.env.INKEEP_ENV || "development";
|
|
2621
|
+
const env = environments[currentEnv];
|
|
2622
|
+
if (!env) {
|
|
2623
|
+
throw new Error(
|
|
2624
|
+
`Environment '${currentEnv}' not found. Available: ${Object.keys(environments).join(", ")}`
|
|
2625
|
+
);
|
|
2626
|
+
}
|
|
2627
|
+
const credential2 = env.credentials?.[key];
|
|
2628
|
+
if (!credential2) {
|
|
2629
|
+
throw new Error(
|
|
2630
|
+
`Credential '${String(key)}' not found in environment '${currentEnv}'`
|
|
2631
|
+
);
|
|
2632
|
+
}
|
|
2633
|
+
return credential2;
|
|
2634
|
+
}
|
|
2635
|
+
};
|
|
2636
|
+
}
|
|
2637
|
+
function registerEnvironmentSettings(config) {
|
|
2638
|
+
return config;
|
|
2627
2639
|
}
|
|
2628
2640
|
zod.z.object({
|
|
2629
2641
|
model: zod.z.string().optional(),
|
|
@@ -2828,7 +2840,6 @@ var stream = Runner.stream.bind(Runner);
|
|
|
2828
2840
|
var raceGraphs = Runner.raceGraphs.bind(Runner);
|
|
2829
2841
|
|
|
2830
2842
|
exports.Agent = Agent;
|
|
2831
|
-
exports.AgentGraph = AgentGraph;
|
|
2832
2843
|
exports.ArtifactComponent = ArtifactComponent;
|
|
2833
2844
|
exports.DataComponent = DataComponent;
|
|
2834
2845
|
exports.ExternalAgent = ExternalAgent;
|
|
@@ -2836,13 +2847,14 @@ exports.Runner = Runner;
|
|
|
2836
2847
|
exports.Tool = Tool;
|
|
2837
2848
|
exports.agent = agent;
|
|
2838
2849
|
exports.agentGraph = agentGraph;
|
|
2850
|
+
exports.agentMcp = agentMcp;
|
|
2839
2851
|
exports.artifactComponent = artifactComponent;
|
|
2840
2852
|
exports.createEnvironmentSettings = createEnvironmentSettings;
|
|
2841
2853
|
exports.credential = credential;
|
|
2842
2854
|
exports.dataComponent = dataComponent;
|
|
2843
2855
|
exports.externalAgent = externalAgent;
|
|
2844
2856
|
exports.externalAgents = externalAgents;
|
|
2845
|
-
exports.
|
|
2857
|
+
exports.mcpServer = mcpServer;
|
|
2846
2858
|
exports.mcpTool = mcpTool;
|
|
2847
2859
|
exports.raceGraphs = raceGraphs;
|
|
2848
2860
|
exports.registerEnvironmentSettings = registerEnvironmentSettings;
|