dsh-thinking-levels 0.3.0 → 0.4.0
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 +42 -19
- package/README.zh.md +42 -19
- package/lib/client.js +1 -0
- package/lib/client.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +27 -2
- package/package.json +2 -6
package/README.md
CHANGED
|
@@ -1,26 +1,36 @@
|
|
|
1
1
|
# dsh-thinking-levels
|
|
2
2
|
|
|
3
|
-
**Per-round thinking-level (`reasoning_effort`) control for [DeepSeek Harness (dsh)](https://github.com/deepseek-ai/deepseek-harness):
|
|
3
|
+
**Per-round thinking-level (`reasoning_effort`) control for [DeepSeek Harness (dsh)](https://github.com/deepseek-ai/deepseek-harness): pick `Auto` (a mask) in the session model selector and the plugin schedules `low` / `high` / `max` from the recent tool-call history before submitting the API effort — or fix a wire level (`off` / `low` / `high` / `max`) manually. Cheap tool rounds stay cheap; heavy work never starves.**
|
|
4
4
|
|
|
5
5
|
[中文文档](./README.zh.md) · English
|
|
6
6
|
|
|
7
|
-
In a multi-step tool chain, the model re-thinks before **every** tool call — and that thinking dominates the wall-clock time (a 50-step agent task can spend minutes reasoning between tools). `dsh-thinking-levels` plugs into the `agent/request` waterfall that dsh re-resolves for every step
|
|
7
|
+
In a multi-step tool chain, the model re-thinks before **every** tool call — and that thinking dominates the wall-clock time (a 50-step agent task can spend minutes reasoning between tools). `dsh-thinking-levels` plugs into the `agent/request` waterfall that dsh re-resolves for every step (registered with `prepend` so the session model-selection assembly cannot overwrite its decision) and injects a thinking level into the next model request.
|
|
8
8
|
|
|
9
9
|
## Levels
|
|
10
10
|
|
|
11
|
-
| Level | Meaning |
|
|
12
|
-
|
|
13
|
-
| `off` | thinking disabled (manual only — never auto-picked) |
|
|
14
|
-
| `low` | manual pick for simple chat tasks (cheap rounds stay cheap) |
|
|
15
|
-
| `high` | the official default effort |
|
|
16
|
-
| `max` | heavy work |
|
|
17
|
-
| `auto` | schedule per step from the recent tool-call history |
|
|
11
|
+
| Level | Meaning | Where |
|
|
12
|
+
|---|---|---|
|
|
13
|
+
| `off` | thinking disabled (manual only — never auto-picked) | model selector / default level |
|
|
14
|
+
| `low` | manual pick for simple chat tasks (cheap rounds stay cheap) | model selector / default level |
|
|
15
|
+
| `high` | the official default effort | model selector / default level |
|
|
16
|
+
| `max` | heavy work | model selector / default level |
|
|
17
|
+
| `auto` | **mask**: schedule per step from the recent tool-call history, resolved to a wire level before submission | model selector (injected by the plugin) / default level |
|
|
18
|
+
|
|
19
|
+
Wire-level facts (verified against the official DeepSeek docs and dsh's `llm-deepseek` adapter): `low` maps 1:1 on deepseek-v4-flash / v4-pro, while `medium` / `xhigh` collapse onto `high`. The adapter accepts `off | low | high | max` and rejects anything else with `UNSUPPORTED_REASONING_EFFORT` — `auto` is the plugin's mask layer, never sent to the API, always resolved to a concrete wire level before injection.
|
|
20
|
+
|
|
21
|
+
## Model-selector Auto
|
|
18
22
|
|
|
19
|
-
|
|
23
|
+
The session model selector (next to the model) now offers **Auto** after `Off / Low / High / Max` (injected into the model-directory metadata by the plugin):
|
|
24
|
+
|
|
25
|
+
| Model-selector pick | Behavior |
|
|
26
|
+
|---|---|
|
|
27
|
+
| **Auto** | plugin schedules via tool history + the upgrade/downgrade toggles, resolves to `low` / `high` / `max` before submission |
|
|
28
|
+
| `off` / `low` / `high` / `max` | **manual choice wins** — plugin does not intervene |
|
|
29
|
+
| unset | the plugin's default level applies (below) |
|
|
20
30
|
|
|
21
31
|
## Auto scheduler
|
|
22
32
|
|
|
23
|
-
The hub is `high` (the official default). `auto` schedules between `low` / `high` / `max`; it never picks `off
|
|
33
|
+
The hub is `high` (the official default). `auto` schedules between `low` / `high` / `max`; it never picks `off`.
|
|
24
34
|
|
|
25
35
|
| Recent tool calls | Level |
|
|
26
36
|
|---|---|
|
|
@@ -29,20 +39,27 @@ The hub is `high` (the official default). `auto` schedules between `low` / `high
|
|
|
29
39
|
| mixed / heavy tools | `high` |
|
|
30
40
|
| very heavy payloads, upgrades allowed | `max` |
|
|
31
41
|
|
|
42
|
+
The scheduling policy is the same source as [dsh-tool-turbo](https://github.com/drscrewdriver/dsh-tool-turbo) (same simple-tool whitelist / payload thresholds / 75% ratio rule).
|
|
43
|
+
|
|
32
44
|
## Install
|
|
33
45
|
|
|
34
46
|
```bash
|
|
35
|
-
# 1. install the plugin into a profile from
|
|
47
|
+
# 1. install the plugin into a profile from npm (web shown; any profile works)
|
|
36
48
|
# (the web profile is a pnpm workspace root, so -w is required)
|
|
37
|
-
dsh plugin --profile web add
|
|
38
|
-
#
|
|
49
|
+
dsh plugin --profile web add dsh-thinking-levels -w
|
|
50
|
+
# GitHub alternative:
|
|
51
|
+
# dsh plugin --profile web add https://github.com/drscrewdriver/dsh-thinking-levels.git -w
|
|
52
|
+
# local-path alternative (no network needed):
|
|
39
53
|
# dsh plugin --profile web add /absolute/path/to/dsh-thinking-levels
|
|
40
54
|
|
|
41
|
-
# 2. restart dsh web
|
|
42
|
-
# (a running instance does not hot-load new bundle layers)
|
|
55
|
+
# 2. restart dsh web (a running instance does not hot-load new bundle layers)
|
|
43
56
|
dsh web
|
|
44
57
|
```
|
|
45
58
|
|
|
59
|
+
> Note: the dsh runtime uses pnpm 11, whose `minimumReleaseAge` supply-chain policy may block a
|
|
60
|
+
> freshly published version with `ERR_PNPM_MINIMUM_RELEASE_AGE_VIOLATION` — add the version to
|
|
61
|
+
> `minimumReleaseAgeExclude` in `~/.dsh/profiles/web/pnpm-workspace.yaml` to lift the cooling period.
|
|
62
|
+
|
|
46
63
|
Manual `link:` registration (alternative to `dsh plugin add`):
|
|
47
64
|
|
|
48
65
|
```bash
|
|
@@ -62,14 +79,20 @@ Two surfaces share one schema:
|
|
|
62
79
|
- **Assembly** — the plugin row's `config:` in the profile composition (e.g. `cordis.yml`):
|
|
63
80
|
```yaml
|
|
64
81
|
config:
|
|
65
|
-
level:
|
|
66
|
-
allowDowngrade:
|
|
82
|
+
level: auto # off | low | high | max | auto — the default level when the session picks nothing
|
|
83
|
+
allowDowngrade: true # let the scheduler drop below `high`
|
|
67
84
|
allowUpgrade: false # forbid the scheduler lifting to `max`
|
|
68
85
|
```
|
|
69
|
-
- **Runtime** — the dsh-settings namespace `thinking-levels` (`level`, `allowDowngrade`, `allowUpgrade`, `enabled`): changes apply to the next model request, no restart needed.
|
|
86
|
+
- **Runtime** — the dsh-settings namespace `thinking-levels` (`level`, `allowDowngrade`, `allowUpgrade`, `enabled`): changes apply to the next model request, no restart needed. A visual editor is available under Settings → Plugins → configurable plugins.
|
|
70
87
|
|
|
71
88
|
Defaults: `{ enabled: true, level: 'auto', allowDowngrade: true, allowUpgrade: false }`.
|
|
72
89
|
|
|
90
|
+
> Semantics: the model-selector pick outranks the plugin's default level. Pick `auto` (mask) → plugin schedules; pick `off/low/high/max` → applied directly; pick nothing → the plugin's `level` default is used. `allowDowngrade` / `allowUpgrade` constrain `auto` scheduling only.
|
|
91
|
+
|
|
92
|
+
## Dependency note
|
|
93
|
+
|
|
94
|
+
The host half does **not** value-depend on `@deepseek-ai/dsh-settings` (settings registration goes through the cordis `settings` service provided by the dsh runtime) — no need to install official packages into the profile manually. `dependencies` is just `@deepseek-ai/schemastery` (installed automatically with the package).
|
|
95
|
+
|
|
73
96
|
## Development
|
|
74
97
|
|
|
75
98
|
```bash
|
package/README.zh.md
CHANGED
|
@@ -1,26 +1,36 @@
|
|
|
1
1
|
# dsh-thinking-levels
|
|
2
2
|
|
|
3
|
-
**为 [DeepSeek Harness (dsh)](https://github.com/deepseek-ai/deepseek-harness) 提供按轮次的思考档位(`reasoning_effort
|
|
3
|
+
**为 [DeepSeek Harness (dsh)](https://github.com/deepseek-ai/deepseek-harness) 提供按轮次的思考档位(`reasoning_effort`)控制:在会话模型选择器中可选 `Auto`(mask)——由插件按工具调用历史自动在 `low` / `high` / `max` 间调度后提交 API;也可手动固定 `off` / `low` / `high` / `max`,让廉价工具轮次保持廉价,同时绝不让重任务缺少推理。**
|
|
4
4
|
|
|
5
5
|
[中文文档](./README.zh.md) · English
|
|
6
6
|
|
|
7
|
-
在多步工具链任务中,模型在**每一次工具调用前**都会重新思考——而这个思考过程占据了绝大部分墙钟时间(一个 50 步的 agent 任务可能在工具之间花费数分钟思考)。`dsh-thinking-levels` 接入 dsh 每一步都会重新解析的 `agent/request` waterfall
|
|
7
|
+
在多步工具链任务中,模型在**每一次工具调用前**都会重新思考——而这个思考过程占据了绝大部分墙钟时间(一个 50 步的 agent 任务可能在工具之间花费数分钟思考)。`dsh-thinking-levels` 接入 dsh 每一步都会重新解析的 `agent/request` waterfall(以 `prepend` 置于最外层,避免被会话模型选择覆盖),向下一次模型请求注入思考档位。
|
|
8
8
|
|
|
9
9
|
## 档位
|
|
10
10
|
|
|
11
|
-
| 档位 | 含义 |
|
|
12
|
-
|
|
13
|
-
| `off` | 关闭思考(仅手动选择,自动调度永不选用) |
|
|
14
|
-
| `low` | 手动低档,对应简单对话任务(廉价轮次保持廉价) |
|
|
15
|
-
| `high` | 官方默认档位 |
|
|
16
|
-
| `max` | 重任务 |
|
|
17
|
-
| `auto` |
|
|
11
|
+
| 档位 | 含义 | 位置 |
|
|
12
|
+
|---|---|---|
|
|
13
|
+
| `off` | 关闭思考(仅手动选择,自动调度永不选用) | 模型选择器 / 默认档位 |
|
|
14
|
+
| `low` | 手动低档,对应简单对话任务(廉价轮次保持廉价) | 模型选择器 / 默认档位 |
|
|
15
|
+
| `high` | 官方默认档位 | 模型选择器 / 默认档位 |
|
|
16
|
+
| `max` | 重任务 | 模型选择器 / 默认档位 |
|
|
17
|
+
| `auto` | **mask**:按最近的工具调用历史逐轮调度,提交 API 前解析为具体档位 | 模型选择器(由插件注入元数据)/ 默认档位 |
|
|
18
|
+
|
|
19
|
+
线缆档位事实(对照官方 DeepSeek 文档与 dsh `llm-deepseek` 适配器核实):deepseek-v4-flash / v4-pro 上 `low` 1:1 生效,`medium` / `xhigh` 折叠到 `high`。适配器只接受 `off | low | high | max`,其他值抛 `UNSUPPORTED_REASONING_EFFORT`——`auto` 是插件的 mask 层,永不直接发送给 API,注入前必然解析为具体线缆档位。
|
|
20
|
+
|
|
21
|
+
## 模型选择器 Auto
|
|
18
22
|
|
|
19
|
-
|
|
23
|
+
会话界面模型选择器(模型旁)现在提供 **Auto** 档位(由插件注入模型目录元数据,位于 `Off / Low / High / Max` 之后):
|
|
24
|
+
|
|
25
|
+
| 模型选择器选择 | 行为 |
|
|
26
|
+
|---|---|
|
|
27
|
+
| **Auto** | 插件按工具调用历史 + 升降档开关调度,解析成 `low` / `high` / `max` 后提交 API |
|
|
28
|
+
| `off` / `low` / `high` / `max` | **尊重手动选择**,插件不介入 |
|
|
29
|
+
| 未选择 | 使用插件的默认档位(见下) |
|
|
20
30
|
|
|
21
31
|
## 自动调度
|
|
22
32
|
|
|
23
|
-
中枢为 `high`(官方默认)。`auto` 只在 `low` / `high` / `max` 之间调度;永不选 `off
|
|
33
|
+
中枢为 `high`(官方默认)。`auto` 只在 `low` / `high` / `max` 之间调度;永不选 `off`。
|
|
24
34
|
|
|
25
35
|
| 最近的工具调用 | 档位 |
|
|
26
36
|
|---|---|
|
|
@@ -29,20 +39,27 @@
|
|
|
29
39
|
| 混合 / 重工具 | `high` |
|
|
30
40
|
| 超大载荷、允许升级 | `max` |
|
|
31
41
|
|
|
42
|
+
调度策略与 [dsh-tool-turbo](https://github.com/drscrewdriver/dsh-tool-turbo) 同源(同一套简单工具白名单 / 载荷阈值 / 75% 比例规则)。
|
|
43
|
+
|
|
32
44
|
## 安装
|
|
33
45
|
|
|
34
46
|
```bash
|
|
35
|
-
# 1. 从
|
|
47
|
+
# 1. 从 npm 把插件装进某个 profile(以 web 为例,任意 profile 均可)
|
|
36
48
|
# (web profile 是 pnpm workspace root,必须带 -w)
|
|
37
|
-
dsh plugin --profile web add
|
|
38
|
-
#
|
|
49
|
+
dsh plugin --profile web add dsh-thinking-levels -w
|
|
50
|
+
# GitHub 安装备选:
|
|
51
|
+
# dsh plugin --profile web add https://github.com/drscrewdriver/dsh-thinking-levels.git -w
|
|
52
|
+
# 本地路径备选(无需网络):
|
|
39
53
|
# dsh plugin --profile web add /dsh-thinking-levels 的绝对路径/
|
|
40
54
|
|
|
41
|
-
# 2. 重启 dsh web
|
|
42
|
-
# (运行中的实例不会热加载新的 bundle 层)
|
|
55
|
+
# 2. 重启 dsh web(运行中的实例不会热加载新的 bundle 层)
|
|
43
56
|
dsh web
|
|
44
57
|
```
|
|
45
58
|
|
|
59
|
+
> 注意:dsh 运行环境使用 pnpm 11,新发布的版本会受 `minimumReleaseAge` 冷却期约束;如安装报
|
|
60
|
+
> `ERR_PNPM_MINIMUM_RELEASE_AGE_VIOLATION`,在 `~/.dsh/profiles/web/pnpm-workspace.yaml` 的
|
|
61
|
+
> `minimumReleaseAgeExclude` 中加入对应版本即可。
|
|
62
|
+
|
|
46
63
|
手动 `link:` 注册(`dsh plugin add` 的备选方式):
|
|
47
64
|
|
|
48
65
|
```bash
|
|
@@ -62,14 +79,20 @@ cd ~/.dsh/profiles/web && pnpm install && dsh web
|
|
|
62
79
|
- **装配层** — profile 组合中插件行的 `config:`(如 `cordis.yml`):
|
|
63
80
|
```yaml
|
|
64
81
|
config:
|
|
65
|
-
level:
|
|
66
|
-
allowDowngrade:
|
|
82
|
+
level: auto # off | low | high | max | auto —— 会话未显式选择时的默认档位
|
|
83
|
+
allowDowngrade: true # 允许调度器降到 `high` 以下
|
|
67
84
|
allowUpgrade: false # 禁止调度器升到 `max`
|
|
68
85
|
```
|
|
69
|
-
- **运行时** — dsh-settings 命名空间 `thinking-levels`(`level`、`allowDowngrade`、`allowUpgrade`、`enabled
|
|
86
|
+
- **运行时** — dsh-settings 命名空间 `thinking-levels`(`level`、`allowDowngrade`、`allowUpgrade`、`enabled`):改动对下一次模型请求生效,无需重启。设置面板(设置 → 插件 → 可配置插件)提供可视化编辑。
|
|
70
87
|
|
|
71
88
|
默认值:`{ enabled: true, level: 'auto', allowDowngrade: true, allowUpgrade: false }`。
|
|
72
89
|
|
|
90
|
+
> 语义说明:模型选择器选择优先于插件默认档位。选 `auto`(mask)→ 插件调度;选 `off/low/high/max` → 直接生效;未选择 → 使用插件的 `level` 默认档位。`allowDowngrade` / `allowUpgrade` 只约束 `auto` 调度。
|
|
91
|
+
|
|
92
|
+
## 依赖说明
|
|
93
|
+
|
|
94
|
+
插件 host 侧**不**值依赖 `@deepseek-ai/dsh-settings`(设置注册通过 cordis 的 `settings` 服务,由 dsh 运行时提供)——无需在 profile 中手动安装官方包。`dependencies` 仅 `@deepseek-ai/schemastery`(随包自动安装)。
|
|
95
|
+
|
|
73
96
|
## 开发
|
|
74
97
|
|
|
75
98
|
```bash
|
package/lib/client.js
CHANGED
package/lib/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","names":["useSyncExternalStore"],"sources":["../src/client/locales.ts","../src/client/card.tsx","../src/client/index.ts"],"sourcesContent":["/** `thinking-levels` client dictionaries. */\r\n\r\n/** Dictionary namespace owned by this plugin. */\r\nexport const NS = 'thinking-levels'\r\n\r\n/** Simplified Chinese dictionary (the key-set source of truth). */\r\nexport const zh = {\r\n 'card.title': '思考档位',\r\n 'card.description': '在模型选择器中可选 Auto(mask):按工具调用历史自动在 low / high / max 间调度后提交 API。此处配置默认档位与调度边界。',\r\n 'card.level': '默认档位',\r\n 'card.level.off': 'off — 关闭思考(仅手动,永不自动选择)',\r\n 'card.level.low': 'low — 低(简单任务,廉价轮保持廉价)',\r\n 'card.level.high': 'high — 高(官方默认)',\r\n 'card.level.max': 'max — 最大(重任务)',\r\n 'card.level.auto': 'auto — 按工具历史自动调度(默认)',\r\n 'card.enabled': '启用',\r\n 'card.allowDowngrade': '允许降档(auto 可降至 low)',\r\n 'card.allowUpgrade': '允许升档(auto 可升至 max)',\r\n 'card.unavailable': '设置命名空间不可用:请确认 dsh-thinking-levels 已装配进 profile。',\r\n 'card.readonly': '只读',\r\n} satisfies Record<string, string>\r\n\r\n/** English dictionary (keys mirror zh). */\r\nexport const en: Record<keyof typeof zh, string> = {\r\n 'card.title': 'Thinking Levels',\r\n 'card.description': 'Pick Auto in the model selector: the plugin schedules low / high / max per tool round before submitting the API effort. Here you configure the default level and scheduler bounds.',\r\n 'card.level': 'Default level',\r\n 'card.level.off': 'off — disable thinking (manual only, never auto-picked)',\r\n 'card.level.low': 'low — cheap rounds stay cheap',\r\n 'card.level.high': 'high — the official default',\r\n 'card.level.max': 'max — heavy work',\r\n 'card.level.auto': 'auto — schedule from tool history (default)',\r\n 'card.enabled': 'Enabled',\r\n 'card.allowDowngrade': 'Allow downgrade (auto may drop to low)',\r\n 'card.allowUpgrade': 'Allow upgrade (auto may lift to max)',\r\n 'card.unavailable': 'Settings namespace unavailable: make sure dsh-thinking-levels is assembled into this profile.',\r\n 'card.readonly': 'Read-only',\r\n}\r\n","/**\r\n * Thinking-levels settings card — the `settings.plugin.item` face of the\r\n * dsh-thinking-levels plugin.\r\n *\r\n * The card binds the `thinking-levels` settings namespace through the\r\n * `settingsScope` cordis service and renders its four fields: the level picker\r\n * (off / low / high / max / auto) plus the three scheduler toggles. Every\r\n * change commits immediately through the scope (no staged form): the decision\r\n * is read per model request, so a committed change applies to the next request\r\n * without a restart.\r\n *\r\n * Kept dependency-free beyond react: the scope is subscribed with\r\n * `useSyncExternalStore`, and the controls are plain HTML so the client bundle\r\n * needs no CSS modules and no primitives value import.\r\n */\r\nimport { useSyncExternalStore } from 'react'\r\nimport type { CSSProperties, JSX } from 'react'\r\nimport type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'\r\nimport type { SettingsScope } from '@deepseek-ai/dsh-client-ui-settings/client'\r\nimport type { EffortId } from '../thinking-level.ts'\r\nimport type { ThinkingLevelsConfig } from '../index.ts'\r\n\r\n/** One injected face: the bound settings scope for the `thinking-levels` namespace. */\r\nexport interface ThinkingLevelsCardInjected {\r\n scope: SettingsScope<ThinkingLevelsConfig>\r\n}\r\n\r\n/** Full props: locale seat + the injected scope. */\r\nexport type ThinkingLevelsCardProps = PropsLocale<'thinking-levels'> & ThinkingLevelsCardInjected\r\n\r\n/** The five user-facing levels, in picker order. */\r\nconst EFFORT_OPTIONS: readonly EffortId[] = ['off', 'low', 'high', 'max', 'auto']\r\n\r\n/** Minimal shared row styling (inline; keeps the client bundle CSS-free). */\r\nconst rowStyle: CSSProperties = {\r\n display: 'flex',\r\n alignItems: 'center',\r\n justifyContent: 'space-between',\r\n gap: '12px',\r\n padding: '6px 0',\r\n fontSize: '13px',\r\n lineHeight: '20px',\r\n}\r\n\r\nconst labelStyle: CSSProperties = { margin: 0, color: 'var(--dsw-alias-label-primary)' }\r\n\r\nconst controlStyle: CSSProperties = {\r\n background: 'var(--dsw-alias-bg-surface, #fff)',\r\n color: 'var(--dsw-alias-label-primary)',\r\n border: '1px solid var(--dsw-alias-border-l2)',\r\n borderRadius: '4px',\r\n padding: '3px 8px',\r\n fontSize: '13px',\r\n}\r\n\r\n/** One boolean field row (checkbox) bound to the scope. */\r\nfunction ToggleRow(props: {\r\n id: string\r\n label: string\r\n checked: boolean\r\n disabled: boolean\r\n onChange: (next: boolean) => void\r\n}): JSX.Element {\r\n const { id, label, checked, disabled, onChange } = props\r\n return (\r\n <div style={rowStyle}>\r\n <label htmlFor={id} style={labelStyle}>{label}</label>\r\n <input\r\n id={id}\r\n type=\"checkbox\"\r\n checked={checked}\r\n disabled={disabled}\r\n onChange={(event) => onChange(event.currentTarget.checked)}\r\n />\r\n </div>\r\n )\r\n}\r\n\r\n/**\r\n * The card body.\r\n * @param props - locale copy and the injected settings scope.\r\n */\r\nexport function ThinkingLevelsCard({ t, scope }: ThinkingLevelsCardProps): JSX.Element {\r\n const snapshot = useSyncExternalStore(\r\n (listener) => scope.subscribe(listener),\r\n () => scope.getSnapshot(),\r\n )\r\n const unavailable = snapshot.status === 'unavailable'\r\n const readonly = unavailable || !snapshot.writable\r\n const value = (snapshot.value ?? {}) as Partial<ThinkingLevelsConfig>\r\n const level = EFFORT_OPTIONS.includes(value.level as EffortId) ? value.level as EffortId : 'auto'\r\n\r\n if (unavailable) {\r\n return (\r\n <div style={{ padding: '12px 16px', fontSize: '13px', color: 'var(--dsw-alias-label-tertiary)' }}>\r\n {t('card.unavailable')}\r\n </div>\r\n )\r\n }\r\n\r\n return (\r\n <div style={{ padding: '12px 16px' }}>\r\n <div style={rowStyle}>\r\n <label htmlFor=\"plugin-config-thinking-levels-level\" style={labelStyle}>{t('card.level')}</label>\r\n <select\r\n id=\"plugin-config-thinking-levels-level\"\r\n value={level}\r\n disabled={readonly}\r\n style={controlStyle}\r\n onChange={(event) => { void scope.set('level', event.currentTarget.value as EffortId) }}\r\n >\r\n {EFFORT_OPTIONS.map((option) => (\r\n <option key={option} value={option}>{t(`card.level.${option}`)}</option>\r\n ))}\r\n </select>\r\n </div>\r\n <ToggleRow\r\n id=\"plugin-config-thinking-levels-enabled\"\r\n label={t('card.enabled')}\r\n checked={value.enabled ?? true}\r\n disabled={readonly}\r\n onChange={(next) => { void scope.set('enabled', next) }}\r\n />\r\n <ToggleRow\r\n id=\"plugin-config-thinking-levels-downgrade\"\r\n label={t('card.allowDowngrade')}\r\n checked={value.allowDowngrade ?? true}\r\n disabled={readonly || value.level !== 'auto'}\r\n onChange={(next) => { void scope.set('allowDowngrade', next) }}\r\n />\r\n <ToggleRow\r\n id=\"plugin-config-thinking-levels-upgrade\"\r\n label={t('card.allowUpgrade')}\r\n checked={value.allowUpgrade ?? false}\r\n disabled={readonly || value.level !== 'auto'}\r\n onChange={(next) => { void scope.set('allowUpgrade', next) }}\r\n />\r\n {!snapshot.writable && <p style={{ margin: '8px 0 0', fontSize: '12px', color: 'var(--dsw-alias-label-tertiary)' }}>{t('card.readonly')}</p>}\r\n </div>\r\n )\r\n}\r\n","/**\r\n * dsh-thinking-levels — browser half.\r\n *\r\n * Registers the `thinking-levels` dictionaries and one `settings.plugin.item`\r\n * card keyed by the plugin's settings namespace, so the shared Plugins\r\n * settings tab renders an editable card: the level picker (off / low / high /\r\n * max / auto) plus the scheduler toggles.\r\n *\r\n * All @deepseek-ai/* imports are type-only: collaboration happens through\r\n * cordis services (`settingsScope`) and slot registration only (client bundle\r\n * purity).\r\n */\r\nimport type { ClientContext } from '@deepseek-ai/dsh-client-runtime/client'\r\nimport type {} from '@deepseek-ai/dsh-client-locale/client'\r\nimport type {} from '@deepseek-ai/dsh-client-ui-settings/client'\r\nimport type { ThinkingLevelsConfig } from '../index.ts'\r\nimport { NS, en, zh } from './locales.ts'\r\nimport { ThinkingLevelsCard, type ThinkingLevelsCardInjected } from './card.tsx'\r\n\r\n/** The settings namespace the host half registers (kept in lockstep with src/index.ts). */\r\nconst THINKING_LEVELS_NS = 'thinking-levels'\r\n\r\n/** Services required by the browser half. */\r\nexport const inject = ['slots', 'locale', 'settingsScope']\r\n\r\n/**\r\n * Client plugin body: dictionaries plus the settings card registration.\r\n * @param ctx - client root context.\r\n */\r\nexport function apply(ctx: ClientContext): void {\r\n ctx.effect(() => ctx.locale.register(NS, { zh, en }), 'dsh-thinking-levels: dictionaries')\r\n\r\n ctx.slots.inject('settings.plugin.item', function* () {\r\n yield ctx.slots.register({\r\n name: 'settings.plugin.item',\r\n key: THINKING_LEVELS_NS,\r\n locale: NS,\r\n inject: (): ThinkingLevelsCardInjected => {\r\n const scope = ctx.settingsScope.bind<ThinkingLevelsConfig>({ namespace: THINKING_LEVELS_NS })\r\n return { scope }\r\n },\r\n }, ThinkingLevelsCard)\r\n })\r\n}\r\n"],"mappings":";;;;;;;;;;;EAGA,MAAa,KAAK;;EAGlB,MAAa,KAAK;GAChB,cAAc;GACd,oBAAoB;GACpB,cAAc;GACd,kBAAkB;GAClB,kBAAkB;GAClB,mBAAmB;GACnB,kBAAkB;GAClB,mBAAmB;GACnB,gBAAgB;GAChB,uBAAuB;GACvB,qBAAqB;GACrB,oBAAoB;GACpB,iBAAiB;EACnB;;EAGA,MAAa,KAAsC;GACjD,cAAc;GACd,oBAAoB;GACpB,cAAc;GACd,kBAAkB;GAClB,k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AC5D,CAAA;KACA,CAAC,SAAS,YAAY,iBAAA,GAAA,kBAAA,IAAA,CAAC,KAAD;MAAG,OAAO;OAAE,QAAQ;OAAW,UAAU;OAAQ,OAAO;MAAkC;MAAI,UAAA,EAAE,eAAe;KAAK,CAAA;IACxI;;EAET;;;;ECxHA,MAAM,qBAAqB;;EAG3B,MAAa,SAAS;GAAC;GAAS;GAAU;EAAe;;;;;EAMzD,SAAgB,MAAM,KAA0B;GAC9C,IAAI,aAAa,IAAI,OAAO,SAAS,IAAI;IAAE;IAAI;GAAG,CAAC,GAAG,mCAAmC;GAEzF,IAAI,MAAM,OAAO,wBAAwB,aAAa;IACpD,MAAM,IAAI,MAAM,SAAS;KACvB,MAAM;KACN,KAAK;KACL,QAAQ;KACR,cAA0C;MAExC,OAAO,EAAE,OADK,IAAI,cAAc,KAA2B,EAAE,WAAW,mBAAmB,CAC9E,EAAE;KACjB;IACF,GAAG,kBAAkB;GACvB,CAAC;EACH"}
|
|
1
|
+
{"version":3,"file":"client.js","names":["useSyncExternalStore"],"sources":["../src/client/locales.ts","../src/client/card.tsx","../src/client/index.ts"],"sourcesContent":["/** `thinking-levels` client dictionaries. */\r\n\r\n/** Dictionary namespace owned by this plugin. */\r\nexport const NS = 'thinking-levels'\r\n\r\n/** Simplified Chinese dictionary (the key-set source of truth). */\r\nexport const zh = {\r\n 'card.title': '思考档位',\r\n 'card.description': '在模型选择器中可选 Auto(mask):按工具调用历史自动在 low / high / max 间调度后提交 API。此处配置默认档位与调度边界。',\r\n 'card.level': '默认档位',\r\n 'card.level.off': 'off — 关闭思考(仅手动,永不自动选择)',\r\n 'card.level.low': 'low — 低(简单任务,廉价轮保持廉价)',\r\n 'card.level.high': 'high — 高(官方默认)',\r\n 'card.level.max': 'max — 最大(重任务)',\r\n 'card.level.auto': 'auto — 按工具历史自动调度(默认)',\r\n 'card.enabled': '启用',\r\n 'card.allowDowngrade': '允许降档(auto 可降至 low)',\r\n 'card.allowUpgrade': '允许升档(auto 可升至 max)',\r\n 'card.unavailable': '设置命名空间不可用:请确认 dsh-thinking-levels 已装配进 profile。',\r\n 'card.readonly': '只读',\r\n} satisfies Record<string, string>\r\n\r\n/** English dictionary (keys mirror zh). */\r\nexport const en: Record<keyof typeof zh, string> = {\r\n 'card.title': 'Thinking Levels',\r\n 'card.description': 'Pick Auto in the model selector: the plugin schedules low / high / max per tool round before submitting the API effort. Here you configure the default level and scheduler bounds.',\r\n 'card.level': 'Default level',\r\n 'card.level.off': 'off — disable thinking (manual only, never auto-picked)',\r\n 'card.level.low': 'low — cheap rounds stay cheap',\r\n 'card.level.high': 'high — the official default',\r\n 'card.level.max': 'max — heavy work',\r\n 'card.level.auto': 'auto — schedule from tool history (default)',\r\n 'card.enabled': 'Enabled',\r\n 'card.allowDowngrade': 'Allow downgrade (auto may drop to low)',\r\n 'card.allowUpgrade': 'Allow upgrade (auto may lift to max)',\r\n 'card.unavailable': 'Settings namespace unavailable: make sure dsh-thinking-levels is assembled into this profile.',\r\n 'card.readonly': 'Read-only',\r\n}\r\n","/**\r\n * Thinking-levels settings card — the `settings.plugin.item` face of the\r\n * dsh-thinking-levels plugin.\r\n *\r\n * The card binds the `thinking-levels` settings namespace through the\r\n * `settingsScope` cordis service and renders its four fields: the level picker\r\n * (off / low / high / max / auto) plus the three scheduler toggles. Every\r\n * change commits immediately through the scope (no staged form): the decision\r\n * is read per model request, so a committed change applies to the next request\r\n * without a restart.\r\n *\r\n * Kept dependency-free beyond react: the scope is subscribed with\r\n * `useSyncExternalStore`, and the controls are plain HTML so the client bundle\r\n * needs no CSS modules and no primitives value import.\r\n */\r\nimport { useSyncExternalStore } from 'react'\r\nimport type { CSSProperties, JSX } from 'react'\r\nimport type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'\r\nimport type { SettingsScope } from '@deepseek-ai/dsh-client-ui-settings/client'\r\nimport type { EffortId } from '../thinking-level.ts'\r\nimport type { ThinkingLevelsConfig } from '../index.ts'\r\n\r\n/** One injected face: the bound settings scope for the `thinking-levels` namespace. */\r\nexport interface ThinkingLevelsCardInjected {\r\n scope: SettingsScope<ThinkingLevelsConfig>\r\n}\r\n\r\n/** Full props: locale seat + the injected scope. */\r\nexport type ThinkingLevelsCardProps = PropsLocale<'thinking-levels'> & ThinkingLevelsCardInjected\r\n\r\n/** The five user-facing levels, in picker order. */\r\nconst EFFORT_OPTIONS: readonly EffortId[] = ['off', 'low', 'high', 'max', 'auto']\r\n\r\n/** Minimal shared row styling (inline; keeps the client bundle CSS-free). */\r\nconst rowStyle: CSSProperties = {\r\n display: 'flex',\r\n alignItems: 'center',\r\n justifyContent: 'space-between',\r\n gap: '12px',\r\n padding: '6px 0',\r\n fontSize: '13px',\r\n lineHeight: '20px',\r\n}\r\n\r\nconst labelStyle: CSSProperties = { margin: 0, color: 'var(--dsw-alias-label-primary)' }\r\n\r\nconst controlStyle: CSSProperties = {\r\n background: 'var(--dsw-alias-bg-surface, #fff)',\r\n color: 'var(--dsw-alias-label-primary)',\r\n border: '1px solid var(--dsw-alias-border-l2)',\r\n borderRadius: '4px',\r\n padding: '3px 8px',\r\n fontSize: '13px',\r\n}\r\n\r\n/** One boolean field row (checkbox) bound to the scope. */\r\nfunction ToggleRow(props: {\r\n id: string\r\n label: string\r\n checked: boolean\r\n disabled: boolean\r\n onChange: (next: boolean) => void\r\n}): JSX.Element {\r\n const { id, label, checked, disabled, onChange } = props\r\n return (\r\n <div style={rowStyle}>\r\n <label htmlFor={id} style={labelStyle}>{label}</label>\r\n <input\r\n id={id}\r\n type=\"checkbox\"\r\n checked={checked}\r\n disabled={disabled}\r\n onChange={(event) => onChange(event.currentTarget.checked)}\r\n />\r\n </div>\r\n )\r\n}\r\n\r\n/**\r\n * The card body.\r\n * @param props - locale copy and the injected settings scope.\r\n */\r\nexport function ThinkingLevelsCard({ t, scope }: ThinkingLevelsCardProps): JSX.Element {\r\n const snapshot = useSyncExternalStore(\r\n (listener) => scope.subscribe(listener),\r\n () => scope.getSnapshot(),\r\n )\r\n const unavailable = snapshot.status === 'unavailable'\r\n const readonly = unavailable || !snapshot.writable\r\n const value = (snapshot.value ?? {}) as Partial<ThinkingLevelsConfig>\r\n const level = EFFORT_OPTIONS.includes(value.level as EffortId) ? value.level as EffortId : 'auto'\r\n\r\n if (unavailable) {\r\n return (\r\n <div style={{ padding: '12px 16px', fontSize: '13px', color: 'var(--dsw-alias-label-tertiary)' }}>\r\n {t('card.unavailable')}\r\n </div>\r\n )\r\n }\r\n\r\n return (\r\n <div style={{ padding: '12px 16px' }}>\r\n <div style={rowStyle}>\r\n <label htmlFor=\"plugin-config-thinking-levels-level\" style={labelStyle}>{t('card.level')}</label>\r\n <select\r\n id=\"plugin-config-thinking-levels-level\"\r\n value={level}\r\n disabled={readonly}\r\n style={controlStyle}\r\n onChange={(event) => { void scope.set('level', event.currentTarget.value as EffortId) }}\r\n >\r\n {EFFORT_OPTIONS.map((option) => (\r\n <option key={option} value={option}>{t(`card.level.${option}`)}</option>\r\n ))}\r\n </select>\r\n </div>\r\n <ToggleRow\r\n id=\"plugin-config-thinking-levels-enabled\"\r\n label={t('card.enabled')}\r\n checked={value.enabled ?? true}\r\n disabled={readonly}\r\n onChange={(next) => { void scope.set('enabled', next) }}\r\n />\r\n <ToggleRow\r\n id=\"plugin-config-thinking-levels-downgrade\"\r\n label={t('card.allowDowngrade')}\r\n checked={value.allowDowngrade ?? true}\r\n disabled={readonly || value.level !== 'auto'}\r\n onChange={(next) => { void scope.set('allowDowngrade', next) }}\r\n />\r\n <ToggleRow\r\n id=\"plugin-config-thinking-levels-upgrade\"\r\n label={t('card.allowUpgrade')}\r\n checked={value.allowUpgrade ?? false}\r\n disabled={readonly || value.level !== 'auto'}\r\n onChange={(next) => { void scope.set('allowUpgrade', next) }}\r\n />\r\n {!snapshot.writable && <p style={{ margin: '8px 0 0', fontSize: '12px', color: 'var(--dsw-alias-label-tertiary)' }}>{t('card.readonly')}</p>}\r\n </div>\r\n )\r\n}\r\n","/**\r\n * dsh-thinking-levels — browser half.\r\n *\r\n * Registers the `thinking-levels` dictionaries and one `settings.plugin.item`\r\n * card keyed by the plugin's settings namespace, so the shared Plugins\r\n * settings tab renders an editable card: the level picker (off / low / high /\r\n * max / auto) plus the scheduler toggles.\r\n *\r\n * All @deepseek-ai/* imports are type-only: collaboration happens through\r\n * cordis services (`settingsScope`) and slot registration only (client bundle\r\n * purity).\r\n */\r\nimport type { ClientContext } from '@deepseek-ai/dsh-client-runtime/client'\r\nimport type {} from '@deepseek-ai/dsh-client-locale/client'\r\nimport type {} from '@deepseek-ai/dsh-client-ui-settings/client'\r\nimport type { ThinkingLevelsConfig } from '../index.ts'\r\nimport { NS, en, zh } from './locales.ts'\r\nimport { ThinkingLevelsCard, type ThinkingLevelsCardInjected } from './card.tsx'\r\n\r\n/** The settings namespace the host half registers (kept in lockstep with src/index.ts). */\r\nconst THINKING_LEVELS_NS = 'thinking-levels'\r\n\r\n/** Services required by the browser half. */\r\nexport const inject = ['slots', 'locale', 'settingsScope']\r\n\r\n/**\r\n * Client plugin body: dictionaries plus the settings card registration.\r\n * @param ctx - client root context.\r\n */\r\nexport function apply(ctx: ClientContext): void {\r\n ctx.effect(() => ctx.locale.register(NS, { zh, en }), 'dsh-thinking-levels: dictionaries')\r\n\r\n ctx.slots.inject('settings.plugin.item', function* () {\r\n yield ctx.slots.register({\r\n name: 'settings.plugin.item',\r\n // Both keys are supplied: CLI dsh declares this slot `keyed` (needs\r\n // `key`) while DSH Desktop's bundled version declares it `list` (needs\r\n // `id`) — the slots service validates only its kind's field, so the\r\n // pair keeps the card working in both environments.\r\n id: THINKING_LEVELS_NS,\r\n key: THINKING_LEVELS_NS,\r\n locale: NS,\r\n inject: (): ThinkingLevelsCardInjected => {\r\n const scope = ctx.settingsScope.bind<ThinkingLevelsConfig>({ namespace: THINKING_LEVELS_NS })\r\n return { scope }\r\n },\r\n }, ThinkingLevelsCard)\r\n })\r\n}\r\n"],"mappings":";;;;;;;;;;;EAGA,MAAa,KAAK;;EAGlB,MAAa,K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AU;MACtC,WAAW,SAAS;OAAE,MAAW,IAAI,kBAAkB,IAAI;MAAE;KAC9D,CAAA;KACD,iBAAA,GAAA,kBAAA,IAAA,CAAC,WAAD;MACE,IAAG;MACH,OAAO,EAAE,mBAAmB;MAC5B,SAAS,MAAM,gBAAgB;MAC/B,UAAU,YAAY,MAAM,UAAU;MACtC,WAAW,SAAS;OAAE,MAAW,IAAI,gBAAgB,IAAI;MAAE;KAC5D,CAAA;KACA,CAAC,SAAS,YAAY,iBAAA,GAAA,kBAAA,IAAA,CAAC,KAAD;MAAG,OAAO;OAAE,QAAQ;OAAW,UAAU;OAAQ,OAAO;MAAkC;MAAI,UAAA,EAAE,eAAe;KAAK,CAAA;IACxI;;EAET;;;;ECxHA,MAAM,qBAAqB;;EAG3B,MAAa,SAAS;GAAC;GAAS;GAAU;EAAe;;;;;EAMzD,SAAgB,MAAM,KAA0B;GAC9C,IAAI,aAAa,IAAI,OAAO,SAAS,IAAI;IAAE;IAAI;GAAG,CAAC,GAAG,mCAAmC;GAEzF,IAAI,MAAM,OAAO,wBAAwB,aAAa;IACpD,MAAM,IAAI,MAAM,SAAS;KACvB,MAAM;KAKN,IAAI;KACJ,KAAK;KACL,QAAQ;KACR,cAA0C;MAExC,OAAO,EAAE,OADK,IAAI,cAAc,KAA2B,EAAE,WAAW,mBAAmB,CAC9E,EAAE;KACjB;IACF,GAAG,kBAAkB;GACvB,CAAC;EACH"}
|
package/lib/index.d.ts
CHANGED
|
@@ -34,7 +34,7 @@ export declare const Config: z<ThinkingLevelsConfig>;
|
|
|
34
34
|
/** Settings defaults, kept in lockstep with the schema defaults above. */
|
|
35
35
|
export declare const DEFAULT_CONFIG: ThinkingLevelsConfig;
|
|
36
36
|
/** Runtime-adjustable settings namespace: level + scheduler toggles. */
|
|
37
|
-
export declare const THINKING_LEVELS_SETTINGS_NAMESPACE
|
|
37
|
+
export declare const THINKING_LEVELS_SETTINGS_NAMESPACE = "thinking-levels";
|
|
38
38
|
/**
|
|
39
39
|
* Plugin body.
|
|
40
40
|
* @param ctx - host context carrying the agent-event dispatch.
|
package/lib/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import z from '@deepseek-ai/schemastery';
|
|
2
|
-
import { installSettingsSection, settingsNamespace } from '@deepseek-ai/dsh-settings';
|
|
3
2
|
import { assertEffortId, decideEffort, isEffortId } from "./thinking-level.js";
|
|
4
3
|
import { recentToolCalls } from "./session-events.js";
|
|
5
4
|
/**
|
|
@@ -22,7 +21,33 @@ export const DEFAULT_CONFIG = {
|
|
|
22
21
|
allowUpgrade: false,
|
|
23
22
|
};
|
|
24
23
|
/** Runtime-adjustable settings namespace: level + scheduler toggles. */
|
|
25
|
-
export const THINKING_LEVELS_SETTINGS_NAMESPACE =
|
|
24
|
+
export const THINKING_LEVELS_SETTINGS_NAMESPACE = 'thinking-levels';
|
|
25
|
+
/**
|
|
26
|
+
* Inline equivalent of the official `installSettingsSection` helper: register
|
|
27
|
+
* the namespace through the `settings` service (cordis injection), layer the
|
|
28
|
+
* composition entry as `base`, and keep the runtime source live. Kept local so
|
|
29
|
+
* the host half has no value dependency on `@deepseek-ai/dsh-settings`.
|
|
30
|
+
* @param ctx - host context carrying the settings service.
|
|
31
|
+
* @param ns - settings namespace to register.
|
|
32
|
+
* @param schema - schemastery schema resolving the namespace value.
|
|
33
|
+
* @param entry - composition-entry config used as the `base` layer.
|
|
34
|
+
* @param hooks - source sink and change notification.
|
|
35
|
+
*/
|
|
36
|
+
function installSettingsSection(ctx, ns, schema, entry, hooks) {
|
|
37
|
+
;
|
|
38
|
+
ctx.inject(['settings'], (sctx) => {
|
|
39
|
+
const scope = sctx.settings.register(ns, schema, { base: entry });
|
|
40
|
+
hooks.setSource(() => scope.get());
|
|
41
|
+
hooks.onChange();
|
|
42
|
+
// Detach: on plugin unload fall back to the composition entry, mirroring
|
|
43
|
+
// the official helper's disposer.
|
|
44
|
+
sctx.effect(() => () => {
|
|
45
|
+
hooks.setSource(() => entry);
|
|
46
|
+
hooks.onChange();
|
|
47
|
+
});
|
|
48
|
+
scope.watch(() => hooks.onChange());
|
|
49
|
+
});
|
|
50
|
+
}
|
|
26
51
|
const TOOL_AGE_LIMIT_MS = 10 * 60 * 1000;
|
|
27
52
|
/**
|
|
28
53
|
* The `auto` mask shown in the model directory: a user-facing level that is
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-thinking-levels",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "DSH host plugin: thinking-level (reasoning_effort) control for dsh — auto-adjust per tool round, with optional manual lock and per-tool timing telemetry.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -33,17 +33,13 @@
|
|
|
33
33
|
"node": ">=20"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"@deepseek-ai/cordis": "^4.0.1"
|
|
37
|
-
"@deepseek-ai/dsh-agent": "^0.1.0-rc.6",
|
|
38
|
-
"@deepseek-ai/dsh-settings": "^0.1.0-rc.6"
|
|
36
|
+
"@deepseek-ai/cordis": "^4.0.1"
|
|
39
37
|
},
|
|
40
38
|
"dependencies": {
|
|
41
39
|
"@deepseek-ai/schemastery": "^3.18.0"
|
|
42
40
|
},
|
|
43
41
|
"devDependencies": {
|
|
44
42
|
"@deepseek-ai/cordis": "^4.0.1",
|
|
45
|
-
"@deepseek-ai/dsh-agent": "^0.1.0-rc.6",
|
|
46
|
-
"@deepseek-ai/dsh-settings": "^0.1.0-rc.6",
|
|
47
43
|
"@deepseek-ai/dsh-client-locale": "^0.1.0-rc.7",
|
|
48
44
|
"@deepseek-ai/dsh-client-runtime": "^0.1.0-rc.7",
|
|
49
45
|
"@deepseek-ai/dsh-client-ui-settings": "^0.1.0-rc.7",
|