@inkeep/agents-run-api 0.0.0-dev-20251125091044 → 0.0.0-dev-20251125151505
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 +36 -2
- package/dist/index.js +36 -2
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -8232,6 +8232,21 @@ async function handleMessageSend(c2, agent, request) {
|
|
|
8232
8232
|
});
|
|
8233
8233
|
}
|
|
8234
8234
|
}
|
|
8235
|
+
if (result.status.state === agentsCore.TaskState.Failed) {
|
|
8236
|
+
const isConnectionRefused = result.status.type === "connection_refused";
|
|
8237
|
+
if (isConnectionRefused) {
|
|
8238
|
+
return c2.json({
|
|
8239
|
+
jsonrpc: "2.0",
|
|
8240
|
+
error: {
|
|
8241
|
+
code: -32603,
|
|
8242
|
+
message: result.status.message || "Agent execution failed",
|
|
8243
|
+
data: {
|
|
8244
|
+
type: "connection_refused"
|
|
8245
|
+
}
|
|
8246
|
+
}
|
|
8247
|
+
});
|
|
8248
|
+
}
|
|
8249
|
+
}
|
|
8235
8250
|
const taskStatus = {
|
|
8236
8251
|
state: result.status.state,
|
|
8237
8252
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
@@ -12503,13 +12518,14 @@ var DEFAULT_BACKOFF = {
|
|
|
12503
12518
|
var DEFAULT_RETRY_STATUS_CODES = ["429", "500", "502", "503", "504"];
|
|
12504
12519
|
var PermanentError = class _PermanentError extends Error {
|
|
12505
12520
|
cause;
|
|
12521
|
+
type;
|
|
12506
12522
|
constructor(message, options) {
|
|
12507
12523
|
let msg = message;
|
|
12508
12524
|
if (options?.cause) {
|
|
12509
12525
|
msg += `: ${options.cause}`;
|
|
12510
12526
|
}
|
|
12511
12527
|
super(msg, options);
|
|
12512
|
-
this.name = "PermanentError";
|
|
12528
|
+
this.name = options?.type || "PermanentError";
|
|
12513
12529
|
if (typeof this.cause === "undefined") {
|
|
12514
12530
|
this.cause = options?.cause;
|
|
12515
12531
|
}
|
|
@@ -12818,6 +12834,12 @@ var A2AClient = class {
|
|
|
12818
12834
|
}
|
|
12819
12835
|
}
|
|
12820
12836
|
const rpcResponse = await httpResponse.json();
|
|
12837
|
+
if (rpcResponse.error?.data?.type === "connection_refused") {
|
|
12838
|
+
throw new PermanentError(rpcResponse.error.message, {
|
|
12839
|
+
cause: new Error(rpcResponse.error.message),
|
|
12840
|
+
type: "connection_refused"
|
|
12841
|
+
});
|
|
12842
|
+
}
|
|
12821
12843
|
if (rpcResponse.id !== requestId2) {
|
|
12822
12844
|
logger13.warn(
|
|
12823
12845
|
{
|
|
@@ -16102,6 +16124,15 @@ ${output}`;
|
|
|
16102
16124
|
logger19.debug({ error }, "Failed to track agent reasoning");
|
|
16103
16125
|
}
|
|
16104
16126
|
}
|
|
16127
|
+
if (last && last["content"] && last["content"].length > 0) {
|
|
16128
|
+
const lastContent = last["content"][last["content"].length - 1];
|
|
16129
|
+
if (lastContent["type"] === "tool-error") {
|
|
16130
|
+
const error = lastContent["error"];
|
|
16131
|
+
if (error && typeof error === "object" && "name" in error && error.name === "connection_refused") {
|
|
16132
|
+
return true;
|
|
16133
|
+
}
|
|
16134
|
+
}
|
|
16135
|
+
}
|
|
16105
16136
|
if (steps.length >= 2) {
|
|
16106
16137
|
const previousStep = steps[steps.length - 2];
|
|
16107
16138
|
if (previousStep && "toolCalls" in previousStep && previousStep.toolCalls) {
|
|
@@ -17092,10 +17123,13 @@ var createTaskHandler = (config, credentialStoreRegistry) => {
|
|
|
17092
17123
|
};
|
|
17093
17124
|
} catch (error) {
|
|
17094
17125
|
console.error("Task handler error:", error);
|
|
17126
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown error occurred";
|
|
17127
|
+
const isConnectionRefused = errorMessage.includes("Connection refused. Please check if the MCP server is running.");
|
|
17095
17128
|
return {
|
|
17096
17129
|
status: {
|
|
17097
17130
|
state: agentsCore.TaskState.Failed,
|
|
17098
|
-
message:
|
|
17131
|
+
message: errorMessage,
|
|
17132
|
+
type: isConnectionRefused ? "connection_refused" : "unknown"
|
|
17099
17133
|
},
|
|
17100
17134
|
artifacts: []
|
|
17101
17135
|
};
|
package/dist/index.js
CHANGED
|
@@ -628,6 +628,21 @@ async function handleMessageSend(c, agent, request) {
|
|
|
628
628
|
});
|
|
629
629
|
}
|
|
630
630
|
}
|
|
631
|
+
if (result.status.state === TaskState.Failed) {
|
|
632
|
+
const isConnectionRefused = result.status.type === "connection_refused";
|
|
633
|
+
if (isConnectionRefused) {
|
|
634
|
+
return c.json({
|
|
635
|
+
jsonrpc: "2.0",
|
|
636
|
+
error: {
|
|
637
|
+
code: -32603,
|
|
638
|
+
message: result.status.message || "Agent execution failed",
|
|
639
|
+
data: {
|
|
640
|
+
type: "connection_refused"
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
});
|
|
644
|
+
}
|
|
645
|
+
}
|
|
631
646
|
const taskStatus = {
|
|
632
647
|
state: result.status.state,
|
|
633
648
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
@@ -4856,13 +4871,14 @@ var DEFAULT_BACKOFF = {
|
|
|
4856
4871
|
var DEFAULT_RETRY_STATUS_CODES = ["429", "500", "502", "503", "504"];
|
|
4857
4872
|
var PermanentError = class _PermanentError extends Error {
|
|
4858
4873
|
cause;
|
|
4874
|
+
type;
|
|
4859
4875
|
constructor(message, options) {
|
|
4860
4876
|
let msg = message;
|
|
4861
4877
|
if (options?.cause) {
|
|
4862
4878
|
msg += `: ${options.cause}`;
|
|
4863
4879
|
}
|
|
4864
4880
|
super(msg, options);
|
|
4865
|
-
this.name = "PermanentError";
|
|
4881
|
+
this.name = options?.type || "PermanentError";
|
|
4866
4882
|
if (typeof this.cause === "undefined") {
|
|
4867
4883
|
this.cause = options?.cause;
|
|
4868
4884
|
}
|
|
@@ -5171,6 +5187,12 @@ var A2AClient = class {
|
|
|
5171
5187
|
}
|
|
5172
5188
|
}
|
|
5173
5189
|
const rpcResponse = await httpResponse.json();
|
|
5190
|
+
if (rpcResponse.error?.data?.type === "connection_refused") {
|
|
5191
|
+
throw new PermanentError(rpcResponse.error.message, {
|
|
5192
|
+
cause: new Error(rpcResponse.error.message),
|
|
5193
|
+
type: "connection_refused"
|
|
5194
|
+
});
|
|
5195
|
+
}
|
|
5174
5196
|
if (rpcResponse.id !== requestId2) {
|
|
5175
5197
|
logger12.warn(
|
|
5176
5198
|
{
|
|
@@ -8449,6 +8471,15 @@ ${output}`;
|
|
|
8449
8471
|
logger15.debug({ error }, "Failed to track agent reasoning");
|
|
8450
8472
|
}
|
|
8451
8473
|
}
|
|
8474
|
+
if (last && last["content"] && last["content"].length > 0) {
|
|
8475
|
+
const lastContent = last["content"][last["content"].length - 1];
|
|
8476
|
+
if (lastContent["type"] === "tool-error") {
|
|
8477
|
+
const error = lastContent["error"];
|
|
8478
|
+
if (error && typeof error === "object" && "name" in error && error.name === "connection_refused") {
|
|
8479
|
+
return true;
|
|
8480
|
+
}
|
|
8481
|
+
}
|
|
8482
|
+
}
|
|
8452
8483
|
if (steps.length >= 2) {
|
|
8453
8484
|
const previousStep = steps[steps.length - 2];
|
|
8454
8485
|
if (previousStep && "toolCalls" in previousStep && previousStep.toolCalls) {
|
|
@@ -9439,10 +9470,13 @@ var createTaskHandler = (config, credentialStoreRegistry) => {
|
|
|
9439
9470
|
};
|
|
9440
9471
|
} catch (error) {
|
|
9441
9472
|
console.error("Task handler error:", error);
|
|
9473
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown error occurred";
|
|
9474
|
+
const isConnectionRefused = errorMessage.includes("Connection refused. Please check if the MCP server is running.");
|
|
9442
9475
|
return {
|
|
9443
9476
|
status: {
|
|
9444
9477
|
state: TaskState.Failed,
|
|
9445
|
-
message:
|
|
9478
|
+
message: errorMessage,
|
|
9479
|
+
type: isConnectionRefused ? "connection_refused" : "unknown"
|
|
9446
9480
|
},
|
|
9447
9481
|
artifacts: []
|
|
9448
9482
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/agents-run-api",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20251125151505",
|
|
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",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"traverse": "^0.6.11",
|
|
56
56
|
"ts-pattern": "^5.7.1",
|
|
57
57
|
"zod": "4.1.5",
|
|
58
|
-
"@inkeep/agents-core": "^0.0.0-dev-
|
|
58
|
+
"@inkeep/agents-core": "^0.0.0-dev-20251125151505"
|
|
59
59
|
},
|
|
60
60
|
"optionalDependencies": {
|
|
61
61
|
"keytar": "^7.9.0"
|