@jiyr0119/dsh-service-console 0.7.2 → 0.8.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/README.md +6 -4
- package/README.zh.md +6 -4
- package/docs/local-debugging.md +1 -1
- package/docs/rc5-upgrade-review.zh.md +182 -0
- package/docs/release-checklist.md +15 -12
- package/icon.svg +8 -0
- package/lib/client/dictionaries.js +3 -2
- package/lib/client/i18n.js +37 -71
- package/lib/client.js +188 -162
- package/lib/host/config.js +1 -2
- package/lib/host/ledger.js +2 -3
- package/lib/host/lifecycle.js +2 -3
- package/lib/host/ownership.js +8 -4
- package/lib/host/process-inspector.js +1 -2
- package/lib/host/protection.js +1 -2
- package/lib/host/redaction.js +1 -2
- package/lib/host/service-registry.js +4 -5
- package/lib/host/service-tool.js +28 -4
- package/lib/index.js +54 -11
- package/lib/types/client/ServiceConsole.d.ts +24 -12
- package/lib/types/client/dictionaries.d.ts +2 -0
- package/lib/types/client/i18n.d.ts +35 -40
- package/lib/types/host/ledger.d.ts +7 -0
- package/lib/types/host/ownership.d.ts +9 -1
- package/lib/types/host/service-registry.d.ts +2 -1
- package/lib/types/host/service-tool.d.ts +7 -2
- package/lib/types/index.d.ts +18 -2
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +24 -30
- package/dsh.plugin.json +0 -16
- package/dynamic/client.js +0 -193
- package/dynamic/host.js +0 -337
- package/manifest.json +0 -24
package/lib/client.js
CHANGED
|
@@ -3,7 +3,7 @@ window.__ModuleLoader__.load({
|
|
|
3
3
|
factory: (require) => {
|
|
4
4
|
var module = { exports: {} };
|
|
5
5
|
module.exports;
|
|
6
|
-
|
|
6
|
+
// \0rolldown/runtime.js
|
|
7
7
|
var __create = Object.create;
|
|
8
8
|
var __defProp = Object.defineProperty;
|
|
9
9
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -24,12 +24,11 @@ window.__ModuleLoader__.load({
|
|
|
24
24
|
value: mod,
|
|
25
25
|
enumerable: true
|
|
26
26
|
}) : target, mod));
|
|
27
|
-
//#endregion
|
|
28
27
|
let react = require("react");
|
|
29
28
|
react = __toESM(react, 1);
|
|
30
29
|
let _deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
31
30
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
32
|
-
|
|
31
|
+
// \0dsh-css:/home/runner/work/dsh-service-console/dsh-service-console/src/client/service-console.module.css.mjs
|
|
33
32
|
const css = ".PuSt5a_layer{z-index:100;pointer-events:none;position:fixed;inset:0}.PuSt5a_popup{background:var(--dsw-alias-bg-layer-2,#262626);border:1px solid var(--dsw-alias-border-inverted,#80808047);width:420px;box-shadow:var(--dsw-shadow-lv3,0 12px 32px #00000059);color:var(--dsw-alias-label-primary,#e8e8e8);--dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2,#80808066);--dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2,#80808099);pointer-events:auto;opacity:0;transform-origin:100% 0;border-radius:16px;flex-direction:column;font:13px/1.45 -apple-system,BlinkMacSystemFont,Segoe UI,PingFang SC,Microsoft YaHei,sans-serif;transition:opacity .18s,transform .18s;display:flex;position:fixed;right:16px;overflow:hidden;transform:translateY(-8px)scale(.98)}.PuSt5a_popupOn{opacity:1;transform:translateY(0)scale(1)}@media (prefers-reduced-motion:reduce){.PuSt5a_popup{transition:none}}.PuSt5a_head{border-bottom:1px solid var(--dsw-alias-border-l3,#80808033);flex:none;align-items:center;gap:8px;padding:14px 16px 12px 18px;display:flex}.PuSt5a_headIco{color:var(--dsw-alias-state-business-primary,#4176e6);flex:none;display:inline-flex}.PuSt5a_headTitle{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;font-size:15px;font-weight:600;overflow:hidden}.PuSt5a_icoBtn{color:var(--dsw-alias-label-secondary,#9a9a9a);cursor:pointer;background:0 0;border:0;border-radius:8px;flex:none;justify-content:center;align-items:center;width:28px;height:28px;display:inline-flex}.PuSt5a_icoBtn:hover{background:var(--dsw-alias-interactive-bg-hover,#80808024);color:var(--dsw-alias-label-primary,#e8e8e8)}.PuSt5a_tabs{border-bottom:1px solid var(--dsw-alias-border-l3,#80808033);flex:none;gap:2px;padding:0 14px;display:flex}.PuSt5a_tab{height:36px;color:var(--dsw-alias-label-secondary,#9a9a9a);font:inherit;cursor:pointer;background:0 0;border:0;border-radius:10px 10px 0 0;flex:1;justify-content:center;align-items:center;gap:6px;font-size:12.5px;font-weight:500;display:inline-flex;position:relative}.PuSt5a_tab:hover{color:var(--dsw-alias-label-primary,#e8e8e8);background:var(--dsw-alias-interactive-bg-hover,#80808014)}.PuSt5a_tabOn{color:var(--dsw-alias-label-primary,#e8e8e8)}.PuSt5a_tabInd{background:var(--dsw-alias-state-business-primary,#4176e6);opacity:0;border-radius:999px;height:2px;transition:opacity .16s,transform .16s;position:absolute;bottom:-1px;left:24%;right:24%;transform:scaleX(.4)}.PuSt5a_tabOn .PuSt5a_tabInd{opacity:1;transform:scaleX(1)}.PuSt5a_tab:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary,#4176e6);outline-offset:-2px}@media (prefers-reduced-motion:reduce){.PuSt5a_tabInd{transition:none}}.PuSt5a_tabBody{flex-direction:column;flex:1;min-height:0;display:flex;overflow:hidden auto}.PuSt5a_tabBody::-webkit-scrollbar{width:6px}.PuSt5a_tabBody::-webkit-scrollbar-thumb{background:var(--dsh-scrollbar-thumb);border-radius:3px}.PuSt5a_tabBody::-webkit-scrollbar-thumb:hover{background:var(--dsh-scrollbar-thumb-hover)}.PuSt5a_tabBody::-webkit-scrollbar-track{background:0 0}.PuSt5a_filterRow{align-items:center;gap:6px;padding:12px 16px 6px;display:flex}.PuSt5a_filter{min-width:0;height:30px;color:var(--dsw-alias-label-primary,#e8e8e8);border:1px solid var(--dsw-alias-border-l2,#80808059);font:inherit;background:0 0;border-radius:8px;outline:none;flex:1;padding:0 8px;font-size:12.5px}.PuSt5a_filter:focus-visible{border-color:var(--dsw-alias-state-business-primary,#4176e6)}.PuSt5a_filter::placeholder{color:var(--dsw-alias-label-caption,#8a8a8a)}.PuSt5a_filterClear{color:var(--dsw-alias-label-secondary,#9a9a9a);cursor:pointer;background:0 0;border:0;border-radius:6px;flex:none;justify-content:center;align-items:center;width:26px;height:26px;display:inline-flex}.PuSt5a_filterClear:hover{color:var(--dsw-alias-label-primary,#e8e8e8);background:var(--dsw-alias-interactive-bg-hover,#8080801f)}.PuSt5a_segGroup{border:1px solid var(--dsw-alias-border-l2,#80808059);border-radius:8px;flex:none;gap:2px;padding:2px;display:inline-flex}.PuSt5a_segBtn{color:var(--dsw-alias-label-secondary,#9a9a9a);font:inherit;cursor:pointer;background:0 0;border:0;border-radius:6px;padding:6px 7px;font-size:11.5px;line-height:1;transition:color .1s,background .1s}.PuSt5a_segBtn:hover{color:var(--dsw-alias-label-primary,#e8e8e8);background:var(--dsw-alias-interactive-bg-hover,#8080801f)}.PuSt5a_segBtnOn,.PuSt5a_segBtnOn:hover{background:var(--dsw-alias-state-business-primary,#4176e6);color:#fff}@media (prefers-reduced-motion:reduce){.PuSt5a_segBtn{transition:none}}.PuSt5a_hintLine{color:var(--dsw-alias-label-caption,#8a8a8a);align-items:center;gap:6px;padding:4px 18px 8px;font-size:11px;display:flex}.PuSt5a_hintWarn{color:var(--dsw-alias-state-warn-primary,#e7b85d)}.PuSt5a_liveDot{background:var(--dsw-alias-state-success-primary,#55d187);width:7px;height:7px;box-shadow:0 0 0 3px color-mix(in srgb, var(--dsw-alias-state-success-primary,#55d187) 18%, transparent);border-radius:50%;flex:none}.PuSt5a_row{border:1px solid var(--dsw-alias-border-l3,#80808026);background:var(--dsw-alias-bg-layer-1,#ffffff08);border-radius:12px;margin:0 12px 8px;padding:12px 16px;transition:background .12s,border-color .12s}.PuSt5a_row:hover{background:var(--dsw-alias-interactive-bg-hover,#80808014);border-color:var(--dsw-alias-border-l2,#80808040)}.PuSt5a_rowMain{flex-wrap:wrap;align-items:center;gap:8px;min-width:0;display:flex}.PuSt5a_rowDot{flex-shrink:0;font-size:8px;line-height:1}.PuSt5a_rowName{letter-spacing:-.01em;word-break:break-word;font-size:13px;font-weight:600}.PuSt5a_rowMeta{color:var(--dsw-alias-label-secondary,#9a9a9a);font-variant-numeric:tabular-nums;word-break:break-all;font-size:11.5px}.PuSt5a_rowSub{color:var(--dsw-alias-label-secondary,#9a9a9a);word-break:break-all;margin-top:4px;font-size:11.5px;line-height:1.4}.PuSt5a_spacer{flex:1}.PuSt5a_badge{white-space:nowrap;border:1px solid;border-radius:999px;padding:1px 6px;font-size:10px;font-weight:500}.PuSt5a_rowBtn{border:1px solid var(--dsw-alias-border-l2,#8080804d);height:24px;color:var(--dsw-alias-label-secondary,#9a9a9a);font:inherit;cursor:pointer;background:0 0;border-radius:6px;flex:none;justify-content:center;align-items:center;padding:0 7px;font-size:11px;transition:color .1s,background .1s;display:inline-flex}.PuSt5a_rowBtn:hover{color:var(--dsw-alias-label-primary,#e8e8e8);background:var(--dsw-alias-interactive-bg-hover,#8080801f)}.PuSt5a_rowAct{color:var(--dsw-alias-label-secondary,#9a9a9a);border-radius:5px;flex:none;justify-content:center;align-items:center;width:22px;height:22px;text-decoration:none;transition:color .1s,background .1s;display:inline-flex}.PuSt5a_rowAct:hover{color:var(--dsw-alias-state-business-primary,#4176e6);background:var(--dsw-alias-interactive-bg-hover,#8080801f)}.PuSt5a_confirmRow{background:color-mix(in srgb, var(--dsw-alias-state-warn-primary,#e7b85d) 8%, transparent);border:1px solid color-mix(in srgb, var(--dsw-alias-state-warn-primary,#e7b85d) 15%, transparent);border-radius:10px;flex-wrap:wrap;align-items:center;gap:6px;margin-top:10px;padding:10px 12px;display:flex}.PuSt5a_confirmTxt{min-width:0;color:var(--dsw-alias-label-secondary,#b0b3ba);flex:1;font-size:12px}.PuSt5a_confirmOk{background:var(--dsw-alias-state-error-primary,#e5484d);color:#fff;height:26px;font:inherit;cursor:pointer;border:none;border-radius:7px;flex:none;padding:0 10px;font-size:11px;font-weight:500;transition:opacity .1s}.PuSt5a_confirmOk:hover{opacity:.85}.PuSt5a_confirmOk:disabled{opacity:.55;cursor:default}.PuSt5a_confirmCancel{border:1px solid var(--dsw-alias-border-l2,#80808059);height:26px;color:var(--dsw-alias-label-secondary,#9a9a9a);font:inherit;cursor:pointer;background:0 0;border-radius:7px;flex:none;padding:0 10px;font-size:11px;transition:color .1s,background .1s}.PuSt5a_confirmCancel:hover{color:var(--dsw-alias-label-primary,#e8e8e8);background:var(--dsw-alias-interactive-bg-hover,#8080801f)}.PuSt5a_detailBox{border:1px solid var(--dsw-alias-border-l2,#8080804d);background:var(--dsw-alias-bg-layer-1,#00000026);box-shadow:inset 3px 0 0 var(--dsw-alias-state-business-primary,#4176e6);border-radius:10px;margin-top:10px;padding:14px}.PuSt5a_detailHead{justify-content:space-between;align-items:center;margin-bottom:12px;font-size:12px;font-weight:600;display:flex}.PuSt5a_detailAccent{color:var(--dsw-alias-state-business-primary,#4176e6);letter-spacing:.12em;text-transform:uppercase;font-size:9px;font-weight:650}.PuSt5a_detailGrid{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;display:grid}.PuSt5a_detailGrid>div{flex-direction:column;gap:3px;min-width:0;display:flex}.PuSt5a_detailLabel{color:var(--dsw-alias-label-caption,#7a7d85);letter-spacing:.06em;text-transform:uppercase;font-size:10px;font-weight:600}.PuSt5a_detailGrid code{overflow-wrap:anywhere;word-break:break-all;color:var(--dsw-alias-label-primary,#d8d9dc);font:11px/1.4 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}.PuSt5a_evidenceBlock{border-top:1px solid var(--dsw-alias-border-l3,#80808026);margin-top:14px;padding-top:12px;overflow:hidden}.PuSt5a_evidenceItem{color:var(--dsw-alias-label-secondary,#8a8d95);gap:6px;margin-top:5px;font-size:11px;line-height:1.4;display:flex}.PuSt5a_evidenceArrow{color:var(--dsw-alias-state-business-primary,#4176e6);flex:none;font-size:10px}.PuSt5a_note{color:var(--dsw-alias-label-caption,#8a8a8a);align-items:center;gap:8px;padding:6px 16px;font-size:12px;display:flex}.PuSt5a_noteErr{color:var(--dsw-alias-state-error-primary,#e5484d);padding:6px 16px;font-size:12px}.PuSt5a_noteWarn{color:var(--dsw-alias-state-warn-primary,#e7b85d);padding:6px 16px;font-size:12px}.PuSt5a_okText{color:var(--dsw-alias-state-success-primary,#55d187);margin-top:4px;font-size:12px}.PuSt5a_errText{color:var(--dsw-alias-state-error-primary,#e5484d);margin-top:4px;font-size:12px}.PuSt5a_empty{color:var(--dsw-alias-label-secondary,#9a9a9a);padding:24px 18px;font-size:12.5px}.PuSt5a_spin{border:2px solid var(--dsw-alias-border-l2,#80808066);border-top-color:var(--dsw-alias-state-business-primary,#4176e6);border-radius:50%;flex:none;width:13px;height:13px;animation:.7s linear infinite PuSt5a_sc-spin}@keyframes PuSt5a_sc-spin{to{transform:rotate(360deg)}}@media (prefers-reduced-motion:reduce){.PuSt5a_spin{animation-duration:1.6s}}.PuSt5a_headerBtn{border:1px solid var(--dsw-alias-border-l2,#80808059);height:32px;color:var(--dsw-alias-label-primary,#e8e8e8);cursor:pointer;background:0 0;border-radius:18px;flex:none;justify-content:center;align-items:center;gap:4px;padding:6px 12px;font-size:13px;font-weight:400;line-height:20px;display:inline-flex}.PuSt5a_headerBtn span,.PuSt5a_headerBtn svg{flex:none}.PuSt5a_headerBtn span{white-space:nowrap}.PuSt5a_headerBtn:hover{background:var(--dsw-alias-interactive-bg-hover,#8080801f)}.PuSt5a_headerBtnOn{color:var(--dsw-alias-state-business-primary,#4176e6);border-color:#4176e680}.PuSt5a_setPage{padding:8px 16px 28px}.PuSt5a_setSection{letter-spacing:.05em;text-transform:uppercase;color:var(--dsw-alias-label-caption,#8a8a8a);padding:10px 4px 6px;font-size:11px;font-weight:600}.PuSt5a_setRow{border-radius:12px;align-items:center;gap:12px;padding:9px 10px;display:flex}.PuSt5a_setRow:hover{background:var(--dsw-alias-interactive-bg-hover,#8080800f)}.PuSt5a_setInfo{flex-direction:column;flex:1;gap:2px;min-width:0;display:flex}.PuSt5a_setLabel{color:var(--dsw-alias-label-primary,#e8e8e8);font-size:12.5px}.PuSt5a_setCap{color:var(--dsw-alias-label-caption,#8a8a8a);font-size:11px}.PuSt5a_setInput{width:80px;min-width:80px;height:28px;color:var(--dsw-alias-label-primary,#e8e8e8);border:1px solid var(--dsw-alias-border-l2,#80808059);font:inherit;background:0 0;border-radius:8px;outline:none;flex:none;padding:0 8px;font-size:12px}.PuSt5a_setInput:focus-visible{border-color:var(--dsw-alias-state-business-primary,#4176e6)}.PuSt5a_setSelect{width:96px}.PuSt5a_switch{border:1px solid var(--dsw-alias-border-l2,#80808066);background:var(--dsw-alias-interactive-bg-hover,#8080802e);cursor:pointer;border-radius:999px;flex:none;width:34px;height:20px;padding:0;transition:background .15s,border-color .15s;position:relative}.PuSt5a_switch:after{content:\"\";background:var(--dsw-alias-label-secondary,#9a9a9a);border-radius:50%;width:14px;height:14px;transition:transform .15s;position:absolute;top:2px;left:2px}.PuSt5a_switch[aria-checked=true]{background:var(--dsw-alias-state-business-primary,#4176e6);border-color:#0000}.PuSt5a_switch[aria-checked=true]:after{background:#fff;transform:translate(14px)}@media (prefers-reduced-motion:reduce){.PuSt5a_switch,.PuSt5a_switch:after{transition:none}}.PuSt5a_prevBtn{border:1px solid var(--dsw-alias-border-l2,#80808059);height:28px;color:var(--dsw-alias-label-secondary,#9a9a9a);font:inherit;cursor:pointer;background:0 0;border-radius:8px;flex:none;justify-content:center;align-items:center;padding:0 10px;font-size:12px;display:inline-flex}.PuSt5a_prevBtn:hover{color:var(--dsw-alias-label-primary,#e8e8e8);background:var(--dsw-alias-interactive-bg-hover,#8080801f)}.PuSt5a_setFooter{justify-content:flex-end;padding:8px 4px 2px;display:flex}.PuSt5a_setNote{color:var(--dsw-alias-label-dimmed,#777);padding:2px 10px 8px;font-size:11px}.PuSt5a_starSection{border:1px solid var(--dsw-alias-border-l3,#80808026);background:var(--dsw-alias-bg-layer-1,#ffffff08);border-radius:12px;margin-top:12px;padding:12px 10px}.PuSt5a_starRow{align-items:center;gap:12px;display:flex}.PuSt5a_starInfo{flex-direction:column;flex:1;gap:2px;min-width:0;display:flex}.PuSt5a_starLabel{color:var(--dsw-alias-label-primary,#e8e8e8);font-size:12.5px}.PuSt5a_starLink{color:var(--dsw-alias-state-business-primary,#4176e6);text-underline-offset:2px;white-space:nowrap;flex:none;font-size:12px;line-height:1.6;text-decoration:underline}.PuSt5a_starLink:hover{opacity:.85}.PuSt5a_rowBtn:focus-visible,.PuSt5a_headerBtn:focus-visible,.PuSt5a_icoBtn:focus-visible,.PuSt5a_prevBtn:focus-visible,.PuSt5a_filter:focus-visible,.PuSt5a_tab:focus-visible,.PuSt5a_segBtn:focus-visible,.PuSt5a_confirmOk:focus-visible,.PuSt5a_confirmCancel:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary,#4176e6);outline-offset:-2px}@media (width<=480px){.PuSt5a_popup{width:calc(100vw - 16px);right:8px}.PuSt5a_detailGrid{grid-template-columns:1fr}}";
|
|
34
33
|
const tagId = "@jiyr0119/dsh-service-console/service-console.module.css";
|
|
35
34
|
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
|
|
@@ -40,102 +39,97 @@ window.__ModuleLoader__.load({
|
|
|
40
39
|
document.head.appendChild(tag);
|
|
41
40
|
}
|
|
42
41
|
var service_console_module_css_default = {
|
|
43
|
-
"icoBtn": "PuSt5a_icoBtn",
|
|
44
|
-
"filter": "PuSt5a_filter",
|
|
45
|
-
"starLink": "PuSt5a_starLink",
|
|
46
|
-
"confirmRow": "PuSt5a_confirmRow",
|
|
47
42
|
"evidenceItem": "PuSt5a_evidenceItem",
|
|
43
|
+
"headerBtnOn": "PuSt5a_headerBtnOn",
|
|
44
|
+
"segBtn": "PuSt5a_segBtn",
|
|
45
|
+
"setSelect": "PuSt5a_setSelect",
|
|
46
|
+
"starLabel": "PuSt5a_starLabel",
|
|
47
|
+
"spin": "PuSt5a_spin",
|
|
48
48
|
"okText": "PuSt5a_okText",
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"tabBody": "PuSt5a_tabBody",
|
|
49
|
+
"setLabel": "PuSt5a_setLabel",
|
|
50
|
+
"rowDot": "PuSt5a_rowDot",
|
|
52
51
|
"evidenceArrow": "PuSt5a_evidenceArrow",
|
|
52
|
+
"confirmCancel": "PuSt5a_confirmCancel",
|
|
53
|
+
"setRow": "PuSt5a_setRow",
|
|
54
|
+
"filter": "PuSt5a_filter",
|
|
55
|
+
"row": "PuSt5a_row",
|
|
56
|
+
"setFooter": "PuSt5a_setFooter",
|
|
57
|
+
"segBtnOn": "PuSt5a_segBtnOn",
|
|
58
|
+
"noteWarn": "PuSt5a_noteWarn",
|
|
59
|
+
"rowMeta": "PuSt5a_rowMeta",
|
|
60
|
+
"headIco": "PuSt5a_headIco",
|
|
61
|
+
"filterRow": "PuSt5a_filterRow",
|
|
53
62
|
"confirmTxt": "PuSt5a_confirmTxt",
|
|
63
|
+
"badge": "PuSt5a_badge",
|
|
64
|
+
"setInfo": "PuSt5a_setInfo",
|
|
65
|
+
"popup": "PuSt5a_popup",
|
|
66
|
+
"setInput": "PuSt5a_setInput",
|
|
54
67
|
"popupOn": "PuSt5a_popupOn",
|
|
55
|
-
"filterRow": "PuSt5a_filterRow",
|
|
56
|
-
"head": "PuSt5a_head",
|
|
57
|
-
"rowBtn": "PuSt5a_rowBtn",
|
|
58
|
-
"rowMeta": "PuSt5a_rowMeta",
|
|
59
|
-
"row": "PuSt5a_row",
|
|
60
|
-
"tab": "PuSt5a_tab",
|
|
61
|
-
"headTitle": "PuSt5a_headTitle",
|
|
62
68
|
"sc-spin": "PuSt5a_sc-spin",
|
|
63
|
-
"
|
|
69
|
+
"tabBody": "PuSt5a_tabBody",
|
|
70
|
+
"hintLine": "PuSt5a_hintLine",
|
|
71
|
+
"icoBtn": "PuSt5a_icoBtn",
|
|
72
|
+
"tabOn": "PuSt5a_tabOn",
|
|
73
|
+
"evidenceBlock": "PuSt5a_evidenceBlock",
|
|
74
|
+
"switch": "PuSt5a_switch",
|
|
75
|
+
"headerBtn": "PuSt5a_headerBtn",
|
|
64
76
|
"filterClear": "PuSt5a_filterClear",
|
|
77
|
+
"layer": "PuSt5a_layer",
|
|
78
|
+
"confirmOk": "PuSt5a_confirmOk",
|
|
79
|
+
"starInfo": "PuSt5a_starInfo",
|
|
65
80
|
"rowSub": "PuSt5a_rowSub",
|
|
66
|
-
"
|
|
67
|
-
"setInfo": "PuSt5a_setInfo",
|
|
68
|
-
"liveDot": "PuSt5a_liveDot",
|
|
81
|
+
"detailAccent": "PuSt5a_detailAccent",
|
|
69
82
|
"noteErr": "PuSt5a_noteErr",
|
|
70
|
-
"
|
|
83
|
+
"liveDot": "PuSt5a_liveDot",
|
|
71
84
|
"note": "PuSt5a_note",
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
"
|
|
77
|
-
"
|
|
85
|
+
"rowAct": "PuSt5a_rowAct",
|
|
86
|
+
"segGroup": "PuSt5a_segGroup",
|
|
87
|
+
"rowMain": "PuSt5a_rowMain",
|
|
88
|
+
"rowBtn": "PuSt5a_rowBtn",
|
|
89
|
+
"head": "PuSt5a_head",
|
|
90
|
+
"empty": "PuSt5a_empty",
|
|
78
91
|
"setSection": "PuSt5a_setSection",
|
|
79
|
-
"rowDot": "PuSt5a_rowDot",
|
|
80
92
|
"tabInd": "PuSt5a_tabInd",
|
|
81
|
-
"starRow": "PuSt5a_starRow",
|
|
82
|
-
"tabs": "PuSt5a_tabs",
|
|
83
|
-
"headIco": "PuSt5a_headIco",
|
|
84
|
-
"segBtnOn": "PuSt5a_segBtnOn",
|
|
85
|
-
"confirmOk": "PuSt5a_confirmOk",
|
|
86
93
|
"detailBox": "PuSt5a_detailBox",
|
|
87
|
-
"
|
|
88
|
-
"
|
|
89
|
-
"
|
|
90
|
-
"setLabel": "PuSt5a_setLabel",
|
|
91
|
-
"setFooter": "PuSt5a_setFooter",
|
|
92
|
-
"hintWarn": "PuSt5a_hintWarn",
|
|
94
|
+
"spacer": "PuSt5a_spacer",
|
|
95
|
+
"detailGrid": "PuSt5a_detailGrid",
|
|
96
|
+
"detailHead": "PuSt5a_detailHead",
|
|
93
97
|
"prevBtn": "PuSt5a_prevBtn",
|
|
98
|
+
"tab": "PuSt5a_tab",
|
|
94
99
|
"starSection": "PuSt5a_starSection",
|
|
100
|
+
"headTitle": "PuSt5a_headTitle",
|
|
101
|
+
"setPage": "PuSt5a_setPage",
|
|
102
|
+
"setCap": "PuSt5a_setCap",
|
|
95
103
|
"detailLabel": "PuSt5a_detailLabel",
|
|
96
|
-
"
|
|
97
|
-
"
|
|
98
|
-
"
|
|
104
|
+
"starRow": "PuSt5a_starRow",
|
|
105
|
+
"errText": "PuSt5a_errText",
|
|
106
|
+
"confirmRow": "PuSt5a_confirmRow",
|
|
107
|
+
"tabs": "PuSt5a_tabs",
|
|
99
108
|
"rowName": "PuSt5a_rowName",
|
|
100
|
-
"
|
|
101
|
-
"headerBtnOn": "PuSt5a_headerBtnOn",
|
|
102
|
-
"noteWarn": "PuSt5a_noteWarn",
|
|
103
|
-
"segBtn": "PuSt5a_segBtn",
|
|
104
|
-
"setPage": "PuSt5a_setPage",
|
|
105
|
-
"spin": "PuSt5a_spin",
|
|
106
|
-
"setRow": "PuSt5a_setRow",
|
|
107
|
-
"switch": "PuSt5a_switch",
|
|
109
|
+
"hintWarn": "PuSt5a_hintWarn",
|
|
108
110
|
"setNote": "PuSt5a_setNote",
|
|
109
|
-
"
|
|
110
|
-
"spacer": "PuSt5a_spacer",
|
|
111
|
-
"rowMain": "PuSt5a_rowMain",
|
|
112
|
-
"detailAccent": "PuSt5a_detailAccent"
|
|
111
|
+
"starLink": "PuSt5a_starLink"
|
|
113
112
|
};
|
|
114
|
-
|
|
115
|
-
//#region src/client/ServiceConsole.tsx
|
|
113
|
+
// src/client/ServiceConsole.tsx
|
|
116
114
|
/**
|
|
117
115
|
* dsh-service-console — 面板组件(原生包 v2)
|
|
118
116
|
*
|
|
119
|
-
* 架构对齐 dsh-
|
|
120
|
-
* - i18n:
|
|
117
|
+
* 架构对齐 dsh-service-console 的 rc.5 契约:
|
|
118
|
+
* - i18n: 组件通过 slot 注册项的 `locale:` 选项拿到框架合成的 `t` seat
|
|
119
|
+
* (`PropsLocale`,按 namespace 联合类型化;语言切换由渲染器按 locale revision
|
|
120
|
+
* 重渲染 outlet,不再需要模块级 bind + 手动订阅)
|
|
121
121
|
* - API: 通过 fetch 直连 webServer JSON 路由(不走 host.call / LLM)
|
|
122
122
|
* - UI: 抽屉式面板 + Tab 栏(服务 / 设置),对标 workspace-explorer 视觉风格
|
|
123
123
|
*/
|
|
124
124
|
let timerCtx = null;
|
|
125
|
-
let localeSubscribe = null;
|
|
126
|
-
let tr = (k) => k;
|
|
127
125
|
function bindTimer(t) {
|
|
128
126
|
timerCtx = t;
|
|
129
127
|
}
|
|
130
|
-
function bindLocale(locale) {
|
|
131
|
-
tr = locale.t;
|
|
132
|
-
localeSubscribe = locale.subscribe;
|
|
133
|
-
}
|
|
134
128
|
/** 动态错误码 → 词典键(err.<CODE>);未收录的码回退 fallback */
|
|
135
|
-
function trError(code, fallback) {
|
|
129
|
+
function trError(t, code, fallback) {
|
|
136
130
|
if (!code) return fallback;
|
|
137
131
|
const key = "err." + code;
|
|
138
|
-
const s =
|
|
132
|
+
const s = t(key);
|
|
139
133
|
return s === key ? fallback : s;
|
|
140
134
|
}
|
|
141
135
|
async function api(path, payload) {
|
|
@@ -153,6 +147,7 @@ window.__ModuleLoader__.load({
|
|
|
153
147
|
}
|
|
154
148
|
const store = {
|
|
155
149
|
open: false,
|
|
150
|
+
sessionId: null,
|
|
156
151
|
listeners: /* @__PURE__ */ new Set()
|
|
157
152
|
};
|
|
158
153
|
function subscribeOpen(fn) {
|
|
@@ -201,27 +196,48 @@ window.__ModuleLoader__.load({
|
|
|
201
196
|
showUnknown: true,
|
|
202
197
|
forceKill: false
|
|
203
198
|
};
|
|
199
|
+
/**
|
|
200
|
+
* rc.5 起每个 slot 渲染点都是 `[data-slot]` 的 `display: contents` 锚点
|
|
201
|
+
* (`dsh-client-ui-renderer` 的 ANCHOR_STYLE)——它没有布局盒,
|
|
202
|
+
* `getBoundingClientRect()` 全 0。必须量锚点里真正的元素子节点,
|
|
203
|
+
* 否则面板恒落在 `top: 8px` 并压住会话 header。
|
|
204
|
+
*/
|
|
205
|
+
function realBox(anchor) {
|
|
206
|
+
if (anchor === null) return null;
|
|
207
|
+
const candidate = anchor.firstElementChild ?? anchor;
|
|
208
|
+
const rect = candidate.getBoundingClientRect();
|
|
209
|
+
return rect.height > 0 || rect.width > 0 ? candidate : null;
|
|
210
|
+
}
|
|
211
|
+
function popupAnchors() {
|
|
212
|
+
return {
|
|
213
|
+
header: realBox(document.querySelector("[data-slot=\"conversation.session.header\"]")),
|
|
214
|
+
composer: realBox(document.querySelector("[data-composer-card]"))
|
|
215
|
+
};
|
|
216
|
+
}
|
|
204
217
|
function measurePopup() {
|
|
205
218
|
const vh = window.innerHeight;
|
|
206
|
-
const header =
|
|
207
|
-
const composer = document.querySelector("[data-composer-card]");
|
|
219
|
+
const { header, composer } = popupAnchors();
|
|
208
220
|
const top = header ? Math.round(header.getBoundingClientRect().bottom) + 8 : 48;
|
|
209
|
-
const
|
|
221
|
+
const composerTop = composer ? Math.round(composer.getBoundingClientRect().top) - 8 : vh - 48;
|
|
222
|
+
const bottomLimit = composerTop > top ? composerTop : vh - 48;
|
|
210
223
|
return {
|
|
211
224
|
top,
|
|
212
225
|
height: Math.max(280, bottomLimit - top)
|
|
213
226
|
};
|
|
214
227
|
}
|
|
215
|
-
function ServiceConsoleEntry() {
|
|
228
|
+
function ServiceConsoleEntry({ t, sessionId }) {
|
|
216
229
|
const [on, setOn] = react.useState(store.open);
|
|
217
230
|
react.useEffect(() => subscribeOpen(setOn), []);
|
|
231
|
+
react.useEffect(() => {
|
|
232
|
+
store.sessionId = sessionId ?? null;
|
|
233
|
+
}, [sessionId]);
|
|
218
234
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
219
235
|
type: "button",
|
|
220
236
|
className: service_console_module_css_default.headerBtn + (on ? " " + service_console_module_css_default.headerBtnOn : ""),
|
|
221
237
|
onClick: toggleOpen,
|
|
222
|
-
title:
|
|
223
|
-
"aria-label":
|
|
224
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children:
|
|
238
|
+
title: t("entry.tip"),
|
|
239
|
+
"aria-label": t("entry.tip"),
|
|
240
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("entry.label") }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
225
241
|
viewBox: "0 0 16 16",
|
|
226
242
|
width: 13,
|
|
227
243
|
height: 13,
|
|
@@ -244,7 +260,47 @@ window.__ModuleLoader__.load({
|
|
|
244
260
|
})]
|
|
245
261
|
});
|
|
246
262
|
}
|
|
247
|
-
function
|
|
263
|
+
function ServiceConsoleIcon({ size }) {
|
|
264
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
265
|
+
viewBox: "0 0 16 16",
|
|
266
|
+
width: size,
|
|
267
|
+
height: size,
|
|
268
|
+
"aria-hidden": "true",
|
|
269
|
+
fill: "none",
|
|
270
|
+
children: [
|
|
271
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
|
|
272
|
+
x: 2.25,
|
|
273
|
+
y: 3.25,
|
|
274
|
+
width: 11.5,
|
|
275
|
+
height: 8.5,
|
|
276
|
+
rx: 2,
|
|
277
|
+
stroke: "currentColor",
|
|
278
|
+
strokeWidth: 1.3
|
|
279
|
+
}),
|
|
280
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
281
|
+
d: "M5 6.25 6.9 7.75 5 9.25",
|
|
282
|
+
stroke: "currentColor",
|
|
283
|
+
strokeWidth: 1.3,
|
|
284
|
+
strokeLinecap: "round",
|
|
285
|
+
strokeLinejoin: "round"
|
|
286
|
+
}),
|
|
287
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
288
|
+
d: "M8.4 9.25H11",
|
|
289
|
+
stroke: "currentColor",
|
|
290
|
+
strokeWidth: 1.3,
|
|
291
|
+
strokeLinecap: "round"
|
|
292
|
+
}),
|
|
293
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
294
|
+
d: "M6 13.4H10",
|
|
295
|
+
stroke: "currentColor",
|
|
296
|
+
strokeWidth: 1.3,
|
|
297
|
+
strokeLinecap: "round"
|
|
298
|
+
})
|
|
299
|
+
]
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
function ServiceConsoleSettings({ t, onSaved }) {
|
|
303
|
+
const tr = t;
|
|
248
304
|
const [config, setConfig] = react.useState(null);
|
|
249
305
|
react.useEffect(() => {
|
|
250
306
|
api("config", {}).then((res) => setConfig(res?.data?.config ?? null)).catch(() => {});
|
|
@@ -413,7 +469,8 @@ window.__ModuleLoader__.load({
|
|
|
413
469
|
]
|
|
414
470
|
});
|
|
415
471
|
}
|
|
416
|
-
function ServiceConsolePanel() {
|
|
472
|
+
function ServiceConsolePanel({ t }) {
|
|
473
|
+
const tr = t;
|
|
417
474
|
const [on, setOn] = react.useState(store.open);
|
|
418
475
|
const [shown, setShown] = react.useState(false);
|
|
419
476
|
const [closing, setClosing] = react.useState(false);
|
|
@@ -443,10 +500,8 @@ window.__ModuleLoader__.load({
|
|
|
443
500
|
const [scope, setScope] = react.useState("workspace");
|
|
444
501
|
const scopeTouched = react.useRef(false);
|
|
445
502
|
const [pending, setPending] = react.useState(false);
|
|
446
|
-
const [, setLangTick] = react.useState(0);
|
|
447
503
|
const timeoutRef = react.useRef(null);
|
|
448
504
|
react.useEffect(() => subscribeOpen(setOn), []);
|
|
449
|
-
react.useEffect(() => localeSubscribe?.(() => setLangTick((n) => n + 1)), []);
|
|
450
505
|
react.useEffect(() => {
|
|
451
506
|
if (on) {
|
|
452
507
|
setClosing(false);
|
|
@@ -470,8 +525,7 @@ window.__ModuleLoader__.load({
|
|
|
470
525
|
const update = () => setRect(measurePopup());
|
|
471
526
|
update();
|
|
472
527
|
const ro = new ResizeObserver(update);
|
|
473
|
-
const header =
|
|
474
|
-
const composer = document.querySelector("[data-composer-card]");
|
|
528
|
+
const { header, composer } = popupAnchors();
|
|
475
529
|
if (header) ro.observe(header);
|
|
476
530
|
if (composer) ro.observe(composer);
|
|
477
531
|
window.addEventListener("resize", update);
|
|
@@ -509,7 +563,7 @@ window.__ModuleLoader__.load({
|
|
|
509
563
|
err: "timeout"
|
|
510
564
|
} : v);
|
|
511
565
|
}, 8e3) ?? null;
|
|
512
|
-
api("services/scan", {}).then((res) => {
|
|
566
|
+
api("services/scan", { sessionId: store.sessionId ?? void 0 }).then((res) => {
|
|
513
567
|
timeoutRef.current?.();
|
|
514
568
|
timeoutRef.current = null;
|
|
515
569
|
setView({
|
|
@@ -571,7 +625,8 @@ window.__ModuleLoader__.load({
|
|
|
571
625
|
text = action === "stop" ? tr("result.stopped") : tr("result.restarted");
|
|
572
626
|
} else {
|
|
573
627
|
ok = false;
|
|
574
|
-
|
|
628
|
+
const code = res?.error?.code ?? "";
|
|
629
|
+
text = trError(tr, code, res?.error?.message || tr("result.error"));
|
|
575
630
|
}
|
|
576
631
|
setOpResult({
|
|
577
632
|
id: svc.id,
|
|
@@ -870,7 +925,10 @@ window.__ModuleLoader__.load({
|
|
|
870
925
|
}, svc.id);
|
|
871
926
|
})
|
|
872
927
|
] });
|
|
873
|
-
const settingsBody = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ServiceConsoleSettings, {
|
|
928
|
+
const settingsBody = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ServiceConsoleSettings, {
|
|
929
|
+
t: tr,
|
|
930
|
+
onSaved: setConfig
|
|
931
|
+
});
|
|
874
932
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
875
933
|
className: service_console_module_css_default.layer,
|
|
876
934
|
children: [toast ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Toast, {
|
|
@@ -879,6 +937,7 @@ window.__ModuleLoader__.load({
|
|
|
879
937
|
onDone: () => setToast(null)
|
|
880
938
|
}, toast.seq) : null, /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
881
939
|
className: service_console_module_css_default.popup + (shown ? " " + service_console_module_css_default.popupOn : ""),
|
|
940
|
+
"data-window-drag-exclude": true,
|
|
882
941
|
style: {
|
|
883
942
|
top: rect.top,
|
|
884
943
|
height: rect.height
|
|
@@ -1029,98 +1088,56 @@ window.__ModuleLoader__.load({
|
|
|
1029
1088
|
})]
|
|
1030
1089
|
});
|
|
1031
1090
|
}
|
|
1032
|
-
|
|
1033
|
-
//#region src/client/i18n.ts
|
|
1091
|
+
// src/client/i18n.ts
|
|
1034
1092
|
/**
|
|
1035
|
-
*
|
|
1036
|
-
*
|
|
1093
|
+
* 幂等注册词典:单次对象式注册;已由先前装载注册(`already has locale`)视为
|
|
1094
|
+
* 成功,其余错误留一条告警而不是静默吞成「UI 回显原始键」。
|
|
1037
1095
|
*/
|
|
1038
1096
|
function registerDictionaries(locale, ns, dicts) {
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
const
|
|
1043
|
-
|
|
1044
|
-
const off = locale.register(ns, code, dict);
|
|
1045
|
-
if (typeof off === "function") offs.push(off);
|
|
1046
|
-
} catch (error) {
|
|
1047
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
1048
|
-
if (!/already has locale/.test(message)) console.warn("[dsh-service-console] locale.register(" + ns + ", " + code + ") failed:", message);
|
|
1049
|
-
}
|
|
1097
|
+
try {
|
|
1098
|
+
locale.register(ns, dicts);
|
|
1099
|
+
} catch (error) {
|
|
1100
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1101
|
+
if (!/already has locale/.test(message)) console.warn("[dsh-service-console] locale.register(" + ns + ") failed:", message);
|
|
1050
1102
|
}
|
|
1051
|
-
return () => {
|
|
1052
|
-
for (const off of offs) try {
|
|
1053
|
-
off();
|
|
1054
|
-
} catch {}
|
|
1055
|
-
};
|
|
1056
1103
|
}
|
|
1057
1104
|
/**
|
|
1058
|
-
*
|
|
1059
|
-
*
|
|
1105
|
+
* 绑定翻译函数:rc.5 的 bound 原生支持 `{param}` 插值;这里仍保留兜底替换,
|
|
1106
|
+
* 以便旧版/桩实现忽略 params 时标签不出现裸占位符。
|
|
1060
1107
|
*/
|
|
1061
1108
|
function bindTranslator(locale, ns) {
|
|
1062
|
-
|
|
1063
|
-
|
|
1109
|
+
let bound;
|
|
1110
|
+
try {
|
|
1111
|
+
bound = locale.bind(ns);
|
|
1112
|
+
} catch {
|
|
1113
|
+
return ((key) => key);
|
|
1114
|
+
}
|
|
1115
|
+
return ((key, params) => {
|
|
1116
|
+
let s;
|
|
1064
1117
|
try {
|
|
1065
|
-
|
|
1118
|
+
s = bound(key, params);
|
|
1066
1119
|
} catch {
|
|
1067
|
-
|
|
1120
|
+
s = key;
|
|
1068
1121
|
}
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
} catch {
|
|
1074
|
-
s = key;
|
|
1075
|
-
}
|
|
1076
|
-
if (typeof s !== "string" || s === "") s = key;
|
|
1077
|
-
if (params) for (const k of Object.keys(params)) s = s.split("{" + k + "}").join(String(params[k]));
|
|
1078
|
-
return s;
|
|
1079
|
-
};
|
|
1080
|
-
};
|
|
1081
|
-
let t = make();
|
|
1082
|
-
return {
|
|
1083
|
-
t: (key, params) => t(key, params),
|
|
1084
|
-
subscribe: (fn) => {
|
|
1085
|
-
const off = locale.subscribe(() => {
|
|
1086
|
-
t = make();
|
|
1087
|
-
fn();
|
|
1088
|
-
});
|
|
1089
|
-
return typeof off === "function" ? off : () => {};
|
|
1090
|
-
}
|
|
1091
|
-
};
|
|
1122
|
+
if (typeof s !== "string" || s === "") s = key;
|
|
1123
|
+
if (params && s.includes("{")) for (const k of Object.keys(params)) s = s.split("{" + k + "}").join(String(params[k]));
|
|
1124
|
+
return s;
|
|
1125
|
+
});
|
|
1092
1126
|
}
|
|
1093
1127
|
/**
|
|
1094
|
-
* 反应式 i18n
|
|
1095
|
-
*
|
|
1096
|
-
*
|
|
1097
|
-
* 退回 `entry.label` 等原始键:
|
|
1098
|
-
*
|
|
1099
|
-
* 1. 服务晚到(桌面竞态):桌面客户端 `globalThis.__DSH_LOCALE__` 存在时,
|
|
1100
|
-
* dsh-client-locale 的 apply 要先 `await bridge.read()`(Electron IPC)才
|
|
1101
|
-
* `ctx.provide('locale')`;本插件 apply 先跑,get 取到 undefined 即整体
|
|
1102
|
-
* 跳过 i18n。浏览器开发环境无 bridge、provide 同步完成,所以“本地验证
|
|
1103
|
-
* 通过、用户下载后失效”。另外 cordis 的 get(strict) 在 provider fiber
|
|
1104
|
-
* 尚未落定(state != 2)时同样返回 undefined。
|
|
1105
|
-
* 2. 热更新双装载的 dispose 顺序:dshmarket 更新会把插件装载两次,第二次
|
|
1106
|
-
* register 抛 already has locale 被跳过;随后旧实例卸载时若把词典 disposer
|
|
1107
|
-
* 掉,词典即被撤走,留下没有词典的新实例回显原始键。
|
|
1108
|
-
*
|
|
1109
|
-
* 对策:`ctx.inject(['locale'], …)` 按平台注入等待语义在服务真正可用
|
|
1110
|
-
* (provider fiber 就绪)后才进入;provider 重启/热更新重载都会重新进入
|
|
1111
|
-
* 回调并重绑;词典注册保持幂等,且有意不在实例卸载时撤销(见上第 2 条),
|
|
1112
|
-
* 注册本身只增不减,对双装载安全。
|
|
1128
|
+
* 反应式 i18n 挂载:等 locale 服务真正可用(provider fiber 就绪)后注册词典,
|
|
1129
|
+
* 并把绑定好的翻译函数交给调用方(用于 slot 注册项的 `label` thunk——它在每次
|
|
1130
|
+
* 投影时被重新读取,因此语言切换无需重新注册)。
|
|
1113
1131
|
*/
|
|
1114
|
-
function attachLocale(ctx, ns, dicts,
|
|
1132
|
+
function attachLocale(ctx, ns, dicts, onReady) {
|
|
1115
1133
|
ctx.inject(["locale"], (sub) => {
|
|
1116
1134
|
const locale = sub.get("locale");
|
|
1117
1135
|
if (locale === void 0) return;
|
|
1118
1136
|
registerDictionaries(locale, ns, dicts);
|
|
1119
|
-
|
|
1137
|
+
onReady(bindTranslator(locale, ns));
|
|
1120
1138
|
});
|
|
1121
1139
|
}
|
|
1122
|
-
|
|
1123
|
-
//#region src/client/dictionaries.ts
|
|
1140
|
+
// src/client/dictionaries.ts
|
|
1124
1141
|
/**
|
|
1125
1142
|
* dsh-service-console — i18n 词典(对齐 DSH locale.register 机制)
|
|
1126
1143
|
* 与 dsh-workspace-explorer 共享设计语言:flat key → template string with {vars}
|
|
@@ -1181,6 +1198,7 @@ window.__ModuleLoader__.load({
|
|
|
1181
1198
|
"err.RESTART_UNSAFE": "缺少安全启动信息,不能重启",
|
|
1182
1199
|
"err.PORT_CONFLICT": "端口仍被占用",
|
|
1183
1200
|
"err.START_TIMEOUT": "未在预期时间开始监听",
|
|
1201
|
+
"err.FORBIDDEN_REMOTE": "非本机来源:只读(防止远程停本机进程)",
|
|
1184
1202
|
"tab.services": "服务",
|
|
1185
1203
|
"tab.settings": "设置",
|
|
1186
1204
|
"settings.title": "面板设置",
|
|
@@ -1255,6 +1273,7 @@ window.__ModuleLoader__.load({
|
|
|
1255
1273
|
"err.RESTART_UNSAFE": "Cannot restart safely",
|
|
1256
1274
|
"err.PORT_CONFLICT": "Port conflict",
|
|
1257
1275
|
"err.START_TIMEOUT": "Start timeout",
|
|
1276
|
+
"err.FORBIDDEN_REMOTE": "Not a local caller — read-only",
|
|
1258
1277
|
"tab.services": "Services",
|
|
1259
1278
|
"tab.settings": "Settings",
|
|
1260
1279
|
"settings.title": "Panel settings",
|
|
@@ -1276,38 +1295,45 @@ window.__ModuleLoader__.load({
|
|
|
1276
1295
|
"star.ask": "⭐ Drop a Star if it helped — it makes the author's day",
|
|
1277
1296
|
"star.cta": "★ Give a Star"
|
|
1278
1297
|
};
|
|
1279
|
-
|
|
1280
|
-
//#region src/client/index.tsx
|
|
1298
|
+
// src/client/index.tsx
|
|
1281
1299
|
const NS = "dsh-service-console";
|
|
1282
1300
|
let labelT = null;
|
|
1283
1301
|
function labelFn(key) {
|
|
1284
1302
|
return labelT ? labelT(key) : key;
|
|
1285
1303
|
}
|
|
1286
|
-
//#endregion
|
|
1287
1304
|
module.exports = {
|
|
1288
1305
|
inject: ["slots", "timer"],
|
|
1289
1306
|
apply(ctx) {
|
|
1290
1307
|
bindTimer(ctx.timer);
|
|
1291
|
-
attachLocale(ctx, NS,
|
|
1292
|
-
|
|
1293
|
-
|
|
1308
|
+
attachLocale(ctx, NS, {
|
|
1309
|
+
zh: ZH_DICT,
|
|
1310
|
+
en: EN_DICT
|
|
1311
|
+
}, (t) => {
|
|
1312
|
+
labelT = t;
|
|
1294
1313
|
});
|
|
1295
1314
|
ctx.effect(() => ctx.slots.inject("conversation.session.header.utilities", () => ctx.slots.register({
|
|
1296
1315
|
name: "conversation.session.header.utilities",
|
|
1297
1316
|
id: "dsh-service-console",
|
|
1298
1317
|
order: 25,
|
|
1318
|
+
locale: NS,
|
|
1299
1319
|
label: () => labelFn("plugin.name")
|
|
1300
1320
|
}, ServiceConsoleEntry)));
|
|
1301
1321
|
ctx.effect(() => ctx.slots.inject("shell.overlay", () => ctx.slots.register({
|
|
1302
1322
|
name: "shell.overlay",
|
|
1303
|
-
id: "dsh-service-console-panel"
|
|
1323
|
+
id: "dsh-service-console-panel",
|
|
1324
|
+
locale: NS
|
|
1304
1325
|
}, ServiceConsolePanel)));
|
|
1305
1326
|
ctx.effect(() => ctx.slots.inject("settings.section", () => ctx.slots.register({
|
|
1306
1327
|
name: "settings.section",
|
|
1307
1328
|
id: "dsh-service-console",
|
|
1308
1329
|
order: 35,
|
|
1330
|
+
locale: NS,
|
|
1309
1331
|
label: () => labelFn("plugin.name")
|
|
1310
1332
|
}, ServiceConsoleSettings)));
|
|
1333
|
+
ctx.effect(() => ctx.slots.inject("settings.section.icon", () => ctx.slots.register({
|
|
1334
|
+
name: "settings.section.icon",
|
|
1335
|
+
id: "dsh-service-console"
|
|
1336
|
+
}, ServiceConsoleIcon)));
|
|
1311
1337
|
}
|
|
1312
1338
|
};
|
|
1313
1339
|
return module.exports;
|
package/lib/host/config.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
2
2
|
import { homedir } from "node:os";
|
|
3
3
|
import { dirname, join } from "node:path";
|
|
4
|
-
|
|
4
|
+
// src/host/config.ts
|
|
5
5
|
const DEFAULT_CONFIG = {
|
|
6
6
|
refreshInterval: 5e3,
|
|
7
7
|
defaultScope: "workspace",
|
|
@@ -85,5 +85,4 @@ function validateConfigPatch(patch) {
|
|
|
85
85
|
next
|
|
86
86
|
};
|
|
87
87
|
}
|
|
88
|
-
//#endregion
|
|
89
88
|
export { CONFIG_LIMITS, DEFAULT_CONFIG, REFRESH_INTERVAL_CHOICES, loadConfigFromFile, saveConfigToFile, validateConfigPatch };
|
package/lib/host/ledger.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { redact } from "./redaction.js";
|
|
2
|
-
|
|
2
|
+
// src/host/ledger.ts
|
|
3
3
|
const DEV_COMMAND_RE = /(npm (run|start|dev)|pnpm (run|dev|start)|yarn (dev|start)|next dev|vite|uvicorn|gunicorn|flask run|django runserver|cargo run|node (server|app|index)|python3? -m (http.server|uvicorn)|serve|http-server|nodemon|tsx watch|deno run)/;
|
|
4
4
|
var SessionLedger = class {
|
|
5
5
|
entries = [];
|
|
@@ -9,7 +9,7 @@ var SessionLedger = class {
|
|
|
9
9
|
observe(exec) {
|
|
10
10
|
try {
|
|
11
11
|
if (!exec || exec.name !== "bash") return;
|
|
12
|
-
const args = exec.args
|
|
12
|
+
const args = exec.arguments ?? exec.args ?? {};
|
|
13
13
|
const command = String(args.command || "");
|
|
14
14
|
if (!DEV_COMMAND_RE.test(command)) return;
|
|
15
15
|
let sessionKey = null;
|
|
@@ -29,5 +29,4 @@ var SessionLedger = class {
|
|
|
29
29
|
} catch (err) {}
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
|
-
//#endregion
|
|
33
32
|
export { DEV_COMMAND_RE, SessionLedger };
|
package/lib/host/lifecycle.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { redact } from "./redaction.js";
|
|
2
1
|
import { runCommand, shellQuote } from "./process-inspector.js";
|
|
3
|
-
|
|
2
|
+
import { redact } from "./redaction.js";
|
|
3
|
+
// src/host/lifecycle.ts
|
|
4
4
|
function ok(data) {
|
|
5
5
|
return {
|
|
6
6
|
ok: true,
|
|
@@ -55,5 +55,4 @@ async function restartService(deps, serviceId) {
|
|
|
55
55
|
command: redact(entry.command) ?? entry.command
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
|
-
//#endregion
|
|
59
58
|
export { restartService, stopService };
|