@ahggg/dsh-side-chat 0.7.2 → 0.7.3

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.
Files changed (173) hide show
  1. package/README.md +3 -3
  2. package/README.zh-CN.md +3 -3
  3. package/lib/client/apply.d.ts +0 -1
  4. package/lib/client/apply.js +0 -1
  5. package/lib/client/contracts.d.ts +0 -1
  6. package/lib/client/contracts.js +0 -1
  7. package/lib/client/index.d.ts +0 -1
  8. package/lib/client/index.js +0 -1
  9. package/lib/client/model-preference.d.ts +0 -1
  10. package/lib/client/model-preference.js +0 -1
  11. package/lib/client/panel/SelectionQuote.d.ts +0 -1
  12. package/lib/client/panel/SelectionQuote.js +0 -1
  13. package/lib/client/panel/SendIcon.d.ts +0 -1
  14. package/lib/client/panel/SendIcon.js +0 -1
  15. package/lib/client/panel/SideChatBody.d.ts +0 -1
  16. package/lib/client/panel/SideChatBody.js +0 -1
  17. package/lib/client/panel/SideChatErrorState.d.ts +0 -1
  18. package/lib/client/panel/SideChatErrorState.js +0 -1
  19. package/lib/client/panel/SideChatHeader.d.ts +0 -1
  20. package/lib/client/panel/SideChatHeader.js +0 -1
  21. package/lib/client/panel/SideChatModelSelect.d.ts +0 -1
  22. package/lib/client/panel/SideChatModelSelect.js +0 -1
  23. package/lib/client/panel/SideChatPanel.d.ts +0 -1
  24. package/lib/client/panel/SideChatPanel.js +0 -1
  25. package/lib/client/panel/StopIcon.d.ts +0 -1
  26. package/lib/client/panel/StopIcon.js +0 -1
  27. package/lib/client/panel/messages.d.ts +0 -1
  28. package/lib/client/panel/messages.js +0 -1
  29. package/lib/client/panel/use-auto-growing-textarea.d.ts +0 -1
  30. package/lib/client/panel/use-auto-growing-textarea.js +0 -1
  31. package/lib/client/parent-composer/ParentConversationAnnotations.d.ts +0 -1
  32. package/lib/client/parent-composer/ParentConversationAnnotations.js +26 -3
  33. package/lib/client/parent-composer/add-to-conversation.d.ts +0 -1
  34. package/lib/client/parent-composer/add-to-conversation.js +99 -8
  35. package/lib/client/parent-composer/annotation-persistence.d.ts +0 -1
  36. package/lib/client/parent-composer/annotation-persistence.js +0 -1
  37. package/lib/client/parent-composer/composer-reference.d.ts +16 -7
  38. package/lib/client/parent-composer/composer-reference.js +34 -2
  39. package/lib/client/parent-composer/referenced-conversation.d.ts +1 -2
  40. package/lib/client/parent-composer/referenced-conversation.js +26 -8
  41. package/lib/client/rc6/ArchivedConversation.d.ts +2 -3
  42. package/lib/client/rc6/ArchivedConversation.js +6 -5
  43. package/lib/client/rc6/Rc6SideChatOverlay.d.ts +0 -1
  44. package/lib/client/rc6/Rc6SideChatOverlay.js +0 -1
  45. package/lib/client/rc6/SideChatTool.d.ts +1 -2
  46. package/lib/client/rc6/SideChatTool.js +18 -9
  47. package/lib/client/rc6/context.d.ts +9 -3
  48. package/lib/client/rc6/context.js +0 -1
  49. package/lib/client/rc6/primitive-labels.d.ts +7 -0
  50. package/lib/client/rc6/primitive-labels.js +60 -0
  51. package/lib/client/rc6/remote-adapter.d.ts +0 -1
  52. package/lib/client/rc6/remote-adapter.js +4 -3
  53. package/lib/client/rc6/runtime-compat.d.ts +120 -0
  54. package/lib/client/rc6/runtime-compat.js +187 -0
  55. package/lib/client/rc6/sessions-adapter.d.ts +7 -4
  56. package/lib/client/rc6/sessions-adapter.js +62 -45
  57. package/lib/client/selection/ConversationAnnotationMarkers.d.ts +0 -1
  58. package/lib/client/selection/ConversationAnnotationMarkers.js +0 -1
  59. package/lib/client/selection/SelectionActions.d.ts +0 -1
  60. package/lib/client/selection/SelectionActions.js +0 -1
  61. package/lib/client/selection/selection-controller.d.ts +0 -1
  62. package/lib/client/selection/selection-controller.js +0 -1
  63. package/lib/client/selection/selection-limits.d.ts +0 -1
  64. package/lib/client/selection/selection-limits.js +0 -1
  65. package/lib/client/selection/selection-normalizer.d.ts +0 -1
  66. package/lib/client/selection/selection-normalizer.js +0 -1
  67. package/lib/client/side-chat-controller.d.ts +0 -1
  68. package/lib/client/side-chat-controller.js +0 -1
  69. package/lib/client.js +1173 -8951
  70. package/lib/host/archived-fork-service.d.ts +0 -1
  71. package/lib/host/archived-fork-service.js +71 -26
  72. package/lib/host/index.d.ts +0 -1
  73. package/lib/host/index.js +0 -1
  74. package/lib/index.d.ts +0 -1
  75. package/lib/index.js +0 -1
  76. package/lib/remote.d.ts +0 -1
  77. package/lib/remote.js +0 -1
  78. package/lib/shared/archived-wire.d.ts +0 -1
  79. package/lib/shared/archived-wire.js +0 -1
  80. package/lib/shared/constants.d.ts +0 -1
  81. package/lib/shared/constants.js +0 -1
  82. package/lib/shared/contracts.d.ts +0 -1
  83. package/lib/shared/contracts.js +0 -1
  84. package/lib/shared/error-codes.d.ts +0 -1
  85. package/lib/shared/error-codes.js +0 -1
  86. package/lib/shared/observable.d.ts +0 -1
  87. package/lib/shared/observable.js +0 -1
  88. package/lib/typert.d.ts +0 -1
  89. package/lib/typert.js +64 -51
  90. package/package.json +60 -38
  91. package/lib/client/apply.d.ts.map +0 -1
  92. package/lib/client/apply.js.map +0 -1
  93. package/lib/client/contracts.d.ts.map +0 -1
  94. package/lib/client/contracts.js.map +0 -1
  95. package/lib/client/index.d.ts.map +0 -1
  96. package/lib/client/index.js.map +0 -1
  97. package/lib/client/model-preference.d.ts.map +0 -1
  98. package/lib/client/model-preference.js.map +0 -1
  99. package/lib/client/panel/SelectionQuote.d.ts.map +0 -1
  100. package/lib/client/panel/SelectionQuote.js.map +0 -1
  101. package/lib/client/panel/SendIcon.d.ts.map +0 -1
  102. package/lib/client/panel/SendIcon.js.map +0 -1
  103. package/lib/client/panel/SideChatBody.d.ts.map +0 -1
  104. package/lib/client/panel/SideChatBody.js.map +0 -1
  105. package/lib/client/panel/SideChatErrorState.d.ts.map +0 -1
  106. package/lib/client/panel/SideChatErrorState.js.map +0 -1
  107. package/lib/client/panel/SideChatHeader.d.ts.map +0 -1
  108. package/lib/client/panel/SideChatHeader.js.map +0 -1
  109. package/lib/client/panel/SideChatModelSelect.d.ts.map +0 -1
  110. package/lib/client/panel/SideChatModelSelect.js.map +0 -1
  111. package/lib/client/panel/SideChatPanel.d.ts.map +0 -1
  112. package/lib/client/panel/SideChatPanel.js.map +0 -1
  113. package/lib/client/panel/StopIcon.d.ts.map +0 -1
  114. package/lib/client/panel/StopIcon.js.map +0 -1
  115. package/lib/client/panel/messages.d.ts.map +0 -1
  116. package/lib/client/panel/messages.js.map +0 -1
  117. package/lib/client/panel/use-auto-growing-textarea.d.ts.map +0 -1
  118. package/lib/client/panel/use-auto-growing-textarea.js.map +0 -1
  119. package/lib/client/parent-composer/ParentConversationAnnotations.d.ts.map +0 -1
  120. package/lib/client/parent-composer/ParentConversationAnnotations.js.map +0 -1
  121. package/lib/client/parent-composer/add-to-conversation.d.ts.map +0 -1
  122. package/lib/client/parent-composer/add-to-conversation.js.map +0 -1
  123. package/lib/client/parent-composer/annotation-persistence.d.ts.map +0 -1
  124. package/lib/client/parent-composer/annotation-persistence.js.map +0 -1
  125. package/lib/client/parent-composer/composer-reference.d.ts.map +0 -1
  126. package/lib/client/parent-composer/composer-reference.js.map +0 -1
  127. package/lib/client/parent-composer/referenced-conversation.d.ts.map +0 -1
  128. package/lib/client/parent-composer/referenced-conversation.js.map +0 -1
  129. package/lib/client/rc6/ArchivedConversation.d.ts.map +0 -1
  130. package/lib/client/rc6/ArchivedConversation.js.map +0 -1
  131. package/lib/client/rc6/Rc6SideChatOverlay.d.ts.map +0 -1
  132. package/lib/client/rc6/Rc6SideChatOverlay.js.map +0 -1
  133. package/lib/client/rc6/SideChatTool.d.ts.map +0 -1
  134. package/lib/client/rc6/SideChatTool.js.map +0 -1
  135. package/lib/client/rc6/context.d.ts.map +0 -1
  136. package/lib/client/rc6/context.js.map +0 -1
  137. package/lib/client/rc6/remote-adapter.d.ts.map +0 -1
  138. package/lib/client/rc6/remote-adapter.js.map +0 -1
  139. package/lib/client/rc6/sessions-adapter.d.ts.map +0 -1
  140. package/lib/client/rc6/sessions-adapter.js.map +0 -1
  141. package/lib/client/selection/ConversationAnnotationMarkers.d.ts.map +0 -1
  142. package/lib/client/selection/ConversationAnnotationMarkers.js.map +0 -1
  143. package/lib/client/selection/SelectionActions.d.ts.map +0 -1
  144. package/lib/client/selection/SelectionActions.js.map +0 -1
  145. package/lib/client/selection/selection-controller.d.ts.map +0 -1
  146. package/lib/client/selection/selection-controller.js.map +0 -1
  147. package/lib/client/selection/selection-limits.d.ts.map +0 -1
  148. package/lib/client/selection/selection-limits.js.map +0 -1
  149. package/lib/client/selection/selection-normalizer.d.ts.map +0 -1
  150. package/lib/client/selection/selection-normalizer.js.map +0 -1
  151. package/lib/client/side-chat-controller.d.ts.map +0 -1
  152. package/lib/client/side-chat-controller.js.map +0 -1
  153. package/lib/client.js.map +0 -1
  154. package/lib/host/archived-fork-service.d.ts.map +0 -1
  155. package/lib/host/archived-fork-service.js.map +0 -1
  156. package/lib/host/index.d.ts.map +0 -1
  157. package/lib/host/index.js.map +0 -1
  158. package/lib/index.d.ts.map +0 -1
  159. package/lib/index.js.map +0 -1
  160. package/lib/remote.d.ts.map +0 -1
  161. package/lib/remote.js.map +0 -1
  162. package/lib/shared/archived-wire.d.ts.map +0 -1
  163. package/lib/shared/archived-wire.js.map +0 -1
  164. package/lib/shared/constants.d.ts.map +0 -1
  165. package/lib/shared/constants.js.map +0 -1
  166. package/lib/shared/contracts.d.ts.map +0 -1
  167. package/lib/shared/contracts.js.map +0 -1
  168. package/lib/shared/error-codes.d.ts.map +0 -1
  169. package/lib/shared/error-codes.js.map +0 -1
  170. package/lib/shared/observable.d.ts.map +0 -1
  171. package/lib/shared/observable.js.map +0 -1
  172. package/lib/typert.d.ts.map +0 -1
  173. package/lib/typert.js.map +0 -1
