@jayyuen66/dsh-plugin-shared 0.1.2 → 0.1.3

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
@@ -1,6 +1,6 @@
1
1
  # @jayyuen66/dsh-plugin-shared
2
2
 
3
- [English](./README.md) · [简体中文](./README.zh.md)
3
+ [English](./README.md) · [简体中文](./README.zh-CN.md)
4
4
 
5
5
  ## What this package is
6
6
 
@@ -97,11 +97,12 @@ The sonarjs entry point is resolved lazily, inside `definePluginConfig()`. Impor
97
97
 
98
98
  ## Dependencies
99
99
 
100
- Seven declared dependencies, all `@deepseek-ai/*`:
100
+ `dependencies` is empty; the seven `@deepseek-ai/*` packages appear only in `peerDependencies` and `devDependencies`. `test/publish-manifest.test.ts` enforces this — it is not a style preference:
101
101
 
102
- - `@deepseek-ai/dsh-output-retention` is a **value** import (`truncateEnd`), so it must ship as a dependency.
103
- - The other six are referenced only by the published `.d.ts`. They are declared because an undeclared type import does not fail loudly — it silently degrades. `lib/job-outcome` used to take `ShellProcess` and `JobOutcome` from packages no consumer tree was required to contain, so with `skipLibCheck: true` a wrong `status` or `exitCode` produced no error at all and `jobOutcomeOf`'s return type collapsed to `any`. Under pnpm's isolated layout none of them resolve at all.
104
- - Versions follow the host: exact pins inside the `dsh-*` family, `~` for `cordis`, matching what the host bundle itself declares so the same copy is reused rather than duplicated.
102
+ - **Putting them in `dependencies` disables the consumer's host.** Consumers are dsh plugins installed into a profile (`nodeLinker: hoisted`, `autoInstallPeers: false`). Any host package listed under `dependencies` is written into the profile as a **real directory**, coexisting with the copy the host process already loaded. `@deepseek-ai/dsh-tools` keys its `TOOL_RUNTIME_SCHEDULER` with a plain `Symbol` (not `Symbol.for`), so symbol identity is per module instance: the host's `dsh-agent-loop` reads a `ToolRuntime` mounted from the duplicate using its own copy's symbol, gets `undefined`, and **every native tool call throws** `Cannot read properties of undefined (reading 'prepare')` — the whole profile loses its tools. This package's build, typecheck and tests all stay green right up to that point, so the invariant has to live in the manifest.
103
+ - `@deepseek-ai/dsh-output-retention` is a **value** import (`truncateEnd`) and is provided by the host at runtime, so it is a required peer.
104
+ - The other six are referenced only by the published `.d.ts`, so they are optional peers plus devDependencies: the peer keeps the type surface honest — `lib/job-outcome` used to take `ShellProcess` and `JobOutcome` from packages no consumer tree was required to contain, so with `skipLibCheck: true` a wrong `status` or `exitCode` produced no error at all and `jobOutcomeOf`'s return type collapsed to `any` — while devDependencies let this repository compile and test. Profiles never install peers, so no duplicate appears.
105
+ - Versions follow the host: exact pins throughout the `dsh-*` family and for `cordis`, matching what the host bundle itself declares so the same copy is reused rather than duplicated.
105
106
 
106
107
  Known upstream limitation: `@deepseek-ai/dsh-llm`'s own declarations import `@deepseek-ai/dsh-attachment`, which it does not declare. It is reached transitively through `dsh-session`, so a consumer running with `skipLibCheck: false` sees `TS2307` from *that* package, not from this one.
107
108
 
@@ -110,7 +111,7 @@ Known upstream limitation: `@deepseek-ai/dsh-llm`'s own declarations import `@de
110
111
  `main` and `exports` point at `dist/` only. There is no second, source-shaped manifest.
111
112
 
112
113
  - `publishConfig` carries `access` and `registry` and nothing else. Putting `main`/`exports` there was wrong: pnpm merges those onto the top level when publishing and npm does not, so publishing with npm shipped a package whose fourteen entry points named files that were not in the tarball.
113
- - `files` is `icon.svg`, `dist`, `config/*.json`, `README.zh.md`. npm always adds `package.json`, `LICENSE` and `README.md`; `README.zh.md` is listed explicitly so the Chinese copy ships too.
114
+ - `files` is `icon.svg`, `dist`, `config/*.json`, `README.zh-CN.md`. npm always adds `package.json`, `LICENSE` and `README.md`; `README.zh-CN.md` is listed explicitly so the Chinese copy ships too.
114
115
  - `build` starts by deleting `dist/`, because `files` takes the whole directory and a renamed facet would otherwise keep publishing its orphan artifact.
115
116
  - `prepare` runs `build`. It does not run when a consumer installs from the registry; it exists so packing, publishing and workspace links always ship a fresh `dist/`.
