@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/dist/testkit.js
CHANGED
|
@@ -3097,6 +3097,26 @@ function resolveAssistantReplayParts(response) {
|
|
|
3097
3097
|
return response.assistant_replay_parts;
|
|
3098
3098
|
}
|
|
3099
3099
|
|
|
3100
|
+
// src/runtime-kernel/graph-engine/definitions/runContinuation.ts
|
|
3101
|
+
var RunRecoveryBlockedError = class extends Error {
|
|
3102
|
+
code = "RUN_RECOVERY_BLOCKED";
|
|
3103
|
+
constructor(message) {
|
|
3104
|
+
super(message);
|
|
3105
|
+
this.name = "RunRecoveryBlockedError";
|
|
3106
|
+
}
|
|
3107
|
+
};
|
|
3108
|
+
var RunPauseRequested = class extends Error {
|
|
3109
|
+
code = "RUN_PAUSE_REQUESTED";
|
|
3110
|
+
constructor(message = "Run paused by user") {
|
|
3111
|
+
super(message);
|
|
3112
|
+
this.name = "RunPauseRequested";
|
|
3113
|
+
}
|
|
3114
|
+
};
|
|
3115
|
+
function isRunPauseSignal(signal) {
|
|
3116
|
+
const reason = signal?.reason;
|
|
3117
|
+
return signal?.aborted === true && typeof reason === "object" && reason !== null && "code" in reason && reason.code === "RUN_PAUSE_REQUESTED";
|
|
3118
|
+
}
|
|
3119
|
+
|
|
3100
3120
|
// src/runtime-kernel/graph-engine/engine.ts
|
|
3101
3121
|
var logger2 = new Logger("GraphExecutor");
|
|
3102
3122
|
function isRecord4(value) {
|
|
@@ -3406,6 +3426,7 @@ var GraphExecutor = class {
|
|
|
3406
3426
|
reportStepsUsed(stepCount);
|
|
3407
3427
|
const signalRaw = state.local?.signal;
|
|
3408
3428
|
if (isAbortSignal2(signalRaw) && signalRaw.aborted) {
|
|
3429
|
+
if (!isRunPauseSignal(signalRaw)) await this.nodes.get(state.nodeId)?.cancel?.(state);
|
|
3409
3430
|
logger2.warn("[GraphExecutor] \u6536\u5230 AbortSignal\uFF0C\u7ACB\u5373\u505C\u6B62\u63A8\u7406\u5FAA\u73AF");
|
|
3410
3431
|
this.ephemeralLocals.delete(checkpointKey);
|
|
3411
3432
|
throwAbortError();
|
|
@@ -3456,6 +3477,12 @@ var GraphExecutor = class {
|
|
|
3456
3477
|
allEvents.push(...stepResolution.events);
|
|
3457
3478
|
}
|
|
3458
3479
|
state = stepResolution.state;
|
|
3480
|
+
const completedSignal = state.local?.signal;
|
|
3481
|
+
if (isAbortSignal2(completedSignal) && completedSignal.aborted && !isRunPauseSignal(completedSignal)) {
|
|
3482
|
+
await this.nodes.get(state.nodeId)?.cancel?.(state);
|
|
3483
|
+
this.ephemeralLocals.delete(checkpointKey);
|
|
3484
|
+
throwAbortError();
|
|
3485
|
+
}
|
|
3459
3486
|
if (stepResolution.action.kind === "route") {
|
|
3460
3487
|
logger2.info("[GraphExecutor] \u8DEF\u7531\u5207\u6362", {
|
|
3461
3488
|
fromNodeId: stepResolution.action.fromNodeId,
|
|
@@ -8665,26 +8692,6 @@ function buildCancelledToolBatchLocalState(local, runtimeEvents) {
|
|
|
8665
8692
|
function recordToolProtocolError(params) {
|
|
8666
8693
|
}
|
|
8667
8694
|
|
|
8668
|
-
// src/runtime-kernel/graph-engine/definitions/runContinuation.ts
|
|
8669
|
-
var RunRecoveryBlockedError = class extends Error {
|
|
8670
|
-
code = "RUN_RECOVERY_BLOCKED";
|
|
8671
|
-
constructor(message) {
|
|
8672
|
-
super(message);
|
|
8673
|
-
this.name = "RunRecoveryBlockedError";
|
|
8674
|
-
}
|
|
8675
|
-
};
|
|
8676
|
-
var RunPauseRequested = class extends Error {
|
|
8677
|
-
code = "RUN_PAUSE_REQUESTED";
|
|
8678
|
-
constructor(message = "Run paused by user") {
|
|
8679
|
-
super(message);
|
|
8680
|
-
this.name = "RunPauseRequested";
|
|
8681
|
-
}
|
|
8682
|
-
};
|
|
8683
|
-
function isRunPauseSignal(signal) {
|
|
8684
|
-
const reason = signal?.reason;
|
|
8685
|
-
return signal?.aborted === true && typeof reason === "object" && reason !== null && "code" in reason && reason.code === "RUN_PAUSE_REQUESTED";
|
|
8686
|
-
}
|
|
8687
|
-
|
|
8688
8695
|
// src/runtime-kernel/graph-engine/nodes/toolNode.recovery.ts
|
|
8689
8696
|
async function executeRecoverableTool(input) {
|
|
8690
8697
|
const local = input.state.local;
|
|
@@ -8886,7 +8893,22 @@ var ToolNode = class {
|
|
|
8886
8893
|
async run(state) {
|
|
8887
8894
|
const events = [];
|
|
8888
8895
|
while (true) {
|
|
8889
|
-
|
|
8896
|
+
let result;
|
|
8897
|
+
try {
|
|
8898
|
+
result = await this.runNextPendingToolCall(state);
|
|
8899
|
+
} catch (error) {
|
|
8900
|
+
if (isToolExecutionAbort(error) && !isRunPauseSignal(state.local?.signal)) {
|
|
8901
|
+
await this.cancel(state);
|
|
8902
|
+
}
|
|
8903
|
+
throw error;
|
|
8904
|
+
}
|
|
8905
|
+
const signal = state.local?.signal;
|
|
8906
|
+
if (isAbortSignal(signal) && signal.aborted && !isRunPauseSignal(signal)) {
|
|
8907
|
+
await this.cancel(state);
|
|
8908
|
+
const error = new Error("The user aborted a request.");
|
|
8909
|
+
error.name = "AbortError";
|
|
8910
|
+
throw error;
|
|
8911
|
+
}
|
|
8890
8912
|
await commitToolBoundary(state, result);
|
|
8891
8913
|
if (Array.isArray(result.events) && result.events.length > 0) {
|
|
8892
8914
|
events.push(...result.events);
|
|
@@ -8900,6 +8922,14 @@ var ToolNode = class {
|
|
|
8900
8922
|
};
|
|
8901
8923
|
}
|
|
8902
8924
|
}
|
|
8925
|
+
async cancel(state) {
|
|
8926
|
+
settlePendingToolCallsAfterAbort({
|
|
8927
|
+
state,
|
|
8928
|
+
calls: parsePendingToolCalls(state.local?.pendingToolCalls ?? []),
|
|
8929
|
+
toolCatalog: this.toolRuntime
|
|
8930
|
+
});
|
|
8931
|
+
await commitToolBoundary(state, { kind: "yield"});
|
|
8932
|
+
}
|
|
8903
8933
|
async runNextPendingToolCall(state) {
|
|
8904
8934
|
const calls = parsePendingToolCalls(state.local?.pendingToolCalls ?? []);
|
|
8905
8935
|
const signalRaw = state.local?.signal;
|