package/README.md CHANGED
@@ -8,10 +8,10 @@ Ask a focused follow-up about selected text without leaving your current DeepSee
8
8
 
9
9
  ## Install
10
10
 
11
- Install DSH rc.7 if it is not already available. Refresh only this package's registry metadata before adding it, so pnpm cannot reuse an older `latest` value immediately after a release:
11
+ Install DSH 0.1.2-rc.1 if it is not already available. Refresh only this package's registry metadata before adding it, so pnpm cannot reuse an older `latest` value immediately after a release:
12
12
 
13
13
  ```powershell
14
- npm install --global @deepseek-ai/dsh@0.1.0-rc.7
14
+ npm install --global @deepseek-ai/dsh@0.1.2-rc.1
15
15
  pnpm cache delete "@ahggg/dsh-side-chat"
16
16
  dsh plugin --profile web add @ahggg/dsh-side-chat@latest
17
17
  ```
@@ -27,7 +27,7 @@ Open the URL printed by DSH. The plugin loads automatically in the Web client.
27
27
 
28
28
  ### Local linked development
29
29
 
30
- When `dsh plugin --profile web list` shows the plugin coming from a `link:` workspace, DSH loads the Git-ignored `lib/client.js`, not `src/`. Rebuild after switching branches or changing client source, then restart the `dsh web` process:
30
+ When `dsh plugin --profile web list` shows the plugin coming from a `link:` workspace, DSH loads the committed `lib/client.js`, not `src/`. Rebuild after switching branches or changing client source, then restart the `dsh web` process:
31
31
 
