@jayyuen66/dsh-dir-prep-organize 0.1.2 → 0.1.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jayyuen66/dsh-dir-prep-organize",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "dsh 插件:对话输入框「整理」按钮(主键直接整理/▾ 以角色视角整理,结合当前目录 + session 模型整理优化草稿)+「模板」下拉(内置精选角色集生成自插件 agents/ 角色库,可按部门分组;设置卡可增删改/一键导入内置全部/导入本地角色 .md)",
5
5
  "homepage": "https://github.com/JayYuen666/dsh-dir-prep-organize#readme",
6
6
  "bugs": {
@@ -45,60 +45,66 @@
45
45
  "registry": "https://registry.npmjs.org"
46
46
  },
47
47
  "dependencies": {
48
- "@jayyuen66/dsh-plugin-shared": "^0.1.5-rc"
48
+ "@jayyuen66/dsh-plugin-shared": "^0.1.6"
49
49
  },
50
50
  "devDependencies": {
51
- "@deepseek-ai/cordis": "4.0.5-alpha.1",
52
- "@deepseek-ai/cosmokit": "1.8.6-alpha.1",
53
- "@deepseek-ai/dsh-agent-default-model": "0.2.1-alpha.2",
54
- "@deepseek-ai/dsh-app-boot": "0.2.1-alpha.2",
55
- "@deepseek-ai/dsh-brand": "0.2.1-alpha.2",
56
- "@deepseek-ai/dsh-client-locale": "0.2.1-alpha.2",
57
- "@deepseek-ai/dsh-client-ui-conversation": "0.2.1-alpha.2",
58
- "@deepseek-ai/dsh-client-ui-plugin-manager": "0.2.1-alpha.2",
59
- "@deepseek-ai/dsh-client-ui-renderer": "0.2.1-alpha.2",
60
- "@deepseek-ai/dsh-client-ui-settings": "0.2.1-alpha.2",
61
- "@deepseek-ai/dsh-client-ui-slots": "0.2.1-alpha.2",
62
- "@deepseek-ai/dsh-config-editor": "0.2.1-alpha.2",
63
- "@deepseek-ai/dsh-fs": "0.2.1-alpha.2",
64
- "@deepseek-ai/dsh-host-webserver": "0.2.1-alpha.2",
65
- "@deepseek-ai/dsh-llm": "0.2.1-alpha.2",
66
- "@deepseek-ai/dsh-sandbox": "0.2.1-alpha.2",
67
- "@deepseek-ai/dsh-session": "0.2.1-alpha.2",
68
- "@deepseek-ai/dsh-settings": "0.2.1-alpha.2",
69
- "@deepseek-ai/schemastery": "3.18.5-alpha.1",
51
+ "@deepseek-ai/cordis": "4.0.5",
52
+ "@deepseek-ai/cordis-plugin-group": "1.0.5",
53
+ "@deepseek-ai/cordis-plugin-include": "1.0.10",
54
+ "@deepseek-ai/cosmokit": "1.8.6",
55
+ "@deepseek-ai/dsh-agent-default-model": "0.2.1-rc.2",
56
+ "@deepseek-ai/dsh-app-boot": "0.2.1-rc.2",
57
+ "@deepseek-ai/dsh-brand": "0.2.1-rc.2",
58
+ "@deepseek-ai/dsh-client-locale": "0.2.1-rc.2",
59
+ "@deepseek-ai/dsh-client-ui-conversation": "0.2.1-rc.2",
60
+ "@deepseek-ai/dsh-client-ui-plugin-manager": "0.2.1-rc.2",
61
+ "@deepseek-ai/dsh-client-ui-renderer": "0.2.1-rc.2",
62
+ "@deepseek-ai/dsh-client-ui-settings": "0.2.1-rc.2",
63
+ "@deepseek-ai/dsh-client-ui-slots": "0.2.1-rc.2",
64
+ "@deepseek-ai/dsh-config-editor": "0.2.1-rc.2",
65
+ "@deepseek-ai/dsh-fs": "0.2.1-rc.2",
66
+ "@deepseek-ai/dsh-home-paths": "0.2.1-rc.2",
67
+ "@deepseek-ai/dsh-host-webserver": "0.2.1-rc.2",
68
+ "@deepseek-ai/dsh-launch-environment": "0.2.1-rc.2",
69
+ "@deepseek-ai/dsh-llm": "0.2.1-rc.2",
70
+ "@deepseek-ai/dsh-sandbox": "0.2.1-rc.2",
71
+ "@deepseek-ai/dsh-scope": "0.2.1-rc.2",
72
+ "@deepseek-ai/dsh-session": "0.2.1-rc.2",
73
+ "@deepseek-ai/dsh-settings": "0.2.1-rc.2",
74
+ "@deepseek-ai/dsh-typert-protocol": "0.2.1-rc.2",
75
+ "@deepseek-ai/schemastery": "3.18.5",
70
76
  "@types/node": "26.6.5",
71
77
  "@types/react": "19.3.0",
72
78
  "@types/react-dom": "19.3.0",
73
- "@vitest/coverage-v8": "5.0.3",
79
+ "@vitest/coverage-v8": "5.0.5",
74
80
  "eslint-plugin-sonarjs": "4.2.2",
75
- "happy-dom": "20.14.6",
76
- "oxfmt": "0.72.0",
77
- "oxlint": "1.87.0",
81
+ "happy-dom": "21.0.3",
82
+ "oxfmt": "0.73.0",
83
+ "oxlint": "1.88.0",
78
84
  "oxlint-tsgolint": "7.0.2004",
79
85
  "react": "^19.3.0",
80
86
  "react-dom": "^19.3.0",
81
- "rolldown": "1.2.13",
87
+ "rolldown": "1.2.14",
82
88
  "typescript": "7.0.2",
83
89
  "vite": "8.3.4",
84
- "vitest": "5.0.3"
90
+ "vitest": "5.0.5"
85
91
  },
