@ahggg/dsh-side-chat 0.1.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +114 -0
- package/README.zh-CN.md +114 -0
- package/cordis.patch.yml +3 -0
- package/lib/client/apply.d.ts +5 -0
- package/lib/client/apply.d.ts.map +1 -0
- package/lib/client/apply.js +35 -0
- package/lib/client/apply.js.map +1 -0
- package/lib/client/contracts.d.ts +76 -0
- package/lib/client/contracts.d.ts.map +1 -0
- package/lib/client/contracts.js +2 -0
- package/lib/client/contracts.js.map +1 -0
- package/lib/client/index.d.ts +11 -0
- package/lib/client/index.d.ts.map +1 -0
- package/lib/client/index.js +9 -0
- package/lib/client/index.js.map +1 -0
- package/lib/client/panel/SelectionQuote.d.ts +10 -0
- package/lib/client/panel/SelectionQuote.d.ts.map +1 -0
- package/lib/client/panel/SelectionQuote.js +8 -0
- package/lib/client/panel/SelectionQuote.js.map +1 -0
- package/lib/client/panel/SendIcon.d.ts +3 -0
- package/lib/client/panel/SendIcon.d.ts.map +1 -0
- package/lib/client/panel/SendIcon.js +6 -0
- package/lib/client/panel/SendIcon.js.map +1 -0
- package/lib/client/panel/SideChatBody.d.ts +6 -0
- package/lib/client/panel/SideChatBody.d.ts.map +1 -0
- package/lib/client/panel/SideChatBody.js +6 -0
- package/lib/client/panel/SideChatBody.js.map +1 -0
- package/lib/client/panel/SideChatErrorState.d.ts +9 -0
- package/lib/client/panel/SideChatErrorState.d.ts.map +1 -0
- package/lib/client/panel/SideChatErrorState.js +6 -0
- package/lib/client/panel/SideChatErrorState.js.map +1 -0
- package/lib/client/panel/SideChatHeader.d.ts +9 -0
- package/lib/client/panel/SideChatHeader.d.ts.map +1 -0
- package/lib/client/panel/SideChatHeader.js +5 -0
- package/lib/client/panel/SideChatHeader.js.map +1 -0
- package/lib/client/panel/SideChatPanel.d.ts +17 -0
- package/lib/client/panel/SideChatPanel.d.ts.map +1 -0
- package/lib/client/panel/SideChatPanel.js +35 -0
- package/lib/client/panel/SideChatPanel.js.map +1 -0
- package/lib/client/panel/messages.d.ts +22 -0
- package/lib/client/panel/messages.d.ts.map +1 -0
- package/lib/client/panel/messages.js +43 -0
- package/lib/client/panel/messages.js.map +1 -0
- package/lib/client/panel/use-auto-growing-textarea.d.ts +3 -0
- package/lib/client/panel/use-auto-growing-textarea.d.ts.map +1 -0
- package/lib/client/panel/use-auto-growing-textarea.js +21 -0
- package/lib/client/panel/use-auto-growing-textarea.js.map +1 -0
- package/lib/client/parent-composer/add-to-conversation.d.ts +4 -0
- package/lib/client/parent-composer/add-to-conversation.d.ts.map +1 -0
- package/lib/client/parent-composer/add-to-conversation.js +25 -0
- package/lib/client/parent-composer/add-to-conversation.js.map +1 -0
- package/lib/client/rc6/ArchivedConversation.d.ts +13 -0
- package/lib/client/rc6/ArchivedConversation.d.ts.map +1 -0
- package/lib/client/rc6/ArchivedConversation.js +170 -0
- package/lib/client/rc6/ArchivedConversation.js.map +1 -0
- package/lib/client/rc6/Rc6SideChatOverlay.d.ts +8 -0
- package/lib/client/rc6/Rc6SideChatOverlay.d.ts.map +1 -0
- package/lib/client/rc6/Rc6SideChatOverlay.js +136 -0
- package/lib/client/rc6/Rc6SideChatOverlay.js.map +1 -0
- package/lib/client/rc6/context.d.ts +10 -0
- package/lib/client/rc6/context.d.ts.map +1 -0
- package/lib/client/rc6/context.js +2 -0
- package/lib/client/rc6/context.js.map +1 -0
- package/lib/client/rc6/remote-adapter.d.ts +7 -0
- package/lib/client/rc6/remote-adapter.d.ts.map +1 -0
- package/lib/client/rc6/remote-adapter.js +29 -0
- package/lib/client/rc6/remote-adapter.js.map +1 -0
- package/lib/client/rc6/sessions-adapter.d.ts +34 -0
- package/lib/client/rc6/sessions-adapter.d.ts.map +1 -0
- package/lib/client/rc6/sessions-adapter.js +252 -0
- package/lib/client/rc6/sessions-adapter.js.map +1 -0
- package/lib/client/selection/SelectionActions.d.ts +9 -0
- package/lib/client/selection/SelectionActions.d.ts.map +1 -0
- package/lib/client/selection/SelectionActions.js +20 -0
- package/lib/client/selection/SelectionActions.js.map +1 -0
- package/lib/client/selection/selection-controller.d.ts +26 -0
- package/lib/client/selection/selection-controller.d.ts.map +1 -0
- package/lib/client/selection/selection-controller.js +111 -0
- package/lib/client/selection/selection-controller.js.map +1 -0
- package/lib/client/selection/selection-limits.d.ts +7 -0
- package/lib/client/selection/selection-limits.d.ts.map +1 -0
- package/lib/client/selection/selection-limits.js +19 -0
- package/lib/client/selection/selection-limits.js.map +1 -0
- package/lib/client/selection/selection-normalizer.d.ts +16 -0
- package/lib/client/selection/selection-normalizer.d.ts.map +1 -0
- package/lib/client/selection/selection-normalizer.js +48 -0
- package/lib/client/selection/selection-normalizer.js.map +1 -0
- package/lib/client/side-chat-controller.d.ts +55 -0
- package/lib/client/side-chat-controller.d.ts.map +1 -0
- package/lib/client/side-chat-controller.js +379 -0
- package/lib/client/side-chat-controller.js.map +1 -0
- package/lib/client.js +5988 -0
- package/lib/client.js.map +1 -0
- package/lib/host/archived-fork-service.d.ts +27 -0
- package/lib/host/archived-fork-service.d.ts.map +1 -0
- package/lib/host/archived-fork-service.js +186 -0
- package/lib/host/archived-fork-service.js.map +1 -0
- package/lib/host/index.d.ts +2 -0
- package/lib/host/index.d.ts.map +1 -0
- package/lib/host/index.js +2 -0
- package/lib/host/index.js.map +1 -0
- package/lib/index.d.ts +23 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +24 -0
- package/lib/index.js.map +1 -0
- package/lib/remote.d.ts +22 -0
- package/lib/remote.d.ts.map +1 -0
- package/lib/remote.js +8 -0
- package/lib/remote.js.map +1 -0
- package/lib/shared/archived-wire.d.ts +100 -0
- package/lib/shared/archived-wire.d.ts.map +1 -0
- package/lib/shared/archived-wire.js +31 -0
- package/lib/shared/archived-wire.js.map +1 -0
- package/lib/shared/constants.d.ts +16 -0
- package/lib/shared/constants.d.ts.map +1 -0
- package/lib/shared/constants.js +16 -0
- package/lib/shared/constants.js.map +1 -0
- package/lib/shared/contracts.d.ts +92 -0
- package/lib/shared/contracts.d.ts.map +1 -0
- package/lib/shared/contracts.js +4 -0
- package/lib/shared/contracts.js.map +1 -0
- package/lib/shared/error-codes.d.ts +4 -0
- package/lib/shared/error-codes.d.ts.map +1 -0
- package/lib/shared/error-codes.js +25 -0
- package/lib/shared/error-codes.js.map +1 -0
- package/lib/shared/observable.d.ts +22 -0
- package/lib/shared/observable.d.ts.map +1 -0
- package/lib/shared/observable.js +40 -0
- package/lib/shared/observable.js.map +1 -0
- package/lib/typert.d.ts +80 -0
- package/lib/typert.d.ts.map +1 -0
- package/lib/typert.js +40 -0
- package/lib/typert.js.map +1 -0
- package/package.json +126 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 dsh-side-chat contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# dsh-side-chat
|
|
2
|
+
|
|
3
|
+
Ask a focused follow-up about selected text without leaving your current DeepSeek Harness conversation.
|
|
4
|
+
|
|
5
|
+
> Compatibility: this release targets `@deepseek-ai/dsh@0.1.0-rc.6` exactly.
|
|
6
|
+
|
|
7
|
+
[简体中文](README.zh-CN.md)
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
Install DSH rc.6 if it is not already available, then add the plugin to the Web profile:
|
|
12
|
+
|
|
13
|
+
```powershell
|
|
14
|
+
npm install --global @deepseek-ai/dsh@0.1.0-rc.6
|
|
15
|
+
dsh plugin --profile web add @ahggg/dsh-side-chat@0.1.0-alpha.1
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Start DSH from the project you want the agent to work in:
|
|
19
|
+
|
|
20
|
+
```powershell
|
|
21
|
+
cd E:\path\to\your-project
|
|
22
|
+
dsh web --port 3080
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Open the URL printed by DSH. The plugin loads automatically in the Web client.
|
|
26
|
+
|
|
27
|
+
## Use Side Chat
|
|
28
|
+
|
|
29
|
+
1. Complete at least one turn in the main conversation.
|
|
30
|
+
2. Select text inside one completed user or assistant message.
|
|
31
|
+
3. Click `Ask in side chat`.
|
|
32
|
+
4. Enter a question and press `Enter` to send it.
|
|
33
|
+
5. Press `Esc` or click `×` when you are done.
|
|
34
|
+
|
|
35
|
+
Useful details:
|
|
36
|
+
|
|
37
|
+
- `Shift+Enter` inserts a newline.
|
|
38
|
+
- The input grows with its content and becomes scrollable at its maximum height.
|
|
39
|
+
- Hover over `1 annotation` to preview the selected text.
|
|
40
|
+
- Before the first send, hover over the annotation and click `×` to remove it.
|
|
41
|
+
- The main conversation stays visible and is never switched to the child Session.
|
|
42
|
+
|
|
43
|
+
## What happens to the conversation
|
|
44
|
+
|
|
45
|
+
The first send creates a real DSH Session fork at the selected message. The child inherits the complete event prefix, model configuration, presets, and workspace. Keeping the prefix unchanged is friendly to provider prompt caching, although a cache hit is never guaranteed.
|
|
46
|
+
|
|
47
|
+
Closing Side Chat stops active work, archives the child Session, and releases its Agent. It does not delete the child's history from disk. The child and copied prefix therefore consume normal DSH Session storage.
|
|
48
|
+
|
|
49
|
+
The parent and child share the same workspace. File changes, commands, and other tool side effects made in Side Chat are real and are not reverted when the panel closes.
|
|
50
|
+
|
|
51
|
+
## Current limitations
|
|
52
|
+
|
|
53
|
+
- A selection must stay inside one completed message.
|
|
54
|
+
- Attachments, `Add to conversation`, and `/side` are not supported yet.
|
|
55
|
+
- Closed Side Chats cannot be reopened from the panel.
|
|
56
|
+
- There is no automatic history cleanup or “keep as normal chat” action.
|
|
57
|
+
- An archived child may briefly appear in normal Session lists.
|
|
58
|
+
|
|
59
|
+
## Upgrade or remove
|
|
60
|
+
|
|
61
|
+
Install the new exact plugin version and restart DSH:
|
|
62
|
+
|
|
63
|
+
```powershell
|
|
64
|
+
dsh plugin --profile web add @ahggg/dsh-side-chat@<version>
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Remove the plugin with:
|
|
68
|
+
|
|
69
|
+
```powershell
|
|
70
|
+
dsh plugin --profile web remove @ahggg/dsh-side-chat
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
<details>
|
|
74
|
+
<summary>Local development and publishing</summary>
|
|
75
|
+
|
|
76
|
+
Requires Node.js `^22.19.0 || >=24.0.0` and pnpm `11.7.0`.
|
|
77
|
+
|
|
78
|
+
```powershell
|
|
79
|
+
pnpm install --frozen-lockfile
|
|
80
|
+
pnpm check
|
|
81
|
+
pnpm clean-profile:verify
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Build and install a local package:
|
|
85
|
+
|
|
86
|
+
```powershell
|
|
87
|
+
npm pack
|
|
88
|
+
dsh plugin --profile web add .\ahggg-dsh-side-chat-0.1.0-alpha.1.tgz
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Publish after the checks pass:
|
|
92
|
+
|
|
93
|
+
```powershell
|
|
94
|
+
npm pack --dry-run
|
|
95
|
+
npm pack
|
|
96
|
+
npm login
|
|
97
|
+
npm publish .\ahggg-dsh-side-chat-0.1.0-alpha.1.tgz --access public --tag alpha
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
The first release must be published manually because npm only allows Trusted Publishing to be configured for an existing package. After `0.1.0-alpha.1` exists, configure its npm Trusted Publisher with:
|
|
101
|
+
|
|
102
|
+
- Organization or user: `AHGGG`
|
|
103
|
+
- Repository: `dsh-side-chat`
|
|
104
|
+
- Workflow: `release.yml`
|
|
105
|
+
- Environment: `npm`
|
|
106
|
+
- Allowed action: `npm publish`
|
|
107
|
+
|
|
108
|
+
Future releases follow the same flow as `pi-kanban`: conventional commits update a release pull request; merging that pull request creates the GitHub prerelease and publishes the matching npm version under the `alpha` tag through OIDC. No `NPM_TOKEN` secret is required.
|
|
109
|
+
|
|
110
|
+
</details>
|
|
111
|
+
|
|
112
|
+
## License
|
|
113
|
+
|
|
114
|
+
MIT
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# dsh-side-chat
|
|
2
|
+
|
|
3
|
+
在不离开当前 DeepSeek Harness 主会话的情况下,针对选中的文本发起一个独立的侧边对话。
|
|
4
|
+
|
|
5
|
+
> 兼容性:当前版本仅适配 `@deepseek-ai/dsh@0.1.0-rc.6`。
|
|
6
|
+
|
|
7
|
+
[English](README.md)
|
|
8
|
+
|
|
9
|
+
## 安装
|
|
10
|
+
|
|
11
|
+
如果尚未安装 DSH rc.6,先安装它,然后把插件添加到 Web profile:
|
|
12
|
+
|
|
13
|
+
```powershell
|
|
14
|
+
npm install --global @deepseek-ai/dsh@0.1.0-rc.6
|
|
15
|
+
dsh plugin --profile web add @ahggg/dsh-side-chat@0.1.0-alpha.1
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
从希望 Agent 操作的真实工程目录启动 DSH:
|
|
19
|
+
|
|
20
|
+
```powershell
|
|
21
|
+
cd E:\path\to\your-project
|
|
22
|
+
dsh web --port 3080
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
打开 DSH 输出的网址,插件会自动加载到 Web 客户端中。
|
|
26
|
+
|
|
27
|
+
## 使用 Side Chat
|
|
28
|
+
|
|
29
|
+
1. 在主会话中至少完成一轮对话。
|
|
30
|
+
2. 在一条已完成的用户或助手消息内选中文字。
|
|
31
|
+
3. 点击 `Ask in side chat`。
|
|
32
|
+
4. 输入问题,按 `Enter` 发送。
|
|
33
|
+
5. 完成后按 `Esc`,或者点击 `×` 关闭。
|
|
34
|
+
|
|
35
|
+
常用操作:
|
|
36
|
+
|
|
37
|
+
- `Shift+Enter` 换行。
|
|
38
|
+
- 输入框会随内容自动增高,达到最大高度后在内部滚动。
|
|
39
|
+
- hover `1 annotation` 可以预览所选文本。
|
|
40
|
+
- 第一次发送前,可以 hover annotation 并点击 `×` 移除引用。
|
|
41
|
+
- 主会话会一直保留在页面中,不会自动切换到 child Session。
|
|
42
|
+
|
|
43
|
+
## 会话和数据如何处理
|
|
44
|
+
|
|
45
|
+
第一次发送时,插件会在所选消息处创建一个真实的 DSH Session fork。child 会继承完整事件前缀、模型配置、preset 和 workspace。保持前缀不变有利于供应商的 prompt cache 复用,但不保证一定命中缓存。
|
|
46
|
+
|
|
47
|
+
关闭 Side Chat 时,插件会停止正在运行的任务、归档 child Session,并释放其 Agent;不会删除 child 的磁盘历史。因此,child 和复制的完整前缀会占用正常的 DSH Session 存储空间。
|
|
48
|
+
|
|
49
|
+
父会话与 child 共享同一个 workspace。Side Chat 中产生的文件修改、命令执行及其他工具副作用都是真实的,关闭面板不会撤销它们。
|
|
50
|
+
|
|
51
|
+
## 当前限制
|
|
52
|
+
|
|
53
|
+
- 选区必须位于同一条已完成消息内。
|
|
54
|
+
- 暂不支持附件、`Add to conversation` 和 `/side`。
|
|
55
|
+
- 关闭后不能从面板重新打开原 Side Chat。
|
|
56
|
+
- 暂无自动历史清理或“保留为普通会话”操作。
|
|
57
|
+
- 已归档的 child 可能短暂出现在普通会话列表中。
|
|
58
|
+
|
|
59
|
+
## 升级或卸载
|
|
60
|
+
|
|
61
|
+
安装新的精确版本并重启 DSH:
|
|
62
|
+
|
|
63
|
+
```powershell
|
|
64
|
+
dsh plugin --profile web add @ahggg/dsh-side-chat@<version>
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
卸载插件:
|
|
68
|
+
|
|
69
|
+
```powershell
|
|
70
|
+
dsh plugin --profile web remove @ahggg/dsh-side-chat
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
<details>
|
|
74
|
+
<summary>本地开发与发布</summary>
|
|
75
|
+
|
|
76
|
+
要求 Node.js `^22.19.0 || >=24.0.0` 和 pnpm `11.7.0`。
|
|
77
|
+
|
|
78
|
+
```powershell
|
|
79
|
+
pnpm install --frozen-lockfile
|
|
80
|
+
pnpm check
|
|
81
|
+
pnpm clean-profile:verify
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
构建并安装本地包:
|
|
85
|
+
|
|
86
|
+
```powershell
|
|
87
|
+
npm pack
|
|
88
|
+
dsh plugin --profile web add .\ahggg-dsh-side-chat-0.1.0-alpha.1.tgz
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
检查通过后发布:
|
|
92
|
+
|
|
93
|
+
```powershell
|
|
94
|
+
npm pack --dry-run
|
|
95
|
+
npm pack
|
|
96
|
+
npm login
|
|
97
|
+
npm publish .\ahggg-dsh-side-chat-0.1.0-alpha.1.tgz --access public --tag alpha
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
npm 只允许已存在的包配置 Trusted Publishing,所以 `0.1.0-alpha.1` 首版需要手动发布一次。发布成功后,在 npm 中为它配置 Trusted Publisher:
|
|
101
|
+
|
|
102
|
+
- Organization or user:`AHGGG`
|
|
103
|
+
- Repository:`dsh-side-chat`
|
|
104
|
+
- Workflow:`release.yml`
|
|
105
|
+
- Environment:`npm`
|
|
106
|
+
- Allowed action:`npm publish`
|
|
107
|
+
|
|
108
|
+
后续发布与 `pi-kanban` 一致:conventional commits 自动更新 release PR;合并 release PR 后创建 GitHub prerelease,并通过 OIDC 将对应版本发布到 npm 的 `alpha` tag,不需要配置 `NPM_TOKEN`。
|
|
109
|
+
|
|
110
|
+
</details>
|
|
111
|
+
|
|
112
|
+
## 许可证
|
|
113
|
+
|
|
114
|
+
MIT
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply.d.ts","sourceRoot":"","sources":["../../src/client/apply.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAWlD,eAAO,MAAM,IAAI,qBAAqB,CAAA;AACtC,eAAO,MAAM,MAAM,UAAkC,CAAA;AAErD,wBAAsB,KAAK,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CA0BvD"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { createElement } from 'react';
|
|
2
|
+
import sideChatCss from './panel/side-chat.css';
|
|
3
|
+
import { SideChatController } from './side-chat-controller.js';
|
|
4
|
+
import { mountArchivedRemote } from './rc6/remote-adapter.js';
|
|
5
|
+
import { Rc6SideChatOverlay } from './rc6/Rc6SideChatOverlay.js';
|
|
6
|
+
import { Rc6SideChatSessions } from './rc6/sessions-adapter.js';
|
|
7
|
+
export const name = 'side-chat-client';
|
|
8
|
+
export const inject = ['remote', 'sessions', 'slots'];
|
|
9
|
+
export async function apply(ctx) {
|
|
10
|
+
const stylesheet = document.createElement('style');
|
|
11
|
+
stylesheet.textContent = sideChatCss;
|
|
12
|
+
stylesheet.dataset.plugin = 'dsh-side-chat';
|
|
13
|
+
stylesheet.dataset['dshSideChat'] = 'styles';
|
|
14
|
+
document.head.append(stylesheet);
|
|
15
|
+
const clientCtx = ctx;
|
|
16
|
+
const mounted = await mountArchivedRemote(clientCtx);
|
|
17
|
+
const sessions = new Rc6SideChatSessions(clientCtx);
|
|
18
|
+
const controller = new SideChatController(mounted.remote, sessions);
|
|
19
|
+
const removeOverlay = clientCtx.slots.inject('shell.overlay', () => clientCtx.slots.register({
|
|
20
|
+
name: 'shell.overlay',
|
|
21
|
+
id: 'dsh-side-chat',
|
|
22
|
+
order: 90,
|
|
23
|
+
}, () => createElement(Rc6SideChatOverlay, { controller, sessions })));
|
|
24
|
+
ctx.effect(() => async () => {
|
|
25
|
+
try {
|
|
26
|
+
await controller.dispose();
|
|
27
|
+
}
|
|
28
|
+
finally {
|
|
29
|
+
removeOverlay();
|
|
30
|
+
await mounted.dispose();
|
|
31
|
+
stylesheet.remove();
|
|
32
|
+
}
|
|
33
|
+
}, 'dsh-side-chat.clientLifecycle');
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=apply.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply.js","sourceRoot":"","sources":["../../src/client/apply.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAKrC,OAAO,WAAW,MAAM,uBAAuB,CAAA;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAA;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAG/D,MAAM,CAAC,MAAM,IAAI,GAAG,kBAAkB,CAAA;AACtC,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,QAAQ,EAAE,UAAU,EAAE,OAAO,CAAC,CAAA;AAErD,MAAM,CAAC,KAAK,UAAU,KAAK,CAAC,GA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SideChatPromptPart, SideChatWireError } from '../shared/contracts.js';
|
|
2
|
+
import type { HostObservable } from '../shared/observable.js';
|
|
3
|
+
export interface SideChatSessionSnapshot {
|
|
4
|
+
readonly status: 'idle' | 'running' | 'needs-input' | 'needs-approval' | 'failed' | 'interrupted';
|
|
5
|
+
}
|
|
6
|
+
export interface SideChatQuestionAnswer {
|
|
7
|
+
readonly answers: readonly {
|
|
8
|
+
readonly id: string;
|
|
9
|
+
readonly selected: readonly string[];
|
|
10
|
+
readonly custom?: string;
|
|
11
|
+
}[];
|
|
12
|
+
}
|
|
13
|
+
export interface SideChatSessionBinding extends HostObservable<SideChatSessionSnapshot> {
|
|
14
|
+
readonly sessionId: SessionId;
|
|
15
|
+
prompt(content: readonly SideChatPromptPart[], mode: 'queue' | 'steer'): Promise<{
|
|
16
|
+
readonly ok: true;
|
|
17
|
+
} | {
|
|
18
|
+
readonly ok: false;
|
|
19
|
+
readonly error: SideChatWireError;
|
|
20
|
+
}>;
|
|
21
|
+
updateQueue(itemId: string, action: {
|
|
22
|
+
readonly kind: 'edit';
|
|
23
|
+
readonly content: readonly SideChatPromptPart[];
|
|
24
|
+
} | {
|
|
25
|
+
readonly kind: 'remove';
|
|
26
|
+
} | {
|
|
27
|
+
readonly kind: 'steer';
|
|
28
|
+
}): Promise<{
|
|
29
|
+
readonly ok: true;
|
|
30
|
+
} | {
|
|
31
|
+
readonly ok: false;
|
|
32
|
+
readonly error: SideChatWireError;
|
|
33
|
+
}>;
|
|
34
|
+
cancel(): Promise<{
|
|
35
|
+
readonly ok: true;
|
|
36
|
+
} | {
|
|
37
|
+
readonly ok: false;
|
|
38
|
+
readonly error: SideChatWireError;
|
|
39
|
+
}>;
|
|
40
|
+
respondApproval(interactionId: string, decision: 'approve' | 'decline'): Promise<{
|
|
41
|
+
readonly ok: true;
|
|
42
|
+
} | {
|
|
43
|
+
readonly ok: false;
|
|
44
|
+
readonly error: SideChatWireError;
|
|
45
|
+
}>;
|
|
46
|
+
respondQuestion(interactionId: string, answer: SideChatQuestionAnswer | null): Promise<{
|
|
47
|
+
readonly ok: true;
|
|
48
|
+
} | {
|
|
49
|
+
readonly ok: false;
|
|
50
|
+
readonly error: SideChatWireError;
|
|
51
|
+
}>;
|
|
52
|
+
}
|
|
53
|
+
export interface SideChatSessionLease {
|
|
54
|
+
readonly sessionId: SessionId;
|
|
55
|
+
readonly binding: SideChatSessionBinding;
|
|
56
|
+
release(): void;
|
|
57
|
+
}
|
|
58
|
+
export interface SideChatClientSessions {
|
|
59
|
+
currentSessionId(): SessionId | undefined;
|
|
60
|
+
lastCompletedSeq(parentSessionId: SessionId): number | undefined;
|
|
61
|
+
selectionIsCurrent(selection: ConversationSelection): boolean;
|
|
62
|
+
retain(sessionId: SessionId): Promise<SideChatSessionLease>;
|
|
63
|
+
openSession(sessionId: SessionId): Promise<void>;
|
|
64
|
+
notify(message: {
|
|
65
|
+
readonly kind: 'status' | 'warning';
|
|
66
|
+
readonly text: string;
|
|
67
|
+
}): void;
|
|
68
|
+
}
|
|
69
|
+
export type SideChatActionResult<T = void> = {
|
|
70
|
+
readonly ok: true;
|
|
71
|
+
readonly value: T;
|
|
72
|
+
} | {
|
|
73
|
+
readonly ok: false;
|
|
74
|
+
readonly error: SideChatWireError;
|
|
75
|
+
};
|
|
76
|
+
//# sourceMappingURL=contracts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../src/client/contracts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,SAAS,EACT,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAE7D,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,aAAa,GAAG,gBAAgB,GAAG,QAAQ,GAAG,aAAa,CAAA;CAClG;A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C,GAAG,IAAI,IACrC;IAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAA;CAAE,GACxC;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,iBAAiB,CAAA;CAAE,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contracts.js","sourceRoot":"","sources":["../../src/client/contracts.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { apply, inject, name } from './apply.js';
|
|
2
|
+
export type { SideChatActionResult, SideChatClientSessions, SideChatSessionBinding, SideChatSessionLease, SideChatSessionSnapshot, } from './contracts.js';
|
|
3
|
+
export { SideChatController } from './side-chat-controller.js';
|
|
4
|
+
export { buildSideChatPrompt } from './parent-composer/add-to-conversation.js';
|
|
5
|
+
export { SideChatPanel, type SideChatPanelProps } from './panel/SideChatPanel.js';
|
|
6
|
+
export { SelectionActions, type SelectionActionsProps } from './selection/SelectionActions.js';
|
|
7
|
+
export { captureDomConversationSelection, type SelectionAnchorResolver, type SelectionNodeDescriptor, } from './selection/selection-controller.js';
|
|
8
|
+
export { selectionFitsLimit, summarizeSelection, utf8ByteLength } from './selection/selection-limits.js';
|
|
9
|
+
export { assertSelectionCurrent, finalizeConversationSelection, normalizeSelectedText, SelectionValidationError, type ConversationSelectionInput, } from './selection/selection-normalizer.js';
|
|
10
|
+
export type { ConversationSelection, SelectionFragment, SelectionRect, SideChatState, } from '../shared/contracts.js';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAChD,YAAY,EACV,oBAAoB,EACpB,sBAAsB,EACtB,sBAAsB,EACtB,oBAAoB,EACpB,uBAAuB,GACxB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAA;AAC9E,OAAO,EAAE,aAAa,EAAE,KAAK,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AACjF,OAAO,EAAE,gBAAgB,EAAE,KAAK,qBAAqB,EAAE,MAAM,iCAAiC,CAAA;AAC9F,OAAO,EACL,+BAA+B,EAC/B,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,GAC7B,MAAM,qCAAqC,CAAA;AAC5C,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAA;AACxG,OAAO,EACL,sBAAsB,EACtB,6BAA6B,EAC7B,qBAAqB,EACrB,wBAAwB,EACxB,KAAK,0BAA0B,GAChC,MAAM,qCAAqC,CAAA;AAC5C,YAAY,EACV,qBAAqB,EACrB,iBAAiB,EACjB,aAAa,EACb,aAAa,GACd,MAAM,wBAAwB,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { apply, inject, name } from './apply.js';
|
|
2
|
+
export { SideChatController } from './side-chat-controller.js';
|
|
3
|
+
export { buildSideChatPrompt } from './parent-composer/add-to-conversation.js';
|
|
4
|
+
export { SideChatPanel } from './panel/SideChatPanel.js';
|
|
5
|
+
export { SelectionActions } from './selection/SelectionActions.js';
|
|
6
|
+
export { captureDomConversationSelection, } from './selection/selection-controller.js';
|
|
7
|
+
export { selectionFitsLimit, summarizeSelection, utf8ByteLength } from './selection/selection-limits.js';
|
|
8
|
+
export { assertSelectionCurrent, finalizeConversationSelection, normalizeSelectedText, SelectionValidationError, } from './selection/selection-normalizer.js';
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAQhD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAA;AAC9E,OAAO,EAAE,aAAa,EAA2B,MAAM,0BAA0B,CAAA;AACjF,OAAO,EAAE,gBAAgB,EAA8B,MAAM,iCAAiC,CAAA;AAC9F,OAAO,EACL,+BAA+B,GAGhC,MAAM,qCAAqC,CAAA;AAC5C,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAA;AACxG,OAAO,EACL,sBAAsB,EACtB,6BAA6B,EAC7B,qBAAqB,EACrB,wBAAwB,GAEzB,MAAM,qCAAqC,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ConversationSelection } from '../../shared/contracts.js';
|
|
2
|
+
import type { SideChatMessages } from './messages.js';
|
|
3
|
+
/** Selected passage displayed separately from the user's first question. */
|
|
4
|
+
export declare function SelectionQuote({ selection, messages, onCopy, onRemove, }: {
|
|
5
|
+
readonly selection: ConversationSelection;
|
|
6
|
+
readonly messages: SideChatMessages;
|
|
7
|
+
readonly onCopy?: (text: string) => void;
|
|
8
|
+
readonly onRemove?: () => void;
|
|
9
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
//# sourceMappingURL=SelectionQuote.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectionQuote.d.ts","sourceRoot":"","sources":["../../../src/client/panel/SelectionQuote.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAA;AACtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAErD,4EAA4E;AAC5E,wBAAgB,cAAc,CAAC,EAC7B,SAAS,EACT,QAAQ,EACR,MAAM,EACN,QAAQ,GACT,EAAE;IACD,QAAQ,CAAC,SAAS,EAAE,qBAAqB,CAAA;IACzC,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAA;IACnC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IACxC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;CAC/B,2CAsCA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
/** Selected passage displayed separately from the user's first question. */
|
|
4
|
+
export function SelectionQuote({ selection, messages, onCopy, onRemove, }) {
|
|
5
|
+
const [expanded, setExpanded] = useState(false);
|
|
6
|
+
return (_jsxs("section", { className: "dsh-side-chat-quote", "aria-label": messages.selectedPassage, "data-expanded": expanded || undefined, children: [_jsxs("div", { className: "dsh-side-chat-quote-chip", children: [_jsxs("button", { type: "button", className: "dsh-side-chat-quote-trigger", "aria-expanded": expanded, "aria-label": `${expanded ? messages.collapse : messages.expand}: ${messages.selectedPassage}`, onClick: () => { setExpanded(value => !value); }, 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.selectionAttachment })] }), onRemove !== undefined && (_jsx("button", { type: "button", className: "dsh-side-chat-quote-remove", "aria-label": messages.removeSelection, onClick: onRemove, children: "\u00D7" }))] }), _jsxs("div", { className: "dsh-side-chat-quote-details", role: "tooltip", children: [_jsxs("div", { className: "dsh-side-chat-quote-details-header", children: [_jsxs("strong", { children: ["1. ", messages.selectionPreviewLabel, ":"] }), onCopy !== undefined && (_jsx("button", { type: "button", onClick: () => { onCopy(selection.text); }, children: messages.copy }))] }), _jsx("pre", { children: selection.text })] })] }));
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=SelectionQuote.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectionQuote.js","sourceRoot":"","sources":["../../../src/client/panel/SelectionQuote.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAIhC,4EAA4E;AAC5E,MAAM,UAAU,cAAc,CAAC,EAC7B,SAAS,EACT,QAAQ,EACR,MAAM,EACN,QAAQ,GAMT;IACC,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IAC/C,OAAO,CACL,mBAAS,SAAS,EAAC,qBAAqB,gBAAa,QAAQ,CAAC,eAAe,mBAAiB,QAAQ,IAAI,SAAS,aACjH,eAAK,SAAS,EAAC,0BAA0B,aACvC,kBACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,6BAA6B,mBACxB,QAAQ,gBACX,GAAG,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,KAAK,QAAQ,CAAC,eAAe,EAAE,EAC5F,OAAO,EAAE,GAAG,EAAE,GAAG,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAA,CAAC,CAAC,aAE/C,eAAK,SAAS,EAAC,0BAA0B,EAAC,OAAO,EAAC,WAAW,iBAAa,MAAM,aAC9E,eAAM,CAAC,EAAC,+DAA+D,GAAG,EAC1E,eAAM,CAAC,EAAC,eAAe,GAAG,IACtB,EACN,2BAAS,QAAQ,CAAC,mBAAmB,GAAU,IACxC,EACR,QAAQ,KAAK,SAAS,IAAI,CACzB,iBACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,4BAA4B,gBAC1B,QAAQ,CAAC,eAAe,EACpC,OAAO,EAAE,QAAQ,uBACR,CACZ,IACG,EACN,eAAK,SAAS,EAAC,6BAA6B,EAAC,IAAI,EAAC,SAAS,aACzD,eAAK,SAAS,EAAC,oCAAoC,aACjD,oCAAY,QAAQ,CAAC,qBAAqB,SAAW,EACpD,MAAM,KAAK,SAAS,IAAI,CACvB,iBAAQ,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAE,GAAG,EAAE,GAAG,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA,CAAC,CAAC,YAAG,QAAQ,CAAC,IAAI,GAAU,CAC1F,IACG,EACN,wBAAM,SAAS,CAAC,IAAI,GAAO,IACvB,IACE,CACX,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SendIcon.d.ts","sourceRoot":"","sources":["../../../src/client/panel/SendIcon.tsx"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,wBAAgB,QAAQ,4CASvB"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/** Arrow used by DSH's native 34px primary send button. */
|
|
3
|
+
export function SendIcon() {
|
|
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
|
+
}
|
|
6
|
+
//# sourceMappingURL=SendIcon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SendIcon.js","sourceRoot":"","sources":["../../../src/client/panel/SendIcon.tsx"],"names":[],"mappings":";AAAA,2DAA2D;AAC3D,MAAM,UAAU,QAAQ;IACtB,OAAO,CACL,cAAK,OAAO,EAAC,WAAW,EAAC,KAAK,EAAC,IAAI,EAAC,MAAM,EAAC,IAAI,iBAAa,MAAM,YAChE,eACE,CAAC,EAAC,yWAAyW,EAC3W,IAAI,EAAC,cAAc,GACnB,GACE,CACP,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
/** Body seat for the upstream EmbeddedConversationSurface. */
|
|
3
|
+
export declare function SideChatBody({ children }: {
|
|
4
|
+
readonly children: ReactNode;
|
|
5
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
//# sourceMappingURL=SideChatBody.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SideChatBody.d.ts","sourceRoot":"","sources":["../../../src/client/panel/SideChatBody.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,8DAA8D;AAC9D,wBAAgB,YAAY,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAA;CAAE,2CAE1E"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/** Body seat for the upstream EmbeddedConversationSurface. */
|
|
3
|
+
export function SideChatBody({ children }) {
|
|
4
|
+
return _jsx("div", { className: "dsh-side-chat-body", children: children });
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=SideChatBody.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SideChatBody.js","sourceRoot":"","sources":["../../../src/client/panel/SideChatBody.tsx"],"names":[],"mappings":";AAEA,8DAA8D;AAC9D,MAAM,UAAU,YAAY,CAAC,EAAE,QAAQ,EAAoC;IACzE,OAAO,cAAK,SAAS,EAAC,oBAAoB,YAAE,QAAQ,GAAO,CAAA;AAC7D,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { SideChatClientError } from '../../shared/contracts.js';
|
|
2
|
+
import type { SideChatMessages } from './messages.js';
|
|
3
|
+
/** Error strip with one direct retry action. */
|
|
4
|
+
export declare function SideChatErrorState({ error, messages, onRetry, }: {
|
|
5
|
+
readonly error: SideChatClientError;
|
|
6
|
+
readonly messages: SideChatMessages;
|
|
7
|
+
readonly onRetry: () => void;
|
|
8
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
//# sourceMappingURL=SideChatErrorState.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SideChatErrorState.d.ts","sourceRoot":"","sources":["../../../src/client/panel/SideChatErrorState.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AACpE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAErD,gDAAgD;AAChD,wBAAgB,kBAAkB,CAAC,EACjC,KAAK,EACL,QAAQ,EACR,OAAO,GACR,EAAE;IACD,QAAQ,CAAC,KAAK,EAAE,mBAAmB,CAAA;IACnC,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAA;IACnC,QAAQ,CAAC,OAAO,EAAE,MAAM,IAAI,CAAA;CAC7B,2CAQA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/** Error strip with one direct retry action. */
|
|
3
|
+
export function SideChatErrorState({ error, messages, onRetry, }) {
|
|
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
|
+
}
|
|
6
|
+
//# sourceMappingURL=SideChatErrorState.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SideChatErrorState.js","sourceRoot":"","sources":["../../../src/client/panel/SideChatErrorState.tsx"],"names":[],"mappings":";AAGA,gDAAgD;AAChD,MAAM,UAAU,kBAAkB,CAAC,EACjC,KAAK,EACL,QAAQ,EACR,OAAO,GAKR;IACC,OAAO,CACL,mBAAS,SAAS,EAAC,qBAAqB,EAAC,IAAI,EAAC,OAAO,aACnD,2BAAS,KAAK,CAAC,IAAI,KAAK,0BAA0B,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,YAAY,GAAU,EAC1G,sBAAI,KAAK,CAAC,OAAO,GAAK,EACrB,KAAK,CAAC,WAAW,IAAI,iBAAQ,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAE,OAAO,YAAG,QAAQ,CAAC,KAAK,GAAU,IAC/E,CACX,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { SideChatPhase } from '../../shared/contracts.js';
|
|
2
|
+
import type { SideChatMessages } from './messages.js';
|
|
3
|
+
export declare function SideChatHeader({ phase, messages, onFocusParent, onClose, }: {
|
|
4
|
+
readonly phase: SideChatPhase;
|
|
5
|
+
readonly messages: SideChatMessages;
|
|
6
|
+
readonly onFocusParent: () => void;
|
|
7
|
+
readonly onClose: () => void;
|
|
8
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
//# sourceMappingURL=SideChatHeader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SideChatHeader.d.ts","sourceRoot":"","sources":["../../../src/client/panel/SideChatHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAC9D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAErD,wBAAgB,cAAc,CAAC,EAC7B,KAAK,EACL,QAAQ,EACR,aAAa,EACb,OAAO,GACR,EAAE;IACD,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAA;IAC7B,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAA;IACnC,QAAQ,CAAC,aAAa,EAAE,MAAM,IAAI,CAAA;IAClC,QAAQ,CAAC,OAAO,EAAE,MAAM,IAAI,CAAA;CAC7B,2CAcA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
export function SideChatHeader({ phase, messages, onFocusParent, onClose, }) {
|
|
3
|
+
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 }) }), _jsx("button", { type: "button", "aria-label": messages.close, disabled: phase === 'closing', onClick: onClose, children: "\u00D7" })] }));
|
|
4
|
+
}
|
|
5
|
+
//# sourceMappingURL=SideChatHeader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SideChatHeader.js","sourceRoot":"","sources":["../../../src/client/panel/SideChatHeader.tsx"],"names":[],"mappings":";AAGA,MAAM,UAAU,cAAc,CAAC,EAC7B,KAAK,EACL,QAAQ,EACR,aAAa,EACb,OAAO,GAMR;IACC,OAAO,CACL,kBAAQ,SAAS,EAAC,sBAAsB,aACtC,iBAAQ,IAAI,EAAC,QAAQ,EAAC,SAAS,EAAC,uBAAuB,EAAC,OAAO,EAAE,aAAa,YAC5E,2BAAS,QAAQ,CAAC,KAAK,GAAU,GAC1B,EACT,iBACE,IAAI,EAAC,QAAQ,gBACD,QAAQ,CAAC,KAAK,EAC1B,QAAQ,EAAE,KAAK,KAAK,SAAS,EAC7B,OAAO,EAAE,OAAO,uBACP,IACJ,CACV,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { SideChatState } from '../../shared/contracts.js';
|
|
3
|
+
import type { SideChatActionResult } from '../contracts.js';
|
|
4
|
+
export interface SideChatPanelProps {
|
|
5
|
+
readonly state: SideChatState;
|
|
6
|
+
readonly locale?: 'en' | 'zh-CN';
|
|
7
|
+
readonly embeddedConversation?: ReactNode;
|
|
8
|
+
readonly onDraftChange: (draft: string) => void;
|
|
9
|
+
readonly onFirstSend: (question: string) => Promise<SideChatActionResult<void>>;
|
|
10
|
+
readonly onClose: () => Promise<SideChatActionResult<void>>;
|
|
11
|
+
readonly onRetry: () => Promise<SideChatActionResult<unknown>>;
|
|
12
|
+
readonly onFocusParent: () => void;
|
|
13
|
+
readonly onCopySelection?: (text: string) => void;
|
|
14
|
+
readonly onRemoveSelection?: () => void;
|
|
15
|
+
}
|
|
16
|
+
export declare function SideChatPanel({ state, locale, embeddedConversation, onDraftChange, onFirstSend, onClose, onRetry, onFocusParent, onCopySelection, onRemoveSelection, }: SideChatPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
//# sourceMappingURL=SideChatPanel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SideChatPanel.d.ts","sourceRoot":"","sources":["../../../src/client/panel/SideChatPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAChE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAC9D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AAS3D,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAA;IAC7B,QAAQ,CAAC,MAAM,CAAC,EAAE,IAAI,GAAG,OAAO,CAAA;IAChC,QAAQ,CAAC,oBAAoB,CAAC,EAAE,SAAS,CAAA;IACzC,QAAQ,CAAC,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAC/C,QAAQ,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC,CAAA;IAC/E,QAAQ,CAAC,OAAO,EAAE,MAAM,OAAO,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC,CAAA;IAC3D,QAAQ,CAAC,OAAO,EAAE,MAAM,OAAO,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC,CAAA;IAC9D,QAAQ,CAAC,aAAa,EAAE,MAAM,IAAI,CAAA;IAClC,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IACjD,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAA;CACxC;AAED,wBAAgB,aAAa,CAAC,EAC5B,KAAK,EACL,MAAa,EACb,oBAAoB,EACpB,aAAa,EACb,WAAW,EACX,OAAO,EACP,OAAO,EACP,aAAa,EACb,eAAe,EACf,iBAAiB,GAClB,EAAE,kBAAkB,2CAoFpB"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { SIDE_CHAT_MESSAGES } from './messages.js';
|
|
4
|
+
import { SelectionQuote } from './SelectionQuote.js';
|
|
5
|
+
import { SendIcon } from './SendIcon.js';
|
|
6
|
+
import { SideChatBody } from './SideChatBody.js';
|
|
7
|
+
import { SideChatErrorState } from './SideChatErrorState.js';
|
|
8
|
+
import { SideChatHeader } from './SideChatHeader.js';
|
|
9
|
+
import { useAutoGrowingTextarea } from './use-auto-growing-textarea.js';
|
|
10
|
+
export function SideChatPanel({ state, locale = 'en', embeddedConversation, onDraftChange, onFirstSend, onClose, onRetry, onFocusParent, onCopySelection, onRemoveSelection, }) {
|
|
11
|
+
const messages = SIDE_CHAT_MESSAGES[locale];
|
|
12
|
+
const [submitting, setSubmitting] = useState(false);
|
|
13
|
+
const draftRef = useAutoGrowingTextarea(state.draft);
|
|
14
|
+
const submit = async (event) => {
|
|
15
|
+
event.preventDefault();
|
|
16
|
+
if (submitting)
|
|
17
|
+
return;
|
|
18
|
+
setSubmitting(true);
|
|
19
|
+
try {
|
|
20
|
+
await onFirstSend(state.draft);
|
|
21
|
+
}
|
|
22
|
+
finally {
|
|
23
|
+
setSubmitting(false);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
return (_jsxs("aside", { className: "dsh-side-chat-panel", "data-side-chat-panel": "", "aria-label": messages.title, "aria-busy": ['creating', 'opening', 'closing'].includes(state.phase) || undefined, children: [_jsx(SideChatHeader, { phase: state.phase, messages: messages, onFocusParent: onFocusParent, onClose: () => { void onClose(); } }), state.error !== undefined && (_jsx(SideChatErrorState, { error: state.error, messages: messages, onRetry: () => { void onRetry(); } })), state.childSessionId !== undefined && embeddedConversation !== undefined
|
|
27
|
+
? _jsx(SideChatBody, { children: embeddedConversation })
|
|
28
|
+
: (_jsxs("form", { className: "dsh-side-chat-draft", onSubmit: (event) => { void submit(event); }, children: [state.selection !== undefined && (_jsx(SelectionQuote, { selection: state.selection, messages: messages, ...onCopySelection === undefined ? {} : { onCopy: onCopySelection }, ...onRemoveSelection === undefined ? {} : { onRemove: onRemoveSelection } })), _jsx("label", { htmlFor: "dsh-side-chat-draft-input", children: messages.placeholder }), _jsx("textarea", { id: "dsh-side-chat-draft-input", ref: draftRef, autoFocus: true, rows: 1, value: state.draft, disabled: ['creating', 'opening', 'closing'].includes(state.phase), placeholder: messages.placeholder, onChange: (event) => { onDraftChange(event.target.value); }, onKeyDown: (event) => {
|
|
29
|
+
if (event.key === 'Enter' && !event.shiftKey) {
|
|
30
|
+
event.preventDefault();
|
|
31
|
+
event.currentTarget.form?.requestSubmit();
|
|
32
|
+
}
|
|
33
|
+
} }), _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
|
+
}
|
|
35
|
+
//# sourceMappingURL=SideChatPanel.js.map
|