32
32
  ```powershell
33
33
  pnpm install --frozen-lockfile
package/README.zh-CN.md CHANGED
@@ -8,10 +8,10 @@
8
8
 
9
9
  ## 安装
10
10
 
11
- 如果尚未安装 DSH rc.7,先安装它。添加插件前只刷新这个包的 registry metadata,避免刚发布新版本时 pnpm 仍复用旧的 `latest`:
11
+ 如果尚未安装 DSH 0.1.2-rc.1,先安装它。添加插件前只刷新这个包的 registry metadata,避免刚发布新版本时 pnpm 仍复用旧的 `latest`:
12
12
 
13
13
  ```powershell
14
- npm install --global @deepseek-ai/dsh@0.1.0-rc.7
14
+ npm install --global @deepseek-ai/dsh@0.1.2-rc.1
15
15
  pnpm cache delete "@ahggg/dsh-side-chat"
16
16
  dsh plugin --profile web add @ahggg/dsh-side-chat@latest
17
17
  ```
@@ -27,7 +27,7 @@ dsh web --port 3080
27
27
 
28
28
  ### 本地链接调试
29
29
 
30
- 当 `dsh plugin --profile web list` 显示插件来自 `link:` 工作区时,DSH 加载的是被 Git 忽略的 `lib/client.js`,而不是 `src/`。切换分支或修改客户端源码后,需要重新构建并重启 `dsh web` 进程:
30
+ 当 `dsh plugin --profile web list` 显示插件来自 `link:` 工作区时,DSH 加载的是已提交的 `lib/client.js`,而不是 `src/`。切换分支或修改客户端源码后,需要重新构建并重启 `dsh web` 进程:
31
31
 
32
32
  ```powershell
33
33
  pnpm install --frozen-lockfile
@@ -2,4 +2,3 @@ import type { Context } from '@deepseek-ai/cordis';
2
2
  export declare const name = "side-chat-client";
3
3
  export declare const inject: string[];
4
4
  export declare function apply(ctx: Context): Promise<void>;
5
- //# sourceMappingURL=apply.d.ts.map
@@ -41,4 +41,3 @@ export async function apply(ctx) {
41
41
  }
42
42
  }, 'dsh-side-chat.clientLifecycle');
43
43
  }
44
- //# sourceMappingURL=apply.js.map
@@ -75,4 +75,3 @@ export type SideChatActionResult<T = void> = {
75
75
  readonly ok: false;
76
76
  readonly error: SideChatWireError;
77
77
  };
78
- //# sourceMappingURL=contracts.d.ts.map
@@ -1,2 +1 @@
1
1
  export {};
2
- //# sourceMappingURL=contracts.js.map
@@ -8,4 +8,3 @@ export { captureDomConversationSelection, restoreDomConversationSelection, type
8
8
  export { selectionFitsLimit, summarizeSelection, utf8ByteLength } from './selection/selection-limits.js';
9
9
  export { assertSelectionCurrent, finalizeConversationSelection, normalizeSelectedText, SelectionValidationError, type ConversationSelectionInput, } from './selection/selection-normalizer.js';
10
10
  export type { ConversationSelection, SelectionFragment, SelectionRect, SideChatModelSelection, SideChatState, } from '../shared/contracts.js';
11
- //# sourceMappingURL=index.d.ts.map
@@ -6,4 +6,3 @@ export { SelectionActions } from './selection/SelectionActions.js';
6
6
  export { captureDomConversationSelection, restoreDomConversationSelection, } from './selection/selection-controller.js';
7
7
  export { selectionFitsLimit, summarizeSelection, utf8ByteLength } from './selection/selection-limits.js';
8
8
  export { assertSelectionCurrent, finalizeConversationSelection, normalizeSelectedText, SelectionValidationError, } from './selection/selection-normalizer.js';
9
- //# sourceMappingURL=index.js.map
@@ -11,4 +11,3 @@ export declare class SideChatModelPreferences {
11
11
  set(selection: SideChatModelSelection): void;
12
12
  }
13
13
  export {};
14
- //# sourceMappingURL=model-preference.d.ts.map
@@ -57,4 +57,3 @@ export class SideChatModelPreferences {
57
57
  }
58
58
  }
59
59
  }
60
- //# sourceMappingURL=model-preference.js.map
@@ -9,4 +9,3 @@ export declare function SelectionQuote({ selections, messages, onRemove, }: {
9
9
  readonly messages: SideChatMessages;
10
10
  readonly onRemove?: () => void;
11
11
  }): import("react/jsx-runtime").JSX.Element;
