@linnlabs/linnkit 0.44.0 → 0.45.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 +17 -0
- package/dist/cli.cjs +51 -2
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +51 -2
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +51 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +51 -2
- package/dist/index.js.map +1 -1
- package/dist/quickstart.cjs +51 -2
- package/dist/quickstart.cjs.map +1 -1
- package/dist/quickstart.js +51 -2
- package/dist/quickstart.js.map +1 -1
- package/dist/runtime-kernel/graph-engine/nodes/toolNode.d.cts +3 -0
- package/dist/runtime-kernel/graph-engine/nodes/toolNode.d.ts +3 -0
- package/dist/runtime-kernel.cjs +51 -2
- package/dist/runtime-kernel.cjs.map +1 -1
- package/dist/runtime-kernel.js +51 -2
- package/dist/runtime-kernel.js.map +1 -1
- package/dist/testkit.cjs +51 -2
- package/dist/testkit.cjs.map +1 -1
- package/dist/testkit.js +51 -2
- package/dist/testkit.js.map +1 -1
- package/docs/integration/run-supervisor.md +1 -0
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -8618,9 +8618,49 @@ function recordToolProtocolError(params) {
|
|
|
8618
8618
|
}
|
|
8619
8619
|
|
|
8620
8620
|
// src/runtime-kernel/graph-engine/nodes/toolNode.recovery.ts
|
|
8621
|
+
var DEFAULT_TOOL_ABORT_GRACE_MS = 3e3;
|
|
8622
|
+
function settleToolWithinAbortGrace(input) {
|
|
8623
|
+
const { execution, signal, graceMs } = input;
|
|
8624
|
+
if (!signal) return execution;
|
|
8625
|
+
return new Promise((resolve5, reject) => {
|
|
8626
|
+
let timer;
|
|
8627
|
+
const cleanup = () => {
|
|
8628
|
+
if (timer !== void 0) clearTimeout(timer);
|
|
8629
|
+
signal.removeEventListener("abort", startGrace);
|
|
8630
|
+
};
|
|
8631
|
+
function startGrace() {
|
|
8632
|
+
timer = setTimeout(() => {
|
|
8633
|
+
cleanup();
|
|
8634
|
+
execution.catch(() => void 0);
|
|
8635
|
+
input.onAbandon?.();
|
|
8636
|
+
const error = new Error("Tool did not stop within the abort grace period; its late outcome is discarded.");
|
|
8637
|
+
error.name = "AbortError";
|
|
8638
|
+
reject(error);
|
|
8639
|
+
}, graceMs);
|
|
8640
|
+
}
|
|
8641
|
+
if (signal.aborted) startGrace();
|
|
8642
|
+
else signal.addEventListener("abort", startGrace, { once: true });
|
|
8643
|
+
execution.then(
|
|
8644
|
+
(value) => {
|
|
8645
|
+
cleanup();
|
|
8646
|
+
resolve5(value);
|
|
8647
|
+
},
|
|
8648
|
+
(error) => {
|
|
8649
|
+
cleanup();
|
|
8650
|
+
reject(error);
|
|
8651
|
+
}
|
|
8652
|
+
);
|
|
8653
|
+
});
|
|
8654
|
+
}
|
|
8621
8655
|
async function executeRecoverableTool(input) {
|
|
8622
8656
|
const local = input.state.local;
|
|
8623
|
-
|
|
8657
|
+
const run = () => settleToolWithinAbortGrace({
|
|
8658
|
+
execution: input.execute(),
|
|
8659
|
+
signal: local?.signal,
|
|
8660
|
+
graceMs: input.abortGraceMs ?? DEFAULT_TOOL_ABORT_GRACE_MS,
|
|
8661
|
+
onAbandon: input.onAbandon
|
|
8662
|
+
});
|
|
8663
|
+
if (!local?.commitExecutionBoundary) return run();
|
|
8624
8664
|
if (local.executingToolCallId) {
|
|
8625
8665
|
if (local.executingToolCallId !== input.call.id) {
|
|
8626
8666
|
throw new RunRecoveryBlockedError("Pending tool identity does not match execution intent");
|
|
@@ -8633,7 +8673,7 @@ async function executeRecoverableTool(input) {
|
|
|
8633
8673
|
}
|
|
8634
8674
|
local.executingToolCallId = input.call.id;
|
|
8635
8675
|
await local.commitExecutionBoundary(input.state);
|
|
8636
|
-
const result = await
|
|
8676
|
+
const result = await run();
|
|
8637
8677
|
if (!result.success && isRunPauseSignal(local.signal)) {
|
|
8638
8678
|
const error = new Error("Tool execution paused before its outcome was confirmed");
|
|
8639
8679
|
error.name = "AbortError";
|
|
@@ -8753,7 +8793,9 @@ var ToolNode = class {
|
|
|
8753
8793
|
auditPort;
|
|
8754
8794
|
modelInputResolver;
|
|
8755
8795
|
idempotencyInFlight = /* @__PURE__ */ new Map();
|
|
8796
|
+
abortGraceMs;
|
|
8756
8797
|
constructor(dependencies) {
|
|
8798
|
+
this.abortGraceMs = dependencies.abortGraceMs;
|
|
8757
8799
|
this.toolRuntime = dependencies.toolRuntime;
|
|
8758
8800
|
this.observationPreview = dependencies.observationPreview;
|
|
8759
8801
|
this.telemetryPort = dependencies.telemetryPort ?? noopTelemetry;
|
|
@@ -8971,6 +9013,13 @@ var ToolNode = class {
|
|
|
8971
9013
|
state,
|
|
8972
9014
|
call,
|
|
8973
9015
|
context: prepared.toolContext,
|
|
9016
|
+
abortGraceMs: this.abortGraceMs,
|
|
9017
|
+
onAbandon: () => logger11.warn("[ToolNode] \u5DE5\u5177\u672A\u5728\u505C\u6B62\u671F\u9650\u5185\u7ED3\u675F\uFF0C\u6309\u4E2D\u65AD\u5904\u7406\u5E76\u4E22\u5F03\u8FDF\u5230\u7ED3\u679C", {
|
|
9018
|
+
toolName: execution.toolName,
|
|
9019
|
+
toolCallId: execution.toolCallId,
|
|
9020
|
+
conversationId: prepared.conversationId,
|
|
9021
|
+
turnId: prepared.turnId
|
|
9022
|
+
}),
|
|
8974
9023
|
execute: () => executeToolWithIdempotency({
|
|
8975
9024
|
idempotencyKey: execution.idempotencyKey,
|
|
8976
9025
|
inFlight: this.idempotencyInFlight,
|