@jiyr0119/dsh-service-console 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # DSH Service Console
2
2
 
3
- **English**
3
+ **[English](README.md)** | [中文](README.zh.md)
4
4
 
5
5
  [![License](https://img.shields.io/github/license/Jiyr0119/dsh-service-console)](LICENSE)
6
6
  [![npm](https://img.shields.io/npm/v/@jiyr0119/dsh-service-console)](https://www.npmjs.com/package/@jiyr0119/dsh-service-console)
@@ -43,6 +43,8 @@ Alternative — dynamic paste (zero-build, process-local): paste `dynamic/host.j
43
43
 
44
44
  The preview shows the complete local listening-service list and the expanded inspector card. The ownership badge remains visible as a safety signal, while the list itself is no longer split into conversation/workspace/machine categories.
45
45
 
46
+ **[→ Interactive Demo](./demo/index.html)** — try the Service Console UI in your browser (no installation required).
47
+
46
48
  ## Permissions & safety
47
49
 
48
50
  - The client never sends raw PIDs or shell commands; it targets a service ID and the Host re-validates PID / start time / fingerprint before acting.
package/README.zh.md CHANGED
@@ -45,6 +45,8 @@ dsh plugin --profile web add -w @jiyr0119/dsh-service-console@latest
45
45
 
46
46
  预览展示本机完整监听服务列表与展开后的检查卡片。归属徽标仍作为安全提示保留,但列表不再按对话 / 工作区 / 本机拆分隐藏服务。
47
47
 
48
+ **[→ 交互式演示](./demo/index.html)** — 无需安装即可在浏览器中体验 Service Console 界面。
49
+
48
50
  ## 权限与安全
49
51
 
50
52
  - Client 不直接传任意 PID 或 Shell 命令,只以 service ID 为目标,Host 在操作前重新校验 PID / 启动时间 / fingerprint。
@@ -0,0 +1,657 @@
1
+ <!doctype html>
2
+ <html lang="zh-CN">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
6
+ <title>DSH Service Console · Interactive Demo</title>
7
+ <meta name="description" content="Interactive mock preview of the DSH Service Console plugin: discover listening ports, identify services, and safely inspect, stop, or restart them." />
8
+ <style>
9
+ * { box-sizing: border-box; }
10
+ html, body { height: 100%; }
11
+ body {
12
+ margin: 0;
13
+ font: 14px/1.5 -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
14
+ color: #e8e8e8;
15
+ background: radial-gradient(1200px 600px at 20% -10%, #1c2430 0%, #0d1117 55%, #080b0f 100%);
16
+ display: flex; flex-direction: column; align-items: center;
17
+ padding: 24px 16px 40px;
18
+ }
19
+
20
+ /* ---- demo 说明条 ---- */
21
+ .demo-note {
22
+ max-width: 960px; width: 100%;
23
+ background: rgba(255,255,255,.05);
24
+ border: 1px solid rgba(255,255,255,.08);
25
+ border-radius: 12px;
26
+ padding: 10px 16px;
27
+ margin-bottom: 14px;
28
+ font-size: 12.5px;
29
+ color: #aeb6c2;
30
+ display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center;
31
+ }
32
+ .demo-note b { color: #e8e8e8; }
33
+ .demo-note a { color: #6ea8fe; text-decoration: none; }
34
+ .demo-note a:hover { text-decoration: underline; }
35
+ .demo-note .pill {
36
+ margin-left: auto; flex: none;
37
+ background: rgba(65,118,230,.16); color: #9ec5ff;
38
+ border: 1px solid rgba(65,118,230,.35);
39
+ border-radius: 999px; padding: 2px 10px; font-size: 11.5px;
40
+ }
41
+ .demo-lang {
42
+ flex: none; cursor: pointer; border: 1px solid rgba(255,255,255,.2); background: transparent;
43
+ color: #cfd6e0; border-radius: 999px; padding: 2px 10px; font-size: 11.5px;
44
+ }
45
+ .demo-lang:hover { border-color: #6ea8fe; color: #fff; }
46
+
47
+ /* ---- 舞台:模拟 DSH 窗口 ---- */
48
+ .demo-stage {
49
+ position: relative;
50
+ width: min(960px, 100%);
51
+ height: min(620px, calc(100dvh - 130px));
52
+ min-height: 440px;
53
+ background: #15171a;
54
+ border: 1px solid rgba(255,255,255,.09);
55
+ border-radius: 18px;
56
+ overflow: hidden;
57
+ box-shadow: 0 24px 70px rgba(0,0,0,.55);
58
+ }
59
+
60
+ /* ---- 会话头部(面包屑 + 工具区) ---- */
61
+ .demo-header {
62
+ position: absolute; top: 0; left: 0; right: 0; z-index: 5;
63
+ display: flex; align-items: center; gap: 12px;
64
+ padding: 8px 16px;
65
+ border-bottom: 1px solid rgba(255,255,255,.07);
66
+ background: rgba(21,23,26,.92);
67
+ }
68
+ .demo-header-left { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
69
+ .demo-header-left .dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; flex: none; }
70
+ .demo-crumbs { display: flex; align-items: center; gap: 4px; font-size: 12.5px; min-width: 0; overflow: hidden; }
71
+ .demo-crumbs .crumb { color: #9aa3b0; background: transparent; border: 0; padding: 2px 4px; border-radius: 6px; font: inherit; }
72
+ .demo-crumbs .crumb-sep { color: #565e69; }
73
+ .demo-crumbs .crumb-current { color: #e8e8e8; font-weight: 600; }
74
+ .demo-header-utils { display: flex; align-items: center; gap: 8px; flex: none; }
75
+
76
+ /* Session log 胶囊(DSH 原生) */
77
+ .demo-sessionlog {
78
+ border: 1px solid rgba(255,255,255,.16);
79
+ min-width: 96px; height: 32px;
80
+ color: #e8e8e8; font-family: inherit; cursor: default;
81
+ background: transparent; border-radius: 18px;
82
+ justify-content: center; align-items: center; gap: 4px;
83
+ padding: 6px 12px; font-size: 13px; font-weight: 400; line-height: 20px;
84
+ display: inline-flex; flex: none; opacity: .85;
85
+ }
86
+ .demo-sessionlog span, .demo-sessionlog svg { flex: none; }
87
+ .demo-sessionlog span { white-space: nowrap; }
88
+ .demo-sessionlog:hover { background: rgba(255,255,255,.07); }
89
+
90
+ /* 插件入口胶囊:功能名称 + 图标(与真实插件一致) */
91
+ .demo-stage .sc-hicon {
92
+ border: 1px solid rgba(255,255,255,.16);
93
+ height: 32px;
94
+ color: #e8e8e8;
95
+ cursor: pointer;
96
+ background: transparent;
97
+ border-radius: 18px;
98
+ justify-content: center;
99
+ align-items: center;
100
+ gap: 4px;
101
+ padding: 6px 12px;
102
+ font-size: 13px;
103
+ font-weight: 400;
104
+ line-height: 20px;
105
+ display: inline-flex;
106
+ flex: none;
107
+ }
108
+ .demo-stage .sc-hicon:hover { background: rgba(255,255,255,.07); }
109
+ .demo-stage .sc-hicon.active {
110
+ background: rgba(65,118,230,.18);
111
+ border-color: rgba(65,118,230,.45);
112
+ color: #9ec5ff;
113
+ }
114
+ .demo-stage .sc-hicon svg { flex: none; }
115
+
116
+ /* ---- Service Console 面板 ---- */
117
+ .sc-panel {
118
+ position: absolute;
119
+ top: 44px;
120
+ right: 16px;
121
+ width: 520px;
122
+ max-height: calc(100% - 60px);
123
+ background: #1e2025;
124
+ border: 1px solid rgba(255,255,255,.12);
125
+ border-radius: 12px;
126
+ box-shadow: 0 12px 40px rgba(0,0,0,.45);
127
+ display: flex;
128
+ flex-direction: column;
129
+ z-index: 10;
130
+ overflow: hidden;
131
+ opacity: 0;
132
+ transform: translateY(-8px) scale(.97);
133
+ pointer-events: none;
134
+ transition: opacity .18s, transform .18s;
135
+ }
136
+ .sc-panel.open {
137
+ opacity: 1;
138
+ transform: translateY(0) scale(1);
139
+ pointer-events: auto;
140
+ }
141
+
142
+ /* 面板头部 */
143
+ .sc-head {
144
+ display: flex;
145
+ align-items: center;
146
+ gap: 8px;
147
+ padding: 10px 14px;
148
+ border-bottom: 1px solid rgba(255,255,255,.08);
149
+ background: rgba(30,32,37,.95);
150
+ }
151
+ .sc-head-title {
152
+ flex: 1;
153
+ font-size: 14px;
154
+ font-weight: 600;
155
+ color: #e8e8e8;
156
+ }
157
+ .sc-head-btn {
158
+ width: 28px; height: 28px;
159
+ display: flex; align-items: center; justify-content: center;
160
+ background: transparent;
161
+ border: 1px solid rgba(255,255,255,.12);
162
+ border-radius: 6px;
163
+ color: #9aa3b0;
164
+ cursor: pointer;
165
+ font-size: 12px;
166
+ }
167
+ .sc-head-btn:hover { background: rgba(255,255,255,.08); color: #e8e8e8; }
168
+
169
+ /* Tab 栏 */
170
+ .sc-tabs {
171
+ display: flex;
172
+ border-bottom: 1px solid rgba(255,255,255,.08);
173
+ background: rgba(30,32,37,.95);
174
+ }
175
+ .sc-tab {
176
+ flex: 1;
177
+ display: flex;
178
+ align-items: center;
179
+ justify-content: center;
180
+ gap: 6px;
181
+ padding: 10px 0;
182
+ font-size: 13px;
183
+ color: #9aa3b0;
184
+ cursor: pointer;
185
+ border: none;
186
+ background: transparent;
187
+ border-bottom: 2px solid transparent;
188
+ transition: color .15s, border-color .15s;
189
+ }
190
+ .sc-tab:hover { color: #e8e8e8; }
191
+ .sc-tab.active {
192
+ color: #e8e8e8;
193
+ border-bottom-color: #6ea8fe;
194
+ }
195
+ .sc-tab svg { flex: none; }
196
+
197
+ /* 搜索栏 */
198
+ .sc-search {
199
+ padding: 10px 14px;
200
+ border-bottom: 1px solid rgba(255,255,255,.06);
201
+ }
202
+ .sc-search input {
203
+ width: 100%;
204
+ padding: 8px 12px;
205
+ background: rgba(255,255,255,.06);
206
+ border: 1px solid rgba(255,255,255,.1);
207
+ border-radius: 8px;
208
+ color: #e8e8e8;
209
+ font-size: 13px;
210
+ outline: none;
211
+ }
212
+ .sc-search input::placeholder { color: #6b7280; }
213
+ .sc-search input:focus { border-color: rgba(65,118,230,.5); }
214
+
215
+ /* 状态提示 */
216
+ .sc-status {
217
+ padding: 8px 14px;
218
+ font-size: 12px;
219
+ color: #9aa3b0;
220
+ display: flex;
221
+ align-items: center;
222
+ gap: 6px;
223
+ border-bottom: 1px solid rgba(255,255,255,.06);
224
+ }
225
+ .sc-status .dot {
226
+ width: 6px; height: 6px;
227
+ border-radius: 50%;
228
+ background: #22c55e;
229
+ animation: pulse 2s infinite;
230
+ }
231
+ @keyframes pulse {
232
+ 0%, 100% { opacity: 1; }
233
+ 50% { opacity: .4; }
234
+ }
235
+
236
+ /* 服务列表 */
237
+ .sc-list {
238
+ flex: 1;
239
+ overflow-y: auto;
240
+ padding: 8px 0;
241
+ }
242
+ .sc-list::-webkit-scrollbar { width: 6px; }
243
+ .sc-list::-webkit-scrollbar-track { background: transparent; }
244
+ .sc-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 3px; }
245
+
246
+ /* 服务行 */
247
+ .sc-svc {
248
+ padding: 10px 14px;
249
+ border-bottom: 1px solid rgba(255,255,255,.05);
250
+ transition: background .1s;
251
+ }
252
+ .sc-svc:hover { background: rgba(255,255,255,.04); }
253
+ .sc-svc:last-child { border-bottom: none; }
254
+
255
+ .sc-svc-main {
256
+ display: flex;
257
+ align-items: center;
258
+ gap: 8px;
259
+ flex-wrap: wrap;
260
+ }
261
+ .sc-svc-dot { color: #22c55e; font-size: 10px; }
262
+ .sc-svc-dot.warn { color: #fbbf24; }
263
+ .sc-svc-dot.err { color: #f87171; }
264
+ .sc-svc-name { font-weight: 600; font-size: 13px; color: #e8e8e8; }
265
+ .sc-svc-meta { font-size: 12px; color: #6b7280; }
266
+ .sc-svc-badge {
267
+ font-size: 10px;
268
+ padding: 1px 6px;
269
+ border-radius: 4px;
270
+ border: 1px solid currentColor;
271
+ white-space: nowrap;
272
+ }
273
+ .sc-svc-badge.chat { color: #22c55e; }
274
+ .sc-svc-badge.workspace { color: #fbbf24; }
275
+ .sc-svc-badge.other { color: #94a3b8; }
276
+ .sc-svc-badge.unknown { color: #f87171; }
277
+
278
+ .sc-svc-actions {
279
+ margin-left: auto;
280
+ display: flex;
281
+ gap: 6px;
282
+ flex: none;
283
+ }
284
+ .sc-svc-btn {
285
+ padding: 4px 10px;
286
+ font-size: 11px;
287
+ border: 1px solid rgba(255,255,255,.15);
288
+ border-radius: 6px;
289
+ background: transparent;
290
+ color: #9aa3b0;
291
+ cursor: pointer;
292
+ transition: all .15s;
293
+ }
294
+ .sc-svc-btn:hover { background: rgba(255,255,255,.08); color: #e8e8e8; }
295
+ .sc-svc-btn.stop:hover { border-color: rgba(248,113,113,.5); color: #f87171; }
296
+ .sc-svc-btn.restart:hover { border-color: rgba(34,197,94,.5); color: #22c55e; }
297
+
298
+ .sc-svc-sub {
299
+ margin-top: 4px;
300
+ font-size: 11px;
301
+ color: #6b7280;
302
+ white-space: nowrap;
303
+ overflow: hidden;
304
+ text-overflow: ellipsis;
305
+ }
306
+
307
+ /* 空状态 */
308
+ .sc-empty {
309
+ padding: 40px 14px;
310
+ text-align: center;
311
+ color: #6b7280;
312
+ font-size: 13px;
313
+ }
314
+
315
+ /* 设置面板 */
316
+ .sc-settings {
317
+ padding: 14px;
318
+ }
319
+ .sc-settings-section {
320
+ font-size: 12px;
321
+ font-weight: 600;
322
+ color: #9aa3b0;
323
+ text-transform: uppercase;
324
+ letter-spacing: .5px;
325
+ margin-bottom: 12px;
326
+ }
327
+ .sc-settings-row {
328
+ display: flex;
329
+ align-items: center;
330
+ justify-content: space-between;
331
+ padding: 10px 0;
332
+ border-bottom: 1px solid rgba(255,255,255,.06);
333
+ }
334
+ .sc-settings-label { font-size: 13px; color: #e8e8e8; }
335
+ .sc-settings-desc { font-size: 11px; color: #6b7280; margin-top: 2px; }
336
+ .sc-settings-input {
337
+ width: 100px;
338
+ padding: 6px 10px;
339
+ background: rgba(255,255,255,.06);
340
+ border: 1px solid rgba(255,255,255,.1);
341
+ border-radius: 6px;
342
+ color: #e8e8e8;
343
+ font-size: 12px;
344
+ text-align: right;
345
+ }
346
+ .sc-settings-switch {
347
+ width: 36px; height: 20px;
348
+ border-radius: 10px;
349
+ background: rgba(255,255,255,.15);
350
+ border: none;
351
+ cursor: pointer;
352
+ position: relative;
353
+ transition: background .2s;
354
+ }
355
+ .sc-settings-switch.on { background: #6ea8fe; }
356
+ .sc-settings-switch::after {
357
+ content: '';
358
+ position: absolute;
359
+ top: 2px; left: 2px;
360
+ width: 16px; height: 16px;
361
+ border-radius: 50%;
362
+ background: #fff;
363
+ transition: transform .2s;
364
+ }
365
+ .sc-settings-switch.on::after { transform: translateX(16px); }
366
+
367
+ /* ---- 模拟对话内容 ---- */
368
+ .demo-chat {
369
+ position: absolute;
370
+ top: 44px; left: 0; right: 0; bottom: 0;
371
+ padding: 20px;
372
+ overflow-y: auto;
373
+ opacity: .3;
374
+ }
375
+ .demo-msg {
376
+ max-width: 480px;
377
+ margin-bottom: 16px;
378
+ }
379
+ .demo-msg.user { margin-left: auto; }
380
+ .demo-msg-bubble {
381
+ padding: 10px 14px;
382
+ border-radius: 12px;
383
+ font-size: 13px;
384
+ line-height: 1.5;
385
+ }
386
+ .demo-msg.assistant .demo-msg-bubble {
387
+ background: rgba(255,255,255,.08);
388
+ color: #e8e8e8;
389
+ }
390
+ .demo-msg.user .demo-msg-bubble {
391
+ background: rgba(65,118,230,.2);
392
+ color: #e8e8e8;
393
+ }
394
+ .demo-msg-label {
395
+ font-size: 11px;
396
+ color: #6b7280;
397
+ margin-bottom: 4px;
398
+ }
399
+
400
+ /* ---- 语言切换逻辑 ---- */
401
+ [data-lang="en"] { display: none; }
402
+ body.lang-en [data-lang="en"] { display: inline; }
403
+ body.lang-en [data-lang="zh"] { display: none; }
404
+ body.lang-en .demo-note [data-lang="en"] { display: inline; }
405
+ body.lang-en .demo-note [data-lang="zh"] { display: none; }
406
+ </style>
407
+ </head>
408
+ <body>
409
+ <!-- 说明条 -->
410
+ <div class="demo-note">
411
+ <span><b>DSH Service Console</b> — <span data-lang="zh">交互式演示</span><span data-lang="en">Interactive Demo</span></span>
412
+ <span data-lang="zh">点击右上角 <b>🖥 SC</b> 按钮打开控制台面板</span>
413
+ <span data-lang="en">Click the <b>🖥 SC</b> button in the header to open the console</span>
414
+ <a href="https://github.com/Jiyr0119/dsh-service-console" target="_blank">GitHub</a>
415
+ <button class="demo-lang" onclick="toggleLang()">EN / 中文</button>
416
+ <span class="pill">v0.3.1</span>
417
+ </div>
418
+
419
+ <!-- 舞台 -->
420
+ <div class="demo-stage">
421
+ <!-- 模拟 DSH 会话头部 -->
422
+ <div class="demo-header">
423
+ <div class="demo-header-left">
424
+ <div class="dot"></div>
425
+ <div class="demo-crumbs">
426
+ <button class="crumb">workspace</button>
427
+ <span class="crumb-sep">/</span>
428
+ <button class="crumb">project</button>
429
+ <span class="crumb-sep">/</span>
430
+ <span class="crumb-current">main</span>
431
+ </div>
432
+ </div>
433
+ <div class="demo-header-utils">
434
+ <button class="demo-sessionlog">
435
+ <svg width="14" height="14" viewBox="0 0 16 16" fill="none"><path d="M8 1v6l4 2" stroke="currentColor" stroke-width="1.3" stroke-linecap="round"/><circle cx="8" cy="8" r="6.5" stroke="currentColor" stroke-width="1.3"/></svg>
436
+ <span>Session Log</span>
437
+ </button>
438
+ <button class="sc-hicon" id="scEntry" onclick="togglePanel()">
439
+ <svg viewBox="0 0 16 16" width="13" height="13" aria-hidden="true">
440
+ <rect x="2" y="3" width="12" height="10" rx="1.5" fill="none" stroke="currentColor" stroke-width="1.3"/>
441
+ <path d="M5 7h6M5 10h4" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>
442
+ </svg>
443
+ <span>SC</span>
444
+ </button>
445
+ </div>
446
+ </div>
447
+
448
+ <!-- 模拟对话内容 -->
449
+ <div class="demo-chat">
450
+ <div class="demo-msg assistant">
451
+ <div class="demo-msg-label">Assistant</div>
452
+ <div class="demo-msg-bubble">I'll help you set up the development server. Let me start the Vite dev server for you.</div>
453
+ </div>
454
+ <div class="demo-msg user">
455
+ <div class="demo-msg-label">You</div>
456
+ <div class="demo-msg-bubble">Great, please start it on port 5173.</div>
457
+ </div>
458
+ <div class="demo-msg assistant">
459
+ <div class="demo-msg-label">Assistant</div>
460
+ <div class="demo-msg-bubble">✅ Dev server started on http://localhost:5173<br/>You can now open the Service Console to monitor it.</div>
461
+ </div>
462
+ </div>
463
+
464
+ <!-- Service Console 面板 -->
465
+ <div class="sc-panel" id="scPanel">
466
+ <!-- 头部 -->
467
+ <div class="sc-head">
468
+ <svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true">
469
+ <rect x="2" y="3" width="12" height="10" rx="1.5" fill="none" stroke="currentColor" stroke-width="1.3"/>
470
+ <path d="M5 7h6M5 10h4" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>
471
+ </svg>
472
+ <span class="sc-head-title">Service Console</span>
473
+ <button class="sc-head-btn" title="Refresh">
474
+ <svg viewBox="0 0 16 16" width="12" height="12"><path d="M13.5 8a5.5 5.5 0 1 1-1.61-3.89M13.5 1.5v3h-3" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/></svg>
475
+ </button>
476
+ <button class="sc-head-btn" onclick="togglePanel()" title="Close">
477
+ <svg viewBox="0 0 16 16" width="12" height="12"><path d="M4 4l8 8M12 4l-8 8" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/></svg>
478
+ </button>
479
+ </div>
480
+
481
+ <!-- Tab 栏 -->
482
+ <div class="sc-tabs">
483
+ <button class="sc-tab active" onclick="switchTab('services')">
484
+ <svg viewBox="0 0 16 16" width="13" height="13" aria-hidden="true">
485
+ <rect x="2" y="3" width="12" height="10" rx="1.5" fill="none" stroke="currentColor" stroke-width="1.3"/>
486
+ <path d="M5 7h6M5 10h4" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>
487
+ </svg>
488
+ <span data-lang="zh">服务</span>
489
+ <span data-lang="en">Services</span>
490
+ </button>
491
+ <button class="sc-tab" onclick="switchTab('settings')">
492
+ <svg viewBox="0 0 16 16" width="13" height="13" aria-hidden="true">
493
+ <circle cx="8" cy="8" r="2.5" fill="none" stroke="currentColor" stroke-width="1.3"/>
494
+ <path d="M8 4.3V2.9M8 13.1v-1.4M4.3 8H2.9M13.1 8h-1.4M5.2 5.2L4.1 4.1M11.9 11.9l-1.1-1.1M5.2 10.8L4.1 11.9M11.9 4.1l-1.1 1.1" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>
495
+ </svg>
496
+ <span data-lang="zh">设置</span>
497
+ <span data-lang="en">Settings</span>
498
+ </button>
499
+ </div>
500
+
501
+ <!-- 服务列表 Tab -->
502
+ <div id="tabServices">
503
+ <!-- 搜索栏 -->
504
+ <div class="sc-search">
505
+ <input type="text" placeholder="搜索服务、端口或路径…" id="searchInput" oninput="filterServices()" />
506
+ </div>
507
+
508
+ <!-- 状态 -->
509
+ <div class="sc-status">
510
+ <div class="dot"></div>
511
+ <span data-lang="zh">3 项服务</span>
512
+ <span data-lang="en">3 services</span>
513
+ <span style="margin-left:auto;font-size:11px;color:#6b7280;">15:32:08</span>
514
+ </div>
515
+
516
+ <!-- 服务列表 -->
517
+ <div class="sc-list" id="serviceList">
518
+ <!-- Vite Dev Server -->
519
+ <div class="sc-svc" data-name="vite" data-port="5173">
520
+ <div class="sc-svc-main">
521
+ <span class="sc-svc-dot">●</span>
522
+ <span class="sc-svc-name">node</span>
523
+ <span class="sc-svc-meta">:5173 · pid 12345</span>
524
+ <span class="sc-svc-badge chat" data-lang="zh">本次对话</span>
525
+ <span class="sc-svc-badge chat" data-lang="en">This chat</span>
526
+ <span class="sc-svc-badge" style="color:#22c55e;">↻</span>
527
+ <div class="sc-svc-actions">
528
+ <button class="sc-svc-btn stop" data-lang="zh">停止</button>
529
+ <button class="sc-svc-btn stop" data-lang="en">Stop</button>
530
+ <button class="sc-svc-btn restart" data-lang="zh">重启</button>
531
+ <button class="sc-svc-btn restart" data-lang="en">Restart</button>
532
+ <button class="sc-svc-btn" data-lang="zh">详情</button>
533
+ <button class="sc-svc-btn" data-lang="en">Detail</button>
534
+ </div>
535
+ </div>
536
+ <div class="sc-svc-sub">node_modules/.bin/vite --port 5173</div>
537
+ <div class="sc-svc-sub">/Users/dev/my-project</div>
538
+ </div>
539
+
540
+ <!-- Next.js Dev Server -->
541
+ <div class="sc-svc" data-name="next" data-port="3000">
542
+ <div class="sc-svc-main">
543
+ <span class="sc-svc-dot">●</span>
544
+ <span class="sc-svc-name">next-server</span>
545
+ <span class="sc-svc-meta">:3000 · pid 12890</span>
546
+ <span class="sc-svc-badge workspace" data-lang="zh">工作区推断</span>
547
+ <span class="sc-svc-badge workspace" data-lang="en">Workspace</span>
548
+ <span class="sc-svc-badge" style="color:#22c55e;">↻</span>
549
+ <div class="sc-svc-actions">
550
+ <button class="sc-svc-btn stop" data-lang="zh">停止</button>
551
+ <button class="sc-svc-btn stop" data-lang="en">Stop</button>
552
+ <button class="sc-svc-btn restart" data-lang="zh">重启</button>
553
+ <button class="sc-svc-btn restart" data-lang="en">Restart</button>
554
+ <button class="sc-svc-btn" data-lang="zh">详情</button>
555
+ <button class="sc-svc-btn" data-lang="en">Detail</button>
556
+ </div>
557
+ </div>
558
+ <div class="sc-svc-sub">next dev --port 3000</div>
559
+ <div class="sc-svc-sub">/Users/dev/web-app</div>
560
+ </div>
561
+
562
+ <!-- PostgreSQL -->
563
+ <div class="sc-svc" data-name="postgres" data-port="5432">
564
+ <div class="sc-svc-main">
565
+ <span class="sc-svc-dot warn">●</span>
566
+ <span class="sc-svc-name">postgres</span>
567
+ <span class="sc-svc-meta">:5432 · pid 9876</span>
568
+ <span class="sc-svc-badge other" data-lang="zh">本机其他</span>
569
+ <span class="sc-svc-badge other" data-lang="en">Other local</span>
570
+ <div class="sc-svc-actions">
571
+ <button class="sc-svc-btn" data-lang="zh">详情</button>
572
+ <button class="sc-svc-btn" data-lang="en">Detail</button>
573
+ </div>
574
+ </div>
575
+ <div class="sc-svc-sub">postgres -D /usr/local/var/postgres</div>
576
+ </div>
577
+ </div>
578
+ </div>
579
+
580
+ <!-- 设置 Tab -->
581
+ <div id="tabSettings" style="display:none;">
582
+ <div class="sc-settings">
583
+ <div class="sc-settings-section" data-lang="zh">通用</div>
584
+ <div class="sc-settings-section" data-lang="en">General</div>
585
+
586
+ <div class="sc-settings-row">
587
+ <div>
588
+ <div class="sc-settings-label" data-lang="zh">优雅超时 (ms)</div>
589
+ <div class="sc-settings-label" data-lang="en">Graceful timeout (ms)</div>
590
+ </div>
591
+ <input class="sc-settings-input" type="number" value="3000" />
592
+ </div>
593
+
594
+ <div class="sc-settings-row">
595
+ <div>
596
+ <div class="sc-settings-label" data-lang="zh">允许强制终止</div>
597
+ <div class="sc-settings-label" data-lang="en">Allow force kill</div>
598
+ <div class="sc-settings-desc" data-lang="zh">优雅超时后发送 SIGKILL</div>
599
+ <div class="sc-settings-desc" data-lang="en">Send SIGKILL after graceful timeout</div>
600
+ </div>
601
+ <button class="sc-settings-switch" onclick="this.classList.toggle('on')"></button>
602
+ </div>
603
+
604
+ <div class="sc-settings-row" style="border:none;">
605
+ <div class="sc-settings-desc" data-lang="zh">配置在本次会话内生效,重启插件后恢复默认。</div>
606
+ <div class="sc-settings-desc" data-lang="en">Settings apply for this run; they reset when the plugin restarts.</div>
607
+ </div>
608
+ </div>
609
+ </div>
610
+ </div>
611
+ </div>
612
+
613
+ <script>
614
+ // 语言切换
615
+ let currentLang = 'zh';
616
+ function toggleLang() {
617
+ currentLang = currentLang === 'zh' ? 'en' : 'zh';
618
+ document.body.classList.toggle('lang-en', currentLang === 'en');
619
+ // 更新搜索框 placeholder
620
+ const input = document.getElementById('searchInput');
621
+ input.placeholder = currentLang === 'zh' ? '搜索服务、端口或路径…' : 'Search services, ports, or paths…';
622
+ }
623
+
624
+ // 面板开关
625
+ let panelOpen = false;
626
+ function togglePanel() {
627
+ panelOpen = !panelOpen;
628
+ document.getElementById('scPanel').classList.toggle('open', panelOpen);
629
+ document.getElementById('scEntry').classList.toggle('active', panelOpen);
630
+ }
631
+
632
+ // Tab 切换
633
+ function switchTab(tab) {
634
+ document.querySelectorAll('.sc-tab').forEach(t => t.classList.remove('active'));
635
+ event.currentTarget.classList.add('active');
636
+ document.getElementById('tabServices').style.display = tab === 'services' ? '' : 'none';
637
+ document.getElementById('tabSettings').style.display = tab === 'settings' ? '' : 'none';
638
+ }
639
+
640
+ // 搜索过滤
641
+ function filterServices() {
642
+ const q = document.getElementById('searchInput').value.toLowerCase();
643
+ document.querySelectorAll('.sc-svc').forEach(svc => {
644
+ const name = svc.dataset.name || '';
645
+ const port = svc.dataset.port || '';
646
+ const show = name.includes(q) || port.includes(q);
647
+ svc.style.display = show ? '' : 'none';
648
+ });
649
+ }
650
+
651
+ // 初始化:默认打开面板
652
+ window.addEventListener('DOMContentLoaded', () => {
653
+ setTimeout(() => togglePanel(), 500);
654
+ });
655
+ </script>
656
+ </body>
657
+ </html>
package/dsh.plugin.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "id": "dsh-external/dsh-service-console",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "main": "./lib/index.js",
5
5
  "description": "本地开发服务控制台:发现监听端口,识别服务归属,安全查看/停止/重启。Local development service console for DSH.",
6
6
  "engines": {
package/dynamic/host.js CHANGED
@@ -265,7 +265,6 @@ return {
265
265
  const svc = s.services.find((x) => x.id === serviceId)
266
266
  if (!svc) return err('TARGET_GONE', '该服务已结束,列表已刷新')
267
267
  if (svc.protected) return err('PROTECTED_PROCESS', '该进程受保护,不能通过 Service Console 操作')
268
- if (svc.ownership === 'unknown') return err('UNKNOWN_OWNERSHIP', '无法确认服务来源,默认不允许控制')
269
268
  const target = svc.processGroupId ? '-' + svc.processGroupId : String(svc.pid)
270
269
  await runCommand('kill -TERM ' + target, 3000)
271
270
  const deadline = Date.now() + (config.gracefulTimeout || 3000)
package/lib/client.js CHANGED
@@ -39,66 +39,66 @@ window.__ModuleLoader__.load({
39
39
  document.head.appendChild(tag);
40
40
  }
41
41
  var service_console_module_css_default = {
42
- "popupOn": "PuSt5a_popupOn",
43
- "setInfo": "PuSt5a_setInfo",
44
- "headTitle": "PuSt5a_headTitle",
45
- "head": "PuSt5a_head",
46
- "badge": "PuSt5a_badge",
47
- "evidenceItem": "PuSt5a_evidenceItem",
42
+ "note": "PuSt5a_note",
43
+ "empty": "PuSt5a_empty",
44
+ "tabs": "PuSt5a_tabs",
45
+ "layer": "PuSt5a_layer",
46
+ "rowDot": "PuSt5a_rowDot",
48
47
  "detailGrid": "PuSt5a_detailGrid",
49
- "setRow": "PuSt5a_setRow",
50
- "switch": "PuSt5a_switch",
51
- "evidenceBlock": "PuSt5a_evidenceBlock",
52
- "rowMain": "PuSt5a_rowMain",
53
- "confirmCancel": "PuSt5a_confirmCancel",
54
- "filterClear": "PuSt5a_filterClear",
55
- "filterRow": "PuSt5a_filterRow",
56
- "rowMeta": "PuSt5a_rowMeta",
57
- "detailLabel": "PuSt5a_detailLabel",
48
+ "setCap": "PuSt5a_setCap",
49
+ "filter": "PuSt5a_filter",
58
50
  "row": "PuSt5a_row",
59
- "note": "PuSt5a_note",
60
- "rowName": "PuSt5a_rowName",
51
+ "detailLabel": "PuSt5a_detailLabel",
52
+ "rowMeta": "PuSt5a_rowMeta",
53
+ "okText": "PuSt5a_okText",
54
+ "sc-spin": "PuSt5a_sc-spin",
55
+ "evidenceItem": "PuSt5a_evidenceItem",
56
+ "noteWarn": "PuSt5a_noteWarn",
57
+ "icoBtn": "PuSt5a_icoBtn",
61
58
  "headIco": "PuSt5a_headIco",
62
- "rowBtn": "PuSt5a_rowBtn",
63
- "errText": "PuSt5a_errText",
59
+ "confirmOk": "PuSt5a_confirmOk",
60
+ "headerBtnOn": "PuSt5a_headerBtnOn",
61
+ "switch": "PuSt5a_switch",
62
+ "detailBox": "PuSt5a_detailBox",
63
+ "head": "PuSt5a_head",
64
+ "headTitle": "PuSt5a_headTitle",
64
65
  "hintLine": "PuSt5a_hintLine",
66
+ "rowSub": "PuSt5a_rowSub",
65
67
  "detailHead": "PuSt5a_detailHead",
66
- "headerBtn": "PuSt5a_headerBtn",
67
- "evidenceArrow": "PuSt5a_evidenceArrow",
68
- "layer": "PuSt5a_layer",
68
+ "spacer": "PuSt5a_spacer",
69
69
  "rowAct": "PuSt5a_rowAct",
70
- "tabInd": "PuSt5a_tabInd",
71
- "setNote": "PuSt5a_setNote",
72
- "setPage": "PuSt5a_setPage",
73
- "noteWarn": "PuSt5a_noteWarn",
74
- "confirmOk": "PuSt5a_confirmOk",
75
- "confirmTxt": "PuSt5a_confirmTxt",
76
- "okText": "PuSt5a_okText",
77
- "tabs": "PuSt5a_tabs",
78
- "empty": "PuSt5a_empty",
79
- "rowDot": "PuSt5a_rowDot",
70
+ "evidenceBlock": "PuSt5a_evidenceBlock",
71
+ "setRow": "PuSt5a_setRow",
80
72
  "noteErr": "PuSt5a_noteErr",
81
- "sc-spin": "PuSt5a_sc-spin",
82
- "setLabel": "PuSt5a_setLabel",
83
- "spin": "PuSt5a_spin",
73
+ "popup": "PuSt5a_popup",
74
+ "setPage": "PuSt5a_setPage",
84
75
  "detailAccent": "PuSt5a_detailAccent",
85
- "tabOn": "PuSt5a_tabOn",
86
- "spacer": "PuSt5a_spacer",
76
+ "tabInd": "PuSt5a_tabInd",
87
77
  "setInput": "PuSt5a_setInput",
88
- "liveDot": "PuSt5a_liveDot",
89
- "setCap": "PuSt5a_setCap",
90
- "rowSub": "PuSt5a_rowSub",
91
- "confirmRow": "PuSt5a_confirmRow",
92
- "headerBtnOn": "PuSt5a_headerBtnOn",
93
- "filter": "PuSt5a_filter",
94
- "popup": "PuSt5a_popup",
95
- "setFooter": "PuSt5a_setFooter",
96
- "tabBody": "PuSt5a_tabBody",
78
+ "rowMain": "PuSt5a_rowMain",
79
+ "badge": "PuSt5a_badge",
80
+ "filterRow": "PuSt5a_filterRow",
97
81
  "tab": "PuSt5a_tab",
98
- "icoBtn": "PuSt5a_icoBtn",
82
+ "spin": "PuSt5a_spin",
83
+ "headerBtn": "PuSt5a_headerBtn",
84
+ "evidenceArrow": "PuSt5a_evidenceArrow",
85
+ "errText": "PuSt5a_errText",
99
86
  "prevBtn": "PuSt5a_prevBtn",
100
- "detailBox": "PuSt5a_detailBox",
101
- "setSection": "PuSt5a_setSection"
87
+ "setLabel": "PuSt5a_setLabel",
88
+ "tabBody": "PuSt5a_tabBody",
89
+ "rowName": "PuSt5a_rowName",
90
+ "liveDot": "PuSt5a_liveDot",
91
+ "rowBtn": "PuSt5a_rowBtn",
92
+ "confirmTxt": "PuSt5a_confirmTxt",
93
+ "setFooter": "PuSt5a_setFooter",
94
+ "filterClear": "PuSt5a_filterClear",
95
+ "setNote": "PuSt5a_setNote",
96
+ "popupOn": "PuSt5a_popupOn",
97
+ "confirmRow": "PuSt5a_confirmRow",
98
+ "confirmCancel": "PuSt5a_confirmCancel",
99
+ "tabOn": "PuSt5a_tabOn",
100
+ "setSection": "PuSt5a_setSection",
101
+ "setInfo": "PuSt5a_setInfo"
102
102
  };
103
103
  //#endregion
104
104
  //#region src/client/ServiceConsole.tsx
@@ -497,7 +497,7 @@ window.__ModuleLoader__.load({
497
497
  const badgeKey = OWNERSHIP_KEY[svc.ownership] ?? "own.unknown";
498
498
  const ports = svc.listeners.map((l) => String(l.port)).join(", ");
499
499
  const url = svc.listeners.map((l) => l.url).filter(Boolean)[0] ?? null;
500
- const canControl = svc.ownership === "conversation-confirmed" || svc.ownership === "workspace-inferred" || svc.ownership === "other-local";
500
+ const canControl = !svc.protected;
501
501
  const isConfirming = confirming?.id === svc.id;
502
502
  const result = opResult?.id === svc.id ? opResult : null;
503
503
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
@@ -20,7 +20,6 @@ async function stopService(deps, serviceId, mode) {
20
20
  const svc = (await deps.buildSnapshot()).services.find((x) => x.id === serviceId);
21
21
  if (!svc) return err("TARGET_GONE", "该服务已结束,列表已刷新");
22
22
  if (svc.protected) return err("PROTECTED_PROCESS", "该进程受保护,不能通过 Service Console 操作");
23
- if (svc.ownership === "unknown") return err("UNKNOWN_OWNERSHIP", "无法确认服务来源,默认不允许控制");
24
23
  const target = svc.processGroupId ? "-" + svc.processGroupId : String(svc.pid);
25
24
  await (deps.commandRunner || runCommand)("kill -TERM " + target, 3e3);
26
25
  const deadline = Date.now() + (deps.config.gracefulTimeout || 3e3);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jiyr0119/dsh-service-console",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "DeepSeek Harness 本地开发服务控制台(原生插件):发现监听端口,识别服务归属,安全查看/停止/重启。Local development service console for DSH.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -39,6 +39,7 @@
39
39
  "dynamic",
40
40
  "docs",
41
41
  "assets",
42
+ "demo",
42
43
  "README.md",
43
44
  "README.zh.md",
44
45
  "LICENSE",