116
117
  - Node throws `ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING` for `.ts` inside `node_modules`, which is exactly where a published package is loaded from, so an artifact is mandatory. The barrel's declaration file is generated by `build-host.mjs` because source-form `export * from "./http.ts"` specifiers are not resolvable by consumers.
@@ -1,6 +1,6 @@
1
1
  # @jayyuen66/dsh-plugin-shared
2
2
 
3
- [English](./README.md) · [简体中文](./README.zh.md)
3
+ [English](./README.md) · [简体中文](./README.zh-CN.md)
4
4
 
5
5
  ## 这个包是什么
6
6
 
@@ -97,11 +97,12 @@ sonarjs 的入口是**惰性解析**的,发生在 `definePluginConfig()` 内
97
97
 
98
98
  ## 依赖
99
99
 
100
- 七条 `dependencies`,全是 `@deepseek-ai/*`:
100
+ `dependencies` 是空的;七枚 `@deepseek-ai/*` 只出现在 `peerDependencies` 与 `devDependencies` 里。这条由 `test/publish-manifest.test.ts` 钉住,不是风格偏好:
101
101
 
102
- - `@deepseek-ai/dsh-output-retention` 是**值导入**(`truncateEnd` 用它),所以必须是依赖。
103
- - 其余六枚只被发布出去的 `.d.ts` 引用。之所以要声明,是因为未声明的类型导入不会大声报错,而是静默降级:`lib/job-outcome` 的 `ShellProcess`/`JobOutcome` 曾经来自消费方根本不保证存在的包,于是在 `skipLibCheck: true` 下写错 `status` 或 `exitCode` 一条都不报,返回值类型直接塌成 `any`;而 pnpm 的隔离布局下这些包压根解析不到。
104
- - 版本口径跟着宿主走:`dsh-*` 家族内用精确钉,`cordis` 用 `~`,与宿主本体自己声明的一致,这样是复用同一份而不是装出第二份。
102
+ - **写进 `dependencies` 会让消费方的宿主瘫掉。** 消费方是 dsh 插件,被装进 profile(`nodeLinker: hoisted`、`autoInstallPeers: false`)。宿主包只要出现在 `dependencies`,pnpm 就在 profile 里把它们落成**真实目录**,与宿主进程里已有的那份并存。而 `@deepseek-ai/dsh-tools` 的 `TOOL_RUNTIME_SCHEDULER` 是普通 `Symbol`(不是 `Symbol.for`),符号身份按模块实例计算——宿主 `dsh-agent-loop` 拿自己那份的 Symbol 去读由副本挂载出来的 `ToolRuntime`,得到 `undefined`,于是**每一次原生工具调用都抛** `Cannot read properties of undefined (reading 'prepare')`,整个 profile 的工具一起失效。本包的构建、类型检查与测试在这之前全部照绿,所以判据只能落在 manifest 面。
103
+ - `@deepseek-ai/dsh-output-retention` 是**值导入**(`truncateEnd` 用它),运行期由宿主提供,因此是非 optional 的 peer。
104
+ - 其余六枚只被发布出去的 `.d.ts` 引用,声明成 optional peer 加 dev:peer 保住类型面不静默降级——`lib/job-outcome` 的 `ShellProcess`/`JobOutcome` 曾经来自消费方根本不保证存在的包,于是在 `skipLibCheck: true` 下写错 `status` 或 `exitCode` 一条都不报,返回值类型直接塌成 `any`;dev 让本包自己的编译与测试解析得到。profile 不装 peer,所以不产生副本。
105
+ - 版本口径跟着宿主走:`dsh-*` 家族内一律精确钉,`cordis` 也精确钉,与宿主本体自己声明的一致,这样是复用同一份而不是装出第二份。
105
106
 
106
107
  已知的上游限制:`@deepseek-ai/dsh-llm` 的声明文件引用了它自己没声明的 `@deepseek-ai/dsh-attachment`。它经 `dsh-session` 传递进来,所以开 `skipLibCheck: false` 的消费方会看到来自**那个包**的 `TS2307`,不是来自本包。
107
108
 
@@ -110,7 +111,7 @@ sonarjs 的入口是**惰性解析**的,发生在 `definePluginConfig()` 内
110
111
  `main` 与 `exports` 只指 `dist/`,不存在第二套源码形态的 manifest。
111
112
 
112
113
  - `publishConfig` 只带 `access` 和 `registry`。把 `main`/`exports` 放在那里是错的:pnpm 发布时会把它们合并到顶层,npm 不会——用 npm 发出去的包,十四个入口指向的都是 tarball 里不存在的文件。