12
- //# sourceMappingURL=SelectionQuote.d.ts.map
@@ -70,4 +70,3 @@ export function SelectionQuote({ selections, messages, onRemove, }) {
70
70
  setExpanded(value => !value);
71
71
  }, children: [_jsxs("svg", { className: "dsh-side-chat-quote-icon", viewBox: "0 0 24 24", "aria-hidden": "true", children: [_jsx("path", { d: "M21 15a4 4 0 0 1-4 4H7l-4 4V7a4 4 0 0 1 4-4h10a4 4 0 0 1 4 4Z" }), _jsx("path", { d: "M8 8h8M8 12h5" })] }), _jsx("strong", { children: messages.selectionAttachments(selections.length) })] }), onRemove !== undefined && (_jsx("button", { type: "button", className: "dsh-side-chat-quote-remove", "aria-label": messages.removeSelection, onClick: onRemove, children: "\u00D7" }))] }), _jsx("div", { ref: detailsRef, className: "dsh-side-chat-quote-details", role: "tooltip", children: selections.map((selection, index) => (_jsxs("div", { className: "dsh-side-chat-quote-detail", children: [_jsx("div", { className: "dsh-side-chat-quote-details-header", children: _jsxs("strong", { children: [String(index + 1), ". ", messages.selectionPreviewLabel, ":"] }) }), _jsx("pre", { children: selection.text }), selection.comment !== undefined && (_jsxs("div", { className: "dsh-side-chat-quote-comment", children: [_jsxs("strong", { children: [messages.selectionCommentLabel, ":"] }), _jsx("pre", { children: selection.comment })] }))] }, `${String(index)}-${selection.text}`))) })] }));
72
72
  }
73
- //# sourceMappingURL=SelectionQuote.js.map
@@ -1,3 +1,2 @@
1
1
  /** Arrow used by DSH's native 34px primary send button. */
2
2
  export declare function SendIcon(): import("react/jsx-runtime").JSX.Element;
3
- //# sourceMappingURL=SendIcon.d.ts.map
@@ -3,4 +3,3 @@ import { jsx as _jsx } from "react/jsx-runtime";
3
3
  export function SendIcon() {
4
4
  return (_jsx("svg", { viewBox: "0 0 16 16", width: "16", height: "16", "aria-hidden": "true", children: _jsx("path", { d: "M8.3125 0.980183C8.66767 1.0531 8.97902 1.20418 9.2627 1.43233C9.48724 1.61297 9.73029 1.85793 9.97949 2.10714L14.707 6.83468L13.293 8.24874L9 3.95577V15.0417H7V3.95577L2.70703 8.24874L1.29297 6.83468L6.02051 2.10714C6.26971 1.85793 6.51277 1.61297 6.7373 1.43233C6.97662 1.23986 7.28445 1.04402 7.6875 0.980183C7.8973 0.947006 8.1031 0.95516 8.3125 0.980183Z", fill: "currentColor" }) }));
5
5
  }
6
- //# sourceMappingURL=SendIcon.js.map
@@ -3,4 +3,3 @@ import type { ReactNode } from 'react';
3
3
  export declare function SideChatBody({ children }: {
4
4
  readonly children: ReactNode;
5
5
  }): import("react/jsx-runtime").JSX.Element;
6
- //# sourceMappingURL=SideChatBody.d.ts.map
@@ -3,4 +3,3 @@ import { jsx as _jsx } from "react/jsx-runtime";
3
3
  export function SideChatBody({ children }) {
4
4
  return _jsx("div", { className: "dsh-side-chat-body", children: children });
5
5
  }
6
- //# sourceMappingURL=SideChatBody.js.map
@@ -6,4 +6,3 @@ export declare function SideChatErrorState({ error, messages, onRetry, }: {
6
6
  readonly messages: SideChatMessages;
7
7
  readonly onRetry: () => void;
8
8
  }): import("react/jsx-runtime").JSX.Element;
9
- //# sourceMappingURL=SideChatErrorState.d.ts.map
@@ -3,4 +3,3 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  export function SideChatErrorState({ error, messages, onRetry, }) {
4
4
  return (_jsxs("section", { className: "dsh-side-chat-error", role: "alert", children: [_jsx("strong", { children: error.code === 'side_chat_destroy_failed' ? messages.closeError : messages.genericError }), _jsx("p", { children: error.message }), error.recoverable && _jsx("button", { type: "button", onClick: onRetry, children: messages.retry })] }));
5
5
  }
6
- //# sourceMappingURL=SideChatErrorState.js.map
@@ -8,4 +8,3 @@ export declare function SideChatHeader({ phase, messages, addToConversationDisab
8
8
  readonly onFocusParent: () => void;
9
9
  readonly onClose: () => void;
10
10
  }): import("react/jsx-runtime").JSX.Element;
11
- //# sourceMappingURL=SideChatHeader.d.ts.map
@@ -5,4 +5,3 @@ function AddToConversationIcon() {
5
5
  export function SideChatHeader({ phase, messages, addToConversationDisabled = false, onAddToConversation, onFocusParent, onClose, }) {
6
6
  return (_jsxs("header", { className: "dsh-side-chat-header", children: [_jsx("button", { type: "button", className: "dsh-side-chat-heading", onClick: onFocusParent, children: _jsx("strong", { children: messages.title }) }), _jsxs("div", { className: "dsh-side-chat-header-actions", children: [onAddToConversation !== undefined && (_jsxs("button", { type: "button", className: "dsh-side-chat-add-to-conversation", disabled: addToConversationDisabled, onClick: onAddToConversation, children: [_jsx(AddToConversationIcon, {}), _jsx("span", { children: messages.addToConversation })] })), _jsx("button", { type: "button", className: "dsh-side-chat-close", "aria-label": messages.close, disabled: phase === 'closing', onClick: onClose, children: "\u00D7" })] })] }));
7
7
  }
8
- //# sourceMappingURL=SideChatHeader.js.map
@@ -14,4 +14,3 @@ export interface SideChatModelSelectProps {
14
14
  }
15
15
  /** Side Chat projection of DSH Web's native composer model selector. */
16
16
  export declare function SideChatModelSelect({ directory, selection, locked, validateInitialSelection, locale, onInitialize, onSelect, }: SideChatModelSelectProps): import("react/jsx-runtime").JSX.Element;
17
- //# sourceMappingURL=SideChatModelSelect.d.ts.map
@@ -244,4 +244,3 @@ export function SideChatModelSelect({ directory, selection, locked, validateInit
244
244
  return (_jsxs("button", { ref: itemRef(), type: "button", role: "menuitemradio", "aria-checked": selected, className: `dsh-side-chat-model-option${selected ? ' dsh-side-chat-model-selected' : ''}`, disabled: selecting, onClick: () => { chooseEffort(level.effort); }, children: [_jsxs("span", { className: "dsh-side-chat-model-option-copy", children: [_jsx("span", { className: "dsh-side-chat-model-name", children: level.label }), level.description !== undefined && (_jsx("span", { className: "dsh-side-chat-model-description", children: level.description }))] }), _jsx("span", { className: "dsh-side-chat-model-check", children: selected ? _jsx(IconCheckOutline16, {}) : null })] }, level.key));
245
245
  }))] })), toast !== null && (_jsx(Toast, { text: toast.text, icon: _jsx(IconWarningOutline16, {}), anchor: rootRef.current?.closest('[data-composer-card]') ?? null, onDone: () => { setToast(null); } }, toast.seq))] }));
