@linnlabs/linnkit 0.35.1 → 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 +21 -1
- package/dist/cli.cjs +64 -24
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +64 -24
- 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/index.cjs +64 -24
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +64 -24
- package/dist/index.js.map +1 -1
- package/dist/quickstart.cjs +64 -24
- package/dist/quickstart.cjs.map +1 -1
- package/dist/quickstart.js +64 -24
- package/dist/quickstart.js.map +1 -1
- 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/run-supervisor/definitions/runSupervisorContracts.d.cts +3 -1
- package/dist/runtime-kernel/run-supervisor/definitions/runSupervisorContracts.d.ts +3 -1
- package/dist/runtime-kernel/run-supervisor/runSupervisor.d.cts +2 -2
- package/dist/runtime-kernel/run-supervisor/runSupervisor.d.ts +2 -2
- package/dist/runtime-kernel.cjs +64 -24
- package/dist/runtime-kernel.cjs.map +1 -1
- package/dist/runtime-kernel.js +64 -24
- package/dist/runtime-kernel.js.map +1 -1
- package/dist/testkit.cjs +64 -24
- package/dist/testkit.cjs.map +1 -1
- package/dist/testkit.js +64 -24
- package/dist/testkit.js.map +1 -1
- package/docs/integration/persistence.md +9 -0
- package/docs/integration/run-supervisor.md +2 -0
- package/package.json +2 -2
|
@@ -81,4 +81,13 @@ Graph 在节点调用前保存进度,每个工具 call 前保存执行意图
|
|
|
81
81
|
工具为失败。Host 仍负责 RunDescriptor、权限重建、唯一 activation、生命周期和资源保留。
|
|
82
82
|
仅使用原 `Checkpointer` 的 Host 不会自动获得这些恢复保证。
|
|
83
83
|
|
|
84
|
+
永久取消时 ToolNode 在 AbortError 离开前提交 yielded 边界,保留真实已完成结果并为未启动
|
|
85
|
+
调用配对取消输出。Graph 在节点切换间收到取消时调用可选 `GraphNode.cancel(state)`;
|
|
86
|
+
此入口只结算已接纳工作,不能启动新动作,不用于 RunPauseRequested。拥有取消收尾事实
|
|
87
|
+
的自定义节点也应履行同一合同。Host 不得在 finishCheckpointWrites 后从 journal 补写。
|
|
88
|
+
|
|
89
|
+
Supervisor 的 cancelled 状态先撤销动作权限,不意味着在途提交已经排空。Host checkpoint
|
|
90
|
+
writer 应允许原 activation 在现存 revision 链上完成收尾(包括取消时已排队的边界),
|
|
91
|
+
但不能恢复工具效果写入权;yielded 或释放后必须拒绝迟到提交,不得复活已清理的断点。
|
|
92
|
+
|
|
84
93
|
linnkit 在内部对每个 port 都跑了 contract test。你的实现必须通过这些**等价的契约测试**。建议在 host 测试里 mirror linnkit 的 contract test,把 memory 实现 → 你的实现做参数化,确保行为 1:1。
|
|
@@ -39,6 +39,7 @@ const handle = await supervisor.registerRun({
|
|
|
39
39
|
- `AgentRunnerService.run()` 一类 host runner 应同步返回 `{ handle, result }`:UI 可以立刻拿 handle 做 cancel/observe/cost,执行结果继续等 `result`。
|
|
40
40
|
- runner 生命周期必须显式写:启动前 `markRunning()`,正常结束 `markCompleted()`,异常结束 `markFailed()`。取消请求先由 `handle.cancel({ reason })` 写 `cancelled` 并触发 abort;执行器取得真实结果后,再用第二个 lifecycle patch 补全 `currentNode / iterationsUsed`。
|
|
41
41
|
- `WaitUserNode` 创建的 `requires_user_interaction` 是正式 pause 事实。它必须经 `RuntimeEventPublisher` 附着正式 `run_id / lane / visibility`,与其他事实一起发布和持久化。host runner 在 persistence drain 成功后才能调用 `markAwaitingUser()`,不得从 Graph 返回值 cherry-pick 后补发第二份事件。
|
|
42
|
+
- 默认 `awaitingUserStateOwner: 'supervisor'` 从实时事件观察等待状态。原子 checkpoint Host 必须选择 `'host'`,由 runner 在交互事实与等待断点提交后写 `markAwaitingUser`;实时事件还未提交时不得提前撤销 execution 写入权。重启若停在已提交等待断点而生命周期尚未写入,Host 用原交互身份重建等待;若原响应已原子接纳,则继续该响应,不重新打开审批。
|
|
42
43
|
- HITL 恢复使用 `claimResume(runId, interaction, eventBus, signal)`。返回的 `RunResumeClaim` 先原子占用一次性 interaction,但保持 `awaiting_user`;host 只有在响应事实持久化成功后才能调用 `activate()`,持久化前失败调用 `release()`。这样并发/重复提交只有一个能激活,也不会在 runner 启动前留下半恢复的 running run。
|
|
43
44
|
- 可恢复 Host 通过 `activate({ executionId, inputEventIds, admissionCommit })` 把响应事实与激活状态放入同一事务。`metadata.resumeInputs` 保留已提交的响应引用及原 checkpoint revision;重启若 Graph 仍停在原等待边界,Host 读取这些事实完成原 response 的 resume,不能要求用户再次提交。只有瞬时能力在新 execution 中重新装配。
|
|
44
45
|
- `RunResumeInteraction` 必须完整匹配 `interactionId / toolCallId / checkpointRevision / resumeToken`。host 必须让 GraphExecutor 用同一 `runId` 的 checkpoint 恢复,禁止注册替代 run 或按 conversation 查“最近 checkpoint”。
|
|
@@ -53,6 +54,7 @@ const handle = await supervisor.registerRun({
|
|
|
53
54
|
- transport `EventBus.close()` 不等于 run 终态。`awaiting_user` 会保留 handle/slot;恢复时 `claimResume.activate()` 把同一 RunHandle 换绑到新的 transport EventBus,并轮换 execution controller,`observeRun()` 可跨 transport 连续观察。同步 run 在 completed/failed/cancelled 后释放;detached 取消还必须等 executor settlement。
|
|
54
55
|
- detached run 执行中如果 EventBus 提前 close,不会提前释放 active slot,避免后台 run 绕过并发限制;slot 会等 detached executor 终态 cleanup。
|
|
55
56
|
- `pause()` 先持久化暂停意图,再以 `RunPauseRequested` 中断当前 attempt;此时 `status=paused` 且 `pausedAt` 缺失,表示仍在收口。Host 保存断点、收口当前 execution 后调用 `markPaused()`,才允许 `resumePausedRun()` 激活。它不创建用户消息,也不提交任何审批。
|
|
57
|
+
- 面向异步客户端的暂停使用 `pause(runId, reason, expectedExecutionId)`;execution 身份在控制锁内核对,排队期间已经发生的继续不能被旧暂停命令中断。
|
|
56
58
|
- `resumePausedRun({ runId, expectedUpdatedAt, executionId, eventBus })` 保留同一 run 并轮换 execution identity / signal。Host 必须先完成前一 execution 的收口,之后再启动 Graph `continueSession`。原本抛 NotImplementedError 的 `RunHandle.resume()` 已移除,避免把“改状态”误当成“调度 Graph”。`runTree/handleFailure` 仍未实现。
|
|
57
59
|
|
|
58
60
|
## 3. RunHandle 完整 API(截至 0.5.0)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@linnlabs/linnkit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.37.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A fine-grained context engineering framework for Agent applications — control every token sent to the model, with clear run lifecycle, audit records, and testable protocol boundaries.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
"vitest": "^4.1.11"
|
|
110
110
|
},
|
|
111
111
|
"linnkit": {
|
|
112
|
-
"phase": "development (0.
|
|
112
|
+
"phase": "development (0.37.0 — durable cancellation settlement)",
|
|
113
113
|
"sourceOfTruth": "CHANGELOG.md",
|
|
114
114
|
"notes": [
|
|
115
115
|
"子入口 ./runtime-kernel/events 是 browser-safe slim seam:仅暴露 events governance 纯函数,禁止扩展任何 Node-only 依赖(如 node:async_hooks / crypto / fs)",
|