@deepseek-ai/dsh-message-quotes 0.0.0-stage → 0.2.2-alpha.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/LICENSE +21 -0
- package/README.i18n.yaml +46 -0
- package/README.md +82 -2
- package/README.zh.md +83 -0
- package/lib/client.js +200 -0
- package/lib/index.js +6 -0
- package/lib/types/client/QuoteSelection.d.ts +8 -0
- package/lib/types/client/QuotedUserText.d.ts +8 -0
- package/lib/types/client/index.d.ts +20 -0
- package/lib/types/client/locales.d.ts +36 -0
- package/lib/types/client/quote-rule.d.ts +11 -0
- package/lib/types/client/quote-text.d.ts +19 -0
- package/lib/types/index.d.ts +4 -0
- package/locale/de.json +6 -0
- package/locale/en.json +6 -0
- package/locale/es.json +6 -0
- package/locale/fr.json +6 -0
- package/locale/ja.json +6 -0
- package/locale/pt.json +6 -0
- package/locale/ru.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +65 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 DeepSeek
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.i18n.yaml
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Bilingual-pair consistency record for README.md (docs/i18n/README.md): per heading
|
|
2
|
+
# section, a hash of its English and Chinese blocks outside code blocks and generated regions.
|
|
3
|
+
# After editing either side, bring the other along and re-record with:
|
|
4
|
+
# pnpm run verify-translation-pairing --write packages/session/message-quotes/README.md
|
|
5
|
+
/:
|
|
6
|
+
en: 3747c4c75b3f49e0
|
|
7
|
+
zh: 5b0b9248cb91d91b
|
|
8
|
+
/deepseek-ai-dsh-message-quotes:
|
|
9
|
+
en: a98d2b6bfee45c56
|
|
10
|
+
zh: 853c079ed4cdae27
|
|
11
|
+
/deepseek-ai-dsh-message-quotes/summary:
|
|
12
|
+
en: a4646537fb9c8371
|
|
13
|
+
zh: d4a008fe576720c6
|
|
14
|
+
/deepseek-ai-dsh-message-quotes/table-of-contents:
|
|
15
|
+
en: d152484eb41ac6b4
|
|
16
|
+
zh: 405b30feaf48c087
|
|
17
|
+
/deepseek-ai-dsh-message-quotes/use-this-package:
|
|
18
|
+
en: 5a2c3edf0a026abe
|
|
19
|
+
zh: aec2f54b6d833591
|
|
20
|
+
/deepseek-ai-dsh-message-quotes/understand-the-implementation:
|
|
21
|
+
en: e5c91bdecff724e5
|
|
22
|
+
zh: 655c2528d111ac32
|
|
23
|
+
/deepseek-ai-dsh-message-quotes/further-exploration:
|
|
24
|
+
en: bcf07b5197b746ce
|
|
25
|
+
zh: 206f79eb606baac7
|
|
26
|
+
/deepseek-ai-dsh-message-quotes/model-experience:
|
|
27
|
+
en: 215e7ba838619b7b
|
|
28
|
+
zh: a311da3843709f90
|
|
29
|
+
/deepseek-ai-dsh-message-quotes/model-experience/quoted-message-text:
|
|
30
|
+
en: 4570ae90b328ddf5
|
|
31
|
+
zh: 5c2c95075c5e0fa4
|
|
32
|
+
/deepseek-ai-dsh-message-quotes/model-experience/quoted-message-text/what-the-model-sees:
|
|
33
|
+
en: 913152fe14c493f6
|
|
34
|
+
zh: 3bdf114beaff1e04
|
|
35
|
+
/deepseek-ai-dsh-message-quotes/model-experience/quoted-message-text/token-effect:
|
|
36
|
+
en: af92deb8bf69432b
|
|
37
|
+
zh: 2582520fcb9b982e
|
|
38
|
+
/deepseek-ai-dsh-message-quotes/model-experience/quoted-message-text/kv-cache-effect:
|
|
39
|
+
en: 626c54bc58b74f8f
|
|
40
|
+
zh: 82a5a8a445734d64
|
|
41
|
+
/deepseek-ai-dsh-message-quotes/known-limitations-and-deferred-work:
|
|
42
|
+
en: 4d2c9783f0268d55
|
|
43
|
+
zh: 40d6d48ceed3194c
|
|
44
|
+
/deepseek-ai-dsh-message-quotes/known-limitations-and-deferred-work/dev-note:
|
|
45
|
+
en: e67f633dc6fe7773
|
|
46
|
+
zh: 8ec3e73528ddb1a6
|
package/README.md
CHANGED
|
@@ -1,3 +1,83 @@
|
|
|
1
|
-
|
|
1
|
+
---
|
|
2
|
+
description: "Quotation controls and Markdown blockquote presentation."
|
|
3
|
+
kind: "package-reference"
|
|
4
|
+
---
|
|
2
5
|
|
|
3
|
-
|
|
6
|
+
# @deepseek-ai/dsh-message-quotes
|
|
7
|
+
|
|
8
|
+
English | [中文](README.zh.md)
|
|
9
|
+
|
|
10
|
+
## Summary
|
|
11
|
+
|
|
12
|
+
`dsh-message-quotes` registers quotation controls and transcript rendering on the Client. Messages retain ordinary Markdown text without quote metadata or content indexes.
|
|
13
|
+
|
|
14
|
+
## Table of Contents
|
|
15
|
+
|
|
16
|
+
- [Use this package](#use-this-package)
|
|
17
|
+
- [Understand the implementation](#understand-the-implementation)
|
|
18
|
+
- [Further Exploration](#further-exploration)
|
|
19
|
+
- [Model Experience](#model-experience)
|
|
20
|
+
- [Known Limitations and Deferred Work](#known-limitations-and-deferred-work)
|
|
21
|
+
- [Dev Note](#dev-note)
|
|
22
|
+
|
|
23
|
+
-----
|
|
24
|
+
|
|
25
|
+
<a id="use-this-package"></a>
|
|
26
|
+
## Use this package
|
|
27
|
+
|
|
28
|
+
The Web bundle mounts this plugin. Its Client entry registers the selection action with `ctx.uiConversation.interactions` and renders quotes through UserText rules. Registrations are removed when the plugin unloads. The selection button uses the shared floating-surface stroke and shadow.
|
|
29
|
+
|
|
30
|
+
-----
|
|
31
|
+
|
|
32
|
+
<a id="understand-the-implementation"></a>
|
|
33
|
+
## Understand the implementation
|
|
34
|
+
|
|
35
|
+
<details>
|
|
36
|
+
<summary>Implementation internals — click to expand</summary>
|
|
37
|
+
|
|
38
|
+
The shared [Markdown formatter](../../client/ui-primitives/README.md#rendering-agent-output) encodes quoted text for the composer. The plugin owns [quote recognition and decoding](src/client/quote-text.ts). Quote previews render their contents as plain text, including recognized Session labels, with uniform typography and no reference-chip decoration. Selection eligibility, local positioning, and dismissal belong to the conversation interaction service; the quote action extracts its text from the DOM. The composer owns QuoteNode editing and serialization.
|
|
39
|
+
|
|
40
|
+
</details>
|
|
41
|
+
|
|
42
|
+
-----
|
|
43
|
+
|
|
44
|
+
<a id="further-exploration"></a>
|
|
45
|
+
## Further Exploration
|
|
46
|
+
|
|
47
|
+
- [Session package map](../README.md) — related persistence and projection packages.
|
|
48
|
+
- [Conversation subsystem](../../../docs/subsystems/conversation.md) — composer and transcript consumers.
|
|
49
|
+
|
|
50
|
+
-----
|
|
51
|
+
|
|
52
|
+
<a id="model-experience"></a>
|
|
53
|
+
## Model Experience
|
|
54
|
+
|
|
55
|
+
### Quoted message text
|
|
56
|
+
|
|
57
|
+
#### What the model sees
|
|
58
|
+
|
|
59
|
+
The composer sends selected text as ordinary Markdown blockquotes, with one `> ` prefix per line. Session-reference and skill processing applies normally to quoted text.
|
|
60
|
+
|
|
61
|
+
#### Token effect
|
|
62
|
+
|
|
63
|
+
Quote text and its line prefixes contribute ordinary input tokens.
|
|
64
|
+
|
|
65
|
+
#### KV Cache effect
|
|
66
|
+
|
|
67
|
+
The plugin rewrites no history. Consumers append the encoded text as user content after the existing prefix.
|
|
68
|
+
|
|
69
|
+
## Known Limitations and Deferred Work
|
|
70
|
+
|
|
71
|
+
<a id="known-limitations-and-deferred-work"></a>
|
|
72
|
+
|
|
73
|
+
- Recognition covers explicitly marked lines with up to three leading spaces; it does not implement Markdown lazy continuation or fenced-code parsing.
|
|
74
|
+
|
|
75
|
+
<a id="dev-note"></a>
|
|
76
|
+
### Dev Note
|
|
77
|
+
|
|
78
|
+
<details>
|
|
79
|
+
<summary>Working context for maintainers — click to expand</summary>
|
|
80
|
+
|
|
81
|
+
None.
|
|
82
|
+
|
|
83
|
+
</details>
|
package/README.zh.md
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "提供引用控件与 Markdown blockquote 展示的插件。"
|
|
3
|
+
kind: "package-reference"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# @deepseek-ai/dsh-message-quotes
|
|
7
|
+
|
|
8
|
+
[English](README.md) | 中文
|
|
9
|
+
|
|
10
|
+
## 概述
|
|
11
|
+
|
|
12
|
+
`dsh-message-quotes` 在 Client 注册引用控件和转录渲染。消息保留普通 Markdown 文本,无需 quote 元数据或 content 索引。
|
|
13
|
+
|
|
14
|
+
## 目录
|
|
15
|
+
|
|
16
|
+
- [使用本包](#use-this-package)
|
|
17
|
+
- [理解实现](#understand-the-implementation)
|
|
18
|
+
- [延伸阅读](#further-exploration)
|
|
19
|
+
- [模型体验](#model-experience)
|
|
20
|
+
- [已知限制与后续工作](#known-limitations-and-deferred-work)
|
|
21
|
+
- [开发备注](#dev-note)
|
|
22
|
+
|
|
23
|
+
-----
|
|
24
|
+
|
|
25
|
+
<a id="use-this-package"></a>
|
|
26
|
+
## 使用本包
|
|
27
|
+
|
|
28
|
+
Web bundle 挂载此插件。Client 入口向 `ctx.uiConversation.interactions` 注册选区操作,并通过 UserText 规则渲染引用。插件卸载时会移除这些注册。选区按钮使用共享浮层描边与阴影。
|
|
29
|
+
|
|
30
|
+
-----
|
|
31
|
+
|
|
32
|
+
<a id="understand-the-implementation"></a>
|
|
33
|
+
## 理解实现
|
|
34
|
+
|
|
35
|
+
<details>
|
|
36
|
+
<summary>实现细节 — 点击展开</summary>
|
|
37
|
+
|
|
38
|
+
输入框使用共享的 [Markdown 格式化工具](../../client/ui-primitives/README.zh.md#rendering-agent-output) 编码引用文本;插件负责[引用识别与解码](src/client/quote-text.ts)。Quote 预览将正文及已识别的 Session 标签作为纯文本呈现,统一文字样式,不展示 reference chip 装饰。选区是否可操作、原地定位与关闭由 conversation 交互服务负责;引用操作从 DOM 提取文本。输入框负责 QuoteNode 编辑和序列化。
|
|
39
|
+
|
|
40
|
+
</details>
|
|
41
|
+
|
|
42
|
+
-----
|
|
43
|
+
|
|
44
|
+
<a id="further-exploration"></a>
|
|
45
|
+
## 延伸阅读
|
|
46
|
+
|
|
47
|
+
- [Session 包索引](../README.zh.md) — 相关持久化和投影包。
|
|
48
|
+
- [Conversation 子系统](../../../docs/subsystems/conversation.zh.md) — 编辑器和对话呈现消费方。
|
|
49
|
+
|
|
50
|
+
-----
|
|
51
|
+
|
|
52
|
+
<a id="model-experience"></a>
|
|
53
|
+
## 模型体验
|
|
54
|
+
|
|
55
|
+
### 引用消息文本
|
|
56
|
+
|
|
57
|
+
#### 模型可见内容
|
|
58
|
+
|
|
59
|
+
输入框将选中文本作为普通 Markdown blockquote 发送,每行带一个 `> ` 前缀。Session-reference 与 skill 处理照常作用于引用文本。
|
|
60
|
+
|
|
61
|
+
#### Token 影响
|
|
62
|
+
|
|
63
|
+
引用文本及其行前缀贡献普通输入 token。
|
|
64
|
+
|
|
65
|
+
#### KV Cache 影响
|
|
66
|
+
|
|
67
|
+
该插件不改写历史。消费方将编码文本作为用户内容追加到现有前缀之后。
|
|
68
|
+
|
|
69
|
+
## 已知限制与后续工作
|
|
70
|
+
|
|
71
|
+
<a id="known-limitations-and-deferred-work"></a>
|
|
72
|
+
|
|
73
|
+
- 识别范围为最多带三个前导空格的显式引用行;不实现 Markdown 懒惰续行或代码围栏解析。
|
|
74
|
+
|
|
75
|
+
<a id="dev-note"></a>
|
|
76
|
+
### 开发备注
|
|
77
|
+
|
|
78
|
+
<details>
|
|
79
|
+
<summary>维护者工作上下文 — 点击展开</summary>
|
|
80
|
+
|
|
81
|
+
无。
|
|
82
|
+
|
|
83
|
+
</details>
|
package/lib/client.js
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
window.__ModuleLoader__.load({
|
|
2
|
+
id: "@deepseek-ai/dsh-message-quotes",
|
|
3
|
+
factory: (require) => {
|
|
4
|
+
var module = { exports: {} };
|
|
5
|
+
var exports = module.exports;
|
|
6
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
7
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
|
+
let react = require("react");
|
|
9
|
+
let _deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
10
|
+
//#region \0dsh-css:/home/runner/work/deepseek-harness/deepseek-harness/packages/session/message-quotes/src/client/QuoteSelection.module.css.mjs
|
|
11
|
+
const css = ".CFlEEG_action{corner-shape:round;background:var(--dsw-alias-button-floating-fill);--dsw-elevation-stroke-color:var(--dsw-alias-border-l3);box-shadow:var(--dsw-elevation-panel);color:var(--dsw-alias-label-primary);font:var(--dsw-font-xs-13);cursor:pointer;border:none;border-radius:999px;padding:5px 10px}.CFlEEG_action:focus-visible{background:var(--dsw-alias-button-floating-hover)}@media (hover:hover){.CFlEEG_action:hover{background:var(--dsw-alias-button-floating-hover)}}";
|
|
12
|
+
const tagId = "@deepseek-ai/dsh-message-quotes/QuoteSelection.module.css";
|
|
13
|
+
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
|
|
14
|
+
const tag = document.createElement("style");
|
|
15
|
+
tag.dataset.plugin = "@deepseek-ai/dsh-message-quotes";
|
|
16
|
+
tag.dataset.pluginCss = tagId;
|
|
17
|
+
tag.textContent = css;
|
|
18
|
+
document.head.appendChild(tag);
|
|
19
|
+
}
|
|
20
|
+
var QuoteSelection_module_css_default = { "action": "CFlEEG_action" };
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region lib/types/client/QuoteSelection.js
|
|
23
|
+
/** Quote action rendered through the Chat text-interaction Slot. */
|
|
24
|
+
/**
|
|
25
|
+
* Render the action for a selection admitted by the Quote plugin.
|
|
26
|
+
* @param props - area-local text interaction and standard Session/composer seats.
|
|
27
|
+
* @returns the quote button after a valid selection in a writable conversation.
|
|
28
|
+
*/
|
|
29
|
+
function QuoteSelectionAction({ dismiss, readText, clearSelection, inputActions, useSession, t }) {
|
|
30
|
+
const enabled = useSession((s) => !s.removed && (s.subagent === null || s.subagent.address.mode === "continuable" && s.subagent.parentAvailable === true));
|
|
31
|
+
(0, react.useEffect)(() => {
|
|
32
|
+
if (!enabled) dismiss();
|
|
33
|
+
}, [enabled, dismiss]);
|
|
34
|
+
if (!enabled) return null;
|
|
35
|
+
return (0, react_jsx_runtime.jsx)("button", {
|
|
36
|
+
type: "button",
|
|
37
|
+
className: QuoteSelection_module_css_default.action,
|
|
38
|
+
"aria-label": t("quote.add"),
|
|
39
|
+
onPointerDown: (event) => {
|
|
40
|
+
event.preventDefault();
|
|
41
|
+
},
|
|
42
|
+
onClick: () => {
|
|
43
|
+
const text = readText();
|
|
44
|
+
if (text === null) {
|
|
45
|
+
dismiss();
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (!inputActions.insertQuote(text)) return;
|
|
49
|
+
clearSelection();
|
|
50
|
+
dismiss();
|
|
51
|
+
},
|
|
52
|
+
children: t("quote.add")
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
//#endregion
|
|
56
|
+
//#region lib/types/client/QuotedUserText.js
|
|
57
|
+
/** Literal display for text-derived quote nodes. */
|
|
58
|
+
/**
|
|
59
|
+
* Display decoded quote text without further interpretation.
|
|
60
|
+
* @param props - the quote node produced by the registered blockquote matcher.
|
|
61
|
+
* @returns the shared literal excerpt and clipped full-text popover.
|
|
62
|
+
*/
|
|
63
|
+
function QuotedUserText({ node }) {
|
|
64
|
+
return (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.QuotePreview, { text: node.data.text });
|
|
65
|
+
}
|
|
66
|
+
//#endregion
|
|
67
|
+
//#region lib/types/client/quote-text.js
|
|
68
|
+
/** Explicit blockquote recognition and decoding for quote presentation. */
|
|
69
|
+
/**
|
|
70
|
+
* Remove one blockquote marker from each explicitly quoted line.
|
|
71
|
+
* @param text - consecutive blockquote lines, with up to three leading spaces.
|
|
72
|
+
* @returns excerpt text with original line endings normalized.
|
|
73
|
+
*/
|
|
74
|
+
function quoteTextOf(text) {
|
|
75
|
+
return text.replace(/\r\n?/gu, "\n").replace(/^ {0,3}>[ \t]?/gmu, "");
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Recognize consecutive explicitly marked Markdown blockquote lines.
|
|
79
|
+
* @param text - complete original message text.
|
|
80
|
+
* @returns ordered nonblank quote spans; inline greater-than signs remain ordinary text.
|
|
81
|
+
*/
|
|
82
|
+
function messageQuoteRanges(text) {
|
|
83
|
+
const ranges = [];
|
|
84
|
+
for (const match of text.matchAll(/^ {0,3}>[^\r\n]*(?:\r?\n {0,3}>[^\r\n]*)*/gmu)) if (quoteTextOf(match[0]).trim() !== "") ranges.push({
|
|
85
|
+
start: match.index,
|
|
86
|
+
end: match.index + match[0].length
|
|
87
|
+
});
|
|
88
|
+
return ranges;
|
|
89
|
+
}
|
|
90
|
+
//#endregion
|
|
91
|
+
//#region lib/types/client/quote-rule.js
|
|
92
|
+
/** Markdown blockquotes produce atomic quote nodes and inline separator replacements. */
|
|
93
|
+
/** Recognize blockquote lines and display adjacent paragraph separators as inline spaces. */
|
|
94
|
+
const quoteRule = {
|
|
95
|
+
id: "quote",
|
|
96
|
+
order: -10,
|
|
97
|
+
match(text, from) {
|
|
98
|
+
for (const range of messageQuoteRanges(text)) for (const start of [
|
|
99
|
+
range.start - 2,
|
|
100
|
+
range.start,
|
|
101
|
+
range.end
|
|
102
|
+
]) {
|
|
103
|
+
if (start < from) continue;
|
|
104
|
+
if (start === range.start) return {
|
|
105
|
+
id: "quote",
|
|
106
|
+
start,
|
|
107
|
+
end: range.end,
|
|
108
|
+
data: { text: quoteTextOf(text.slice(start, range.end)) }
|
|
109
|
+
};
|
|
110
|
+
if (text.slice(start, start + 2) === "\n\n") return {
|
|
111
|
+
id: "text",
|
|
112
|
+
start,
|
|
113
|
+
end: start + 2,
|
|
114
|
+
data: {
|
|
115
|
+
text: "\n\n",
|
|
116
|
+
display: " "
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
//#endregion
|
|
123
|
+
//#region lib/types/client/locales.js
|
|
124
|
+
/** Copy owned by the Quote interaction plugin. */
|
|
125
|
+
/** Quote plugin dictionary namespace. */
|
|
126
|
+
const NS = "messageQuotes";
|
|
127
|
+
/** Simplified Chinese dictionary and key source. */
|
|
128
|
+
const zh = { "quote.add": "引用文本" };
|
|
129
|
+
/** English dictionary. */
|
|
130
|
+
const en = { "quote.add": "Quote text" };
|
|
131
|
+
/** Japanese dictionary. */
|
|
132
|
+
const ja = { "quote.add": "テキストを引用" };
|
|
133
|
+
/** Spanish dictionary, checked against the English keys. */
|
|
134
|
+
const es = { "quote.add": "Texto de cotización" };
|
|
135
|
+
/** French dictionary, checked against the English keys. */
|
|
136
|
+
const fr = { "quote.add": "Texte de citation" };
|
|
137
|
+
/** German dictionary, checked against the English keys. */
|
|
138
|
+
const de = { "quote.add": "Zitattext" };
|
|
139
|
+
/** Russian dictionary, checked against the English keys. */
|
|
140
|
+
const ru = { "quote.add": "Текст цитаты" };
|
|
141
|
+
/** Portuguese dictionary, checked against the English keys. */
|
|
142
|
+
const pt = { "quote.add": "Citação de texto" };
|
|
143
|
+
//#endregion
|
|
144
|
+
//#region lib/types/client/index.js
|
|
145
|
+
/** Browser plugin name. */
|
|
146
|
+
const name = "message-quotes";
|
|
147
|
+
/** Services needed to admit selections and register Quote presentation. */
|
|
148
|
+
const inject = [
|
|
149
|
+
"slots",
|
|
150
|
+
"locale",
|
|
151
|
+
"sessions",
|
|
152
|
+
"uiConversation"
|
|
153
|
+
];
|
|
154
|
+
/**
|
|
155
|
+
* Register Quote admission, its action surface, and literal UserText rendering.
|
|
156
|
+
* @param ctx - Client root context owning every Quote contribution.
|
|
157
|
+
*/
|
|
158
|
+
function apply(ctx) {
|
|
159
|
+
ctx.effect(() => ctx.locale.register(NS, {
|
|
160
|
+
zh,
|
|
161
|
+
en,
|
|
162
|
+
ja,
|
|
163
|
+
es,
|
|
164
|
+
fr,
|
|
165
|
+
de,
|
|
166
|
+
ru,
|
|
167
|
+
pt
|
|
168
|
+
}), "message-quotes: dictionaries");
|
|
169
|
+
ctx.effect(() => ctx.uiConversation.userText.register(quoteRule), "message-quotes: UserText rule");
|
|
170
|
+
ctx.effect(() => ctx.uiConversation.interactions.register({
|
|
171
|
+
id: "quote",
|
|
172
|
+
onInteraction(request) {
|
|
173
|
+
if (request.trigger !== "selection" || request.readText() === null) return;
|
|
174
|
+
const binding = ctx.sessions.binding(request.sessionId);
|
|
175
|
+
if (binding === void 0) return;
|
|
176
|
+
const session = binding.session.getSnapshot();
|
|
177
|
+
if (session.removed || session.subagent !== null && (session.subagent.address.mode !== "continuable" || session.subagent.parentAvailable !== true)) return;
|
|
178
|
+
request.open();
|
|
179
|
+
}
|
|
180
|
+
}), "message-quotes: selection interaction");
|
|
181
|
+
ctx.slots.inject("conversation.chat.text-interaction", () => ctx.slots.register({
|
|
182
|
+
name: "conversation.chat.text-interaction",
|
|
183
|
+
key: "quote",
|
|
184
|
+
locale: NS
|
|
185
|
+
}, QuoteSelectionAction));
|
|
186
|
+
ctx.slots.inject("conversation.user.text.node", () => ctx.slots.register({
|
|
187
|
+
name: "conversation.user.text.node",
|
|
188
|
+
key: "quote",
|
|
189
|
+
priority: 100
|
|
190
|
+
}, QuotedUserText));
|
|
191
|
+
}
|
|
192
|
+
//#endregion
|
|
193
|
+
exports.apply = apply;
|
|
194
|
+
exports.inject = inject;
|
|
195
|
+
exports.name = name;
|
|
196
|
+
return module.exports;
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
//# sourceMappingURL=client.js.map
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots';
|
|
2
|
+
/**
|
|
3
|
+
* Render the action for a selection admitted by the Quote plugin.
|
|
4
|
+
* @param props - area-local text interaction and standard Session/composer seats.
|
|
5
|
+
* @returns the quote button after a valid selection in a writable conversation.
|
|
6
|
+
*/
|
|
7
|
+
export declare function QuoteSelectionAction({ dismiss, readText, clearSelection, inputActions, useSession, t }: PropsRuntime<'conversation.chat.text-interaction'> & PropsLocale<'messageQuotes'>): import("react").JSX.Element | null;
|
|
8
|
+
//# sourceMappingURL=QuoteSelection.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { UserTextNodeProps } from '@deepseek-ai/dsh-client-ui-conversation/client';
|
|
2
|
+
/**
|
|
3
|
+
* Display decoded quote text without further interpretation.
|
|
4
|
+
* @param props - the quote node produced by the registered blockquote matcher.
|
|
5
|
+
* @returns the shared literal excerpt and clipped full-text popover.
|
|
6
|
+
*/
|
|
7
|
+
export declare function QuotedUserText({ node }: UserTextNodeProps<'quote'>): import("react").JSX.Element;
|
|
8
|
+
//# sourceMappingURL=QuotedUserText.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** Quote selection actions and literal UserText excerpts registered by the browser plugin. */
|
|
2
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
3
|
+
import { type MessageQuotesKey } from './locales.ts';
|
|
4
|
+
export type {} from './quote-rule.ts';
|
|
5
|
+
declare module '@deepseek-ai/dsh-client-ui-slots' {
|
|
6
|
+
interface LocaleNamespaceMap {
|
|
7
|
+
/** Quote selection action copy. */
|
|
8
|
+
messageQuotes: MessageQuotesKey;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
/** Browser plugin name. */
|
|
12
|
+
export declare const name = "message-quotes";
|
|
13
|
+
/** Services needed to admit selections and register Quote presentation. */
|
|
14
|
+
export declare const inject: string[];
|
|
15
|
+
/**
|
|
16
|
+
* Register Quote admission, its action surface, and literal UserText rendering.
|
|
17
|
+
* @param ctx - Client root context owning every Quote contribution.
|
|
18
|
+
*/
|
|
19
|
+
export declare function apply(ctx: Context): void;
|
|
20
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/** Copy owned by the Quote interaction plugin. */
|
|
2
|
+
/** Quote plugin dictionary namespace. */
|
|
3
|
+
export declare const NS = "messageQuotes";
|
|
4
|
+
/** Simplified Chinese dictionary and key source. */
|
|
5
|
+
export declare const zh: {
|
|
6
|
+
'quote.add': string;
|
|
7
|
+
};
|
|
8
|
+
/** Supported Quote interaction copy keys. */
|
|
9
|
+
export type MessageQuotesKey = keyof typeof zh;
|
|
10
|
+
/** English dictionary. */
|
|
11
|
+
export declare const en: Record<MessageQuotesKey, string>;
|
|
12
|
+
/** Japanese dictionary. */
|
|
13
|
+
export declare const ja: {
|
|
14
|
+
'quote.add': string;
|
|
15
|
+
};
|
|
16
|
+
/** Spanish dictionary, checked against the English keys. */
|
|
17
|
+
export declare const es: {
|
|
18
|
+
'quote.add': string;
|
|
19
|
+
};
|
|
20
|
+
/** French dictionary, checked against the English keys. */
|
|
21
|
+
export declare const fr: {
|
|
22
|
+
'quote.add': string;
|
|
23
|
+
};
|
|
24
|
+
/** German dictionary, checked against the English keys. */
|
|
25
|
+
export declare const de: {
|
|
26
|
+
'quote.add': string;
|
|
27
|
+
};
|
|
28
|
+
/** Russian dictionary, checked against the English keys. */
|
|
29
|
+
export declare const ru: {
|
|
30
|
+
'quote.add': string;
|
|
31
|
+
};
|
|
32
|
+
/** Portuguese dictionary, checked against the English keys. */
|
|
33
|
+
export declare const pt: {
|
|
34
|
+
'quote.add': string;
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=locales.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { UserTextRule } from '@deepseek-ai/dsh-client-ui-conversation/client';
|
|
2
|
+
declare module '@deepseek-ai/dsh-client-ui-conversation/client' {
|
|
3
|
+
interface UserTextDataMap {
|
|
4
|
+
quote: {
|
|
5
|
+
readonly text: string;
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
/** Recognize blockquote lines and display adjacent paragraph separators as inline spaces. */
|
|
10
|
+
export declare const quoteRule: UserTextRule<'quote'>;
|
|
11
|
+
//# sourceMappingURL=quote-rule.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** Explicit blockquote recognition and decoding for quote presentation. */
|
|
2
|
+
/**
|
|
3
|
+
* Remove one blockquote marker from each explicitly quoted line.
|
|
4
|
+
* @param text - consecutive blockquote lines, with up to three leading spaces.
|
|
5
|
+
* @returns excerpt text with original line endings normalized.
|
|
6
|
+
*/
|
|
7
|
+
export declare function quoteTextOf(text: string): string;
|
|
8
|
+
/** One blockquote span in original UTF-16 text, excluding its trailing line break. */
|
|
9
|
+
export interface MessageQuoteRange {
|
|
10
|
+
readonly start: number;
|
|
11
|
+
readonly end: number;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Recognize consecutive explicitly marked Markdown blockquote lines.
|
|
15
|
+
* @param text - complete original message text.
|
|
16
|
+
* @returns ordered nonblank quote spans; inline greater-than signs remain ordinary text.
|
|
17
|
+
*/
|
|
18
|
+
export declare function messageQuoteRanges(text: string): readonly MessageQuoteRange[];
|
|
19
|
+
//# sourceMappingURL=quote-text.d.ts.map
|
package/locale/de.json
ADDED
package/locale/en.json
ADDED
package/locale/es.json
ADDED
package/locale/fr.json
ADDED
package/locale/ja.json
ADDED
package/locale/pt.json
ADDED
package/locale/ru.json
ADDED
package/locale/zh.json
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,68 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepseek-ai/dsh-message-quotes",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"description": "Selected-text quotation and Markdown blockquote presentation",
|
|
4
|
+
"version": "0.2.2-alpha.2",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/deepseek-ai/deepseek-harness.git",
|
|
11
|
+
"directory": "packages/session/message-quotes"
|
|
12
|
+
},
|
|
13
|
+
"type": "module",
|
|
14
|
+
"main": "lib/index.js",
|
|
15
|
+
"types": "lib/types/index.d.ts",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./lib/types/index.d.ts",
|
|
19
|
+
"default": "./lib/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./src/*": "./src/*",
|
|
22
|
+
"./locale/*.json": "./locale/*.json",
|
|
23
|
+
"./package.json": "./package.json",
|
|
24
|
+
"./client": {
|
|
25
|
+
"types": "./lib/types/client/index.d.ts",
|
|
26
|
+
"default": "./lib/client.js"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"locale/*.json",
|
|
31
|
+
"lib/index.js",
|
|
32
|
+
"lib/client.js",
|
|
33
|
+
"lib/types/**/*.d.ts"
|
|
34
|
+
],
|
|
35
|
+
"license": "MIT",
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"@deepseek-ai/cordis": "~4.0.6-alpha.1"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@deepseek-ai/cordis": "~4.0.6-alpha.1",
|
|
41
|
+
"@deepseek-ai/dsh-api-session-controller": "0.2.2-alpha.2",
|
|
42
|
+
"@deepseek-ai/dsh-client-locale": "0.2.2-alpha.2",
|
|
43
|
+
"@deepseek-ai/dsh-client-ui-chat": "0.2.2-alpha.2",
|
|
44
|
+
"@deepseek-ai/dsh-client-ui-conversation": "0.2.2-alpha.2",
|
|
45
|
+
"@deepseek-ai/dsh-client-ui-renderer": "0.2.2-alpha.2",
|
|
46
|
+
"@deepseek-ai/dsh-client-ui-slots": "0.2.2-alpha.2",
|
|
47
|
+
"@deepseek-ai/dsh-client-ui-primitives": "0.2.2-alpha.2",
|
|
48
|
+
"react": "^18.2.0",
|
|
49
|
+
"@deepseek-ai/dsh-client-test-runtime": "0.2.2-alpha.2",
|
|
50
|
+
"@deepseek-ai/dsh-session": "0.2.2-alpha.2"
|
|
51
|
+
},
|
|
52
|
+
"dsh": {
|
|
53
|
+
"client": {
|
|
54
|
+
"inject": [
|
|
55
|
+
"@deepseek-ai/dsh-api-session-controller",
|
|
56
|
+
"@deepseek-ai/dsh-client-locale",
|
|
57
|
+
"@deepseek-ai/dsh-client-ui-chat",
|
|
58
|
+
"@deepseek-ai/dsh-client-ui-conversation",
|
|
59
|
+
"@deepseek-ai/dsh-client-ui-renderer"
|
|
60
|
+
],
|
|
61
|
+
"platform": "web"
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"scripts": {
|
|
65
|
+
"bundle": "tsdown",
|
|
66
|
+
"watch": "tsdown --watch"
|
|
67
|
+
}
|
|
6
68
|
}
|