dsh-prompt-pocket 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,36 +1,70 @@
1
- # dsh-prompt-pocket
2
-
3
- **A prompt pocket that floats in the corner of DeepSeek Harness.** Press `Ctrl+Shift+S` and the draft you were already typing is saved. Click a row to put it back at your caret.
4
-
5
- **It adds nothing to the layout** — no sidebar entry, no chip row above the composer, no panel that shifts the conversation. Just a 24px dot you can drag anywhere.
6
-
7
- ## Install
8
-
9
- ```bash
10
- dsh plugin --profile web add dsh-prompt-pocket
11
- ```
12
-
13
- Restart the host once, then force-reload the page (`Ctrl+Shift+R`).
14
-
15
- ## Use
16
-
17
- | Action | Key |
18
- | --- | --- |
19
- | Save selection, or the whole draft when nothing is selected | `Ctrl+Shift+S` |
20
- | Open the pocket | `Ctrl+Shift+P` |
21
- | Insert a prompt at the caret | `Enter` on a row |
22
- | Replace the whole draft with it | `Alt+Enter` |
23
-
24
- Turning a note into a DSH prompt is opt-in: the save chip and each row with a star give you a diff, and a failed run never replaces the original.
25
-
26
- Two drawers: **This project** (every session in the same workspace) and **General** (everywhere). Saving never opens a dialog.
27
-
28
- ## Storage
29
-
30
- `$DSH_HOME/dsh-prompt-stash/store.json` — one file, atomic write, 500 entries maximum, least recently used evicted first.
31
-
32
- A `prompt_stash` tool lets the agent read and write the same pocket.
33
-
34
- ## License
35
-
36
- MIT
1
+ # dsh-prompt-pocket
2
+
3
+ **A prompt pocket for [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness): one keystroke saves what you were typing, one click puts it back at the caret.** It lives as a 24px dot in the corner, so the layout never grows a sidebar, a chip row, or a panel that shifts the conversation.
4
+
5
+ ![The prompt pocket open over a session: a search box, two drawers, three saved prompts and the dot in the corner](https://raw.githubusercontent.com/FindSomeSkills/dsh-prompt-pocket/main/docs/images/en-panel.png)
6
+
7
+ Site: **[dshtoolbox.com/plugins/dsh-prompt-pocket](https://www.dshtoolbox.com/plugins/dsh-prompt-pocket/)** · 中文页: [dshtoolbox.com/zh/plugins/dsh-prompt-pocket](https://www.dshtoolbox.com/zh/plugins/dsh-prompt-pocket/) · npm: [dsh-prompt-pocket](https://www.npmjs.com/package/dsh-prompt-pocket)
8
+
9
+ ## Why it exists
10
+
11
+ Prompt libraries ask for a title, tags, a folder and a panel before they will keep a sentence. By then you have forgotten the sentence. This one keeps the sentence.
12
+
13
+ ## What it does that others do not
14
+
15
+ - **`Ctrl+Shift+S` saves without a dialog.** The selection if there is one, the whole draft otherwise. No title, no tags, no “where should this go”.
16
+ - **The confirmation appears beside the dot even when the panel is closed** — with a one-click move to the other drawer and a button to rewrite the prompt.
17
+ - **Insert is revision-guarded, not string concatenation.** A quote chip or attachment you already had stays where it is, the insert is one undo step, and focus returns to the composer.
18
+ - **Two drawers split by workspace, not by session.** Sessions get archived and forked; a prompt pinned to one session loses its home. A bare session falls back to General instead of showing an empty drawer.
19
+ - **✦ writes a DSH prompt, it does not paraphrase.** Variables, paths, URLs and code blocks are kept byte-for-byte, nothing is invented, and filler is forbidden by the instruction. A failed or empty result never replaces your text; accepting a rewrite keeps the old one in `prior`.
20
+ - **One click on an assistant reply keeps it verbatim** as source material, read from the session log — text blocks only, tool calls never leak in.
21
+ - **The agent shares the same pocket** through the `prompt_stash` tool, scoped to the drawers so one project's prompts do not show up in another's answer.
22
+ - **500 prompts, least recently used dropped, one JSON file, atomic writes, no runtime dependencies, no account.** Nothing leaves the machine except the one model call you explicitly ask for.
23
+
24
+ ![The pocket collapsed to a faint dot in the corner of the composer](https://raw.githubusercontent.com/FindSomeSkills/dsh-prompt-pocket/main/docs/images/en-pill.png)
25
+
26
+ ## Install
27
+
28
+ ```bash
29
+ dsh plugin --profile web add dsh-prompt-pocket
30
+ ```
31
+
32
+ Restart the host once so the route, the tool and the client bundle register, then force-reload the page with `Ctrl+Shift+R`. From a checkout instead:
33
+
34
+ ```bash
35
+ git clone https://github.com/FindSomeSkills/dsh-prompt-pocket
36
+ cd dsh-prompt-pocket
37
+ dsh plugin --profile web add .
38
+ ```
39
+
40
+ ## Use
41
+
42
+ | Action | How |
43
+ | --- | --- |
44
+ | Save the selection or the draft | `Ctrl+Shift+S` |
45
+ | Open or close the pocket | `Ctrl+Shift+P`, or click the dot |
46
+ | Move the dot | Drag it; the position is remembered per browser |
47
+ | Insert a prompt at the caret | `Enter`, or click the row |
48
+ | Replace the whole draft | `Alt+Enter` while a row is selected |
49
+ | Walk the list | `↑` `↓` (wraps around), `Esc` closes |
50
+ | Move a prompt between drawers | `⇄` on the row |
51
+ | Delete | `×` on the row |
52
+ | Rewrite the prompt for DSH | `✦`, or the button on the save confirmation |
53
+ | Save an assistant reply | `⤓` in the reply action row |
54
+
55
+ ## Where the data lives
56
+
57
+ `$DSH_HOME/dsh-prompt-stash/store.json`, by default `~/.dsh/dsh-prompt-stash/store.json`. One file for every profile and every browser pointed at this host; writes go through a temporary file and a rename, and a damaged file is renamed to `.corrupt-<timestamp>.bak` instead of blocking the panel.
58
+
59
+ ## Requirements
60
+
61
+ DeepSeek Harness `>= 0.2.0-rc.1` and a Web profile — the pocket renders inside the composer. Windows, macOS and Linux run the same code; the interface language follows the DSH setting. The desktop client is untested.
62
+
63
+ ## Links
64
+
65
+ - Product page: https://www.dshtoolbox.com/plugins/dsh-prompt-pocket/
66
+ - Chinese page: https://www.dshtoolbox.com/zh/plugins/dsh-prompt-pocket/
67
+ - npm: https://www.npmjs.com/package/dsh-prompt-pocket
68
+ - Manual: [docs/DETAIL.md](docs/DETAIL.md) (English) · [docs/DETAIL.zh.md](docs/DETAIL.zh.md) (中文)
69
+
70
+ MIT.
package/README.zh.md CHANGED
@@ -1,36 +1,70 @@
1
- # dsh-prompt-pocket
2
-
3
- **浮在 DeepSeek Harness 角落的提示词口袋。** 按 `Ctrl+Shift+S`,正在打的草稿就存进去了;点一条,它回到光标处。
4
-
5
- **界面里不多出任何东西**——没有侧栏入口,没有输入框上方那排胶囊,没有会挤压对话的面板。只有一枚 24px 的圆点,能拖到任何位置。
6
-
7
- ## 安装
8
-
9
- ```bash
10
- dsh plugin --profile web add dsh-prompt-pocket
11
- ```
12
-
13
- 重启一次宿主,然后按 `Ctrl+Shift+R` 强制刷新页面。
14
-
15
- ## 用法
16
-
17
- | 动作 | 按键 |
18
- | --- | --- |
19
- | 存选区;没选中时存整段草稿 | `Ctrl+Shift+S` |
20
- | 打开口袋 | `Ctrl+Shift+P` |
21
- | 把一条插到光标处 | 选中后 `Enter` |
22
- | 用这条替换整段草稿 | `Alt+Enter` |
23
-
24
- 写成 DSH 提示词是按需的:存完的提示行和每条的星标会给出原文与结果的对比,生成失败绝不覆盖原文。
25
-
26
- 两个抽屉:**此项目**(同一个 workspace 下的所有会话)、**通用**(到哪儿都在)。保存从不弹窗。
27
-
28
- ## 数据
29
-
30
- `$DSH_HOME/dsh-prompt-stash/store.json`——单文件,原子写,最多 500 条,满了先淘汰最久没用的。
31
-
32
- 模型通过 `prompt_stash` 工具读写同一个口袋。
33
-
34
- ## 许可
35
-
36
- MIT
1
+ # dsh-prompt-pocket
2
+
3
+ **给 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) 用的提示词口袋:一个快捷键存下你正在打的字,一次点击把它插回光标处。** 它就是角落里一枚 24px 的圆点,界面不会因此长出一条侧栏、一排胶囊,或者一个挤压对话的面板。
4
+
5
+ ![提示词口袋展开在会话上方:搜索框、两个抽屉、三条已存提示词,右下角是那颗圆点](https://raw.githubusercontent.com/FindSomeSkills/dsh-prompt-pocket/main/docs/images/zh-panel.png)
6
+
7
+ 站点:**[dshtoolbox.com/zh/plugins/dsh-prompt-pocket](https://www.dshtoolbox.com/zh/plugins/dsh-prompt-pocket/)** · English: [dshtoolbox.com/plugins/dsh-prompt-pocket](https://www.dshtoolbox.com/plugins/dsh-prompt-pocket/) · npm: [dsh-prompt-pocket](https://www.npmjs.com/package/dsh-prompt-pocket)
8
+
9
+ ## 为什么做这个
10
+
11
+ 提示词库要先让你起标题、打标签、建文件夹、开面板,然后才肯收下一句话。等你填完,那句话已经忘了。这个不填,直接收。
12
+
13
+ ## 别处没有的几件事
14
+
15
+ - **`Ctrl+Shift+S` 存,不弹窗。** 有选中存选中,没选中存整段草稿。不起标题、不选标签、不问放哪。
16
+ - **面板关着也能看见存到哪了。** 圆点旁边出一条两秒的提示,带「改存另一档」和「写成 DSH 提示词」两个按钮。
17
+ - **插入走输入框的修订号保护,不是拼字符串。** 你已经插的引用 chip、挂的附件都留在原地,插入是一步撤销,插完焦点回到输入框。
18
+ - **两个抽屉按 workspace 分,不按会话分。** 会话会归档、会 fork,绑在会话上的提示词那天就没了家;没有 workspace 的裸会话退成通用,而不是给你一个空标签页。
19
+ - **✦ 写的是 DSH 提示词,不是同义改写。** `{{变量}}`、路径、URL、代码块原样保留,没说过的东西不编,套话在被禁之列。失败或空结果绝不覆盖原文;接受新版本时旧文本留在 `prior` 里,一键退回。
20
+ - **AI 回复一键存原文。** 从会话日志里只取 text 块,工具调用不会漏进提示词。
21
+ - **模型共用同一个口袋。** `prompt_stash` 工具读写同一份文件,且守分档,一个项目的提示词不会出现在另一个项目的回答里。
22
+ - **最多 500 条,满了淘汰最久没用的那条;一个 JSON 文件、原子写、没有运行时依赖、不需要账号。** 除了你主动点的那一次模型调用,什么都不出这台机器。
23
+
24
+ ![口袋收起时就是输入框角落一枚很淡的圆点](https://raw.githubusercontent.com/FindSomeSkills/dsh-prompt-pocket/main/docs/images/zh-pill.png)
25
+
26
+ ## 安装
27
+
28
+ ```bash
29
+ dsh plugin --profile web add dsh-prompt-pocket
30
+ ```
31
+
32
+ 装完重启一次宿主,让路由、工具和客户端 bundle 注册;然后 `Ctrl+Shift+R` 强刷页面。要从源码装:
33
+
34
+ ```bash
35
+ git clone https://github.com/FindSomeSkills/dsh-prompt-pocket
36
+ cd dsh-prompt-pocket
37
+ dsh plugin --profile web add .
38
+ ```
39
+
40
+ ## 用法
41
+
42
+ | 要做什么 | 怎么做 |
43
+ | --- | --- |
44
+ | 存选中内容或整段草稿 | `Ctrl+Shift+S` |
45
+ | 开 / 关面板 | `Ctrl+Shift+P`,或点圆点 |
46
+ | 挪圆点 | 按住拖;位置按浏览器记住 |
47
+ | 插到光标处 | `Enter`,或直接点那一行 |
48
+ | 整段替换 | 选中行后 `Alt+Enter` |
49
+ | 上下选 | `↑` `↓`(循环),`Esc` 关 |
50
+ | 在两个档之间挪 | 行尾 `⇄` |
51
+ | 删除 | 行尾 `×` |
52
+ | 写成 DSH 提示词 | 行尾 `✦`,或存完提示里的按钮 |
53
+ | 存一条 AI 回复 | 回复动作行的 `⤓` |
54
+
55
+ ## 数据在哪
56
+
57
+ `$DSH_HOME/dsh-prompt-stash/store.json`,默认 `~/.dsh/dsh-prompt-stash/store.json`。一个文件,所有 profile、所有连到这台机器的浏览器共用;写入走临时文件 + rename,文件坏了会改名成 `.corrupt-<时间戳>.bak`,不会挡住面板。
58
+
59
+ ## 运行要求
60
+
61
+ DeepSeek Harness `>= 0.2.0-rc.1`,Web profile——口袋渲染在输入框里。Windows、macOS、Linux 跑同一份代码;界面语言跟随 DSH 的设置。桌面客户端没验证过。
62
+
63
+ ## 链接
64
+
65
+ - 产品页:https://www.dshtoolbox.com/zh/plugins/dsh-prompt-pocket/
66
+ - 英文页:https://www.dshtoolbox.com/plugins/dsh-prompt-pocket/
67
+ - npm:https://www.npmjs.com/package/dsh-prompt-pocket
68
+ - 使用手册:[docs/DETAIL.zh.md](docs/DETAIL.zh.md) · [docs/DETAIL.md](docs/DETAIL.md)
69
+
70
+ MIT。
package/client.js CHANGED
@@ -1,5 +1,5 @@
1
1
  window.__ModuleLoader__.load({
2
- id: 'dsh-prompt-stash',
2
+ id: 'dsh-prompt-pocket',
3
3
  factory(require) {
4
4
  const React = require('react');
5
5
  const { createPortal } = require('react-dom');
@@ -963,7 +963,7 @@ window.__ModuleLoader__.load({
963
963
  const t = ctx.locale.bind(NS);
964
964
  const Bound = (props) => h(Pocket, { ...props, t });
965
965
  ctx.slots.inject('conversation.input.overlay', () =>
966
- ctx.slots.register({ name: 'conversation.input.overlay', id: 'dsh-prompt-stash', order: 20 }, Bound)
966
+ ctx.slots.register({ name: 'conversation.input.overlay', id: 'dsh-prompt-pocket', order: 20 }, Bound)
967
967
  );
968
968
  const ReplyBound = (props) => h(ReplySaveAction, { ...props, t });
969
969
  ctx.slots.inject('conversation.chat.assistant-actions', () =>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-prompt-pocket",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "A prompt pocket that floats in the corner: save the draft or the selected text with Ctrl+Shift+S, click a saved prompt to drop it back at the caret.",
@@ -1,133 +1,133 @@
1
- // Client-half regression: loads the real bundle, checks both slot registrations,
2
- // the i18n parity, and that the pocket renders without touching the network.
3
- // Run: node scripts/client-smoke.mjs
4
- import assert from 'node:assert/strict';
5
-
6
- const ok = [];
7
- const pass = (n) => ok.push(n);
8
-
9
- function useState(init) {
10
- return [typeof init === 'function' ? init() : init, () => {}];
11
- }
12
- function useEffect() {}
13
- function useMemo(fn) {
14
- return fn();
15
- }
16
- function useCallback(fn) {
17
- return fn;
18
- }
19
- function useRef(v) {
20
- return { current: v === undefined ? null : v };
21
- }
22
- function createElement(type, props, ...children) {
23
- return { type, props: props || {}, children: children.flat() };
24
- }
25
-
26
- const React = { createElement, useState, useEffect, useMemo, useCallback, useRef };
27
- const ReactDom = { createPortal: (node, container) => ({ type: 'portal', container, node }) };
28
-
29
- let loaded = null;
30
- globalThis.window = {
31
- innerWidth: 1200,
32
- innerHeight: 800,
33
- getSelection: () => ({ toString: () => '' }),
34
- __ModuleLoader__: { load: (c) => (loaded = c) },
35
- };
36
- globalThis.document = { body: {}, addEventListener() {}, removeEventListener() {} };
37
- const store = {};
38
- globalThis.localStorage = {
39
- getItem: (k) => (k in store ? store[k] : null),
40
- setItem: (k, v) => {
41
- store[k] = String(v);
42
- },
43
- removeItem: (k) => {
44
- delete store[k];
45
- },
46
- };
47
- let fetchCalls = 0;
48
- globalThis.fetch = () => {
49
- fetchCalls += 1;
50
- return Promise.reject(new Error('no network in test'));
51
- };
52
-
53
- await import('../client.js');
54
-
55
- assert.ok(loaded, 'bundle 应调用 __ModuleLoader__.load');
56
- assert.equal(loaded.id, 'dsh-prompt-stash');
57
- pass('bundle 以正确 id 注册');
58
-
59
- const mod = loaded.factory((name) => {
60
- if (name === 'react') return React;
61
- if (name === 'react-dom') return ReactDom;
62
- throw new Error('unexpected import: ' + name);
63
- });
64
- assert.equal(typeof mod.apply, 'function');
65
- assert.deepEqual(mod.inject, ['slots', 'locale']);
66
- pass('factory 返回 apply 与 slots/locale 注入声明');
67
-
68
- const slots = [];
69
- let dict = null;
70
- mod.apply({
71
- effect(fn) {
72
- return fn();
73
- },
74
- locale: {
75
- register(ns, d) {
76
- dict = { ns, d };
77
- return () => {};
78
- },
79
- bind() {
80
- return (k) => k;
81
- },
82
- },
83
- slots: {
84
- inject(name, fn) {
85
- return fn();
86
- },
87
- register(meta, component) {
88
- slots.push({ meta, component });
89
- return () => {};
90
- },
91
- },
92
- });
93
-
94
- assert.equal(slots.length, 2, '应当挂两个位置:输入框浮层 + 回复动作');
95
- assert.equal(slots[0].meta.name, 'conversation.input.overlay');
96
- assert.equal(slots[0].meta.id, 'dsh-prompt-stash');
97
- assert.equal(slots[1].meta.name, 'conversation.chat.assistant-actions');
98
- assert.equal(slots[1].meta.order, 30);
99
- pass('挂到输入框浮层与回复动作行');
100
-
101
- assert.ok(dict && dict.d.zh && dict.d.en, '中英两套字典都要有');
102
- assert.equal(Object.keys(dict.d.zh).length, Object.keys(dict.d.en).length, '中英条目数一致');
103
- pass('中英字典条目对齐');
104
-
105
- const props = {
106
- sessionId: 'session-a',
107
- useInput: () => '',
108
- useWorkspaces: () => [],
109
- inputActions: {
110
- captureInsertion: () => ({ draftRev: 1 }),
111
- insertText: () => true,
112
- setDraft: () => {},
113
- focus: () => {},
114
- },
115
- };
116
-
117
- const outer = slots[0].component(props);
118
- const rendered = outer.type(outer.props);
119
- const tree = JSON.stringify(rendered);
120
- assert.ok(tree.includes('data-dsh-prompt-stash'), '浮点要带自己的标记');
121
- assert.ok(tree.includes('portal'), '固定定位必须 portal 到 body');
122
- assert.equal(fetchCalls, 0, '渲染期不该发请求');
123
- pass('渲染出可拖动的浮点并 portal 到 body');
124
-
125
- // The reply action must not fire a request until it is clicked.
126
- const actionOuter = slots[1].component({ sessionId: 'session-a', messageId: 'm-1', useWorkspaces: () => [] });
127
- const action = actionOuter.type(actionOuter.props);
128
- assert.equal(JSON.stringify(action).includes('button'), true);
129
- assert.equal(fetchCalls, 0, '回复按钮点之前不发请求');
130
- pass('回复动作渲染时不发请求');
131
-
132
- console.log('通过 ' + ok.length + ' 项:');
133
- ok.forEach((n, i) => console.log(' ' + (i + 1) + '. ' + n));
1
+ // Client-half regression: loads the real bundle, checks both slot registrations,
2
+ // the i18n parity, and that the pocket renders without touching the network.
3
+ // Run: node scripts/client-smoke.mjs
4
+ import assert from 'node:assert/strict';
5
+
6
+ const ok = [];
7
+ const pass = (n) => ok.push(n);
8
+
9
+ function useState(init) {
10
+ return [typeof init === 'function' ? init() : init, () => {}];
11
+ }
12
+ function useEffect() {}
13
+ function useMemo(fn) {
14
+ return fn();
15
+ }
16
+ function useCallback(fn) {
17
+ return fn;
18
+ }
19
+ function useRef(v) {
20
+ return { current: v === undefined ? null : v };
21
+ }
22
+ function createElement(type, props, ...children) {
23
+ return { type, props: props || {}, children: children.flat() };
24
+ }
25
+
26
+ const React = { createElement, useState, useEffect, useMemo, useCallback, useRef };
27
+ const ReactDom = { createPortal: (node, container) => ({ type: 'portal', container, node }) };
28
+
29
+ let loaded = null;
30
+ globalThis.window = {
31
+ innerWidth: 1200,
32
+ innerHeight: 800,
33
+ getSelection: () => ({ toString: () => '' }),
34
+ __ModuleLoader__: { load: (c) => (loaded = c) },
35
+ };
36
+ globalThis.document = { body: {}, addEventListener() {}, removeEventListener() {} };
37
+ const store = {};
38
+ globalThis.localStorage = {
39
+ getItem: (k) => (k in store ? store[k] : null),
40
+ setItem: (k, v) => {
41
+ store[k] = String(v);
42
+ },
43
+ removeItem: (k) => {
44
+ delete store[k];
45
+ },
46
+ };
47
+ let fetchCalls = 0;
48
+ globalThis.fetch = () => {
49
+ fetchCalls += 1;
50
+ return Promise.reject(new Error('no network in test'));
51
+ };
52
+
53
+ await import('../client.js');
54
+
55
+ assert.ok(loaded, 'bundle 应调用 __ModuleLoader__.load');
56
+ assert.equal(loaded.id, 'dsh-prompt-pocket');
57
+ pass('bundle 以正确 id 注册');
58
+
59
+ const mod = loaded.factory((name) => {
60
+ if (name === 'react') return React;
61
+ if (name === 'react-dom') return ReactDom;
62
+ throw new Error('unexpected import: ' + name);
63
+ });
64
+ assert.equal(typeof mod.apply, 'function');
65
+ assert.deepEqual(mod.inject, ['slots', 'locale']);
66
+ pass('factory 返回 apply 与 slots/locale 注入声明');
67
+
68
+ const slots = [];
69
+ let dict = null;
70
+ mod.apply({
71
+ effect(fn) {
72
+ return fn();
73
+ },
74
+ locale: {
75
+ register(ns, d) {
76
+ dict = { ns, d };
77
+ return () => {};
78
+ },
79
+ bind() {
80
+ return (k) => k;
81
+ },
82
+ },
83
+ slots: {
84
+ inject(name, fn) {
85
+ return fn();
86
+ },
87
+ register(meta, component) {
88
+ slots.push({ meta, component });
89
+ return () => {};
90
+ },
91
+ },
92
+ });
93
+
94
+ assert.equal(slots.length, 2, '应当挂两个位置:输入框浮层 + 回复动作');
95
+ assert.equal(slots[0].meta.name, 'conversation.input.overlay');
96
+ assert.equal(slots[0].meta.id, 'dsh-prompt-pocket');
97
+ assert.equal(slots[1].meta.name, 'conversation.chat.assistant-actions');
98
+ assert.equal(slots[1].meta.order, 30);
99
+ pass('挂到输入框浮层与回复动作行');
100
+
101
+ assert.ok(dict && dict.d.zh && dict.d.en, '中英两套字典都要有');
102
+ assert.equal(Object.keys(dict.d.zh).length, Object.keys(dict.d.en).length, '中英条目数一致');
103
+ pass('中英字典条目对齐');
104
+
105
+ const props = {
106
+ sessionId: 'session-a',
107
+ useInput: () => '',
108
+ useWorkspaces: () => [],
109
+ inputActions: {
110
+ captureInsertion: () => ({ draftRev: 1 }),
111
+ insertText: () => true,
112
+ setDraft: () => {},
113
+ focus: () => {},
114
+ },
115
+ };
116
+
117
+ const outer = slots[0].component(props);
118
+ const rendered = outer.type(outer.props);
119
+ const tree = JSON.stringify(rendered);
120
+ assert.ok(tree.includes('data-dsh-prompt-stash'), '浮点要带自己的标记');
121
+ assert.ok(tree.includes('portal'), '固定定位必须 portal 到 body');
122
+ assert.equal(fetchCalls, 0, '渲染期不该发请求');
123
+ pass('渲染出可拖动的浮点并 portal 到 body');
124
+
125
+ // The reply action must not fire a request until it is clicked.
126
+ const actionOuter = slots[1].component({ sessionId: 'session-a', messageId: 'm-1', useWorkspaces: () => [] });
127
+ const action = actionOuter.type(actionOuter.props);
128
+ assert.equal(JSON.stringify(action).includes('button'), true);
129
+ assert.equal(fetchCalls, 0, '回复按钮点之前不发请求');
130
+ pass('回复动作渲染时不发请求');
131
+
132
+ console.log('通过 ' + ok.length + ' 项:');
133
+ ok.forEach((n, i) => console.log(' ' + (i + 1) + '. ' + n));