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