@inkeep/agents-run-api 0.19.7 → 0.19.8
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.
|
@@ -303,9 +303,26 @@ var _LocalSandboxExecutor = class _LocalSandboxExecutor {
|
|
|
303
303
|
}
|
|
304
304
|
async installDependencies(sandboxDir) {
|
|
305
305
|
return new Promise((resolve, reject) => {
|
|
306
|
-
const
|
|
306
|
+
const npmEnv = {
|
|
307
|
+
...process.env,
|
|
308
|
+
// Set npm cache directory to sandbox to avoid /home/user issues
|
|
309
|
+
npm_config_cache: join(sandboxDir, ".npm-cache"),
|
|
310
|
+
// Set npm logs directory to sandbox
|
|
311
|
+
npm_config_logs_dir: join(sandboxDir, ".npm-logs"),
|
|
312
|
+
// Set npm temp directory to sandbox
|
|
313
|
+
npm_config_tmp: join(sandboxDir, ".npm-tmp"),
|
|
314
|
+
// Override HOME directory as fallback for npm
|
|
315
|
+
HOME: sandboxDir,
|
|
316
|
+
// Disable npm update notifier to avoid permission issues
|
|
317
|
+
npm_config_update_notifier: "false",
|
|
318
|
+
// Use non-interactive mode
|
|
319
|
+
npm_config_progress: "false",
|
|
320
|
+
npm_config_loglevel: "error"
|
|
321
|
+
};
|
|
322
|
+
const npm = spawn("npm", ["install", "--no-audit", "--no-fund"], {
|
|
307
323
|
cwd: sandboxDir,
|
|
308
|
-
stdio: "pipe"
|
|
324
|
+
stdio: "pipe",
|
|
325
|
+
env: npmEnv
|
|
309
326
|
});
|
|
310
327
|
let stderr = "";
|
|
311
328
|
npm.stdout?.on("data", () => {
|
package/dist/index.cjs
CHANGED
|
@@ -691,9 +691,26 @@ var init_LocalSandboxExecutor = __esm({
|
|
|
691
691
|
}
|
|
692
692
|
async installDependencies(sandboxDir) {
|
|
693
693
|
return new Promise((resolve, reject) => {
|
|
694
|
-
const
|
|
694
|
+
const npmEnv = {
|
|
695
|
+
...process.env,
|
|
696
|
+
// Set npm cache directory to sandbox to avoid /home/user issues
|
|
697
|
+
npm_config_cache: path.join(sandboxDir, ".npm-cache"),
|
|
698
|
+
// Set npm logs directory to sandbox
|
|
699
|
+
npm_config_logs_dir: path.join(sandboxDir, ".npm-logs"),
|
|
700
|
+
// Set npm temp directory to sandbox
|
|
701
|
+
npm_config_tmp: path.join(sandboxDir, ".npm-tmp"),
|
|
702
|
+
// Override HOME directory as fallback for npm
|
|
703
|
+
HOME: sandboxDir,
|
|
704
|
+
// Disable npm update notifier to avoid permission issues
|
|
705
|
+
npm_config_update_notifier: "false",
|
|
706
|
+
// Use non-interactive mode
|
|
707
|
+
npm_config_progress: "false",
|
|
708
|
+
npm_config_loglevel: "error"
|
|
709
|
+
};
|
|
710
|
+
const npm = child_process.spawn("npm", ["install", "--no-audit", "--no-fund"], {
|
|
695
711
|
cwd: sandboxDir,
|
|
696
|
-
stdio: "pipe"
|
|
712
|
+
stdio: "pipe",
|
|
713
|
+
env: npmEnv
|
|
697
714
|
});
|
|
698
715
|
let stderr = "";
|
|
699
716
|
npm.stdout?.on("data", () => {
|
|
@@ -3166,8 +3183,14 @@ var AgentSession = class {
|
|
|
3166
3183
|
return `Agent ${event.subAgentId} generating response`;
|
|
3167
3184
|
case "agent_reasoning":
|
|
3168
3185
|
return `Agent ${event.subAgentId} reasoning through request`;
|
|
3169
|
-
case "
|
|
3170
|
-
return `Tool
|
|
3186
|
+
case "tool_call":
|
|
3187
|
+
return `Tool call: ${event.data.toolName || "unknown"}`;
|
|
3188
|
+
case "tool_result": {
|
|
3189
|
+
const status = event.data.error ? "failed" : "completed";
|
|
3190
|
+
return `Tool result: ${event.data.toolName || "unknown"} (${status})`;
|
|
3191
|
+
}
|
|
3192
|
+
case "error":
|
|
3193
|
+
return `Error: ${event.data.message}`;
|
|
3171
3194
|
case "transfer":
|
|
3172
3195
|
return `Agent transfer: ${event.data.fromSubAgent} \u2192 ${event.data.targetSubAgent}`;
|
|
3173
3196
|
case "delegation_sent":
|
|
@@ -3888,15 +3911,29 @@ ${this.statusUpdateState?.config.prompt?.trim() || ""}`;
|
|
|
3888
3911
|
const activities = [];
|
|
3889
3912
|
for (const event of events) {
|
|
3890
3913
|
switch (event.eventType) {
|
|
3891
|
-
case "
|
|
3892
|
-
|
|
3914
|
+
case "tool_call": {
|
|
3915
|
+
activities.push(
|
|
3916
|
+
`\u{1F527} **${event.data.toolName}** (called)
|
|
3917
|
+
\u{1F4E5} Input: ${JSON.stringify(event.data.args)}`
|
|
3918
|
+
);
|
|
3919
|
+
break;
|
|
3920
|
+
}
|
|
3921
|
+
case "tool_result": {
|
|
3922
|
+
const resultStr = event.data.error ? `\u274C Error: ${event.data.error}` : JSON.stringify(event.data.result);
|
|
3893
3923
|
activities.push(
|
|
3894
3924
|
`\u{1F527} **${event.data.toolName}** ${event.data.duration ? `(${event.data.duration}ms)` : ""}
|
|
3895
|
-
\u{1F4E5} Input: ${JSON.stringify(event.data.args)}
|
|
3896
3925
|
\u{1F4E4} Output: ${resultStr}`
|
|
3897
3926
|
);
|
|
3898
3927
|
break;
|
|
3899
3928
|
}
|
|
3929
|
+
case "error": {
|
|
3930
|
+
activities.push(
|
|
3931
|
+
`\u274C **Error**: ${event.data.message}
|
|
3932
|
+
\u{1F50D} Code: ${event.data.code || "unknown"}
|
|
3933
|
+
\u{1F4CA} Severity: ${event.data.severity || "error"}`
|
|
3934
|
+
);
|
|
3935
|
+
break;
|
|
3936
|
+
}
|
|
3900
3937
|
// INTERNAL OPERATIONS - DO NOT EXPOSE TO STATUS UPDATES
|
|
3901
3938
|
case "transfer":
|
|
3902
3939
|
case "delegation_sent":
|
|
@@ -3981,7 +4018,7 @@ ${this.statusUpdateState?.config.prompt?.trim() || ""}`;
|
|
|
3981
4018
|
}
|
|
3982
4019
|
});
|
|
3983
4020
|
const toolCallEvent = this.events.find(
|
|
3984
|
-
(event) => event.eventType === "
|
|
4021
|
+
(event) => event.eventType === "tool_result" && event.data && "toolCallId" in event.data && event.data.toolCallId === artifactData.metadata?.toolCallId
|
|
3985
4022
|
);
|
|
3986
4023
|
const toolContext = toolCallEvent ? {
|
|
3987
4024
|
toolName: toolCallEvent.data.toolName,
|
|
@@ -7604,14 +7641,22 @@ var Agent = class {
|
|
|
7604
7641
|
});
|
|
7605
7642
|
}
|
|
7606
7643
|
const isInternalTool = toolName.includes("save_tool_result") || toolName.includes("thinking_complete") || toolName.startsWith("transfer_to_") || toolName.startsWith("delegate_to_");
|
|
7644
|
+
if (streamRequestId && !isInternalTool) {
|
|
7645
|
+
agentSessionManager.recordEvent(streamRequestId, "tool_call", this.config.id, {
|
|
7646
|
+
toolName,
|
|
7647
|
+
args,
|
|
7648
|
+
toolCallId: context?.toolCallId,
|
|
7649
|
+
toolId
|
|
7650
|
+
});
|
|
7651
|
+
}
|
|
7607
7652
|
try {
|
|
7608
7653
|
const result = await originalExecute(args, context);
|
|
7609
7654
|
const duration = Date.now() - startTime;
|
|
7610
7655
|
if (streamRequestId && !isInternalTool) {
|
|
7611
|
-
agentSessionManager.recordEvent(streamRequestId, "
|
|
7656
|
+
agentSessionManager.recordEvent(streamRequestId, "tool_result", this.config.id, {
|
|
7612
7657
|
toolName,
|
|
7613
|
-
args,
|
|
7614
7658
|
result,
|
|
7659
|
+
toolCallId: context?.toolCallId,
|
|
7615
7660
|
toolId,
|
|
7616
7661
|
duration
|
|
7617
7662
|
});
|
|
@@ -7621,12 +7666,13 @@ var Agent = class {
|
|
|
7621
7666
|
const duration = Date.now() - startTime;
|
|
7622
7667
|
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
7623
7668
|
if (streamRequestId && !isInternalTool) {
|
|
7624
|
-
agentSessionManager.recordEvent(streamRequestId, "
|
|
7669
|
+
agentSessionManager.recordEvent(streamRequestId, "tool_result", this.config.id, {
|
|
7625
7670
|
toolName,
|
|
7626
|
-
|
|
7627
|
-
|
|
7671
|
+
result: null,
|
|
7672
|
+
toolCallId: context?.toolCallId,
|
|
7628
7673
|
toolId,
|
|
7629
|
-
duration
|
|
7674
|
+
duration,
|
|
7675
|
+
error: errorMessage
|
|
7630
7676
|
});
|
|
7631
7677
|
}
|
|
7632
7678
|
throw error;
|
|
@@ -7895,13 +7941,14 @@ var Agent = class {
|
|
|
7895
7941
|
},
|
|
7896
7942
|
(span) => {
|
|
7897
7943
|
agentsCore.setSpanWithError(span, new Error(`0 effective tools available for ${tool3.name}`));
|
|
7898
|
-
agentSessionManager.recordEvent(streamRequestId, "
|
|
7899
|
-
|
|
7900
|
-
|
|
7901
|
-
|
|
7902
|
-
|
|
7903
|
-
|
|
7904
|
-
serverUrl: tool3.config.type === "mcp" ? tool3.config.mcp.server.url : "unknown"
|
|
7944
|
+
agentSessionManager.recordEvent(streamRequestId, "error", this.config.id, {
|
|
7945
|
+
message: `MCP server has 0 effective tools. Double check the selected tools in your graph and the active tools in the MCP server configuration.`,
|
|
7946
|
+
code: "no_tools_available",
|
|
7947
|
+
severity: "error",
|
|
7948
|
+
context: {
|
|
7949
|
+
toolName: tool3.name,
|
|
7950
|
+
serverUrl: tool3.config.type === "mcp" ? tool3.config.mcp.server.url : "unknown",
|
|
7951
|
+
operation: "mcp_tool_discovery"
|
|
7905
7952
|
}
|
|
7906
7953
|
});
|
|
7907
7954
|
span.end();
|
|
@@ -8726,7 +8773,9 @@ var Agent = class {
|
|
|
8726
8773
|
if (steps.length >= 2) {
|
|
8727
8774
|
const previousStep = steps[steps.length - 2];
|
|
8728
8775
|
if (previousStep && "toolCalls" in previousStep && previousStep.toolCalls) {
|
|
8729
|
-
const hasTransferCall = previousStep.toolCalls.some(
|
|
8776
|
+
const hasTransferCall = previousStep.toolCalls.some(
|
|
8777
|
+
(tc) => tc.toolName.startsWith("transfer_to_")
|
|
8778
|
+
);
|
|
8730
8779
|
if (hasTransferCall && "toolResults" in previousStep && previousStep.toolResults) {
|
|
8731
8780
|
return true;
|
|
8732
8781
|
}
|
package/dist/index.js
CHANGED
|
@@ -2250,8 +2250,14 @@ var AgentSession = class {
|
|
|
2250
2250
|
return `Agent ${event.subAgentId} generating response`;
|
|
2251
2251
|
case "agent_reasoning":
|
|
2252
2252
|
return `Agent ${event.subAgentId} reasoning through request`;
|
|
2253
|
-
case "
|
|
2254
|
-
return `Tool
|
|
2253
|
+
case "tool_call":
|
|
2254
|
+
return `Tool call: ${event.data.toolName || "unknown"}`;
|
|
2255
|
+
case "tool_result": {
|
|
2256
|
+
const status = event.data.error ? "failed" : "completed";
|
|
2257
|
+
return `Tool result: ${event.data.toolName || "unknown"} (${status})`;
|
|
2258
|
+
}
|
|
2259
|
+
case "error":
|
|
2260
|
+
return `Error: ${event.data.message}`;
|
|
2255
2261
|
case "transfer":
|
|
2256
2262
|
return `Agent transfer: ${event.data.fromSubAgent} \u2192 ${event.data.targetSubAgent}`;
|
|
2257
2263
|
case "delegation_sent":
|
|
@@ -2972,15 +2978,29 @@ ${this.statusUpdateState?.config.prompt?.trim() || ""}`;
|
|
|
2972
2978
|
const activities = [];
|
|
2973
2979
|
for (const event of events) {
|
|
2974
2980
|
switch (event.eventType) {
|
|
2975
|
-
case "
|
|
2976
|
-
|
|
2981
|
+
case "tool_call": {
|
|
2982
|
+
activities.push(
|
|
2983
|
+
`\u{1F527} **${event.data.toolName}** (called)
|
|
2984
|
+
\u{1F4E5} Input: ${JSON.stringify(event.data.args)}`
|
|
2985
|
+
);
|
|
2986
|
+
break;
|
|
2987
|
+
}
|
|
2988
|
+
case "tool_result": {
|
|
2989
|
+
const resultStr = event.data.error ? `\u274C Error: ${event.data.error}` : JSON.stringify(event.data.result);
|
|
2977
2990
|
activities.push(
|
|
2978
2991
|
`\u{1F527} **${event.data.toolName}** ${event.data.duration ? `(${event.data.duration}ms)` : ""}
|
|
2979
|
-
\u{1F4E5} Input: ${JSON.stringify(event.data.args)}
|
|
2980
2992
|
\u{1F4E4} Output: ${resultStr}`
|
|
2981
2993
|
);
|
|
2982
2994
|
break;
|
|
2983
2995
|
}
|
|
2996
|
+
case "error": {
|
|
2997
|
+
activities.push(
|
|
2998
|
+
`\u274C **Error**: ${event.data.message}
|
|
2999
|
+
\u{1F50D} Code: ${event.data.code || "unknown"}
|
|
3000
|
+
\u{1F4CA} Severity: ${event.data.severity || "error"}`
|
|
3001
|
+
);
|
|
3002
|
+
break;
|
|
3003
|
+
}
|
|
2984
3004
|
// INTERNAL OPERATIONS - DO NOT EXPOSE TO STATUS UPDATES
|
|
2985
3005
|
case "transfer":
|
|
2986
3006
|
case "delegation_sent":
|
|
@@ -3065,7 +3085,7 @@ ${this.statusUpdateState?.config.prompt?.trim() || ""}`;
|
|
|
3065
3085
|
}
|
|
3066
3086
|
});
|
|
3067
3087
|
const toolCallEvent = this.events.find(
|
|
3068
|
-
(event) => event.eventType === "
|
|
3088
|
+
(event) => event.eventType === "tool_result" && event.data && "toolCallId" in event.data && event.data.toolCallId === artifactData.metadata?.toolCallId
|
|
3069
3089
|
);
|
|
3070
3090
|
const toolContext = toolCallEvent ? {
|
|
3071
3091
|
toolName: toolCallEvent.data.toolName,
|
|
@@ -6663,14 +6683,22 @@ var Agent = class {
|
|
|
6663
6683
|
});
|
|
6664
6684
|
}
|
|
6665
6685
|
const isInternalTool = toolName.includes("save_tool_result") || toolName.includes("thinking_complete") || toolName.startsWith("transfer_to_") || toolName.startsWith("delegate_to_");
|
|
6686
|
+
if (streamRequestId && !isInternalTool) {
|
|
6687
|
+
agentSessionManager.recordEvent(streamRequestId, "tool_call", this.config.id, {
|
|
6688
|
+
toolName,
|
|
6689
|
+
args,
|
|
6690
|
+
toolCallId: context?.toolCallId,
|
|
6691
|
+
toolId
|
|
6692
|
+
});
|
|
6693
|
+
}
|
|
6666
6694
|
try {
|
|
6667
6695
|
const result = await originalExecute(args, context);
|
|
6668
6696
|
const duration = Date.now() - startTime;
|
|
6669
6697
|
if (streamRequestId && !isInternalTool) {
|
|
6670
|
-
agentSessionManager.recordEvent(streamRequestId, "
|
|
6698
|
+
agentSessionManager.recordEvent(streamRequestId, "tool_result", this.config.id, {
|
|
6671
6699
|
toolName,
|
|
6672
|
-
args,
|
|
6673
6700
|
result,
|
|
6701
|
+
toolCallId: context?.toolCallId,
|
|
6674
6702
|
toolId,
|
|
6675
6703
|
duration
|
|
6676
6704
|
});
|
|
@@ -6680,12 +6708,13 @@ var Agent = class {
|
|
|
6680
6708
|
const duration = Date.now() - startTime;
|
|
6681
6709
|
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
6682
6710
|
if (streamRequestId && !isInternalTool) {
|
|
6683
|
-
agentSessionManager.recordEvent(streamRequestId, "
|
|
6711
|
+
agentSessionManager.recordEvent(streamRequestId, "tool_result", this.config.id, {
|
|
6684
6712
|
toolName,
|
|
6685
|
-
|
|
6686
|
-
|
|
6713
|
+
result: null,
|
|
6714
|
+
toolCallId: context?.toolCallId,
|
|
6687
6715
|
toolId,
|
|
6688
|
-
duration
|
|
6716
|
+
duration,
|
|
6717
|
+
error: errorMessage
|
|
6689
6718
|
});
|
|
6690
6719
|
}
|
|
6691
6720
|
throw error;
|
|
@@ -6954,13 +6983,14 @@ var Agent = class {
|
|
|
6954
6983
|
},
|
|
6955
6984
|
(span) => {
|
|
6956
6985
|
setSpanWithError(span, new Error(`0 effective tools available for ${tool3.name}`));
|
|
6957
|
-
agentSessionManager.recordEvent(streamRequestId, "
|
|
6958
|
-
|
|
6959
|
-
|
|
6960
|
-
|
|
6961
|
-
|
|
6962
|
-
|
|
6963
|
-
serverUrl: tool3.config.type === "mcp" ? tool3.config.mcp.server.url : "unknown"
|
|
6986
|
+
agentSessionManager.recordEvent(streamRequestId, "error", this.config.id, {
|
|
6987
|
+
message: `MCP server has 0 effective tools. Double check the selected tools in your graph and the active tools in the MCP server configuration.`,
|
|
6988
|
+
code: "no_tools_available",
|
|
6989
|
+
severity: "error",
|
|
6990
|
+
context: {
|
|
6991
|
+
toolName: tool3.name,
|
|
6992
|
+
serverUrl: tool3.config.type === "mcp" ? tool3.config.mcp.server.url : "unknown",
|
|
6993
|
+
operation: "mcp_tool_discovery"
|
|
6964
6994
|
}
|
|
6965
6995
|
});
|
|
6966
6996
|
span.end();
|
|
@@ -7016,7 +7046,7 @@ var Agent = class {
|
|
|
7016
7046
|
if (functionToolsData.length === 0) {
|
|
7017
7047
|
return functionTools;
|
|
7018
7048
|
}
|
|
7019
|
-
const { LocalSandboxExecutor } = await import('./LocalSandboxExecutor-
|
|
7049
|
+
const { LocalSandboxExecutor } = await import('./LocalSandboxExecutor-S6BPJMJV.js');
|
|
7020
7050
|
const sandboxExecutor = LocalSandboxExecutor.getInstance();
|
|
7021
7051
|
for (const functionToolDef of functionToolsData) {
|
|
7022
7052
|
const functionId = functionToolDef.functionId;
|
|
@@ -7785,7 +7815,9 @@ var Agent = class {
|
|
|
7785
7815
|
if (steps.length >= 2) {
|
|
7786
7816
|
const previousStep = steps[steps.length - 2];
|
|
7787
7817
|
if (previousStep && "toolCalls" in previousStep && previousStep.toolCalls) {
|
|
7788
|
-
const hasTransferCall = previousStep.toolCalls.some(
|
|
7818
|
+
const hasTransferCall = previousStep.toolCalls.some(
|
|
7819
|
+
(tc) => tc.toolName.startsWith("transfer_to_")
|
|
7820
|
+
);
|
|
7789
7821
|
if (hasTransferCall && "toolResults" in previousStep && previousStep.toolResults) {
|
|
7790
7822
|
return true;
|
|
7791
7823
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/agents-run-api",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.8",
|
|
4
4
|
"description": "Agents Run API for Inkeep Agent Framework - handles chat, agent execution, and streaming",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"traverse": "^0.6.11",
|
|
52
52
|
"ts-pattern": "^5.7.1",
|
|
53
53
|
"zod": "^4.1.11",
|
|
54
|
-
"@inkeep/agents-core": "^0.19.
|
|
54
|
+
"@inkeep/agents-core": "^0.19.8"
|
|
55
55
|
},
|
|
56
56
|
"optionalDependencies": {
|
|
57
57
|
"keytar": "^7.9.0"
|