@jayyuen66/dsh-dir-prep-organize 0.1.15 → 0.1.17

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 CHANGED
@@ -4,6 +4,18 @@
4
4
  [语义化版本](https://semver.org/lang/zh-CN/)。最新版本在最上。这里的偏离是刻意的:版本标题
5
5
  不写发布日期,各版发布时间以 npm registry 为准(`npm view <包名> time` 取得到)。
6
6
 
7
+ ## 0.1.17
8
+
9
+ shared 经 catalog 抬到 `^0.3.1`:运行期入口收敛为 `./tool` / `./client`,本仓导入与 Remote 读取器(`parseOrThrow` / `remoteMounterOf`)迁到新入口;本地的 `clampInt`、`hasMethods`、工作目录形状守卫与 `markRemote` 副本删除,改由 shared 提供,host 构建经 `toolImportTransform` 拆分 `/tool`;client 仍按 `dsh.client.external` 外置 `/client`。宿主基线同步切到 `dsh 0.2.3-alpha.3`(devDependencies 全族精确钉 alpha.3);客户端对 `ui-slots` / `ui-primitives` 的导入改走 `<包名>/client`(包根保留兼容,`ui-messages.ts` 的 `declare module` 同批改名);`dsh.client.immediately` 改为 `false`,不再进启动预取层(bundle 随 Loader 条目到达);`react` / `react-dom` 开发依赖抬到 `^19.3.1`,并以 optional peer 声明。devDependencies 补 `@deepseek-ai/dsh-fs-patch`、`@deepseek-ai/dsh-output-retention` 与 `@rolldown/plugin-transform-imports`(peer 同步)。设置卡的脏值判等改用 shared 的 `formValueEquals`(`null` / `undefined` / 缺键按同值处理);「一键导入内置角色库」的范围收窄为顶层 + 一层子目录(两份 README 同步)。角色库、默认配置与整理行为不变。
10
+
11
+ 发布面不再随包发 `types/` 声明:`exports["."]` 回到纯运行期映射,`files`、`check` 与 `prepack` 去掉声明链,`build-types.mjs`、`tsconfig.types.json` 与声明相关用例一并退役;README 的声明承诺与 peer 清单读法同步删除。插件是终端产物,宿主按包名载入 `host.js` / `client.js`,没有 TypeScript 消费方。
12
+
13
+ - 客户端的样式注入迁到 `meta.stylesheets`:构建期注册、宿主渲染前安装,客户端不再向 `document.head` 追加 `<style>`;导入内置库的忙碌态补 `ProgressBar`。两张 capability-map 配图重绘并对齐仓库的 SVG 无障碍契约。
14
+
15
+ ## 0.1.16
16
+
17
+ 宿主基线切到 `dsh 0.2.3-alpha.2`(Node `^24.22.3 || >=26.13.1`),shared 经 catalog 抬到 `^0.2.13`。设置卡随 shared v3 视觉层更新;客户端注册空输入框 placeholder;宿主侧改用会话的活动工作目录(live cwd 优先、非法活值回落),并移除 `@deepseek-ai/dsh-working-directory` 依赖。角色库、默认配置与路由不变。
18
+
7
19
  ## 0.1.15
8
20
 
9
21
  宿主基线抬到 `0.2.2-rc.5`:devDependencies 全族精确钉 rc.5,`engines.dsh` 与 dsh 家族 peer 同一条窗口;dependabot 配置注释与集成台架的契约证据行(deepseek-harness @ dsh-v0.2.2-rc.5)同步。Typert 远端方法的程序化标记收编 shared `./lib/remote-marker`(与 session-rescue / ocr-review 的副本逐字同构);`test/build-host.test.ts` 的 shared 子路径外置清单补 `lib/instance-lock` 与 `lib/remote-marker`。`src/remote.ts` 的 `RemoteHost` / `isMounter` 与 `src/client-entry.ts` 的 `within` 竞速骨架收编 shared(`./lib/typert-client` / `./lib/with-timeout`)。shared 经 catalog 抬到 `^0.2.12`——收编的三个子路径随 shared 0.2.12 发布,`pnpm-lock.yaml` 经 `pnpm install --lockfile-only` 重解到 registry 现量。
package/README.md CHANGED
@@ -11,8 +11,8 @@
11
11
  <a href="https://www.npmjs.com/package/@jayyuen66/dsh-dir-prep-organize"><img src="https://img.shields.io/npm/d18m/@jayyuen66/dsh-dir-prep-organize?style=flat-square" alt="npm downloads (18 months)" /></a>
12
12
  <a href="https://github.com/JayYuen666/dsh-dir-prep-organize/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/JayYuen666/dsh-dir-prep-organize/ci.yml?branch=main&style=flat-square&label=ci" alt="ci" /></a>
13
13
  <img src="https://img.shields.io/badge/license-MIT-4c1?style=flat-square" alt="MIT" />
14
- <img src="https://img.shields.io/badge/node-%3E%3D24.9-4c1?style=flat-square&logo=nodedotjs&logoColor=white" alt="node" />
15
- <img src="https://img.shields.io/badge/dsh-%5E0.2.2--rc.5-658EFF?style=flat-square" alt="dsh" />
14
+ <img src="https://img.shields.io/badge/node-%5E24.22.3%7C%7C%3E%3D26.13.1-4c1?style=flat-square&logo=nodedotjs&logoColor=white" alt="node" />
15
+ <img src="https://img.shields.io/badge/dsh-%5E0.2.3--alpha.3-658EFF?style=flat-square" alt="dsh" />
16
16
  <a href="https://github.com/deepseek-ai/deepseek-harness"><img src="https://img.shields.io/badge/powered_by_dsh-4D6BFE?style=flat-square&logo=deepseek&logoColor=white" alt="powered by dsh" /></a>
17
17
  </p>
18
18
 
@@ -54,14 +54,14 @@
54
54
  - Adds **two controls** to the right of the web chat input: a split "Polish" button (main key + caret) and a "Template" dropdown.
55
55
  - The main key polishes directly; the caret key offers "polish in a role's style".
56
56
  - The dropdown groups entries by their `group` field; an entry with an empty group lands in "General".
57
- - **Polish** sends the draft, the top level of the session cwd (file names, sizes, and the full text of key text files), and the session's **real** user/assistant turns to the model selected for that conversation (falling back to the host default), then replaces the draft with the rewrite. The result is written back only while the session, draft revision and input phase are unchanged.
57
+ - **Polish** sends the draft, the top level of the session's active working directory (the live `workingDirectory` value first, `header.cwd` only when it is absent — every path below derives from that one rule; file names, sizes, and the full text of key text files), and the session's **real** user/assistant turns to the model selected for that conversation (falling back to the host default), then replaces the draft with the rewrite. The result is written back only while the session, draft revision and input phase are unchanged.
58
58
  - On failure the draft is **never** touched: the button shows an error state for 4 seconds with the reason in its tooltip.
59
59
  - **Templates** insert text at the caret through the input box's insert face: quoted blocks and attachments stay intact, and a stale insertion is refused instead of replacing the draft. Both controls are disabled while the input box is submitting.
60
60
  - The built-in set is **85 curated role templates**, generated by `scripts/gen-defaults.mjs` from this package's `agents/` role library - a vendored collection of several hundred role `.md` files across more than twenty department directories. The curated 85 is the number that matters to a user; the library size is not pinned here because it changes whenever the upstream project is refreshed.
61
61
  - That table **stays host-side**: the client bundle no longer inlines it. The generated file is ~640 KB and used to push `client.js` to ~711 KB.
62
62
  - The browser calls the Remote `defaults` method **once, lazily** (first menu open or first settings-card visit) and reuses it in-process. Nothing is fetched at all when the user already has their own templates.
63
63
  - While it has not arrived the menu shows a loading row - not the "no templates" hint. A failure surfaces the host's own reason plus a Retry button.
64
- - The settings card's **"Role library"** section covers per-entry add/edit/delete, a two-step restore of the defaults, one-click import of the whole built-in library, import of a local `.md` or directory **by path**, and registration of extra allowed import directories. That section is **one list feeding two places**: the input-box "Template" dropdown and the "Polish" ▾ role menu.
64
+ - The settings card's **"Role library"** section covers per-entry add/edit/delete, a two-step restore of the defaults, one-click import of the built-in role library's top level plus one sub-directory level, import of a local `.md` or directory **by path**, and registration of extra allowed import directories. That section is **one list feeding two places**: the input-box "Template" dropdown and the "Polish" ▾ role menu.
65
65
  - Templates and allowed directories are read and written through the host settings with **zero LLM calls**, and **no model tool is registered**.
66
66
 
67
67
  ## <img src="https://api.iconify.design/lucide/package.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> Install
@@ -74,13 +74,12 @@ Remove with `dsh plugin --profile web remove @jayyuen66/dsh-dir-prep-organize`.
74
74
 
75
75
  - The bundle patch inserts `- id: dsh-plugin-shared` (`@jayyuen66/dsh-plugin-shared`). **Keep that component enabled**: disabling it removes the settings card's shared component supply, and the next page load fails with `missed the module table`.
76
76
 
77
- - **Requires Node.js `>= 24.9`.** This is an ESM-only package. Use the **named** exports (`import { apply } from "@jayyuen66/dsh-dir-prep-organize"`); there is **no default export**, so `import pkg from …` fails with `does not provide an export named 'default'`. That Node floor is what makes `require()` of an ESM entry work at all, which is why `engines.node` is declared.
78
- - **Requires host `dsh` on the `0.2.2-rc.5` host line or later.** The requirement the host actually reads is `engines.dsh` (`^0.2.2-rc.5`), and it **decides alone**: `evaluatePluginCompatibility` returns on the `engines.dsh` branch before it ever looks at `peerDependencies`. Derived per host version from the loading gate's own predicate (`app-boot`'s `satisfies`, with `includePrerelease: true`): `0.2.0-rc.2`, `0.2.1-rc.5`, `0.2.2-alpha.3`, `0.2.2-rc.1` and `0.2.2-rc.2` through `0.2.2-rc.4` are **refused**, `0.2.2-rc.5`, `0.2.2` and `0.2.3` pass, `0.3.0` is refused. A refused host needs the explicit risk grant `dsh plugin --profile <p> allow-version <pkg>@<ver> --dsh-version <exact> --accept-risk`. The support window rolls: this package is verified against every released host version inside the window at publish time and re-verified once the window moves, so the version number in this bullet is not a standing promise.
79
- - **The `@deepseek-ai/dsh-*` development pins are at `0.2.2-rc.5`** - the host line this package is built and tested against. `engines.dsh` and the optional peer ranges carry the separately checked support window (`^0.2.2-rc.5`); the pin is a fact about which host version it was *compiled* against, not a restatement of that window. Mixing the two is why the publish gate checks them separately.
80
- - **No `@deepseek-ai/*` under `dependencies`, by contract** (`test/publish-manifest.test.ts` enforces it). Consumer profiles install with `nodeLinker: hoisted` and `autoInstallPeers: false`, so a host package under `dependencies` is materialized as a **real directory** next to the copy the running host 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 reads the scheduler off the profile copy, gets `undefined`, and **every native tool call throws** - while this package's build, typecheck and coverage gates stay green right up to that moment.
81
- - **The two host packages `host.js` imports as values are required peers**: `@deepseek-ai/schemastery` (the host's fork - only it resolves the `.volatile()` fields) and `@deepseek-ai/dsh-brand`. `build-host.mjs` externalizes `dependencies` **and** `peerDependencies`, so the bare specifiers stay in the artifact; a devDependencies-only entry would let the bundler inline the official function body. `test/build-host.test.ts` pins both "specifier present" and "function body absent".
82
- - **Every host package the emitted declarations name is declared under `peerDependencies`**, and each one reached only there is *optional* (`@deepseek-ai/cordis`, `cosmokit`, and the `dsh-agent-default-model` / client-ui / `fs` / `llm` / `session` family). Declaring them is not ceremony: under pnpm's strict layout a bare specifier in `types/host.d.ts` that no manifest table names is unresolvable on the consumer's side, while this repository's own typecheck stays green. The test reads that roster off `types/**/*.d.ts` rather than off this paragraph, so the two cannot drift apart.
83
- - **What ships**: `host.js`, `client.js`, `templates.data.mjs`, `types/`, `cordis.patch.yml`, `agents/`, `locale/`, `docs/` and `THIRD_PARTY_NOTICES.md`. `package.json`, `README*` and `LICENSE` are attached unconditionally by the registry client.
77
+ - **Requires Node.js `^24.22.3 || >=26.13.1`.** This is an ESM-only package. Use the **named** exports (`import { apply } from "@jayyuen66/dsh-dir-prep-organize"`); there is **no default export**, so `import pkg from …` fails with `does not provide an export named 'default'`. `engines.node` follows the host floor; the installer rejects a Node the host cannot run on.
78
+ - **Requires host `dsh` on the `0.2.3-alpha.3` host line or later.** The requirement the host actually reads is `engines.dsh` (`^0.2.3-alpha.3`), and it **decides alone**: `evaluatePluginCompatibility` returns on the `engines.dsh` branch before it ever looks at `peerDependencies`. Derived per host version from the loading gate's own predicate (`app-boot`'s `satisfies`, with `includePrerelease: true`): `0.2.3-alpha.3`, later releases below `0.3.0` and prereleases on the `0.2.3` tuple pass; `0.2.2` and earlier and `0.3.0` or later are refused; prereleases of later `0.2.x` tuples such as `0.2.4-rc.1` pass as well. A refused host needs the explicit risk grant `dsh plugin --profile <p> allow-version <pkg>@<ver> --dsh-version <exact> --accept-risk`. The support window rolls: this package is verified against every released host version inside the window at publish time and re-verified once the window moves, so the version number in this bullet is not a standing promise.
79
+ - **The `@deepseek-ai/dsh-*` development pins are at `0.2.3-alpha.3`** - the host line this package is built and tested against. `engines.dsh` and the optional peer ranges carry the separately checked support window (`^0.2.3-alpha.3`); the pin is a fact about which host version it was *compiled* against, not a restatement of that window. Mixing the two is why the publish gate checks them separately.
80
+ - **No `@deepseek-ai/*` under `dependencies`, by contract** (`test/publish-manifest.test.ts` enforces it). Consumer profiles install with `nodeLinker: hoisted` and `autoInstallPeers: false`, so a host package under `dependencies` is materialized as a **real directory** next to the copy the running host already loaded. `@deepseek-ai/dsh-tools` once keyed its tool-runtime scheduler with a plain `Symbol` on the `0.2.2` host line (removed in `0.2.3`) (not `Symbol.for`), so symbol identity is per module instance: the host reads the scheduler off the profile copy, gets `undefined`, and **every native tool call throws** - while this package's build, typecheck and coverage gates stay green right up to that moment.
81
+ - **The three host packages `host.js` imports as values are required peers**: `@deepseek-ai/schemastery` (the host's fork - only it resolves the `.volatile()` fields), `@deepseek-ai/dsh-brand` and `@deepseek-ai/dsh-typert-protocol` (the Remote service base). `build-host.mjs` externalizes `dependencies` **and** `peerDependencies`, so the bare specifiers stay in the artifact; a devDependencies-only entry would let the bundler inline the official function body. `test/build-host.test.ts` pins both "specifier present" and "function body absent".
82
+ - **What ships**: `host.js`, `client.js`, `templates.data.mjs`, `cordis.patch.yml`, `agents/`, `locale/`, `docs/` and `THIRD_PARTY_NOTICES.md`. `package.json`, `README*` and `LICENSE` are attached unconditionally by the registry client.
84
83
  - **The built-in table ships as its own artifact and is loaded on first use**, not at plugin load. It used to be bundled into `host.js`, so every user paid for the templates in memory even without opening the dropdown.
85
84
  - **`agents/` is not authored here**: it comes from [`agency-agents-zh`](https://github.com/jnMetaCode/agency-agents-zh) (MIT). The copyright and licence notice ship in `THIRD_PARTY_NOTICES.md`, because MIT requires it in every distributed copy. Do not hand-edit files under `agents/`.
86
85
 
@@ -88,6 +87,8 @@ Remove with `dsh plugin --profile web remove @jayyuen66/dsh-dir-prep-organize`.
88
87
 
89
88
  If your profile pins `@jayyuen66/dsh-plugin-shared` with a pnpm `overrides` entry, that pin must be at least the version this package declares. A lower pin installs a copy without the names imported at runtime, and the host then reports `N entries did not activate` together with `does not provide an export named ...` at boot - the package installs fine and never loads, and no per-repository CI run can see it.
90
89
 
90
+ Bundle order matters too: this package's patch inserts the `dsh-plugin-shared` row and declares shared in `dependencies`, so that row loads the copy this bundle imports. When several bundles insert a row for the same package, the bundle listed first in `dsh.profile.bundles` decides which copy it loads; a profile `cordis.patch.yml` row with the same package name loads the profile's copy. Keep whichever copy that row ends up with at least as new as this package declares. From this release on, the client stylesheets (`meta.stylesheets`) and `ProgressBar` require shared `0.3.2` or later; the `^0.3.1` range only keeps older plugins compatible, so treat `0.3.2` as the effective floor for releases and single-repository CI.
91
+
91
92
  ## <img src="https://api.iconify.design/lucide/circle-check.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> Verify it is live
92
93
 
93
94
  1. **Two controls appear** to the right of the chat input. If they do not, the bundle layer is not mounted - check `dsh --profile web --dump-config` for the `dir-prep-organize` layer.
@@ -104,6 +105,8 @@ Worth knowing before you look for them:
104
105
  - **It registers no model tools.** The host half only injects `settings`; it never touches the tool registry. There is no `organize_text` tool to call.
105
106
  - **It opens no HTTP route of its own.** The data plane is the official Typert Remote namespace `dirPrepOrganize`, registered through an injected child fiber, reached through the host `/api` gateway. Authentication, Host/DNS-rebinding/Origin checks, the signed browser-session cookie and body limits are all the gateway's - this package keeps no CSRF token and no route table.
106
107
  - **It adds no CLI subcommand.**
108
+ - **It does not require the plugin manager to be installed.** The settings card waits for the `plugins.bundle.config` slot; without that slot it never appears, and the input-box controls keep working.
109
+ - **Its stylesheet is managed by the host renderer.** The build registers it through `ModuleLoader` metadata, so the client entry does not append a `<style>` element to `document.head`.
107
110
  - **It reads no environment variable** and makes no outbound request of its own.
108
111
  - What it *does* consume: the host `settings` service (hard-injected, so the entry does not activate without it), `llm.stream`, `agentDefaultModel`, and the session/agent/filesystem services. When the settings form itself is not ready, the card renders disabled with a status hint while the dropdown falls back to the built-in curated set.
109
112
 
@@ -114,7 +117,8 @@ Worth knowing before you look for them:
114
117
  - `conversation.input.right` - the polish button (id `dir-prep-organize`, order 99) and the templates dropdown (id `dir-prep-organize-templates`, order 100).
115
118
  - `plugins.bundle.config` - the settings card, keyed by the **bundle package name** `@jayyuen66/dsh-dir-prep-organize`. The host dispatches `entryKey: pkg.name` (source of truth: `dsh.profile.bundles` in the profile's `package.json`), so a bare entry id never matches and the card would render nowhere.
116
119
  - The settings namespace and `configForms.get()` stay the **bare entry id** `dir-prep-organize` - deliberately not the same identifier as that slot key.
117
- - The client half is `dsh.client.platform = web` with `immediately`; `dsh.client.external` names `@jayyuen66/dsh-plugin-shared/client` so the host sorts the startup graph with that supply row in place.
120
+ - The client half is `dsh.client.platform = web`; it is not an `immediately` row, so its bundle is not part of the boot prefetch tier and arrives with the Loader entry. `dsh.client.external` names `@jayyuen66/dsh-plugin-shared/client` so the host sorts the startup graph with that supply row in place.
121
+ - The card's `Menu` / `RiskConfirmation` come from `@deepseek-ai/dsh-client-ui-primitives/client`; the Web composition loads `ui-slots`, `ui-primitives`, and `ui-dockkit` as `immediately` rows, and `PLATFORM_MODULES` answers those names for every dynamic bundle. A composition that drops those rows cannot render the card.
118
122
  - The card follows the official locale plugin's preference for its own labels and copy; the host half reads the preference per request, so switching language needs no restart.
119
123
  - The plugin page reads its title, description and detail document from `locale/<lang>.json` (`meta.title`, `meta.description`, `meta.detail`). `docs/DETAIL.md` and `docs/DETAIL.zh.md` ship in the tarball; without `meta.detail` the host falls back to the README.
120
124
 
@@ -140,22 +144,20 @@ Worth knowing before you look for them:
140
144
  | Built-in set | 85 curated templates generated from the `agents/` role library. The dropdown falls back to them when `templates` is unset |
141
145
  | Insertion | Uses the input box's version-checked insert face (`captureInsertion()` + `insertText()`). Text goes in at the caret, quoted blocks and attachments stay intact, and a stale insertion inserts nothing |
142
146
  | "Unset" is an empty array | Under implicit registration schemastery casts a missing array field to `[]`, so **an empty list always means "fall back to built-in"**. Only a non-empty array whose items are all invalid renders as an empty list |
143
- | Restore defaults | Unsets `templates` back to the curated set and leaves `importAllowRoots` untouched. Two-step confirm; the second click must come within 4 seconds |
144
- | Import | By path: a local `.md` file or a directory. `path` exactly empty imports the whole built-in library. A role file whose code fence never closes is rejected instead of silently importing half its body |
147
+ | Restore defaults | Unsets `templates` back to the curated set and leaves `importAllowRoots` untouched. Two-step confirm |
148
+ | Import | By path: a local `.md` file or a directory. `path` exactly empty imports the built-in library's top level plus one sub-directory level. A role file whose code fence never closes is rejected instead of silently importing half its body |
145
149
 
146
150
  ## <img src="https://api.iconify.design/lucide/sliders-horizontal.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> Settings
147
151
 
148
- Namespace `dir-prep-organize` equals the settings entry id. Fields projected into the settings form are the `.volatile()` ones.
152
+ Settings live on the **dir-prep-organize** card in the plugin detail page. The card is the configuration reference for its editable lists: placeholders, tooltips, section notes and the shared save bar explain the controls where help exists. This README does not duplicate that field-level guidance.
153
+
154
+ The namespace and settings entry id are both `dir-prep-organize`; values persist in `settings.yaml` under the dsh data directory. Edits stage locally and take effect after **Save**. Saved template and allowed-root lists are read again on later actions, so they do not require a host restart.
155
+
156
+ `importAllowRoots` is an explicit trust list, not a placeholder. It accepts absolute directories only; relative paths and `~` are dropped, trailing separators are normalized, and duplicates are removed. An empty list adds nothing. Because the card has no session context, its imports can use only the bundled `agents/` library and registered roots; an endpoint call with a session also allows that session's active working directory. `.` / `..` and hidden path segments remain refused.
149
157
 
150
- | Field | Type | Default | Card control | Notes |
151
- |---|---|---|---|---|
152
- | `templates` | `{id,name,description,text,group,emoji}[]` | unset | **yes** | The user's own templates. Unset falls back to the 85 built-in entries |
153
- | `importAllowRoots` | `string[]` | `[]` | **yes** | Extra allowed roots for the import endpoint. Non-strings and whitespace-only items are dropped, **relative paths and `~` are dropped too** (the host resolves those against its own process cwd, which would register a root whose target nobody can read off the card), and items are deduplicated after trailing separators are normalized — `/a` and `/a/` are one tree, not two rows. With nothing registered, only the session cwd and the built-in role library are allowed |
154
- | `organizeTimeoutMs` | natural, volatile | `120000` | **no** | The LLM abort deadline in ms. Values are truncated and clamped to `[1, 2147483647]`; non-finite values fall back to `120000`. `0` passes the schema and clamps to 1 ms, so it really does mean an immediate timeout. Past 2^31-1 Node's `setTimeout` prints a `TimeoutOverflowWarning` and silently uses **1 ms**, which turns "raise the timeout" into "fail instantly". The card has no control, so changing it means `settings.yaml` or the row's `config:` |
155
- | `maxSnippetBytes` | natural, non-volatile | `262144` | **no** | Per-file cap for key-file snippets; a larger file, or one whose size is unknown, is skipped whole and counted in `skipped.tooLarge`. Import candidates use the same cap. Non-volatile means no form projection, hence no card row - deployment value only |
156
- | `readConcurrency` | natural, non-volatile | `8` | **no** | Bounded read concurrency for snippets and directory imports. Clamped to `[1, 64]`: `0` or a negative value made the bounded map recurse forever until the host was killed by the OOM killer, and a huge value defeats the fd ceiling this field exists to hold |
158
+ `organizeTimeoutMs` stays off-card. It defaults to `120000` ms, is read per request as the host's abort deadline, and gives the client fetch timeout a further 5000 ms. Values are truncated and clamped to `[1, 2147483647]`; non-finite values fall back to the default. Set it in `settings.yaml` or the plugin row's `config:` block. `maxSnippetBytes` (`262144`) and `readConcurrency` (`8`) are also off-card deployment values; they take effect on restart, and read concurrency is clamped to `[1, 64]`.
157
159
 
158
- Settings are persisted in `settings.yaml` under the dsh data directory.
160
+ **Conservative refusals and ways out.** A stale-write message means the input changed while the request was in flight; retry from the current draft, because there is no force-overwrite path. An import refusal means the target is outside the explicit trust boundary; register its absolute directory and save. Missing key-file text may be deliberate: sensitive names are never selected, while symlink escapes, unreadable files and size or budget skips are reflected in `skipped` / `truncated`. Do not treat the directory listing as complete content. If a role style is a poor fit, choose direct polish or another role.
159
161
 
160
162
  ## <img src="https://api.iconify.design/lucide/network.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> Public interface
161
163
 
@@ -167,7 +169,7 @@ Official Typert Remote namespace **`dirPrepOrganize`**, registered through an in
167
169
  | `context` | `{ sessionId }` | `ok` / `cwd` / `truncated` / `skipped` / `entries[{name,isDir,sizeBytes,snippet}]` |
168
170
  | `model` | `{ sessionId }` | `ok` / `provider` / `model` / `reasoningEffort` |
169
171
  | `organize` | `{ sessionId, prompt, entriesSummary, roleText? }` | `ok` / `content` |
170
- | `importTemplates` | `{ path, sessionId }` (`path` exactly empty = whole built-in library) | `ok` / `count` / `truncated` / `skipped` / `entries` |
172
+ | `importTemplates` | `{ path, sessionId }` (`path` exactly empty = built-in library, top level plus one sub-directory level) | `ok` / `count` / `truncated` / `skipped` / `entries` |
171
173
 
172
174
  - Business failures stay `ok:false` with `error`. The import path-policy branches are the exception: an out-of-bounds path or a malformed `path` field also carries `status` 403 or 400.
173
175
  - `model` is the preflight read of the default selection; `organize` prefers the live agent's selection as described under "The polish call".
@@ -179,12 +181,12 @@ Official Typert Remote namespace **`dirPrepOrganize`**, registered through an in
179
181
  |---|---|
180
182
  | Network | No outbound requests of its own: the data plane is the host gateway's RPC channel. No environment variable is read |
181
183
  | On disk | The only data written is `templates` and `importAllowRoots`, in the host settings file |
182
- | What one polish call sends | The full draft, the session cwd path, top-level directory entries **with the full text of key text files**, the real user/assistant turns (framework-injected messages and tool results are filtered out), and the optional role body |
184
+ | What one polish call sends | The full draft, the session's active working directory path, top-level directory entries **with the full text of key text files**, the real user/assistant turns (framework-injected messages and tool results are filtered out), and the optional role body |
183
185
  | Which files get a snippet | Only 20 code/document extensions (ts/tsx/js/jsx/mjs/cjs/py/rs/go/java/rb/json/toml/md/sql/graphql/proto/css/scss/less). `yaml` / `env` are **not** whitelisted |
184
186
  | Sensitive file names | Any file whose name matches `credentials` / `secret(s)` / `id_rsa` / `pem` / `p12` / `pfx` / `keystore` / `env` / `key(s)` / `token(s)` / `auth` / `passwd` / `password` / `account(s)` **at a separator boundary** never gets a snippet. The boundary is deliberate: a naive substring match would drop `monkey.js` and `AUTHORS.md`, while a miss would send credential text to a third-party model |
185
187
  | Caps and concurrency | A single file over `maxSnippetBytes`, or with unknown size, is skipped whole - never half-summarized. Collected snippets share a 2 MiB budget; once it is exhausted the rest are skipped whole and counted in `skipped.tooLarge`. Reads run with `readConcurrency` |
186
188
  | Counters | Too-large / unreadable / deeper-level / non-role cases are counted in `skipped`, shown in the UI, and reflected honestly by `truncated` |
187
- | Import endpoint | **Read-only**: no model call, no disk writes. Absolute paths are refused by default; only paths inside the session cwd, the package's `agents/` and `importAllowRoots` pass. `.` / `..` / hidden segments (such as `.ssh`) are always rejected, and an out-of-bounds path answers 403 echoing the resolved path |
189
+ | Import endpoint | **Read-only**: no model call, no disk writes. Absolute paths are refused by default; only paths inside the session's active working directory, the package's `agents/` and `importAllowRoots` pass. `.` / `..` / hidden segments (such as `.ssh`) are always rejected, and an out-of-bounds path answers 403 echoing the resolved path |
188
190
 
189
191
  ## <img src="https://api.iconify.design/lucide/triangle-alert.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> Known boundaries
190
192
 
@@ -201,7 +203,7 @@ Registered honestly, one entry per class.
201
203
 
202
204
  | Symptom | What happens |
203
205
  |---|---|
204
- | Nothing changed after pressing "Polish" | Failures never touch the draft; the button shows an error state for a few seconds with the reason in its tooltip. Usual causes: no session cwd (`sessionId` missing or session unknown), no model selection, a finish reason other than `stop`, the `organizeTimeoutMs` deadline, or the draft/selection changing while the request was in flight (the result is discarded) |
206
+ | Nothing changed after pressing "Polish" | Failures never touch the draft; the button shows an error state for a few seconds with the reason in its tooltip. Usual causes: no active working directory (`sessionId` missing, session unknown, and neither a live value nor `header.cwd` to fall back to), no model selection, a finish reason other than `stop`, the `organizeTimeoutMs` deadline, or the draft/selection changing while the request was in flight (the result is discarded) |
205
207
  | The model reports a context overflow | Working as designed: input is deliberately not truncated, so the model error is the feedback. A payload above the endpoint body cap gets 413 instead |
206
208
  | Importing local roles was refused | Absolute paths are refused by default and the card has no session context. The path must live inside the built-in `agents/` or a registered directory and contain no `.` / `..` / hidden segments |
207
209
  | Fewer entries imported than expected | Read the four `skipped` counters: `deeper` (third level, counted only), `tooLarge` (over `maxSnippetBytes`), `unnamed` (no name in the first 200 frontmatter lines), `unreadable` (read failure) |
package/README.zh-CN.md CHANGED
@@ -11,8 +11,8 @@
11
11
  <a href="https://www.npmjs.com/package/@jayyuen66/dsh-dir-prep-organize"><img src="https://img.shields.io/npm/d18m/@jayyuen66/dsh-dir-prep-organize?style=flat-square" alt="npm downloads (18 months)" /></a>
12
12
  <a href="https://github.com/JayYuen666/dsh-dir-prep-organize/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/JayYuen666/dsh-dir-prep-organize/ci.yml?branch=main&style=flat-square&label=ci" alt="ci" /></a>
13
13
  <img src="https://img.shields.io/badge/license-MIT-4c1?style=flat-square" alt="MIT" />
14
- <img src="https://img.shields.io/badge/node-%3E%3D24.9-4c1?style=flat-square&logo=nodedotjs&logoColor=white" alt="node" />
15
- <img src="https://img.shields.io/badge/dsh-%5E0.2.2--rc.5-658EFF?style=flat-square" alt="dsh" />
14
+ <img src="https://img.shields.io/badge/node-%5E24.22.3%7C%7C%3E%3D26.13.1-4c1?style=flat-square&logo=nodedotjs&logoColor=white" alt="node" />
15
+ <img src="https://img.shields.io/badge/dsh-%5E0.2.3--alpha.3-658EFF?style=flat-square" alt="dsh" />
16
16
  <a href="https://github.com/deepseek-ai/deepseek-harness"><img src="https://img.shields.io/badge/powered_by_dsh-4D6BFE?style=flat-square&logo=deepseek&logoColor=white" alt="powered by dsh" /></a>
17
17
  </p>
18
18
 
@@ -54,14 +54,14 @@
54
54
  - 在 web 输入框右侧加**两个控件**:一个可拆分的「润色」按钮(主键 + ▾),一个「模板」下拉。
55
55
  - 主键直接润色;▾ 键提供「以某个角色的风格润色」。
56
56
  - 下拉按条目的 `group` 字段分组,`group` 为空的条目落在「通用」里。
57
- - **润色**会把草稿、会话 cwd 的顶层(文件名、大小、关键文本文件的全文)以及会话里**真实的** user/assistant 轮次交给当前会话选定的模型(取不到时回落宿主默认模型),然后用重写结果替换草稿。只有会话、草稿版本与输入阶段都没变时才写回。
57
+ - **润色**会把草稿、会话活动工作目录的顶层(活值 `workingDirectory` 优先,缺席才回落 `header.cwd`——下文每条路径都按这一条推导;文件名、大小、关键文本文件的全文)以及会话里**真实的** user/assistant 轮次交给当前会话选定的模型(取不到时回落宿主默认模型),然后用重写结果替换草稿。只有会话、草稿版本与输入阶段都没变时才写回。
58
58
  - 失败时草稿**绝不**被改动:按钮进入错误态若干秒,原因写在其 tooltip 里。
59
59
  - **模板**经输入框的插入接口写到光标处:引用块与附件保持原样;插入凭据过期时宿主拒绝插入,而不是重建整份草稿。输入框处于提交期时两个控件禁用。
60
60
  - 内置集是 **85 条精选角色模板**,由 `scripts/gen-defaults.mjs` 从本包的 `agents/` 角色库生成——那是从上游项目移入的几百份角色 `.md`,分布在二十多个部门目录下。对用户有意义的是那 85 条;角色库的份数不在这里钉死,因为上游一刷新它就变。
61
61
  - 这张表**只在宿主侧**:客户端产物不再内联它。生成文件约 640 KB,曾把 `client.js` 推到约 711 KB。
62
62
  - 浏览器**懒加载、只调一次** Remote 的 `defaults` 方法(首次打开菜单或首次进设置卡),之后在进程内复用。用户已经有自己的模板时**一个字节都不拉**。
63
63
  - 数据还没到时菜单显示一行 loading,而不是「没有模板」那句提示;失败时把宿主自己的原因和「重试」按钮一起显示出来。
64
- - 设置卡的**「角色库」**小节覆盖:逐条增/改/删、两步恢复默认、一键导入整套内置库、按路径导入本地 `.md` 或目录、登记额外的允许导入目录。这个小节是**一份列表同时喂两处**——输入框「模板」下拉,与「润色」▾ 的角色菜单。
64
+ - 设置卡的**「角色库」**小节覆盖:逐条增/改/删、两步恢复默认、一键导入内置库(顶层 + 一层子目录)、按路径导入本地 `.md` 或目录、登记额外的允许导入目录。这个小节是**一份列表同时喂两处**——输入框「模板」下拉,与「润色」▾ 的角色菜单。
65
65
  - 模板与允许目录都经宿主设置读写,**零 LLM 调用**,且**不注册任何模型工具**。
66
66
 
67
67
  ## <img src="https://api.iconify.design/lucide/package.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> 安装
@@ -74,13 +74,12 @@ dsh plugin --profile web add @jayyuen66/dsh-dir-prep-organize
74
74
 
75
75
  - 组合包补丁会插入 `- id: dsh-plugin-shared`(`@jayyuen66/dsh-plugin-shared`)。**这个组件必须保持开启**:停用后设置卡会失去 shared 组件供应,下一次页面加载会报 `missed the module table`。
76
76
 
77
- - **要求 Node.js `>= 24.9`。** 本包是纯 ESM。用**具名**导出(`import { apply } from "@jayyuen66/dsh-dir-prep-organize"`);**没有 default 导出**,所以 `import pkg from …` 会报 `does not provide an export named 'default'`。正是这个 Node 下限让 ESM 入口的 `require()` 形式可用,所以声明了 `engines.node`。
78
- - **要求宿主 `dsh` 在 `0.2.2-rc.5` 这条宿主线上或更晚。** 宿主真正读的是 `engines.dsh`(`^0.2.2-rc.5`),而且它**单独决定**:`evaluatePluginCompatibility` 在 `engines.dsh` 那一支就返回了,根本走不到读 `peerDependencies` 的那段。按宿主装载门的判定谓词(`app-boot` 的 `satisfies`,带 `includePrerelease: true`)逐版本推得:`0.2.0-rc.2`、`0.2.1-rc.5`、`0.2.2-alpha.3`、`0.2.2-rc.1` 与 `0.2.2-rc.2` 到 `0.2.2-rc.4` **被拒**,`0.2.2-rc.5`、`0.2.2` 与 `0.2.3` 通过,`0.3.0` 被拒。被拒的宿主需要走显式担责的授权 `dsh plugin --profile <p> allow-version <pkg>@<ver> --dsh-version <exact> --accept-risk`。支持窗口是滚动的:本包在发布时把窗口内的每个已发布宿主版本逐版取证,窗口滚动后重新取证,不把这一句里的版本号当长期承诺。
79
- - **`@deepseek-ai/dsh-*` 的开发依赖钉在 `0.2.2-rc.5`**——本包编译与测试所对着的那条宿主线。`engines.dsh` 与 optional peer 范围承载单独判读的支持窗口(`^0.2.2-rc.5`);钉版是关于「它是对着哪个宿主版本**编译**的」的事实,不是那个窗口的复述。把两者混为一谈,正是发布门禁分开检查它们的原因。
80
- - **`dependencies` 里不放任何 `@deepseek-ai/*`,这是约定**(`test/publish-manifest.test.ts` 钉着)。消费方 profile 用 `nodeLinker: hoisted` 且 `autoInstallPeers: false` 安装,于是写在 `dependencies` 里的宿主包会被落成**真实目录**,与运行中的宿主已加载的那份并存。`@deepseek-ai/dsh-tools` 的工具运行期调度键是普通 `Symbol`(不是 `Symbol.for`),符号身份按模块实例算:宿主从 profile 副本上读那个键拿到 `undefined`,于是**每一次原生工具调用都抛**——而本包的构建、类型检查、覆盖率检查在此之前全部照绿。
81
- - **`host.js` 按值导入的那两枚宿主包是必需 peer**:`@deepseek-ai/schemastery`(宿主 fork——只有它能把 `.volatile()` 字段解析成活引用)与 `@deepseek-ai/dsh-brand`。`build-host.mjs` 外部化 `dependencies` **与** `peerDependencies`,所以裸说明符留在产物里;只写 `devDependencies` 会让打包器把官方函数体内联进去。`test/build-host.test.ts` 同时钉「说明符在」与「函数体不在」。
82
- - **声明里点到的每一枚宿主包都落在 `peerDependencies`**,凡是只能从那里到达的都是 *optional*(`@deepseek-ai/cordis`、`cosmokit`,以及 `dsh-agent-default-model` / client-ui / `fs` / `llm` / `session` 那一族)。声明它们不是仪式:pnpm 严格布局下,`types/host.d.ts` 里一枚没有被任何 manifest 表点名的裸说明符在消费方侧解析不到,而本仓自己的类型检查照样绿。那条清单由测试从 `types/**/*.d.ts` 现量读,不从这段文字读,所以两边不会漂移。
83
- - **随包发的东西**:`host.js`、`client.js`、`templates.data.mjs`、`types/`、`cordis.patch.yml`、`agents/`、`locale/`、`docs/` 与 `THIRD_PARTY_NOTICES.md`。`package.json`、`README*` 与 `LICENSE` 由发布器无条件附带。
77
+ - **要求 Node.js `^24.22.3 || >=26.13.1`。** 本包是纯 ESM。用**具名**导出(`import { apply } from "@jayyuen66/dsh-dir-prep-organize"`);**没有 default 导出**,所以 `import pkg from …` 会报 `does not provide an export named 'default'`。`engines.node` 跟随宿主下限;宿主跑不起来的 Node,安装器也会拒掉。
78
+ - **要求宿主 `dsh` 在 `0.2.3-alpha.3` 这条宿主线上或更晚。** 宿主真正读的是 `engines.dsh`(`^0.2.3-alpha.3`),而且它**单独决定**:`evaluatePluginCompatibility` 在 `engines.dsh` 那一支就返回了,根本走不到读 `peerDependencies` 的那段。按宿主装载门的判定谓词(`app-boot` 的 `satisfies`,带 `includePrerelease: true`):`0.2.3-alpha.3`、其后低于 `0.3.0` 的正式版与 `0.2.3` 元组内的预发布通过;`0.2.2` 及更早与 `0.3.0` 及以后都被拒;更高 `0.2.x` 元组的预发布(如 `0.2.4-rc.1`)同样满足。被拒的宿主需要走显式担责的授权 `dsh plugin --profile <p> allow-version <pkg>@<ver> --dsh-version <exact> --accept-risk`。支持窗口是滚动的:本包在发布时把窗口内的每个已发布宿主版本逐版取证,窗口滚动后重新取证,不把这一句里的版本号当长期承诺。
79
+ - **`@deepseek-ai/dsh-*` 的开发依赖钉在 `0.2.3-alpha.3`**——本包编译与测试所对着的那条宿主线。`engines.dsh` 与 optional peer 范围承载单独判读的支持窗口(`^0.2.3-alpha.3`);钉版是关于「它是对着哪个宿主版本**编译**的」的事实,不是那个窗口的复述。把两者混为一谈,正是发布门禁分开检查它们的原因。
80
+ - **`dependencies` 里不放任何 `@deepseek-ai/*`,这是约定**(`test/publish-manifest.test.ts` 钉着)。消费方 profile 用 `nodeLinker: hoisted` 且 `autoInstallPeers: false` 安装,于是写在 `dependencies` 里的宿主包会被落成**真实目录**,与运行中的宿主已加载的那份并存。`@deepseek-ai/dsh-tools` 的工具运行期调度键曾在宿主 `0.2.2` 线是普通 `Symbol`(不是 `Symbol.for`),符号身份按模块实例算(该调度键在 `0.2.3` 源码里已移除):宿主从 profile 副本上读那个键拿到 `undefined`,于是**每一次原生工具调用都抛**——而本包的构建、类型检查、覆盖率检查在此之前全部照绿。
81
+ - **`host.js` 按值导入的那三枚宿主包是必需 peer**:`@deepseek-ai/schemastery`(宿主 fork——只有它能把 `.volatile()` 字段解析成活引用)、`@deepseek-ai/dsh-brand` 与 `@deepseek-ai/dsh-typert-protocol`(Remote 的 Service 基类)。`build-host.mjs` 外部化 `dependencies` **与** `peerDependencies`,所以裸说明符留在产物里;只写 `devDependencies` 会让打包器把官方函数体内联进去。`test/build-host.test.ts` 同时钉「说明符在」与「函数体不在」。
82
+ - **随包发的东西**:`host.js`、`client.js`、`templates.data.mjs`、`cordis.patch.yml`、`agents/`、`locale/`、`docs/` 与 `THIRD_PARTY_NOTICES.md`。`package.json`、`README*` 与 `LICENSE` 由发布器无条件附带。
84
83
  - **内置表单独一个产物、首次使用时才加载**,不是插件装载时加载。它以前被打进 `host.js`,于是每个用户即使从不开那个下拉,也要在内存里付一份模板的代价。
85
84
  - **`agents/` 不是本仓写的**:来自 [`agency-agents-zh`](https://github.com/jnMetaCode/agency-agents-zh)(MIT)。版权与许可声明随包发在 `THIRD_PARTY_NOTICES.md` 里,因为 MIT 要求它出现在每一份分发副本中。**不要手改 `agents/` 下的任何文件。**
86
85
 
@@ -88,6 +87,8 @@ dsh plugin --profile web add @jayyuen66/dsh-dir-prep-organize
88
87
 
89
88
  如果你的 profile 用 pnpm `overrides` 把 `@jayyuen66/dsh-plugin-shared` 钉在某个版本,那个值必须不低于本包声明的那一版。钉得更低会装到一份缺少运行期所导入名字的产物,宿主起来时报 `N entries did not activate` 与 `does not provide an export named ...`——包装得上、永远不生效,而各仓单仓 CI 看不见这一类。
90
89
 
90
+ bundle 顺序也会决定这件事:本包的 patch 插入 `dsh-plugin-shared` 行,并在 `dependencies` 声明 shared,所以这行加载本 bundle 自己 import 的那份。多个 bundle 插入同一个包名的行时,`dsh.profile.bundles` 里排在最前的那个决定它加载哪份;profile 自己的 `cordis.patch.yml` 里写同一包名的行则加载 profile 的那份。请让这行最终拿到的那份不低于本包声明的版本。本版起的客户端样式表(`meta.stylesheets`)与 `ProgressBar` 需要 shared `0.3.2` 或更晚;`^0.3.1` 的范围只为兼容旧插件,发布与单仓 CI 请以 `0.3.2` 作为实际下限。
91
+
91
92
  ## <img src="https://api.iconify.design/lucide/circle-check.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> 确认它真的在工作
92
93
 
93
94
  1. **输入框右边出现两个控件。** 没出现就是装配层没挂上——用 `dsh --profile web --dump-config` 看有没有 `dir-prep-organize` 这一层。
@@ -104,6 +105,8 @@ dsh plugin --profile web add @jayyuen66/dsh-dir-prep-organize
104
105
  - **它不注册任何模型工具。** 宿主半只 inject `settings`,从不碰工具注册表。没有 `organize_text` 这类工具可调。
105
106
  - **它没有自建的 HTTP 路由。** 数据那一栏是官方 Typert Remote 命名空间 `dirPrepOrganize`,经注入的子 fiber 注册,走宿主 `/api` 网关。认证、Host/DNS 重绑定/Origin判据、签名浏览器会话 cookie、body 上限全归网关——本包不持有 CSRF token,也没有路由表。
106
107
  - **它不加 CLI 子命令。**
108
+ - **它不要求装插件管理器。** 设置卡等的是 `plugins.bundle.config` 槽;没有那个槽时卡片不会出现,输入框旁的控件照常工作。
109
+ - **样式表由宿主 renderer 管理。** 构建时通过 `ModuleLoader` 元数据注册,客户端入口不再向 `document.head` 追加 `<style>` 元素。
107
110
  - **它不读任何环境变量**,也没有自己的出站请求。
108
111
  - 它**确实**消费的东西:宿主 `settings` 服务(硬注入,缺它条目根本不激活)、`llm.stream`、`agentDefaultModel`,以及会话、Agent 与文件系统服务。设置表单本身没就绪时,卡片禁用并显示状态提示,下拉回落到内置精选集。
109
112
 
@@ -114,7 +117,8 @@ dsh plugin --profile web add @jayyuen66/dsh-dir-prep-organize
114
117
  - `conversation.input.right`——润色按钮(id `dir-prep-organize`,order 99)与模板下拉(id `dir-prep-organize-templates`,order 100)。
115
118
  - `plugins.bundle.config`——设置卡,按 **bundle 包名** `@jayyuen66/dsh-dir-prep-organize` 作 key。宿主派发 `entryKey: pkg.name`(唯一来源是 profile `package.json` 里的 `dsh.profile.bundles`),所以写成裸条目 id 永远匹配不上,卡片哪都不渲染。
116
119
  - 设置命名空间与 `configForms.get()` 仍是**裸条目 id** `dir-prep-organize`——与那个槽位 key 刻意不是同一个标识。
117
- - 客户端半是 `dsh.client.platform = web` 且带 `immediately`;`dsh.client.external` 声明 `@jayyuen66/dsh-plugin-shared/client`,供宿主把这条供应行排进启动图。
120
+ - 客户端半是 `dsh.client.platform = web`;它不是 `immediately` 行,因此不进启动预取层,bundle 随 Loader 条目到达。`dsh.client.external` 声明 `@jayyuen66/dsh-plugin-shared/client`,供宿主把这条供应行排进启动图。
121
+ - 卡片的 `Menu` / `RiskConfirmation` 来自 `@deepseek-ai/dsh-client-ui-primitives/client`;Web 组合把 `ui-slots`、`ui-primitives`、`ui-dockkit` 作为 `immediately` 行装载,`PLATFORM_MODULES` 为每个动态 bundle 提供这几个名字。组合里漏掉这几行时,卡片渲染不出来。
118
122
  - 卡片的文案遵循官方 locale 插件的偏好;宿主半每次请求现读该偏好,所以切语言不必重启。
119
123
  - 插件页的标题、说明与详情文档来自 `locale/<语言>.json`(`meta.title`、`meta.description`、`meta.detail`)。`docs/DETAIL.md` 与 `docs/DETAIL.zh.md` 随包发布;没有声明 `meta.detail` 时宿主才回落到 README。
120
124
 
@@ -140,22 +144,20 @@ dsh plugin --profile web add @jayyuen66/dsh-dir-prep-organize
140
144
  | 内置集 | 从 `agents/` 角色库生成的 85 条精选模板。`templates` 未设置时下拉回落到它们 |
141
145
  | 插入 | 走输入框的版本校验插入接口(`captureInsertion()` + `insertText()`)。文本写到光标处,引用块与附件保持原样;凭据过期时什么都不插入 |
142
146
  | 「未设置」= 空数组 | 隐式注册下 schemastery 会把缺失的数组字段 cast 成 `[]`,所以**空列表永远意味着「回落到内置」**。只有非空数组且条目全部非法,才渲染成空列表 |
143
- | 恢复默认 | 把 `templates` 退回精选集,`importAllowRoots` 不动。两步确认,第二次点击须在 4 秒内 |
144
- | 导入 | 按路径:本地 `.md` 文件或目录。`path` 恰为空串 = 导入整套内置库。角色文件的代码围栏没有结束标记时直接拒绝,不会静默只导入半篇正文 |
147
+ | 恢复默认 | 把 `templates` 退回精选集,`importAllowRoots` 不动。两步确认 |
148
+ | 导入 | 按路径:本地 `.md` 文件或目录。`path` 恰为空串 = 导入内置库(顶层 + 一层子目录)。角色文件的代码围栏没有结束标记时直接拒绝,不会静默只导入半篇正文 |
145
149
 
146
150
  ## <img src="https://api.iconify.design/lucide/sliders-horizontal.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> 设置项
147
151
 
148
- 命名空间 `dir-prep-organize` 即设置条目 id。投影进设置表单的字段就是那几个 `.volatile()` 的。
152
+ 设置位于插件详情页的 **dir-prep-organize** 卡片。卡片是两份可编辑列表的配置说明:placeholder、tooltip、小节提示与统一保存条在有帮助的地方解释控件。本文不再复述字段级帮助。
153
+
154
+ 命名空间与设置条目 id 都是 `dir-prep-organize`,值持久化在 dsh 数据目录的 `settings.yaml`。改动先本地暂存,点**保存**后生效。已保存的模板与允许目录会在后续动作中重新读取,不需要重启宿主。
155
+
156
+ `importAllowRoots` 是显式信任列表,不是占位项。它只接受绝对目录;相对路径与 `~` 会被丢弃,末尾分隔符先归一再去重。列表为空表示不额外放行。设置卡没有会话上下文,因此卡上导入只能使用随包 `agents/` 与已登记目录;带会话调用的端点还允许该会话的活动工作目录。含 `.` / `..` 或隐藏段的路径仍被拒绝。
149
157
 
150
- | 字段 | 类型 | 默认值 | 卡上有控件 | 说明 |
151
- |---|---|---|---|---|
152
- | `templates` | `{id,name,description,text,group,emoji}[]` | 未设置 | **有** | 用户自己的模板。未设置时回落到 85 条内置 |
153
- | `importAllowRoots` | `string[]` | `[]` | **有** | 导入端点的额外允许根,逐个目录登记;非字符串与纯空白项丢弃,**相对路径与 `~` 同样丢弃**(host 按它自己的进程 cwd 解析它们,等于登记一条界面上看不出指向哪里的根),末尾分隔符归一后再去重——`/a` 与 `/a/` 是同一棵树,不该在卡上摆两行。一个都没登记时只允许会话 cwd 与内置角色库 |
154
- | `organizeTimeoutMs` | natural,volatile | `120000` | **无** | LLM 中止时限(毫秒)。取值先取整再夹到 `[1, 2147483647]`;非有限数回落到 `120000`。`0` 能过 schema,夹完是 1 ms,所以它确实表示"立刻超时"。超过 2^31-1 时 Node 的 `setTimeout` 会打 `TimeoutOverflowWarning` 并静默用 **1 ms**,于是"调大超时"变成"立刻失败"。卡上没有控件,改它只能经 `settings.yaml` 或该行的 `config:` |
155
- | `maxSnippetBytes` | natural,非 volatile | `262144` | **无** | 关键文件摘要的单文件上限;超过、或大小未知的文件整份跳过并计入 `skipped.tooLarge`。导入候选用同一个上限。非 volatile 意味着不进表单快照,所以也没有卡上的行——纯部署值 |
156
- | `readConcurrency` | natural,非 volatile | `8` | **无** | 摘要与目录导入的有界读并发。夹在 `[1, 64]`:`0` 或负数会让那套有界 map 自我递归直到宿主被 OOM killer 杀掉,而过大的值直接废掉这个字段存在的意义(fd 上限) |
158
+ `organizeTimeoutMs` 留在卡外。默认 `120000` ms,每次请求现读,作为宿主的 abort 时限;客户端 fetch 超时再留 5000 ms。取值先取整再夹到 `[1, 2147483647]`,非有限数回落默认值。修改位置是 `settings.yaml` 或插件注册行的 `config:` 块。`maxSnippetBytes`(`262144`)与 `readConcurrency`(`8`)同样留在卡外,随重启生效;读并发夹在 `[1, 64]`。
157
159
 
158
- 设置持久化在 dsh 数据目录下的 `settings.yaml`。
160
+ **保守拒绝与出路。** 过期写入提示表示请求途中输入已变;请从当前草稿重试,没有强制覆盖路径。导入被拒表示目标不在显式信任边界内;登记它的绝对目录并保存。关键文件正文缺失可能是刻意行为:敏感文件名永不入选,符号链接越界、读取失败以及大小或总量预算跳过会反映在 `skipped` / `truncated`。不要把目录列表当成完整内容。角色风格不合适时,改用直接润色或另一个角色。
159
161
 
160
162
  ## <img src="https://api.iconify.design/lucide/network.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> 对外接口
161
163
 
@@ -167,7 +169,7 @@ dsh plugin --profile web add @jayyuen66/dsh-dir-prep-organize
167
169
  | `context` | `{ sessionId }` | `ok` / `cwd` / `truncated` / `skipped` / `entries[{name,isDir,sizeBytes,snippet}]` |
168
170
  | `model` | `{ sessionId }` | `ok` / `provider` / `model` / `reasoningEffort` |
169
171
  | `organize` | `{ sessionId, prompt, entriesSummary, roleText? }` | `ok` / `content` |
170
- | `importTemplates` | `{ path, sessionId }`(`path` 恰为空串 = 整套内置库) | `ok` / `count` / `truncated` / `skipped` / `entries` |
172
+ | `importTemplates` | `{ path, sessionId }`(`path` 恰为空串 = 内置库,顶层 + 一层子目录) | `ok` / `count` / `truncated` / `skipped` / `entries` |
171
173
 
172
174
  - 业务失败一律 `ok:false` 带 `error`。导入路径策略那几支是例外:越界路径或形状不对的 `path` 还会额外带 `status` 403 或 400。
173
175
  - `model` 只是对默认选择的预检;`organize` 优先用会话活 Agent 的选择,见「润色调用」。
@@ -179,12 +181,12 @@ dsh plugin --profile web add @jayyuen66/dsh-dir-prep-organize
179
181
  |---|---|
180
182
  | 网络 | 没有自己的出站请求:数据那一栏走宿主网关的 RPC 通道。不读任何环境变量 |
181
183
  | 写到磁盘 | 唯一写盘的是宿主设置文件里的 `templates` 与 `importAllowRoots` |
182
- | 一次润色发出去什么 | 完整草稿、会话 cwd 路径、顶层目录条目**连同关键文本文件的全文**、真实的 user/assistant 轮次(框架注入的消息与工具结果被滤掉),以及可选的角色正文 |
184
+ | 一次润色发出去什么 | 完整草稿、会话活动工作目录路径、顶层目录条目**连同关键文本文件的全文**、真实的 user/assistant 轮次(框架注入的消息与工具结果被滤掉),以及可选的角色正文 |
183
185
  | 哪些文件会取摘要 | 只有 20 种代码/文档扩展名(ts/tsx/js/jsx/mjs/cjs/py/rs/go/java/rb/json/toml/md/sql/graphql/proto/css/scss/less)。`yaml` / `env` **不在**白名单里 |
184
186
  | 敏感文件名 | 名字在**分隔符边界**上命中 `credentials` / `secret(s)` / `id_rsa` / `pem` / `p12` / `pfx` / `keystore` / `env` / `key(s)` / `token(s)` / `auth` / `passwd` / `password` / `account(s)` 的文件,永不取摘要。边界是刻意的:朴素子串匹配会误杀 `monkey.js` 与 `AUTHORS.md`,而漏匹配会把凭据全文发给第三方模型 |
185
187
  | 上限与并发 | 单个文件超过 `maxSnippetBytes`、或大小未知,整份跳过——绝不半份摘要。收集到的摘要共享 2 MiB 总量预算;用完之后其余整份跳过并计入 `skipped.tooLarge`。读按 `readConcurrency` 跑 |
186
188
  | 计数器 | 过大 / 读不出 / 更深层 / 非角色这几类计入 `skipped`,在 UI 里显示,并由 `truncated` 如实反映 |
187
- | 导入端点 | **只读**:不调模型、不写盘。绝对路径默认拒绝;只有会话 cwd、本包的 `agents/` 与 `importAllowRoots` 之内通过。`.` / `..` / 隐藏段(如 `.ssh`)一律拒绝,越界路径回 403 并回显解析后的路径 |
189
+ | 导入端点 | **只读**:不调模型、不写盘。绝对路径默认拒绝;只有会话活动工作目录、本包的 `agents/` 与 `importAllowRoots` 之内通过。`.` / `..` / 隐藏段(如 `.ssh`)一律拒绝,越界路径回 403 并回显解析后的路径 |
188
190
 
189
191
  ## <img src="https://api.iconify.design/lucide/triangle-alert.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> 已知边界
190
192
 
@@ -201,7 +203,7 @@ dsh plugin --profile web add @jayyuen66/dsh-dir-prep-organize
201
203
 
202
204
  | 症状 | 怎么回事 |
203
205
  |---|---|
204
- | 按了「润色」什么都没变 | 失败从不碰草稿;按钮进入错误态若干秒,原因在 tooltip 里。常见成因:没有会话 cwd(`sessionId` 缺失或会话未知)、没有模型选择、finish reason 不是 `stop`、撞上 `organizeTimeoutMs` 时限,或请求途中草稿/模型选择变了(结果被丢弃) |
206
+ | 按了「润色」什么都没变 | 失败从不碰草稿;按钮进入错误态若干秒,原因在 tooltip 里。常见成因:没有可用的活动工作目录(`sessionId` 缺失、会话未知,且活值与 `header.cwd` 都取不到)、没有模型选择、finish reason 不是 `stop`、撞上 `organizeTimeoutMs` 时限,或请求途中草稿/模型选择变了(结果被丢弃) |
205
207
  | 模型报上下文溢出 | 这是设计如此:输入刻意不截断,模型报错就是反馈。载荷超过端点 body 上限则得到 413 |
206
208
  | 导入本地角色被拒 | 绝对路径默认拒绝,而卡片没有会话上下文。路径必须在内置 `agents/` 或某个已登记目录之内,且不含 `.` / `..` / 隐藏段 |
207
209
  | 导入的条目比预期少 | 看四个 `skipped` 计数器:`deeper`(第三层,只计数)、`tooLarge`(超过 `maxSnippetBytes`)、`unnamed`(前 200 行 frontmatter 里没有名字)、`unreadable`(读失败) |
@@ -47,8 +47,10 @@ SOFTWARE.
47
47
  ## 运行期依赖
48
48
 
49
49
  运行期依赖的许可由各自包随包分发,本包不再重复其文本:`@deepseek-ai/cosmokit`、
50
- `@deepseek-ai/dsh-brand`、`@deepseek-ai/schemastery`、`@jayyuen66/dsh-plugin-shared`、`zod`。
50
+ `@deepseek-ai/dsh-brand`、`@deepseek-ai/dsh-typert-protocol`、`@deepseek-ai/schemastery`、
51
+ `@deepseek-ai/dsh-output-retention`(shared 的文本模块在运行期按值导入它)、
52
+ `@jayyuen66/dsh-plugin-shared`、`zod`。
51
53
  `zod` 由设置卡的 `src/remote.ts` 以值引入(strict codec 的形状校验),client 产物按宿主
52
54
  `PLATFORM_MODULES` 保持 `require("zod")` 外部化。
53
- 其中 `@deepseek-ai/cosmokit` 仅出现在本包发布的类型声明里——schemastery 的 `Schema` 类型
54
- 把 `Dict` 取自 cosmokit,声明文件点名它就必须让它可解析,故列为运行期依赖而非开发依赖。
55
+ 其中 `@deepseek-ai/cosmokit` 只作为类型解析出现——schemastery 的 `Schema` 类型把 `Dict`
56
+ 取自 cosmokit;本包不按值导入它,但 typecheck 解析这条类型时需要它,故留在 peer/dev 的类型供应里。