@inkeep/agents-sdk 0.0.0-dev-20251010175818 → 0.0.0-dev-20251010180500
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 +47 -19
- package/dist/index.js +47 -19
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -455,16 +455,20 @@ function buildToolManifestFromCodeTS(code, projectRoot = process.cwd()) {
|
|
|
455
455
|
const warnings = [];
|
|
456
456
|
const dependencies = {};
|
|
457
457
|
for (const pkg of deps) {
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
458
|
+
try {
|
|
459
|
+
const v = resolveInstalledVersion(pkg, projectRoot);
|
|
460
|
+
if (!v) {
|
|
461
|
+
warnings.push(`Could not resolve version for "${pkg}"`);
|
|
462
|
+
continue;
|
|
463
|
+
}
|
|
464
|
+
if ("unresolved" in v) {
|
|
465
|
+
warnings.push(`Using range for "${pkg}" -> ${v.range} (no lockfile / not installed)`);
|
|
466
|
+
dependencies[pkg] = v.range;
|
|
467
|
+
} else {
|
|
468
|
+
dependencies[pkg] = v.exact;
|
|
469
|
+
}
|
|
470
|
+
} catch {
|
|
471
|
+
dependencies[pkg] = false;
|
|
468
472
|
}
|
|
469
473
|
}
|
|
470
474
|
return { dependencies, warnings };
|
|
@@ -480,7 +484,14 @@ var FunctionTool = class {
|
|
|
480
484
|
this.id = generateIdFromName(config.name);
|
|
481
485
|
if (!config.dependencies) {
|
|
482
486
|
const executeCode = typeof config.execute === "string" ? config.execute : config.execute.toString();
|
|
483
|
-
|
|
487
|
+
const deps = getFunctionToolDeps(config.name, executeCode);
|
|
488
|
+
for (const dep in deps) {
|
|
489
|
+
if (deps[dep] === false) {
|
|
490
|
+
delete deps[dep];
|
|
491
|
+
}
|
|
492
|
+
throw new Error(`Dependency \x1B[1;32m${dep}\x1B[0m used in function tool \x1B[1;32m${config.name}\x1B[0m is neither installed nor in dependencies object.`);
|
|
493
|
+
}
|
|
494
|
+
this.config.dependencies = deps;
|
|
484
495
|
}
|
|
485
496
|
logger4.info(
|
|
486
497
|
{
|
|
@@ -1623,6 +1634,8 @@ var AgentGraph = class {
|
|
|
1623
1634
|
*/
|
|
1624
1635
|
async toFullGraphDefinition() {
|
|
1625
1636
|
const agentsObject = {};
|
|
1637
|
+
const functionToolsObject = {};
|
|
1638
|
+
const functionsObject = {};
|
|
1626
1639
|
for (const agent of this.subAgents) {
|
|
1627
1640
|
if (this.isInternalAgent(agent)) {
|
|
1628
1641
|
const internalAgent = agent;
|
|
@@ -1641,6 +1654,23 @@ var AgentGraph = class {
|
|
|
1641
1654
|
headersMapping[toolId] = toolInstance.headers;
|
|
1642
1655
|
}
|
|
1643
1656
|
tools.push(toolId);
|
|
1657
|
+
if (toolInstance.constructor.name === "FunctionTool" && toolInstance instanceof FunctionTool) {
|
|
1658
|
+
if (!functionsObject[toolId]) {
|
|
1659
|
+
const functionData = toolInstance.serializeFunction();
|
|
1660
|
+
functionsObject[toolId] = functionData;
|
|
1661
|
+
}
|
|
1662
|
+
if (!functionToolsObject[toolId]) {
|
|
1663
|
+
const toolData = toolInstance.serializeTool();
|
|
1664
|
+
functionToolsObject[toolId] = {
|
|
1665
|
+
id: toolData.id,
|
|
1666
|
+
name: toolData.name,
|
|
1667
|
+
description: toolData.description,
|
|
1668
|
+
functionId: toolData.functionId,
|
|
1669
|
+
graphId: this.graphId
|
|
1670
|
+
// Include graphId for graph-scoped function tools
|
|
1671
|
+
};
|
|
1672
|
+
}
|
|
1673
|
+
}
|
|
1644
1674
|
}
|
|
1645
1675
|
const dataComponents = [];
|
|
1646
1676
|
const subAgentDataComponents = internalAgent.getDataComponents();
|
|
@@ -1697,6 +1727,8 @@ var AgentGraph = class {
|
|
|
1697
1727
|
defaultSubAgentId: this.defaultSubAgent?.getId() || "",
|
|
1698
1728
|
subAgents: agentsObject,
|
|
1699
1729
|
contextConfig: this.contextConfig?.toObject(),
|
|
1730
|
+
...Object.keys(functionToolsObject).length > 0 && { functionTools: functionToolsObject },
|
|
1731
|
+
...Object.keys(functionsObject).length > 0 && { functions: functionsObject },
|
|
1700
1732
|
models: this.models,
|
|
1701
1733
|
statusUpdates: this.statusUpdateSettings,
|
|
1702
1734
|
graphPrompt: this.graphPrompt,
|
|
@@ -3231,6 +3263,7 @@ var Project = class {
|
|
|
3231
3263
|
async toFullProjectDefinition() {
|
|
3232
3264
|
const graphsObject = {};
|
|
3233
3265
|
const toolsObject = {};
|
|
3266
|
+
const functionToolsObject = {};
|
|
3234
3267
|
const functionsObject = {};
|
|
3235
3268
|
const dataComponentsObject = {};
|
|
3236
3269
|
const artifactComponentsObject = {};
|
|
@@ -3323,18 +3356,13 @@ var Project = class {
|
|
|
3323
3356
|
const functionData = actualTool.serializeFunction();
|
|
3324
3357
|
functionsObject[toolId] = functionData;
|
|
3325
3358
|
}
|
|
3326
|
-
if (!
|
|
3359
|
+
if (!functionToolsObject[toolId]) {
|
|
3327
3360
|
const toolData = actualTool.serializeTool();
|
|
3328
|
-
|
|
3329
|
-
type: "function"
|
|
3330
|
-
// No inline function details - they're in the functions table via functionId
|
|
3331
|
-
};
|
|
3332
|
-
toolsObject[toolId] = {
|
|
3361
|
+
functionToolsObject[toolId] = {
|
|
3333
3362
|
id: toolData.id,
|
|
3334
3363
|
name: toolData.name,
|
|
3335
3364
|
description: toolData.description,
|
|
3336
|
-
functionId: toolData.functionId
|
|
3337
|
-
config: toolConfig
|
|
3365
|
+
functionId: toolData.functionId
|
|
3338
3366
|
};
|
|
3339
3367
|
}
|
|
3340
3368
|
} else {
|
package/dist/index.js
CHANGED
|
@@ -427,16 +427,20 @@ function buildToolManifestFromCodeTS(code, projectRoot = process.cwd()) {
|
|
|
427
427
|
const warnings = [];
|
|
428
428
|
const dependencies = {};
|
|
429
429
|
for (const pkg of deps) {
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
430
|
+
try {
|
|
431
|
+
const v = resolveInstalledVersion(pkg, projectRoot);
|
|
432
|
+
if (!v) {
|
|
433
|
+
warnings.push(`Could not resolve version for "${pkg}"`);
|
|
434
|
+
continue;
|
|
435
|
+
}
|
|
436
|
+
if ("unresolved" in v) {
|
|
437
|
+
warnings.push(`Using range for "${pkg}" -> ${v.range} (no lockfile / not installed)`);
|
|
438
|
+
dependencies[pkg] = v.range;
|
|
439
|
+
} else {
|
|
440
|
+
dependencies[pkg] = v.exact;
|
|
441
|
+
}
|
|
442
|
+
} catch {
|
|
443
|
+
dependencies[pkg] = false;
|
|
440
444
|
}
|
|
441
445
|
}
|
|
442
446
|
return { dependencies, warnings };
|
|
@@ -452,7 +456,14 @@ var FunctionTool = class {
|
|
|
452
456
|
this.id = generateIdFromName(config.name);
|
|
453
457
|
if (!config.dependencies) {
|
|
454
458
|
const executeCode = typeof config.execute === "string" ? config.execute : config.execute.toString();
|
|
455
|
-
|
|
459
|
+
const deps = getFunctionToolDeps(config.name, executeCode);
|
|
460
|
+
for (const dep in deps) {
|
|
461
|
+
if (deps[dep] === false) {
|
|
462
|
+
delete deps[dep];
|
|
463
|
+
}
|
|
464
|
+
throw new Error(`Dependency \x1B[1;32m${dep}\x1B[0m used in function tool \x1B[1;32m${config.name}\x1B[0m is neither installed nor in dependencies object.`);
|
|
465
|
+
}
|
|
466
|
+
this.config.dependencies = deps;
|
|
456
467
|
}
|
|
457
468
|
logger4.info(
|
|
458
469
|
{
|
|
@@ -1595,6 +1606,8 @@ var AgentGraph = class {
|
|
|
1595
1606
|
*/
|
|
1596
1607
|
async toFullGraphDefinition() {
|
|
1597
1608
|
const agentsObject = {};
|
|
1609
|
+
const functionToolsObject = {};
|
|
1610
|
+
const functionsObject = {};
|
|
1598
1611
|
for (const agent of this.subAgents) {
|
|
1599
1612
|
if (this.isInternalAgent(agent)) {
|
|
1600
1613
|
const internalAgent = agent;
|
|
@@ -1613,6 +1626,23 @@ var AgentGraph = class {
|
|
|
1613
1626
|
headersMapping[toolId] = toolInstance.headers;
|
|
1614
1627
|
}
|
|
1615
1628
|
tools.push(toolId);
|
|
1629
|
+
if (toolInstance.constructor.name === "FunctionTool" && toolInstance instanceof FunctionTool) {
|
|
1630
|
+
if (!functionsObject[toolId]) {
|
|
1631
|
+
const functionData = toolInstance.serializeFunction();
|
|
1632
|
+
functionsObject[toolId] = functionData;
|
|
1633
|
+
}
|
|
1634
|
+
if (!functionToolsObject[toolId]) {
|
|
1635
|
+
const toolData = toolInstance.serializeTool();
|
|
1636
|
+
functionToolsObject[toolId] = {
|
|
1637
|
+
id: toolData.id,
|
|
1638
|
+
name: toolData.name,
|
|
1639
|
+
description: toolData.description,
|
|
1640
|
+
functionId: toolData.functionId,
|
|
1641
|
+
graphId: this.graphId
|
|
1642
|
+
// Include graphId for graph-scoped function tools
|
|
1643
|
+
};
|
|
1644
|
+
}
|
|
1645
|
+
}
|
|
1616
1646
|
}
|
|
1617
1647
|
const dataComponents = [];
|
|
1618
1648
|
const subAgentDataComponents = internalAgent.getDataComponents();
|
|
@@ -1669,6 +1699,8 @@ var AgentGraph = class {
|
|
|
1669
1699
|
defaultSubAgentId: this.defaultSubAgent?.getId() || "",
|
|
1670
1700
|
subAgents: agentsObject,
|
|
1671
1701
|
contextConfig: this.contextConfig?.toObject(),
|
|
1702
|
+
...Object.keys(functionToolsObject).length > 0 && { functionTools: functionToolsObject },
|
|
1703
|
+
...Object.keys(functionsObject).length > 0 && { functions: functionsObject },
|
|
1672
1704
|
models: this.models,
|
|
1673
1705
|
statusUpdates: this.statusUpdateSettings,
|
|
1674
1706
|
graphPrompt: this.graphPrompt,
|
|
@@ -3203,6 +3235,7 @@ var Project = class {
|
|
|
3203
3235
|
async toFullProjectDefinition() {
|
|
3204
3236
|
const graphsObject = {};
|
|
3205
3237
|
const toolsObject = {};
|
|
3238
|
+
const functionToolsObject = {};
|
|
3206
3239
|
const functionsObject = {};
|
|
3207
3240
|
const dataComponentsObject = {};
|
|
3208
3241
|
const artifactComponentsObject = {};
|
|
@@ -3295,18 +3328,13 @@ var Project = class {
|
|
|
3295
3328
|
const functionData = actualTool.serializeFunction();
|
|
3296
3329
|
functionsObject[toolId] = functionData;
|
|
3297
3330
|
}
|
|
3298
|
-
if (!
|
|
3331
|
+
if (!functionToolsObject[toolId]) {
|
|
3299
3332
|
const toolData = actualTool.serializeTool();
|
|
3300
|
-
|
|
3301
|
-
type: "function"
|
|
3302
|
-
// No inline function details - they're in the functions table via functionId
|
|
3303
|
-
};
|
|
3304
|
-
toolsObject[toolId] = {
|
|
3333
|
+
functionToolsObject[toolId] = {
|
|
3305
3334
|
id: toolData.id,
|
|
3306
3335
|
name: toolData.name,
|
|
3307
3336
|
description: toolData.description,
|
|
3308
|
-
functionId: toolData.functionId
|
|
3309
|
-
config: toolConfig
|
|
3337
|
+
functionId: toolData.functionId
|
|
3310
3338
|
};
|
|
3311
3339
|
}
|
|
3312
3340
|
} else {
|
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-20251010180500",
|
|
4
4
|
"description": "Agents SDK for building and managing agents in the Inkeep Agent Framework",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"nanoid": "^5.1.5",
|
|
13
13
|
"typescript": "^5.3.3",
|
|
14
14
|
"zod": "^4.1.11",
|
|
15
|
-
"@inkeep/agents-core": "^0.0.0-dev-
|
|
15
|
+
"@inkeep/agents-core": "^0.0.0-dev-20251010180500"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"@types/js-yaml": "^4.0.9",
|