@linxin666/dsh-client-ui-session-id 0.2.9
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 +202 -0
- package/README.i18n.yaml +6 -0
- package/README.md +66 -0
- package/README.zh.md +60 -0
- package/cordis.patch.yml +7 -0
- package/lib/client.js +379 -0
- package/lib/client.js.map +1 -0
- package/lib/index.js +5 -0
- package/lib/types/client/SessionIdEntry.d.ts +15 -0
- package/lib/types/client/SessionIdPanel.d.ts +18 -0
- package/lib/types/client/icons.d.ts +13 -0
- package/lib/types/client/index.d.ts +27 -0
- package/lib/types/client/locales.d.ts +28 -0
- package/lib/types/client/semantic.d.ts +18 -0
- package/lib/types/index.d.ts +11 -0
- package/lib/types/invariant.d.ts +3 -0
- package/package.json +76 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.i18n.yaml
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Bilingual-pair consistency record (docs/i18n.md): the git blob hash of each
|
|
2
|
+
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
|
3
|
+
# after editing either side, bring the other along and re-record with:
|
|
4
|
+
# node scripts/verify-docs.mjs --write <dir>
|
|
5
|
+
README.md: c89aecce011b00c6fe413f052de859169f360be7
|
|
6
|
+
README.zh.md: 344d6d62fd03bfe306917107a832a539a54e7d63
|
package/README.md
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# @linxin666/dsh-client-ui-session-id
|
|
2
|
+
|
|
3
|
+
English | [中文](README.zh.md)
|
|
4
|
+
|
|
5
|
+
A browser-only DSH web GUI plugin that lists every session with its full
|
|
6
|
+
session id in a sidebar panel and copies the id on one click. It mounts into
|
|
7
|
+
the official sidebar footer seat (`sidebar.footer.action`) — no DSH source
|
|
8
|
+
changes, nothing runs on the host.
|
|
9
|
+
|
|
10
|
+
## What it does
|
|
11
|
+
|
|
12
|
+
- Adds a "Session ID" trigger beside the sidebar settings row (icon in the
|
|
13
|
+
56px rail, labeled row in the wide sidebar).
|
|
14
|
+
- Opens a centered panel listing every session: display title, full session id
|
|
15
|
+
(monospace), and a per-row "Copy" button. The current session is marked.
|
|
16
|
+
- A search box filters the list locally by title or id substring (read-only,
|
|
17
|
+
no host query), so finding a session among hundreds stays fast.
|
|
18
|
+
- Sessions are read from the official `ctx.sessions.list` feed, so the panel
|
|
19
|
+
stays live as sessions start, finish, or get archived — no refresh needed.
|
|
20
|
+
- Clicking "Copy" writes the id through the official clipboard helper
|
|
21
|
+
(`writeClipboard`); the button briefly shows "Copied".
|
|
22
|
+
|
|
23
|
+
## Install
|
|
24
|
+
|
|
25
|
+
### From npm (recommended)
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
dsh plugin --profile web add @linxin666/dsh-client-ui-session-id@latest
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Restart `dsh web` (or wait for the hot-reload) and click the Session ID entry
|
|
32
|
+
at the bottom of the sidebar.
|
|
33
|
+
|
|
34
|
+
### From the repository (development)
|
|
35
|
+
|
|
36
|
+
```sh
|
|
37
|
+
git clone https://github.com/zhu1090093659/dsh-web-ui.git
|
|
38
|
+
cd dsh-web-ui
|
|
39
|
+
pnpm install
|
|
40
|
+
pnpm -r build
|
|
41
|
+
dsh plugin --profile web add link:$(pwd)/packages/dsh-session-id
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Security model
|
|
45
|
+
|
|
46
|
+
- A session id is a **locator / automation identifier**, not a credential:
|
|
47
|
+
it never grants access to the session, its files, or its host. The panel
|
|
48
|
+
only displays and copies ids; it never writes them to the session log, the
|
|
49
|
+
agent prompt, or any persistent storage, and it never copies automatically.
|
|
50
|
+
- Copying is always user-gesture driven; a failed clipboard write shows an
|
|
51
|
+
actionable "Copy failed, retry" state with no permission request and no
|
|
52
|
+
background retry.
|
|
53
|
+
- Sharing a session id can still **expose workflow associations** (titles,
|
|
54
|
+
run times, and the session's place in the workspace), so copy ids only when
|
|
55
|
+
you actually need to reference a session elsewhere.
|
|
56
|
+
|
|
57
|
+
## Known limitations
|
|
58
|
+
|
|
59
|
+
- Requires a DSH shell that declares `sidebar.footer.action` (0.1.0-rc.8 and
|
|
60
|
+
newer shells). On older shells the entry does not render.
|
|
61
|
+
- Read-only viewer: it shows and copies ids, it does not open or manage
|
|
62
|
+
sessions.
|
|
63
|
+
|
|
64
|
+
## License
|
|
65
|
+
|
|
66
|
+
BSD-3-Clause.
|
package/README.zh.md
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# @linxin666/dsh-client-ui-session-id
|
|
2
|
+
|
|
3
|
+
[English](README.md) | 中文
|
|
4
|
+
|
|
5
|
+
纯浏览器端的 DSH Web GUI 插件:在侧边栏底部加入口,打开面板列出全部会话的
|
|
6
|
+
会话 ID,一键复制。挂载到官方侧边栏底部席位(`sidebar.footer.action`),不改
|
|
7
|
+
任何 DSH 源码,host 侧零行为。
|
|
8
|
+
|
|
9
|
+
## 是什么
|
|
10
|
+
|
|
11
|
+
- 在侧边栏底部的设置行旁边新增「会话 ID」入口(56px 收起态显示图标,展开态
|
|
12
|
+
显示带文字的整行按钮)。
|
|
13
|
+
- 点击打开居中面板,列出全部会话:显示标题、完整会话 ID(等宽字体),每行
|
|
14
|
+
一个「复制」按钮;当前会话有标记。
|
|
15
|
+
- 面板顶部有搜索框,按标题或 ID 子串**本地**过滤(只读、不发起 host 查询),
|
|
16
|
+
会话多时也能快速定位。
|
|
17
|
+
- 数据来自官方 `ctx.sessions.list` 实时数据源,会话开始、结束或归档时面板
|
|
18
|
+
自动跟随刷新,无需手动刷新。
|
|
19
|
+
- 点击「复制」通过官方剪贴板助手(`writeClipboard`)写入 ID,按钮短暂显示
|
|
20
|
+
「已复制」。
|
|
21
|
+
|
|
22
|
+
## 安装
|
|
23
|
+
|
|
24
|
+
### 从 npm 安装(推荐)
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
dsh plugin --profile web add @linxin666/dsh-client-ui-session-id@latest
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
重启 `dsh web`(或等待热更新生效)后,点击侧边栏底部的「会话 ID」入口即可。
|
|
31
|
+
|
|
32
|
+
### 从仓库安装(开发调试)
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
git clone https://github.com/zhu1090093659/dsh-web-ui.git
|
|
36
|
+
cd dsh-web-ui
|
|
37
|
+
pnpm install
|
|
38
|
+
pnpm -r build
|
|
39
|
+
dsh plugin --profile web add link:$(pwd)/packages/dsh-session-id
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## 安全模型
|
|
43
|
+
|
|
44
|
+
- 会话 ID 是**定位 / 自动化标识,不是认证凭据**:它本身无法访问会话、
|
|
45
|
+
文件或宿主。面板只展示与复制 ID,绝不写入会话日志、agent prompt 或任何
|
|
46
|
+
持久化存储,也绝不自动复制。
|
|
47
|
+
- 复制始终由用户手势触发;剪贴板写入失败时按钮显示可操作的「复制失败,请
|
|
48
|
+
重试」状态,不额外申请剪贴板权限、不做后台重试。
|
|
49
|
+
- 分享会话 ID 仍可能**暴露工作流关联信息**(标题、运行时间、在 workspace
|
|
50
|
+
中的位置),请只在确实需要在别处引用会话时按需复制。
|
|
51
|
+
|
|
52
|
+
## 已知限制
|
|
53
|
+
|
|
54
|
+
- 需要声明了 `sidebar.footer.action` 席位的 DSH Web 外壳(0.1.0-rc.8 及更新版本);
|
|
55
|
+
旧版外壳上入口不会渲染。
|
|
56
|
+
- 只读查看器:只展示与复制 ID,不打开或管理会话。
|
|
57
|
+
|
|
58
|
+
## 许可证
|
|
59
|
+
|
|
60
|
+
BSD-3-Clause。
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# bundle patch for the session-id plugin: inserts its plugin row into the web
|
|
2
|
+
# profile roster. Applied as a profile bundle layer (the `dsh.bundle.patch`
|
|
3
|
+
# manifest field); install with
|
|
4
|
+
# `dsh plugin --profile web add link:<repo>/packages/dsh-session-id`.
|
|
5
|
+
- insert:
|
|
6
|
+
- id: ui-session-id
|
|
7
|
+
name: '@linxin666/dsh-client-ui-session-id'
|
package/lib/client.js
ADDED
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
window.__ModuleLoader__.load({
|
|
2
|
+
id: "@linxin666/dsh-client-ui-session-id",
|
|
3
|
+
factory: (require) => {
|
|
4
|
+
var module = { exports: {} };
|
|
5
|
+
var exports = module.exports;
|
|
6
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
7
|
+
let react = require("react");
|
|
8
|
+
let react_dom = require("react-dom");
|
|
9
|
+
let _deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
10
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
11
|
+
//#region src/client/icons.tsx
|
|
12
|
+
/** Shared svg attrs for the 16px stroke icon family. */
|
|
13
|
+
function iconProps(props) {
|
|
14
|
+
return {
|
|
15
|
+
width: 16,
|
|
16
|
+
height: 16,
|
|
17
|
+
viewBox: "0 0 16 16",
|
|
18
|
+
fill: "none",
|
|
19
|
+
stroke: "currentColor",
|
|
20
|
+
strokeWidth: 1.3,
|
|
21
|
+
strokeLinecap: "round",
|
|
22
|
+
strokeLinejoin: "round",
|
|
23
|
+
"aria-hidden": true,
|
|
24
|
+
...props
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
/** An ID-card / identifier glyph for the seat trigger and panel title. */
|
|
28
|
+
function SessionIdIcon(props) {
|
|
29
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
30
|
+
...iconProps(props),
|
|
31
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
|
|
32
|
+
x: "1.5",
|
|
33
|
+
y: "3.5",
|
|
34
|
+
width: "13",
|
|
35
|
+
height: "9",
|
|
36
|
+
rx: "1.5"
|
|
37
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M4 6.5h2M4 9h2M7.5 6.5h4.5M7.5 9h4.5" })]
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
/** Copy glyph. */
|
|
41
|
+
function CopyIcon(props) {
|
|
42
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
43
|
+
...iconProps(props),
|
|
44
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
|
|
45
|
+
x: "5.5",
|
|
46
|
+
y: "5.5",
|
|
47
|
+
width: "9",
|
|
48
|
+
height: "9",
|
|
49
|
+
rx: "1.5"
|
|
50
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M2.5 10.5v-7A1.5 1.5 0 0 1 4 2h5.5" })]
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
/** Check glyph for the transient copied state. */
|
|
54
|
+
function CheckIcon(props) {
|
|
55
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
56
|
+
...iconProps(props),
|
|
57
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M3 8.5 6.5 12l6.5-8" })
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
/** Close glyph for the panel header. */
|
|
61
|
+
function CloseIcon(props) {
|
|
62
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
63
|
+
...iconProps(props),
|
|
64
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M4 4l8 8M12 4l-8 8" })
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
//#endregion
|
|
68
|
+
//#region src/client/semantic.ts
|
|
69
|
+
/**
|
|
70
|
+
* Semantic attribute values for the session-id plugin (contract:
|
|
71
|
+
* skins/skin-center/contracts/semantic-attrs-v1.md). Root containers carry
|
|
72
|
+
* `data-dsh-plugin`; parts carry bare `data-dsh-part` values owned by the
|
|
73
|
+
* plugin attribute.
|
|
74
|
+
*/
|
|
75
|
+
/** Plugin short name stamped on the root container and the footer trigger. */
|
|
76
|
+
const SESSION_ID_PLUGIN_ATTR = "session-id";
|
|
77
|
+
/** The sidebar footer seat trigger. */
|
|
78
|
+
const SESSION_ID_PART_ENTRY = "entry";
|
|
79
|
+
/** The modal panel root. */
|
|
80
|
+
const SESSION_ID_PART_PANEL = "panel";
|
|
81
|
+
/** The per-row copy button. */
|
|
82
|
+
const SESSION_ID_PART_COPY = "copy";
|
|
83
|
+
/** The panel search input. */
|
|
84
|
+
const SESSION_ID_PART_SEARCH = "search";
|
|
85
|
+
//#endregion
|
|
86
|
+
//#region \0dsh-css:packages/dsh-session-id/src/client/session-id.module.css.mjs
|
|
87
|
+
const css = ".-TNLea_trigger{width:36px;height:36px;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;border-radius:50%;flex:none;justify-content:center;align-items:center;padding:0;transition:background-color .12s,color .12s,box-shadow .12s;display:inline-flex;position:relative}.-TNLea_trigger[data-wide=wide]{border-radius:8px;flex:auto;justify-content:flex-start;gap:8px;width:auto;min-width:0;padding:0 10px}.-TNLea_trigger[data-wide=wide] .-TNLea_triggerLabel{display:inline}.-TNLea_triggerLabel{white-space:nowrap;text-overflow:ellipsis;font-size:14px;line-height:20px;display:none;overflow:hidden}.-TNLea_trigger:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.-TNLea_trigger:active:not(:disabled){background:var(--dsw-alias-interactive-bg-active)}.-TNLea_trigger:focus-visible{box-shadow:0 0 0 2px var(--dsw-alias-bg-layer-2), 0 0 0 4px var(--dsw-alias-brand-primary);outline:none}.-TNLea_overlay{z-index:1000;justify-content:center;align-items:center;display:flex;position:fixed;inset:0}.-TNLea_mask{background:var(--dsw-alias-bg-mask-1);backdrop-filter:var(--dsw-mask-blur);position:absolute;inset:0}.-TNLea_panel{z-index:1;box-sizing:border-box;background:var(--dsw-alias-bg-layer-2);width:560px;max-width:calc(100vw - 48px);max-height:calc(100vh - 48px);box-shadow:var(--dsw-shadow-lv3);color:var(--dsw-alias-label-primary);border-radius:24px;flex-direction:column;gap:14px;padding:24px;font-size:14px;line-height:22px;display:flex;position:relative}.-TNLea_header{align-items:flex-start;gap:12px;display:flex}.-TNLea_heading{flex:1;min-width:0}.-TNLea_title{margin:0;font-size:18px;font-weight:600;line-height:26px}.-TNLea_closeButton{width:28px;height:28px;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;border-radius:8px;flex:none;justify-content:center;align-items:center;padding:0;transition:background-color .12s,color .12s;display:inline-flex}.-TNLea_closeButton:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.-TNLea_closeButton:focus-visible{box-shadow:0 0 0 2px var(--dsw-alias-bg-layer-2), 0 0 0 4px var(--dsw-alias-brand-primary);outline:none}.-TNLea_search{box-sizing:border-box;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-1);width:100%;height:32px;color:var(--dsw-alias-label-primary);border-radius:8px;flex:none;padding:0 10px;font-size:14px;line-height:20px}.-TNLea_search::placeholder{color:var(--dsw-alias-label-tertiary)}.-TNLea_search:focus-visible{box-shadow:0 0 0 2px var(--dsw-alias-bg-layer-2), 0 0 0 4px var(--dsw-alias-brand-primary);outline:none}.-TNLea_empty{text-align:center;color:var(--dsw-alias-label-tertiary);padding:24px 0}.-TNLea_list{flex-direction:column;gap:4px;display:flex;overflow:auto}.-TNLea_row{border-radius:10px;align-items:center;gap:10px;min-width:0;padding:8px 10px;display:flex}.-TNLea_row:hover{background:var(--dsw-alias-interactive-bg-hover)}.-TNLea_rowInfo{flex:1;min-width:0}.-TNLea_rowTitle{white-space:nowrap;text-overflow:ellipsis;color:var(--dsw-alias-label-primary);font-weight:500;display:block;overflow:hidden}.-TNLea_rowTitle.-TNLea_rowActive{color:var(--dsw-alias-brand-primary)}.-TNLea_rowId{white-space:nowrap;text-overflow:ellipsis;color:var(--dsw-alias-label-secondary);font-family:var(--dsw-font-mono,ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);margin-top:2px;font-size:12px;line-height:18px;display:block;overflow:hidden}.-TNLea_rowMeta{color:var(--dsw-alias-label-tertiary);align-items:center;gap:8px;margin-top:2px;font-size:12px;line-height:18px;display:flex}.-TNLea_copyButton{height:28px;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;border-radius:8px;flex:none;align-items:center;gap:4px;padding:0 10px;font-size:12px;line-height:18px;transition:background-color .12s,color .12s;display:inline-flex}.-TNLea_copyButton:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.-TNLea_copyButton[data-copied=true]{color:var(--dsw-alias-brand-primary)}.-TNLea_copyButton[data-failed=true]{color:var(--dsw-alias-state-error-primary)}.-TNLea_copyButton:focus-visible{box-shadow:0 0 0 2px var(--dsw-alias-bg-layer-2), 0 0 0 4px var(--dsw-alias-brand-primary);outline:none}.-TNLea_icon{width:16px;height:16px}.-TNLea_iconSmall{width:12px;height:12px}";
|
|
88
|
+
const tagId = "@linxin666/dsh-client-ui-session-id/session-id.module.css";
|
|
89
|
+
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
|
|
90
|
+
const tag = document.createElement("style");
|
|
91
|
+
tag.dataset.plugin = "@linxin666/dsh-client-ui-session-id";
|
|
92
|
+
tag.dataset.pluginCss = tagId;
|
|
93
|
+
tag.textContent = css;
|
|
94
|
+
document.head.appendChild(tag);
|
|
95
|
+
}
|
|
96
|
+
var session_id_module_css_default = {
|
|
97
|
+
"closeButton": "-TNLea_closeButton",
|
|
98
|
+
"copyButton": "-TNLea_copyButton",
|
|
99
|
+
"empty": "-TNLea_empty",
|
|
100
|
+
"header": "-TNLea_header",
|
|
101
|
+
"heading": "-TNLea_heading",
|
|
102
|
+
"icon": "-TNLea_icon",
|
|
103
|
+
"iconSmall": "-TNLea_iconSmall",
|
|
104
|
+
"list": "-TNLea_list",
|
|
105
|
+
"mask": "-TNLea_mask",
|
|
106
|
+
"overlay": "-TNLea_overlay",
|
|
107
|
+
"panel": "-TNLea_panel",
|
|
108
|
+
"row": "-TNLea_row",
|
|
109
|
+
"rowActive": "-TNLea_rowActive",
|
|
110
|
+
"rowId": "-TNLea_rowId",
|
|
111
|
+
"rowInfo": "-TNLea_rowInfo",
|
|
112
|
+
"rowMeta": "-TNLea_rowMeta",
|
|
113
|
+
"rowTitle": "-TNLea_rowTitle",
|
|
114
|
+
"search": "-TNLea_search",
|
|
115
|
+
"title": "-TNLea_title",
|
|
116
|
+
"trigger": "-TNLea_trigger",
|
|
117
|
+
"triggerLabel": "-TNLea_triggerLabel"
|
|
118
|
+
};
|
|
119
|
+
//#endregion
|
|
120
|
+
//#region src/client/SessionIdPanel.tsx
|
|
121
|
+
/**
|
|
122
|
+
* Session ID panel — a centered modal listing every session with its full id
|
|
123
|
+
* and a copy button. Data rides the injected `sessionList` observable
|
|
124
|
+
* (ctx.sessions.list, see SessionRuntime.list) read through
|
|
125
|
+
* useSyncExternalStore, so the panel stays in sync with host list updates and
|
|
126
|
+
* needs no per-session runtime wiring.
|
|
127
|
+
*/
|
|
128
|
+
/** Sort sessions by update time, newest first; blank rows sink to the bottom. */
|
|
129
|
+
function sortSessions(list) {
|
|
130
|
+
return [...list.ids.map((id) => list.byId[id]).filter((row) => row !== void 0)].sort((a, b) => {
|
|
131
|
+
if (a.blank !== b.blank) return a.blank ? 1 : -1;
|
|
132
|
+
return b.updatedAt - a.updatedAt;
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
/** One session row: title + id + copy button with transient "copied" / failed state. */
|
|
136
|
+
function SessionRow({ session, current, t }) {
|
|
137
|
+
const [status, setStatus] = (0, react.useState)("idle");
|
|
138
|
+
const active = session.id === current;
|
|
139
|
+
const title = session.displayTitle || session.id;
|
|
140
|
+
const handleCopy = () => {
|
|
141
|
+
(0, _deepseek_ai_dsh_client_ui_primitives.writeClipboard)(session.id).then((ok) => {
|
|
142
|
+
if (ok) {
|
|
143
|
+
setStatus("copied");
|
|
144
|
+
window.setTimeout(() => {
|
|
145
|
+
setStatus("idle");
|
|
146
|
+
}, 1200);
|
|
147
|
+
} else setStatus("failed");
|
|
148
|
+
}).catch(() => {
|
|
149
|
+
setStatus("failed");
|
|
150
|
+
});
|
|
151
|
+
};
|
|
152
|
+
const copyLabel = status === "copied" ? t("panel.copied") : status === "failed" ? t("panel.copyFailed") : t("panel.copy");
|
|
153
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
154
|
+
className: session_id_module_css_default.row,
|
|
155
|
+
"data-dsh-part": "row",
|
|
156
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
157
|
+
className: session_id_module_css_default.rowInfo,
|
|
158
|
+
children: [
|
|
159
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
160
|
+
className: `${session_id_module_css_default.rowTitle}${active ? ` ${session_id_module_css_default.rowActive}` : ""}`,
|
|
161
|
+
title,
|
|
162
|
+
children: title
|
|
163
|
+
}),
|
|
164
|
+
active && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
165
|
+
className: session_id_module_css_default.rowMeta,
|
|
166
|
+
children: t("panel.current")
|
|
167
|
+
}),
|
|
168
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
169
|
+
className: session_id_module_css_default.rowId,
|
|
170
|
+
title: session.id,
|
|
171
|
+
children: session.id
|
|
172
|
+
})
|
|
173
|
+
]
|
|
174
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
175
|
+
type: "button",
|
|
176
|
+
className: session_id_module_css_default.copyButton,
|
|
177
|
+
"data-dsh-part": SESSION_ID_PART_COPY,
|
|
178
|
+
"data-copied": status === "copied" ? "true" : void 0,
|
|
179
|
+
"data-failed": status === "failed" ? "true" : void 0,
|
|
180
|
+
"aria-label": `${copyLabel} ${session.id}`,
|
|
181
|
+
onClick: handleCopy,
|
|
182
|
+
children: [status === "copied" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CheckIcon, { className: session_id_module_css_default.iconSmall }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopyIcon, { className: session_id_module_css_default.iconSmall }), copyLabel]
|
|
183
|
+
})]
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Render the session-id panel body.
|
|
188
|
+
* @param props - injected list source + locale seat + close callback.
|
|
189
|
+
* @returns the modal panel.
|
|
190
|
+
*/
|
|
191
|
+
function SessionIdPanel({ list, onClose, t }) {
|
|
192
|
+
const snapshot = (0, react.useSyncExternalStore)(list.subscribe, list.getSnapshot);
|
|
193
|
+
const sorted = sortSessions(snapshot);
|
|
194
|
+
const [search, setSearch] = (0, react.useState)("");
|
|
195
|
+
const query = search.trim().toLowerCase();
|
|
196
|
+
const rows = query === "" ? sorted : sorted.filter((row) => row.displayTitle.toLowerCase().includes(query) || row.id.toLowerCase().includes(query));
|
|
197
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
198
|
+
className: session_id_module_css_default.overlay,
|
|
199
|
+
role: "presentation",
|
|
200
|
+
"data-dsh-plugin": SESSION_ID_PLUGIN_ATTR,
|
|
201
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
202
|
+
className: session_id_module_css_default.mask,
|
|
203
|
+
"aria-hidden": "true",
|
|
204
|
+
onClick: onClose
|
|
205
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
206
|
+
className: session_id_module_css_default.panel,
|
|
207
|
+
"data-dsh-part": SESSION_ID_PART_PANEL,
|
|
208
|
+
role: "dialog",
|
|
209
|
+
"aria-modal": "true",
|
|
210
|
+
"aria-label": t("panel.title"),
|
|
211
|
+
children: [
|
|
212
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
213
|
+
className: session_id_module_css_default.header,
|
|
214
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
215
|
+
className: session_id_module_css_default.heading,
|
|
216
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h2", {
|
|
217
|
+
className: session_id_module_css_default.title,
|
|
218
|
+
children: t("panel.title")
|
|
219
|
+
})
|
|
220
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
221
|
+
type: "button",
|
|
222
|
+
className: session_id_module_css_default.closeButton,
|
|
223
|
+
"aria-label": t("panel.close"),
|
|
224
|
+
onClick: onClose,
|
|
225
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CloseIcon, { className: session_id_module_css_default.icon })
|
|
226
|
+
})]
|
|
227
|
+
}),
|
|
228
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
229
|
+
type: "search",
|
|
230
|
+
className: session_id_module_css_default.search,
|
|
231
|
+
"data-dsh-part": SESSION_ID_PART_SEARCH,
|
|
232
|
+
placeholder: t("panel.search.placeholder"),
|
|
233
|
+
"aria-label": t("panel.search.aria"),
|
|
234
|
+
value: search,
|
|
235
|
+
onChange: (event) => {
|
|
236
|
+
setSearch(event.target.value);
|
|
237
|
+
}
|
|
238
|
+
}),
|
|
239
|
+
rows.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
240
|
+
className: session_id_module_css_default.empty,
|
|
241
|
+
children: query === "" ? t("panel.empty") : t("panel.noMatches")
|
|
242
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
243
|
+
className: session_id_module_css_default.list,
|
|
244
|
+
children: rows.map((row) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SessionRow, {
|
|
245
|
+
session: row,
|
|
246
|
+
current: snapshot.current,
|
|
247
|
+
t
|
|
248
|
+
}, row.id))
|
|
249
|
+
})
|
|
250
|
+
]
|
|
251
|
+
})]
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
//#endregion
|
|
255
|
+
//#region src/client/SessionIdEntry.tsx
|
|
256
|
+
/**
|
|
257
|
+
* Sidebar footer entry for the session-id plugin: the trigger beside the
|
|
258
|
+
* sidebar settings seat (wide row / rail icon) that opens the session-id
|
|
259
|
+
* panel. Registered into the official `sidebar.footer.action` list slot
|
|
260
|
+
* (declared by ui-sidebar, same seat dsh-remote-web-ui shares).
|
|
261
|
+
*/
|
|
262
|
+
/**
|
|
263
|
+
* Render the session-id seat trigger and panel.
|
|
264
|
+
* @param props - composed slot props.
|
|
265
|
+
* @returns the trigger and, when open, the panel portal.
|
|
266
|
+
*/
|
|
267
|
+
function SessionIdEntry({ wide, list, t }) {
|
|
268
|
+
const [open, setOpen] = (0, react.useState)(false);
|
|
269
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
270
|
+
type: "button",
|
|
271
|
+
className: session_id_module_css_default.trigger,
|
|
272
|
+
"data-dsh-plugin": SESSION_ID_PLUGIN_ATTR,
|
|
273
|
+
"data-dsh-part": SESSION_ID_PART_ENTRY,
|
|
274
|
+
"data-wide": wide ? "wide" : "rail",
|
|
275
|
+
"aria-label": t("entry.label"),
|
|
276
|
+
title: t("entry.label"),
|
|
277
|
+
onClick: () => {
|
|
278
|
+
setOpen(true);
|
|
279
|
+
},
|
|
280
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SessionIdIcon, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
281
|
+
className: session_id_module_css_default.triggerLabel,
|
|
282
|
+
children: t("entry.label")
|
|
283
|
+
})]
|
|
284
|
+
}), open && (0, react_dom.createPortal)(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SessionIdPanel, {
|
|
285
|
+
list,
|
|
286
|
+
onClose: () => {
|
|
287
|
+
setOpen(false);
|
|
288
|
+
},
|
|
289
|
+
t
|
|
290
|
+
}), document.body)] });
|
|
291
|
+
}
|
|
292
|
+
//#endregion
|
|
293
|
+
//#region src/client/locales.ts
|
|
294
|
+
/**
|
|
295
|
+
* Locale dictionaries for the session-id plugin. `zh` is the key-set source of
|
|
296
|
+
* truth; `en` keeps a full key-for-key mirror (packages/AGENTS.md bilingual
|
|
297
|
+
* rules). Registered through ctx.locale.register(NS, { zh, en }).
|
|
298
|
+
*/
|
|
299
|
+
/** Simplified Chinese dictionary (key-set source of truth). */
|
|
300
|
+
const zh = {
|
|
301
|
+
"entry.label": "会话 ID",
|
|
302
|
+
"panel.title": "会话 ID",
|
|
303
|
+
"panel.empty": "暂无会话",
|
|
304
|
+
"panel.noMatches": "无匹配会话",
|
|
305
|
+
"panel.search.placeholder": "搜索标题或 ID…",
|
|
306
|
+
"panel.search.aria": "搜索会话",
|
|
307
|
+
"panel.close": "关闭",
|
|
308
|
+
"panel.copy": "复制",
|
|
309
|
+
"panel.copied": "已复制",
|
|
310
|
+
"panel.copyFailed": "复制失败,请重试",
|
|
311
|
+
"panel.current": "当前",
|
|
312
|
+
"panel.updatedAt": "更新于 {t}",
|
|
313
|
+
"panel.time.now": "刚刚",
|
|
314
|
+
"panel.time.minutes": "{n} 分钟前",
|
|
315
|
+
"panel.time.hours": "{n} 小时前",
|
|
316
|
+
"panel.time.days": "{n} 天前"
|
|
317
|
+
};
|
|
318
|
+
/** English dictionary, key-for-key complete against zh. */
|
|
319
|
+
const en = {
|
|
320
|
+
"entry.label": "Session ID",
|
|
321
|
+
"panel.title": "Session IDs",
|
|
322
|
+
"panel.empty": "No sessions",
|
|
323
|
+
"panel.noMatches": "No matching sessions",
|
|
324
|
+
"panel.search.placeholder": "Search title or ID…",
|
|
325
|
+
"panel.search.aria": "Search sessions",
|
|
326
|
+
"panel.close": "Close",
|
|
327
|
+
"panel.copy": "Copy",
|
|
328
|
+
"panel.copied": "Copied",
|
|
329
|
+
"panel.copyFailed": "Copy failed, retry",
|
|
330
|
+
"panel.current": "Current",
|
|
331
|
+
"panel.updatedAt": "Updated {t}",
|
|
332
|
+
"panel.time.now": "just now",
|
|
333
|
+
"panel.time.minutes": "{n}m ago",
|
|
334
|
+
"panel.time.hours": "{n}h ago",
|
|
335
|
+
"panel.time.days": "{n}d ago"
|
|
336
|
+
};
|
|
337
|
+
//#endregion
|
|
338
|
+
//#region src/client/index.ts
|
|
339
|
+
/** Dictionary namespace owned by this plugin. */
|
|
340
|
+
const NS = "session-id";
|
|
341
|
+
/** Unique occupant id inside the shared footer.action list slot. */
|
|
342
|
+
const ENTRY_ID = "session-id";
|
|
343
|
+
/** Services required by this plugin. */
|
|
344
|
+
const inject = [
|
|
345
|
+
"slots",
|
|
346
|
+
"locale",
|
|
347
|
+
"sessions"
|
|
348
|
+
];
|
|
349
|
+
/**
|
|
350
|
+
* Register the session-id surface.
|
|
351
|
+
* @param ctx - client root context.
|
|
352
|
+
*/
|
|
353
|
+
function apply(ctx) {
|
|
354
|
+
ctx.effect(() => ctx.locale.register(NS, {
|
|
355
|
+
zh,
|
|
356
|
+
en
|
|
357
|
+
}), "session-id: dictionaries");
|
|
358
|
+
ctx.slots.inject("sidebar.footer.action", () => {
|
|
359
|
+
const sessions = ctx.get("sessions");
|
|
360
|
+
const list = {
|
|
361
|
+
getSnapshot: () => sessions.list.getSnapshot(),
|
|
362
|
+
subscribe: (fn) => sessions.list.subscribe(fn)
|
|
363
|
+
};
|
|
364
|
+
return ctx.slots.register({
|
|
365
|
+
name: "sidebar.footer.action",
|
|
366
|
+
id: ENTRY_ID,
|
|
367
|
+
locale: NS,
|
|
368
|
+
inject: () => ({ list })
|
|
369
|
+
}, SessionIdEntry);
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
//#endregion
|
|
373
|
+
exports.apply = apply;
|
|
374
|
+
exports.inject = inject;
|
|
375
|
+
return module.exports;
|
|
376
|
+
}
|
|
377
|
+
});
|
|
378
|
+
|
|
379
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","names":["css","css"],"sources":["../../../packages/dsh-session-id/src/client/icons.tsx","../../../packages/dsh-session-id/src/client/semantic.ts","../../../packages/dsh-session-id/src/client/SessionIdPanel.tsx","../../../packages/dsh-session-id/src/client/SessionIdEntry.tsx","../../../packages/dsh-session-id/src/client/locales.ts","../../../packages/dsh-session-id/src/client/index.ts"],"sourcesContent":["/**\n * Inline SVG icons for the session-id plugin (16px stroke style matching the\n * shell's nav icons; sized via className where a smaller variant is needed).\n */\nimport type { SVGProps } from 'react'\n\n/** Shared svg attrs for the 16px stroke icon family. */\nfunction iconProps(props: SVGProps<SVGSVGElement>): SVGProps<SVGSVGElement> {\n return {\n width: 16,\n height: 16,\n viewBox: '0 0 16 16',\n fill: 'none',\n stroke: 'currentColor',\n strokeWidth: 1.3,\n strokeLinecap: 'round',\n strokeLinejoin: 'round',\n 'aria-hidden': true,\n ...props,\n }\n}\n\n/** An ID-card / identifier glyph for the seat trigger and panel title. */\nexport function SessionIdIcon(props: SVGProps<SVGSVGElement>) {\n return (\n <svg {...iconProps(props)}>\n <rect x=\"1.5\" y=\"3.5\" width=\"13\" height=\"9\" rx=\"1.5\" />\n <path d=\"M4 6.5h2M4 9h2M7.5 6.5h4.5M7.5 9h4.5\" />\n </svg>\n )\n}\n\n/** Copy glyph. */\nexport function CopyIcon(props: SVGProps<SVGSVGElement>) {\n return (\n <svg {...iconProps(props)}>\n <rect x=\"5.5\" y=\"5.5\" width=\"9\" height=\"9\" rx=\"1.5\" />\n <path d=\"M2.5 10.5v-7A1.5 1.5 0 0 1 4 2h5.5\" />\n </svg>\n )\n}\n\n/** Check glyph for the transient copied state. */\nexport function CheckIcon(props: SVGProps<SVGSVGElement>) {\n return (\n <svg {...iconProps(props)}>\n <path d=\"M3 8.5 6.5 12l6.5-8\" />\n </svg>\n )\n}\n\n/** Close glyph for the panel header. */\nexport function CloseIcon(props: SVGProps<SVGSVGElement>) {\n return (\n <svg {...iconProps(props)}>\n <path d=\"M4 4l8 8M12 4l-8 8\" />\n </svg>\n )\n}\n","/**\n * Semantic attribute values for the session-id plugin (contract:\n * skins/skin-center/contracts/semantic-attrs-v1.md). Root containers carry\n * `data-dsh-plugin`; parts carry bare `data-dsh-part` values owned by the\n * plugin attribute.\n */\n\n/** Plugin short name stamped on the root container and the footer trigger. */\nexport const SESSION_ID_PLUGIN_ATTR = 'session-id'\n\n/** The sidebar footer seat trigger. */\nexport const SESSION_ID_PART_ENTRY = 'entry'\n\n/** The modal panel root. */\nexport const SESSION_ID_PART_PANEL = 'panel'\n\n/** One session list row. */\nexport const SESSION_ID_PART_ROW = 'row'\n\n/** The per-row copy button. */\nexport const SESSION_ID_PART_COPY = 'copy'\n\n/** The panel search input. */\nexport const SESSION_ID_PART_SEARCH = 'search'","/**\n * Session ID panel — a centered modal listing every session with its full id\n * and a copy button. Data rides the injected `sessionList` observable\n * (ctx.sessions.list, see SessionRuntime.list) read through\n * useSyncExternalStore, so the panel stays in sync with host list updates and\n * needs no per-session runtime wiring.\n */\nimport { useSyncExternalStore, useState } from 'react'\nimport type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'\nimport type { SessionListState, SessionSummary } from '@deepseek-ai/dsh-client-runtime/client'\nimport { writeClipboard } from '@deepseek-ai/dsh-client-ui-primitives'\nimport { SessionIdIcon, CheckIcon, CopyIcon, CloseIcon } from './icons.tsx'\nimport { SESSION_ID_PART_COPY, SESSION_ID_PART_PANEL, SESSION_ID_PART_ROW, SESSION_ID_PART_SEARCH, SESSION_ID_PLUGIN_ATTR } from './semantic.ts'\nimport css from './session-id.module.css'\n\n/** The sessions-list read face injected by the plugin (ObservableSnapshot). */\nexport type SessionListReadSource = {\n getSnapshot(): SessionListState\n subscribe(fn: () => void): () => void\n}\n\n/** Panel props: the list source + the locale seat. */\nexport type SessionIdPanelProps = PropsLocale<'session-id'> & {\n list: SessionListReadSource\n onClose: () => void\n}\n\n/** Short relative label for a session's update time (zh/en shared w/ locales). */\nfunction relativeTimeLabel(updatedAt: number, now: number, t: PropsLocale<'session-id'>['t']): string {\n const diff = Math.max(0, now - updatedAt)\n const minute = 60_000\n const hour = 60 * minute\n const day = 24 * hour\n if (diff < minute) return t('panel.updatedAt', { t: t('panel.time.now') })\n if (diff < hour) return t('panel.updatedAt', { t: t('panel.time.minutes', { n: Math.floor(diff / minute) }) })\n if (diff < day) return t('panel.updatedAt', { t: t('panel.time.hours', { n: Math.floor(diff / hour) }) })\n return t('panel.updatedAt', { t: t('panel.time.days', { n: Math.floor(diff / day) }) })\n}\n\n/** Sort sessions by update time, newest first; blank rows sink to the bottom. */\nfunction sortSessions(list: SessionListState): SessionSummary[] {\n const rows = list.ids\n .map(id => list.byId[id])\n .filter((row): row is SessionSummary => row !== undefined)\n return [...rows].sort((a, b) => {\n if (a.blank !== b.blank) return a.blank ? 1 : -1\n return b.updatedAt - a.updatedAt\n })\n}\n\n/** One session row: title + id + copy button with transient \"copied\" / failed state. */\nfunction SessionRow({ session, current, t }: {\n session: SessionSummary\n current: string | undefined\n t: PropsLocale<'session-id'>['t']\n}) {\n const [status, setStatus] = useState<'idle' | 'copied' | 'failed'>('idle')\n const active = session.id === current\n const title = session.displayTitle || session.id\n\n const handleCopy = (): void => {\n // Copy must be gesture-driven; a failed write surfaces an actionable\n // message instead of silently swallowing the error (no permission\n // requests, no background retry).\n void writeClipboard(session.id).then((ok) => {\n if (ok) {\n setStatus('copied')\n window.setTimeout(() => { setStatus('idle') }, 1200)\n } else {\n setStatus('failed')\n }\n }).catch(() => {\n // A rejected write is the same actionable failure as ok === false.\n setStatus('failed')\n })\n }\n\n const copyLabel = status === 'copied' ? t('panel.copied')\n : status === 'failed' ? t('panel.copyFailed') : t('panel.copy')\n\n return (\n <div className={css.row} data-dsh-part={SESSION_ID_PART_ROW}>\n <span className={css.rowInfo}>\n <span className={`${css.rowTitle}${active ? ` ${css.rowActive}` : ''}`} title={title}>\n {title}\n </span>\n {active && <span className={css.rowMeta}>{t('panel.current')}</span>}\n <span className={css.rowId} title={session.id}>{session.id}</span>\n </span>\n <button\n type=\"button\"\n className={css.copyButton}\n data-dsh-part={SESSION_ID_PART_COPY}\n data-copied={status === 'copied' ? 'true' : undefined}\n data-failed={status === 'failed' ? 'true' : undefined}\n aria-label={`${copyLabel} ${session.id}`}\n onClick={handleCopy}\n >\n {status === 'copied' ? <CheckIcon className={css.iconSmall} /> : <CopyIcon className={css.iconSmall} />}\n {copyLabel}\n </button>\n </div>\n )\n}\n\n/**\n * Render the session-id panel body.\n * @param props - injected list source + locale seat + close callback.\n * @returns the modal panel.\n */\nexport function SessionIdPanel({ list, onClose, t }: SessionIdPanelProps) {\n const snapshot = useSyncExternalStore(list.subscribe, list.getSnapshot)\n const sorted = sortSessions(snapshot)\n const [search, setSearch] = useState('')\n\n // Local, read-only filter over the already-visible list (title or id\n // substring, case-insensitive) — no host API, no disk, no other profile.\n const query = search.trim().toLowerCase()\n const rows = query === ''\n ? sorted\n : sorted.filter(row => row.displayTitle.toLowerCase().includes(query) || row.id.toLowerCase().includes(query))\n\n return (\n <div className={css.overlay} role=\"presentation\" data-dsh-plugin={SESSION_ID_PLUGIN_ATTR}>\n <div className={css.mask} aria-hidden=\"true\" onClick={onClose} />\n <div className={css.panel} data-dsh-part={SESSION_ID_PART_PANEL} role=\"dialog\" aria-modal=\"true\" aria-label={t('panel.title')}>\n <div className={css.header}>\n <div className={css.heading}>\n <h2 className={css.title}>{t('panel.title')}</h2>\n </div>\n <button\n type=\"button\"\n className={css.closeButton}\n aria-label={t('panel.close')}\n onClick={onClose}\n >\n <CloseIcon className={css.icon} />\n </button>\n </div>\n <input\n type=\"search\"\n className={css.search}\n data-dsh-part={SESSION_ID_PART_SEARCH}\n placeholder={t('panel.search.placeholder')}\n aria-label={t('panel.search.aria')}\n value={search}\n onChange={(event) => { setSearch(event.target.value) }}\n />\n {rows.length === 0 ? (\n <div className={css.empty}>{query === '' ? t('panel.empty') : t('panel.noMatches')}</div>\n ) : (\n <div className={css.list}>\n {rows.map(row => (\n <SessionRow key={row.id} session={row} current={snapshot.current} t={t} />\n ))}\n </div>\n )}\n </div>\n </div>\n )\n}\n","/**\n * Sidebar footer entry for the session-id plugin: the trigger beside the\n * sidebar settings seat (wide row / rail icon) that opens the session-id\n * panel. Registered into the official `sidebar.footer.action` list slot\n * (declared by ui-sidebar, same seat dsh-remote-web-ui shares).\n */\nimport { useState } from 'react'\nimport { createPortal } from 'react-dom'\nimport type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'\nimport { SessionIdPanel, type SessionListReadSource } from './SessionIdPanel.tsx'\nimport { SESSION_ID_PART_ENTRY, SESSION_ID_PLUGIN_ATTR } from './semantic.ts'\nimport { SessionIdIcon } from './icons.tsx'\nimport css from './session-id.module.css'\n\n/** Entry props: the footer seat's column state + injected list source + locale seat. */\nexport type SessionIdEntryProps = PropsLocale<'session-id'> & {\n /** Whether the sidebar renders wide content (false = 56px rail). */\n wide: boolean\n /** The sessions-list read face (ctx.sessions.list wrapped by the plugin). */\n list: SessionListReadSource\n}\n\n/**\n * Render the session-id seat trigger and panel.\n * @param props - composed slot props.\n * @returns the trigger and, when open, the panel portal.\n */\nexport function SessionIdEntry({ wide, list, t }: SessionIdEntryProps) {\n const [open, setOpen] = useState(false)\n\n const trigger = (\n <button\n type=\"button\"\n className={css.trigger}\n data-dsh-plugin={SESSION_ID_PLUGIN_ATTR}\n data-dsh-part={SESSION_ID_PART_ENTRY}\n data-wide={wide ? 'wide' : 'rail'}\n aria-label={t('entry.label')}\n title={t('entry.label')}\n onClick={() => { setOpen(true) }}\n >\n <SessionIdIcon />\n <span className={css.triggerLabel}>{t('entry.label')}</span>\n </button>\n )\n\n return (\n <>\n {trigger}\n {open && createPortal(\n <SessionIdPanel list={list} onClose={() => { setOpen(false) }} t={t} />,\n document.body,\n )}\n </>\n )\n}\n","/**\n * Locale dictionaries for the session-id plugin. `zh` is the key-set source of\n * truth; `en` keeps a full key-for-key mirror (packages/AGENTS.md bilingual\n * rules). Registered through ctx.locale.register(NS, { zh, en }).\n */\n\n/** Simplified Chinese dictionary (key-set source of truth). */\nexport const zh = {\n 'entry.label': '会话 ID',\n 'panel.title': '会话 ID',\n 'panel.empty': '暂无会话',\n 'panel.noMatches': '无匹配会话',\n 'panel.search.placeholder': '搜索标题或 ID…',\n 'panel.search.aria': '搜索会话',\n 'panel.close': '关闭',\n 'panel.copy': '复制',\n 'panel.copied': '已复制',\n 'panel.copyFailed': '复制失败,请重试',\n 'panel.current': '当前',\n 'panel.updatedAt': '更新于 {t}',\n 'panel.time.now': '刚刚',\n 'panel.time.minutes': '{n} 分钟前',\n 'panel.time.hours': '{n} 小时前',\n 'panel.time.days': '{n} 天前',\n}\n\n/** The session-id namespace key union. */\nexport type SessionIdKey = keyof typeof zh\n\n/** English dictionary, key-for-key complete against zh. */\nexport const en: Record<SessionIdKey, string> = {\n 'entry.label': 'Session ID',\n 'panel.title': 'Session IDs',\n 'panel.empty': 'No sessions',\n 'panel.noMatches': 'No matching sessions',\n 'panel.search.placeholder': 'Search title or ID…',\n 'panel.search.aria': 'Search sessions',\n 'panel.close': 'Close',\n 'panel.copy': 'Copy',\n 'panel.copied': 'Copied',\n 'panel.copyFailed': 'Copy failed, retry',\n 'panel.current': 'Current',\n 'panel.updatedAt': 'Updated {t}',\n 'panel.time.now': 'just now',\n 'panel.time.minutes': '{n}m ago',\n 'panel.time.hours': '{n}h ago',\n 'panel.time.days': '{n}d ago',\n}","/**\n * Session-id plugin — browser half. Registers the `session-id` dictionaries\n * and the sidebar-foot trigger (into the ui-sidebar-declared\n * `sidebar.footer.action` list slot) that opens the session-id panel. The\n * panel lists every session with its full id and a copy button.\n *\n * Export discipline (packages/AGENTS.md): the /client surface carries only\n * what cordis loading needs plus types.\n */\nimport type { ClientContext, ISessions } from '@deepseek-ai/dsh-client-runtime/client'\n// Type-only: pulls the locale plugin's Context merge (ctx.locale) and its\n// LocaleNamespaceMap merge table.\nimport type {} from '@deepseek-ai/dsh-client-locale/client'\n// Type-only: pulls the ui-sidebar SlotMap merge (the 'sidebar.footer.action' hole).\nimport type {} from '@deepseek-ai/dsh-client-ui-sidebar/client'\nimport { SessionIdEntry } from './SessionIdEntry.tsx'\nimport { en, zh, type SessionIdKey } from './locales.ts'\n\ndeclare module '@deepseek-ai/dsh-client-ui-slots' {\n interface LocaleNamespaceMap {\n /** Session-id surface copy. */\n 'session-id': SessionIdKey\n }\n}\n\n/** Dictionary namespace owned by this plugin. */\nconst NS = 'session-id'\n\n/** Unique occupant id inside the shared footer.action list slot. */\nconst ENTRY_ID = 'session-id'\n\n/** Services required by this plugin. */\nexport const inject = ['slots', 'locale', 'sessions']\n\n/**\n * Register the session-id surface.\n * @param ctx - client root context.\n */\nexport function apply(ctx: ClientContext): void {\n ctx.effect(() => ctx.locale.register(NS, { zh, en }), 'session-id: dictionaries')\n\n // Sidebar foot entry. The shell declares 'sidebar.footer.action' (list kind:\n // multiple occupants may share the seat); registration is declaration-aware\n // via slots.inject. The list read face (ctx.sessions.list) is injected as a\n // plain prop so the component can subscribe without per-session wiring.\n ctx.slots.inject('sidebar.footer.action', () => {\n // Read the browser sessions face explicitly (combined host/client program\n // shares the Cordis Context name; the explicit face keeps types correct).\n const sessions = ctx.get('sessions') as unknown as ISessions\n const list = {\n getSnapshot: () => sessions.list.getSnapshot(),\n subscribe: (fn: () => void) => sessions.list.subscribe(fn),\n }\n return ctx.slots.register({\n name: 'sidebar.footer.action',\n id: ENTRY_ID,\n locale: NS,\n inject: () => ({ list }),\n }, SessionIdEntry)\n })\n}\n\nexport type { SessionIdEntryProps } from './SessionIdEntry.tsx'\nexport type { SessionIdKey } from './locales.ts'\nexport type { SessionListReadSource, SessionIdPanelProps } from './SessionIdPanel.tsx'\n"],"mappings":";;;;;;;;;;;;EAOA,SAAS,UAAU,OAAyD;GAC1E,OAAO;IACL,OAAO;IACP,QAAQ;IACR,SAAS;IACT,MAAM;IACN,QAAQ;IACR,aAAa;IACb,eAAe;IACf,gBAAgB;IAChB,eAAe;IACf,GAAG;GACL;EACF;;EAGA,SAAgB,cAAc,OAAgC;GAC5D,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;IAAK,GAAI,UAAU,KAAK;cAAxB,CACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;KAAM,GAAE;KAAM,GAAE;KAAM,OAAM;KAAK,QAAO;KAAI,IAAG;IAAO,CAAA,GACtD,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD,EAAM,GAAE,uCAAwC,CAAA,CAC7C;;EAET;;EAGA,SAAgB,SAAS,OAAgC;GACvD,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;IAAK,GAAI,UAAU,KAAK;cAAxB,CACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;KAAM,GAAE;KAAM,GAAE;KAAM,OAAM;KAAI,QAAO;KAAI,IAAG;IAAO,CAAA,GACrD,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD,EAAM,GAAE,qCAAsC,CAAA,CAC3C;;EAET;;EAGA,SAAgB,UAAU,OAAgC;GACxD,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;IAAK,GAAI,UAAU,KAAK;cACtB,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD,EAAM,GAAE,sBAAuB,CAAA;GAC5B,CAAA;EAET;;EAGA,SAAgB,UAAU,OAAgC;GACxD,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;IAAK,GAAI,UAAU,KAAK;cACtB,iBAAA,GAAA,kBA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oBAAoB;GACpB,iBAAiB;GACjB,mBAAmB;GACnB,kBAAkB;GAClB,sBAAsB;GACtB,oBAAoB;GACpB,mBAAmB;EACrB;;;;ECrBA,MAAM,KAAK;;EAGX,MAAM,WAAW;;EAGjB,MAAa,SAAS;GAAC;GAAS;GAAU;EAAU;;;;;EAMpD,SAAgB,MAAM,KAA0B;GAC9C,IAAI,aAAa,IAAI,OAAO,SAAS,IAAI;IAAE;IAAI;GAAG,CAAC,GAAG,0BAA0B;GAMhF,IAAI,MAAM,OAAO,+BAA+B;IAG9C,MAAM,WAAW,IAAI,IAAI,UAAU;IACnC,MAAM,OAAO;KACX,mBAAmB,SAAS,KAAK,YAAY;KAC7C,YAAY,OAAmB,SAAS,KAAK,UAAU,EAAE;IAC3D;IACA,OAAO,IAAI,MAAM,SAAS;KACxB,MAAM;KACN,IAAI;KACJ,QAAQ;KACR,eAAe,EAAE,KAAK;IACxB,GAAG,cAAc;GACnB,CAAC;EACH"}
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots';
|
|
2
|
+
import { type SessionListReadSource } from './SessionIdPanel.tsx';
|
|
3
|
+
/** Entry props: the footer seat's column state + injected list source + locale seat. */
|
|
4
|
+
export type SessionIdEntryProps = PropsLocale<'session-id'> & {
|
|
5
|
+
/** Whether the sidebar renders wide content (false = 56px rail). */
|
|
6
|
+
wide: boolean;
|
|
7
|
+
/** The sessions-list read face (ctx.sessions.list wrapped by the plugin). */
|
|
8
|
+
list: SessionListReadSource;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Render the session-id seat trigger and panel.
|
|
12
|
+
* @param props - composed slot props.
|
|
13
|
+
* @returns the trigger and, when open, the panel portal.
|
|
14
|
+
*/
|
|
15
|
+
export declare function SessionIdEntry({ wide, list, t }: SessionIdEntryProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots';
|
|
2
|
+
import type { SessionListState } from '@deepseek-ai/dsh-client-runtime/client';
|
|
3
|
+
/** The sessions-list read face injected by the plugin (ObservableSnapshot). */
|
|
4
|
+
export type SessionListReadSource = {
|
|
5
|
+
getSnapshot(): SessionListState;
|
|
6
|
+
subscribe(fn: () => void): () => void;
|
|
7
|
+
};
|
|
8
|
+
/** Panel props: the list source + the locale seat. */
|
|
9
|
+
export type SessionIdPanelProps = PropsLocale<'session-id'> & {
|
|
10
|
+
list: SessionListReadSource;
|
|
11
|
+
onClose: () => void;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Render the session-id panel body.
|
|
15
|
+
* @param props - injected list source + locale seat + close callback.
|
|
16
|
+
* @returns the modal panel.
|
|
17
|
+
*/
|
|
18
|
+
export declare function SessionIdPanel({ list, onClose, t }: SessionIdPanelProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inline SVG icons for the session-id plugin (16px stroke style matching the
|
|
3
|
+
* shell's nav icons; sized via className where a smaller variant is needed).
|
|
4
|
+
*/
|
|
5
|
+
import type { SVGProps } from 'react';
|
|
6
|
+
/** An ID-card / identifier glyph for the seat trigger and panel title. */
|
|
7
|
+
export declare function SessionIdIcon(props: SVGProps<SVGSVGElement>): import("react").JSX.Element;
|
|
8
|
+
/** Copy glyph. */
|
|
9
|
+
export declare function CopyIcon(props: SVGProps<SVGSVGElement>): import("react").JSX.Element;
|
|
10
|
+
/** Check glyph for the transient copied state. */
|
|
11
|
+
export declare function CheckIcon(props: SVGProps<SVGSVGElement>): import("react").JSX.Element;
|
|
12
|
+
/** Close glyph for the panel header. */
|
|
13
|
+
export declare function CloseIcon(props: SVGProps<SVGSVGElement>): import("react").JSX.Element;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session-id plugin — browser half. Registers the `session-id` dictionaries
|
|
3
|
+
* and the sidebar-foot trigger (into the ui-sidebar-declared
|
|
4
|
+
* `sidebar.footer.action` list slot) that opens the session-id panel. The
|
|
5
|
+
* panel lists every session with its full id and a copy button.
|
|
6
|
+
*
|
|
7
|
+
* Export discipline (packages/AGENTS.md): the /client surface carries only
|
|
8
|
+
* what cordis loading needs plus types.
|
|
9
|
+
*/
|
|
10
|
+
import type { ClientContext } from '@deepseek-ai/dsh-client-runtime/client';
|
|
11
|
+
import { type SessionIdKey } from './locales.ts';
|
|
12
|
+
declare module '@deepseek-ai/dsh-client-ui-slots' {
|
|
13
|
+
interface LocaleNamespaceMap {
|
|
14
|
+
/** Session-id surface copy. */
|
|
15
|
+
'session-id': SessionIdKey;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
/** Services required by this plugin. */
|
|
19
|
+
export declare const inject: string[];
|
|
20
|
+
/**
|
|
21
|
+
* Register the session-id surface.
|
|
22
|
+
* @param ctx - client root context.
|
|
23
|
+
*/
|
|
24
|
+
export declare function apply(ctx: ClientContext): void;
|
|
25
|
+
export type { SessionIdEntryProps } from './SessionIdEntry.tsx';
|
|
26
|
+
export type { SessionIdKey } from './locales.ts';
|
|
27
|
+
export type { SessionListReadSource, SessionIdPanelProps } from './SessionIdPanel.tsx';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Locale dictionaries for the session-id plugin. `zh` is the key-set source of
|
|
3
|
+
* truth; `en` keeps a full key-for-key mirror (packages/AGENTS.md bilingual
|
|
4
|
+
* rules). Registered through ctx.locale.register(NS, { zh, en }).
|
|
5
|
+
*/
|
|
6
|
+
/** Simplified Chinese dictionary (key-set source of truth). */
|
|
7
|
+
export declare const zh: {
|
|
8
|
+
'entry.label': string;
|
|
9
|
+
'panel.title': string;
|
|
10
|
+
'panel.empty': string;
|
|
11
|
+
'panel.noMatches': string;
|
|
12
|
+
'panel.search.placeholder': string;
|
|
13
|
+
'panel.search.aria': string;
|
|
14
|
+
'panel.close': string;
|
|
15
|
+
'panel.copy': string;
|
|
16
|
+
'panel.copied': string;
|
|
17
|
+
'panel.copyFailed': string;
|
|
18
|
+
'panel.current': string;
|
|
19
|
+
'panel.updatedAt': string;
|
|
20
|
+
'panel.time.now': string;
|
|
21
|
+
'panel.time.minutes': string;
|
|
22
|
+
'panel.time.hours': string;
|
|
23
|
+
'panel.time.days': string;
|
|
24
|
+
};
|
|
25
|
+
/** The session-id namespace key union. */
|
|
26
|
+
export type SessionIdKey = keyof typeof zh;
|
|
27
|
+
/** English dictionary, key-for-key complete against zh. */
|
|
28
|
+
export declare const en: Record<SessionIdKey, string>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Semantic attribute values for the session-id plugin (contract:
|
|
3
|
+
* skins/skin-center/contracts/semantic-attrs-v1.md). Root containers carry
|
|
4
|
+
* `data-dsh-plugin`; parts carry bare `data-dsh-part` values owned by the
|
|
5
|
+
* plugin attribute.
|
|
6
|
+
*/
|
|
7
|
+
/** Plugin short name stamped on the root container and the footer trigger. */
|
|
8
|
+
export declare const SESSION_ID_PLUGIN_ATTR = "session-id";
|
|
9
|
+
/** The sidebar footer seat trigger. */
|
|
10
|
+
export declare const SESSION_ID_PART_ENTRY = "entry";
|
|
11
|
+
/** The modal panel root. */
|
|
12
|
+
export declare const SESSION_ID_PART_PANEL = "panel";
|
|
13
|
+
/** One session list row. */
|
|
14
|
+
export declare const SESSION_ID_PART_ROW = "row";
|
|
15
|
+
/** The per-row copy button. */
|
|
16
|
+
export declare const SESSION_ID_PART_COPY = "copy";
|
|
17
|
+
/** The panel search input. */
|
|
18
|
+
export declare const SESSION_ID_PART_SEARCH = "search";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host loader entry for the session-id plugin — runs in the DSH host process.
|
|
3
|
+
*
|
|
4
|
+
* This is a pure browser plugin: it only renders the sidebar-foot trigger and
|
|
5
|
+
* the session-id panel from data already served by the host (the sessions list
|
|
6
|
+
* RPC). The host half intentionally has no behavior; the actual UI lives in
|
|
7
|
+
* the browser half (src/client).
|
|
8
|
+
*/
|
|
9
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
10
|
+
/** Apply the host half (no-op for a pure browser plugin). */
|
|
11
|
+
export declare function apply(_ctx: Context): void;
|
package/package.json
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@linxin666/dsh-client-ui-session-id",
|
|
3
|
+
"description": "DSH web GUI plugin: sidebar-foot Session ID panel listing every session with its full id and one-click copy (browser-only; no source changes).",
|
|
4
|
+
"version": "0.2.9",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "lib/index.js",
|
|
7
|
+
"types": "lib/types/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./lib/types/index.d.ts",
|
|
11
|
+
"default": "./lib/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./invariant": {
|
|
14
|
+
"types": "./lib/types/invariant.d.ts",
|
|
15
|
+
"default": "./lib/invariant.js"
|
|
16
|
+
},
|
|
17
|
+
"./client": {
|
|
18
|
+
"types": "./lib/types/client/index.d.ts",
|
|
19
|
+
"default": "./lib/client.js"
|
|
20
|
+
},
|
|
21
|
+
"./src/*": "./src/*",
|
|
22
|
+
"./package.json": "./package.json"
|
|
23
|
+
},
|
|
24
|
+
"dsh": {
|
|
25
|
+
"engines": {
|
|
26
|
+
"dsh": ">=0.1.1-rc.1"
|
|
27
|
+
},
|
|
28
|
+
"bundle": {
|
|
29
|
+
"patch": "./cordis.patch.yml"
|
|
30
|
+
},
|
|
31
|
+
"client": {
|
|
32
|
+
"inject": [
|
|
33
|
+
"@deepseek-ai/dsh-client-runtime"
|
|
34
|
+
],
|
|
35
|
+
"platform": "web"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"peerDependencies": {
|
|
39
|
+
"@deepseek-ai/dsh-client-ui-primitives": "^0.1.1-rc.2",
|
|
40
|
+
"react": "^18.2.0"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@deepseek-ai/cordis": "^4.0.1",
|
|
44
|
+
"@deepseek-ai/dsh-client-connection": "^0.1.1-rc.2",
|
|
45
|
+
"@deepseek-ai/dsh-client-locale": "^0.1.1-rc.2",
|
|
46
|
+
"@deepseek-ai/dsh-client-runtime": "^0.1.1-rc.2",
|
|
47
|
+
"@deepseek-ai/dsh-client-ui-primitives": "^0.1.1-rc.2",
|
|
48
|
+
"@deepseek-ai/dsh-client-ui-sidebar": "^0.1.1-rc.2",
|
|
49
|
+
"@deepseek-ai/dsh-client-ui-slots": "^0.1.1-rc.2",
|
|
50
|
+
"@testing-library/dom": "^10.4.1",
|
|
51
|
+
"@testing-library/react": "^16.1.0",
|
|
52
|
+
"@types/react": "~18.3.1",
|
|
53
|
+
"@types/react-dom": "^18.3.5",
|
|
54
|
+
"jsdom": "29.1.1",
|
|
55
|
+
"react": "^18.3.1",
|
|
56
|
+
"react-dom": "^18.3.1",
|
|
57
|
+
"tsdown": "0.22.2",
|
|
58
|
+
"typescript": "~5.7.2",
|
|
59
|
+
"vite-tsconfig-paths": "^6.1.1",
|
|
60
|
+
"vitest": "^4.1.8"
|
|
61
|
+
},
|
|
62
|
+
"files": [
|
|
63
|
+
"lib",
|
|
64
|
+
"cordis.patch.yml",
|
|
65
|
+
"README.md",
|
|
66
|
+
"README.zh.md",
|
|
67
|
+
"README.i18n.yaml"
|
|
68
|
+
],
|
|
69
|
+
"license": "Apache-2.0",
|
|
70
|
+
"scripts": {
|
|
71
|
+
"build": "tsc -p tsconfig.build.json && tsdown",
|
|
72
|
+
"watch": "tsdown --watch",
|
|
73
|
+
"test": "vitest run",
|
|
74
|
+
"typecheck": "tsc --noEmit"
|
|
75
|
+
}
|
|
76
|
+
}
|