246
246
  }
247
- //# sourceMappingURL=SideChatModelSelect.js.map
@@ -16,4 +16,3 @@ export interface SideChatPanelProps {
16
16
  readonly onRemoveSelection?: () => void;
17
17
  }
18
18
  export declare function SideChatPanel({ state, locale, embeddedConversation, modelControl, onDraftChange, onFirstSend, onClose, onRetry, onFocusParent, onAddToConversation, addToConversationDisabled, onRemoveSelection, }: SideChatPanelProps): import("react/jsx-runtime").JSX.Element;
19
- //# sourceMappingURL=SideChatPanel.d.ts.map
@@ -32,4 +32,3 @@ export function SideChatPanel({ state, locale = 'en', embeddedConversation, mode
32
32
  }
33
33
  } }), _jsxs("div", { className: "dsh-side-chat-draft-actions", children: [modelControl, _jsx("button", { type: "submit", className: "dsh-side-chat-send-button", "aria-label": messages.send, disabled: submitting || state.draft.trim().length === 0, children: _jsx(SendIcon, {}) })] })] })), _jsxs("footer", { className: "dsh-side-chat-footer", children: [_jsx("span", { children: messages.temporary }), _jsx("span", { children: messages.referenceOnly }), _jsx("span", { children: messages.cannotReopen }), _jsx("span", { children: messages.sharedWorkspace })] }), _jsx("div", { className: "dsh-side-chat-announcer", "aria-live": "polite", children: state.phase === 'running' ? 'Side Chat running' : `Side Chat ${state.phase}` })] }));
34
34
  }
35
- //# sourceMappingURL=SideChatPanel.js.map
@@ -1,3 +1,2 @@
1
1
  /** Rounded-square stop glyph used by DSH's native primary action button. */
2
2
  export declare function StopIcon(): import("react/jsx-runtime").JSX.Element;
3
- //# sourceMappingURL=StopIcon.d.ts.map
@@ -3,4 +3,3 @@ import { jsx as _jsx } from "react/jsx-runtime";
3
3
  export function StopIcon() {
4
4
  return (_jsx("svg", { viewBox: "0 0 16 16", width: "16", height: "16", "aria-hidden": "true", children: _jsx("rect", { x: "3", y: "3", width: "10", height: "10", rx: "3", fill: "currentColor" }) }));
5
5
  }
6
- //# sourceMappingURL=StopIcon.js.map
@@ -20,4 +20,3 @@ export interface SideChatMessages {
20
20
  readonly closeError: string;
21
21
  }
22
22
  export declare const SIDE_CHAT_MESSAGES: Readonly<Record<'en' | 'zh-CN', SideChatMessages>>;
23
- //# sourceMappingURL=messages.d.ts.map
@@ -42,4 +42,3 @@ export const SIDE_CHAT_MESSAGES = Object.freeze({
42
42
  closeError: '无法关闭侧边对话',
43
43
  }),
44
44
  });
45
- //# sourceMappingURL=messages.js.map
@@ -1,3 +1,2 @@
1
1
  /** Keep a textarea one line tall until its content reaches the CSS max-height. */
2
2
  export declare function useAutoGrowingTextarea(value: string): import("react").RefObject<HTMLTextAreaElement>;
3
- //# sourceMappingURL=use-auto-growing-textarea.d.ts.map
@@ -18,4 +18,3 @@ export function useAutoGrowingTextarea(value) {
18
18
  }, [value]);
19
19
  return ref;
20
20
  }
21
- //# sourceMappingURL=use-auto-growing-textarea.js.map
@@ -26,4 +26,3 @@ export declare function annotatedUserMessageRenderer(Original: UserNodeRenderer)
26
26
  /** Mount the composer capsule and a thin wrapper around DSH's user renderers. */
27
27
  export declare function mountParentConversationAnnotations(ctx: Rc6ClientContext, removeAnnotations: () => void): () => void;
28
28
  export {};
29
- //# sourceMappingURL=ParentConversationAnnotations.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { createElement } from 'react';
2
+ import { createElement, useLayoutEffect, useRef } from 'react';
3
3
  import { SIDE_CHAT_MESSAGES } from '../panel/messages.js';
4
4
  import { SelectionQuote } from '../panel/SelectionQuote.js';
5
5
  import { conversationAnnotations, parseAnnotatedConversationPrompt, } from './add-to-conversation.js';
@@ -7,12 +7,36 @@ import { parseReferencedConversationPrompt, } from './referenced-conversation.js
7
7
  function currentLocale() {
8
8
  return navigator.language.toLowerCase().startsWith('zh') ? 'zh-CN' : 'en';
9
9
  }
10
+ const ANNOTATION_CHIP_WIDTH_PROPERTY = '--dsh-side-chat-parent-annotation-width';
10
11
  /** The interactive annotation capsule occupying the reserved first composer row. */
