@michengai/dsh-btw 1.0.3 → 1.0.5

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/lib/index.js CHANGED
@@ -74,6 +74,8 @@ var zh = {
74
74
  "quote.fromRole": "> [\u6765\u81EA{role}{turn}]:",
75
75
  "quote.source": "\u51FA\u5904",
76
76
  "quote.panelTitle": "\u5F15\u7528",
77
+ "quote.detailTitle": "\u5F15\u7528\u8BE6\u60C5",
78
+ "quote.close": "\u5173\u95ED",
77
79
  "quote.commentLabel": "\u6279\u6CE8",
78
80
  "agent.name": "\u65C1\u95EE\u4E13\u5BB6",
79
81
  "agent.promptPrefix": "\u4F60\u662F\u4E13\u6CE8\u89E3\u7B54\u65C1\u95EE\u7684\u72EC\u7ACB\u4E13\u5BB6\u3002\u4EE5\u4E0B\u662F\u7528\u6237\u9488\u5BF9\u5F53\u524D\u4E0A\u4E0B\u6587\u63D0\u51FA\u7684\u95EE\u9898\uFF0C\u8BF7\u76F4\u63A5\u7ED9\u51FA\u4E13\u6CE8\u3001\u51C6\u786E\u7684\u56DE\u7B54\uFF1B\u5148\u524D\u4F1A\u8BDD\u5386\u53F2\uFF08\u5305\u62EC\u4EFB\u4F55\u5DE5\u5177\u8C03\u7528\u53CA\u5176\u7ED3\u679C\uFF09\u4EC5\u4F5C\u4E3A\u53EA\u8BFB\u7406\u89E3\u80CC\u666F\u7684\u53C2\u8003\uFF0C\u5F53\u524D\u6CA1\u6709\u4EFB\u4F55\u53EF\u7528\u5DE5\u5177\uFF0C\u4E25\u7981\u5C1D\u8BD5\u53D1\u8D77\u5DE5\u5177\u8C03\u7528\u6216\u8F93\u51FA <tool_call> \u7B49\u8C03\u7528\u6807\u8BB0\uFF0C\u8BF7\u76F4\u63A5\u4F7F\u7528\u7EAF\u6587\u5B57\u6216 Markdown \u7ED9\u51FA\u6700\u7EC8\u56DE\u7B54\u3002\u4E0D\u8981\u5728\u56DE\u7B54\u4E2D\u91CD\u590D\u65E0\u5173\u7684\u4E3B\u4F1A\u8BDD\u5185\u5BB9\u3002",
@@ -151,6 +153,8 @@ var en = {
151
153
  "quote.fromRole": "> [From {role}{turn}]:",
152
154
  "quote.source": "Source",
153
155
  "quote.panelTitle": "Quotes",
156
+ "quote.detailTitle": "Quote Details",
157
+ "quote.close": "Close",
154
158
  "quote.commentLabel": "Note",
155
159
  "agent.name": "Side Question Expert",
156
160
  "agent.promptPrefix": "You are a focused side-question expert. Answer the following question directly and specifically based on the context. Prior conversation history (including tool calls and results) is strictly read-only background context. You have no tools available. Do not attempt to invoke tools or output tool-call tags/blocks like <tool_call>. Answer directly in plain text or Markdown. Do not include unrelated main-session content.",
@@ -5,12 +5,18 @@ interface DraftInput {
5
5
  state: {
6
6
  getSnapshot(): {
7
7
  draft: string;
8
+ draftRev?: number;
8
9
  phase: string;
10
+ occurrences?: readonly {
11
+ source: string;
12
+ ref: string;
13
+ }[];
9
14
  };
10
15
  };
11
16
  setDraft(text: string): void;
12
17
  focus?(): void;
13
18
  notify?(level: 'info' | 'error', text: string): void;
19
+ insertReference?(ref: unknown, span: unknown): boolean;
14
20
  }
15
21
  export declare function QuoteDock({ store, sessionId, t, input, }: {
16
22
  store: QuoteStore;
@@ -6,12 +6,18 @@ interface DraftInput {
6
6
  state: {
7
7
  getSnapshot(): {
8
8
  draft: string;
9
+ draftRev?: number;
9
10
  phase: string;
11
+ occurrences?: readonly {
12
+ source: string;
13
+ ref: string;
14
+ }[];
10
15
  };
11
16
  };
12
17
  setDraft(text: string): void;
13
18
  focus?(): void;
14
19
  notify?(level: 'info' | 'error', text: string): void;
20
+ insertReference?(ref: unknown, span: unknown): boolean;
15
21
  }
16
22
  /** 只接管会话正文选区;非模态 popover 不抢选区,顶层避免滚动裁切。 */
17
23
  export declare function SelectionAsk({ store, quoteStore, sessionId, t, input, }: {
@@ -22,7 +22,6 @@ export declare class QuoteStore {
22
22
  comment?: string;
23
23
  t?: BtwTranslate;
24
24
  }): QuotedReference;
25
- updateComment(sessionId: string, quoteId: string, comment: string): void;
26
25
  removeQuote(sessionId: string, quoteId: string): void;
27
26
  clearQuotes(sessionId: string): void;
28
27
  subscribe(listener: () => void): () => void;
@@ -0,0 +1,53 @@
1
+ import type { InputTriggerSource, ReferenceInsert, TokenSpan } from '@deepseek-ai/dsh-client-ui-input-trigger/client';
2
+ import type { BtwTranslate } from '../locales';
3
+ import { type QuoteStore } from './quotes';
4
+ export declare const QUOTE_TRIGGER_SOURCE = "dsh-btw-quote";
5
+ export interface SerializedQuotePayload {
6
+ id: string;
7
+ role: 'user' | 'assistant';
8
+ turnIndex?: number;
9
+ text: string;
10
+ comment?: string;
11
+ }
12
+ export declare function serializeQuoteRef(quote: {
13
+ id: string;
14
+ role: 'user' | 'assistant';
15
+ turnIndex?: number;
16
+ text: string;
17
+ comment?: string;
18
+ }): string;
19
+ export declare function parseQuoteRef(raw: string): SerializedQuotePayload | undefined;
20
+ export declare function createQuoteReferenceInsert(quote: {
21
+ id: string;
22
+ role: 'user' | 'assistant';
23
+ turnIndex?: number;
24
+ text: string;
25
+ comment?: string;
26
+ }, t: BtwTranslate): ReferenceInsert;
27
+ export declare function createQuoteTriggerSource({ quoteStore, t, }: {
28
+ quoteStore: QuoteStore;
29
+ t: BtwTranslate;
30
+ }): InputTriggerSource;
31
+ interface CompatibleInputTarget {
32
+ state: {
33
+ getSnapshot(): {
34
+ draft: string;
35
+ draftRev?: number;
36
+ phase: string;
37
+ };
38
+ };
39
+ setDraft(text: string): void;
40
+ insertReference?(ref: ReferenceInsert, span: TokenSpan): boolean;
41
+ }
42
+ /**
43
+ * 尝试以原子结构化引用(Mention chip)形式向输入框插入引用。
44
+ * 若宿主不支持 insertReference,返回 false,以便降级走传统草稿追加逻辑。
45
+ */
46
+ export declare function insertQuoteReference(input: CompatibleInputTarget, quote: {
47
+ id: string;
48
+ role: 'user' | 'assistant';
49
+ turnIndex?: number;
50
+ text: string;
51
+ comment?: string;
52
+ }, t: BtwTranslate): boolean;
53
+ export {};
@@ -0,0 +1,44 @@
1
+ import React from 'react';
2
+ import { type BtwTranslate } from '../locales';
3
+ export interface ParsedQuoteItem {
4
+ readonly label: string;
5
+ readonly text: string;
6
+ readonly role?: 'assistant' | 'user';
7
+ readonly turnIndex?: number;
8
+ }
9
+ export interface QuoteNodeData {
10
+ readonly label: string;
11
+ readonly count: number;
12
+ readonly raw: string;
13
+ readonly items: readonly ParsedQuoteItem[];
14
+ readonly isEn: boolean;
15
+ readonly role?: 'assistant' | 'user';
16
+ readonly turnIndex?: number;
17
+ }
18
+ declare module '@deepseek-ai/dsh-client-ui-conversation/client' {
19
+ interface UserTextDataMap {
20
+ 'dsh-btw-quote': QuoteNodeData;
21
+ }
22
+ }
23
+ export declare function parseQuotePromptBlock(text: string, from?: number): {
24
+ start: number;
25
+ end: number;
26
+ data: QuoteNodeData;
27
+ } | undefined;
28
+ export declare const quoteUserTextRule: {
29
+ id: "dsh-btw-quote";
30
+ order: number;
31
+ match(text: string, from: number): {
32
+ id: "dsh-btw-quote";
33
+ start: number;
34
+ end: number;
35
+ data: QuoteNodeData;
36
+ } | undefined;
37
+ };
38
+ export declare function QuoteUserTextNode(props: {
39
+ readonly node: {
40
+ readonly id: 'dsh-btw-quote';
41
+ readonly data: QuoteNodeData;
42
+ };
43
+ readonly t?: BtwTranslate;
44
+ }): React.JSX.Element;
@@ -67,6 +67,8 @@ export declare const zh: {
67
67
  'quote.fromRole': string;
68
68
  'quote.source': string;
69
69
  'quote.panelTitle': string;
70
+ 'quote.detailTitle': string;
71
+ 'quote.close': string;
70
72
  'quote.commentLabel': string;
71
73
  'agent.name': string;
72
74
  'agent.promptPrefix': string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@michengai/dsh-btw",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
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",
@@ -45,7 +45,8 @@
45
45
  "inject": [
46
46
  "@deepseek-ai/dsh-client-ui-conversation",
47
47
  "@deepseek-ai/dsh-api-remotes",
48
- "@deepseek-ai/dsh-client-locale"
48
+ "@deepseek-ai/dsh-client-locale",
49
+ "@deepseek-ai/dsh-client-ui-input-trigger"
49
50
  ]
50
51
  }
51
52
  },
@@ -64,12 +65,13 @@
64
65
  "license": "Apache-2.0",
65
66
  "peerDependencies": {
66
67
  "@deepseek-ai/cordis": "^4.0.2",
67
- "@deepseek-ai/dsh-client-ui-primitives": "0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2",
68
- "@deepseek-ai/dsh-commands": "0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2",
69
- "@deepseek-ai/dsh-session": "0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2",
70
- "@deepseek-ai/dsh-subagent": "0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2",
71
- "@deepseek-ai/dsh-system-prompt": "0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2",
72
- "@deepseek-ai/dsh-tools": "0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2",
68
+ "@deepseek-ai/dsh-client-ui-input-trigger": "0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3",
69
+ "@deepseek-ai/dsh-client-ui-primitives": "0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3",
70
+ "@deepseek-ai/dsh-commands": "0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3",
71
+ "@deepseek-ai/dsh-session": "0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3",
72
+ "@deepseek-ai/dsh-subagent": "0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3",
73
+ "@deepseek-ai/dsh-system-prompt": "0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3",
74
+ "@deepseek-ai/dsh-tools": "0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3",
73
75
  "react": "^18.3.1"
74
76
  },
75
77
  "devDependencies": {