@ahggg/dsh-side-chat 0.7.1 → 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.
- package/README.md +3 -3
- package/README.zh-CN.md +3 -3
- package/lib/client/apply.d.ts +0 -1
- package/lib/client/apply.js +0 -1
- package/lib/client/contracts.d.ts +0 -1
- package/lib/client/contracts.js +0 -1
- package/lib/client/index.d.ts +0 -1
- package/lib/client/index.js +0 -1
- package/lib/client/model-preference.d.ts +0 -1
- package/lib/client/model-preference.js +0 -1
- package/lib/client/panel/SelectionQuote.d.ts +0 -1
- package/lib/client/panel/SelectionQuote.js +0 -1
- package/lib/client/panel/SendIcon.d.ts +0 -1
- package/lib/client/panel/SendIcon.js +0 -1
- package/lib/client/panel/SideChatBody.d.ts +0 -1
- package/lib/client/panel/SideChatBody.js +0 -1
- package/lib/client/panel/SideChatErrorState.d.ts +0 -1
- package/lib/client/panel/SideChatErrorState.js +0 -1
- package/lib/client/panel/SideChatHeader.d.ts +0 -1
- package/lib/client/panel/SideChatHeader.js +0 -1
- package/lib/client/panel/SideChatModelSelect.d.ts +0 -1
- package/lib/client/panel/SideChatModelSelect.js +0 -1
- package/lib/client/panel/SideChatPanel.d.ts +0 -1
- package/lib/client/panel/SideChatPanel.js +0 -1
- package/lib/client/panel/StopIcon.d.ts +0 -1
- package/lib/client/panel/StopIcon.js +0 -1
- package/lib/client/panel/messages.d.ts +0 -1
- package/lib/client/panel/messages.js +0 -1
- package/lib/client/panel/use-auto-growing-textarea.d.ts +0 -1
- package/lib/client/panel/use-auto-growing-textarea.js +0 -1
- package/lib/client/parent-composer/ParentConversationAnnotations.d.ts +0 -1
- package/lib/client/parent-composer/ParentConversationAnnotations.js +26 -3
- package/lib/client/parent-composer/add-to-conversation.d.ts +15 -54
- package/lib/client/parent-composer/add-to-conversation.js +308 -63
- package/lib/client/parent-composer/annotation-persistence.d.ts +1 -2
- package/lib/client/parent-composer/annotation-persistence.js +43 -41
- package/lib/client/parent-composer/composer-reference.d.ts +81 -0
- package/lib/client/parent-composer/composer-reference.js +89 -0
- package/lib/client/parent-composer/referenced-conversation.d.ts +2 -3
- package/lib/client/parent-composer/referenced-conversation.js +36 -25
- package/lib/client/rc6/ArchivedConversation.d.ts +2 -3
- package/lib/client/rc6/ArchivedConversation.js +6 -5
- package/lib/client/rc6/Rc6SideChatOverlay.d.ts +0 -1
- package/lib/client/rc6/Rc6SideChatOverlay.js +12 -2
- package/lib/client/rc6/SideChatTool.d.ts +1 -2
- package/lib/client/rc6/SideChatTool.js +18 -9
- package/lib/client/rc6/context.d.ts +9 -3
- package/lib/client/rc6/context.js +0 -1
- package/lib/client/rc6/primitive-labels.d.ts +7 -0
- package/lib/client/rc6/primitive-labels.js +60 -0
- package/lib/client/rc6/remote-adapter.d.ts +0 -1
- package/lib/client/rc6/remote-adapter.js +4 -3
- package/lib/client/rc6/runtime-compat.d.ts +120 -0
- package/lib/client/rc6/runtime-compat.js +187 -0
- package/lib/client/rc6/sessions-adapter.d.ts +9 -4
- package/lib/client/rc6/sessions-adapter.js +74 -46
- package/lib/client/selection/ConversationAnnotationMarkers.d.ts +0 -1
- package/lib/client/selection/ConversationAnnotationMarkers.js +0 -1
- package/lib/client/selection/SelectionActions.d.ts +5 -2
- package/lib/client/selection/SelectionActions.js +66 -50
- package/lib/client/selection/selection-controller.d.ts +0 -1
- package/lib/client/selection/selection-controller.js +0 -1
- package/lib/client/selection/selection-limits.d.ts +0 -1
- package/lib/client/selection/selection-limits.js +0 -1
- package/lib/client/selection/selection-normalizer.d.ts +0 -1
- package/lib/client/selection/selection-normalizer.js +0 -1
- package/lib/client/side-chat-controller.d.ts +0 -1
- package/lib/client/side-chat-controller.js +0 -1
- package/lib/client.js +1173 -8744
- package/lib/host/archived-fork-service.d.ts +0 -1
- package/lib/host/archived-fork-service.js +71 -26
- package/lib/host/index.d.ts +0 -1
- package/lib/host/index.js +0 -1
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -1
- package/lib/remote.d.ts +0 -1
- package/lib/remote.js +0 -1
- package/lib/shared/archived-wire.d.ts +0 -1
- package/lib/shared/archived-wire.js +0 -1
- package/lib/shared/constants.d.ts +0 -1
- package/lib/shared/constants.js +0 -1
- package/lib/shared/contracts.d.ts +0 -1
- package/lib/shared/contracts.js +0 -1
- package/lib/shared/error-codes.d.ts +0 -1
- package/lib/shared/error-codes.js +0 -1
- package/lib/shared/observable.d.ts +0 -1
- package/lib/shared/observable.js +0 -1
- package/lib/typert.d.ts +0 -1
- package/lib/typert.js +64 -51
- package/package.json +60 -38
- package/lib/client/apply.d.ts.map +0 -1
- package/lib/client/apply.js.map +0 -1
- package/lib/client/contracts.d.ts.map +0 -1
- package/lib/client/contracts.js.map +0 -1
- package/lib/client/index.d.ts.map +0 -1
- package/lib/client/index.js.map +0 -1
- package/lib/client/model-preference.d.ts.map +0 -1
- package/lib/client/model-preference.js.map +0 -1
- package/lib/client/panel/SelectionQuote.d.ts.map +0 -1
- package/lib/client/panel/SelectionQuote.js.map +0 -1
- package/lib/client/panel/SendIcon.d.ts.map +0 -1
- package/lib/client/panel/SendIcon.js.map +0 -1
- package/lib/client/panel/SideChatBody.d.ts.map +0 -1
- package/lib/client/panel/SideChatBody.js.map +0 -1
- package/lib/client/panel/SideChatErrorState.d.ts.map +0 -1
- package/lib/client/panel/SideChatErrorState.js.map +0 -1
- package/lib/client/panel/SideChatHeader.d.ts.map +0 -1
- package/lib/client/panel/SideChatHeader.js.map +0 -1
- package/lib/client/panel/SideChatModelSelect.d.ts.map +0 -1
- package/lib/client/panel/SideChatModelSelect.js.map +0 -1
- package/lib/client/panel/SideChatPanel.d.ts.map +0 -1
- package/lib/client/panel/SideChatPanel.js.map +0 -1
- package/lib/client/panel/StopIcon.d.ts.map +0 -1
- package/lib/client/panel/StopIcon.js.map +0 -1
- package/lib/client/panel/messages.d.ts.map +0 -1
- package/lib/client/panel/messages.js.map +0 -1
- package/lib/client/panel/use-auto-growing-textarea.d.ts.map +0 -1
- package/lib/client/panel/use-auto-growing-textarea.js.map +0 -1
- package/lib/client/parent-composer/ParentConversationAnnotations.d.ts.map +0 -1
- package/lib/client/parent-composer/ParentConversationAnnotations.js.map +0 -1
- package/lib/client/parent-composer/add-to-conversation.d.ts.map +0 -1
- package/lib/client/parent-composer/add-to-conversation.js.map +0 -1
- package/lib/client/parent-composer/annotation-persistence.d.ts.map +0 -1
- package/lib/client/parent-composer/annotation-persistence.js.map +0 -1
- package/lib/client/parent-composer/referenced-conversation.d.ts.map +0 -1
- package/lib/client/parent-composer/referenced-conversation.js.map +0 -1
- package/lib/client/rc6/ArchivedConversation.d.ts.map +0 -1
- package/lib/client/rc6/ArchivedConversation.js.map +0 -1
- package/lib/client/rc6/Rc6SideChatOverlay.d.ts.map +0 -1
- package/lib/client/rc6/Rc6SideChatOverlay.js.map +0 -1
- package/lib/client/rc6/SideChatTool.d.ts.map +0 -1
- package/lib/client/rc6/SideChatTool.js.map +0 -1
- package/lib/client/rc6/context.d.ts.map +0 -1
- package/lib/client/rc6/context.js.map +0 -1
- package/lib/client/rc6/remote-adapter.d.ts.map +0 -1
- package/lib/client/rc6/remote-adapter.js.map +0 -1
- package/lib/client/rc6/sessions-adapter.d.ts.map +0 -1
- package/lib/client/rc6/sessions-adapter.js.map +0 -1
- package/lib/client/selection/ConversationAnnotationMarkers.d.ts.map +0 -1
- package/lib/client/selection/ConversationAnnotationMarkers.js.map +0 -1
- package/lib/client/selection/SelectionActions.d.ts.map +0 -1
- package/lib/client/selection/SelectionActions.js.map +0 -1
- package/lib/client/selection/selection-controller.d.ts.map +0 -1
- package/lib/client/selection/selection-controller.js.map +0 -1
- package/lib/client/selection/selection-limits.d.ts.map +0 -1
- package/lib/client/selection/selection-limits.js.map +0 -1
- package/lib/client/selection/selection-normalizer.d.ts.map +0 -1
- package/lib/client/selection/selection-normalizer.js.map +0 -1
- package/lib/client/side-chat-controller.d.ts.map +0 -1
- package/lib/client/side-chat-controller.js.map +0 -1
- package/lib/client.js.map +0 -1
- package/lib/host/archived-fork-service.d.ts.map +0 -1
- package/lib/host/archived-fork-service.js.map +0 -1
- package/lib/host/index.d.ts.map +0 -1
- package/lib/host/index.js.map +0 -1
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/remote.d.ts.map +0 -1
- package/lib/remote.js.map +0 -1
- package/lib/shared/archived-wire.d.ts.map +0 -1
- package/lib/shared/archived-wire.js.map +0 -1
- package/lib/shared/constants.d.ts.map +0 -1
- package/lib/shared/constants.js.map +0 -1
- package/lib/shared/contracts.d.ts.map +0 -1
- package/lib/shared/contracts.js.map +0 -1
- package/lib/shared/error-codes.d.ts.map +0 -1
- package/lib/shared/error-codes.js.map +0 -1
- package/lib/shared/observable.d.ts.map +0 -1
- package/lib/shared/observable.js.map +0 -1
- package/lib/typert.d.ts.map +0 -1
- 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.
|
|
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.
|
|
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
|
|
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.
|
|
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.
|
|
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
|
|
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
|
package/lib/client/apply.d.ts
CHANGED
package/lib/client/apply.js
CHANGED
package/lib/client/contracts.js
CHANGED
package/lib/client/index.d.ts
CHANGED
|
@@ -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
|
package/lib/client/index.js
CHANGED
|
@@ -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
|
|
@@ -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
|
|
@@ -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 { 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
|
|
@@ -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
|
|
@@ -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
|
|
@@ -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
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { Context } from '@deepseek-ai/cordis';
|
|
2
1
|
import type { ConversationSelection, SideChatPromptPart } from '../../shared/contracts.js';
|
|
2
|
+
import type { ParentComposerInput, ParentComposerInputSnapshot, SelectionReferenceSource } from './composer-reference.js';
|
|
3
|
+
export type { ParentComposerInput, ParentComposerInputSnapshot, ParentComposerOccurrence, ParentConversationService, SelectionReferenceSource, } from './composer-reference.js';
|
|
3
4
|
export declare const SELECTION_REFERENCE_LABEL = "__dsh_side_chat_annotations__";
|
|
4
5
|
export interface ConversationAnnotation {
|
|
5
6
|
readonly text: string;
|
|
@@ -10,55 +11,6 @@ export interface ConversationSelectionAnnotation extends ConversationAnnotation
|
|
|
10
11
|
readonly annotationIndex: number;
|
|
11
12
|
readonly selection: ConversationSelection;
|
|
12
13
|
}
|
|
13
|
-
export interface ParentComposerOccurrence {
|
|
14
|
-
readonly occurrenceId: number;
|
|
15
|
-
readonly source: string;
|
|
16
|
-
readonly ref: string;
|
|
17
|
-
readonly offset: number;
|
|
18
|
-
/** Present in newer DSH input snapshots; older rc.6 fixtures omit it. */
|
|
19
|
-
readonly length?: number;
|
|
20
|
-
/** Draft-persistence projection cached by newer DSH versions. */
|
|
21
|
-
readonly clipboardText?: string;
|
|
22
|
-
}
|
|
23
|
-
export interface ParentComposerInputSnapshot {
|
|
24
|
-
readonly draft: string;
|
|
25
|
-
readonly draftRev: number;
|
|
26
|
-
readonly occurrences: readonly ParentComposerOccurrence[];
|
|
27
|
-
}
|
|
28
|
-
export interface ParentComposerInput {
|
|
29
|
-
readonly state: {
|
|
30
|
-
getSnapshot(): ParentComposerInputSnapshot;
|
|
31
|
-
subscribe?(listener: () => void): () => void;
|
|
32
|
-
};
|
|
33
|
-
setDraft(text: string): void;
|
|
34
|
-
insertReference(reference: {
|
|
35
|
-
readonly source: string;
|
|
36
|
-
readonly ref: string;
|
|
37
|
-
readonly label: string;
|
|
38
|
-
readonly appearance?: 'session' | 'file' | 'folder';
|
|
39
|
-
readonly clipboardText: string;
|
|
40
|
-
}, span: {
|
|
41
|
-
readonly start: number;
|
|
42
|
-
readonly end: number;
|
|
43
|
-
readonly draftRev: number;
|
|
44
|
-
}): boolean;
|
|
45
|
-
}
|
|
46
|
-
export interface ParentConversationService {
|
|
47
|
-
readonly input: {
|
|
48
|
-
for(scope: Context): ParentComposerInput;
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
export interface SelectionReferenceSource {
|
|
52
|
-
readonly trigger: '@';
|
|
53
|
-
readonly name: string;
|
|
54
|
-
readonly order: number;
|
|
55
|
-
candidates(): Promise<readonly never[]>;
|
|
56
|
-
onPick(): undefined;
|
|
57
|
-
readonly codec: {
|
|
58
|
-
clipboardText(ref: string): string;
|
|
59
|
-
serialize(ref: string, signal: AbortSignal): Promise<string>;
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
14
|
export declare function decodeSelectionReference(ref: string): readonly ConversationAnnotation[];
|
|
63
15
|
/** Read all plugin annotations represented by the current DSH input occurrence. */
|
|
64
16
|
export declare function conversationAnnotations(snapshot: ParentComposerInputSnapshot): readonly ConversationAnnotation[];
|
|
@@ -70,14 +22,24 @@ export declare function removeConversationAnnotations(input: ParentComposerInput
|
|
|
70
22
|
export declare const selectionReferenceSource: SelectionReferenceSource;
|
|
71
23
|
/** Add one passage to the parent composer's aggregated annotation occurrence. */
|
|
72
24
|
export declare function addSelectionToConversation(input: ParentComposerInput, selection: ConversationSelection, comment?: string): boolean;
|
|
25
|
+
/** Remove one unsent selected-passage annotation, retaining the aggregate when needed. */
|
|
26
|
+
export declare function removeConversationAnnotation(input: ParentComposerInput, annotationIndex: number): boolean;
|
|
73
27
|
/** Replace the optional comment on one unsent selected-passage annotation. */
|
|
74
28
|
export declare function updateConversationAnnotation(input: ParentComposerInput, annotationIndex: number, comment?: string): boolean;
|
|
29
|
+
export interface ConversationAnnotationRecoveryRecord {
|
|
30
|
+
readonly ref: string;
|
|
31
|
+
readonly displayDraft: string;
|
|
32
|
+
readonly mirrorDraft: string;
|
|
33
|
+
readonly baseDraft: string;
|
|
34
|
+
}
|
|
35
|
+
/** Describe both the display draft and DSH's persisted clipboard projection. */
|
|
36
|
+
export declare function conversationAnnotationRecoveryRecord(snapshot: ParentComposerInputSnapshot): ConversationAnnotationRecoveryRecord | undefined;
|
|
75
37
|
/** Return the valid aggregated reference currently occupying the leading draft slot. */
|
|
76
38
|
export declare function conversationAnnotationReference(snapshot: ParentComposerInputSnapshot): string | undefined;
|
|
77
|
-
/** Remove
|
|
39
|
+
/** Remove the plugin-owned prefix when rc.6 restored its draft without occurrences. */
|
|
78
40
|
export declare function removeOrphanedConversationAnnotationPlaceholder(input: ParentComposerInput): boolean;
|
|
79
|
-
/** Rehydrate a lost occurrence
|
|
80
|
-
export declare function restoreConversationAnnotationReference(input: ParentComposerInput, ref: string): boolean;
|
|
41
|
+
/** Rehydrate a lost occurrence over either its display draft or exact mirror projection. */
|
|
42
|
+
export declare function restoreConversationAnnotationReference(input: ParentComposerInput, ref: string, expectedMirrorDraft?: string, expectedBaseDraft?: string): boolean;
|
|
81
43
|
export interface AnnotatedConversationPrompt {
|
|
82
44
|
readonly annotations: readonly ConversationAnnotation[];
|
|
83
45
|
readonly message: string;
|
|
@@ -86,4 +48,3 @@ export interface AnnotatedConversationPrompt {
|
|
|
86
48
|
export declare function parseAnnotatedConversationPrompt(text: string): AnnotatedConversationPrompt | undefined;
|
|
87
49
|
/** Add the selected quote to the first child prompt. */
|
|
88
50
|
export declare function buildSideChatPrompt(selection: ConversationSelection | undefined, question: string): readonly SideChatPromptPart[];
|
|
89
|
-
//# sourceMappingURL=add-to-conversation.d.ts.map
|