11
12
  export function ParentComposerAnnotations({ input, onRemove, locale = currentLocale(), }) {
12
13
  const annotations = conversationAnnotations(input);
14
+ const dockRef = useRef(null);
15
+ useLayoutEffect(() => {
16
+ const dock = dockRef.current;
17
+ const seat = dock?.closest('[data-composer-seat]');
18
+ const chip = dock?.querySelector('.dsh-side-chat-quote-chip');
19
+ if (seat === undefined || chip === undefined || seat === null || chip === null)
20
+ return;
21
+ // The durable host reference stays in Lexical's document flow. Match its
22
+ // occupied width to this visible overlay so the caret starts at the edge
23
+ // users see instead of after the longer internal serialization label.
24
+ const syncWidth = () => {
25
+ const width = chip.getBoundingClientRect().width;
26
+ if (width > 0)
27
+ seat.style.setProperty(ANNOTATION_CHIP_WIDTH_PROPERTY, `${String(width)}px`);
28
+ };
29
+ syncWidth();
30
+ const observer = typeof ResizeObserver === 'undefined' ? undefined : new ResizeObserver(syncWidth);
31
+ observer?.observe(chip);
32
+ return () => {
33
+ observer?.disconnect();
34
+ seat.style.removeProperty(ANNOTATION_CHIP_WIDTH_PROPERTY);
35
+ };
36
+ }, [annotations.length, locale]);
13
37
  if (annotations.length === 0)
14
38
  return null;
15
- return (_jsx("div", { className: "dsh-side-chat-parent-annotation-dock", children: _jsx(SelectionQuote, { selections: annotations, messages: SIDE_CHAT_MESSAGES[locale], onRemove: onRemove }) }));
39
+ return (_jsx("div", { ref: dockRef, className: "dsh-side-chat-parent-annotation-dock", children: _jsx(SelectionQuote, { selections: annotations, messages: SIDE_CHAT_MESSAGES[locale], onRemove: onRemove }) }));
16
40
  }
