@linxin666/dsh-client-ui-preset-center 0.4.1 → 0.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +29 -202
- package/README.i18n.yaml +2 -2
- package/README.md +14 -2
- package/README.zh.md +14 -2
- package/lib/client.js +28 -28
- package/lib/client.js.map +1 -1
- package/lib/index.js +85 -12
- package/package.json +16 -9
package/LICENSE
CHANGED
|
@@ -1,202 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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.
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026, zhu1090093659
|
|
4
|
+
All rights reserved.
|
|
5
|
+
|
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
|
7
|
+
modification, are permitted provided that the following conditions are met:
|
|
8
|
+
|
|
9
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
10
|
+
list of conditions and the following disclaimer.
|
|
11
|
+
|
|
12
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
13
|
+
this list of conditions and the following disclaimer in the documentation
|
|
14
|
+
and/or other materials provided with the distribution.
|
|
15
|
+
|
|
16
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
17
|
+
contributors may be used to endorse or promote products derived from
|
|
18
|
+
this software without specific prior written permission.
|
|
19
|
+
|
|
20
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
21
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
22
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
23
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
24
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
25
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
26
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
27
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
28
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
29
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
package/README.i18n.yaml
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
|
3
3
|
# after editing either side, bring the other along and re-record with:
|
|
4
4
|
# node scripts/verify-docs.mjs --write <dir>
|
|
5
|
-
README.md:
|
|
6
|
-
README.zh.md:
|
|
5
|
+
README.md: aea6def583a6f63e94b4329633c93fff3f6b9195
|
|
6
|
+
README.zh.md: 646dc41cc1b723b0159046e68270a70b1090c564
|
package/README.md
CHANGED
|
@@ -4,6 +4,8 @@ English | [中文](README.zh.md)
|
|
|
4
4
|
|
|
5
5
|
Community agent-preset manager for the DSH Web GUI: the Workshop's **Presets** panel and the host library that installs, declares, disables and uninstalls presets downloaded from [dsh-market.com](https://dsh-market.com). A preset is only listed under **Settings → Agent presets** once this plugin declares it to the agent-preset registry; everything else stays in the Workshop.
|
|
6
6
|
|
|
7
|
+
This repository owns both the plugin and the community preset catalog in [`presets/`](presets/). Presets are contributed here as pull requests — the submission checklist and the review rules are in [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
8
|
+
|
|
7
9
|
## What it does
|
|
8
10
|
|
|
9
11
|
- Adds a **Presets** tab to the Workshop store card (contributed through the card's `dsh-workshop.panel` child slot) that lists the community catalog with install state, version updates and install counts.
|
|
@@ -13,6 +15,16 @@ Community agent-preset manager for the DSH Web GUI: the Workshop's **Presets** p
|
|
|
13
15
|
- Refuses a preset whose id another declaration already supplies (the registry rejects a duplicate, so declaring would look like a successful install and do nothing), and refuses to disable or uninstall the preset the registry's default names (a default naming a missing preset fails every new session).
|
|
14
16
|
- Verifies market provenance on every state read: per-file sha256 pinned to `https://dsh-market.com`, so a locally edited preset is reported as modified and an update never silently overwrites it.
|
|
15
17
|
|
|
18
|
+
## Most popular presets
|
|
19
|
+
|
|
20
|
+
The three most-liked presets in the Workshop's preset catalog on [dsh-market.com](https://dsh-market.com), in the site's default popularity order — all of them published from [`presets/`](presets/) in this repository:
|
|
21
|
+
|
|
22
|
+
| Preset | Author | Scenario |
|
|
23
|
+
|---|---|---|
|
|
24
|
+
| [Roleplay · Qiao Youyou](https://dsh-market.com/#preset:roleplay-qiaoyouyou) (`roleplay-qiaoyouyou`) | dongshuyan | Immersive all-ages roleplay with Qiao Youyou, a kindergarten teacher |
|
|
25
|
+
| [Roleplay · Xie Wanzhou](https://dsh-market.com/#preset:roleplay-xiewanzhou) (`roleplay-xiewanzhou`) | dongshuyan | Immersive all-ages roleplay with Xie Wanzhou, a backend engineer at an internet company |
|
|
26
|
+
| [Roleplay · Su Mianmian](https://dsh-market.com/#preset:roleplay-sumianmian) (`roleplay-sumianmian`) | dongshuyan | Immersive all-ages roleplay with Su Mianmian, a coddled first-year business student |
|
|
27
|
+
|
|
16
28
|
## Install
|
|
17
29
|
|
|
18
30
|
```sh
|
|
@@ -43,7 +55,7 @@ A preset is code, not an asset: its composition may name npm plugins, load files
|
|
|
43
55
|
- **The official settings section may lag.** It re-reads on its own actions, `settings/document-updated` and `connection/reset`, so a preset declared in the Workshop can require a page refresh before it appears under **Settings → Agent presets**. New sessions pick it up immediately.
|
|
44
56
|
- **Running sessions keep their preset.** A session's composition is fixed at creation, so disabling or uninstalling a preset never changes a session already using it.
|
|
45
57
|
- **The composition subset is deliberately small.** Compositions are read by a reader that understands the YAML a preset ships (block maps and sequences, quoted and plain scalars, literal and folded blocks, `!!js`) and refuses anything else — anchors, aliases, flow collections, extra tags — rather than guessing. A refused composition is reported as such and stays undeclared.
|
|
46
|
-
- **The catalog is
|
|
58
|
+
- **The catalog is whatever the pinned catalog lists.** `presets/catalog.json` in this repository is the publishing source; the dsh-web market build reads it from the pinned submodule commit, so a merged preset reaches users when that pin moves. The contribution format and the evidence a submission must carry are in [CONTRIBUTING.md](CONTRIBUTING.md) and [presets/README.md](presets/README.md).
|
|
47
59
|
|
|
48
60
|
## Architecture
|
|
49
61
|
|
|
@@ -57,6 +69,6 @@ A preset is code, not an asset: its composition may name npm plugins, load files
|
|
|
57
69
|
- `src/core/provenance.ts` — the market provenance reader and per-file verification.
|
|
58
70
|
- `src/core/profile.ts` — the composition profile.
|
|
59
71
|
- `src/client/PresetPanel.tsx` — the panel the Workshop card renders.
|
|
60
|
-
- `presets/` — the publishing source
|
|
72
|
+
- `presets/` — the publishing source for the Workshop's Presets category (catalog plus one directory per preset), read by the dsh-web market build from the pinned submodule commit.
|
|
61
73
|
|
|
62
74
|
The library path is a cross-package contract: the market installer writes `preset` assets into `$DSH_HOME/agent-presets/<id>/` and neither package imports the other; the path name and the `dsh-market.provenance.json` format are mirrored constants, the same way the Skin Center mirrors the market's provenance.
|
package/README.zh.md
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
DSH Web GUI 的社区 agent 预设管理器:创意工坊的**预设**面板,以及负责安装、声明、停用、卸载从 [dsh-market.com](https://dsh-market.com) 下载的预设的 host 侧库。预设只有被本插件**声明**进 agent-preset 注册表后才会出现在**设置 → Agent 预设**;其余都留在创意工坊。
|
|
6
6
|
|
|
7
|
+
本仓同时拥有插件与 [`presets/`](presets/) 下的社区预设目录。预设以 PR 形式投稿,投稿清单与评审规则见 [CONTRIBUTING.md](CONTRIBUTING.md)。
|
|
8
|
+
|
|
7
9
|
## 能力
|
|
8
10
|
|
|
9
11
|
- 在创意工坊商店卡新增**预设**标签页(通过卡片声明的 `dsh-workshop.panel` 子槽位注入),列出社区目录,带安装状态、版本更新提示与安装计数。
|
|
@@ -13,6 +15,16 @@ DSH Web GUI 的社区 agent 预设管理器:创意工坊的**预设**面板,
|
|
|
13
15
|
- 拒绝 id 已被其它声明占用的预设(注册表会拒绝重复 id,声明看起来成功却毫无效果),也拒绝停用或卸载注册表当前默认值指向的预设(默认值指向不存在的预设会让每个新会话创建失败)。
|
|
14
16
|
- 每次读取状态都校验市场 provenance:逐文件 sha256 锚定 `https://dsh-market.com`,因此本地改动过的预设会被标为「本地已修改」,更新也绝不静默覆盖它。
|
|
15
17
|
|
|
18
|
+
## 人气预设
|
|
19
|
+
|
|
20
|
+
[dsh-market.com](https://dsh-market.com) 创意工坊预设目录里人气最高的三个预设,按网站默认的「按人气」排序——三者都由本仓的 [`presets/`](presets/) 发布:
|
|
21
|
+
|
|
22
|
+
| 预设 | 作者 | 剧情 |
|
|
23
|
+
|---|---|---|
|
|
24
|
+
| [角色扮演 · 乔柚柚](https://dsh-market.com/#preset:roleplay-qiaoyouyou)(`roleplay-qiaoyouyou`) | dongshuyan | 与民办幼儿园老师乔柚柚对话:活泼开朗,带班哄孩子一把好手。全年龄向沉浸式角色扮演 |
|
|
25
|
+
| [角色扮演 · 谢晚舟](https://dsh-market.com/#preset:roleplay-xiewanzhou)(`roleplay-xiewanzhou`) | dongshuyan | 与互联网公司后端工程师谢晚舟对话:上班理性话少,下班宅家看番。全年龄向沉浸式角色扮演 |
|
|
26
|
+
| [角色扮演 · 苏绵绵](https://dsh-market.com/#preset:roleplay-sumianmian)(`roleplay-sumianmian`) | dongshuyan | 与重点大学经管系大一学生苏绵绵对话:呆萌的富家千金,从小被保护得很好。全年龄向沉浸式角色扮演 |
|
|
27
|
+
|
|
16
28
|
## 安装
|
|
17
29
|
|
|
18
30
|
```sh
|
|
@@ -43,7 +55,7 @@ dsh plugin --profile web add @linxin666/dsh-client-ui-preset-center
|
|
|
43
55
|
- **官方设置分区可能滞后。** 它只在自身动作、`settings/document-updated` 与 `connection/reset` 时重读,因此在创意工坊声明的预设可能需要刷新页面才出现在**设置 → Agent 预设**;新建会话会立即看到它。
|
|
44
56
|
- **运行中的会话保留原预设。** 会话的组合在创建时固定,停用或卸载不会改变正在使用它的会话。
|
|
45
57
|
- **组合子集刻意收窄。** 组合由只读懂预设所用 YAML 的读取器解析(块映射与块序列、引号与普通标量、字面块与折叠块、`!!js`),遇到其它构造——锚点、别名、流式集合、额外标签——一律拒绝而不是猜测。被拒绝的组合会被如实报告,并保持未声明。
|
|
46
|
-
-
|
|
58
|
+
- **目录内容取决于被钉扎的那份 catalog。** 本仓的 `presets/catalog.json` 是发布源;dsh-web 的市场构建按 submodule 钉扎的提交读取它,因此合并的预设要等该钉扎前移才到达用户。贡献格式与投稿必须附带的证据见 [CONTRIBUTING.md](CONTRIBUTING.md) 与 [presets/README.md](presets/README.md)。
|
|
47
59
|
|
|
48
60
|
## 架构
|
|
49
61
|
|
|
@@ -57,6 +69,6 @@ dsh plugin --profile web add @linxin666/dsh-client-ui-preset-center
|
|
|
57
69
|
- `src/core/provenance.ts` —— 市场 provenance 读取与逐文件校验。
|
|
58
70
|
- `src/core/profile.ts` —— 组合画像。
|
|
59
71
|
- `src/client/PresetPanel.tsx` —— 创意工坊卡片渲染的面板。
|
|
60
|
-
- `presets/` ——
|
|
72
|
+
- `presets/` —— 创意工坊「预设」类目的发布源(catalog 加每个预设一个目录),由 dsh-web 的市场构建按 submodule 钉扎的提交读取。
|
|
61
73
|
|
|
62
74
|
库路径是跨包契约:市场安装器把 `preset` 资产写进 `$DSH_HOME/agent-presets/<id>/`,两个包互不 import;路径名与 `dsh-market.provenance.json` 格式是镜像常量,与皮肤中心镜像市场 provenance 的方式一致。
|
package/lib/client.js
CHANGED
|
@@ -7,9 +7,9 @@ window.__ModuleLoader__.load({
|
|
|
7
7
|
let react = require("react");
|
|
8
8
|
let _deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
9
9
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
10
|
-
//#region \0dsh-css:
|
|
11
|
-
const css = ".
|
|
12
|
-
const tagId = "@linxin666/dsh-client-ui-preset-center/
|
|
10
|
+
//#region \0dsh-css:src/client/preset-center.module.css.mjs
|
|
11
|
+
const css = "._6yuPUG_panel{flex-direction:column;gap:10px;display:flex}._6yuPUG_search{box-sizing:border-box;width:100%;font:inherit;color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-1);border:1px solid var(--dsw-alias-border-l2);border-radius:6px;padding:7px 10px;font-size:13px}._6yuPUG_search:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}._6yuPUG_empty{color:var(--dsw-alias-label-tertiary);margin:0;padding:14px 0;font-size:13px}._6yuPUG_list{flex-direction:column;gap:8px;margin:0;padding:0;list-style:none;display:flex}._6yuPUG_card{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-1);border-radius:8px;flex-direction:column;gap:6px;padding:12px;display:flex}._6yuPUG_cardHead{flex-wrap:wrap;align-items:baseline;gap:6px 10px;min-width:0;display:flex}._6yuPUG_cardName{color:var(--dsw-alias-label-primary);font-weight:600}._6yuPUG_cardName a{color:inherit;text-decoration:none}._6yuPUG_cardName a:hover{text-decoration:underline}._6yuPUG_version{color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;margin-left:6px;font-size:11px}._6yuPUG_cardMeta{color:var(--dsw-alias-label-tertiary);flex-wrap:wrap;align-items:center;gap:4px 8px;font-size:11px;display:flex}._6yuPUG_cardDesc{color:var(--dsw-alias-label-secondary);margin:0;font-size:13px;line-height:1.45}._6yuPUG_badgeMuted,._6yuPUG_badgeOn,._6yuPUG_badgeOff,._6yuPUG_badgeWarn,._6yuPUG_badgeCode{white-space:nowrap;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-module-platform);color:var(--dsw-alias-label-secondary);border-radius:999px;flex:none;padding:0 8px;font-size:11px;line-height:1.6}._6yuPUG_badgeOn{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-2);border-color:var(--dsw-alias-label-dimmed)}._6yuPUG_badgeWarn{color:var(--dsw-alias-label-error,#c53030)}._6yuPUG_badgeCode{color:var(--dsw-alias-label-primary)}._6yuPUG_profile{flex-wrap:wrap;align-items:center;gap:6px;margin:0;display:flex}._6yuPUG_profileText{color:var(--dsw-alias-label-tertiary);font-size:11px;line-height:1.5}._6yuPUG_actions{flex-wrap:wrap;gap:6px;display:flex}._6yuPUG_actions>button{font-size:12px}._6yuPUG_primary{color:var(--dsw-alias-label-primary-foreground);background:var(--dsw-alias-button-primary-fill);border-color:var(--dsw-alias-button-primary-fill)}._6yuPUG_primary:hover:enabled{background:var(--dsw-alias-button-primary-hover);border-color:var(--dsw-alias-button-primary-hover)}._6yuPUG_primary:disabled{opacity:.55;cursor:default}._6yuPUG_secondary{color:var(--dsw-alias-label-primary)}._6yuPUG_danger{color:var(--dsw-alias-label-error,#c53030)}._6yuPUG_note{color:var(--dsw-alias-label-secondary);margin:0;font-size:12px;line-height:1.5}._6yuPUG_inlineButton{margin-left:8px;font-size:12px}._6yuPUG_viewer{white-space:pre;max-height:46vh;color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-2);border:1px solid var(--dsw-alias-border-l2);border-radius:6px;margin:0;padding:10px;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:12px;line-height:1.5;overflow:auto}._6yuPUG_modalActions{justify-content:flex-end;gap:8px;margin-top:12px;display:flex}";
|
|
12
|
+
const tagId = "@linxin666/dsh-client-ui-preset-center/src/client/preset-center.module.css";
|
|
13
13
|
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
|
|
14
14
|
const tag = document.createElement("style");
|
|
15
15
|
tag.dataset.plugin = "@linxin666/dsh-client-ui-preset-center";
|
|
@@ -18,31 +18,31 @@ window.__ModuleLoader__.load({
|
|
|
18
18
|
document.head.appendChild(tag);
|
|
19
19
|
}
|
|
20
20
|
var preset_center_module_css_default = {
|
|
21
|
-
"actions": "
|
|
22
|
-
"badgeCode": "
|
|
23
|
-
"badgeMuted": "
|
|
24
|
-
"badgeOff": "
|
|
25
|
-
"badgeOn": "
|
|
26
|
-
"badgeWarn": "
|
|
27
|
-
"card": "
|
|
28
|
-
"cardDesc": "
|
|
29
|
-
"cardHead": "
|
|
30
|
-
"cardMeta": "
|
|
31
|
-
"cardName": "
|
|
32
|
-
"danger": "
|
|
33
|
-
"empty": "
|
|
34
|
-
"inlineButton": "
|
|
35
|
-
"list": "
|
|
36
|
-
"modalActions": "
|
|
37
|
-
"note": "
|
|
38
|
-
"panel": "
|
|
39
|
-
"primary": "
|
|
40
|
-
"profile": "
|
|
41
|
-
"profileText": "
|
|
42
|
-
"search": "
|
|
43
|
-
"secondary": "
|
|
44
|
-
"version": "
|
|
45
|
-
"viewer": "
|
|
21
|
+
"actions": "_6yuPUG_actions",
|
|
22
|
+
"badgeCode": "_6yuPUG_badgeCode",
|
|
23
|
+
"badgeMuted": "_6yuPUG_badgeMuted",
|
|
24
|
+
"badgeOff": "_6yuPUG_badgeOff",
|
|
25
|
+
"badgeOn": "_6yuPUG_badgeOn",
|
|
26
|
+
"badgeWarn": "_6yuPUG_badgeWarn",
|
|
27
|
+
"card": "_6yuPUG_card",
|
|
28
|
+
"cardDesc": "_6yuPUG_cardDesc",
|
|
29
|
+
"cardHead": "_6yuPUG_cardHead",
|
|
30
|
+
"cardMeta": "_6yuPUG_cardMeta",
|
|
31
|
+
"cardName": "_6yuPUG_cardName",
|
|
32
|
+
"danger": "_6yuPUG_danger",
|
|
33
|
+
"empty": "_6yuPUG_empty",
|
|
34
|
+
"inlineButton": "_6yuPUG_inlineButton",
|
|
35
|
+
"list": "_6yuPUG_list",
|
|
36
|
+
"modalActions": "_6yuPUG_modalActions",
|
|
37
|
+
"note": "_6yuPUG_note",
|
|
38
|
+
"panel": "_6yuPUG_panel",
|
|
39
|
+
"primary": "_6yuPUG_primary",
|
|
40
|
+
"profile": "_6yuPUG_profile",
|
|
41
|
+
"profileText": "_6yuPUG_profileText",
|
|
42
|
+
"search": "_6yuPUG_search",
|
|
43
|
+
"secondary": "_6yuPUG_secondary",
|
|
44
|
+
"version": "_6yuPUG_version",
|
|
45
|
+
"viewer": "_6yuPUG_viewer"
|
|
46
46
|
};
|
|
47
47
|
//#endregion
|
|
48
48
|
//#region src/client/PresetPanel.tsx
|
package/lib/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","names":["css","Button","Modal"],"sources":["../../../packages/dsh-preset-center/src/client/PresetPanel.tsx","../../../packages/dsh-preset-center/src/client/locales.ts","../../../packages/dsh-preset-center/src/client/index.ts"],"sourcesContent":["/**\n * The Workshop's Presets panel: browse the community preset catalog and drive\n * the host library (install into `$DSH_HOME/agent-presets/<id>` and declare it\n * to the agent-preset registry, disable, uninstall), with the composition\n * profile shown before anything executable is declared.\n *\n * The panel owns no catalog fetch: the Workshop card already fetches\n * `manifest/presets.json` and passes the records down, so one store section\n * makes one catalog request. Preset state comes from the preset-center host\n * routes, which derive it from disk and the live declarations on every read.\n * @module @linxin666/dsh-client-ui-preset-center/client/PresetPanel\n */\n\nimport { useEffect, useState, type ReactNode } from 'react'\nimport { Button, Modal } from '@deepseek-ai/dsh-client-ui-primitives'\nimport type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'\nimport { NS, type PresetCenterKey } from './locales.ts'\nimport css from './preset-center.module.css'\n\n/** One catalog record the Workshop card fetched from `manifest/presets.json`. */\nexport interface WorkshopPresetRecord {\n /** Preset id (the directory name). */\n id: string\n /** Display name (Chinese, matching the store convention). */\n name?: string\n /** English display name. */\n nameEn?: string\n /** Catalog author. */\n author?: string\n /** Chinese description. */\n description?: string\n /** English description. */\n descriptionEn?: string\n /** Catalog version used for update notifications. */\n version?: string\n /** Catalog tags. */\n tags?: string[]\n /** Source repository the card links to. */\n repo?: string\n /** Catalog ordering rank. */\n rank?: number\n}\n\n/** Marker key props of the Presets panel cell (the owner supplies nothing extra). */\nexport interface WorkshopPanelKeyProps {\n /** Marker field: key props are intentionally empty. */\n children?: never\n}\n\n/** Owner share the Workshop card passes to the Presets panel. */\nexport interface WorkshopPanelOwnerProps {\n /** Catalog records, already fetched by the store card. */\n items?: readonly WorkshopPresetRecord[]\n /** Catalog fetch state. */\n catalogState?: 'loading' | 'ready' | 'error'\n /** Whether the store's loopback asset gateway answered. */\n gateway?: boolean\n /** Install-event counts by preset id. */\n installs?: Record<string, number>\n /** Download one preset into the library through the store gateway. */\n install?: (id: string, force: boolean) => Promise<{ dest: string }>\n /** Record a successful install with the market (returns the fresh count). */\n reportInstall?: (id: string) => Promise<number>\n}\n\n/** Props the renderer binds for the Presets panel. */\nexport type PresetPanelProps =\n PropsLocale<typeof NS>\n & WorkshopPanelOwnerProps\n & WorkshopPanelKeyProps\n\ninterface CompositionProfile {\n plugins: string[]\n relativeNames: string[]\n inlineExpressions: number\n codeFiles: string[]\n codeExecution: 'none' | 'inline' | 'local'\n rows: number\n}\n\nexport interface PresetStateRow {\n id: string\n installed: boolean\n /** This plugin currently holds a registry declaration for the id. */\n enabled: boolean\n managed: boolean\n assetVersion?: string\n installedAt?: string\n integrity: 'valid' | 'modified' | 'missing' | 'none'\n dir: string\n profile: CompositionProfile\n}\n\ninterface StateResponse {\n ok?: boolean\n defaultId?: string | null\n occupied?: string[]\n rosterAvailable?: boolean\n presets?: PresetStateRow[]\n}\n\nconst EMPTY_PROFILE: CompositionProfile = {\n plugins: [], relativeNames: [], inlineExpressions: 0, codeFiles: [], codeExecution: 'none', rows: 0,\n}\n\nfunction messageOf(reason: unknown): string {\n return reason instanceof Error ? reason.message : String(reason)\n}\n\nasync function fetchJson(url: string): Promise<unknown> {\n const res = await fetch(url, { headers: { accept: 'application/json' } })\n if (!res.ok) throw new Error('HTTP ' + res.status)\n return res.json()\n}\n\ninterface PostResult {\n status: number\n data: { ok?: boolean; error?: string; message?: string; profile?: CompositionProfile; state?: PresetStateRow }\n}\n\nasync function postJson(url: string, body: unknown): Promise<PostResult> {\n const res = await fetch(url, {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify(body),\n })\n const data = await res.json().catch(() => ({})) as PostResult['data']\n return { status: res.status, data }\n}\n\ninterface SemverParts {\n major: number\n minor: number\n patch: number\n prerelease: string[]\n}\n\nexport function parseSemver(value: string): SemverParts | undefined {\n const match = /^v?(\\d+)\\.(\\d+)\\.(\\d+)(?:-([0-9A-Za-z.-]+))?(?:\\+[0-9A-Za-z.-]+)?$/.exec(value.trim())\n if (match === null) return undefined\n return {\n major: Number(match[1]),\n minor: Number(match[2]),\n patch: Number(match[3]),\n prerelease: match[4] === undefined ? [] : match[4].split('.'),\n }\n}\n\nexport function compareVersions(a: string, b: string): number {\n const pa = parseSemver(a)\n const pb = parseSemver(b)\n if (pa === undefined && pb === undefined) return 0\n if (pa === undefined) return -1\n if (pb === undefined) return 1\n for (const key of ['major', 'minor', 'patch'] as const) {\n if (pa[key] !== pb[key]) return pa[key] < pb[key] ? -1 : 1\n }\n if (pa.prerelease.length === 0 && pb.prerelease.length === 0) return 0\n if (pa.prerelease.length === 0) return 1\n if (pb.prerelease.length === 0) return -1\n for (let index = 0; index < Math.max(pa.prerelease.length, pb.prerelease.length); index++) {\n const ra = pa.prerelease[index]\n const rb = pb.prerelease[index]\n if (ra === undefined) return -1\n if (rb === undefined) return 1\n if (ra === rb) continue\n const numericA = /^\\d+$/.test(ra)\n const numericB = /^\\d+$/.test(rb)\n if (numericA && numericB) return Number(ra) < Number(rb) ? -1 : 1\n if (numericA) return -1\n if (numericB) return 1\n return ra < rb ? -1 : 1\n }\n return 0\n}\n\n/** Whether the catalog advertises a version newer than the installed one. */\nexport function hasUpdate(record: WorkshopPresetRecord, row: PresetStateRow | undefined): boolean {\n if (row === undefined || !row.installed) return false\n if (record.version === undefined || row.assetVersion === undefined) return false\n return compareVersions(record.version, row.assetVersion) > 0\n}\n\n/** Render the Presets panel. */\nexport function PresetPanel(props: PresetPanelProps): ReactNode {\n const { t } = props\n const [state, setState] = useState<StateResponse | null>(null)\n const [loadError, setLoadError] = useState<string | null>(null)\n const [query, setQuery] = useState('')\n const [busy, setBusy] = useState<string | null>(null)\n const [notes, setNotes] = useState<Record<string, string>>({})\n const [viewer, setViewer] = useState<{ id: string; text: string; truncated: boolean } | null>(null)\n const [confirmInstall, setConfirmInstall] = useState<{ id: string; name: string; profile: CompositionProfile } | null>(null)\n const [confirmUninstall, setConfirmUninstall] = useState<{ id: string; name: string } | null>(null)\n const [reload, setReload] = useState(0)\n\n useEffect(() => {\n let alive = true\n setLoadError(null)\n void fetchJson('/api/preset-center/state').then((raw) => {\n if (!alive) return\n setState(raw as StateResponse)\n }).catch((reason: unknown) => {\n if (!alive) return\n setState(null)\n setLoadError(messageOf(reason))\n })\n return () => { alive = false }\n }, [reload])\n\n const rows = props.items ?? []\n const stateById = new Map<string, PresetStateRow>((state?.presets ?? []).map((row) => [row.id, row]))\n const occupied = new Set(state?.occupied ?? [])\n const gateway = props.gateway === true && state !== null\n const busyNow = busy !== null\n\n const note = (id: string, text: string): void => {\n setNotes((prev) => ({ ...prev, [id]: text }))\n window.setTimeout(() => {\n setNotes((prev) => {\n const next = { ...prev }\n delete next[id]\n return next\n })\n }, 4000)\n }\n\n const refresh = (): void => { setReload((value) => value + 1) }\n\n const run = async (id: string, label: string, work: () => Promise<void>): Promise<void> => {\n if (busyNow) return\n setBusy(id)\n try {\n await work()\n } catch (reason) {\n note(id, t('note.actionFailed', { reason: messageOf(reason) }))\n } finally {\n setBusy(null)\n }\n }\n\n /** Declare one installed preset, asking for confirmation when it carries code. */\n const declareNow = async (record: WorkshopPresetRecord, confirm: boolean, success: PresetCenterKey): Promise<void> => {\n const res = await postJson('/api/preset-center/install', { id: record.id, confirm })\n if (res.data.ok === true) {\n setConfirmInstall(null)\n note(record.id, t(success, {}))\n refresh()\n return\n }\n if (res.data.error === 'confirmation-required') {\n setConfirmInstall({ id: record.id, name: displayName(record), profile: res.data.profile ?? EMPTY_PROFILE })\n return\n }\n if (res.data.error === 'broken' || res.data.error === 'invalid-composition') {\n note(record.id, t('note.broken', { reason: res.data.message ?? '' }))\n refresh()\n return\n }\n if (res.data.error === 'shadowed') {\n note(record.id, t('note.shadowed', {}))\n refresh()\n return\n }\n if (res.data.error === 'roster-unavailable') {\n note(record.id, t('note.rosterUnavailable', {}))\n return\n }\n note(record.id, t('note.actionFailed', { reason: res.data.message ?? res.data.error ?? 'HTTP ' + res.status }))\n }\n\n const install = (record: WorkshopPresetRecord, force: boolean): Promise<void> => run(record.id, 'install', async () => {\n if (props.install === undefined) return\n try {\n await props.install(record.id, force)\n } catch (reason) {\n const code = (reason as { code?: string }).code\n if (code === 'conflict') {\n note(record.id, t('note.conflict', {}))\n return\n }\n note(record.id, t('note.installFailed', { reason: messageOf(reason) }))\n return\n }\n void props.reportInstall?.(record.id).catch(() => { /* non-fatal */ })\n refresh()\n // A download lands inert; the declaration is what makes it live, and the\n // confirmation gate is what protects that step.\n await declareNow(record, false, force ? 'note.updated' : 'note.enabled')\n })\n\n const update = (record: WorkshopPresetRecord, row: PresetStateRow): Promise<void> => run(record.id, 'update', async () => {\n if (props.install === undefined) return\n const wasEnabled = row.enabled\n if (wasEnabled) {\n const off = await postJson('/api/preset-center/disable', { id: record.id })\n if (off.data.ok !== true) {\n note(record.id, t('note.actionFailed', { reason: off.data.message ?? off.data.error ?? 'HTTP ' + off.status }))\n return\n }\n }\n try {\n await props.install(record.id, true)\n } catch (reason) {\n note(record.id, t('note.installFailed', { reason: messageOf(reason) }))\n refresh()\n return\n }\n void props.reportInstall?.(record.id).catch(() => { /* non-fatal */ })\n if (wasEnabled) {\n // Already consented before the update; re-declaring the replaced bytes\n // must not silently lose the declaration the user asked for.\n await declareNow(record, true, 'note.updated')\n return\n }\n note(record.id, t('note.updated', {}))\n refresh()\n })\n\n const enable = (record: WorkshopPresetRecord, confirm: boolean): Promise<void> => run(record.id, 'enable', async () => {\n await declareNow(record, confirm, 'note.enabled')\n })\n\n const disable = (record: WorkshopPresetRecord): Promise<void> => run(record.id, 'disable', async () => {\n const res = await postJson('/api/preset-center/disable', { id: record.id })\n if (res.data.ok === true) {\n note(record.id, t('note.disabled', {}))\n refresh()\n return\n }\n if (res.data.error === 'default-preset') {\n note(record.id, t('note.defaultPreset', {}))\n return\n }\n note(record.id, t('note.actionFailed', { reason: res.data.message ?? res.data.error ?? 'HTTP ' + res.status }))\n })\n\n const uninstall = (record: WorkshopPresetRecord): Promise<void> => run(record.id, 'uninstall', async () => {\n const res = await postJson('/api/preset-center/uninstall', { id: record.id })\n setConfirmUninstall(null)\n if (res.data.ok === true) {\n note(record.id, t('note.uninstalled', {}))\n refresh()\n return\n }\n if (res.data.error === 'default-preset') {\n note(record.id, t('note.defaultPreset', {}))\n return\n }\n note(record.id, t('note.actionFailed', { reason: res.data.message ?? res.data.error ?? 'HTTP ' + res.status }))\n })\n\n const view = (record: WorkshopPresetRecord): Promise<void> => run(record.id, 'view', async () => {\n const raw = await fetchJson('/api/preset-center/composition?id=' + encodeURIComponent(record.id)) as { text?: string; truncated?: boolean }\n setViewer({ id: record.id, text: raw.text ?? '', truncated: raw.truncated === true })\n })\n\n function displayName(record: WorkshopPresetRecord): string {\n return record.name ?? record.nameEn ?? record.id\n }\n\n const matches = (record: WorkshopPresetRecord): boolean => {\n if (query === '') return true\n const q = query.toLowerCase()\n const hay = [record.name, record.nameEn, record.author, record.description, record.descriptionEn, ...(record.tags ?? [])]\n .filter(Boolean).join(' ').toLowerCase()\n return hay.includes(q)\n }\n\n const visible = rows\n .filter(matches)\n .slice()\n .sort((a, b) => (a.rank ?? 999) - (b.rank ?? 999) || displayName(a).localeCompare(displayName(b)))\n\n const codeBadgeKey = (profile: CompositionProfile): PresetCenterKey =>\n profile.codeExecution === 'local' ? 'code.local' : profile.codeExecution === 'inline' ? 'code.inline' : 'code.none'\n\n const statusOf = (record: WorkshopPresetRecord, row: PresetStateRow | undefined): { key: PresetCenterKey; tone: string } => {\n if (occupied.has(record.id)) return { key: 'state.shadowed', tone: css.badgeWarn }\n if (row === undefined) return { key: 'state.notInstalled', tone: css.badgeMuted }\n if (!row.managed) return { key: 'state.local', tone: css.badgeWarn }\n if (row.integrity === 'modified') return { key: 'state.modified', tone: css.badgeWarn }\n if (row.enabled) return { key: 'state.enabled', tone: css.badgeOn }\n return { key: 'state.installed', tone: css.badgeOff }\n }\n\n return (\n <div className={css.panel} data-dsh-plugin=\"preset-center\" data-dsh-part=\"preset-panel\">\n {props.gateway !== true ? <p className={css.note}>{t('note.remoteInstall', {})}</p> : null}\n {state === null && loadError !== null ? (\n <p className={css.note} role=\"status\">\n {gateway ? t('note.loadFailed', { reason: loadError }) : t('note.gatewayUnavailable', {})}\n <Button className={css.inlineButton} onClick={refresh}>{t('action.refresh')}</Button>\n </p>\n ) : null}\n <input\n className={css.search}\n type=\"search\"\n aria-label={t('search.placeholder')}\n placeholder={t('search.placeholder')}\n value={query}\n onChange={(event) => { setQuery(event.target.value) }}\n />\n {props.catalogState === 'loading' ? (\n <p className={css.empty} role=\"status\">{t('installing', {})}</p>\n ) : visible.length === 0 ? (\n <p className={css.empty} role=\"status\">{rows.length === 0 ? t('note.emptyCatalog', {}) : t('note.noMatch', {})}</p>\n ) : (\n <ul className={css.list}>\n {visible.map((record) => {\n const row = stateById.get(record.id)\n const status = statusOf(record, row)\n const profile = row?.profile ?? EMPTY_PROFILE\n const updateAvailable = hasUpdate(record, row)\n const busyHere = busy === record.id\n // A directory this plugin does not manage (hand-authored, or\n // installed by another tool) blocks the download: installing over\n // it would be a silent overwrite of someone else's files.\n const blockedByLocal = row !== undefined && !row.managed && row.installed\n const installable = gateway && props.install !== undefined && !occupied.has(record.id) && !blockedByLocal\n const installs = props.installs?.[record.id] ?? 0\n return (\n <li key={record.id} className={css.card}>\n <div className={css.cardHead}>\n <span className={css.cardName} title={displayName(record)}>\n {record.repo ? (\n <a href={record.repo} target=\"_blank\" rel=\"noreferrer\">{displayName(record)}</a>\n ) : displayName(record)}\n {record.version ? <span className={css.version}>v{record.version}</span> : null}\n </span>\n <span className={css.cardMeta}>\n {record.author ?? ''}\n <span className={status.tone}>{t(status.key, {})}</span>\n {updateAvailable ? <span className={css.badgeWarn}>{t('state.newVersion', { version: record.version ?? '' })}</span> : null}\n {row?.enabled && row.integrity === 'valid' ? null : null}\n {installs > 0 ? <span className={css.badgeMuted}>{t('count.installs', { count: String(installs) })}</span> : null}\n </span>\n </div>\n {record.description || record.descriptionEn ? (\n <p className={css.cardDesc}>{(record.description ?? record.descriptionEn ?? '').slice(0, 200)}</p>\n ) : null}\n {row !== undefined ? (\n <p className={css.profile}>\n <span className={css.badgeCode}>{t(codeBadgeKey(profile), {})}</span>\n <span className={css.profileText}>\n {t('code.detail', {\n files: String(profile.codeFiles.length),\n expressions: String(profile.inlineExpressions),\n plugins: String(profile.plugins.length),\n })}\n </span>\n </p>\n ) : null}\n <div className={css.actions}>\n {row === undefined || !row.managed ? (\n <Button\n className={css.primary}\n disabled={!installable || busyNow}\n onClick={() => { void install(record, false) }}\n >\n {busyHere ? t('installing', {}) : t('action.install', {})}\n </Button>\n ) : null}\n {row !== undefined && row.managed && !row.enabled ? (\n <Button\n className={css.primary}\n disabled={!gateway || busyNow || occupied.has(record.id)}\n onClick={() => { void enable(record, false) }}\n >\n {busyHere ? t('installing', {}) : t('action.enable', {})}\n </Button>\n ) : null}\n {row !== undefined && row.managed && row.enabled ? (\n <Button\n className={css.secondary}\n disabled={!gateway || busyNow}\n onClick={() => { void disable(record) }}\n >\n {t('action.disable', {})}\n </Button>\n ) : null}\n {row !== undefined && row.managed && (updateAvailable || row.integrity === 'modified') ? (\n <Button\n className={css.secondary}\n disabled={!installable || busyNow}\n onClick={() => { void update(record, row) }}\n >\n {t('action.update', {})}\n </Button>\n ) : null}\n {row !== undefined && row.integrity !== 'none' ? (\n <Button className={css.secondary} disabled={busyNow} onClick={() => { void view(record) }}>\n {t('action.view', {})}\n </Button>\n ) : null}\n {row !== undefined && row.managed ? (\n <Button className={css.danger} disabled={busyNow} onClick={() => { setConfirmUninstall({ id: record.id, name: displayName(record) }) }}>\n {t('action.uninstall', {})}\n </Button>\n ) : null}\n </div>\n {notes[record.id] ? <p className={css.note} role=\"status\">{notes[record.id]}</p> : null}\n </li>\n )\n })}\n </ul>\n )}\n <Modal\n title={viewer ? t('viewer.title', { name: viewer.id }) : ''}\n open={viewer !== null}\n onClose={() => { setViewer(null) }}\n closeLabel={t('action.cancel', {})}\n >\n <pre className={css.viewer}>{viewer?.text === '' ? t('viewer.empty', {}) : viewer?.text}</pre>\n {viewer?.truncated ? <p className={css.note}>{t('viewer.empty', {})}</p> : null}\n </Modal>\n <Modal\n title={t('confirm.title', {})}\n open={confirmInstall !== null}\n onClose={() => { setConfirmInstall(null) }}\n closeLabel={t('action.cancel', {})}\n >\n <p>\n {t('confirm.text', {\n name: confirmInstall?.name ?? '',\n detail: t('code.detail', {\n files: String(confirmInstall?.profile.codeFiles.length ?? 0),\n expressions: String(confirmInstall?.profile.inlineExpressions ?? 0),\n plugins: String(confirmInstall?.profile.plugins.length ?? 0),\n }),\n })}\n </p>\n <div className={css.modalActions}>\n <Button className={css.primary} onClick={() => {\n const target = confirmInstall\n setConfirmInstall(null)\n const record = rows.find((entry) => entry.id === target?.id)\n if (record !== undefined) void enable(record, true)\n }}>{t('action.enable', {})}</Button>\n <Button className={css.secondary} onClick={() => { setConfirmInstall(null) }}>{t('action.cancel', {})}</Button>\n </div>\n </Modal>\n <Modal\n title={t('uninstall.title', {})}\n open={confirmUninstall !== null}\n onClose={() => { setConfirmUninstall(null) }}\n closeLabel={t('action.cancel', {})}\n >\n <p>{t('uninstall.text', { name: confirmUninstall?.name ?? '' })}</p>\n <div className={css.modalActions}>\n <Button className={css.danger} onClick={() => {\n const target = confirmUninstall\n const record = rows.find((entry) => entry.id === target?.id)\n if (record !== undefined) void uninstall(record)\n else setConfirmUninstall(null)\n }}>{t('action.uninstall', {})}</Button>\n <Button className={css.secondary} onClick={() => { setConfirmUninstall(null) }}>{t('action.cancel', {})}</Button>\n </div>\n </Modal>\n </div>\n )\n}\n","/**\n * Preset-center copy (zh is the key source; en mirrors it key for key).\n * @module @linxin666/dsh-client-ui-preset-center/client/locales\n */\n\n/** Locale namespace owned by this plugin (single home; the entry and the panel import it). */\nexport const NS = 'dsh-web-ui-preset-center'\n\nexport const zh = {\n 'state.notInstalled': '未安装',\n 'state.installed': '已安装 · 未启用',\n 'state.enabled': '已启用',\n 'state.modified': '本地已修改',\n 'state.conflict': '目录状态异常',\n 'state.local': '本地自建同名预设',\n 'state.shadowed': 'id 已被其它插件声明的预设占用',\n 'state.newVersion': '有新版本 {version}',\n 'state.broken': '无法加载',\n 'action.install': '安装',\n 'action.update': '更新',\n 'action.enable': '启用',\n 'action.disable': '停用',\n 'action.uninstall': '卸载',\n 'action.view': '查看组合',\n 'action.cancel': '取消',\n 'action.refresh': '刷新',\n 'code.local': '含本地代码',\n 'code.inline': '含内联表达式',\n 'code.none': '仅组合已安装插件',\n 'code.detail': '{files} 个代码文件 · {expressions} 个 !!js 表达式 · {plugins} 个插件',\n 'confirm.title': '安装可执行预设',\n 'confirm.text': '「{name}」安装后会在 DSH 主进程内加载其组合内容,权限等同 shell 访问。{detail} 确认继续?',\n 'uninstall.title': '卸载预设',\n 'uninstall.text': '将注销「{name}」并删除其本地文件($DSH_HOME/agent-presets 中的副本)。已使用该预设的会话不受影响。',\n 'viewer.title': '{name} · agent.cordis.yml',\n 'viewer.empty': '(组合文件为空或不可读)',\n 'note.installFailed': '安装失败:{reason}',\n 'note.conflict': '本地已存在同名目录,未覆盖任何文件',\n 'note.actionFailed': '操作失败:{reason}',\n 'note.enabled': '已安装并启用;刷新页面后在「设置 → Agent 预设」中可见',\n 'note.disabled': '已停用;文件仍保留在预设库中,可随时重新启用',\n 'note.uninstalled': '已卸载',\n 'note.updated': '已更新到最新版本',\n 'note.broken': '无法加载:{reason}',\n 'note.shadowed': '该 id 已被另一插件声明的预设占用,无法声明',\n 'note.defaultPreset': '这是当前默认预设,请先在「设置 → Agent 预设」切换默认值',\n 'note.rosterUnavailable': '宿主未提供 agent-preset 注册表服务,无法声明预设',\n 'note.gatewayUnavailable': '本机网关不可用:远程浏览器或 host 路由未挂载,无法安装或启用',\n 'note.loadFailed': '读取预设状态失败:{reason}',\n 'note.emptyCatalog': '社区预设目录为空',\n 'note.noMatch': '没有匹配的预设',\n 'note.remoteInstall': '请在运行 DSH 的本机浏览器中操作',\n 'search.placeholder': '搜索预设',\n 'count.installs': '安装 {count}',\n 'installing': '处理中…',\n} as const\n\nexport const en: Record<keyof typeof zh, string> = {\n 'state.notInstalled': 'Not installed',\n 'state.installed': 'Installed - disabled',\n 'state.enabled': 'Enabled',\n 'state.modified': 'Modified locally',\n 'state.conflict': 'Directory state conflict',\n 'state.local': 'Local preset with this id',\n 'state.shadowed': 'Id taken by a preset another plugin declares',\n 'state.newVersion': 'Update {version} available',\n 'state.broken': 'Cannot load',\n 'action.install': 'Install',\n 'action.update': 'Update',\n 'action.enable': 'Enable',\n 'action.disable': 'Disable',\n 'action.uninstall': 'Uninstall',\n 'action.view': 'View composition',\n 'action.cancel': 'Cancel',\n 'action.refresh': 'Refresh',\n 'code.local': 'Ships local code',\n 'code.inline': 'Has inline expressions',\n 'code.none': 'Composes installed plugins only',\n 'code.detail': '{files} code files - {expressions} !!js expressions - {plugins} plugins',\n 'confirm.title': 'Install an executable preset',\n 'confirm.text': 'Installing \"{name}\" loads its composition inside the DSH host process, which carries the same trust as shell access. {detail} Continue?',\n 'uninstall.title': 'Uninstall preset',\n 'uninstall.text': 'Unregisters \"{name}\" and deletes its local files (the copy under $DSH_HOME/agent-presets). Sessions already using it keep running.',\n 'viewer.title': '{name} - agent.cordis.yml',\n 'viewer.empty': '(composition file is empty or unreadable)',\n 'note.installFailed': 'Install failed: {reason}',\n 'note.conflict': 'A directory with this id already exists locally; nothing was overwritten',\n 'note.actionFailed': 'Action failed: {reason}',\n 'note.enabled': 'Installed and enabled; refresh the page to see it under Settings - Agent presets',\n 'note.disabled': 'Disabled; the files stay in the preset library and can be enabled again',\n 'note.uninstalled': 'Uninstalled',\n 'note.updated': 'Updated to the newest version',\n 'note.broken': 'Cannot load: {reason}',\n 'note.shadowed': 'A preset another plugin declares already owns this id, so it cannot be declared',\n 'note.defaultPreset': 'This is the current default preset; change the default under Settings - Agent presets first',\n 'note.rosterUnavailable': 'The host exposes no agent-preset registry service, so presets cannot be declared',\n 'note.gatewayUnavailable': 'Local gateway unavailable: remote browser or host routes not mounted; install and enable are disabled',\n 'note.loadFailed': 'Reading preset state failed: {reason}',\n 'note.emptyCatalog': 'The community preset catalog is empty',\n 'note.noMatch': 'No matching preset',\n 'note.remoteInstall': 'Run this in a browser on the machine hosting DSH',\n 'search.placeholder': 'Search presets',\n 'count.installs': '{count} installs',\n 'installing': 'Working...',\n}\n\nexport type PresetCenterKey = keyof typeof zh\n","/**\n * Browser half of the preset center: registers the dictionaries and\n * contributes the Presets panel into the child slot the Workshop card\n * declares. Nothing here fetches the catalog — the store card owns that — and\n * every mutation goes through the host's loopback gateway.\n * @module @linxin666/dsh-client-ui-preset-center/client\n */\n\nimport type { Context as ClientContext } from '@deepseek-ai/cordis'\nimport type {} from '@deepseek-ai/dsh-client-locale/client'\nimport type {} from '@deepseek-ai/dsh-client-ui-renderer/client'\nimport type {} from '@deepseek-ai/dsh-client-ui-slots'\nimport { PresetPanel, type WorkshopPanelKeyProps, type WorkshopPanelOwnerProps } from './PresetPanel.tsx'\nimport { NS, en, zh, type PresetCenterKey } from './locales.ts'\n\nexport type { PresetPanelProps, WorkshopPanelKeyProps, WorkshopPanelOwnerProps, WorkshopPresetRecord } from './PresetPanel.tsx'\nexport { NS } from './locales.ts'\n\ndeclare module '@deepseek-ai/dsh-client-ui-slots' {\n interface LocaleNamespaceMap {\n /** Preset panel copy. */\n 'dsh-web-ui-preset-center': PresetCenterKey\n }\n\n interface SlotMap {\n /**\n * The child slot the Workshop card declares for asset-kind panels; this\n * plugin contributes the `preset` cell. Shape mirrors the store card's\n * declaration (both sides declare it identically, the same way the family\n * plugin cards share `web-ui.plugin.item`).\n */\n 'dsh-workshop.panel': {\n kind: 'keyed'\n scope: 'root'\n owner: WorkshopPanelOwnerProps\n keyProps: { preset: WorkshopPanelKeyProps }\n }\n }\n}\n\nexport const inject = ['slots', 'locale']\n\n/** Register the dictionaries and the Presets panel cell. */\nexport function apply(ctx: ClientContext): void {\n ctx.effect(() => {\n try {\n return ctx.locale.register(NS, { zh, en })\n } catch {\n return () => {}\n }\n }, 'dsh-preset-center: dictionaries')\n\n ctx.slots.inject('dsh-workshop.panel', () => {\n try {\n const unregister = ctx.slots.register({\n name: 'dsh-workshop.panel',\n key: 'preset',\n locale: NS,\n }, PresetPanel)\n return () => { unregister() }\n } catch {\n return () => {}\n }\n })\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqGA,MAAM,gBAAoC;GACxC,SAAS,CAAC;GAAG,eAAe,CAAC;GAAG,mBAAmB;GAAG,WAAW,CAAC;GAAG,eAAe;GAAQ,MAAM;EACpG;EAEA,SAAS,UAAU,QAAyB;GAC1C,OAAO,kBAAkB,QAAQ,OAAO,UAAU,OAAO,MAAM;EACjE;EAEA,eAAe,UAAU,KAA+B;GACtD,MAAM,MAAM,MAAM,MAAM,KAAK,EAAE,SAAS,EAAE,QAAQ,mBAAmB,EAAE,CAAC;GACxE,IAAI,CAAC,IAAI,IAAI,MAAM,IAAI,MAAM,UAAU,IAAI,MAAM;GACjD,OAAO,IAAI,KAAK;EAClB;EAOA,eAAe,SAAS,KAAa,MAAoC;GACvE,MAAM,MAAM,MAAM,MAAM,KAAK;IAC3B,QAAQ;IACR,SAAS,EAAE,gBAAgB,mBAAmB;IAC9C,MAAM,KAAK,UAAU,IAAI;GAC3B,CAAC;GACD,MAAM,OAAO,MAAM,IAAI,KAAK,CAAC,CAAC,aAAa,CAAC,EAAE;GAC9C,OAAO;IAAE,QAAQ,IAAI;IAAQ;GAAK;EACpC;EASA,SAAgB,YAAY,OAAwC;GAClE,MAAM,QAAQ,qEAAqE,KAAK,MAAM,KAAK,CAAC;GACpG,IAAI,UAAU,MAAM,OAAO,KAAA;GAC3B,OAAO;IACL,OAAO,OAAO,MAAM,EAAE;IACtB,OAAO,OAAO,MAAM,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AiB;GACjB,kBAAkB;GAClB,oBAAoB;GACpB,eAAe;GACf,iBAAiB;GACjB,kBAAkB;GAClB,cAAc;GACd,eAAe;GACf,aAAa;GACb,eAAe;GACf,iBAAiB;GACjB,gBAAgB;GAChB,mBAAmB;GACnB,kBAAkB;GAClB,gBAAgB;GAChB,gBAAgB;GAChB,sBAAsB;GACtB,iBAAiB;GACjB,qBAAqB;GACrB,gBAAgB;GAChB,iBAAiB;GACjB,oBAAoB;GACpB,gBAAgB;GAChB,eAAe;GACf,iBAAiB;GACjB,sBAAsB;GACtB,0BAA0B;GAC1B,2BAA2B;GAC3B,mBAAmB;GACnB,qBAAqB;GACrB,gBAAgB;GAChB,sBAAsB;GACtB,sBAAsB;GACtB,kBAAkB;GAClB,cAAc;EAChB;;;EChEA,MAAa,SAAS,CAAC,SAAS,QAAQ;;EAGxC,SAAgB,MAAM,KAA0B;GAC9C,IAAI,aAAa;IACf,IAAI;KACF,OAAO,IAAI,OAAO,SAAS,IAAI;MAAE;MAAI;KAAG,CAAC;IAC3C,QAAQ;KACN,aAAa,CAAC;IAChB;GACF,GAAG,iCAAiC;GAEpC,IAAI,MAAM,OAAO,4BAA4B;IAC3C,IAAI;KACF,MAAM,aAAa,IAAI,MAAM,SAAS;MACpC,MAAM;MACN,KAAK;MACL,QAAQ;KACV,GAAG,WAAW;KACd,aAAa;MAAE,WAAW;KAAE;IAC9B,QAAQ;KACN,aAAa,CAAC;IAChB;GACF,CAAC;EACH"}
|
|
1
|
+
{"version":3,"file":"client.js","names":["css","Button","Modal"],"sources":["../src/client/PresetPanel.tsx","../src/client/locales.ts","../src/client/index.ts"],"sourcesContent":["/**\n * The Workshop's Presets panel: browse the community preset catalog and drive\n * the host library (install into `$DSH_HOME/agent-presets/<id>` and declare it\n * to the agent-preset registry, disable, uninstall), with the composition\n * profile shown before anything executable is declared.\n *\n * The panel owns no catalog fetch: the Workshop card already fetches\n * `manifest/presets.json` and passes the records down, so one store section\n * makes one catalog request. Preset state comes from the preset-center host\n * routes, which derive it from disk and the live declarations on every read.\n * @module @linxin666/dsh-client-ui-preset-center/client/PresetPanel\n */\n\nimport { useEffect, useState, type ReactNode } from 'react'\nimport { Button, Modal } from '@deepseek-ai/dsh-client-ui-primitives'\nimport type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'\nimport { NS, type PresetCenterKey } from './locales.ts'\nimport css from './preset-center.module.css'\n\n/** One catalog record the Workshop card fetched from `manifest/presets.json`. */\nexport interface WorkshopPresetRecord {\n /** Preset id (the directory name). */\n id: string\n /** Display name (Chinese, matching the store convention). */\n name?: string\n /** English display name. */\n nameEn?: string\n /** Catalog author. */\n author?: string\n /** Chinese description. */\n description?: string\n /** English description. */\n descriptionEn?: string\n /** Catalog version used for update notifications. */\n version?: string\n /** Catalog tags. */\n tags?: string[]\n /** Source repository the card links to. */\n repo?: string\n /** Catalog ordering rank. */\n rank?: number\n}\n\n/** Marker key props of the Presets panel cell (the owner supplies nothing extra). */\nexport interface WorkshopPanelKeyProps {\n /** Marker field: key props are intentionally empty. */\n children?: never\n}\n\n/** Owner share the Workshop card passes to the Presets panel. */\nexport interface WorkshopPanelOwnerProps {\n /** Catalog records, already fetched by the store card. */\n items?: readonly WorkshopPresetRecord[]\n /** Catalog fetch state. */\n catalogState?: 'loading' | 'ready' | 'error'\n /** Whether the store's loopback asset gateway answered. */\n gateway?: boolean\n /** Install-event counts by preset id. */\n installs?: Record<string, number>\n /** Download one preset into the library through the store gateway. */\n install?: (id: string, force: boolean) => Promise<{ dest: string }>\n /** Record a successful install with the market (returns the fresh count). */\n reportInstall?: (id: string) => Promise<number>\n}\n\n/** Props the renderer binds for the Presets panel. */\nexport type PresetPanelProps =\n PropsLocale<typeof NS>\n & WorkshopPanelOwnerProps\n & WorkshopPanelKeyProps\n\ninterface CompositionProfile {\n plugins: string[]\n relativeNames: string[]\n inlineExpressions: number\n codeFiles: string[]\n codeExecution: 'none' | 'inline' | 'local'\n rows: number\n}\n\nexport interface PresetStateRow {\n id: string\n installed: boolean\n /** This plugin currently holds a registry declaration for the id. */\n enabled: boolean\n managed: boolean\n assetVersion?: string\n installedAt?: string\n integrity: 'valid' | 'modified' | 'missing' | 'none'\n dir: string\n profile: CompositionProfile\n}\n\ninterface StateResponse {\n ok?: boolean\n defaultId?: string | null\n occupied?: string[]\n rosterAvailable?: boolean\n presets?: PresetStateRow[]\n}\n\nconst EMPTY_PROFILE: CompositionProfile = {\n plugins: [], relativeNames: [], inlineExpressions: 0, codeFiles: [], codeExecution: 'none', rows: 0,\n}\n\nfunction messageOf(reason: unknown): string {\n return reason instanceof Error ? reason.message : String(reason)\n}\n\nasync function fetchJson(url: string): Promise<unknown> {\n const res = await fetch(url, { headers: { accept: 'application/json' } })\n if (!res.ok) throw new Error('HTTP ' + res.status)\n return res.json()\n}\n\ninterface PostResult {\n status: number\n data: { ok?: boolean; error?: string; message?: string; profile?: CompositionProfile; state?: PresetStateRow }\n}\n\nasync function postJson(url: string, body: unknown): Promise<PostResult> {\n const res = await fetch(url, {\n method: 'POST',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify(body),\n })\n const data = await res.json().catch(() => ({})) as PostResult['data']\n return { status: res.status, data }\n}\n\ninterface SemverParts {\n major: number\n minor: number\n patch: number\n prerelease: string[]\n}\n\nexport function parseSemver(value: string): SemverParts | undefined {\n const match = /^v?(\\d+)\\.(\\d+)\\.(\\d+)(?:-([0-9A-Za-z.-]+))?(?:\\+[0-9A-Za-z.-]+)?$/.exec(value.trim())\n if (match === null) return undefined\n return {\n major: Number(match[1]),\n minor: Number(match[2]),\n patch: Number(match[3]),\n prerelease: match[4] === undefined ? [] : match[4].split('.'),\n }\n}\n\nexport function compareVersions(a: string, b: string): number {\n const pa = parseSemver(a)\n const pb = parseSemver(b)\n if (pa === undefined && pb === undefined) return 0\n if (pa === undefined) return -1\n if (pb === undefined) return 1\n for (const key of ['major', 'minor', 'patch'] as const) {\n if (pa[key] !== pb[key]) return pa[key] < pb[key] ? -1 : 1\n }\n if (pa.prerelease.length === 0 && pb.prerelease.length === 0) return 0\n if (pa.prerelease.length === 0) return 1\n if (pb.prerelease.length === 0) return -1\n for (let index = 0; index < Math.max(pa.prerelease.length, pb.prerelease.length); index++) {\n const ra = pa.prerelease[index]\n const rb = pb.prerelease[index]\n if (ra === undefined) return -1\n if (rb === undefined) return 1\n if (ra === rb) continue\n const numericA = /^\\d+$/.test(ra)\n const numericB = /^\\d+$/.test(rb)\n if (numericA && numericB) return Number(ra) < Number(rb) ? -1 : 1\n if (numericA) return -1\n if (numericB) return 1\n return ra < rb ? -1 : 1\n }\n return 0\n}\n\n/** Whether the catalog advertises a version newer than the installed one. */\nexport function hasUpdate(record: WorkshopPresetRecord, row: PresetStateRow | undefined): boolean {\n if (row === undefined || !row.installed) return false\n if (record.version === undefined || row.assetVersion === undefined) return false\n return compareVersions(record.version, row.assetVersion) > 0\n}\n\n/** Render the Presets panel. */\nexport function PresetPanel(props: PresetPanelProps): ReactNode {\n const { t } = props\n const [state, setState] = useState<StateResponse | null>(null)\n const [loadError, setLoadError] = useState<string | null>(null)\n const [query, setQuery] = useState('')\n const [busy, setBusy] = useState<string | null>(null)\n const [notes, setNotes] = useState<Record<string, string>>({})\n const [viewer, setViewer] = useState<{ id: string; text: string; truncated: boolean } | null>(null)\n const [confirmInstall, setConfirmInstall] = useState<{ id: string; name: string; profile: CompositionProfile } | null>(null)\n const [confirmUninstall, setConfirmUninstall] = useState<{ id: string; name: string } | null>(null)\n const [reload, setReload] = useState(0)\n\n useEffect(() => {\n let alive = true\n setLoadError(null)\n void fetchJson('/api/preset-center/state').then((raw) => {\n if (!alive) return\n setState(raw as StateResponse)\n }).catch((reason: unknown) => {\n if (!alive) return\n setState(null)\n setLoadError(messageOf(reason))\n })\n return () => { alive = false }\n }, [reload])\n\n const rows = props.items ?? []\n const stateById = new Map<string, PresetStateRow>((state?.presets ?? []).map((row) => [row.id, row]))\n const occupied = new Set(state?.occupied ?? [])\n const gateway = props.gateway === true && state !== null\n const busyNow = busy !== null\n\n const note = (id: string, text: string): void => {\n setNotes((prev) => ({ ...prev, [id]: text }))\n window.setTimeout(() => {\n setNotes((prev) => {\n const next = { ...prev }\n delete next[id]\n return next\n })\n }, 4000)\n }\n\n const refresh = (): void => { setReload((value) => value + 1) }\n\n const run = async (id: string, label: string, work: () => Promise<void>): Promise<void> => {\n if (busyNow) return\n setBusy(id)\n try {\n await work()\n } catch (reason) {\n note(id, t('note.actionFailed', { reason: messageOf(reason) }))\n } finally {\n setBusy(null)\n }\n }\n\n /** Declare one installed preset, asking for confirmation when it carries code. */\n const declareNow = async (record: WorkshopPresetRecord, confirm: boolean, success: PresetCenterKey): Promise<void> => {\n const res = await postJson('/api/preset-center/install', { id: record.id, confirm })\n if (res.data.ok === true) {\n setConfirmInstall(null)\n note(record.id, t(success, {}))\n refresh()\n return\n }\n if (res.data.error === 'confirmation-required') {\n setConfirmInstall({ id: record.id, name: displayName(record), profile: res.data.profile ?? EMPTY_PROFILE })\n return\n }\n if (res.data.error === 'broken' || res.data.error === 'invalid-composition') {\n note(record.id, t('note.broken', { reason: res.data.message ?? '' }))\n refresh()\n return\n }\n if (res.data.error === 'shadowed') {\n note(record.id, t('note.shadowed', {}))\n refresh()\n return\n }\n if (res.data.error === 'roster-unavailable') {\n note(record.id, t('note.rosterUnavailable', {}))\n return\n }\n note(record.id, t('note.actionFailed', { reason: res.data.message ?? res.data.error ?? 'HTTP ' + res.status }))\n }\n\n const install = (record: WorkshopPresetRecord, force: boolean): Promise<void> => run(record.id, 'install', async () => {\n if (props.install === undefined) return\n try {\n await props.install(record.id, force)\n } catch (reason) {\n const code = (reason as { code?: string }).code\n if (code === 'conflict') {\n note(record.id, t('note.conflict', {}))\n return\n }\n note(record.id, t('note.installFailed', { reason: messageOf(reason) }))\n return\n }\n void props.reportInstall?.(record.id).catch(() => { /* non-fatal */ })\n refresh()\n // A download lands inert; the declaration is what makes it live, and the\n // confirmation gate is what protects that step.\n await declareNow(record, false, force ? 'note.updated' : 'note.enabled')\n })\n\n const update = (record: WorkshopPresetRecord, row: PresetStateRow): Promise<void> => run(record.id, 'update', async () => {\n if (props.install === undefined) return\n const wasEnabled = row.enabled\n if (wasEnabled) {\n const off = await postJson('/api/preset-center/disable', { id: record.id })\n if (off.data.ok !== true) {\n note(record.id, t('note.actionFailed', { reason: off.data.message ?? off.data.error ?? 'HTTP ' + off.status }))\n return\n }\n }\n try {\n await props.install(record.id, true)\n } catch (reason) {\n note(record.id, t('note.installFailed', { reason: messageOf(reason) }))\n refresh()\n return\n }\n void props.reportInstall?.(record.id).catch(() => { /* non-fatal */ })\n if (wasEnabled) {\n // Already consented before the update; re-declaring the replaced bytes\n // must not silently lose the declaration the user asked for.\n await declareNow(record, true, 'note.updated')\n return\n }\n note(record.id, t('note.updated', {}))\n refresh()\n })\n\n const enable = (record: WorkshopPresetRecord, confirm: boolean): Promise<void> => run(record.id, 'enable', async () => {\n await declareNow(record, confirm, 'note.enabled')\n })\n\n const disable = (record: WorkshopPresetRecord): Promise<void> => run(record.id, 'disable', async () => {\n const res = await postJson('/api/preset-center/disable', { id: record.id })\n if (res.data.ok === true) {\n note(record.id, t('note.disabled', {}))\n refresh()\n return\n }\n if (res.data.error === 'default-preset') {\n note(record.id, t('note.defaultPreset', {}))\n return\n }\n note(record.id, t('note.actionFailed', { reason: res.data.message ?? res.data.error ?? 'HTTP ' + res.status }))\n })\n\n const uninstall = (record: WorkshopPresetRecord): Promise<void> => run(record.id, 'uninstall', async () => {\n const res = await postJson('/api/preset-center/uninstall', { id: record.id })\n setConfirmUninstall(null)\n if (res.data.ok === true) {\n note(record.id, t('note.uninstalled', {}))\n refresh()\n return\n }\n if (res.data.error === 'default-preset') {\n note(record.id, t('note.defaultPreset', {}))\n return\n }\n note(record.id, t('note.actionFailed', { reason: res.data.message ?? res.data.error ?? 'HTTP ' + res.status }))\n })\n\n const view = (record: WorkshopPresetRecord): Promise<void> => run(record.id, 'view', async () => {\n const raw = await fetchJson('/api/preset-center/composition?id=' + encodeURIComponent(record.id)) as { text?: string; truncated?: boolean }\n setViewer({ id: record.id, text: raw.text ?? '', truncated: raw.truncated === true })\n })\n\n function displayName(record: WorkshopPresetRecord): string {\n return record.name ?? record.nameEn ?? record.id\n }\n\n const matches = (record: WorkshopPresetRecord): boolean => {\n if (query === '') return true\n const q = query.toLowerCase()\n const hay = [record.name, record.nameEn, record.author, record.description, record.descriptionEn, ...(record.tags ?? [])]\n .filter(Boolean).join(' ').toLowerCase()\n return hay.includes(q)\n }\n\n const visible = rows\n .filter(matches)\n .slice()\n .sort((a, b) => (a.rank ?? 999) - (b.rank ?? 999) || displayName(a).localeCompare(displayName(b)))\n\n const codeBadgeKey = (profile: CompositionProfile): PresetCenterKey =>\n profile.codeExecution === 'local' ? 'code.local' : profile.codeExecution === 'inline' ? 'code.inline' : 'code.none'\n\n const statusOf = (record: WorkshopPresetRecord, row: PresetStateRow | undefined): { key: PresetCenterKey; tone: string } => {\n if (occupied.has(record.id)) return { key: 'state.shadowed', tone: css.badgeWarn }\n if (row === undefined) return { key: 'state.notInstalled', tone: css.badgeMuted }\n if (!row.managed) return { key: 'state.local', tone: css.badgeWarn }\n if (row.integrity === 'modified') return { key: 'state.modified', tone: css.badgeWarn }\n if (row.enabled) return { key: 'state.enabled', tone: css.badgeOn }\n return { key: 'state.installed', tone: css.badgeOff }\n }\n\n return (\n <div className={css.panel} data-dsh-plugin=\"preset-center\" data-dsh-part=\"preset-panel\">\n {props.gateway !== true ? <p className={css.note}>{t('note.remoteInstall', {})}</p> : null}\n {state === null && loadError !== null ? (\n <p className={css.note} role=\"status\">\n {gateway ? t('note.loadFailed', { reason: loadError }) : t('note.gatewayUnavailable', {})}\n <Button className={css.inlineButton} onClick={refresh}>{t('action.refresh')}</Button>\n </p>\n ) : null}\n <input\n className={css.search}\n type=\"search\"\n aria-label={t('search.placeholder')}\n placeholder={t('search.placeholder')}\n value={query}\n onChange={(event) => { setQuery(event.target.value) }}\n />\n {props.catalogState === 'loading' ? (\n <p className={css.empty} role=\"status\">{t('installing', {})}</p>\n ) : visible.length === 0 ? (\n <p className={css.empty} role=\"status\">{rows.length === 0 ? t('note.emptyCatalog', {}) : t('note.noMatch', {})}</p>\n ) : (\n <ul className={css.list}>\n {visible.map((record) => {\n const row = stateById.get(record.id)\n const status = statusOf(record, row)\n const profile = row?.profile ?? EMPTY_PROFILE\n const updateAvailable = hasUpdate(record, row)\n const busyHere = busy === record.id\n // A directory this plugin does not manage (hand-authored, or\n // installed by another tool) blocks the download: installing over\n // it would be a silent overwrite of someone else's files.\n const blockedByLocal = row !== undefined && !row.managed && row.installed\n const installable = gateway && props.install !== undefined && !occupied.has(record.id) && !blockedByLocal\n const installs = props.installs?.[record.id] ?? 0\n return (\n <li key={record.id} className={css.card}>\n <div className={css.cardHead}>\n <span className={css.cardName} title={displayName(record)}>\n {record.repo ? (\n <a href={record.repo} target=\"_blank\" rel=\"noreferrer\">{displayName(record)}</a>\n ) : displayName(record)}\n {record.version ? <span className={css.version}>v{record.version}</span> : null}\n </span>\n <span className={css.cardMeta}>\n {record.author ?? ''}\n <span className={status.tone}>{t(status.key, {})}</span>\n {updateAvailable ? <span className={css.badgeWarn}>{t('state.newVersion', { version: record.version ?? '' })}</span> : null}\n {row?.enabled && row.integrity === 'valid' ? null : null}\n {installs > 0 ? <span className={css.badgeMuted}>{t('count.installs', { count: String(installs) })}</span> : null}\n </span>\n </div>\n {record.description || record.descriptionEn ? (\n <p className={css.cardDesc}>{(record.description ?? record.descriptionEn ?? '').slice(0, 200)}</p>\n ) : null}\n {row !== undefined ? (\n <p className={css.profile}>\n <span className={css.badgeCode}>{t(codeBadgeKey(profile), {})}</span>\n <span className={css.profileText}>\n {t('code.detail', {\n files: String(profile.codeFiles.length),\n expressions: String(profile.inlineExpressions),\n plugins: String(profile.plugins.length),\n })}\n </span>\n </p>\n ) : null}\n <div className={css.actions}>\n {row === undefined || !row.managed ? (\n <Button\n className={css.primary}\n disabled={!installable || busyNow}\n onClick={() => { void install(record, false) }}\n >\n {busyHere ? t('installing', {}) : t('action.install', {})}\n </Button>\n ) : null}\n {row !== undefined && row.managed && !row.enabled ? (\n <Button\n className={css.primary}\n disabled={!gateway || busyNow || occupied.has(record.id)}\n onClick={() => { void enable(record, false) }}\n >\n {busyHere ? t('installing', {}) : t('action.enable', {})}\n </Button>\n ) : null}\n {row !== undefined && row.managed && row.enabled ? (\n <Button\n className={css.secondary}\n disabled={!gateway || busyNow}\n onClick={() => { void disable(record) }}\n >\n {t('action.disable', {})}\n </Button>\n ) : null}\n {row !== undefined && row.managed && (updateAvailable || row.integrity === 'modified') ? (\n <Button\n className={css.secondary}\n disabled={!installable || busyNow}\n onClick={() => { void update(record, row) }}\n >\n {t('action.update', {})}\n </Button>\n ) : null}\n {row !== undefined && row.integrity !== 'none' ? (\n <Button className={css.secondary} disabled={busyNow} onClick={() => { void view(record) }}>\n {t('action.view', {})}\n </Button>\n ) : null}\n {row !== undefined && row.managed ? (\n <Button className={css.danger} disabled={busyNow} onClick={() => { setConfirmUninstall({ id: record.id, name: displayName(record) }) }}>\n {t('action.uninstall', {})}\n </Button>\n ) : null}\n </div>\n {notes[record.id] ? <p className={css.note} role=\"status\">{notes[record.id]}</p> : null}\n </li>\n )\n })}\n </ul>\n )}\n <Modal\n title={viewer ? t('viewer.title', { name: viewer.id }) : ''}\n open={viewer !== null}\n onClose={() => { setViewer(null) }}\n closeLabel={t('action.cancel', {})}\n >\n <pre className={css.viewer}>{viewer?.text === '' ? t('viewer.empty', {}) : viewer?.text}</pre>\n {viewer?.truncated ? <p className={css.note}>{t('viewer.empty', {})}</p> : null}\n </Modal>\n <Modal\n title={t('confirm.title', {})}\n open={confirmInstall !== null}\n onClose={() => { setConfirmInstall(null) }}\n closeLabel={t('action.cancel', {})}\n >\n <p>\n {t('confirm.text', {\n name: confirmInstall?.name ?? '',\n detail: t('code.detail', {\n files: String(confirmInstall?.profile.codeFiles.length ?? 0),\n expressions: String(confirmInstall?.profile.inlineExpressions ?? 0),\n plugins: String(confirmInstall?.profile.plugins.length ?? 0),\n }),\n })}\n </p>\n <div className={css.modalActions}>\n <Button className={css.primary} onClick={() => {\n const target = confirmInstall\n setConfirmInstall(null)\n const record = rows.find((entry) => entry.id === target?.id)\n if (record !== undefined) void enable(record, true)\n }}>{t('action.enable', {})}</Button>\n <Button className={css.secondary} onClick={() => { setConfirmInstall(null) }}>{t('action.cancel', {})}</Button>\n </div>\n </Modal>\n <Modal\n title={t('uninstall.title', {})}\n open={confirmUninstall !== null}\n onClose={() => { setConfirmUninstall(null) }}\n closeLabel={t('action.cancel', {})}\n >\n <p>{t('uninstall.text', { name: confirmUninstall?.name ?? '' })}</p>\n <div className={css.modalActions}>\n <Button className={css.danger} onClick={() => {\n const target = confirmUninstall\n const record = rows.find((entry) => entry.id === target?.id)\n if (record !== undefined) void uninstall(record)\n else setConfirmUninstall(null)\n }}>{t('action.uninstall', {})}</Button>\n <Button className={css.secondary} onClick={() => { setConfirmUninstall(null) }}>{t('action.cancel', {})}</Button>\n </div>\n </Modal>\n </div>\n )\n}\n","/**\n * Preset-center copy (zh is the key source; en mirrors it key for key).\n * @module @linxin666/dsh-client-ui-preset-center/client/locales\n */\n\n/** Locale namespace owned by this plugin (single home; the entry and the panel import it). */\nexport const NS = 'dsh-web-ui-preset-center'\n\nexport const zh = {\n 'state.notInstalled': '未安装',\n 'state.installed': '已安装 · 未启用',\n 'state.enabled': '已启用',\n 'state.modified': '本地已修改',\n 'state.conflict': '目录状态异常',\n 'state.local': '本地自建同名预设',\n 'state.shadowed': 'id 已被其它插件声明的预设占用',\n 'state.newVersion': '有新版本 {version}',\n 'state.broken': '无法加载',\n 'action.install': '安装',\n 'action.update': '更新',\n 'action.enable': '启用',\n 'action.disable': '停用',\n 'action.uninstall': '卸载',\n 'action.view': '查看组合',\n 'action.cancel': '取消',\n 'action.refresh': '刷新',\n 'code.local': '含本地代码',\n 'code.inline': '含内联表达式',\n 'code.none': '仅组合已安装插件',\n 'code.detail': '{files} 个代码文件 · {expressions} 个 !!js 表达式 · {plugins} 个插件',\n 'confirm.title': '安装可执行预设',\n 'confirm.text': '「{name}」安装后会在 DSH 主进程内加载其组合内容,权限等同 shell 访问。{detail} 确认继续?',\n 'uninstall.title': '卸载预设',\n 'uninstall.text': '将注销「{name}」并删除其本地文件($DSH_HOME/agent-presets 中的副本)。已使用该预设的会话不受影响。',\n 'viewer.title': '{name} · agent.cordis.yml',\n 'viewer.empty': '(组合文件为空或不可读)',\n 'note.installFailed': '安装失败:{reason}',\n 'note.conflict': '本地已存在同名目录,未覆盖任何文件',\n 'note.actionFailed': '操作失败:{reason}',\n 'note.enabled': '已安装并启用;刷新页面后在「设置 → Agent 预设」中可见',\n 'note.disabled': '已停用;文件仍保留在预设库中,可随时重新启用',\n 'note.uninstalled': '已卸载',\n 'note.updated': '已更新到最新版本',\n 'note.broken': '无法加载:{reason}',\n 'note.shadowed': '该 id 已被另一插件声明的预设占用,无法声明',\n 'note.defaultPreset': '这是当前默认预设,请先在「设置 → Agent 预设」切换默认值',\n 'note.rosterUnavailable': '宿主未提供 agent-preset 注册表服务,无法声明预设',\n 'note.gatewayUnavailable': '本机网关不可用:远程浏览器或 host 路由未挂载,无法安装或启用',\n 'note.loadFailed': '读取预设状态失败:{reason}',\n 'note.emptyCatalog': '社区预设目录为空',\n 'note.noMatch': '没有匹配的预设',\n 'note.remoteInstall': '请在运行 DSH 的本机浏览器中操作',\n 'search.placeholder': '搜索预设',\n 'count.installs': '安装 {count}',\n 'installing': '处理中…',\n} as const\n\nexport const en: Record<keyof typeof zh, string> = {\n 'state.notInstalled': 'Not installed',\n 'state.installed': 'Installed - disabled',\n 'state.enabled': 'Enabled',\n 'state.modified': 'Modified locally',\n 'state.conflict': 'Directory state conflict',\n 'state.local': 'Local preset with this id',\n 'state.shadowed': 'Id taken by a preset another plugin declares',\n 'state.newVersion': 'Update {version} available',\n 'state.broken': 'Cannot load',\n 'action.install': 'Install',\n 'action.update': 'Update',\n 'action.enable': 'Enable',\n 'action.disable': 'Disable',\n 'action.uninstall': 'Uninstall',\n 'action.view': 'View composition',\n 'action.cancel': 'Cancel',\n 'action.refresh': 'Refresh',\n 'code.local': 'Ships local code',\n 'code.inline': 'Has inline expressions',\n 'code.none': 'Composes installed plugins only',\n 'code.detail': '{files} code files - {expressions} !!js expressions - {plugins} plugins',\n 'confirm.title': 'Install an executable preset',\n 'confirm.text': 'Installing \"{name}\" loads its composition inside the DSH host process, which carries the same trust as shell access. {detail} Continue?',\n 'uninstall.title': 'Uninstall preset',\n 'uninstall.text': 'Unregisters \"{name}\" and deletes its local files (the copy under $DSH_HOME/agent-presets). Sessions already using it keep running.',\n 'viewer.title': '{name} - agent.cordis.yml',\n 'viewer.empty': '(composition file is empty or unreadable)',\n 'note.installFailed': 'Install failed: {reason}',\n 'note.conflict': 'A directory with this id already exists locally; nothing was overwritten',\n 'note.actionFailed': 'Action failed: {reason}',\n 'note.enabled': 'Installed and enabled; refresh the page to see it under Settings - Agent presets',\n 'note.disabled': 'Disabled; the files stay in the preset library and can be enabled again',\n 'note.uninstalled': 'Uninstalled',\n 'note.updated': 'Updated to the newest version',\n 'note.broken': 'Cannot load: {reason}',\n 'note.shadowed': 'A preset another plugin declares already owns this id, so it cannot be declared',\n 'note.defaultPreset': 'This is the current default preset; change the default under Settings - Agent presets first',\n 'note.rosterUnavailable': 'The host exposes no agent-preset registry service, so presets cannot be declared',\n 'note.gatewayUnavailable': 'Local gateway unavailable: remote browser or host routes not mounted; install and enable are disabled',\n 'note.loadFailed': 'Reading preset state failed: {reason}',\n 'note.emptyCatalog': 'The community preset catalog is empty',\n 'note.noMatch': 'No matching preset',\n 'note.remoteInstall': 'Run this in a browser on the machine hosting DSH',\n 'search.placeholder': 'Search presets',\n 'count.installs': '{count} installs',\n 'installing': 'Working...',\n}\n\nexport type PresetCenterKey = keyof typeof zh\n","/**\n * Browser half of the preset center: registers the dictionaries and\n * contributes the Presets panel into the child slot the Workshop card\n * declares. Nothing here fetches the catalog — the store card owns that — and\n * every mutation goes through the host's loopback gateway.\n * @module @linxin666/dsh-client-ui-preset-center/client\n */\n\nimport type { Context as ClientContext } from '@deepseek-ai/cordis'\nimport type {} from '@deepseek-ai/dsh-client-locale/client'\nimport type {} from '@deepseek-ai/dsh-client-ui-renderer/client'\nimport type {} from '@deepseek-ai/dsh-client-ui-slots'\nimport { PresetPanel, type WorkshopPanelKeyProps, type WorkshopPanelOwnerProps } from './PresetPanel.tsx'\nimport { NS, en, zh, type PresetCenterKey } from './locales.ts'\n\nexport type { PresetPanelProps, WorkshopPanelKeyProps, WorkshopPanelOwnerProps, WorkshopPresetRecord } from './PresetPanel.tsx'\nexport { NS } from './locales.ts'\n\ndeclare module '@deepseek-ai/dsh-client-ui-slots' {\n interface LocaleNamespaceMap {\n /** Preset panel copy. */\n 'dsh-web-ui-preset-center': PresetCenterKey\n }\n\n interface SlotMap {\n /**\n * The child slot the Workshop card declares for asset-kind panels; this\n * plugin contributes the `preset` cell. Shape mirrors the store card's\n * declaration (both sides declare it identically, the same way the family\n * plugin cards share `web-ui.plugin.item`).\n */\n 'dsh-workshop.panel': {\n kind: 'keyed'\n scope: 'root'\n owner: WorkshopPanelOwnerProps\n keyProps: { preset: WorkshopPanelKeyProps }\n }\n }\n}\n\nexport const inject = ['slots', 'locale']\n\n/** Register the dictionaries and the Presets panel cell. */\nexport function apply(ctx: ClientContext): void {\n ctx.effect(() => {\n try {\n return ctx.locale.register(NS, { zh, en })\n } catch {\n return () => {}\n }\n }, 'dsh-preset-center: dictionaries')\n\n ctx.slots.inject('dsh-workshop.panel', () => {\n try {\n const unregister = ctx.slots.register({\n name: 'dsh-workshop.panel',\n key: 'preset',\n locale: NS,\n }, PresetPanel)\n return () => { unregister() }\n } catch {\n return () => {}\n }\n })\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqGA,MAAM,gBAAoC;GACxC,SAAS,CAAC;GAAG,eAAe,CAAC;GAAG,mBAAm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B,sBAAsB;GACtB,kBAAkB;GAClB,cAAc;EAChB;;;EChEA,MAAa,SAAS,CAAC,SAAS,QAAQ;;EAGxC,SAAgB,MAAM,KAA0B;GAC9C,IAAI,aAAa;IACf,IAAI;KACF,OAAO,IAAI,OAAO,SAAS,IAAI;MAAE;MAAI;KAAG,CAAC;IAC3C,QAAQ;KACN,aAAa,CAAC;IAChB;GACF,GAAG,iCAAiC;GAEpC,IAAI,MAAM,OAAO,4BAA4B;IAC3C,IAAI;KACF,MAAM,aAAa,IAAI,MAAM,SAAS;MACpC,MAAM;MACN,KAAK;MACL,QAAQ;KACV,GAAG,WAAW;KACd,aAAa;MAAE,WAAW;KAAE;IAC9B,QAAQ;KACN,aAAa,CAAC;IAChB;GACF,CAAC;EACH"}
|
package/lib/index.js
CHANGED
|
@@ -11,38 +11,111 @@ import { createHash } from "node:crypto";
|
|
|
11
11
|
* the loader accepts a standalone install of the same package side by side;
|
|
12
12
|
* without this guard the second instance would still re-register the same
|
|
13
13
|
* webserver routes, tools, settings namespaces, and system-prompt sections
|
|
14
|
-
* and fail the boot. mountOnce makes
|
|
15
|
-
*
|
|
16
|
-
* package name in the client module host).
|
|
14
|
+
* and fail the boot. mountOnce makes a mount of an already-mounted package a
|
|
15
|
+
* no-op for as long as the first instance lives (the browser half is already
|
|
16
|
+
* deduped by package name in the client module host).
|
|
17
|
+
*
|
|
18
|
+
* A no-op is only safe while the holder is ALIVE. The holder can be disposed
|
|
19
|
+
* long after the refused mount ran its course: the Host reloads a profile by
|
|
20
|
+
* creating the new loader entries before the old ones are torn down (a
|
|
21
|
+
* plugin-manager enable/disable/install write, a settings-driven row reload,
|
|
22
|
+
* HMR), so the new aggregate shell entry mounts its family plugin while the
|
|
23
|
+
* previous entry still owns the name. Dropping that refused mount lost the
|
|
24
|
+
* plugin for good - the previous entry then disposed its own mount, releasing
|
|
25
|
+
* the name with nobody left to take it, and the family row stayed listed as
|
|
26
|
+
* active while its host routes 404ed (the task-board panel showed
|
|
27
|
+
* "board.hostError.notMounted", no degraded record appeared, and only a Host
|
|
28
|
+
* restart recovered it).
|
|
29
|
+
*
|
|
30
|
+
* The refused mount is therefore QUEUED, not dropped, and replayed the moment
|
|
31
|
+
* the holder releases the name - if the waiting fiber is still alive then. The
|
|
32
|
+
* single-instance guarantee is unchanged: exactly one mount is live per
|
|
33
|
+
* package name, and the replay re-enters the guard so a later mount still
|
|
34
|
+
* dedupes against it.
|
|
17
35
|
*
|
|
18
36
|
* The registry rides a global symbol so two module instances of the same
|
|
19
|
-
* package (npm copy vs repository link) still share one verdict.
|
|
20
|
-
*
|
|
37
|
+
* package (npm copy vs repository link) still share one verdict. That symbol
|
|
38
|
+
* is a CROSS-REPOSITORY contract, not this file's private state: the four
|
|
39
|
+
* satellite packages (dsh-skins / dsh-pet / dsh-presets /
|
|
40
|
+
* dsh-community-plugins) are separate repositories carrying their own copy of
|
|
41
|
+
* this guard, rebuilt on their own schedule, so the value under `MOUNTED`
|
|
42
|
+
* must keep the shape every published copy reads (a `Set` of package names
|
|
43
|
+
* with `has`/`add`/`delete`). The wait queues this guard added therefore live
|
|
44
|
+
* under their own additive key, and the registry reads back a `Set` even when
|
|
45
|
+
* some other build left a different value there. Changing `MOUNTED`'s shape
|
|
46
|
+
* in place broke that contract once: a satellite's legacy copy created a
|
|
47
|
+
* `Set`, the family's new copy read it as a `Map`, and every family row
|
|
48
|
+
* mounted after it failed with "claims.get is not a function".
|
|
49
|
+
*
|
|
50
|
+
* cordis `ctx.effect` runs its callback immediately and treats the callback's
|
|
21
51
|
* return value as the fiber disposer, so the unmarker is returned, not run.
|
|
22
52
|
*/
|
|
53
|
+
/** Published cross-repository contract: package names currently mounted. */
|
|
23
54
|
const MOUNTED = Symbol.for("dsh-web.mounted-plugins");
|
|
55
|
+
/** Additive key this guard owns: refused mounts waiting for the name. */
|
|
56
|
+
const WAITERS = Symbol.for("dsh-web.mounted-plugins.waiters");
|
|
57
|
+
/**
|
|
58
|
+
* The shared name registry, always a `Set` whatever another build stored here:
|
|
59
|
+
* a foreign value (an interim shape, a hand-written global) must not take every
|
|
60
|
+
* family plugin down with it.
|
|
61
|
+
* @returns the process-wide set of mounted package names.
|
|
62
|
+
*/
|
|
24
63
|
function mountedSet() {
|
|
25
64
|
const registry = globalThis;
|
|
26
|
-
|
|
65
|
+
const existing = registry[MOUNTED];
|
|
66
|
+
if (existing instanceof Set) return existing;
|
|
67
|
+
const created = /* @__PURE__ */ new Set();
|
|
68
|
+
registry[MOUNTED] = created;
|
|
69
|
+
return created;
|
|
70
|
+
}
|
|
71
|
+
/** Queue per package name for mounts refused while a holder was alive. */
|
|
72
|
+
function mountWaiters() {
|
|
73
|
+
const registry = globalThis;
|
|
74
|
+
return registry[WAITERS] ??= /* @__PURE__ */ new Map();
|
|
27
75
|
}
|
|
28
76
|
/**
|
|
29
77
|
* Wrap a cordis plugin apply so the package runs at most once per process.
|
|
30
|
-
* The first mount registers normally and
|
|
31
|
-
*
|
|
78
|
+
* The first mount registers normally and releases the name when its fiber
|
|
79
|
+
* disposes; a mount refused while that name is held waits for the release and
|
|
80
|
+
* then runs, unless its own fiber disposes first.
|
|
32
81
|
* @param packageName - npm package identity shared by every install source.
|
|
33
82
|
* @param fn - the original plugin apply.
|
|
34
83
|
* @returns an apply of the same shape.
|
|
35
84
|
*/
|
|
36
85
|
function mountOnce(packageName, fn) {
|
|
37
|
-
|
|
86
|
+
const mount = (...args) => {
|
|
38
87
|
const mounted = mountedSet();
|
|
39
|
-
|
|
88
|
+
const ctx = args[0];
|
|
89
|
+
if (mounted.has(packageName)) {
|
|
90
|
+
const waiters = mountWaiters();
|
|
91
|
+
const queue = waiters.get(packageName) ?? [];
|
|
92
|
+
let alive = true;
|
|
93
|
+
const pending = { run: () => {
|
|
94
|
+
if (alive) mount(...args);
|
|
95
|
+
} };
|
|
96
|
+
ctx?.effect?.(() => () => {
|
|
97
|
+
alive = false;
|
|
98
|
+
const index = queue.indexOf(pending);
|
|
99
|
+
if (index >= 0) queue.splice(index, 1);
|
|
100
|
+
});
|
|
101
|
+
queue.push(pending);
|
|
102
|
+
waiters.set(packageName, queue);
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
40
105
|
mounted.add(packageName);
|
|
41
|
-
|
|
106
|
+
ctx?.effect?.(() => () => {
|
|
42
107
|
mounted.delete(packageName);
|
|
108
|
+
const waiters = mountWaiters();
|
|
109
|
+
const queue = waiters.get(packageName);
|
|
110
|
+
if (queue === void 0) return;
|
|
111
|
+
waiters.delete(packageName);
|
|
112
|
+
for (const waiter of queue.splice(0)) queueMicrotask(() => {
|
|
113
|
+
waiter.run();
|
|
114
|
+
});
|
|
43
115
|
});
|
|
44
116
|
return fn(...args);
|
|
45
|
-
}
|
|
117
|
+
};
|
|
118
|
+
return mount;
|
|
46
119
|
}
|
|
47
120
|
//#endregion
|
|
48
121
|
//#region src/host/declarations.ts
|
package/package.json
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@linxin666/dsh-client-ui-preset-center",
|
|
3
3
|
"description": "Community agent-preset manager: the Workshop's Presets panel and the host library that installs, declares, disables and uninstalls presets downloaded from dsh-market.com, keeping a downloaded composition inert until the plugin declares it to the agent-preset registry.",
|
|
4
|
-
"version": "0.4.
|
|
4
|
+
"version": "0.4.3",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
5
8
|
"icon": "icon.svg",
|
|
6
9
|
"type": "module",
|
|
7
10
|
"main": "lib/index.js",
|
|
@@ -28,6 +31,15 @@
|
|
|
28
31
|
"platform": "web"
|
|
29
32
|
}
|
|
30
33
|
},
|
|
34
|
+
"packageManager": "pnpm@11.24.0",
|
|
35
|
+
"scripts": {
|
|
36
|
+
"build": "tsdown",
|
|
37
|
+
"prepare": "tsdown",
|
|
38
|
+
"watch": "tsdown --watch",
|
|
39
|
+
"typecheck": "tsc --noEmit",
|
|
40
|
+
"test": "vitest run",
|
|
41
|
+
"preset:check": "node scripts/preset-catalog.cjs --check"
|
|
42
|
+
},
|
|
31
43
|
"license": "BSD-3-Clause",
|
|
32
44
|
"peerDependencies": {
|
|
33
45
|
"@deepseek-ai/dsh": ">=0.1.7-rc.1",
|
|
@@ -50,6 +62,7 @@
|
|
|
50
62
|
"@types/react": "~18.3.1",
|
|
51
63
|
"@types/react-dom": "^18.3.5",
|
|
52
64
|
"jsdom": "^26.0.0",
|
|
65
|
+
"lightningcss": "^1.32.0",
|
|
53
66
|
"react": "^18.3.1",
|
|
54
67
|
"react-dom": "^18.3.1",
|
|
55
68
|
"tsdown": "0.22.2",
|
|
@@ -63,12 +76,6 @@
|
|
|
63
76
|
],
|
|
64
77
|
"repository": {
|
|
65
78
|
"type": "git",
|
|
66
|
-
"url": "https://github.com/zhu1090093659/dsh-
|
|
67
|
-
},
|
|
68
|
-
"scripts": {
|
|
69
|
-
"build": "tsdown",
|
|
70
|
-
"watch": "tsdown --watch",
|
|
71
|
-
"typecheck": "tsc --noEmit",
|
|
72
|
-
"test": "vitest run"
|
|
79
|
+
"url": "https://github.com/zhu1090093659/dsh-presets.git"
|
|
73
80
|
}
|
|
74
|
-
}
|
|
81
|
+
}
|