@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/quickstart.js
CHANGED
|
@@ -8732,9 +8732,49 @@ function recordToolProtocolError(params) {
|
|
|
8732
8732
|
}
|
|
8733
8733
|
|
|
8734
8734
|
// src/runtime-kernel/graph-engine/nodes/toolNode.recovery.ts
|
|
8735
|
+
var DEFAULT_TOOL_ABORT_GRACE_MS = 3e3;
|
|
8736
|
+
function settleToolWithinAbortGrace(input) {
|
|
8737
|
+
const { execution, signal, graceMs } = input;
|
|
8738
|
+
if (!signal) return execution;
|
|
8739
|
+
return new Promise((resolve, reject) => {
|
|
8740
|
+
let timer;
|
|
8741
|
+
const cleanup = () => {
|
|
8742
|
+
if (timer !== void 0) clearTimeout(timer);
|
|
8743
|
+
signal.removeEventListener("abort", startGrace);
|
|
8744
|
+
};
|
|
8745
|
+
function startGrace() {
|
|
8746
|
+
timer = setTimeout(() => {
|
|
8747
|
+
cleanup();
|
|
8748
|
+
execution.catch(() => void 0);
|
|
8749
|
+
input.onAbandon?.();
|
|
8750
|
+
const error = new Error("Tool did not stop within the abort grace period; its late outcome is discarded.");
|
|
8751
|
+
error.name = "AbortError";
|
|
8752
|
+
reject(error);
|
|
8753
|
+
}, graceMs);
|
|
8754
|
+
}
|
|
8755
|
+
if (signal.aborted) startGrace();
|
|
8756
|
+
else signal.addEventListener("abort", startGrace, { once: true });
|
|
8757
|
+
execution.then(
|
|
8758
|
+
(value) => {
|
|
8759
|
+
cleanup();
|
|
8760
|
+
resolve(value);
|
|
8761
|
+
},
|
|
8762
|
+
(error) => {
|
|
8763
|
+
cleanup();
|
|
8764
|
+
reject(error);
|
|
8765
|
+
}
|
|
8766
|
+
);
|
|
8767
|
+
});
|
|
8768
|
+
}
|
|
8735
8769
|
async function executeRecoverableTool(input) {
|
|
8736
8770
|
const local = input.state.local;
|
|
8737
|
-
|
|
8771
|
+
const run = () => settleToolWithinAbortGrace({
|
|
8772
|
+
execution: input.execute(),
|
|
8773
|
+
signal: local?.signal,
|
|
8774
|
+
graceMs: input.abortGraceMs ?? DEFAULT_TOOL_ABORT_GRACE_MS,
|
|
8775
|
+
onAbandon: input.onAbandon
|
|
8776
|
+
});
|
|
8777
|
+
if (!local?.commitExecutionBoundary) return run();
|
|
8738
8778
|
if (local.executingToolCallId) {
|
|
8739
8779
|
if (local.executingToolCallId !== input.call.id) {
|
|
8740
8780
|
throw new RunRecoveryBlockedError("Pending tool identity does not match execution intent");
|
|
@@ -8747,7 +8787,7 @@ async function executeRecoverableTool(input) {
|
|
|
8747
8787
|
}
|
|
8748
8788
|
local.executingToolCallId = input.call.id;
|
|
8749
8789
|
await local.commitExecutionBoundary(input.state);
|
|
8750
|
-
const result = await
|
|
8790
|
+
const result = await run();
|
|
8751
8791
|
if (!result.success && isRunPauseSignal(local.signal)) {
|
|
8752
8792
|
const error = new Error("Tool execution paused before its outcome was confirmed");
|
|
8753
8793
|
error.name = "AbortError";
|
|
@@ -8867,7 +8907,9 @@ var ToolNode = class {
|
|
|
8867
8907
|
auditPort;
|
|
8868
8908
|
modelInputResolver;
|
|
8869
8909
|
idempotencyInFlight = /* @__PURE__ */ new Map();
|
|
8910
|
+
abortGraceMs;
|
|
8870
8911
|
constructor(dependencies) {
|
|
8912
|
+
this.abortGraceMs = dependencies.abortGraceMs;
|
|
8871
8913
|
this.toolRuntime = dependencies.toolRuntime;
|
|
8872
8914
|
this.observationPreview = dependencies.observationPreview;
|
|
8873
8915
|
this.telemetryPort = dependencies.telemetryPort ?? noopTelemetry;
|
|
@@ -9085,6 +9127,13 @@ var ToolNode = class {
|
|
|
9085
9127
|
state,
|
|
9086
9128
|
call,
|
|
9087
9129
|
context: prepared.toolContext,
|
|
9130
|
+
abortGraceMs: this.abortGraceMs,
|
|
9131
|
+
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", {
|
|
9132
|
+
toolName: execution.toolName,
|
|
9133
|
+
toolCallId: execution.toolCallId,
|
|
9134
|
+
conversationId: prepared.conversationId,
|
|
9135
|
+
turnId: prepared.turnId
|
|
9136
|
+
}),
|
|
9088
9137
|
execute: () => executeToolWithIdempotency({
|
|
9089
9138
|
idempotencyKey: execution.idempotencyKey,
|
|
9090
9139
|
inFlight: this.idempotencyInFlight,
|