17
41
  function contentText(content) {
18
42
  return content.map((block) => {
@@ -135,4 +159,3 @@ export function mountParentConversationAnnotations(ctx, removeAnnotations) {
135
159
  removeDock();
136
160
  };
137
161
  }
138
- //# sourceMappingURL=ParentConversationAnnotations.js.map
@@ -48,4 +48,3 @@ export interface AnnotatedConversationPrompt {
48
48
  export declare function parseAnnotatedConversationPrompt(text: string): AnnotatedConversationPrompt | undefined;
49
49
  /** Add the selected quote to the first child prompt. */
50
50
  export declare function buildSideChatPrompt(selection: ConversationSelection | undefined, question: string): readonly SideChatPromptPart[];
51
- //# sourceMappingURL=add-to-conversation.d.ts.map
@@ -1,4 +1,4 @@
1
- import { draftWithoutOccurrence, LEGACY_REFERENCE_PLACEHOLDER, newlyInsertedOccurrence, occurrenceMatchesDraft, occurrenceRange, referenceDisplayText, } from './composer-reference.js';
1
+ import { draftWithoutOccurrence, LEGACY_REFERENCE_PLACEHOLDER, newlyInsertedOccurrence, occurrenceEditSpan, occurrenceMatchesDraft, occurrenceRange, referenceDisplayText, } from './composer-reference.js';
2
2
  const SELECTION_REFERENCE_SOURCE = 'dsh-side-chat-selection';
3
3
  export const SELECTION_REFERENCE_LABEL = '__dsh_side_chat_annotations__';
4
4
  function escapeXmlText(value) {
@@ -163,8 +163,23 @@ function draftWithoutSelectionOccurrences(snapshot) {
163
163
  /** Remove every unsent plugin annotation while preserving the user's draft. */
164
164
  export function removeConversationAnnotations(input) {
165
165
  const snapshot = input.state.getSnapshot();
166
- if (selectionOccurrences(snapshot).length === 0)
166
+ const occurrences = selectionOccurrences(snapshot);
167
+ if (occurrences.length === 0)
167
168
  return false;
169
+ if (input.referenceMode === 'lexical' && input.replaceText !== undefined) {
170
+ for (const occurrenceId of occurrences.map(occurrence => occurrence.occurrenceId).reverse()) {
171
+ const current = input.state.getSnapshot();
172
+ const occurrence = current.occurrences.find(candidate => candidate.occurrenceId === occurrenceId);
173
+ if (occurrence === undefined)
174
+ continue;
175
+ const span = occurrenceEditSpan(input, current, occurrence, {
176
+ consumeFollowingSeparator: true,
177
+ });
178
+ if (span === undefined || !input.replaceText('', span))
179
+ return false;
180
+ }
181
+ return selectionOccurrences(input.state.getSnapshot()).length === 0;
182
+ }
168
183
  input.setDraft(draftWithoutSelectionOccurrences(snapshot));
169
184
  return true;
170
185
  }
@@ -184,7 +199,7 @@ export const selectionReferenceSource = {
184
199
  },
185
200
  },
186
201
  };
187
- function writeConversationAnnotations(input, before, annotations) {
202
+ function writeTextConversationAnnotations(input, before, annotations) {
188
203
  const draft = draftWithoutSelectionOccurrences(before);
189
204
  const insertionState = input.state.getSnapshot();
190
205
  if (insertionState.draftRev !== before.draftRev || insertionState.draft !== before.draft)
@@ -269,6 +284,85 @@ function writeConversationAnnotations(input, before, annotations) {
269
284
  && retained.offset === 0
270
285
  && occurrenceMatchesDraft(normalized, retained, SELECTION_REFERENCE_LABEL);
271
286
  }
287
+ function writeLexicalConversationAnnotations(input, before, annotations) {
288
+ if (input.replaceText === undefined)
289
+ return false;
290
+ const existing = selectionOccurrences(before);
291
+ if (existing.length > 1)
292
+ return false;
293
+ const previous = existing[0];
294
+ if (previous !== undefined && previous.length === undefined)
295
+ return false;
296
+ let insertionState = before;
297
+ let preparedGap = false;
298
+ if (previous === undefined) {
299
+ // A gap inserted before the chip is unambiguously plugin-owned. DSH's
300
+ // automatic gap cannot otherwise be distinguished from a user's leading
301
+ // space when the reference is later removed.
302
+ if (!input.replaceText(' ', { start: 0, end: 0, draftRev: before.draftRev }))
303
+ return false;
304
+ insertionState = input.state.getSnapshot();
305
+ if (insertionState.draft !== ` ${before.draft}`)
306
+ return false;
307
+ preparedGap = true;
308
+ }
309
+ const span = previous === undefined
310
+ ? { start: 0, end: 0, draftRev: insertionState.draftRev }
311
+ : occurrenceEditSpan(input, insertionState, previous);
312
+ if (span === undefined)
313
+ return false;
314
+ const ref = encodeSelectionReference(annotations);
315
+ const clipboardText = annotations.map(annotation => annotation.text).join('\n\n');
316
+ const inserted = input.insertReference({
317
+ source: SELECTION_REFERENCE_SOURCE,
318
+ ref,
319
+ label: SELECTION_REFERENCE_LABEL,
320
+ clipboardText,
321
+ }, span);
322
+ if (!inserted) {
323
+ if (preparedGap) {
324
+ const current = input.state.getSnapshot();
325
+ if (current.draft === ` ${before.draft}`) {
326
+ input.replaceText('', { start: 0, end: 1, draftRev: current.draftRev });
327
+ }
328
+ }
329
+ return false;
330
+ }
331
+ const afterInsert = input.state.getSnapshot();
332
+ const occurrence = newlyInsertedOccurrence(insertionState, afterInsert, SELECTION_REFERENCE_SOURCE, ref);
333
+ const previousEnd = previous === undefined ? 0 : previous.offset + (previous.length ?? 0);
334
+ const previousTail = previous === undefined
335
+ ? insertionState.draft
336
+ : insertionState.draft.slice(previousEnd);
337
+ const automaticGap = previousTail.startsWith(' ') ? '' : ' ';
338
+ const expectedDraft = previous === undefined
339
+ ? `${clipboardText}${insertionState.draft}`
340
+ : insertionState.draft.slice(0, previous.offset) + clipboardText + automaticGap + previousTail;
341
+ const valid = occurrence !== undefined
342
+ && selectionOccurrences(afterInsert).length === 1
343
+ && occurrence.offset === (previous?.offset ?? 0)
344
+ && occurrence.label === SELECTION_REFERENCE_LABEL
345
+ && occurrence.clipboardText === clipboardText
346
+ && occurrenceMatchesDraft(afterInsert, occurrence, SELECTION_REFERENCE_LABEL)
347
+ && afterInsert.draft === expectedDraft;
348
+ if (valid)
349
+ return true;
350
+ // Best-effort rollback for a first insertion. Replacing an existing chip is
351
+ // atomic and should never reach this path on a conforming DSH input facade.
352
+ if (previous === undefined && occurrence !== undefined) {
353
+ const rollback = occurrenceEditSpan(input, afterInsert, occurrence, {
354
+ consumeFollowingSeparator: true,
355
+ });
356
+ if (rollback !== undefined)
357
+ input.replaceText('', rollback);
358
+ }
359
+ return false;
360
+ }
361
+ function writeConversationAnnotations(input, before, annotations) {
362
+ return input.referenceMode === 'lexical'
363
+ ? writeLexicalConversationAnnotations(input, before, annotations)
364
+ : writeTextConversationAnnotations(input, before, annotations);
365
+ }
272
366
  /** Add one passage to the parent composer's aggregated annotation occurrence. */
273
367
  export function addSelectionToConversation(input, selection, comment) {
274
368
  const before = input.state.getSnapshot();
@@ -282,10 +376,8 @@ export function removeConversationAnnotation(input, annotationIndex) {
282
376
  if (!Number.isSafeInteger(annotationIndex) || annotations[annotationIndex] === undefined)
283
377
  return false;
284
378
  annotations.splice(annotationIndex, 1);
285
- if (annotations.length === 0) {
286
- input.setDraft(draftWithoutSelectionOccurrences(before));
287
- return selectionOccurrences(input.state.getSnapshot()).length === 0;
288
- }
379
+ if (annotations.length === 0)
380
+ return removeConversationAnnotations(input);
289
381
  return writeConversationAnnotations(input, before, annotations);
290
382
  }
291
383
  /** Replace the optional comment on one unsent selected-passage annotation. */
@@ -525,4 +617,3 @@ export function buildSideChatPrompt(selection, question) {
525
617
  ].join('\n'),
526
618
  }];
527
619
  }
528
- //# sourceMappingURL=add-to-conversation.js.map
@@ -16,4 +16,3 @@ export declare class ConversationAnnotationPersistence {
16
16
  private remove;
17
17
  }
18
18
  export {};
19
- //# sourceMappingURL=annotation-persistence.d.ts.map
@@ -132,4 +132,3 @@ export class ConversationAnnotationPersistence {
132
132
  }
133
133
  }
134
134
  }
135
- //# sourceMappingURL=annotation-persistence.js.map
@@ -5,35 +5,41 @@ export interface ParentComposerOccurrence {
5
5
  readonly source: string;
6
6
  readonly ref: string;
7
7
  readonly offset: number;
8
- /** Complete inline display-text length in current DSH input snapshots. */
8
+ /** Occupied projection length (display text through 0.1.1, clipboard text in 0.1.2). */
9
9
  readonly length?: number;
10
10
  /** Insert-time display label, present in current DSH input snapshots. */
11
11
  readonly label?: string;
12
12
  /** Draft-persistence projection cached by current DSH input snapshots. */
13
13
  readonly clipboardText?: string;
14
+ readonly appearance?: 'session' | 'file' | 'folder';
14
15
  }
15
16
  export interface ParentComposerInputSnapshot {
16
17
  readonly draft: string;
17
18
  readonly draftRev: number;
18
19
  readonly occurrences: readonly ParentComposerOccurrence[];
19
20
  }
21
+ export interface ParentComposerSpan {
22
+ readonly start: number;
23
+ readonly end: number;
24
+ readonly draftRev: number;
25
+ }
20
26
  export interface ParentComposerInput {
21
27
  readonly state: {
22
28
  getSnapshot(): ParentComposerInputSnapshot;
23
29
  subscribe?(listener: () => void): () => void;
24
30
  };
31
+ /** DSH 0.1.2's Lexical editor projects each reference as one mutation coordinate. */
32
+ readonly referenceMode?: 'text' | 'lexical';
25
33
  setDraft(text: string): void;
34
+ /** Atomic plain-text replacement supplied by Side Chat's scoped input-event adapter. */
35
+ replaceText?(text: string, span: ParentComposerSpan): boolean;
26
36
  insertReference(reference: {
27
37
  readonly source: string;
28
38
  readonly ref: string;
29
39
  readonly label: string;
30
40
  readonly appearance?: 'session' | 'file' | 'folder';
31
41
  readonly clipboardText: string;
32
- }, span: {
33
- readonly start: number;
34
- readonly end: number;
35
- readonly draftRev: number;
36
- }): boolean;
42
+ }, span: ParentComposerSpan): boolean;
37
43
  }
