@michengai/dsh-btw 1.3.0 → 1.3.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/CHANGELOG.md +11 -0
- package/CHANGELOG.zh-CN.md +11 -0
- package/lib/client.js +113 -42
- package/lib/types/client/official-quote.d.ts +13 -3
- package/lib/types/client/user-quote-chip.d.ts +3 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.3.2] - 2026-11-03
|
|
4
|
+
|
|
5
|
+
- Extend host compatibility support: verified compatibility across DSH latest prerelease `0.2.2-alpha.3` and all RCs up to `0.2.1-rc.5`, ensuring seamless side-ask interaction on newer hosts.
|
|
6
|
+
|
|
7
|
+
## [1.3.1] - 2026-11-01
|
|
8
|
+
|
|
9
|
+
- Isolate quote rule ID to prevent host crash: migrate blockquote matching rule ID and slot key to dedicated `dsh-btw-blockquote` namespace instead of borrowing the official `quote` identifier, and yield dynamically at render time and on registry change when `@deepseek-ai/dsh-message-quotes` is present. Fixes fatal `Failed to load plugins` crashes on newer hosts shipping the official quote package while preserving seamless blockquote styling on older hosts (#24).
|
|
10
|
+
- Prevent user prompt text swallowing in quote prompt parsing: refine quote prompt block delimiter boundary so that text following an excerpt is never swallowed into the quote chip even when submitted without an explicit heading separator (#23).
|
|
11
|
+
- Preserve leading code indentation and support EOF quote submission: constrain separator heading to a standalone line, preserve 4-space and Tab code block indentations on the subsequent user text line, and cleanly consume delimiter headings when sending quotes with an empty draft (#23).
|
|
12
|
+
- Isolate bubble DOM structure: replace semantic `<header>` with a dedicated `div` and use a plugin-private `data-btw-phase` attribute to prevent theme macro rules (such as Codex UI mica floating headers) from accidentally styling the side-ask header as a detached floating card.
|
|
13
|
+
|
|
3
14
|
## [1.3.0] - 2026-10-29
|
|
4
15
|
|
|
5
16
|
- Configurable tool whitelist: add a settings page on the plugin's row in **Plugins** (the same place as `dsh-subagent-default-model`'s configuration) where a comma-free, one-per-line list of tool names widens what a side question may call. The execution-time guard reads the whitelist on every call, so changes apply to the next side question without reloading the plugin. Empty keeps the previous text-only behaviour (#22).
|
package/CHANGELOG.zh-CN.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# 更新日志
|
|
2
2
|
|
|
3
|
+
## [1.3.2] - 2026-11-03
|
|
4
|
+
|
|
5
|
+
- 扩展宿主兼容支持:全面通过 DSH 最新预发布版本 `0.2.2-alpha.3` 与全系 RC(覆盖至 `0.2.1-rc.5`)的兼容性回归,确保一次性只读旁问在最新宿主上平稳运行。
|
|
6
|
+
|
|
7
|
+
## [1.3.1] - 2026-11-01
|
|
8
|
+
|
|
9
|
+
- 隔离引用规则 ID 彻底避免宿主崩溃:将块引用切分规则 ID 与插槽 key 迁入专用命名空间 `dsh-btw-blockquote`,彻底停止借用官方 `quote` 标识符,并在渲染期与注册表变更事件中检测到官方 `@deepseek-ai/dsh-message-quotes` 时动态让位。彻底解决新宿主因重复注册引发的 `Failed to load plugins` 崩溃,同时确保老版本宿主继续拥有完整的引用卡片呈现能力(#24)。
|
|
10
|
+
- 修复引用后发送的消息正文被引文卡片吞噬不显示的缺陷:收敛引用提示词块的切分边界,即便消息未携带显式分隔引导词,引文末尾后的所有用户正文均能完整交回宿主渲染,不再整段消失(#23)。
|
|
11
|
+
- 严格保护正文首行代码缩进与兼容纯引用发送:将分隔符标题严格约束为独占行,完好保留紧随其后的 4 空格与制表符代码缩进;并在用户仅发送引用不键入问题时于末尾完整吞噬空标题,不再向下泄露裸文本(#23)。
|
|
12
|
+
- 隔离气泡内部 DOM 结构:将气泡标题行由原生 `<header>` 改造为 `div.btw-header`,并将根节点属性调整为私有前缀 `data-btw-phase`,防止被全局主题(如 Codex UI 云母浮动模式)的会话顶栏宏选择器误伤为独立的悬浮毛玻璃胶囊。
|
|
13
|
+
|
|
3
14
|
## [1.3.0] - 2026-10-29
|
|
4
15
|
|
|
5
16
|
- 可配置的工具白名单:在 **插件** 页本插件行新增配置页(位置与 `dsh-subagent-default-model` 的配置页相同),按行填写除 `send_message` 之外允许旁问调用的工具名。执行期闸门每次调用都重读配置,改完对下一次旁问生效,不需要重新加载插件;留空保持原先的「只允许纯文字回答」(#22)。
|
package/lib/client.js
CHANGED
|
@@ -13769,7 +13769,7 @@ function BubbleView({ item, close, t, collapsed, onToggleCollapse }) {
|
|
|
13769
13769
|
}
|
|
13770
13770
|
};
|
|
13771
13771
|
const stopOrCloseTitle = item.closeFailed ? t("action.retryClose") : t(item.phase === "answering" ? "action.stop" : "action.close");
|
|
13772
|
-
return /* @__PURE__ */ import_react5.default.createElement("article", { className: "btw-bubble", "data-phase": item.phase, "aria-label": t("bubble.label") }, /* @__PURE__ */ import_react5.default.createElement("
|
|
13772
|
+
return /* @__PURE__ */ import_react5.default.createElement("article", { className: "btw-bubble", "data-btw-phase": item.phase, "aria-label": t("bubble.label") }, /* @__PURE__ */ import_react5.default.createElement("div", { className: "btw-header" }, /* @__PURE__ */ import_react5.default.createElement("span", { className: "btw-symbol" }, /* @__PURE__ */ import_react5.default.createElement(MessageCircle, { size: 16 })), /* @__PURE__ */ import_react5.default.createElement("span", { className: "btw-question" }, item.question), /* @__PURE__ */ import_react5.default.createElement("div", { className: "btw-actions" }, item.answer && /* @__PURE__ */ import_react5.default.createElement("button", { type: "button", title: t(copied ? "action.copied" : "action.copy"), "aria-label": t("action.copy"), onClick: () => {
|
|
13773
13773
|
void copy();
|
|
13774
13774
|
} }, copied ? /* @__PURE__ */ import_react5.default.createElement(Check, { size: 16 }) : /* @__PURE__ */ import_react5.default.createElement(Copy, { size: 16 })), /* @__PURE__ */ import_react5.default.createElement("button", { type: "button", title: t(collapsed ? "action.expand" : "action.collapse"), "aria-label": t(collapsed ? "action.expand" : "action.collapse"), "aria-expanded": !collapsed, onClick: onToggleCollapse }, collapsed ? /* @__PURE__ */ import_react5.default.createElement(ChevronUp, { size: 16 }) : /* @__PURE__ */ import_react5.default.createElement(ChevronDown, { size: 16 })), /* @__PURE__ */ import_react5.default.createElement(
|
|
13775
13775
|
"button",
|
|
@@ -14041,37 +14041,43 @@ function messageQuoteRanges(text7) {
|
|
|
14041
14041
|
}
|
|
14042
14042
|
return ranges;
|
|
14043
14043
|
}
|
|
14044
|
-
|
|
14045
|
-
|
|
14046
|
-
|
|
14047
|
-
|
|
14048
|
-
|
|
14049
|
-
|
|
14050
|
-
|
|
14051
|
-
|
|
14052
|
-
|
|
14053
|
-
|
|
14054
|
-
|
|
14055
|
-
|
|
14056
|
-
|
|
14057
|
-
|
|
14058
|
-
|
|
14059
|
-
|
|
14060
|
-
|
|
14061
|
-
|
|
14062
|
-
|
|
14063
|
-
|
|
14064
|
-
|
|
14065
|
-
|
|
14066
|
-
|
|
14067
|
-
|
|
14068
|
-
|
|
14044
|
+
function createOfficialQuoteRule(isOfficialPresent) {
|
|
14045
|
+
return {
|
|
14046
|
+
id: "dsh-btw-blockquote",
|
|
14047
|
+
order: -10,
|
|
14048
|
+
match(text7, from) {
|
|
14049
|
+
if (isOfficialPresent?.()) {
|
|
14050
|
+
return void 0;
|
|
14051
|
+
}
|
|
14052
|
+
for (const range of messageQuoteRanges(text7)) {
|
|
14053
|
+
for (const start2 of [range.start - 2, range.start, range.end]) {
|
|
14054
|
+
if (start2 < from) continue;
|
|
14055
|
+
if (start2 === range.start) {
|
|
14056
|
+
return {
|
|
14057
|
+
id: "dsh-btw-blockquote",
|
|
14058
|
+
start: start2,
|
|
14059
|
+
end: range.end,
|
|
14060
|
+
data: { text: quoteTextOf(text7.slice(start2, range.end)) }
|
|
14061
|
+
};
|
|
14062
|
+
}
|
|
14063
|
+
if (text7.slice(start2, start2 + 2) === "\n\n") {
|
|
14064
|
+
return {
|
|
14065
|
+
id: "text",
|
|
14066
|
+
start: start2,
|
|
14067
|
+
end: start2 + 2,
|
|
14068
|
+
data: {
|
|
14069
|
+
text: "\n\n",
|
|
14070
|
+
display: " "
|
|
14071
|
+
}
|
|
14072
|
+
};
|
|
14073
|
+
}
|
|
14069
14074
|
}
|
|
14070
14075
|
}
|
|
14076
|
+
return void 0;
|
|
14071
14077
|
}
|
|
14072
|
-
|
|
14073
|
-
|
|
14074
|
-
|
|
14078
|
+
};
|
|
14079
|
+
}
|
|
14080
|
+
var officialQuoteRule = createOfficialQuoteRule();
|
|
14075
14081
|
function OfficialQuoteIcon({ className }) {
|
|
14076
14082
|
return /* @__PURE__ */ import_react6.default.createElement("svg", { width: 16, height: 16, className, viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true" }, /* @__PURE__ */ import_react6.default.createElement("g", { transform: "translate(6.8 2.4)" }, /* @__PURE__ */ import_react6.default.createElement("path", { d: "M2.8125 0.583008L3.2002 1.16602C2.43912 1.6713 1.88491 2.41238 1.60547 3.25684H2.98926V6.70605H0V4.52148C1.96593e-05 2.70313 0.9109 1.00575 2.42578 0L2.8125 0.583008Z", fill: "currentColor" }), /* @__PURE__ */ import_react6.default.createElement("path", { d: "M7.50781 0.583008L7.89551 1.16602C7.13443 1.6713 6.58022 2.41238 6.30078 3.25684H7.68457V6.70605H4.69531V4.52148C4.69533 2.70313 5.60621 1.00575 7.12109 0L7.50781 0.583008Z", fill: "currentColor" })));
|
|
14077
14083
|
}
|
|
@@ -14197,7 +14203,12 @@ function createQuoteTriggerSource({
|
|
|
14197
14203
|
createdAt: Date.now(),
|
|
14198
14204
|
comment: payload.comment
|
|
14199
14205
|
};
|
|
14200
|
-
|
|
14206
|
+
const formatted = formatQuotesWithDraft("", [fakeRef], t);
|
|
14207
|
+
return `${formatted.trimEnd()}
|
|
14208
|
+
|
|
14209
|
+
${t("quote.userRequestHeading")}
|
|
14210
|
+
|
|
14211
|
+
`;
|
|
14201
14212
|
}
|
|
14202
14213
|
};
|
|
14203
14214
|
return {
|
|
@@ -14743,16 +14754,48 @@ function parseQuotePromptBlock(text7, from = 0) {
|
|
|
14743
14754
|
if (start2 < 0) return void 0;
|
|
14744
14755
|
const prefix = text7.slice(from, start2);
|
|
14745
14756
|
if (prefix.trim().length > 0) return void 0;
|
|
14746
|
-
const
|
|
14747
|
-
const
|
|
14748
|
-
|
|
14749
|
-
let end =
|
|
14750
|
-
if (
|
|
14751
|
-
|
|
14752
|
-
|
|
14757
|
+
const subAfterStart = text7.slice(start2);
|
|
14758
|
+
const sepRegex = isEn ? /(?:^|\r?\n)(?:---\s*[\r\n]+)?##[ \t]*User Request:[ \t]*(?:\r?\n|$)/ : /(?:^|\r?\n)(?:---\s*[\r\n]+)?##[ \t]*用户需求与指示:[ \t]*(?:\r?\n|$)/;
|
|
14759
|
+
const sepMatch = sepRegex.exec(subAfterStart);
|
|
14760
|
+
let end = -1;
|
|
14761
|
+
if (sepMatch) {
|
|
14762
|
+
const matchEndInSub = sepMatch.index + sepMatch[0].length;
|
|
14763
|
+
const afterSep = subAfterStart.slice(matchEndInSub);
|
|
14764
|
+
if (!afterSep.trim()) {
|
|
14765
|
+
end = text7.length;
|
|
14766
|
+
} else {
|
|
14767
|
+
const blankLinesMatch = afterSep.match(/^(?:\r?\n)+/);
|
|
14768
|
+
const blankLen = blankLinesMatch ? blankLinesMatch[0].length : 0;
|
|
14769
|
+
end = start2 + matchEndInSub + blankLen;
|
|
14770
|
+
}
|
|
14753
14771
|
}
|
|
14754
14772
|
if (end < 0) {
|
|
14755
|
-
|
|
14773
|
+
let lastQuoteEndInSub = 0;
|
|
14774
|
+
let currentIdx = 0;
|
|
14775
|
+
const lines = subAfterStart.split(/\r?\n/);
|
|
14776
|
+
for (let i = 0; i < lines.length; i++) {
|
|
14777
|
+
const line = lines[i];
|
|
14778
|
+
const lineLen = line.length;
|
|
14779
|
+
const trimmed = line.trim();
|
|
14780
|
+
const isQuoteLine = trimmed.startsWith(">");
|
|
14781
|
+
const isHeaderLine = trimmed.startsWith("#") || trimmed.startsWith("\u6CE8\u610F\uFF1A") || trimmed.startsWith("Note:");
|
|
14782
|
+
if (isQuoteLine) {
|
|
14783
|
+
lastQuoteEndInSub = currentIdx + lineLen;
|
|
14784
|
+
} else if (!isHeaderLine && trimmed.length > 0) {
|
|
14785
|
+
break;
|
|
14786
|
+
}
|
|
14787
|
+
const matchNewline = subAfterStart.slice(currentIdx + lineLen).match(/^\r?\n/);
|
|
14788
|
+
currentIdx += lineLen + (matchNewline ? matchNewline[0].length : 0);
|
|
14789
|
+
}
|
|
14790
|
+
if (lastQuoteEndInSub > 0) {
|
|
14791
|
+
end = start2 + lastQuoteEndInSub;
|
|
14792
|
+
const trailingWhitespace = text7.slice(end).match(/^\r?\n(?:\r?\n)?/);
|
|
14793
|
+
if (trailingWhitespace) {
|
|
14794
|
+
end += trailingWhitespace[0].length;
|
|
14795
|
+
}
|
|
14796
|
+
} else {
|
|
14797
|
+
end = text7.length;
|
|
14798
|
+
}
|
|
14756
14799
|
}
|
|
14757
14800
|
const block = text7.slice(start2, end);
|
|
14758
14801
|
const regex = /> \[(?:来自|From )([^\]]+)\]:([^\n]*(?:\n(?!> \[(?:来自|From )).*)*)/g;
|
|
@@ -15219,9 +15262,37 @@ function apply(ctx) {
|
|
|
15219
15262
|
const uc = uiConversation;
|
|
15220
15263
|
if (uc?.userText) {
|
|
15221
15264
|
const disposers = [];
|
|
15222
|
-
const
|
|
15223
|
-
|
|
15224
|
-
|
|
15265
|
+
const ut = uc.userText;
|
|
15266
|
+
let offOfficialShim;
|
|
15267
|
+
let syncing = false;
|
|
15268
|
+
const isOfficialQuotePresent = () => Boolean(ut.definitions?.has("quote") || ut.has?.("quote"));
|
|
15269
|
+
const syncShim = () => {
|
|
15270
|
+
if (syncing) return;
|
|
15271
|
+
syncing = true;
|
|
15272
|
+
try {
|
|
15273
|
+
const hasOfficial = isOfficialQuotePresent();
|
|
15274
|
+
if (hasOfficial && offOfficialShim) {
|
|
15275
|
+
offOfficialShim();
|
|
15276
|
+
offOfficialShim = void 0;
|
|
15277
|
+
} else if (!hasOfficial && !offOfficialShim) {
|
|
15278
|
+
offOfficialShim = safeRegisterUserTextRule(ut, createOfficialQuoteRule(isOfficialQuotePresent));
|
|
15279
|
+
}
|
|
15280
|
+
} finally {
|
|
15281
|
+
syncing = false;
|
|
15282
|
+
}
|
|
15283
|
+
};
|
|
15284
|
+
syncShim();
|
|
15285
|
+
if (typeof ut.subscribe === "function") {
|
|
15286
|
+
const unsub = ut.subscribe(syncShim);
|
|
15287
|
+
disposers.push(unsub);
|
|
15288
|
+
}
|
|
15289
|
+
disposers.push(() => {
|
|
15290
|
+
if (offOfficialShim) {
|
|
15291
|
+
offOfficialShim();
|
|
15292
|
+
offOfficialShim = void 0;
|
|
15293
|
+
}
|
|
15294
|
+
});
|
|
15295
|
+
const offLegacy = safeRegisterUserTextRule(ut, quoteUserTextRule);
|
|
15225
15296
|
if (typeof offLegacy === "function") disposers.push(offLegacy);
|
|
15226
15297
|
return () => {
|
|
15227
15298
|
disposers.forEach((d) => d());
|
|
@@ -15313,7 +15384,7 @@ function apply(ctx) {
|
|
|
15313
15384
|
try {
|
|
15314
15385
|
const offOfficial = slots.register({
|
|
15315
15386
|
name: "conversation.user.text.node",
|
|
15316
|
-
key: "
|
|
15387
|
+
key: "dsh-btw-blockquote",
|
|
15317
15388
|
priority: 100,
|
|
15318
15389
|
locale: NS
|
|
15319
15390
|
}, (({ node: node2 }) => /* @__PURE__ */ import_react11.default.createElement(OfficialQuotePreview, { text: node2.data.text })));
|
|
@@ -16,7 +16,7 @@ export declare function messageQuoteRanges(text: string): {
|
|
|
16
16
|
end: number;
|
|
17
17
|
}[];
|
|
18
18
|
export interface QuoteNodeMatch {
|
|
19
|
-
id: 'quote' | 'text';
|
|
19
|
+
id: 'dsh-btw-blockquote' | 'quote' | 'text';
|
|
20
20
|
start: number;
|
|
21
21
|
end: number;
|
|
22
22
|
data: {
|
|
@@ -25,10 +25,20 @@ export interface QuoteNodeMatch {
|
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
|
-
*
|
|
28
|
+
* 构造用于降级承接 Markdown blockquote 的 UserText 切分规则。
|
|
29
|
+
* 拥有自有命名空间 `dsh-btw-blockquote`,彻底避免抢占官方 `quote` 规则 ID。
|
|
30
|
+
* 并在渲染期动态让位:若宿主已加载官方 `quote` 规则,则返回 undefined 放弃匹配,由官方规则渲染。
|
|
31
|
+
*/
|
|
32
|
+
export declare function createOfficialQuoteRule(isOfficialPresent?: () => boolean): {
|
|
33
|
+
id: "dsh-btw-blockquote";
|
|
34
|
+
order: number;
|
|
35
|
+
match(text: string, from: number): QuoteNodeMatch | undefined;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* 默认 blockquote 切分规则实例(老宿主无官方插件时降级承接)。
|
|
29
39
|
*/
|
|
30
40
|
export declare const officialQuoteRule: {
|
|
31
|
-
id:
|
|
41
|
+
id: "dsh-btw-blockquote";
|
|
32
42
|
order: number;
|
|
33
43
|
match(text: string, from: number): QuoteNodeMatch | undefined;
|
|
34
44
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@michengai/dsh-btw",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"description": "DSH 一次性只读旁问插件:基于当前上下文回答,独立气泡,不执行工具 · One-shot read-only side-ask plugin: answers from current context in an independent bubble, no tool execution",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|