@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/testkit.cjs
CHANGED
|
@@ -8993,9 +8993,49 @@ function recordToolProtocolError(params) {
|
|
|
8993
8993
|
}
|
|
8994
8994
|
|
|
8995
8995
|
// src/runtime-kernel/graph-engine/nodes/toolNode.recovery.ts
|
|
8996
|
+
var DEFAULT_TOOL_ABORT_GRACE_MS = 3e3;
|
|
8997
|
+
function settleToolWithinAbortGrace(input) {
|
|
8998
|
+
const { execution, signal, graceMs } = input;
|
|
8999
|
+
if (!signal) return execution;
|
|
9000
|
+
return new Promise((resolve, reject) => {
|
|
9001
|
+
let timer;
|
|
9002
|
+
const cleanup = () => {
|
|
9003
|
+
if (timer !== void 0) clearTimeout(timer);
|
|
9004
|
+
signal.removeEventListener("abort", startGrace);
|
|
9005
|
+
};
|
|
9006
|
+
function startGrace() {
|
|
9007
|
+
timer = setTimeout(() => {
|
|
9008
|
+
cleanup();
|
|
9009
|
+
execution.catch(() => void 0);
|
|
9010
|
+
input.onAbandon?.();
|
|
9011
|
+
const error = new Error("Tool did not stop within the abort grace period; its late outcome is discarded.");
|
|
9012
|
+
error.name = "AbortError";
|
|
9013
|
+
reject(error);
|
|
9014
|
+
}, graceMs);
|
|
9015
|
+
}
|
|
9016
|
+
if (signal.aborted) startGrace();
|
|
9017
|
+
else signal.addEventListener("abort", startGrace, { once: true });
|
|
9018
|
+
execution.then(
|
|
9019
|
+
(value) => {
|
|
9020
|
+
cleanup();
|
|
9021
|
+
resolve(value);
|
|
9022
|
+
},
|
|
9023
|
+
(error) => {
|
|
9024
|
+
cleanup();
|
|
9025
|
+
reject(error);
|
|
9026
|
+
}
|
|
9027
|
+
);
|
|
9028
|
+
});
|
|
9029
|
+
}
|
|
8996
9030
|
async function executeRecoverableTool(input) {
|
|
8997
9031
|
const local = input.state.local;
|
|
8998
|
-
|
|
9032
|
+
const run = () => settleToolWithinAbortGrace({
|
|
9033
|
+
execution: input.execute(),
|
|
9034
|
+
signal: local?.signal,
|
|
9035
|
+
graceMs: input.abortGraceMs ?? DEFAULT_TOOL_ABORT_GRACE_MS,
|
|
9036
|
+
onAbandon: input.onAbandon
|
|
9037
|
+
});
|
|
9038
|
+
if (!local?.commitExecutionBoundary) return run();
|
|
8999
9039
|
if (local.executingToolCallId) {
|
|
9000
9040
|
if (local.executingToolCallId !== input.call.id) {
|
|
9001
9041
|
throw new RunRecoveryBlockedError("Pending tool identity does not match execution intent");
|
|
@@ -9008,7 +9048,7 @@ async function executeRecoverableTool(input) {
|
|
|
9008
9048
|
}
|
|
9009
9049
|
local.executingToolCallId = input.call.id;
|
|
9010
9050
|
await local.commitExecutionBoundary(input.state);
|
|
9011
|
-
const result = await
|
|
9051
|
+
const result = await run();
|
|
9012
9052
|
if (!result.success && isRunPauseSignal(local.signal)) {
|
|
9013
9053
|
const error = new Error("Tool execution paused before its outcome was confirmed");
|
|
9014
9054
|
error.name = "AbortError";
|
|
@@ -9128,7 +9168,9 @@ var ToolNode = class {
|
|
|
9128
9168
|
auditPort;
|
|
9129
9169
|
modelInputResolver;
|
|
9130
9170
|
idempotencyInFlight = /* @__PURE__ */ new Map();
|
|
9171
|
+
abortGraceMs;
|
|
9131
9172
|
constructor(dependencies) {
|
|
9173
|
+
this.abortGraceMs = dependencies.abortGraceMs;
|
|
9132
9174
|
this.toolRuntime = dependencies.toolRuntime;
|
|
9133
9175
|
this.observationPreview = dependencies.observationPreview;
|
|
9134
9176
|
this.telemetryPort = dependencies.telemetryPort ?? noopTelemetry;
|
|
@@ -9346,6 +9388,13 @@ var ToolNode = class {
|
|
|
9346
9388
|
state,
|
|
9347
9389
|
call,
|
|
9348
9390
|
context: prepared.toolContext,
|
|
9391
|
+
abortGraceMs: this.abortGraceMs,
|
|
9392
|
+
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", {
|
|
9393
|
+
toolName: execution.toolName,
|
|
9394
|
+
toolCallId: execution.toolCallId,
|
|
9395
|
+
conversationId: prepared.conversationId,
|
|
9396
|
+
turnId: prepared.turnId
|
|
9397
|
+
}),
|
|
9349
9398
|
execute: () => executeToolWithIdempotency({
|
|
9350
9399
|
idempotencyKey: execution.idempotencyKey,
|
|
9351
9400
|
inFlight: this.idempotencyInFlight,
|