@tangle-network/agent-app 0.60.42 → 0.60.44
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.
|
@@ -1819,6 +1819,17 @@ function aggregateNativeCompletionReceipts(turns) {
|
|
|
1819
1819
|
completedTurnIds: turns.map((turn) => turn.turnId)
|
|
1820
1820
|
};
|
|
1821
1821
|
}
|
|
1822
|
+
var TOOL_ABORTED_ERROR = "The Sandbox aborted a tool call before the turn finished, as when its runtime restarts mid-turn";
|
|
1823
|
+
function abortedToolCall(parts) {
|
|
1824
|
+
for (const part of parts) {
|
|
1825
|
+
if (part.type !== "tool") continue;
|
|
1826
|
+
const state = part.state;
|
|
1827
|
+
if (state?.status === "error" && /tool execution aborted/i.test(String(state.error ?? ""))) {
|
|
1828
|
+
return typeof part.tool === "string" ? part.tool : "tool";
|
|
1829
|
+
}
|
|
1830
|
+
}
|
|
1831
|
+
return void 0;
|
|
1832
|
+
}
|
|
1822
1833
|
function missingTurnReceipt(turnId, error) {
|
|
1823
1834
|
return { turnId, state: "failed", text: "", parts: [], usage: {}, error };
|
|
1824
1835
|
}
|
|
@@ -1883,13 +1894,17 @@ async function observeNativeCompletion(options) {
|
|
|
1883
1894
|
}
|
|
1884
1895
|
const completed = run.status === "completed" ? await readCompletedSandboxTurn(source, { turnId, sessionId: options.sessionId, since }) : null;
|
|
1885
1896
|
if (run.status === "completed" && completed) {
|
|
1897
|
+
const aborted = abortedToolCall(completed.parts ?? []);
|
|
1886
1898
|
recovered.push({
|
|
1887
1899
|
...completed,
|
|
1888
1900
|
turnId,
|
|
1889
|
-
|
|
1901
|
+
// A run the runtime ended while a tool was still running reports
|
|
1902
|
+
// completed, but its reply stops mid-work. It is a failed turn.
|
|
1903
|
+
state: aborted ? "failed" : "completed",
|
|
1890
1904
|
text: completed.text ?? "",
|
|
1891
1905
|
parts: completed.parts ?? [],
|
|
1892
|
-
usage: completed.usage ?? {}
|
|
1906
|
+
usage: completed.usage ?? {},
|
|
1907
|
+
...aborted ? { error: `${TOOL_ABORTED_ERROR} (${aborted})` } : {}
|
|
1893
1908
|
});
|
|
1894
1909
|
continue;
|
|
1895
1910
|
}
|
|
@@ -3373,6 +3388,7 @@ export {
|
|
|
3373
3388
|
OOXML_WORD_MACRO_ENABLED_MIME,
|
|
3374
3389
|
OOXML_WORD_MIME,
|
|
3375
3390
|
PROMOTE_MAX_FILE_BYTES,
|
|
3391
|
+
TOOL_ABORTED_ERROR,
|
|
3376
3392
|
UPLOAD_INLINE_MAX_BYTES,
|
|
3377
3393
|
UPLOAD_MAX_FILE_BYTES,
|
|
3378
3394
|
aggregateNativeCompletionReceipts,
|