@supertiny99/dsh-profile-launcher 0.0.0-stage → 0.3.0

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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 supertiny99
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,61 @@
1
- # Temporary Holding Version
1
+ # @supertiny99/dsh-profile-launcher
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ DSH(DeepSeek Harness)多 Profile 桌面版启动器与环境管理器。在桌面端内侧栏面板发现本机全部 profile 环境(`~/.dsh*`)、识别运行状态与当前实例,一键启动不同 profile 的桌面版(独立 user-data 绕开 Electron 单实例锁,多环境**双开并存**),并支持**新建 / 停止 / 删除** profile 环境的完整生命周期管理。
4
+
5
+ ## 为什么需要它
6
+
7
+ - DSH 官方切换 profile 只能靠命令行(`DSH_HOME=... ` 启动),且桌面端主进程持有与 profile 无关的单实例锁——**朴素双开第二个 profile 实例会被锁静默吞掉**(进程秒退、只是聚焦旧窗口),极易误以为"启动了"。
8
+ - 新建 profile 更有坑:手动预置半吊子 `package.json` 会让宿主走"已初始化"分支不补全声明,host 崩在 `authenticatedUrl` 并弹官方"请重装"误导话术(实证)。新建的唯一正确形态是**纯空目录**——首次启动时宿主自动完成全部初始化。
9
+ - 本插件把「发现环境 + 正确双开 + 状态可见 + 生命周期管理」封装为零点击 GUI。
10
+
11
+ ## 功能
12
+
13
+ - **环境发现(两级)**:扫描 `~/.dsh*` 目录,区分完整 home(已初始化)与待初始化 home(新建空目录 / 历史不完整环境,首启时宿主自动补全),展示名称 / 路径 / 激活插件数 / 安装依赖数
14
+ - **运行状态**:扫描宿主进程列表,精确识别每个 profile 是否有桌面版在跑(当前实例高亮标记)
15
+ - **一键启动**:`spawn` detached 官方 app,不随本实例退出;启动后存活复查,秒退实例显式告警;待初始化 home 亦可直接启动(触发宿主首启初始化)
16
+ - **新建**:名称校验(小写字母/数字/连字符)+ 重名拒绝,创建 `~/.dsh-<名称>` 纯空目录,零预置文件;**可选继承模型配置**——下拉任选一个已初始化 profile,字节级复制 `settings.yaml`(模型 provider 定义)/ `.credentials.yaml`(API key,保持 0600)/ `.env`(环境变量注入)三件套到新 home。宿主首启经官方导入机制(settings.yaml → Cordis 条目)自动生效,模型设置**开箱即用无需重配**
17
+ - **停止**:SIGTERM 目标实例主进程,整棵进程树随之退出(实证 1s 清零),5s 轮询 + SIGKILL 兜底;同机其他实例零影响
18
+ - **删除**:官方 RiskConfirmation 勾选确认(降级内嵌二次确认),真删 home 整目录(含 desktop-user-data);运行中 / 当前实例 / 状态未知一律拒绝
19
+ - **防误操作**:操作入口不满足条件不渲染;homePath 白名单校验防任意路径注入
20
+ - 双主题自适应(`--dsw-alias-*` 设计 token);UI primitives 能力检测降级,宿主版本差异不白屏
21
+
22
+ ## 安装
23
+
24
+ DSH 桌面版 → 插件页「添加插件」,spec 任选:
25
+
26
+ ```text
27
+ @supertiny99/dsh-profile-launcher # npm
28
+ link:/path/to/this/profile-launcher # 开发态
29
+ ```
30
+
31
+ 安装后完全退出 app 冷启动生效。侧栏「Profile 启动器」(火箭图标,order 65)。
32
+
33
+ ## 使用
34
+
35
+ 1. 打开侧栏「Profile 启动器」面板,自动列出全部环境
36
+ 2. 对「未运行」的环境点「启动」,新桌面版窗口与当前实例并存
37
+ 3. 点「新建」输入名称创建空环境 → 启动即自动初始化 → 在新实例的「插件」页安装所需插件;想要模型配置开箱可用,在「继承配置」下拉选一个已有环境即可
38
+ 4. 运行中的沙盒可「停止」(整树退出),不再需要的环境确认后「删除」(整目录真删)
39
+ 5. 各 profile 实例的登录态/窗口状态相互独立(独立 user-data),首次各登一次即可
40
+
41
+ ## 已知边界
42
+
43
+ - 仅 macOS(Windows/Linux 未实证,roadmap 候选)
44
+ - 官方若变更单实例锁策略,双开钥匙可能失效(`engines.dsh <0.3.0` 限版本防护)
45
+ - 各实例 Chromium 层数据不共享(隔离的代价与收益)
46
+ - **首启「登录或添加 API Key」引导页**:账号未登录(如走本地网关、无 DeepSeek 账号)时,每个新 profile 首启会弹一次该官方引导——与是否继承模型配置**无关**(宿主机制实证:显示条件是账号状态而非配置缺失,完成标记为会话态不落盘),关闭即可,继承的模型配置已开箱可用
47
+ - 登录态(DeepSeek 账号会话)不随配置继承,需各 profile 首次手动登录(如有需要)
48
+
49
+ ## 开发
50
+
51
+ ```bash
52
+ npm install
53
+ npm test # 纯逻辑单测(node:assert/strict)
54
+ npm run build # esbuild 打包 + external 泄漏自检 + 产物结构 selfcheck
55
+ ```
56
+
57
+ Host 半(`src/index.js`)源码直发;Client 半构建到 `dist/client.js`。零 runtime 依赖,external 全部取自宿主冻结模块表。
58
+
59
+ ## License
60
+
61
+ MIT
@@ -0,0 +1,4 @@
1
+ # @supertiny99/dsh-profile-launcher bundle patch
2
+ - insert:
3
+ - id: profile-launcher
4
+ name: '@supertiny99/dsh-profile-launcher'
package/dist/client.js ADDED
@@ -0,0 +1,316 @@
1
+ window.__ModuleLoader__.load({id:"@supertiny99/dsh-profile-launcher",factory:(require)=>{const module={exports:{}};const exports=module.exports;
2
+ var V=Object.create;var y=Object.defineProperty;var X=Object.getOwnPropertyDescriptor;var Y=Object.getOwnPropertyNames;var Z=Object.getPrototypeOf,R=Object.prototype.hasOwnProperty;var ee=(r,t)=>{for(var o in t)y(r,o,{get:t[o],enumerable:!0})},I=(r,t,o,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of Y(t))!R.call(r,l)&&l!==o&&y(r,l,{get:()=>t[l],enumerable:!(s=X(t,l))||s.enumerable});return r};var $=(r,t,o)=>(o=r!=null?V(Z(r)):{},I(t||!r||!r.__esModule?y(o,"default",{value:r,enumerable:!0}):o,r)),re=r=>I(y({},"__esModule",{value:!0}),r);var me={};ee(me,{apply:()=>ge,inject:()=>be});module.exports=re(me);var e=$(require("react"),1),te=$(require("@deepseek-ai/dsh-client-ui-primitives"),1);var j=`.pl-container {
3
+ min-height: 100%;
4
+ background: var(--dsw-alias-surface-page, #f8fafc);
5
+ color: var(--dsw-alias-text-primary, #1e293b);
6
+ font-size: 13px;
7
+ line-height: 1.55;
8
+ padding: 20px 24px 32px;
9
+ box-sizing: border-box;
10
+ }
11
+
12
+ .pl-header {
13
+ display: flex;
14
+ align-items: center;
15
+ justify-content: space-between;
16
+ gap: 12px;
17
+ margin-bottom: 16px;
18
+ }
19
+
20
+ .pl-title {
21
+ font-size: 15px;
22
+ font-weight: 600;
23
+ letter-spacing: 0.2px;
24
+ display: flex;
25
+ align-items: center;
26
+ gap: 8px;
27
+ }
28
+
29
+ .pl-subtitle {
30
+ color: var(--dsw-alias-text-tertiary, #94a3b8);
31
+ font-size: 12px;
32
+ margin-top: 2px;
33
+ }
34
+
35
+ .pl-actions {
36
+ display: flex;
37
+ align-items: center;
38
+ gap: 8px;
39
+ }
40
+
41
+ .pl-hint {
42
+ color: var(--dsw-alias-text-tertiary, #94a3b8);
43
+ font-size: 12px;
44
+ border: 1px solid var(--dsw-alias-border-subtle, #e2e8f0);
45
+ border-radius: 8px;
46
+ padding: 10px 12px;
47
+ margin-bottom: 16px;
48
+ background: var(--dsw-alias-surface-overlay, #ffffff);
49
+ }
50
+
51
+ .pl-card-list {
52
+ display: flex;
53
+ flex-direction: column;
54
+ gap: 10px;
55
+ }
56
+
57
+ .pl-card {
58
+ display: flex;
59
+ align-items: center;
60
+ justify-content: space-between;
61
+ gap: 14px;
62
+ border: 1px solid var(--dsw-alias-border-subtle, #e2e8f0);
63
+ border-radius: 10px;
64
+ padding: 12px 14px;
65
+ background: var(--dsw-alias-surface-overlay, #ffffff);
66
+ transition: border-color 0.15s ease;
67
+ }
68
+
69
+ .pl-card:hover {
70
+ border-color: var(--dsw-alias-border-strong, #cbd5e1);
71
+ }
72
+
73
+ .pl-card-main {
74
+ display: flex;
75
+ flex-direction: column;
76
+ gap: 3px;
77
+ min-width: 0;
78
+ }
79
+
80
+ .pl-card-title-row {
81
+ display: flex;
82
+ align-items: center;
83
+ gap: 8px;
84
+ flex-wrap: wrap;
85
+ }
86
+
87
+ .pl-card-name {
88
+ font-weight: 600;
89
+ font-size: 13.5px;
90
+ }
91
+
92
+ .pl-card-path {
93
+ font-family: var(--dsw-alias-font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
94
+ font-size: 11.5px;
95
+ color: var(--dsw-alias-text-secondary, #64748b);
96
+ white-space: nowrap;
97
+ overflow: hidden;
98
+ text-overflow: ellipsis;
99
+ }
100
+
101
+ .pl-card-bundles {
102
+ font-size: 11.5px;
103
+ color: var(--dsw-alias-text-tertiary, #94a3b8);
104
+ }
105
+
106
+ .pl-badges {
107
+ display: flex;
108
+ align-items: center;
109
+ gap: 6px;
110
+ flex-shrink: 0;
111
+ }
112
+
113
+ .pl-badge {
114
+ display: inline-flex;
115
+ align-items: center;
116
+ gap: 5px;
117
+ font-size: 11px;
118
+ border-radius: 999px;
119
+ padding: 3px 9px;
120
+ border: 1px solid transparent;
121
+ white-space: nowrap;
122
+ }
123
+
124
+ .pl-badge-running {
125
+ color: #15803d;
126
+ background: rgba(34, 197, 94, 0.12);
127
+ border-color: rgba(34, 197, 94, 0.35);
128
+ }
129
+
130
+ .pl-badge-current {
131
+ color: #1d4ed8;
132
+ background: rgba(59, 130, 246, 0.12);
133
+ border-color: rgba(59, 130, 246, 0.35);
134
+ }
135
+
136
+ .pl-badge-stopped {
137
+ color: var(--dsw-alias-text-tertiary, #94a3b8);
138
+ background: var(--dsw-alias-surface-sunken, #f1f5f9);
139
+ border-color: var(--dsw-alias-border-subtle, #e2e8f0);
140
+ }
141
+
142
+ .pl-badge-unknown {
143
+ color: #92400e;
144
+ background: rgba(245, 158, 11, 0.12);
145
+ border-color: rgba(245, 158, 11, 0.35);
146
+ }
147
+
148
+ .pl-dot {
149
+ width: 6px;
150
+ height: 6px;
151
+ border-radius: 50%;
152
+ background: currentColor;
153
+ }
154
+
155
+ .pl-dot-pulse {
156
+ animation: pl-pulse 1.8s ease-in-out infinite;
157
+ }
158
+
159
+ @keyframes pl-pulse {
160
+ 0%, 100% { opacity: 1; }
161
+ 50% { opacity: 0.35; }
162
+ }
163
+
164
+ .pl-launch-btn {
165
+ display: inline-flex;
166
+ align-items: center;
167
+ gap: 6px;
168
+ font-size: 12px;
169
+ font-weight: 500;
170
+ border-radius: 8px;
171
+ padding: 6px 14px;
172
+ cursor: pointer;
173
+ border: 1px solid var(--dsw-alias-border-subtle, #e2e8f0);
174
+ background: var(--dsw-alias-surface-overlay, #ffffff);
175
+ color: var(--dsw-alias-text-primary, #1e293b);
176
+ transition: all 0.15s ease;
177
+ flex-shrink: 0;
178
+ }
179
+
180
+ .pl-launch-btn:hover:not(:disabled) {
181
+ border-color: var(--dsw-alias-border-strong, #cbd5e1);
182
+ }
183
+
184
+ .pl-launch-btn:disabled {
185
+ opacity: 0.45;
186
+ cursor: not-allowed;
187
+ }
188
+
189
+ .pl-empty {
190
+ text-align: center;
191
+ color: var(--dsw-alias-text-tertiary, #94a3b8);
192
+ padding: 40px 0;
193
+ }
194
+
195
+ .pl-error {
196
+ border: 1px solid rgba(239, 68, 68, 0.4);
197
+ background: rgba(239, 68, 68, 0.08);
198
+ color: #b91c1c;
199
+ border-radius: 8px;
200
+ padding: 10px 12px;
201
+ margin-bottom: 14px;
202
+ font-size: 12px;
203
+ word-break: break-all;
204
+ }
205
+
206
+ .pl-loading {
207
+ text-align: center;
208
+ color: var(--dsw-alias-text-tertiary, #94a3b8);
209
+ padding: 40px 0;
210
+ }
211
+
212
+ /* \u2014\u2014 pl-CHG-002\uFF1A\u65B0\u5EFA\u8868\u5355 / \u5371\u9669\u64CD\u4F5C / \u5F85\u521D\u59CB\u5316\u5FBD\u6807 \u2014\u2014 */
213
+
214
+ .pl-form {
215
+ display: flex;
216
+ align-items: center;
217
+ gap: 8px;
218
+ flex-wrap: wrap;
219
+ border: 1px solid var(--dsw-alias-border-subtle, #e2e8f0);
220
+ border-radius: 10px;
221
+ padding: 10px 12px;
222
+ margin-bottom: 12px;
223
+ background: var(--dsw-alias-surface-overlay, #ffffff);
224
+ }
225
+
226
+ .pl-input {
227
+ flex: 1 1 200px;
228
+ min-width: 0;
229
+ font-size: 12.5px;
230
+ border-radius: 8px;
231
+ padding: 7px 10px;
232
+ border: 1px solid var(--dsw-alias-border-subtle, #e2e8f0);
233
+ background: var(--dsw-alias-surface-page, #f8fafc);
234
+ color: var(--dsw-alias-text-primary, #1e293b);
235
+ outline: none;
236
+ transition: border-color 0.15s ease;
237
+ }
238
+
239
+ .pl-input:focus {
240
+ border-color: var(--dsw-alias-border-strong, #cbd5e1);
241
+ }
242
+
243
+ /* \u7EE7\u627F\u914D\u7F6E\u4E0B\u62C9\uFF08pl-CHG-003\uFF09\uFF1A\u5BF9\u9F50 pl-input \u5916\u89C2\uFF0C\u56FA\u5B9A\u5408\u7406\u5BBD\u5EA6\u4E0D\u4E0E\u540D\u79F0\u8F93\u5165\u62A2\u5F39\u6027\u884C */
244
+ .pl-select {
245
+ flex: 0 0 auto;
246
+ min-width: 180px;
247
+ appearance: auto;
248
+ cursor: pointer;
249
+ }
250
+
251
+ .pl-form-note {
252
+ font-size: 11px;
253
+ color: var(--dsw-alias-text-tertiary, #94a3b8);
254
+ white-space: nowrap;
255
+ }
256
+
257
+ .pl-link-btn {
258
+ font-size: 12px;
259
+ color: var(--dsw-alias-text-secondary, #64748b);
260
+ background: none;
261
+ border: none;
262
+ cursor: pointer;
263
+ padding: 6px 8px;
264
+ }
265
+
266
+ .pl-link-btn:hover {
267
+ text-decoration: underline;
268
+ }
269
+
270
+ .pl-danger-btn {
271
+ display: inline-flex;
272
+ align-items: center;
273
+ font-size: 12px;
274
+ font-weight: 500;
275
+ border-radius: 8px;
276
+ padding: 6px 14px;
277
+ cursor: pointer;
278
+ border: 1px solid var(--dsw-alias-border-subtle, #e2e8f0);
279
+ background: var(--dsw-alias-surface-overlay, #ffffff);
280
+ color: var(--dsw-alias-text-secondary, #64748b);
281
+ transition: all 0.15s ease;
282
+ flex-shrink: 0;
283
+ }
284
+
285
+ .pl-danger-btn:hover:not(:disabled) {
286
+ color: #b91c1c;
287
+ border-color: rgba(239, 68, 68, 0.45);
288
+ }
289
+
290
+ /* \u5185\u5D4C\u4E8C\u6B21\u786E\u8BA4\u6001\uFF08\u65E0 RiskConfirmation \u65F6\u7684\u964D\u7EA7\u8DEF\u5F84\uFF09\uFF1A\u7EA2\u8272\u5B9E\u611F\u5F3A\u8C03 */
291
+ .pl-danger-confirm {
292
+ color: #ffffff;
293
+ background: #dc2626;
294
+ border-color: #dc2626;
295
+ }
296
+
297
+ .pl-danger-confirm:hover:not(:disabled) {
298
+ color: #ffffff;
299
+ background: #b91c1c;
300
+ border-color: #b91c1c;
301
+ }
302
+
303
+ .pl-danger-btn:disabled {
304
+ opacity: 0.45;
305
+ cursor: not-allowed;
306
+ }
307
+
308
+ .pl-badge-pending {
309
+ color: #92400e;
310
+ background: rgba(245, 158, 11, 0.1);
311
+ border-color: rgba(245, 158, 11, 0.3);
312
+ font-size: 10.5px;
313
+ padding: 2px 8px;
314
+ }
315
+ `;var E=$(require("react"),1),k=class extends E.default.Component{constructor(t){super(t),this.state={error:null}}static getDerivedStateFromError(t){return{error:t}}componentDidCatch(t,o){console.error("[profile-launcher] panel error:",t,o)}render(){return this.state.error?E.default.createElement("div",{style:{padding:24,color:"#b91c1c",fontSize:13}},"Profile \u542F\u52A8\u5668\u9762\u677F\u6E32\u67D3\u51FA\u9519\uFF1A",String(this.state.error?.message??this.state.error)):this.props.children}};var N=te??{},u=typeof N.Button=="function"?N.Button:null,w=typeof N.RiskConfirmation=="function"?N.RiskConfirmation:null,ae=/^[a-z0-9]([a-z0-9-]{0,30}[a-z0-9])?$/;function J(r){return r.length===0?"":r.length>32?"\u540D\u79F0\u4E0D\u80FD\u8D85\u8FC7 32 \u4E2A\u5B57\u7B26":ae.test(r)?"":"\u4EC5\u5141\u8BB8\u5C0F\u5199\u5B57\u6BCD\u3001\u6570\u5B57\u3001\u8FDE\u5B57\u7B26\uFF0C\u4E14\u4E0D\u80FD\u4EE5\u8FDE\u5B57\u7B26\u5F00\u5934\u6216\u7ED3\u5C3E"}function G({active:r}){return e.default.createElement("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:r?2.2:1.6,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},e.default.createElement("path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z"}),e.default.createElement("path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z"}),e.default.createElement("path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0"}),e.default.createElement("path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5"}))}function oe({home:r}){return r.running===null||r.running===void 0?e.default.createElement("span",{className:"pl-badge pl-badge-unknown",title:"\u8FDB\u7A0B\u68C0\u6D4B\u4E0D\u53EF\u7528\uFF08pgrep \u5931\u8D25\uFF09"},e.default.createElement("span",{className:"pl-dot"})," \u72B6\u6001\u672A\u77E5"):r.current?e.default.createElement("span",{className:"pl-badge pl-badge-current",title:"\u5F53\u524D\u9762\u677F\u6240\u5728\u7684 profile \u5B9E\u4F8B"},e.default.createElement("span",{className:"pl-dot"})," \u5F53\u524D\u5B9E\u4F8B"):r.running?e.default.createElement("span",{className:"pl-badge pl-badge-running",title:"\u8BE5 profile \u684C\u9762\u7248\u6B63\u5728\u8FD0\u884C"},e.default.createElement("span",{className:"pl-dot pl-dot-pulse"})," \u8FD0\u884C\u4E2D"):e.default.createElement("span",{className:"pl-badge pl-badge-stopped",title:"\u8BE5 profile \u684C\u9762\u7248\u672A\u8FD0\u884C"},"\u672A\u8FD0\u884C")}function le({home:r,launching:t,onLaunch:o}){if(r.current||r.running===!0)return null;let s=t,l=t?"\u542F\u52A8\u4E2D\u2026":"\u542F\u52A8",p=b=>{b.preventDefault(),s||o(r)};return u?e.default.createElement(u,{variant:"secondary",size:"small",disabled:s,onClick:p},l):e.default.createElement("button",{type:"button",className:"pl-launch-btn",disabled:s,onClick:p},l)}function ie({home:r,busy:t,onStop:o}){if(r.current||r.running!==!0)return null;let s=t?"\u505C\u6B62\u4E2D\u2026":"\u505C\u6B62",l=p=>{p.preventDefault(),t||o(r)};return u?e.default.createElement(u,{variant:"secondary",size:"small",disabled:t,onClick:l},s):e.default.createElement("button",{type:"button",className:"pl-launch-btn",disabled:t,onClick:l},s)}function se({home:r,busy:t,immediate:o,onClick:s}){let[l,p]=(0,e.useState)(!1);return(0,e.useEffect)(()=>{if(!l)return;let f=setTimeout(()=>p(!1),3e3);return()=>clearTimeout(f)},[l]),r.current||r.running!==!1?null:e.default.createElement("button",{type:"button",className:l?"pl-danger-btn pl-danger-confirm":"pl-danger-btn",disabled:t,onClick:f=>{if(f.preventDefault(),!t){if(o||l){p(!1),s(r);return}p(!0)}}},t?"\u5220\u9664\u4E2D\u2026":l?"\u786E\u8BA4\u5220\u9664":"\u5220\u9664")}function de({home:r,launching:t,stopping:o,deleting:s,onLaunch:l,onStop:p,onDelete:b}){let f=r.bundleCount!=null?`${r.bundleCount} \u4E2A\u63D2\u4EF6\u6FC0\u6D3B \xB7 ${r.dependencyCount??0} \u4E2A\u5DF2\u5B89\u88C5`:"manifest \u4E0D\u53EF\u8BFB";return e.default.createElement("div",{className:"pl-card"},e.default.createElement("div",{className:"pl-card-main"},e.default.createElement("div",{className:"pl-card-title-row"},e.default.createElement("span",{className:"pl-card-name"},r.displayName),r.initialized===!1&&e.default.createElement("span",{className:"pl-badge pl-badge-pending",title:"\u5C1A\u65E0 profiles/desktop/package.json\u2014\u2014\u9996\u6B21\u542F\u52A8\u65F6\u7531\u5BBF\u4E3B\u81EA\u52A8\u5B8C\u6210\u521D\u59CB\u5316\uFF08\u7A7A profile \u5B9E\u8BC1\uFF0C\u65E0\u9700\u9884\u7F6E\u4EFB\u4F55\u6587\u4EF6\uFF09"},"\u5F85\u521D\u59CB\u5316")),e.default.createElement("span",{className:"pl-card-path",title:r.homePath},r.homePath),e.default.createElement("span",{className:"pl-card-bundles"},f)),e.default.createElement("div",{className:"pl-badges"},e.default.createElement(oe,{home:r}),e.default.createElement(le,{home:r,launching:t,onLaunch:l}),e.default.createElement(ie,{home:r,busy:o,onStop:p}),e.default.createElement(se,{home:r,busy:s,immediate:!!w,onClick:b})))}function pe(){let[r,t]=(0,e.useState)(null),[o,s]=(0,e.useState)(!0),[l,p]=(0,e.useState)(null),[b,f]=(0,e.useState)(null),[K,H]=(0,e.useState)(null),[_,D]=(0,e.useState)(null),[P,i]=(0,e.useState)(null),[h,L]=(0,e.useState)(!1),[C,A]=(0,e.useState)(""),[O,g]=(0,e.useState)(""),[z,S]=(0,e.useState)(""),[x,T]=(0,e.useState)(null),[W,F]=(0,e.useState)(!1),c=(0,e.useCallback)(async()=>{try{let n=await fetch("/profile-launcher/profiles");if(!n.ok)throw new Error(`HTTP ${n.status}`);t(await n.json()),p(null)}catch(n){p(n instanceof Error?n.message:String(n))}finally{s(!1)}},[]);(0,e.useEffect)(()=>{c()},[c]);let q=(0,e.useCallback)(async n=>{f(n.homePath),i(null);try{let a=await fetch("/profile-launcher/launch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({homePath:n.homePath})}),d=await a.json().catch(()=>({}));a.ok?d.survived===!1?i({kind:"error",text:`${n.displayName} \u5B9E\u4F8B\u542F\u52A8\u540E\u5F88\u5FEB\u9000\u51FA\uFF0C\u8BF7\u68C0\u67E5\u8BE5 profile \u662F\u5426\u635F\u574F`}):i({kind:"ok",text:`${n.displayName} \u684C\u9762\u7248\u5DF2\u542F\u52A8`}):i({kind:"error",text:d.error??`\u542F\u52A8\u5931\u8D25\uFF08HTTP ${a.status}\uFF09`})}catch(a){i({kind:"error",text:a instanceof Error?a.message:String(a)})}finally{f(null),await c(),setTimeout(()=>c(),3e3)}},[c]),m=(0,e.useCallback)(()=>{L(!1),A(""),g(""),S("")},[]),M=(0,e.useCallback)(async()=>{let n=C.trim(),a=J(n);if(a){g(a);return}i(null);try{let d=await fetch("/profile-launcher/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:n,inheritFrom:z||void 0})}),v=await d.json().catch(()=>({}));d.ok?(m(),i({kind:"ok",text:v.inherited?.length>0?`\u5DF2\u521B\u5EFA\u5E76\u7EE7\u627F\u6A21\u578B\u914D\u7F6E\uFF08${v.inherited.join("\u3001")}\uFF09\uFF0C\u5F00\u7BB1\u5373\u7528\u3002\u9996\u6B21\u542F\u52A8\u5982\u51FA\u73B0\u300C\u767B\u5F55\u6216\u6DFB\u52A0 API Key\u300D\u5F15\u5BFC\u9875\uFF0C\u5C5E\u5B98\u65B9\u4E00\u6B21\u6027\u6D41\u7A0B\uFF0C\u5173\u95ED\u5373\u53EF`:`\u5DF2\u521B\u5EFA ${v.homePath}\u3002\u9996\u6B21\u542F\u52A8\u65F6\u81EA\u52A8\u5B8C\u6210\u521D\u59CB\u5316\uFF1B\u5B89\u88C5\u63D2\u4EF6\u8BF7\u5728\u542F\u52A8\u540E\u7684\u5E94\u7528\u5185\u300C\u63D2\u4EF6\u300D\u9875\u64CD\u4F5C`}),await c()):g(v.error??`\u65B0\u5EFA\u5931\u8D25\uFF08HTTP ${d.status}\uFF09`)}catch(d){i({kind:"error",text:d instanceof Error?d.message:String(d)})}},[C,z,m,c]),Q=(0,e.useCallback)(async n=>{H(n.homePath),i(null);try{let a=await fetch("/profile-launcher/stop",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({homePath:n.homePath})}),d=await a.json().catch(()=>({}));a.ok?i({kind:"ok",text:`${n.displayName} \u684C\u9762\u7248\u5DF2\u505C\u6B62`}):i({kind:"error",text:d.error??`\u505C\u6B62\u5931\u8D25\uFF08HTTP ${a.status}\uFF09`})}catch(a){i({kind:"error",text:a instanceof Error?a.message:String(a)})}finally{H(null),await c()}},[c]),B=(0,e.useCallback)(async n=>{D(n.homePath),i(null);try{let a=await fetch("/profile-launcher/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({homePath:n.homePath})}),d=await a.json().catch(()=>({}));a.ok?i({kind:"ok",text:`\u5DF2\u5220\u9664 ${n.displayName}\uFF08${n.homePath}\uFF09`}):i({kind:"error",text:d.error??`\u5220\u9664\u5931\u8D25\uFF08HTTP ${a.status}\uFF09`})}catch(a){i({kind:"error",text:a instanceof Error?a.message:String(a)})}finally{D(null),await c()}},[c]),U=(0,e.useCallback)(n=>{w?(T(n),F(!1)):B(n)},[B]);return o?e.default.createElement("div",{className:"pl-container"},e.default.createElement("style",null,j),e.default.createElement("div",{className:"pl-loading"},"\u6B63\u5728\u626B\u63CF profile \u73AF\u5883\u2026")):e.default.createElement("div",{className:"pl-container"},e.default.createElement("style",null,j),e.default.createElement("div",{className:"pl-header"},e.default.createElement("div",null,e.default.createElement("div",{className:"pl-title"},e.default.createElement(G,{active:!0})," Profile \u542F\u52A8\u5668"),e.default.createElement("div",{className:"pl-subtitle"},"\u53D1\u73B0\u3001\u542F\u52A8\u3001\u65B0\u5EFA\u4E0E\u6E05\u7406\u4E0D\u540C profile \u7684 DSH \u684C\u9762\u7248\u73AF\u5883")),e.default.createElement("div",{className:"pl-actions"},e.default.createElement(ce,{open:h,onToggle:()=>{h?m():(L(!0),g(""),S(""))}}),e.default.createElement(fe,{onRefresh:c}))),h&&e.default.createElement("div",{className:"pl-form"},e.default.createElement("input",{className:"pl-input",type:"text",value:C,placeholder:"\u65B0 profile \u540D\u79F0\uFF08\u5982 sandbox\u3001test-235\uFF09",autoFocus:!0,onChange:n=>{A(n.target.value),g(J(n.target.value))},onKeyDown:n=>{n.key==="Enter"&&M(),n.key==="Escape"&&m()}}),e.default.createElement("select",{className:"pl-input pl-select",value:z,title:"\u65B0\u5EFA\u65F6\u4ECE\u65E2\u6709 profile \u590D\u5236\u6A21\u578B\u76F8\u5173\u914D\u7F6E\uFF08settings.yaml / .credentials.yaml / .env\uFF09",onChange:n=>S(n.target.value)},e.default.createElement("option",{value:""},"\u4E0D\u7EE7\u627F\uFF08\u7A7A profile\uFF09"),(r?.homes??[]).filter(n=>n.initialized===!0).map(n=>e.default.createElement("option",{key:n.homePath,value:n.homePath},"\u7EE7\u627F\u300C",n.displayName,"\u300D\u7684\u6A21\u578B\u914D\u7F6E"))),e.default.createElement(ue,{className:"pl-form-submit",onClick:M},"\u521B\u5EFA"),e.default.createElement("button",{type:"button",className:"pl-link-btn",onClick:m},"\u53D6\u6D88"),e.default.createElement("span",{className:"pl-form-note"},"home \u5C06\u521B\u5EFA\u4E3A ~/.dsh-<\u540D\u79F0>\uFF1B\u7EE7\u627F\u65F6\u590D\u5236\u6A21\u578B\u914D\u7F6E\u4E09\u4EF6\u5957\uFF08\u6765\u6E90\u7F3A\u5931\u7684\u8DF3\u8FC7\uFF09")),h&&O&&e.default.createElement("div",{className:"pl-error"},O),P&&e.default.createElement("div",{className:P.kind==="ok"?"pl-hint":"pl-error"},P.text),l&&e.default.createElement("div",{className:"pl-error"},"\u52A0\u8F7D\u5931\u8D25\uFF1A",l),r&&r.appPath===null&&e.default.createElement("div",{className:"pl-error"},"\u672A\u627E\u5230 DSH \u684C\u9762\u7248\u53EF\u6267\u884C\u6587\u4EF6\uFF0C\u542F\u52A8\u529F\u80FD\u4E0D\u53EF\u7528\uFF08\u63A2\u6D4B\u8FC7 argv[0] / execPath / /Applications \u9ED8\u8BA4\u8DEF\u5F84\uFF09"),e.default.createElement("div",{className:"pl-card-list"},r?.homes?.length?r.homes.map(n=>e.default.createElement(de,{key:n.homePath,home:n,launching:b===n.homePath,stopping:K===n.homePath,deleting:_===n.homePath,onLaunch:q,onStop:Q,onDelete:U})):e.default.createElement("div",{className:"pl-empty"},"\u672A\u53D1\u73B0\u4EFB\u4F55 profile \u73AF\u5883\uFF08~/.dsh* \u76EE\u5F55\u4E00\u4E2A\u90FD\u6CA1\u6709\uFF09")),w&&x&&e.default.createElement(w,{open:!0,title:`\u5220\u9664 profile\u300C${x.displayName}\u300D`,description:`\u5C06\u6C38\u4E45\u5220\u9664\u6574\u4E2A home \u76EE\u5F55 ${x.homePath}\uFF08\u542B desktop-user-data \u8FD0\u884C\u6570\u636E\uFF09\uFF0C\u4E0D\u53EF\u6062\u590D\u3002`,acknowledgeLabel:"\u6211\u7406\u89E3\u6B64\u64CD\u4F5C\u4E0D\u53EF\u64A4\u9500",cancelLabel:"\u53D6\u6D88",confirmLabel:"\u6C38\u4E45\u5220\u9664",acknowledged:W,onAcknowledgedChange:F,onCancel:()=>T(null),onConfirm:()=>{let n=x;T(null),B(n)}}))}function ce({open:r,onToggle:t}){return u?e.default.createElement(u,{variant:r?"ghost":"secondary",size:"small",onClick:t},r?"\u6536\u8D77":"\u65B0\u5EFA"):e.default.createElement("button",{type:"button",className:"pl-launch-btn",onClick:t},r?"\u6536\u8D77":"\u65B0\u5EFA")}function ue({className:r,onClick:t,children:o}){return u?e.default.createElement(u,{variant:"primary",size:"small",onClick:t},o):e.default.createElement("button",{type:"button",className:`pl-launch-btn ${r??""}`,onClick:t},o)}function fe({onRefresh:r}){return u?e.default.createElement(u,{variant:"ghost",size:"small",onClick:r},"\u5237\u65B0"):e.default.createElement("button",{type:"button",className:"pl-launch-btn",onClick:r},"\u5237\u65B0")}var be=["slots","layout"];function ge(r){r.slots.inject("sidebar.panellist",()=>r.slots.register({name:"sidebar.panellist",id:"profile-launcher",order:65,label:"Profile \u542F\u52A8\u5668"},G)),r.slots.inject("main",()=>r.slots.register({name:"main",key:"profile-launcher"},()=>e.default.createElement(k,null,e.default.createElement(pe,null))))}
316
+ return module.exports}})
package/package.json CHANGED
@@ -1,6 +1,62 @@
1
1
  {
2
- "name": "@supertiny99/dsh-profile-launcher",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
2
+ "name": "@supertiny99/dsh-profile-launcher",
3
+ "version": "0.3.0",
4
+ "description": "DeepSeek Harness (DSH) 多 Profile 桌面版一键启动器:在桌面端内发现全部 profile 环境、识别运行状态与当前实例,并以独立 user-data 目录绕开单实例锁实现不同 profile 桌面版双开并存;新建 profile 可选从既有 profile 继承模型相关配置(settings.yaml / .credentials.yaml / .env)。",
5
+ "type": "module",
6
+ "main": "src/index.js",
7
+ "author": "supertiny99",
8
+ "license": "MIT",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/supertiny99/dsh-profile-launcher.git"
12
+ },
13
+ "homepage": "https://github.com/supertiny99/dsh-profile-launcher#readme",
14
+ "bugs": {
15
+ "url": "https://github.com/supertiny99/dsh-profile-launcher/issues"
16
+ },
17
+ "exports": {
18
+ ".": "./src/index.js",
19
+ "./client": "./dist/client.js",
20
+ "./cordis.patch.yml": "./cordis.patch.yml",
21
+ "./package.json": "./package.json"
22
+ },
23
+ "dsh": {
24
+ "bundle": {
25
+ "patch": "./cordis.patch.yml"
26
+ },
27
+ "client": {
28
+ "platform": "web",
29
+ "immediately": true,
30
+ "inject": [
31
+ "@deepseek-ai/dsh-client-ui-conversation"
32
+ ]
33
+ }
34
+ },
35
+ "engines": {
36
+ "node": ">=20",
37
+ "dsh": ">=0.2.1-rc.5 <0.3.0"
38
+ },
39
+ "keywords": [
40
+ "dsh",
41
+ "deepseek-harness",
42
+ "dsh-plugin",
43
+ "profile",
44
+ "launcher",
45
+ "multi-instance",
46
+ "dev-sandbox"
47
+ ],
48
+ "scripts": {
49
+ "build": "node scripts/build.mjs && node scripts/selfcheck.mjs",
50
+ "test": "node tests/test-launcher-core.mjs"
51
+ },
52
+ "devDependencies": {
53
+ "esbuild": "^0.25.10"
54
+ },
55
+ "files": [
56
+ "src",
57
+ "dist/client.js",
58
+ "cordis.patch.yml",
59
+ "README.md",
60
+ "LICENSE"
61
+ ]
62
+ }