@mantyx/sdk 0.21.0 → 0.22.0
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/CHANGELOG.md +7 -0
- package/dist/a2a-server.cjs.map +1 -1
- package/dist/a2a-server.js +1 -1
- package/dist/{chunk-QMUVI3Y3.js → chunk-5NKXV5XZ.js} +30 -6
- package/dist/{chunk-QMUVI3Y3.js.map → chunk-5NKXV5XZ.js.map} +1 -1
- package/dist/index.cjs +30 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1092,11 +1092,23 @@ var MantyxClient = class {
|
|
|
1092
1092
|
}
|
|
1093
1093
|
}
|
|
1094
1094
|
async postToolResult(runId, toolUseId, payload) {
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1095
|
+
const path = `/agent-runs/${encodeURIComponent(runId)}/tool-results`;
|
|
1096
|
+
const body = { toolUseId, ...payload };
|
|
1097
|
+
for (let attempt = 0; attempt < TOOL_RESULT_POST_MAX_ATTEMPTS; attempt++) {
|
|
1098
|
+
try {
|
|
1099
|
+
await this.request({
|
|
1100
|
+
method: "POST",
|
|
1101
|
+
path,
|
|
1102
|
+
body
|
|
1103
|
+
});
|
|
1104
|
+
return;
|
|
1105
|
+
} catch (err) {
|
|
1106
|
+
if (attempt === TOOL_RESULT_POST_MAX_ATTEMPTS - 1 || !isToolResultPostRetryable(err)) {
|
|
1107
|
+
return;
|
|
1108
|
+
}
|
|
1109
|
+
await sleep(toolResultPostBackoffMs(attempt));
|
|
1110
|
+
}
|
|
1111
|
+
}
|
|
1100
1112
|
}
|
|
1101
1113
|
async cancelRun(runId) {
|
|
1102
1114
|
await this.request({
|
|
@@ -1935,6 +1947,18 @@ function parseRunOutput(result, validator) {
|
|
|
1935
1947
|
function sleep(ms) {
|
|
1936
1948
|
return new Promise((r) => setTimeout(r, ms));
|
|
1937
1949
|
}
|
|
1950
|
+
var TOOL_RESULT_POST_MAX_ATTEMPTS = 6;
|
|
1951
|
+
function toolResultPostBackoffMs(attempt) {
|
|
1952
|
+
return Math.min(500 * 2 ** attempt, 8e3);
|
|
1953
|
+
}
|
|
1954
|
+
function isToolResultPostRetryable(err) {
|
|
1955
|
+
if (err instanceof MantyxNetworkError) return true;
|
|
1956
|
+
if (err instanceof MantyxError && typeof err.status === "number") {
|
|
1957
|
+
if (err.status === 429) return true;
|
|
1958
|
+
if (err.status >= 500) return true;
|
|
1959
|
+
}
|
|
1960
|
+
return false;
|
|
1961
|
+
}
|
|
1938
1962
|
function parseRunTokens(value) {
|
|
1939
1963
|
if (!value || typeof value !== "object" || Array.isArray(value)) return void 0;
|
|
1940
1964
|
const v = value;
|
|
@@ -2576,7 +2600,7 @@ async function runComputerUse(opts) {
|
|
|
2576
2600
|
}
|
|
2577
2601
|
|
|
2578
2602
|
// src/version.ts
|
|
2579
|
-
var SDK_VERSION = "0.
|
|
2603
|
+
var SDK_VERSION = "0.22.0";
|
|
2580
2604
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2581
2605
|
0 && (module.exports = {
|
|
2582
2606
|
AgentSession,
|