dsh-plugin-om 0.0.43 → 0.0.45
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 +69 -82
- package/dist/client/OmConfigCard.d.ts +9 -0
- package/dist/client/OmConfigCard.d.ts.map +1 -0
- package/dist/client/index.d.ts +4 -7
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/locales.d.ts +42 -1
- package/dist/client/locales.d.ts.map +1 -1
- package/dist/client/om-config-controller.d.ts +77 -0
- package/dist/client/om-config-controller.d.ts.map +1 -0
- package/dist/client.js +301 -6
- package/dist/client.js.map +1 -1
- package/dist/compaction-log.d.ts +4 -4
- package/dist/compaction-log.d.ts.map +1 -1
- package/dist/compress-tools.d.ts +2 -2
- package/dist/compress-view.d.ts +4 -4
- package/dist/compress-view.d.ts.map +1 -1
- package/dist/config.d.ts +40 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/embedding.d.ts +2 -5
- package/dist/embedding.d.ts.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +189 -61
- package/dist/logger.d.ts +1 -1
- package/dist/logger.d.ts.map +1 -1
- package/package.json +62 -24
package/README.md
CHANGED
|
@@ -2,38 +2,37 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/dsh-plugin-om)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
为 DSH 提供 [Observational Memory](https://mastra.ai/research/observational-memory) 风格的上下文压缩和原文召回。
|
|
6
6
|
|
|
7
7
|
## 功能
|
|
8
8
|
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
- **降级警告行**:浏览器客户端把 om 警告会话事件渲染为可展开的警告行
|
|
9
|
+
- 自动压缩主会话历史,并在摘要过大时再次合并
|
|
10
|
+
- 通过工具循环生成摘要,保留用户消息、系统消息和未压缩内容
|
|
11
|
+
- 保留工具加载与手动加载的 skill 原文,并在压缩前再次确认
|
|
12
|
+
- 使用 `recall` 按消息序号回看原文,使用 `recall-semantic` 进行本地语义检索
|
|
13
|
+
- 记录压缩过程、耗时和 token 用量
|
|
14
|
+
- 压缩会话记录显示在子智能体列表,随父会话 Session 日志一起下载
|
|
15
|
+
- 在浏览器中显示压缩结果、错误和降级警告
|
|
17
16
|
|
|
18
|
-
##
|
|
17
|
+
## 安装
|
|
19
18
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
## 安装与启用
|
|
23
|
-
|
|
24
|
-
本插件适配 dsh 0.1.7-rc.2 及以上版本(客户端压缩卡片依赖宿主 `uiConversation` 服务)。`$DSH_HOME` 缺省为 `~/.dsh`,profile 描述 dsh 进程的启动模式。
|
|
19
|
+
要求 DSH 0.2.0-rc.2 或更高版本。
|
|
25
20
|
|
|
26
21
|
```sh
|
|
27
22
|
dsh plugin --profile <profile> add dsh-plugin-om
|
|
28
23
|
```
|
|
29
24
|
|
|
30
|
-
|
|
25
|
+
重启 DSH 后检查配置:
|
|
31
26
|
|
|
32
|
-
|
|
27
|
+
```sh
|
|
28
|
+
dsh --profile <profile> --dump-config
|
|
29
|
+
```
|
|
33
30
|
|
|
34
|
-
|
|
31
|
+
pnpm 11 安装失败时,在 profile 的 `pnpm-workspace.yaml` 中设置 `allowBuilds: true`,或允许 `onnxruntime-node`、`protobufjs` 和 `sharp` 构建。
|
|
35
32
|
|
|
36
|
-
|
|
33
|
+
## 配置
|
|
34
|
+
|
|
35
|
+
在 WebUI 插件侧边栏打开 `dsh-plugin-om` 行配置页,或编辑 `$DSH_HOME/profiles/<profile>/cordis.patch.yml`。配置支持热更新,`$DSH_HOME` 默认为 `~/.dsh`。
|
|
37
36
|
|
|
38
37
|
```yaml
|
|
39
38
|
- id: dsh-plugin-om
|
|
@@ -41,9 +40,30 @@ dsh plugin --profile <profile> add dsh-plugin-om
|
|
|
41
40
|
observeThresholdTokens: 35000
|
|
42
41
|
```
|
|
43
42
|
|
|
44
|
-
|
|
43
|
+
| 配置项 | 默认值 | 说明 |
|
|
44
|
+
| --- | --- | --- |
|
|
45
|
+
| `observeThresholdTokens` | `35000` | 观察压缩阈值 |
|
|
46
|
+
| `reflectThresholdTokens` | `40000` | 摘要合并阈值 |
|
|
47
|
+
| `tailMessageCount` | `20` | 触发后保留的完整消息数 |
|
|
48
|
+
| `compressMaxTokens` | 模型默认值 | 单轮生成上限 |
|
|
49
|
+
| `compressProvider` | 会话路由 | 压缩 provider,需与 `compressModel` 同时配置 |
|
|
50
|
+
| `compressModel` | 会话路由 | 压缩模型,需与 `compressProvider` 同时配置 |
|
|
51
|
+
| `compressReasoningEffort` | 模型默认值 | 思考等级 |
|
|
52
|
+
| `compressSkipReasoning` | `true` | 是否忽略 reasoning |
|
|
53
|
+
| `rateLimitWaitMs` | `60000` | 429 后的等待毫秒数,`0` 表示不等待 |
|
|
54
|
+
| `modelDir` | DSH 共享目录 | 嵌入模型目录 |
|
|
55
|
+
| `omEnabled` | `true` | 是否启用自动压缩 |
|
|
56
|
+
| `recallEnabled` | `true` | 是否启用原文召回 |
|
|
57
|
+
| `semanticRecallEnabled` | `true` | 是否启用语义召回 |
|
|
58
|
+
| `debug` | 开发环境启用 | 是否输出步骤日志 |
|
|
59
|
+
|
|
60
|
+
较小的观察阈值更早节省上下文,较大的阈值提供更多摘要信息。只有 reasoning 包含关键决策时才需将 `compressSkipReasoning` 设为 `false`。
|
|
45
61
|
|
|
46
|
-
|
|
62
|
+
[机制说明与成本计算器](https://fanethedivine.github.io/dsh-plugin-om/)可估算不同配置的 token 成本。
|
|
63
|
+
|
|
64
|
+
## 开发
|
|
65
|
+
|
|
66
|
+
运行 `pnpm dev` 自动构建,并在 `cordis.patch.yml` 中加载本地 bundle:
|
|
47
67
|
|
|
48
68
|
```yaml
|
|
49
69
|
- insert:
|
|
@@ -51,54 +71,19 @@ dsh plugin --profile <profile> add dsh-plugin-om
|
|
|
51
71
|
name: file:///<repo>/dist/index.mjs
|
|
52
72
|
```
|
|
53
73
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
preset-agent 自带 compaction-basic 压缩,阈值为上下文窗口的 80%,一般先用 om 进行压缩。
|
|
57
|
-
|
|
58
|
-
## 插件配置项
|
|
59
|
-
|
|
60
|
-
| 键 | 默认 | 含义 |
|
|
61
|
-
| --- | --- | --- |
|
|
62
|
-
| `observeThresholdTokens` | `35000` | 净压力达到该值时触发观察压缩 |
|
|
63
|
-
| `reflectThresholdTokens` | `40000` | 全部 `<history>` 块 token 合计达到该值时触发反思合并 |
|
|
64
|
-
| `compressMaxTokens` | 不设置 | 压缩循环单轮生成上限,不设置时由模型适配器默认值决定 |
|
|
65
|
-
| `compressProvider` | 不设置 | 压缩请求的 provider,与 `compressModel` 成对配置才生效,只配置其一回落会话路由,成对配置后未路由会话也会执行压缩 |
|
|
66
|
-
| `compressModel` | 不设置 | 压缩请求的模型,与 `compressProvider` 成对配置才生效 |
|
|
67
|
-
| `compressReasoningEffort` | 不设置 | 压缩请求的思考等级,需为目标模型支持的等级,不设置时用模型默认;配置值不被目标模型支持时降级为模型默认并输出 `reasoning-effort-unavailable` 警告(每会话一次) |
|
|
68
|
-
| `rateLimitWaitMs` | `60000` | 遇 429 限流后下一次压缩请求前的等待毫秒数,`0` 不限流 |
|
|
69
|
-
| `tailMessageCount` | `20` | 观察触发后等待新增完整消息达到该条数才执行压缩,`0` 表示触发当轮立即执行 |
|
|
70
|
-
| `compressSkipReasoning` | `true` | 工具循环 getHistory 输出是否携带 `<reasoning>` 参考条目,`true` 时不携带,压缩指令同步省略对应说明 |
|
|
71
|
-
| `modelDir` | 共享目录 | recall-semantic 嵌入模型目录,默认 `$DSH_HOME/plugin-data/dsh-plugin-om/models/<id>`,onnx 缺失且启用语义召回时运行时自动下载 |
|
|
72
|
-
| `omEnabled` | `true` | 是否启用自动压缩,关闭后 recall 工具不受影响 |
|
|
73
|
-
| `debug` | dev | 步骤级日志开关,缺省按 `NODE_ENV` 非 production 判定,压缩结果与失败日志始终输出 |
|
|
74
|
-
| `recallEnabled` | `true` | 是否注册 `recall` 工具 |
|
|
75
|
-
| `semanticRecallEnabled` | `true` | 是否注册 `recall-semantic` 工具,关闭时不触发模型下载 |
|
|
76
|
-
|
|
77
|
-
> 检测到未压缩消息到达观察阈值后,插件会等待至少 tailMessageCount 后再压缩之前的消息,因此这个配置可以影响首次压缩的时机,也可以保留更多的会话信息。
|
|
78
|
-
|
|
79
|
-
合理设置 `observeThresholdTokens` 和 `compressSkipReasoning`:
|
|
80
|
-
- 若模型 reasoning 输出质量差且会把关键结论以 text 形式输出(例如glm和deepseek),无需携带reasoning
|
|
81
|
-
- 若使用 openai/responses 或 anthropic/messages API,reasoning 内容包含大量决策信息,建议携带reasoning
|
|
82
|
-
- 若观察阈值太小,涵盖信息不足以形成逻辑链路,应当让观察阈值覆盖多个 text/reasoning
|
|
83
|
-
- 若观察阈值太大摘要质量也会降低,大幅增加单次观察的耗时,且越早 OM 收益越高
|
|
84
|
-
|
|
85
|
-
> 想直观理解机制并估算不同参数下的 token 成本,可打开交互式[机制说明与成本计算器](https://fanethedivine.github.io/dsh-plugin-om/)。
|
|
86
|
-
|
|
87
|
-
## npm 命令
|
|
74
|
+
语义召回首次使用时自动下载嵌入模型,也可运行 `pnpm run download:model` 预下载。
|
|
88
75
|
|
|
89
76
|
| 命令 | 作用 |
|
|
90
77
|
| --- | --- |
|
|
91
|
-
| `pnpm
|
|
92
|
-
| `pnpm
|
|
93
|
-
| `pnpm
|
|
94
|
-
| `pnpm
|
|
95
|
-
| `pnpm run
|
|
96
|
-
| `pnpm build` / `pnpm dev` | 构建 / 自动打包 |
|
|
97
|
-
| `pnpm run release` | check → CHANGELOG 归档 → 版本号更新 → 打 tag 推送 |
|
|
78
|
+
| `pnpm dev` | 监听并构建 |
|
|
79
|
+
| `pnpm check` | 检查类型、lint、测试和构建 |
|
|
80
|
+
| `pnpm test` | 运行测试 |
|
|
81
|
+
| `pnpm run download:model` | 预下载嵌入模型 |
|
|
82
|
+
| `pnpm run release` | 检查并发布新版本 |
|
|
98
83
|
|
|
99
84
|
## 文件地图
|
|
100
85
|
|
|
101
|
-
```
|
|
86
|
+
```text
|
|
102
87
|
cordis.patch.yml # bundle patch,dsh plugin add 后作为组合层插入插件行
|
|
103
88
|
src/
|
|
104
89
|
├── index.ts # 打包入口:注册 recall 工具并接线 pre-step 自动压缩
|
|
@@ -113,29 +98,31 @@ src/
|
|
|
113
98
|
├── rate-limit.ts # 全局 429 限流冷却门,进程级共享状态
|
|
114
99
|
├── log-index.ts # 完整消息索引与渲染,recall 与压缩共用同一套编号
|
|
115
100
|
├── recall.ts # recall 工具:按完整消息 index 区间回看
|
|
116
|
-
├── recall-xml.ts # 完整消息到 CDATA 包裹 XML
|
|
101
|
+
├── recall-xml.ts # 完整消息到 CDATA 包裹 XML 条目的渲染,recall 系工具共用
|
|
117
102
|
├── recall-output.ts # recall 输出契约:{ text, images } 与 render 投影
|
|
118
103
|
├── semantic-recall.ts # recall-semantic 工具:本地嵌入语义检索
|
|
119
104
|
├── embedding.ts # 本地 ONNX 嵌入:懒加载、批量、运行时按需下载编排
|
|
120
105
|
├── model-download.ts # 模型下载原语:URL、跳过判定、原子落盘
|
|
121
106
|
├── compress-view.ts # 压缩视图:观察与反思区间到统一条目序列的投影与渲染
|
|
122
107
|
├── compress-tools.ts # 压缩工具状态机:getHistory/compressHistory/completeCompression 与最终块构建
|
|
123
|
-
├── compress-loop.ts #
|
|
124
|
-
├── compaction-log.ts #
|
|
125
|
-
├── compress.ts #
|
|
126
|
-
└── client/ # 浏览器客户端 bundle
|
|
127
|
-
├── index.ts #
|
|
128
|
-
├──
|
|
129
|
-
├──
|
|
130
|
-
├──
|
|
131
|
-
├──
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
108
|
+
├── compress-loop.ts # 工具压缩循环:多轮请求、工具执行、限流、失败判定与统计
|
|
109
|
+
├── compaction-log.ts # 压缩会话记录落盘:循环对话消息组与压缩统计子会话
|
|
110
|
+
├── compress.ts # 两级自动压缩:观察、反思、失败传播与生命周期事件
|
|
111
|
+
└── client/ # 浏览器客户端 bundle:压缩卡片与插件行配置
|
|
112
|
+
├── index.ts # 注册卡片、渲染器与行配置槽
|
|
113
|
+
├── om-config-controller.ts # 宿主配置表单、草稿和原子保存
|
|
114
|
+
├── OmConfigCard.tsx # 十四项双语配置控件
|
|
115
|
+
├── definition.ts # 压缩卡片定义:生命周期事件、检查点替换与警告事件
|
|
116
|
+
├── OmCompactionCard.tsx # 压缩结果与错误卡片
|
|
117
|
+
├── OmWarningCard.tsx # 功能降级警告行
|
|
118
|
+
├── format.ts # 统计数字紧凑格式化
|
|
119
|
+
└── locales.ts # 中英文文案
|
|
120
|
+
models/ # 嵌入模型目录
|
|
121
|
+
scripts/ # 下载和发布脚本
|
|
122
|
+
tests/ # 服务端、客户端与集成测试
|
|
123
|
+
web/ # 机制说明与成本计算器站点
|
|
124
|
+
├── src/model.ts # 成本模型
|
|
125
|
+
└── src/components/ # 页面组件与 UI 原语
|
|
126
|
+
.agents/skills/agent-workflow/SKILL.md # 仓库开发工作流
|
|
127
|
+
.github/workflows/web-deploy.yml # GitHub Pages 部署工作流
|
|
141
128
|
```
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** WebUI 行配置页:双语说明及真实可编辑的整数、字符串、布尔控件。 */
|
|
2
|
+
import type { InjectFace, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots';
|
|
3
|
+
import type { NS } from './locales.ts';
|
|
4
|
+
import { type OmConfigCardFace } from './om-config-controller.ts';
|
|
5
|
+
/** 插件管理器注入的配置页 props。 */
|
|
6
|
+
export type OmConfigCardProps = PropsRuntime<'plugins.row.config'> & PropsLocale<typeof NS> & InjectFace<OmConfigCardFace>;
|
|
7
|
+
/** 配置行内容:说明、草稿值及继承/覆盖标记。 */
|
|
8
|
+
export declare function OmConfigCard(props: OmConfigCardProps): string | React.JSX.Element;
|
|
9
|
+
//# sourceMappingURL=OmConfigCard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OmConfigCard.d.ts","sourceRoot":"","sources":["../../src/client/OmConfigCard.tsx"],"names":[],"mappings":"AAAA,yCAAyC;AAIzC,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAC9F,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAoB,KAAK,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAEpF,yBAAyB;AACzB,MAAM,MAAM,iBAAiB,GAAG,YAAY,CAAC,oBAAoB,CAAC,GAChE,WAAW,CAAC,OAAO,EAAE,CAAC,GACtB,UAAU,CAAC,gBAAgB,CAAC,CAAC;AAE/B,4BAA4B;AAC5B,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAqEjF"}
|
package/dist/client/index.d.ts
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* 识别内置 'compact' 检查点,插件自产的压缩检查点(source.kind = 'plugin:dsh-plugin-om')
|
|
5
|
-
* 由本 bundle 认领并在消息列表渲染「已压缩」卡片;om 警告信封事件(借用
|
|
6
|
-
* feedback/record)渲染为「功能降级」警告行。
|
|
2
|
+
* 浏览器客户端入口:注册压缩卡片、功能降级警告及 WebUI 插件行配置页。
|
|
3
|
+
* 配置页只在宿主提供 dsh-plugin-om 命名空间时挂载,并随客户端释放订阅。
|
|
7
4
|
*/
|
|
8
5
|
import type { Context } from '@deepseek-ai/cordis';
|
|
9
|
-
/**
|
|
6
|
+
/** 必需服务:聊天节点槽、会话定义、双语 locale 与宿主配置表单。 */
|
|
10
7
|
export declare const inject: string[];
|
|
11
|
-
/**
|
|
8
|
+
/** 挂载压缩卡片、警告行和可配置的插件行。 */
|
|
12
9
|
export declare function apply(ctx: Context): void;
|
|
13
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAkBnD,yCAAyC;AACzC,eAAO,MAAM,MAAM,UAAuD,CAAC;AAE3E,0BAA0B;AAC1B,wBAAgB,KAAK,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CA4CxC"}
|
package/dist/client/locales.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `om-compaction` namespace
|
|
2
|
+
* `om-compaction` namespace 字典:压缩卡片、降级警告与插件行配置页的中英文文案。
|
|
3
3
|
* 导出 NS / zh / en;zh 为键集事实源,en 键集与 zh 一致。
|
|
4
4
|
*/
|
|
5
5
|
/** Dictionary namespace owned by this plugin. */
|
|
@@ -18,6 +18,47 @@ export declare const zh: {
|
|
|
18
18
|
readonly 'compaction.failed.observe': "上下文压缩失败(观察)";
|
|
19
19
|
readonly 'compaction.failed.reflect': "上下文压缩失败(反思)";
|
|
20
20
|
readonly warning: "上下文压缩功能降级";
|
|
21
|
+
readonly 'config.description': "配置上下文压缩与原文召回。";
|
|
22
|
+
readonly 'config.loading': "正在加载配置…";
|
|
23
|
+
readonly 'config.unavailable': "插件当前不可用,无法配置。";
|
|
24
|
+
readonly 'config.readOnly': "本部署的配置只读。";
|
|
25
|
+
readonly 'config.saveFailed': "保存失败,修改已保留,请检查配置或重试。";
|
|
26
|
+
readonly 'config.versionConflict': "配置已被其他页面修改,请重新加载后再保存。";
|
|
27
|
+
readonly 'config.save': "保存修改";
|
|
28
|
+
readonly 'config.discard': "撤销修改";
|
|
29
|
+
readonly 'config.saving': "保存中…";
|
|
30
|
+
readonly 'config.overridden': "已覆盖";
|
|
31
|
+
readonly 'config.inherited': "继承默认";
|
|
32
|
+
readonly 'config.reset': "恢复默认";
|
|
33
|
+
readonly 'config.invalidInteger': "请输入整数;留空使用默认值。";
|
|
34
|
+
readonly 'config.observeThresholdTokens': "观察阈值";
|
|
35
|
+
readonly 'config.observeThresholdTokens.hint': "上下文压力达到此 token 数时触发观察压缩。";
|
|
36
|
+
readonly 'config.reflectThresholdTokens': "摘要合并阈值";
|
|
37
|
+
readonly 'config.reflectThresholdTokens.hint': "摘要累计达到此 token 数时触发反思合并。";
|
|
38
|
+
readonly 'config.tailMessageCount': "保留消息数";
|
|
39
|
+
readonly 'config.tailMessageCount.hint': "触发观察后保留的完整消息条数。";
|
|
40
|
+
readonly 'config.compressMaxTokens': "单次生成上限";
|
|
41
|
+
readonly 'config.compressMaxTokens.hint': "压缩请求的最大生成 token 数;留空使用模型默认值。";
|
|
42
|
+
readonly 'config.compressProvider': "压缩 Provider";
|
|
43
|
+
readonly 'config.compressProvider.hint': "与压缩模型同时设置;留空使用会话路由。";
|
|
44
|
+
readonly 'config.compressModel': "压缩模型";
|
|
45
|
+
readonly 'config.compressModel.hint': "与压缩 Provider 同时设置;留空使用会话路由。";
|
|
46
|
+
readonly 'config.compressReasoningEffort': "思考等级";
|
|
47
|
+
readonly 'config.compressReasoningEffort.hint': "压缩请求的思考等级;留空使用模型默认值。";
|
|
48
|
+
readonly 'config.compressSkipReasoning': "忽略思考内容";
|
|
49
|
+
readonly 'config.compressSkipReasoning.hint': "压缩时不将历史 reasoning 纳入参考。";
|
|
50
|
+
readonly 'config.rateLimitWaitMs': "限流等待毫秒数";
|
|
51
|
+
readonly 'config.rateLimitWaitMs.hint': "429 限流后的冷却时间;0 表示不等待。";
|
|
52
|
+
readonly 'config.modelDir': "嵌入模型目录";
|
|
53
|
+
readonly 'config.modelDir.hint': "本地语义召回使用的嵌入模型目录。";
|
|
54
|
+
readonly 'config.omEnabled': "自动压缩";
|
|
55
|
+
readonly 'config.omEnabled.hint': "启用观察压缩和摘要反思合并。";
|
|
56
|
+
readonly 'config.recallEnabled': "原文召回";
|
|
57
|
+
readonly 'config.recallEnabled.hint': "注册按消息序号召回原文的工具。";
|
|
58
|
+
readonly 'config.semanticRecallEnabled': "语义召回";
|
|
59
|
+
readonly 'config.semanticRecallEnabled.hint': "注册本地语义检索工具。";
|
|
60
|
+
readonly 'config.debug': "步骤日志";
|
|
61
|
+
readonly 'config.debug.hint': "启用步骤级日志;缺省值由 NODE_ENV 决定。";
|
|
21
62
|
};
|
|
22
63
|
/** English dictionary(键集与 zh 一致)。 */
|
|
23
64
|
export declare const en: Record<keyof typeof zh, string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"locales.d.ts","sourceRoot":"","sources":["../../src/client/locales.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,iDAAiD;AACjD,eAAO,MAAM,EAAE,kBAAkB,CAAC;AAElC,mEAAmE;AACnE,eAAO,MAAM,EAAE
|
|
1
|
+
{"version":3,"file":"locales.d.ts","sourceRoot":"","sources":["../../src/client/locales.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,iDAAiD;AACjD,eAAO,MAAM,EAAE,kBAAkB,CAAC;AAElC,mEAAmE;AACnE,eAAO,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuDL,CAAC;AAEX,qCAAqC;AACrC,eAAO,MAAM,EAAE,EAAE,MAAM,CAAC,MAAM,OAAO,EAAE,EAAE,MAAM,CAyD9C,CAAC;AAEF,OAAO,QAAQ,kCAAkC,CAAC;IAChD,UAAU,kBAAkB;QAC1B,mDAAmD;QACnD,eAAe,EAAE,MAAM,OAAO,EAAE,CAAC;KAClC;CACF"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/** WebUI 行配置表单:严格整数/布尔解析与 14 项草稿的宿主原子提交。 */
|
|
2
|
+
import type { SnapshotStore } from '@deepseek-ai/dsh-client-store';
|
|
3
|
+
import { type SettingsFieldState, type SettingsFormActions, type SettingsFormScope, type SettingsFormShell } from '@deepseek-ai/dsh-client-ui-primitives';
|
|
4
|
+
import type { PluginConfig } from '../config.ts';
|
|
5
|
+
/** 由宿主提供的插件条目配置命名空间。 */
|
|
6
|
+
export declare const CONFIG_NS = "dsh-plugin-om";
|
|
7
|
+
/** 完整表单字段及控件类别。 */
|
|
8
|
+
export declare const OM_CONFIG_FIELDS: readonly [{
|
|
9
|
+
readonly name: "observeThresholdTokens";
|
|
10
|
+
readonly kind: "integer";
|
|
11
|
+
}, {
|
|
12
|
+
readonly name: "reflectThresholdTokens";
|
|
13
|
+
readonly kind: "integer";
|
|
14
|
+
}, {
|
|
15
|
+
readonly name: "tailMessageCount";
|
|
16
|
+
readonly kind: "integer";
|
|
17
|
+
}, {
|
|
18
|
+
readonly name: "compressMaxTokens";
|
|
19
|
+
readonly kind: "integer";
|
|
20
|
+
}, {
|
|
21
|
+
readonly name: "compressProvider";
|
|
22
|
+
readonly kind: "text";
|
|
23
|
+
}, {
|
|
24
|
+
readonly name: "compressModel";
|
|
25
|
+
readonly kind: "text";
|
|
26
|
+
}, {
|
|
27
|
+
readonly name: "compressReasoningEffort";
|
|
28
|
+
readonly kind: "text";
|
|
29
|
+
}, {
|
|
30
|
+
readonly name: "compressSkipReasoning";
|
|
31
|
+
readonly kind: "boolean";
|
|
32
|
+
}, {
|
|
33
|
+
readonly name: "rateLimitWaitMs";
|
|
34
|
+
readonly kind: "integer";
|
|
35
|
+
}, {
|
|
36
|
+
readonly name: "modelDir";
|
|
37
|
+
readonly kind: "text";
|
|
38
|
+
}, {
|
|
39
|
+
readonly name: "omEnabled";
|
|
40
|
+
readonly kind: "boolean";
|
|
41
|
+
}, {
|
|
42
|
+
readonly name: "recallEnabled";
|
|
43
|
+
readonly kind: "boolean";
|
|
44
|
+
}, {
|
|
45
|
+
readonly name: "semanticRecallEnabled";
|
|
46
|
+
readonly kind: "boolean";
|
|
47
|
+
}, {
|
|
48
|
+
readonly name: "debug";
|
|
49
|
+
readonly kind: "boolean";
|
|
50
|
+
}];
|
|
51
|
+
/** 一次订阅中投影宿主状态及所有草稿。 */
|
|
52
|
+
export interface OmConfigCardState extends SettingsFormShell {
|
|
53
|
+
status: 'loading' | 'ready' | 'unavailable';
|
|
54
|
+
conflict: boolean;
|
|
55
|
+
fields: Record<keyof PluginConfig, SettingsFieldState>;
|
|
56
|
+
}
|
|
57
|
+
/** 行配置槽注入的表单操作及响应式快照。 */
|
|
58
|
+
export interface OmConfigCardFace extends SettingsFormActions {
|
|
59
|
+
hooks: {
|
|
60
|
+
omConfigCard: SnapshotStore<OmConfigCardState>;
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
/** 在插件客户端生命周期内托管表单订阅。 */
|
|
64
|
+
export declare class OmConfigController {
|
|
65
|
+
private readonly scope;
|
|
66
|
+
private readonly form;
|
|
67
|
+
private readonly store;
|
|
68
|
+
private conflict;
|
|
69
|
+
constructor(scope: SettingsFormScope<Partial<PluginConfig>>);
|
|
70
|
+
/** 从模型投影唯一一份字段及加载状态。 */
|
|
71
|
+
private projection;
|
|
72
|
+
/** 供行槽注册器向 React 注入表单操作。 */
|
|
73
|
+
inject(): OmConfigCardFace;
|
|
74
|
+
/** 释放宿主快照订阅。 */
|
|
75
|
+
dispose(): void;
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=om-config-controller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"om-config-controller.d.ts","sourceRoot":"","sources":["../../src/client/om-config-controller.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EAExB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EAEvB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,wBAAwB;AACxB,eAAO,MAAM,SAAS,kBAAkB,CAAC;AAEzC,mBAAmB;AACnB,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkB3B,CAAC;AAoCH,wBAAwB;AACxB,MAAM,WAAW,iBAAkB,SAAQ,iBAAiB;IAC1D,MAAM,EAAE,SAAS,GAAG,OAAO,GAAG,aAAa,CAAC;IAC5C,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC,MAAM,YAAY,EAAE,kBAAkB,CAAC,CAAC;CACxD;AAED,yBAAyB;AACzB,MAAM,WAAW,gBAAiB,SAAQ,mBAAmB;IAC3D,KAAK,EAAE;QAAE,YAAY,EAAE,aAAa,CAAC,iBAAiB,CAAC,CAAA;KAAE,CAAC;CAC3D;AAED,yBAAyB;AACzB,qBAAa,kBAAkB;IAKjB,OAAO,CAAC,QAAQ,CAAC,KAAK;IAJlC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAA2C;IAChE,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAmC;IACzD,OAAO,CAAC,QAAQ,CAAS;gBAEI,KAAK,EAAE,iBAAiB,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IAgB5E,wBAAwB;IACxB,OAAO,CAAC,UAAU;IAWlB,4BAA4B;IAC5B,MAAM,IAAI,gBAAgB;IAI1B,gBAAgB;IAChB,OAAO,IAAI,IAAI;CAGhB"}
|