@feng0531/dsh-execution-bus 0.2.9 → 0.2.11

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/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  “萧何”是产品与模式显示名,执行总线是其技术功能;不新增人物 Agent,不进行角色扮演。仓库 dsh-execution-bus、npm 包名、execution_bus 工具名及 execution-bus-test 预设 ID 保持不变。历史版本发布说明保留当时名称。
6
6
 
7
- DSH 独立插件:`@feng0531/dsh-execution-bus` · 当前版本 **0.2.9**
7
+ DSH 独立插件:`@feng0531/dsh-execution-bus` · 当前版本 **0.2.11**
8
8
 
9
9
  > 当前是早期可运行版本,不是完整生产验收版。已验证真实 DSH 组件和脚本模型驱动的内存会话;真实模型、桌面界面和 PTC 完整链路尚未验收。**不支持重启后恢复任务。**
10
10
 
@@ -102,7 +102,7 @@ flowchart TD
102
102
  2. 在你选定的隔离 DSH 配置依赖目录安装固定版本,不要在 DSH 程序安装目录执行:
103
103
 
104
104
  ```powershell
105
- npm install --ignore-scripts @feng0531/dsh-execution-bus@0.2.9
105
+ npm install --ignore-scripts @feng0531/dsh-execution-bus@0.2.11
106
106
  ```
107
107
 
108
108
  这是 npm 目录示例。若目标配置使用 pnpm,应沿用其包管理器,不混用锁文件。遇到宿主 peer 版本冲突就停止,不用强制安装绕过。
@@ -231,7 +231,7 @@ npm run test:install # 临时目录安装,不操作日常 DSH
231
231
 
232
232
  - [协议和投递语义](<docs/protocol.md>):字段、状态、重复处理与取消规则。
233
233
  - [宿主兼容性与源码调用链](<docs/host-compatibility.md>):为什么可以等待,为什么不能跨重启恢复。
234
- - [验证记录](<docs/validation.md>)、[0.2.9 发布说明](<docs/releases/0.2.9.md>):已验证与未验证范围。
234
+ - [验证记录](<docs/validation.md>)、[0.2.11 发布说明](<docs/releases/0.2.11.md>):已验证与未验证范围。
235
235
  - [维护者发布流程](<docs/RELEASING.md>):标签 CI、安装包校验与正式发布门禁。
236
236
 
237
237
  ## 许可
package/dist/plugin.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { randomUUID } from "node:crypto";
2
+ import { setTimeout as pause } from "node:timers/promises";
2
3
  import { ExecutionBus, parse } from "./bus.js";
3
4
  import { testHandler, readHandler } from "./handlers.js";
4
5
  export const name = "execution-bus";
