dsh-zipfix 0.4.0 → 0.4.1

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
@@ -12,6 +12,8 @@ DeepSeek Harness 插件:修复 ZIP 压缩包与已解压目录中的中文文
12
12
 
13
13
  ## 安装
14
14
 
15
+ npm:[`dsh-zipfix`](https://www.npmjs.com/package/dsh-zipfix)(DSH 中执行 `plugin_manager { action: "install_bundle", target: "dsh-zipfix@0.4.1" }`)。
16
+
15
17
  DSH 插件市场(发现 → 添加索引源):
16
18
 
17
19
  ```text
package/index.js CHANGED
@@ -10,7 +10,7 @@ import { apply as applyTools } from './plugin/index.js';
10
10
  import { apply as applyUi } from './ui/index.js';
11
11
 
12
12
  export const name = 'dsh-zipfix';
13
- export const inject = ['tools'];
13
+ export const inject = ['tools', 'webServer', 'connection'];
14
14
 
15
15
  export function apply(ctx) {
16
16
  applyTools(ctx);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-zipfix",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "ZIP 中文文件名乱码修复器(DeepSeek Harness 插件):5 个 agent 工具 + 侧边栏上传面板。",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -169,9 +169,9 @@ export function installZipfixWebApi(ctx) {
169
169
  ctx.logger?.warn?.('zipfix-ui: webServer service unavailable; sidebar API disabled');
170
170
  return () => {};
171
171
  }
172
- // 宿主连接认证:所有路由先过 connection.requestRejection(Host/Origin 围栏 + 浏览器会话认证)。
172
+ // 宿主连接认证在每次请求时解析 connection(不要在这里缓存:冷启动时服务可能尚未就绪),
173
+ // 所有路由先过 connection.requestRejection(Host/Origin 围栏 + 浏览器会话认证)。
173
174
  // 拿不到 connection 或检查抛错时一律拒绝,绝不退化到「只检查 Host/Origin/回环」。
174
- const connection = ctx.get('connection');
175
175
 
176
176
  const tempRoot = path.join(os.tmpdir(), 'dsh-zipfix-web');
177
177
  const tasks = new Map();
@@ -230,6 +230,7 @@ export function installZipfixWebApi(ctx) {
230
230
  * 失败关闭(fail closed):没有 connection 服务、检查抛错、或返回 401/403 都拒绝。
231
231
  */
232
232
  function assertAdmitted(req) {
233
+ const connection = ctx.get('connection');
233
234
  if (connection === undefined || typeof connection.requestRejection !== 'function') {
234
235
  throw new HttpError(403, '宿主认证服务不可用,已拒绝该请求');
235
236
  }
package/ui/index.js CHANGED
@@ -10,8 +10,12 @@ import { installZipfixWebApi } from '../plugin/lib/webapi.js';
10
10
  /** Cordis 插件名。 */
11
11
  export const name = 'dsh-zipfix-ui';
12
12
 
13
- /** 无硬依赖:webServer 缺失时静默降级(不阻塞同仓的 agent 工具包)。 */
14
- export const inject = [];
13
+ /**
14
+ * 硬依赖宿主服务,避免冷启动时 webServer/connection 尚未就绪导致静默不注册路由:
15
+ * - webServer:/zipfix-api 路由的注册目标
16
+ * - connection:宿主认证(Host/Origin 围栏 + 浏览器会话)
17
+ */
18
+ export const inject = ['webServer', 'connection'];
15
19
 
16
20
  /**
17
21
  * 注册 HTTP API,并随插件卸载释放路由与临时目录。