@linnlabs/linnkit 0.36.0 → 0.37.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 +12 -1
- package/dist/cli.cjs +51 -21
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +51 -21
- package/dist/cli.js.map +1 -1
- package/dist/context-manager.cjs.map +1 -1
- package/dist/context-manager.js.map +1 -1
- package/dist/contracts/agentSpec.d.cts +30 -30
- package/dist/contracts/agentSpec.d.ts +30 -30
- package/dist/contracts/audit.d.cts +32 -32
- package/dist/contracts/audit.d.ts +32 -32
- package/dist/contracts/contextPolicy.d.cts +36 -36
- package/dist/contracts/contextPolicy.d.ts +36 -36
- package/dist/contracts/events.d.cts +1113 -1113
- package/dist/contracts/events.d.ts +1113 -1113
- package/dist/contracts/execution.d.cts +8 -8
- package/dist/contracts/execution.d.ts +8 -8
- package/dist/contracts/messages.d.cts +1178 -1178
- package/dist/contracts/messages.d.ts +1178 -1178
- package/dist/contracts/provider-continuation.d.cts +28 -28
- package/dist/contracts/provider-continuation.d.ts +28 -28
- package/dist/contracts/sse.d.cts +897 -897
- package/dist/contracts/sse.d.ts +897 -897
- package/dist/contracts/sub-run-trace-payload.d.cts +26 -26
- package/dist/contracts/sub-run-trace-payload.d.ts +26 -26
- package/dist/contracts/token-accounting.d.cts +46 -46
- package/dist/contracts/token-accounting.d.ts +46 -46
- package/dist/index.cjs +51 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +51 -21
- package/dist/index.js.map +1 -1
- package/dist/quickstart.cjs +51 -21
- package/dist/quickstart.cjs.map +1 -1
- package/dist/quickstart.js +51 -21
- package/dist/quickstart.js.map +1 -1
- package/dist/runtime-kernel/events/agentEvents.d.cts +172 -172
- package/dist/runtime-kernel/events/agentEvents.d.ts +172 -172
- package/dist/runtime-kernel/graph-engine/nodes/toolNode.d.cts +1 -0
- package/dist/runtime-kernel/graph-engine/nodes/toolNode.d.ts +1 -0
- package/dist/runtime-kernel/graph-engine/types.d.cts +2 -0
- package/dist/runtime-kernel/graph-engine/types.d.ts +2 -0
- package/dist/runtime-kernel.cjs +51 -21
- package/dist/runtime-kernel.cjs.map +1 -1
- package/dist/runtime-kernel.js +51 -21
- package/dist/runtime-kernel.js.map +1 -1
- package/dist/testkit.cjs +51 -21
- package/dist/testkit.cjs.map +1 -1
- package/dist/testkit.js +51 -21
- package/dist/testkit.js.map +1 -1
- package/docs/integration/persistence.md +9 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -12,7 +12,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
12
12
|
|
|
13
13
|
---
|
|
14
14
|
|
|
15
|
-
## [
|
|
15
|
+
## [0.37.0] - 2026-09-12
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
|
|
19
|
+
- Optional GraphNode cancellation settlement hook for already-admitted work at node transitions.
|
|
20
|
+
It never starts work and is not invoked for resumable pauses.
|
|
21
|
+
|
|
22
|
+
### Fixed
|
|
23
|
+
|
|
24
|
+
- Commit cancelled ToolNode batches before AbortError leaves the graph, preserving completed
|
|
25
|
+
tool outcomes and pairing unstarted calls. Durable Hosts no longer discard their staged
|
|
26
|
+
terminal results when closing the execution checkpoint writer.
|
|
16
27
|
|
|
17
28
|
## [0.36.0] - 2026-09-11
|
|
18
29
|
|
package/dist/cli.cjs
CHANGED
|
@@ -3007,6 +3007,26 @@ function resolveAssistantReplayParts(response) {
|
|
|
3007
3007
|
return response.assistant_replay_parts;
|
|
3008
3008
|
}
|
|
3009
3009
|
|
|
3010
|
+
// src/runtime-kernel/graph-engine/definitions/runContinuation.ts
|
|
3011
|
+
var RunRecoveryBlockedError = class extends Error {
|
|
3012
|
+
code = "RUN_RECOVERY_BLOCKED";
|
|
3013
|
+
constructor(message) {
|
|
3014
|
+
super(message);
|
|
3015
|
+
this.name = "RunRecoveryBlockedError";
|
|
3016
|
+
}
|
|
3017
|
+
};
|
|
3018
|
+
var RunPauseRequested = class extends Error {
|
|
3019
|
+
code = "RUN_PAUSE_REQUESTED";
|
|
3020
|
+
constructor(message = "Run paused by user") {
|
|
3021
|
+
super(message);
|
|
3022
|
+
this.name = "RunPauseRequested";
|
|
3023
|
+
}
|
|
3024
|
+
};
|
|
3025
|
+
function isRunPauseSignal(signal) {
|
|
3026
|
+
const reason = signal?.reason;
|
|
3027
|
+
return signal?.aborted === true && typeof reason === "object" && reason !== null && "code" in reason && reason.code === "RUN_PAUSE_REQUESTED";
|
|
3028
|
+
}
|
|
3029
|
+
|
|
3010
3030
|
// src/runtime-kernel/graph-engine/engine.ts
|
|
3011
3031
|
var logger2 = new Logger("GraphExecutor");
|
|
3012
3032
|
function isRecord4(value) {
|
|
@@ -3316,6 +3336,7 @@ var GraphExecutor = class {
|
|
|
3316
3336
|
reportStepsUsed(stepCount);
|
|
3317
3337
|
const signalRaw = state.local?.signal;
|
|
3318
3338
|
if (isAbortSignal2(signalRaw) && signalRaw.aborted) {
|
|
3339
|
+
if (!isRunPauseSignal(signalRaw)) await this.nodes.get(state.nodeId)?.cancel?.(state);
|
|
3319
3340
|
logger2.warn("[GraphExecutor] \u6536\u5230 AbortSignal\uFF0C\u7ACB\u5373\u505C\u6B62\u63A8\u7406\u5FAA\u73AF");
|
|
3320
3341
|
this.ephemeralLocals.delete(checkpointKey);
|
|
3321
3342
|
throwAbortError();
|
|
@@ -3366,6 +3387,12 @@ var GraphExecutor = class {
|
|
|
3366
3387
|
allEvents.push(...stepResolution.events);
|
|
3367
3388
|
}
|
|
3368
3389
|
state = stepResolution.state;
|
|
3390
|
+
const completedSignal = state.local?.signal;
|
|
3391
|
+
if (isAbortSignal2(completedSignal) && completedSignal.aborted && !isRunPauseSignal(completedSignal)) {
|
|
3392
|
+
await this.nodes.get(state.nodeId)?.cancel?.(state);
|
|
3393
|
+
this.ephemeralLocals.delete(checkpointKey);
|
|
3394
|
+
throwAbortError();
|
|
3395
|
+
}
|
|
3369
3396
|
if (stepResolution.action.kind === "route") {
|
|
3370
3397
|
logger2.info("[GraphExecutor] \u8DEF\u7531\u5207\u6362", {
|
|
3371
3398
|
fromNodeId: stepResolution.action.fromNodeId,
|
|
@@ -8296,26 +8323,6 @@ function buildCancelledToolBatchLocalState(local, runtimeEvents) {
|
|
|
8296
8323
|
function recordToolProtocolError(params) {
|
|
8297
8324
|
}
|
|
8298
8325
|
|
|
8299
|
-
// src/runtime-kernel/graph-engine/definitions/runContinuation.ts
|
|
8300
|
-
var RunRecoveryBlockedError = class extends Error {
|
|
8301
|
-
code = "RUN_RECOVERY_BLOCKED";
|
|
8302
|
-
constructor(message) {
|
|
8303
|
-
super(message);
|
|
8304
|
-
this.name = "RunRecoveryBlockedError";
|
|
8305
|
-
}
|
|
8306
|
-
};
|
|
8307
|
-
var RunPauseRequested = class extends Error {
|
|
8308
|
-
code = "RUN_PAUSE_REQUESTED";
|
|
8309
|
-
constructor(message = "Run paused by user") {
|
|
8310
|
-
super(message);
|
|
8311
|
-
this.name = "RunPauseRequested";
|
|
8312
|
-
}
|
|
8313
|
-
};
|
|
8314
|
-
function isRunPauseSignal(signal) {
|
|
8315
|
-
const reason = signal?.reason;
|
|
8316
|
-
return signal?.aborted === true && typeof reason === "object" && reason !== null && "code" in reason && reason.code === "RUN_PAUSE_REQUESTED";
|
|
8317
|
-
}
|
|
8318
|
-
|
|
8319
8326
|
// src/runtime-kernel/graph-engine/nodes/toolNode.recovery.ts
|
|
8320
8327
|
async function executeRecoverableTool(input) {
|
|
8321
8328
|
const local = input.state.local;
|
|
@@ -8517,7 +8524,22 @@ var ToolNode = class {
|
|
|
8517
8524
|
async run(state) {
|
|
8518
8525
|
const events = [];
|
|
8519
8526
|
while (true) {
|
|
8520
|
-
|
|
8527
|
+
let result;
|
|
8528
|
+
try {
|
|
8529
|
+
result = await this.runNextPendingToolCall(state);
|
|
8530
|
+
} catch (error) {
|
|
8531
|
+
if (isToolExecutionAbort(error) && !isRunPauseSignal(state.local?.signal)) {
|
|
8532
|
+
await this.cancel(state);
|
|
8533
|
+
}
|
|
8534
|
+
throw error;
|
|
8535
|
+
}
|
|
8536
|
+
const signal = state.local?.signal;
|
|
8537
|
+
if (isAbortSignal(signal) && signal.aborted && !isRunPauseSignal(signal)) {
|
|
8538
|
+
await this.cancel(state);
|
|
8539
|
+
const error = new Error("The user aborted a request.");
|
|
8540
|
+
error.name = "AbortError";
|
|
8541
|
+
throw error;
|
|
8542
|
+
}
|
|
8521
8543
|
await commitToolBoundary(state, result);
|
|
8522
8544
|
if (Array.isArray(result.events) && result.events.length > 0) {
|
|
8523
8545
|
events.push(...result.events);
|
|
@@ -8531,6 +8553,14 @@ var ToolNode = class {
|
|
|
8531
8553
|
};
|
|
8532
8554
|
}
|
|
8533
8555
|
}
|
|
8556
|
+
async cancel(state) {
|
|
8557
|
+
settlePendingToolCallsAfterAbort({
|
|
8558
|
+
state,
|
|
8559
|
+
calls: parsePendingToolCalls(state.local?.pendingToolCalls ?? []),
|
|
8560
|
+
toolCatalog: this.toolRuntime
|
|
8561
|
+
});
|
|
8562
|
+
await commitToolBoundary(state, { kind: "yield"});
|
|
8563
|
+
}
|
|
8534
8564
|
async runNextPendingToolCall(state) {
|
|
8535
8565
|
const calls = parsePendingToolCalls(state.local?.pendingToolCalls ?? []);
|
|
8536
8566
|
const signalRaw = state.local?.signal;
|