@@ -86,6 +87,14 @@ export function apply(ctx) {
86
87
  let settled = sharedJobs.get(jobKey);
87
88
  if (!settled) {
88
89
  try {
90
+ const outcome = attached.done.then((v) => ({
91
+ status: v.state === "succeeded"
92
+ ? "completed"
93
+ : v.state === "cancelled"
94
+ ? "killed"
95
+ : "failed",
96
+ detail: v.state,
97
+ }));
89
98
  const job = ctx.jobs.start({
90
99
  kind: "execution-bus",
91
100
  label: "萧何 / Xiao He",
@@ -93,14 +102,7 @@ export function apply(ctx) {
93
102
  run(h) {
94
103
  handle = h;
95
104
  return {
96
- done: attached.done.then((v) => ({
97
- status: v.state === "succeeded"
98
- ? "completed"
99
- : v.state === "cancelled"
100
- ? "killed"
101
- : "failed",
102
- detail: v.state,
103
- })),
105
+ done: outcome,
104
106
  cancel: abort,
105
107
  };
106
108
  },
@@ -119,12 +121,43 @@ export function apply(ctx) {
119
121
  catch (error) {
120
122
  // rc.2 has no typed not-found code. Match only this minted Job and
121
123
  // confirm absence in the original owner scope; never swallow access/service errors.
122
- if (!(error instanceof Error) ||
123
- error.message !== `unknown job ${job}` ||
124
- ctx.jobs.list(ownerId).some((view) => view.id === job))
125
- throw error;
126
- // Record cleanup is not execution completion. Drain the original result.
124
+ let alreadyRemoved = false;
125
+ try {
126
+ alreadyRemoved =
127
+ error instanceof Error &&
128
+ error.message === `unknown job ${job}` &&
129
+ !ctx.jobs.list(ownerId).some((view) => view.id === job);
130
+ }
131
+ catch {
132
+ /* Preserve the original wait/cleanup error. */
133
+ }
134
+ // A broken wait channel does not terminate execution. Keep caller cancellation
135
+ // attached, drain both producer and host outcome, then attempt cleanup once.
127
136
  await attached.done;
137
+ if (!alreadyRemoved) {
138
+ // No scope-owned observer: teardown can remove it before settlement.
139
+ // After producer drain, allow a bounded host commit window. This is
140
+ // program-side cleanup only, never execution retry or model polling.
141
+ for (let attempt = 0; attempt < 20; attempt++) {
142
+ try {
143
+ const view = ctx.jobs
144
+ .list(ownerId)
145
+ .find((view) => view.id === job && view.owner === ownerId);
146
+ if (!view)
147
+ break;
148
+ if (view.status !== "running" &&
149
+ view.status !== "stopping") {
150
+ ctx.jobs.remove(job, ownerId);
151
+ break;
152
+ }
153
+ }
154
+ catch {
155
+ break;
156
+ }
157
+ await pause(10);
158
+ }
159
+ throw error;
160
+ }
128
161
  }
129
162
  })();
130
163
  sharedJobs.set(jobKey, settled);
@@ -0,0 +1,13 @@
1
+ # 萧何 / Xiao He 0.2.10
2
+
3
+ ## BUG 修复
4
+
5
+ Job 等待通道或清理服务异常时,不再在执行仍运行中提前结束原工具调用。保留调用方取消监听,等待原执行和宿主 outcome 达到终态,再尽力清理并返回原服务错误。不会因通信失败自动重跑或误记执行失败。
6
+
7
+ 确切所属 Job 已被先行移除的幂等处理保持不变。其他异常仍明确失败;二次查询或清理失败不替换原错误。若清理服务持续不可用,记录仍可能保留至宿主所属生命周期清理,不声称保证删除。
8
+
9
+ ## 验证与边界
10
+
11
+ 新增两项真实宿主组件故障注入:等待立即失败时原调用返回前任务已达成功终态且 Job 已清理;等待与清理同时失败仍保留原始错误。用例修复前均失败。全量回归、标签四矩阵 CI 和发布包验证按既有门禁执行。
12
+
13
+ 不合作的 Handler 仍可能阻碍排空。真实模型、GUI 与 PTC 完整链路未验收,不支持跨重启恢复。兼容 DSH 0.2.0-rc.2,非商业源码公开许可;不自动安装或重启 DSH。
@@ -0,0 +1,13 @@
1
+ # 萧何 / Xiao He 0.2.11
2
+
3
+ ## BUG 修复
4
+
5
+ 移除等待异常排空对作用域内 Job 终态观察者的依赖,修复等待服务先失败、随后 Agent/插件作用域卸载时,监听器先被解除导致原调用及卸载永久等待的问题。
6
+
7
+ 异常路径始终先等待原执行达到终态,保留原服务错误;之后按原 owner 查询确切 Job 的状态,最多进行 20 次、间隔 10 毫秒的程序侧清理检查。该有界窗口只等待宿主记录提交,不会放弃仍运行的 Handler、调用模型轮询或重试执行。服务持续不可用时保留原错误,记录可能延后由宿主生命周期清理。
8
+
9
+ ## 验证与边界
10
+
11
+ 新增真实 Cordis/ToolRuntime/LocalJobs 有界回归:等待失败后销毁作用域,原调用与卸载都能结束且 Job 清空。修复前该用例 4 秒超时。正常等待、先行移除、等待与清理故障继续回归。正式发布仍执行完整 CI 和同包门禁。
12
+
13
+ 兼容 DSH 0.2.0-rc.2,非商业源码公开许可。真实模型、GUI 和 PTC 完整链路未验收,不支持跨重启恢复;不安装或重启 DSH。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feng0531/dsh-execution-bus",
3
- "version": "0.2.9",
3
+ "version": "0.2.11",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "license": "SEE LICENSE IN LICENSE",