86
92
  "peerDependencies": {
87
- "@deepseek-ai/cordis": "4.0.5-alpha.1",
88
- "@deepseek-ai/cosmokit": "1.8.6-alpha.1",
89
- "@deepseek-ai/dsh": ">=0.2.0-rc.2",
90
- "@deepseek-ai/dsh-agent-default-model": "0.2.1-alpha.2",
91
- "@deepseek-ai/dsh-brand": "0.2.1-alpha.2",
92
- "@deepseek-ai/dsh-client-locale": "0.2.1-alpha.2",
93
- "@deepseek-ai/dsh-client-ui-conversation": "0.2.1-alpha.2",
94
- "@deepseek-ai/dsh-client-ui-renderer": "0.2.1-alpha.2",
95
- "@deepseek-ai/dsh-client-ui-settings": "0.2.1-alpha.2",
96
- "@deepseek-ai/dsh-client-ui-slots": "0.2.1-alpha.2",
97
- "@deepseek-ai/dsh-fs": "0.2.1-alpha.2",
98
- "@deepseek-ai/dsh-llm": "0.2.1-alpha.2",
99
- "@deepseek-ai/dsh-session": "0.2.1-alpha.2",
100
- "@deepseek-ai/schemastery": "3.18.5-alpha.1",
101
- "react": "^19.3.0"
93
+ "@deepseek-ai/cordis": "4.0.5",
94
+ "@deepseek-ai/cosmokit": "1.8.6",
95
+ "@deepseek-ai/dsh": "^0.2.1-rc.2",
96
+ "@deepseek-ai/dsh-agent-default-model": "0.2.1-rc.2",
97
+ "@deepseek-ai/dsh-brand": "0.2.1-rc.2",
98
+ "@deepseek-ai/dsh-client-locale": "0.2.1-rc.2",
99
+ "@deepseek-ai/dsh-client-ui-conversation": "0.2.1-rc.2",
100
+ "@deepseek-ai/dsh-client-ui-renderer": "0.2.1-rc.2",
101
+ "@deepseek-ai/dsh-client-ui-settings": "0.2.1-rc.2",
102
+ "@deepseek-ai/dsh-client-ui-slots": "0.2.1-rc.2",
103
+ "@deepseek-ai/dsh-fs": "0.2.1-rc.2",
104
+ "@deepseek-ai/dsh-llm": "0.2.1-rc.2",
105
+ "@deepseek-ai/dsh-session": "0.2.1-rc.2",
106
+ "@deepseek-ai/dsh-typert-protocol": "0.2.1-rc.2",
107
+ "@deepseek-ai/schemastery": "3.18.5"
102
108
  },