113
- - `files` 是 `icon.svg`、`dist`、`config/*.json`、`README.zh.md`。npm 永远附带 `package.json`、`LICENSE` 和 `README.md`;`README.zh.md` 显式列出才会一起发。
114
+ - `files` 是 `icon.svg`、`dist`、`config/*.json`、`README.zh-CN.md`。npm 永远附带 `package.json`、`LICENSE` 和 `README.md`;`README.zh-CN.md` 显式列出才会一起发。
114
115
  - `build` 第一步删除 `dist/`:`files` 整目录收,切面一旦改名,上一代孤儿产物会继续被发出去。
115
116
  - `prepare` 挂 `build`。消费方从 registry 安装时它不执行;它存在是为了让打包、发布与 workspace link 拿到的都是新鲜 `dist/`。
116
117
  - 必须有编译产物:Node 对 `node_modules` 里的 `.ts` 直接抛 `ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING`,而发出去的包正是躺在那里被载入的。barrel 的声明文件由 `build-host.mjs` 生成,因为源码形态的 `export * from "./http.ts"` 消费方解析不到。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jayyuen66/dsh-plugin-shared",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "dsh 自研插件的共享工具库:tool 事件流记账扫描 + webServer HTTP 样板(sendJson/CORS/CSRF/body 限制)+ 卡片 apply 骨架 + 项目键派生 + 代理对安全截断。作为库包被 import,不由用户启用",
5
5
  "keywords": [
6
6
  "cordis",
@@ -24,7 +24,7 @@
24
24
  "icon.svg",
25
25
  "dist",
26
26
  "config/*.json",
27
- "README.zh.md"
27
+ "README.zh-CN.md"
28
28
  ],
29
29
  "type": "module",
30
30
  "sideEffects": false,
@@ -103,19 +103,17 @@
103
103
  "access": "public",
104
104
  "registry": "https://registry.npmjs.org"
105
105
  },
106
- "dependencies": {
106
+ "devDependencies": {
107
107
  "@deepseek-ai/cordis": "4.0.5-alpha.1",
108
+ "@deepseek-ai/dsh-brand": "0.2.1-alpha.1",
108
109
  "@deepseek-ai/dsh-client-locale": "0.2.1-alpha.1",
109
110
  "@deepseek-ai/dsh-jobs": "0.2.1-alpha.1",
111
+ "@deepseek-ai/dsh-llm": "0.2.1-alpha.1",
110
112
  "@deepseek-ai/dsh-output-retention": "0.2.1-alpha.1",
113
+ "@deepseek-ai/dsh-scope": "0.2.1-alpha.1",
111
114
  "@deepseek-ai/dsh-session": "0.2.1-alpha.1",
112
115
  "@deepseek-ai/dsh-shell": "0.2.1-alpha.1",
113
- "@deepseek-ai/dsh-tools": "0.2.1-alpha.1"
114
- },
115
- "devDependencies": {
116
- "@deepseek-ai/dsh-brand": "0.2.1-alpha.1",
117
- "@deepseek-ai/dsh-llm": "0.2.1-alpha.1",
118
- "@deepseek-ai/dsh-scope": "0.2.1-alpha.1",
116
+ "@deepseek-ai/dsh-tools": "0.2.1-alpha.1",
119
117
  "@types/node": "26.6.3",
120
118
  "@vitest/coverage-v8": "5.0.2",
121
119
  "eslint-plugin-sonarjs": "4.2.2",
@@ -128,11 +126,36 @@
128
126
  "vitest": "5.0.2"
129
127
  },
130
128
  "peerDependencies": {
131
- "@deepseek-ai/dsh": "^0.2.1-alpha.1"
129
+ "@deepseek-ai/cordis": "4.0.5-alpha.1",
130
+ "@deepseek-ai/dsh": "^0.2.1-alpha.1",
131
+ "@deepseek-ai/dsh-client-locale": "0.2.1-alpha.1",
132
+ "@deepseek-ai/dsh-jobs": "0.2.1-alpha.1",
133
+ "@deepseek-ai/dsh-output-retention": "0.2.1-alpha.1",
134
+ "@deepseek-ai/dsh-session": "0.2.1-alpha.1",
135
+ "@deepseek-ai/dsh-shell": "0.2.1-alpha.1",
136
+ "@deepseek-ai/dsh-tools": "0.2.1-alpha.1"
132
137
  },
133
138
  "peerDependenciesMeta": {
139
+ "@deepseek-ai/cordis": {
140
+ "optional": true
141
+ },
134
142
  "@deepseek-ai/dsh": {
135
143
  "optional": true
144
+ },
145
+ "@deepseek-ai/dsh-client-locale": {
146
+ "optional": true
147
+ },
148
+ "@deepseek-ai/dsh-jobs": {
149
+ "optional": true
150
+ },
151
+ "@deepseek-ai/dsh-session": {
152
+ "optional": true
153
+ },
154
+ "@deepseek-ai/dsh-shell": {
155
+ "optional": true
156
+ },
157
+ "@deepseek-ai/dsh-tools": {
158
+ "optional": true
136
159
  }
137
160
  },
138
161
  "icon": "icon.svg",