38
44
  export interface ParentConversationService {
39
45
  readonly input: {
@@ -63,10 +69,13 @@ export declare function referenceDisplayText(label: string): string;
63
69
  */
64
70
  export declare function occurrenceRange(snapshot: ParentComposerInputSnapshot, occurrence: ParentComposerOccurrence, expectedLabel: string): OccurrenceRange | undefined;
65
71
  export declare function occurrenceMatchesDraft(snapshot: ParentComposerInputSnapshot, occurrence: ParentComposerOccurrence, expectedLabel: string): boolean;
72
+ /** Convert one published occurrence range to the host input machine's mutation coordinates. */
73
+ export declare function occurrenceEditSpan(input: ParentComposerInput, snapshot: ParentComposerInputSnapshot, occurrence: ParentComposerOccurrence, options?: {
74
+ readonly consumeFollowingSeparator?: boolean;
75
+ }): ParentComposerSpan | undefined;
66
76
  /** Find the exact occurrence minted by one synchronous insertReference call. */
67
77
  export declare function newlyInsertedOccurrence(before: ParentComposerInputSnapshot, after: ParentComposerInputSnapshot, source: string, ref: string): ParentComposerOccurrence | undefined;
68
78
  /** Remove one occurrence's display range and, optionally, its separating ASCII gap. */
69
79
  export declare function draftWithoutOccurrence(snapshot: ParentComposerInputSnapshot, occurrence: ParentComposerOccurrence, expectedLabel: string, options?: {
70
80
  readonly consumeAdjacentSpace?: boolean;
71
81
  }): string | undefined;
72
- //# sourceMappingURL=composer-reference.d.ts.map
@@ -30,7 +30,40 @@ export function occurrenceMatchesDraft(snapshot, occurrence, expectedLabel) {
30
30
  if (range === undefined)
31
31
  return false;
32
32
  const text = snapshot.draft.slice(range.start, range.end);
33
- return text === LEGACY_REFERENCE_PLACEHOLDER || text === referenceDisplayText(expectedLabel);
33
+ if (text === LEGACY_REFERENCE_PLACEHOLDER || text === referenceDisplayText(expectedLabel))
34
+ return true;
35
+ return occurrence.label === expectedLabel
36
+ && occurrence.clipboardText !== undefined
37
+ && text === occurrence.clipboardText;
38
+ }
39
+ /** Convert one published occurrence range to the host input machine's mutation coordinates. */
40
+ export function occurrenceEditSpan(input, snapshot, occurrence, options = {}) {
41
+ const range = occurrenceRange(snapshot, occurrence, occurrence.label ?? '');
42
+ if (range === undefined)
43
+ return;
44
+ let start = range.start;
45
+ let end = range.end;
46
+ if (input.referenceMode === 'lexical') {
47
+ if (occurrence.length === undefined)
48
+ return;
49
+ start = occurrence.offset;
50
+ for (const candidate of [...snapshot.occurrences].sort((left, right) => left.offset - right.offset)) {
51
+ if (candidate.occurrenceId === occurrence.occurrenceId)
52
+ break;
53
+ if (candidate.offset > occurrence.offset || candidate.length === undefined)
54
+ return;
55
+ start -= candidate.length - 1;
56
+ }
57
+ end = start + 1;
58
+ }
59
+ if (options.consumeFollowingSeparator === true) {
60
+ const tail = snapshot.draft.slice(range.end);
61
+ if (tail.startsWith('\n\n'))
62
+ end += 2;
63
+ else if (tail.startsWith('\n') || tail.startsWith(' '))
64
+ end += 1;
65
+ }
66
+ return { start, end, draftRev: snapshot.draftRev };
34
67
  }
35
68
  /** Find the exact occurrence minted by one synchronous insertReference call. */
36
69
  export function newlyInsertedOccurrence(before, after, source, ref) {
@@ -54,4 +87,3 @@ export function draftWithoutOccurrence(snapshot, occurrence, expectedLabel, opti
54
87
  }
55
88
  return snapshot.draft.slice(0, start) + snapshot.draft.slice(end);
56
89
  }
57
- //# sourceMappingURL=composer-reference.js.map
@@ -1,4 +1,4 @@
1
- import type { ConversationNode } from '@deepseek-ai/dsh-client-runtime/client';
1
+ import type { ConversationNode } from '@deepseek-ai/dsh-client-ui-conversation/client';
2
2
  import type { SessionId } from '../../shared/contracts.js';
3
3
  import type { ParentComposerInput, SelectionReferenceSource } from './composer-reference.js';
4
4
  export declare const SIDE_CHAT_CONVERSATION_REFERENCE_SOURCE = "dsh-side-chat-conversation";
@@ -32,4 +32,3 @@ export declare function parseReferencedConversationPrompt(text: string): ParsedR
32
32
  export declare function addReferencedSideChatToConversation(input: ParentComposerInput, reference: ReferencedSideChatConversation): boolean;
33
33
  /** Reference codec used by the native composer chip and submit pipeline. */
34
34
  export declare const sideChatConversationReferenceSource: SelectionReferenceSource;
35
- //# sourceMappingURL=referenced-conversation.d.ts.map