103
109
  "peerDependenciesMeta": {
104
110
  "@deepseek-ai/cordis": {
@@ -143,7 +149,7 @@
143
149
  },
144
150
  "icon": "icon.svg",
145
151
  "engines": {
146
- "dsh": ">=0.2.0-rc.2",
152
+ "dsh": "^0.2.1-rc.2",
147
153
  "node": ">=22.12.0"
148
154
  },
149
155
  "dsh": {
package/types/host.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- import type { IncomingMessage, ServerResponse } from "node:http";
2
1
  import Schema from "@deepseek-ai/schemastery";
3
2
  import type { Context, Volatile } from "@deepseek-ai/cordis";
4
3
  import type { AgentDefaultModelConfig } from "@deepseek-ai/dsh-agent-default-model";
5
4
  import type { FileSystem } from "@deepseek-ai/dsh-fs";
6
- import type { GenerateOptions, LlmRuntime, Message, StreamChunk } from "@deepseek-ai/dsh-llm";
5
+ import type { GenerateOptions, LlmRuntime, Message, ReasoningEffortId, StreamChunk } from "@deepseek-ai/dsh-llm";
7
6
  import type { SessionHeader, SessionId } from "@deepseek-ai/dsh-session";
7
+ import { TypertRemoteService } from "@deepseek-ai/dsh-typert-protocol";
8
8
  import type { HostMessages } from "./src/host-messages.js";
9
9
  import type { TemplateEntry } from "./src/templates.js";
10
10
  /**
@@ -20,10 +20,10 @@ import type { TemplateEntry } from "./src/templates.js";
20
20
  */
21
21
  export declare function defaultTemplatesFrom(raw: unknown): readonly TemplateEntry[];
22
22
  /**
23
- * 内置精选模板表(85 条):按需载入,永不静态导入。
23
+ * 内置精选模板表:按需载入,永不静态导入。
24
24
  *
25
- * 静态导入会让这 85 条模板随宿主载入插件一起进内存,而它们只有一个消费者——default-templates
26
- * 端点,而客户端本来就是首次打开下拉时才拉这一发。两边都按需,才是同一件事的同一口径。
25
+ * 静态导入会让整张精选表随宿主载入插件一起进内存,而它们只有一个消费者——default-templates
26
+ * 读面,而客户端本来就是首次打开下拉时才拉这一发。两边都按需,才是同一件事的同一口径。
27
27
  *
28
28
  * @returns 内置精选模板表
29
29
  */
@@ -44,13 +44,13 @@ export declare function clampInt(value: number, min: number, max: number, fallba
44
44
  /** 目标的官方形状直接 re-export(`targetKey` 就此是官方 `FsTargetKey` 品牌,不再降级成 string)。 */
45
45
  export type { FsDirEntry, FsTarget } from "@deepseek-ai/dsh-fs";
46
46
  /**
47
- * 官方 `FileSystem`(installed @deepseek-ai/dsh-fs/lib/types/index.d.ts:61,cordis `Service`
48
- * 子类 → 名义比较)的方法面投影:本包用 `resolve`(:94) / `listDir`(:208) / `readText`(:162)
49
- * / `contains`(:173) / `stat`(:181)。旧镜像漏抄了官方那几位的可选 `signal?: AbortSignal`
47
+ * 官方 `FileSystem`(installed @deepseek-ai/dsh-fs/lib/types/index.d.ts,cordis `Service`
48
+ * 子类 → 名义比较)的方法面投影:本包用 `resolve` / `listDir` / `readText`
49
+ * / `contains` / `stat`。旧镜像漏抄了官方那几位的可选 `signal?: AbortSignal`
50
50
  * 形参(抄本里没有的形参在 TS 里是"少收一个参数",调用点不会报错,但真实宿主多一档取消
51
51
  * 语义);投影之后它回到官方形状。
52
52
  *
53
- * `stat`(installed index.d.ts:181-187,返回 `{version,type,size?}`)是**单文件导入**那条
53
+ * `stat`(installed `@deepseek-ai/dsh-fs/lib/types/index.d.ts`,返回 `{version,type,size?}`)是**单文件导入**那条
54
54
  * 路径唯一的字节上限来源:目录分支的每个候选都自带 `listDir` 给的 `size`,而单文件导入
55
55
  * 只有一个 `resolve` 出来的 target,不 stat 就无从判断该不该读——而官方 `readText`
56
56
  * 自述"读整份文本"、**没有任何上限**。缺了它,一个几 MB 的 .md 就能把整份读进宿主内存。
@@ -58,18 +58,18 @@ export type { FsDirEntry, FsTarget } from "@deepseek-ai/dsh-fs";
58
58
  export type FsService = Pick<FileSystem, "resolve" | "listDir" | "readText" | "contains" | "stat">;
59
59
  /**
60
60
  * 本包从会话消息史的读取面 = **官方 `Message` 的键名投影**(installed
61
- * @deepseek-ai/dsh-llm/lib/types/message.d.ts:124-133 `MessageBase` 与各变体的 `role`),
61
+ * @deepseek-ai/dsh-llm/lib/types/message.d.ts `MessageBase` 与各变体的 `role`),
62
62
  * 三位各自取到"本包能凭运行时守卫负责的那一档":
63
63
  * - `role` 就此是官方 `Message['role']` 的字面量联合(上游加/改角色即在此编译不过,
64
64
  * 下面 `role === "user" || role === "assistant"` 的判定跟着动)。
65
- * - `content` 官方是 `readonly ContentBlock[]`(message.d.ts:128),但本包的职责是
65
+ * - `content` 官方是 `readonly ContentBlock[]`(message.d.ts),但本包的职责是
66
66
  * **逐块自证**:只认 `type==='text'` 且 `text` 是字符串的块(`isTextBlock`),其余
67
67
  * (tool-call / reasoning / image / 宿主新版本才有的块)一律跳过。这里留 `unknown`
68
68
  * 不是"抹平官方形状",而是本包**不假设交付**:`Array.isArray(msg.content)` 那道判据
69
69
  * 断言的正是"交来的可能根本不是数组",test/host.test.ts 的「坏形状」用例钉的就是
70
70
  * 非数组 content(字符串)与数组里的裸字符串/null 项。把值域收成官方联合等于宣称
71
71
  * "块形状可信",那几条用例便无法表达,而为了过类型删用例是本仓红线。
72
- * - `source.kind` 官方是 `MessageSourceMap` 的值联合(installed message.d.ts:101-108 只有
72
+ * - `source.kind` 官方是 `MessageSourceMap` 的值联合(installed message.d.ts 只有
73
73
  * `user`/`model`/`tool`/`system-prompt`,宿主安装里另有 `model-selection` 一枚由
74
74
  * dsh-agent 自己 merge)。**本包要读的恰是这张表里没有的 kind**:真人过滤之外的
75
75
  * `agent-instructions` / `skill-catalog` / `memory-recall-step` / `plugin:<name>` 全是
@@ -88,10 +88,10 @@ export interface DerivedMessageView {
88
88
  }
89
89
  /**
90
90
  * 本包读到的会话面 = 官方 `Session` 两位成员的**边界投影**(installed
91
- * @deepseek-ai/dsh-session/lib/types/index.d.ts:`readonly header: SessionHeader` :150、
92
- * `deriveMessages(): Message[]` :347)。
91
+ * @deepseek-ai/dsh-session/lib/types/index.d.ts:`readonly header: SessionHeader`、
92
+ * `deriveMessages(): Message[]`)。
93
93
  * 键名一律借自官方(`header` 借 `Session`、`cwd` 借 `SessionHeader`,installed
94
- * @deepseek-ai/dsh-session 域内 types.d.ts:69 `readonly cwd?: string`),值域收成"本包真的读的那位
94
+ * @deepseek-ai/dsh-session 域内 types.d.ts `readonly cwd?: string`),值域收成"本包真的读的那位
95
95
  * + 可缺失":官方把 header/deriveMessages 记成必选成员,但那句承诺说的是宿主自己 `new`
96
96
  * 出来的 Session;跨进程递来的会话是否具备某位只能运行时判(见 `extractSessionConversation`
97
97
  * 的 `typeof session.deriveMessages !== "function"` 与 `cwdOfSession` 的 `typeof === "string"`
@@ -103,10 +103,10 @@ export interface SessionLike {
103
103
  }
104
104
  /**
105
105
  * `Context.sessions`(官方 `SessionStore`,installed @deepseek-ai/dsh-session/lib/types/
106
- * index.d.ts:26-28)的 `get` 一位(:491 `get(id: SessionId): Session | undefined`)在本包的
106
+ * index.d.ts)的 `get` 一位(`Sessions.get(id: SessionId)`)在本包的
107
107
  * 读法:入参就此是官方品牌的 `SessionId`(边界上递来的是裸 string,构造口只有文件头那枚
108
108
  * `brandString<SessionId>`),返回值域换成上面的 `SessionLike` 投影——直接取官方返回的整枚
109
- * `Session` 类会把名义类一路渗进本包(`private log`/`surfaceManager`,:137-139),那三道运行时
109
+ * `Session` 类会把名义类一路渗进本包(`private log`/`surfaceManager`),那三道运行时
110
110
  * 守卫当场在编译器眼里变成死代码,而它们挡的是真实输入。返回 `undefined` 与官方一致。
111
111
  * 口径同 danger-guard/host.ts 的 `GuardExecution`(借键名、值域换投影)。
112
112
  */
@@ -118,14 +118,20 @@ export interface SessionsService {
118
118
  * 键不同名即不同型,宿主真值塞不进来、任何带该属性的字符串反倒能通过,注释里那句
119
119
  * 「转换点为 0」并不成立。取官方类型后模型选择与 stream 入参两侧共用同一真值。 */
120
120
  export type { ReasoningEffortId } from "@deepseek-ai/dsh-llm";
121
- /** 默认模型选择直接取官方成员的返回形状(`AgentDefaultModelConfig.currentSelection()`
122
- * 的返回类型,installed @deepseek-ai/dsh-agent-default-model/lib/types/index.d.ts:42)。
123
- * 旧镜像自己抄了 `{ provider, model, reasoningEffort? }` 三位——其中 `reasoningEffort` 是
124
- * `ReasoningEffortId` 品牌(本文件上面已按官方 re-export),抄本一旦与官方漂开,
125
- * 品牌值塞不进 stream 入参就是静默丢字段。取 ReturnType 之后本包不再裁定它的形状。 */
126
- export type ModelSelection = ReturnType<AgentDefaultModelConfig["currentSelection"]>;
127
- /** 官方 `AgentDefaultModelConfig`(同文件 :24,cordis `Service` 子类 → 名义比较)的
128
- * 方法面投影:本包只 `currentSelection()`(:41),不写回(`saveSelection` :48 归 composer)。 */
121
+ /** 默认模型选择的三位形状:与官方 `ModelSelection`(`@deepseek-ai/dsh-agent` 的
122
+ * model-selection.d.ts)同形。`reasoningEffort` 用官方真品牌 `ReasoningEffortId`(上面已按
123
+ * dsh-llm 的 peer 面 re-export),品牌值塞不进 stream 入参的静默丢字段风险仍在类型面上。
124
+ *
125
+ * 为什么不直接 import/re-export 官方类型:那会在 `types/host.d.ts` 里留下裸说明符
126
+ * `@deepseek-ai/dsh-agent`,按本仓门禁它只能落进 peer 表,而本包运行期并不 import 它——
127
+ * 为此扩一条 peer 是发布契约变更,归用户裁决;在此之前用结构等价类型。 */
128
+ export interface ModelSelection {
129
+ readonly provider: string;
130
+ readonly model: string;
131
+ readonly reasoningEffort?: ReasoningEffortId;
132
+ }
133
+ /** 官方 `AgentDefaultModelConfig`(同文件,cordis `Service` 子类 → 名义比较)的
134
+ * 方法面投影:本包只 `currentSelection()`,不写回(`saveSelection` 归 composer)。 */
129
135
  export type AgentDefaultModel = Pick<AgentDefaultModelConfig, "currentSelection">;
130
136
  /** 文本块与 request-only user 输入均取官方声明:`TextBlock` 与 `RequestUserInput`
131
137
  * (后者的 `content` 真值是 `UserMessage["content"]` 全块集,`id`/`source` 是
@@ -134,13 +140,13 @@ export type { RequestUserInput, TextBlock } from "@deepseek-ai/dsh-llm";
134
140
  /** 流块与终态取官方判别联合(`switch (chunk.type)` 即收窄载荷,不再把 `type` 写成
135
141
  * 裸 `string` + 全可选成员)。 */
136
142
  export type { FinishReason, StreamChunk } from "@deepseek-ai/dsh-llm";
137
- /** stream 入参:官方 `GenerateOptions` 的本包用到的子集。此前这里在 `Pick` 之外**另加**
138
- * 了一枚 `signal?: AbortSignal`,注释写着"本包附加的取消位"——官方其实**就有**这一位
139
- * (installed @deepseek-ai/dsh-llm/lib/types/types.d.ts:519),另写一次等于凭空多出一个
140
- * 与官方并行的形状声明;现在连同 `signal` 一起 `Pick`,一处来源。 */
143
+ /** stream 入参:官方 `GenerateOptions` 的本包用到的子集。在 `Pick` 之外**另加**
144
+ * 一枚 `signal?: AbortSignal` 是不行的——官方本来**就有**这一位
145
+ * (installed @deepseek-ai/dsh-llm/lib/types/types.d.ts),另写一次等于凭空多出一个
146
+ * 与官方并行的形状声明;连同 `signal` 一起 `Pick`,一处来源。 */
141
147
  export type LlmStreamOptions = Pick<GenerateOptions, "provider" | "model" | "reasoningEffort" | "messages" | "system" | "signal">;
142
148
  /** 官方 `LlmRuntime`(`Context.llm` 的类型,installed @deepseek-ai/dsh-llm/lib/types/
143
- * index.d.ts:29-31)的方法面投影:本包只 `stream`。旧镜像把返回抄成
149
+ * index.d.ts)的方法面投影:本包只 `stream`。旧镜像把返回抄成
144
150
  * `AsyncIterable<StreamChunk>`——官方那一位的真实返回域由成员自己交出,重述一次就多一处
145
151
  * 会漂移的判决(`stream` 在 installed index.d.ts 上有数枚同名成员,本包用的是 runtime 那枚)。 */
146
152
  export type LlmService = Pick<LlmRuntime, "stream">;
@@ -152,15 +158,15 @@ export interface DirEntry {
152
158
  snippet: string | undefined;
153
159
  }
154
160
  /** 静默丢数据的记账(审计修复:原先"读失败即 undefined、超限即忽略"完全没有
155
- * 回执,界面与 host 都显示成功)。dir context 与 import 两端点共用此形状。 */
161
+ * 回执,界面与 host 都显示成功)。dir context 与 import 两个读面共用此形状。 */
156
162
  export interface SkipCounts {
157
163
  /** 字节超限、整份跳过的文件数。 */
158
164
  tooLarge: number;
159
165
  /** 读取失败(含 EMFILE / 权限 / 非 UTF-8)的文件数。 */
160
166
  unreadable: number;
161
- /** 只在更深一层、被扫描深度限制造漏掉的 .md 数(仅导入端点用)。 */
167
+ /** 只在更深一层、被扫描深度限制造漏掉的 .md 数(仅导入读面用)。 */
162
168
  deeper: number;
163
- /** 读到了但解析不出角色 name(非角色文件)而被跳过的文件数(仅导入端点用)。 */
169
+ /** 读到了但解析不出角色 name(非角色文件)而被跳过的文件数(仅导入读面用)。 */
164
170
  unnamed: number;
165
171
  /** 真实目标落在允许根之外(符号链接指向根外文件)而被策略排除的文件数。
166
172
  * 必须单列:它既不是读失败也不是超限,把「凭据文件被链接进工作目录」这类事
@@ -175,7 +181,7 @@ export interface CollectResult {
175
181
  skipped: SkipCounts;
176
182
  error?: string;
177
183
  }
178
- /** host 路由实际用的收集函数:fs 服务 → DirEntry[](含关键文件全文摘要)。
184
+ /** 读面实际用的收集函数:fs 服务 → DirEntry[](含关键文件全文摘要)。
179
185
  * 条目数不设上限(用户拍板),但单文件按 MAX_SNIPPET_BYTES 整份跳过、
180
186
  * 读取按 READ_CONCURRENCY 有界并发;跳过项计入 skipped 并让 truncated 反映事实。
181
187
  * 回执文案取自注入的字典(纯函数不读设置)。 */
@@ -187,16 +193,15 @@ export interface DirScanLimits {
187
193
  /** 单次收集的全部摘要的字节总量上限。 */
188
194
  maxTotalBytes?: number;
189
195
  }
190
- /** 路由层实际用的 limits 全集。 */
196
+ /** 读面实际用的 limits 全集。 */
191
197
  type RouteLimits = DirScanLimits & {
192
198
  organizeTimeoutMs: number;
193
- importBodyMaxBytes: number;
194
199
  };
195
200
  /**
196
- * 部署值的唯一收口:把会致命的几个数夹进安全区间,再交给路由。
201
+ * 部署值的唯一收口:把会致命的几个数夹进安全区间,再交给读面。
197
202
  *
198
- * 为什么放在这里而不是各消费点:`limitsOf()` 是全部五个路由读 limits 的**唯一入口**
199
- * (context/organize/importAgent 都经它),一处收口就不会漏掉将来新增的路由;而散在
203
+ * 为什么放在这里而不是各消费点:`limitsOf()` 是 context/organize/importTemplates
204
+ * 三个读面读 limits 的**唯一入口**,一处收口就不会漏掉将来新增的读面;而散在
200
205
  * 各消费点夹,哪天新增一个调用点就等于新增一个漏洞。
201
206
  *
202
207
  * 夹哪两个、为什么:
@@ -206,9 +211,9 @@ type RouteLimits = DirScanLimits & {
206
211
  * - `organizeTimeoutMs` → `[1, 2^31-1]`。上界超了会被 `setTimeout` 静默夹成 1 ms,
207
212
  * 「调大超时」变成「立刻失败」。
208
213
  *
209
- * 另外两个(`maxSnippetBytes`/`importBodyMaxBytes`)**故意不夹**:schema 已经挡住
210
- * NaN/±Infinity/负数/小数,唯一还能配出来的越界值 `0` 各自有确定且已记账的行为
211
- * (前者「全跳过且计 tooLarge」,后者「413」),那是用户的显式意图,不该被悄悄改写。
214
+ * 剩下 `maxSnippetBytes` **故意不夹**:schema 已经挡住 NaN/±Infinity/负数/小数,
215
+ * 唯一还能配出来的越界值 `0` 有确定且已记账的行为(全跳过并计 tooLarge),那是用户
216
+ * 的显式意图,不该被悄悄改写。
212
217
  *
213
218
  * @param limits - 未经夹位的部署值
214
219
  * @returns 两项关键值已夹位、其余原样透传的新对象
@@ -228,7 +233,7 @@ export declare function importPathError(requested: string, cwd: string | undefin
228
233
  * truncated 反映"确实有东西没进来",不再硬编码 false。
229
234
  * skipPolicy 用于内置角色库自检(AGENTS_DIR 是策略里的允许根,用户输入路径正常
230
235
  * 不需要它;保留这个开关只为让"内置全量导入"不依赖安装位置是否命中隐藏段判断)。
231
- * allowRoots = 设置 importAllowRoots 登记的额外允许目录(由路由注入)。 */
236
+ * allowRoots = 设置 importAllowRoots 登记的额外允许目录(由读面注入)。 */
232
237
  export declare function collectAgentTemplates(fs: Pick<FsService, "resolve" | "listDir" | "readText" | "contains" | "stat">, requested: string, cwd: string | undefined, messages: HostMessages, opts?: {
233
238
  skipPolicy?: boolean;
234
239
  allowRoots?: readonly string[];
@@ -278,7 +283,7 @@ export declare function buildOrganizeUser(prompt: string, input: Omit<OrganizeIn
278
283
  export declare function extractRecentTurns(messages: readonly DerivedMessageView[]): string;
279
284
  /** 流式聚合 text-delta 为完整文本;终态非 stop 视为失败(失败文本取自注入字典)。 */
280
285
  export declare function drainStreamToText(stream: AsyncIterable<StreamChunk>, messages: HostMessages): Promise<string>;
281
- /** 整理入口(host 路由调用;导出供测试注入假 stream)。失败文案与 system 提示都来自
286
+ /** 整理入口(读面调用;导出供测试注入假 stream)。失败文案与 system 提示都来自
282
287
  * 注入的字典,本函数不读设置。 */
283
288
  export declare function runOrganize(llm: LlmService, input: OrganizeInput, messages: HostMessages, timeoutMs?: number, callerSignal?: AbortSignal): Promise<{
284
289
  content: string;
@@ -286,10 +291,10 @@ export declare function runOrganize(llm: LlmService, input: OrganizeInput, messa
286
291
  /** settings 命名空间与 loader 行 config 共用同一 schema(单源,防漂移)。
287
292
  * 值名退避为 configSchema:避免与同名 interface Config 触发 no-redeclare;
288
293
  * 外部仍以 `Config` 名导入(export as),公开 API 不变。
289
- * 写入校验由 dsh-settings 在持久化前按此 schema 完成;两个字段都必须 `.volatile()`
294
+ * 写入校验由 dsh-settings 在持久化前按此 schema 完成;凡是要出现在卡上的字段都必须 `.volatile()`
290
295
  * ——没有任何 volatile 字段的条目会被宿主 describe() 整条跳过
291
- * (packages/settings/settings/src/index.ts:308-309),设置卡读不到、写入则抛
292
- * `has no volatile fields`(:386)。
296
+ * (packages/settings/settings/src/index.ts),设置卡读不到、写入则抛
297
+ * `has no volatile fields`。
293
298
  *
294
299
  * 旧 `settings.register(ns, Config, { base })` 的 base 底座取消,逐字段落到 `.default(...)`:
295
300
  * - importAllowRoots:`.default([])`。**空表是策略不是缺省占位**——登记目录是用户的
@@ -297,14 +302,14 @@ export declare function runOrganize(llm: LlmService, input: OrganizeInput, messa
297
302
  * 见 importPathError);
298
303
  * - templates:**标 volatile、不给默认**。内置精选集(scripts/gen-defaults.mjs 从
299
304
  * agents/ 角色库生成的 src/default-templates.generated.ts,~640 KB)由 **host 半**
300
- * 持有、经 default-templates 端点按需下发,client 拉到后作回落:⚠ 不给默认**不等于**读回 undefined——schemastery 对 array 字段把缺失
305
+ * 持有、经 `dirPrepOrganize.defaults` 方法按需下发,client 拉到后作回落:⚠ 不给默认**不等于**读回 undefined——schemastery 对 array 字段把缺失
301
306
  * 值 cast 成 `[]`(实测 `configSchema["~standard"].validate({})` 之后 `templates` 引用
302
- * `.get() === []`),宿主 describe() 又只丢 undefined 位(index.ts:141-147 projectForm),
307
+ * `.get() === []`),宿主 describe() 又只丢 undefined 位(`SettingsForms.projectForm`),
303
308
  * 所以「未设置」递到客户端看到的就是一张空表。回落判据因此落在 client 半
304
309
  * (client-entry.ts 的 `fromSettings`:空表按未设置处理),设置卡「恢复默认」=
305
310
  * `unset("templates")` 且复读空值按已回落处理,故「缺失」「空表」「内置」三者同义。
306
- * 写成 `.default(...)` 会让宿主每次 describe() 都重新序列化这 640 KB(index.ts:313 对
307
- * `JSON.stringify([uid, schema.toJSON(), entry.options.config])` 取指纹,schema.ts:24
311
+ * 写成 `.default(...)` 会让宿主每次 describe() 都重新序列化这 640 KB(index.ts 对
312
+ * `JSON.stringify([uid, schema.toJSON(), entry.options.config])` 取指纹,schema.ts
308
313
  * 的 plainSchema 保留 meta.default),所以内置集不进 schema、由 host 半端点按需下发;而既然空表就是
309
314
  * 「未设置」的运行时形状,回落判据仍由 client 半出。 */
310
315
  declare const configShape: {
@@ -327,7 +332,6 @@ declare const configShape: {
327
332
  organizeTimeoutMs: Schema<number, number, "volatile-defined">;
328
333
  maxSnippetBytes: Schema<number, number, "defined">;
329
334
  readConcurrency: Schema<number, number, "defined">;
330
- importBodyMaxBytes: Schema<number, number, "defined">;
331
335
  };
332
336
  declare const configSchema: ReturnType<typeof Schema.object<typeof configShape>>;
333
337
  /** cordis 校验过 configSchema 后交进 apply 的那份配置:volatile 字段以 Volatile 引用
@@ -344,24 +348,21 @@ export interface Config {
344
348
  maxSnippetBytes: number;
345
349
  /** 目录扫描/读取的有界并发度。 */
346
350
  readConcurrency: number;
347
- /** organize/import POST body 的物理字节上限(内存防爆纵深防御)。 */
348
- importBodyMaxBytes: number;
349
351
  }
350
352
  export { configSchema as Config };
351
353
  /** volatile 引用读出的值 → importAllowRoots 字符串列表(纯函数,测试锁死)。
352
354
  * 引用背后可能是存量脏配置:非数组一律空表(fail-closed),非字符串/纯空白项逐个
353
355
  * 丢弃——绝不能把非字符串塞进路径校验,也不能让空串变成"允许 process.cwd()"。 */
354
356
  export declare function importAllowRootsOf(raw: unknown): string[];
355
- /** 注入的服务面:webServer + settings 为硬依赖(cordis 等两者就绪才 apply)。
357
+ /** 注入的服务面:settings 为硬依赖(cordis 等它就绪才 apply)。
356
358
  * 0.1.7 起命名空间是隐式的(= 本条目在 cordis.patch.yml 里的裸 id,可编辑字段取自
357
359
  * 导出的 Config),所以 settings 不再是「注册的前提」而是「页面策略(configure)与
358
360
  * 跨命名空间读(describe)」的载体;设置页只派发「host 已 serve 的命名空间 ∩
359
361
  * settings.plugin.item 卡」(dsh-client-ui-settings-plugins 源码语义),configure 必须
360
362
  * 发生在 apply 期,故仍硬注入。sessions/fs/llm/agentDefaultModel 仍可选读。 */
361
363
  export declare const inject: string[];
362
- /** 路由处理器的可测提取:apply 用 ctx.get 的惰性 getter 调用(服务可能在
363
- * 路由注册后才就绪),测试直接注入静态假服务 + 假 req/res 驱动。
364
- * csrf 为 per-apply 令牌:context/model GET 下发,organize POST 回填校验。 */
364
+ /** 读面依赖的可测提取:apply 用 ctx.get 的惰性 getter 调用(服务可能在读面
365
+ * 注册后才就绪),测试可直接注入静态假服务。 */
365
366
  export interface RouteDeps {
366
367
  sessions?: () => SessionsService | undefined;
367
368
  fs?: () => FsService | undefined;
@@ -376,26 +377,56 @@ export interface RouteDeps {
376
377
  * 而不必去改磁盘上那份产物(它的 URL 一旦被加载过就进了 Node 的 ESM 缓存,改了也没用)。 */
377
378
  loadDefaultTemplates?: () => Promise<readonly TemplateEntry[]>;
378
379
  }
379
- /** 路由 handler 形状(本包自己的路由表投影)。官方 `WebRoute["handler"]` 的返回是
380
- * `void | Promise<void>`(installed `@deepseek-ai/dsh-host-webserver/lib/types/index.d.ts:40`),
381
- * dispatcher 侧写成 `await route.handler(req, res)`(installed lib/index.js:356)——
382
- * await 对同步返回同样成立,而外层 `handle` 本身是 async,故同步抛与 reject 在调用方
383
- * 观察上等价:**没有调用方依赖 handler 返回 promise**。于是投影按实现拆成两枚,
384
- * 让 createRouteHandlers 的返回值继续自证——确有 await 的三枚是 AsyncRouteHandler,
385
- * 纯同步的两枚是 SyncRouteHandler,不再为凑类型套假 async。 */
386
- export type SyncRouteHandler = (req: IncomingMessage, res: ServerResponse) => void;
387
- export type AsyncRouteHandler = (req: IncomingMessage, res: ServerResponse) => Promise<void>;
388
380
  /** 回执字典的现读 getter:每个请求取一次,用户在「设置 → 常规」改语言后下一个请求即
389
381
  * 切文案(不重启、不加插件自己的 locale 设置项;与 importAllowRoots 的现读同构)。 */
390
382
  export type MessagesOf = () => HostMessages;
391
- export declare function createRouteHandlers(deps: RouteDeps, csrf: string, messagesOf: MessagesOf, servingNonLoopback?: boolean): {
392
- defaults: AsyncRouteHandler;
393
- context: AsyncRouteHandler;
394
- model: SyncRouteHandler;
395
- organize: AsyncRouteHandler;
396
- importAgent: AsyncRouteHandler;
383
+ /** 读面每次调用的共享面:服务 getter 与现读文案/限额。 */
384
+ interface RemoteScope {
385
+ readonly deps: RouteDeps;
386
+ readonly messagesOf: MessagesOf;
387
+ readonly limitsOf: () => RouteLimits;
388
+ }
389
+ /** 五个读面的纯载荷入口(服务与测试共用):不含任何传输层判定。 */
390
+ export declare function createRemotePayloads(deps: RouteDeps, messagesOf: MessagesOf): {
391
+ defaults: () => Promise<Record<string, unknown>>;
392
+ context: (sessionId: string | null) => Promise<Record<string, unknown>>;
393
+ model: () => Record<string, unknown>;
394
+ organize: (parsed: unknown) => Promise<Record<string, unknown>>;
395
+ importTemplates: (parsed: unknown) => Promise<{
396
+ status: number;
397
+ body: Record<string, unknown>;
398
+ }>;
397
399
  };
398
- /** host apply:登记设置页策略 + 四个 webServer 路由(全在 effect 内,卸载即注销)。
400
+ /** 官方 Typert Remote 的服务键(= 线上命名空间)。 */
401
+ export declare const DIR_PREP_REMOTE_NAMESPACE = "dirPrepOrganize";
402
+ interface ContextRequest {
403
+ sessionId: string;
404
+ }
405
+ interface OrganizeRequest extends ContextRequest {
406
+ prompt: string;
407
+ entriesSummary: string;
408
+ roleText?: string;
409
+ }
410
+ interface ImportTemplatesRequest {
411
+ path: string;
412
+ sessionId: string;
413
+ }
414
+ /**
415
+ * 设置卡的宿主读面(官方 Typert Remote):目录上下文、当前模型、整理、导入与内置模板。
416
+ * 取代原先的五条 HTTP 端点(旧数据面已删除)。
417
+ */
418
+ export declare class DirPrepRemoteService extends TypertRemoteService {
419
+ private readonly scope;
420
+ constructor(ctx: Context, scope: RemoteScope);
421
+ defaults(): Promise<Record<string, unknown>>;
422
+ context(request: ContextRequest): Promise<Record<string, unknown>>;
423
+ model(request: ContextRequest): Record<string, unknown>;
424
+ organize(request: OrganizeRequest): Promise<Record<string, unknown>>;
425
+ importTemplates(request: ImportTemplatesRequest): Promise<Record<string, unknown>>;
426
+ }
427
+ /** 注册读面(构造即注册);替身上下文没有注册口时只少掉这一栏。 */
428
+ export declare function installDirPrepRemote(ctx: Context, scope: RemoteScope): boolean;
429
+ /** host apply:登记设置页策略 + 注册官方 Remote 读面(注入子上下文,卸载即撤)。
399
430
  * 0.1.7 起模板设置是**隐式注册**的(导出的 Config + 字段上的 .volatile()),本函数
400
431
  * 不再向 settings 注册任何东西;配置值由 cordis 校验并填过默认后按 volatile 引用交进来
401
432
  * (第二参数 config),读当前值一律 `.get()`。 */
@@ -6,6 +6,7 @@ import type { InputActions, InputState } from "@deepseek-ai/dsh-client-ui-conver
6
6
  import type { SlotRegistry } from "@deepseek-ai/dsh-client-ui-renderer/client";
7
7
  import type { LocaleDictOf } from "@deepseek-ai/dsh-client-ui-slots";
8
8
  import type { ConfigForm } from "@deepseek-ai/dsh-client-ui-settings/client";
9
+ import type { DirPrepReader } from "./remote.js";
9
10
  declare const NS: LocaleNs;
10
11
  export interface DirEntryView {
11
12
  name: string;
@@ -24,7 +25,6 @@ export interface ImportSkips {
24
25
  export interface ContextResponse {
25
26
  ok: boolean;
26
27
  error?: string;
27
- csrf?: string;
28
28
  cwd?: string;
29
29
  truncated?: boolean;
30
30
  entries?: DirEntryView[];
@@ -46,6 +46,8 @@ export interface BuiltinState {
46
46
  error: string;
47
47
  }
48
48
  export declare function builtinTemplatesSnapshot(): BuiltinState;
49
+ /** 导出仅供单测:不经过 apply 的纯读面用例直接注入替身。 */
50
+ export declare function setDirPrepReader(reader: DirPrepReader | undefined): void;
49
51
  export declare function loadBuiltinTemplates(): Promise<BuiltinState>;
50
52
  export declare function subscribeBuiltinTemplates(listener: () => void): () => void;
51
53
  export declare function resetBuiltinTemplates(): void;
@@ -80,6 +82,8 @@ export interface KitProps {
80
82
  }
81
83
  export interface ClientCtx {
82
84
  effect: Context["effect"];
85
+ /** 官方反射面:读面经 `get("remote")` 查出,不建立 inject 依赖(缺席只少一栏数据面)。 */
86
+ get: Context["get"];
83
87
  slots: Pick<SlotRegistry, "inject" | "register">;
84
88
  configForms: {
85
89
  get: (entryId: string) => EntryForm;
@@ -12,7 +12,7 @@ export declare const ORGANIZE_TIMEOUT_SLACK_MS = 5000;
12
12
  * `organizeTimeoutMs` 的前端取表。
13
13
  *
14
14
  * 上界与 host 同为 `[1, MAX_TIMER_MS]`:host 自己夹了上界正是为了躲开上面那个静默夹断,
15
- * 而这一侧是**唯一**发起 fetch 的地方,它要是没夹,host 夹得再对也没用。
15
+ * 而这一侧是**唯一**发起整理读面调用的地方,它要是没夹,host 夹得再对也没用。
16
16
  *
17
17
  * @param value - 配置表单投影值
18
18
  * @returns `[1, MAX_TIMER_MS]` 区间内的整数;不合法时 undefined(回落默认)
@@ -78,8 +78,6 @@ export interface HostMessages {
78
78
  readonly noModelSelected: string;
79
79
  /** 模型返回空白。 */
80
80
  readonly emptyOrganizeResult: string;
81
- /** 请求体读到了但不是 JSON。 */
82
- readonly invalidJsonBody: string;
83
81
  /** fs 服务未就绪。 */
84
82
  readonly fsUnavailable: string;
85
83
  /** sessions 里查不到该会话。 */
@@ -0,0 +1,27 @@
1
+ import type { InvocationDescriptor } from "@deepseek-ai/dsh-typert-protocol";
2
+ /** Typert Remote 命名空间。**单源**:错误文案与宿主侧注册都用这一枚,
3
+ * 写死两处会让"网关挂的是 A、报错说的是 B"这种漂移没有任何运行期信号。 */
4
+ export declare const DIR_PREP_NAMESPACE = "dirPrepOrganize";
5
+ export declare const DIR_PREP_DESCRIPTORS: readonly InvocationDescriptor[];
6
+ export interface DirPrepOrganizeArgs {
7
+ sessionId: string;
8
+ prompt: string;
9
+ entriesSummary: string;
10
+ roleText?: string;
11
+ }
12
+ export interface DirPrepReader {
13
+ defaults: () => Promise<unknown>;
14
+ context: (sessionId: string) => Promise<unknown>;
15
+ model: (sessionId: string) => Promise<unknown>;
16
+ organize: (args: DirPrepOrganizeArgs) => Promise<unknown>;
17
+ importTemplates: (args: {
18
+ path: string;
19
+ sessionId: string;
20
+ }) => Promise<unknown>;
21
+ }
22
+ interface RemoteHost {
23
+ get?: (name: string, strict?: boolean) => unknown;
24
+ }
25
+ /** 造读取器;当前部署没有远程面时 undefined(卡片只显示读不到)。 */
26
+ export declare function createDirPrepReader(ctx: RemoteHost): DirPrepReader | undefined;
27
+ export {};
@@ -15,8 +15,8 @@ export interface TemplateEntry {
15
15
  * scripts/gen-defaults-lib.mjs,键序 = 下拉分组展示序),本文件不再同名 re-export:
16
16
  * 实测同名两处导出正是 fallow `duplicate_export`(severity=error)报出来的那一条,
17
17
  * 而"两份名字保持同步"的纪律并不由 re-export 保证。表体仍是生成物;host 半引本文件的
18
- * groupLabelOf/parseAgentFrontmatter,精选集(现 640KB)也由 host 半引走、经
19
- * default-templates 端点按需下发,client 半不打包它。 */
18
+ * groupLabelOf/parseAgentFrontmatter,精选集(生成物)也由 host 半引走、经
19
+ * `dirPrepOrganize.defaults` 方法按需下发,client 半不打包它。 */
20
20
  /** 仓库目录名 → 分组标签(groupLabelOf(engineering) === "工程";未收录回落目录名)。
21
21
  * 必须只认**自有属性**:`AGENT_DIR_GROUP_LABELS["constructor"]` 会命中原型上的
22
22
  * function(`?? dirName` 不触发)→ TemplateEntry.group 拿到函数、JSON.stringify
@@ -56,8 +56,8 @@ export declare function condenseRoleBody(body: string): string;
56
56
  */
57
57
  export declare function mergeImportedTemplates(existing: readonly TemplateEntry[], incoming: readonly TemplateEntry[]): TemplateEntry[];
58
58
  /** 内置默认模板(独立开发者精选角色集,生成自插件内置 agents/ 目录)。
59
- * host 作为 settings base 下发;client 在快照缺 templates 字段时兜底使用
60
- * (不猜测快照是否合并 base,两种语义下行为都正确)。
59
+ * client 在快照缺 templates 字段时用它兜底;host 半的下发走 build-host.mjs 打出的
60
+ * templates.data.mjs(同一份生成物的另一产物),不再经 settings base 下发。
61
61
  * 全量角色可经设置页「导入角色」导入(路径留空 = 导入内置 agents/ 全部;显式路径
62
62
  * 受 host 的「cwd 内 + 内置角色目录 allowlist」策略约束)。 */
63
63
  export { DEFAULT_TEMPLATES } from "./default-templates.generated.js";
@@ -169,7 +169,7 @@ export interface UiMessages {
169
169
  }
170
170
  /**
171
171
  * 本包的文案命名空间 merge 进官方的 `LocaleNamespaceMap`(installed
172
- * `dsh-client-ui-slots/lib/types/index.d.ts:23`「Dictionary owners extend via declaration
172
+ * `dsh-client-ui-slots/lib/types/index.d.ts`「Dictionary owners extend via declaration
173
173
  * merging (exactly like SlotMap)」)。这不是美化:不 merge 时 `ctx.locale.bind(NS)` 只能
174
174
  * 落到官方那条**未类型化**重载(返回 `Translate<string>`),卡片要的窄键集 `t` 就无官方
175
175
  * 来源,本地只好手写一份同构签名(就是被这一段替换掉的旧版本)。
@@ -191,8 +191,8 @@ declare const LOCALE_NS_KEY: "dir-prep-organize";
191
191
  export type LocaleNs = typeof LOCALE_NS_KEY;
192
192
  /**
193
193
  * 卡片取文案的函数形状:官方 `TranslateNS<N> = Translate<LocaleKeysOf<N>>`(installed
194
- * `dsh-client-ui-slots/lib/types/index.d.ts:67`,而 `Translate<K> =
195
- * (key: K, params?: Record<string, unknown>) => string`,同文件 :45)。函数面归官方,
194
+ * `dsh-client-ui-slots/lib/types/index.d.ts`,而 `Translate<K> =
195
+ * (key: K, params?: Record<string, unknown>) => string`,同文件)。函数面归官方,
196
196
  * 键集就是上面 merge 的 `keyof UiMessages`(外加官方 `LocaleKeysOf` 一并放行的
197
197
  * `common` 命名空间键——那是宿主查不到键时的回落面,运行时行为见其 `lookup`)。
198
198
  */