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