dsh-agentone 0.5.42 → 0.5.43

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.
Files changed (2) hide show
  1. package/lib/index.js +20 -4
  2. package/package.json +2 -2
package/lib/index.js CHANGED
@@ -679,7 +679,17 @@ export function apply(ctx, config) {
679
679
  // 模块级重试定时器跨 apply 存活:重入先清,避免旧定时器引用旧 config
680
680
  clearModelRetry();
681
681
  modelRetryAttempts = 0;
682
- const register = (path, handler) => ctx.webServer.register({ kind: 'exact', path, handler });
682
+ // 路由注册必须接住宿主返回的 disposer:cordis 的服务代理不自动收集
683
+ // 服务调用的返回值(getTraceable 只做包装),直接丢弃意味着 fiber 销毁
684
+ // 后路由仍留在 webserver 表里——live patch reload 重挂插件时,新激活的
685
+ // register('/agentone/') 撞 duplicate exact route,整条 entry 报
686
+ // 「启用失败」(0.5.42 桌面端实测)。每条路由单独包一层 ctx.effect:
687
+ // 正常销毁时随 fiber 倒序释放;装配中途抛错时已挂路由也已登记在
688
+ // fiber 上,随失败 fiber 的销毁一并回收。
689
+ const register = (path, handler) => ctx.effect(
690
+ () => ctx.webServer.register({ kind: 'exact', path, handler }),
691
+ `dsh-agentone: route ${path}`,
692
+ );
683
693
 
684
694
  register('/agentone/', (request, response) => {
685
695
  if (request.method !== 'GET') {
@@ -1649,14 +1659,20 @@ export function apply(ctx, config) {
1649
1659
  }
1650
1660
  })();
1651
1661
 
1652
- return async () => {
1662
+ // 销毁回调必须同步返回:cordis 对 disposables 倒序逐项 await,任何一
1663
+ // 个返回 Promise 都会拖住其后的销毁步骤。旧实现在这里 await 排空
1664
+ // defaults/profiles 队列(升级场景队列里正是 pnpm 操作),一旦宿主把
1665
+ // 路由释放链挂在它后面,热重载的新激活就会在等待窗口里撞 duplicate
1666
+ // route。队列排空是纯后台清理(中止在途同步、等待安装队列),不产出
1667
+ // 任何销毁链需要的结果,改为 fire-and-forget,不再阻塞销毁链。
1668
+ return () => {
1653
1669
  disposed = true;
1654
- await defaults.dispose();
1655
- await profiles.dispose();
1656
1670
  pendingStates.clear();
1657
1671
  pendingCliAuth.clear();
1658
1672
  clearModelRetry();
1659
1673
  modelRetryAttempts = 0;
1674
+ void defaults.dispose().catch(() => {});
1675
+ void profiles.dispose().catch(() => {});
1660
1676
  log.info('[dsh-agentone] routes unmounted');
1661
1677
  };
1662
1678
  }, 'dsh-agentone: http routes');
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-agentone",
3
- "version": "0.5.42",
4
- "description": "AgentOne 平台集成:平台模型、SkillHub 技能、套餐与 CLI;宿主插件错误中文化与启用态术语对齐官方插件管理",
3
+ "version": "0.5.43",
4
+ "description": "AgentOne 平台集成:平台模型、SkillHub 技能、套餐与 CLI;修复热重载后路由未释放导致的启用失败",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "smoke": "node scripts/env-matrix-smoke.mjs"