@jiyr0119/dsh-service-console 0.2.2 → 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/docs/local-debugging.md +158 -0
- package/dsh.plugin.json +1 -1
- package/lib/client.js +806 -452
- package/lib/types/client/ServiceConsole.d.ts +16 -5
- package/lib/types/client/dictionaries.d.ts +6 -0
- package/lib/types/client/index.d.ts +8 -6
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -29,7 +29,7 @@ window.__ModuleLoader__.load({
|
|
|
29
29
|
react = __toESM(react, 1);
|
|
30
30
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
31
31
|
//#region \0dsh-css:/home/runner/work/dsh-service-console/dsh-service-console/src/client/service-console.module.css.mjs
|
|
32
|
-
const css = ".PuSt5a_panel{z-index:9999;box-sizing:border-box;width:min(620px,100vw - 32px);max-height:min(760px,100dvh - 88px);color:var(--dsw-alias-label-primary,#f5f5f5);background:var(--dsw-alias-bg-overlay,#202124);border:1px solid var(--dsw-alias-border-l1,#3b3d42);font-family:var(--dsw-font-family,Inter, -apple-system, BlinkMacSystemFont, sans-serif);pointer-events:auto;border-radius:14px;padding:18px;font-size:13px;position:fixed;top:64px;right:20px;overflow:auto;box-shadow:0 18px 55px #0000006b,0 2px 8px #0003}.PuSt5a_header{border-bottom:1px solid var(--dsw-alias-border-l1,#35373c);justify-content:space-between;align-items:flex-start;gap:16px;padding-bottom:14px;display:flex}.PuSt5a_titleBlock{flex-direction:column;gap:3px;display:flex}.PuSt5a_titleBlock strong{letter-spacing:-.02em;font-size:19px}.PuSt5a_eyebrow,.PuSt5a_detailAccent,.PuSt5a_detailLabel{color:var(--dsw-alias-label-tertiary,#858991);letter-spacing:.1em;text-transform:uppercase;font-size:10px;font-weight:650}.PuSt5a_subtitle,.PuSt5a_scopeHint{color:var(--dsw-alias-label-secondary,#a8abb2);font-size:12px}.PuSt5a_headerActions{gap:5px;display:flex}.PuSt5a_iconBtn,.PuSt5a_closeBtn{cursor:pointer;border:1px solid var(--dsw-alias-border-l2,#50535a);background:var(--dsw-alias-bg-layer-1,#2a2c30);width:30px;height:30px;color:var(--dsw-alias-label-primary,#eee);border-radius:8px;padding:0;font-family:inherit}.PuSt5a_iconBtn:hover,.PuSt5a_closeBtn:hover,.PuSt5a_btn:hover{background:var(--dsw-alias-interactive-bg-hover,#383b41)}.PuSt5a_closeBtn{color:var(--dsw-alias-label-secondary,#aaa);font-size:21px;line-height:1}.PuSt5a_scopeLine{color:var(--dsw-alias-label-primary,#eee);align-items:center;gap:7px;padding:12px 0 10px;font-size:12px;display:flex}.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%}.PuSt5a_autoRefresh{color:var(--dsw-alias-label-secondary,#aaa);font-size:11px}.PuSt5a_autoRefresh input{accent-color:var(--dsw-alias-state-success-primary,#55d187)}.PuSt5a_row{border-bottom:1px solid var(--dsw-alias-border-l1,#35373c);padding:13px 0}.PuSt5a_rowMain{flex-wrap:wrap;align-items:center;gap:7px;display:flex}.PuSt5a_name{font-size:14px;font-weight:650}.PuSt5a_muted{color:var(--dsw-alias-label-secondary,#999)}.PuSt5a_ok{color:var(--dsw-alias-state-success-primary,#55d187)}.PuSt5a_err{color:var(--dsw-alias-state-error-primary,#ff7c83)}.PuSt5a_warn{color:var(--dsw-alias-state-warn-primary,#e7b85d)}.PuSt5a_status{color:var(--dsw-alias-label-secondary,#a8abb2);margin:10px 0;font-size:11px}.PuSt5a_btn{cursor:pointer;border:1px solid var(--dsw-alias-border-l2,#50535a);background:var(--dsw-alias-bg-layer-1,#2a2c30);color:var(--dsw-alias-label-primary,#eee);font:inherit;border-radius:7px;margin-left:5px;padding:5px 9px;font-size:11px;text-decoration:none}.PuSt5a_badge{border:1px solid;border-radius:999px;padding:2px 7px;font-size:10px}.PuSt5a_input{box-sizing:border-box;border:1px solid var(--dsw-alias-border-l2,#50535a);background:var(--dsw-alias-bg-layer-1,#2a2c30);color:var(--dsw-alias-label-primary,#eee);font:inherit;border-radius:8px;padding:8px 10px;font-size:12px}.PuSt5a_search{width:100%;margin-bottom:7px}.PuSt5a_spacer{flex:1}.PuSt5a_configBox{border:1px solid var(--dsw-alias-border-l1,#35373c);background:var(--dsw-alias-bg-layer-1,#292b30);border-radius:9px;margin:10px 0;padding:11px}.PuSt5a_configRow{align-items:center;gap:8px;margin-top:7px;display:flex}.PuSt5a_confirmRow{background:color-mix(in srgb, var(--dsw-alias-state-warn-primary,#e7b85d) 9%, transparent);border-radius:8px;flex-wrap:wrap;align-items:center;gap:5px;margin-top:9px;padding:9px;display:flex}.PuSt5a_detailBox{border:1px solid var(--dsw-alias-border-l2,#50535a);background:var(--dsw-alias-bg-layer-1,#292b30);box-shadow:inset 3px 0 0 var(--dsw-alias-state-warn-primary,#e7b85d);border-radius:10px;margin-top:11px;padding:13px}.PuSt5a_detailHeader{justify-content:space-between;align-items:center;margin-bottom:12px;font-size:12px;font-weight:650;display:flex}.PuSt5a_detailAccent{color:var(--dsw-alias-state-warn-primary,#e7b85d);font-size:9px}.PuSt5a_detailGrid{grid-template-columns:repeat(2,minmax(0,1fr));gap:11px;display:grid}.PuSt5a_detailGrid>div{flex-direction:column;gap:4px;min-width:0;display:flex}.PuSt5a_detailGrid code{overflow-wrap:anywhere;color:var(--dsw-alias-label-primary,#e7e8ea);font:11px ui-monospace,SFMono-Regular,Menlo,monospace}.PuSt5a_evidenceBlock{border-top:1px solid var(--dsw-alias-border-l1,#3b3d42);margin-top:14px;padding-top:11px}.PuSt5a_evidenceItem{color:var(--dsw-alias-label-secondary,#b4b6bc);gap:7px;margin-top:6px;font-size:11px;display:flex}.PuSt5a_evidenceItem span{color:var(--dsw-alias-state-warn-primary,#e7b85d)}.PuSt5a_entry{border:1px solid var(--dsw-alias-border-l2);min-width:111px;height:32px;color:var(--dsw-alias-label-primary);font-family:var(--dsw-font-family);cursor:pointer;background:0 0;border-radius:18px;justify-content:center;align-items:center;gap:4px;padding:6px 12px;font-size:13px;font-weight:400;line-height:20px;display:inline-flex}.PuSt5a_entry:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}.PuSt5a_entryLabel,.PuSt5a_entryIcon{white-space:nowrap;flex:none}@media (width<=640px){.PuSt5a_panel{width:calc(100vw - 20px);max-height:calc(100dvh - 20px);top:10px;right:10px}.PuSt5a_detailGrid{grid-template-columns:1fr}}@media (prefers-reduced-motion:reduce){.PuSt5a_panel{scroll-behavior:auto}}";
|
|
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_hintLine{color:var(--dsw-alias-label-caption,#8a8a8a);align-items:center;gap:6px;padding:4px 18px 8px;font-size:11px;display:flex}.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_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_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_rowBtn:focus-visible,.PuSt5a_headerBtn:focus-visible,.PuSt5a_icoBtn:focus-visible,.PuSt5a_prevBtn:focus-visible,.PuSt5a_filter:focus-visible,.PuSt5a_tab: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}}";
|
|
33
33
|
const tagId = "@jiyr0119/dsh-service-console/service-console.module.css";
|
|
34
34
|
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
|
|
35
35
|
const tag = document.createElement("style");
|
|
@@ -39,204 +39,275 @@ window.__ModuleLoader__.load({
|
|
|
39
39
|
document.head.appendChild(tag);
|
|
40
40
|
}
|
|
41
41
|
var service_console_module_css_default = {
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"input": "PuSt5a_input",
|
|
47
|
-
"scopeHint": "PuSt5a_scopeHint",
|
|
48
|
-
"row": "PuSt5a_row",
|
|
49
|
-
"ok": "PuSt5a_ok",
|
|
50
|
-
"liveDot": "PuSt5a_liveDot",
|
|
51
|
-
"titleBlock": "PuSt5a_titleBlock",
|
|
52
|
-
"btn": "PuSt5a_btn",
|
|
53
|
-
"configRow": "PuSt5a_configRow",
|
|
54
|
-
"detailGrid": "PuSt5a_detailGrid",
|
|
55
|
-
"header": "PuSt5a_header",
|
|
42
|
+
"popupOn": "PuSt5a_popupOn",
|
|
43
|
+
"setInfo": "PuSt5a_setInfo",
|
|
44
|
+
"headTitle": "PuSt5a_headTitle",
|
|
45
|
+
"head": "PuSt5a_head",
|
|
56
46
|
"badge": "PuSt5a_badge",
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"status": "PuSt5a_status",
|
|
62
|
-
"subtitle": "PuSt5a_subtitle",
|
|
63
|
-
"err": "PuSt5a_err",
|
|
64
|
-
"spacer": "PuSt5a_spacer",
|
|
47
|
+
"evidenceItem": "PuSt5a_evidenceItem",
|
|
48
|
+
"detailGrid": "PuSt5a_detailGrid",
|
|
49
|
+
"setRow": "PuSt5a_setRow",
|
|
50
|
+
"switch": "PuSt5a_switch",
|
|
65
51
|
"evidenceBlock": "PuSt5a_evidenceBlock",
|
|
66
|
-
"entry": "PuSt5a_entry",
|
|
67
|
-
"iconBtn": "PuSt5a_iconBtn",
|
|
68
|
-
"scopeLine": "PuSt5a_scopeLine",
|
|
69
52
|
"rowMain": "PuSt5a_rowMain",
|
|
70
|
-
"
|
|
53
|
+
"confirmCancel": "PuSt5a_confirmCancel",
|
|
54
|
+
"filterClear": "PuSt5a_filterClear",
|
|
55
|
+
"filterRow": "PuSt5a_filterRow",
|
|
56
|
+
"rowMeta": "PuSt5a_rowMeta",
|
|
57
|
+
"detailLabel": "PuSt5a_detailLabel",
|
|
58
|
+
"row": "PuSt5a_row",
|
|
59
|
+
"note": "PuSt5a_note",
|
|
60
|
+
"rowName": "PuSt5a_rowName",
|
|
61
|
+
"headIco": "PuSt5a_headIco",
|
|
62
|
+
"rowBtn": "PuSt5a_rowBtn",
|
|
63
|
+
"errText": "PuSt5a_errText",
|
|
64
|
+
"hintLine": "PuSt5a_hintLine",
|
|
65
|
+
"detailHead": "PuSt5a_detailHead",
|
|
66
|
+
"headerBtn": "PuSt5a_headerBtn",
|
|
67
|
+
"evidenceArrow": "PuSt5a_evidenceArrow",
|
|
68
|
+
"layer": "PuSt5a_layer",
|
|
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",
|
|
80
|
+
"noteErr": "PuSt5a_noteErr",
|
|
81
|
+
"sc-spin": "PuSt5a_sc-spin",
|
|
82
|
+
"setLabel": "PuSt5a_setLabel",
|
|
83
|
+
"spin": "PuSt5a_spin",
|
|
84
|
+
"detailAccent": "PuSt5a_detailAccent",
|
|
85
|
+
"tabOn": "PuSt5a_tabOn",
|
|
86
|
+
"spacer": "PuSt5a_spacer",
|
|
87
|
+
"setInput": "PuSt5a_setInput",
|
|
88
|
+
"liveDot": "PuSt5a_liveDot",
|
|
89
|
+
"setCap": "PuSt5a_setCap",
|
|
90
|
+
"rowSub": "PuSt5a_rowSub",
|
|
71
91
|
"confirmRow": "PuSt5a_confirmRow",
|
|
92
|
+
"headerBtnOn": "PuSt5a_headerBtnOn",
|
|
93
|
+
"filter": "PuSt5a_filter",
|
|
94
|
+
"popup": "PuSt5a_popup",
|
|
95
|
+
"setFooter": "PuSt5a_setFooter",
|
|
96
|
+
"tabBody": "PuSt5a_tabBody",
|
|
97
|
+
"tab": "PuSt5a_tab",
|
|
98
|
+
"icoBtn": "PuSt5a_icoBtn",
|
|
99
|
+
"prevBtn": "PuSt5a_prevBtn",
|
|
72
100
|
"detailBox": "PuSt5a_detailBox",
|
|
73
|
-
"
|
|
74
|
-
"evidenceItem": "PuSt5a_evidenceItem",
|
|
75
|
-
"detailAccent": "PuSt5a_detailAccent",
|
|
76
|
-
"entryIcon": "PuSt5a_entryIcon",
|
|
77
|
-
"name": "PuSt5a_name",
|
|
78
|
-
"headerActions": "PuSt5a_headerActions",
|
|
79
|
-
"warn": "PuSt5a_warn"
|
|
101
|
+
"setSection": "PuSt5a_setSection"
|
|
80
102
|
};
|
|
81
103
|
//#endregion
|
|
82
104
|
//#region src/client/ServiceConsole.tsx
|
|
105
|
+
/**
|
|
106
|
+
* dsh-service-console — 面板组件(原生包 v2)
|
|
107
|
+
*
|
|
108
|
+
* 架构对齐 dsh-workspace-explorer:
|
|
109
|
+
* - i18n: 通过 locale.bind(NS) 获取翻译函数(而非硬编码 TEXTS)
|
|
110
|
+
* - API: 通过 fetch 直连 webServer JSON 路由(不走 host.call / LLM)
|
|
111
|
+
* - UI: 抽屉式面板 + Tab 栏(服务 / 设置),对标 workspace-explorer 视觉风格
|
|
112
|
+
*/
|
|
83
113
|
let timerCtx = null;
|
|
84
114
|
let localeCtx = null;
|
|
115
|
+
let tr = (k) => k;
|
|
85
116
|
function bindTimer(t) {
|
|
86
117
|
timerCtx = t;
|
|
87
118
|
}
|
|
88
119
|
function bindLocale(locale) {
|
|
89
120
|
localeCtx = locale;
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
121
|
+
try {
|
|
122
|
+
const bound = locale.bind("dsh-service-console");
|
|
123
|
+
tr = (key, vars) => {
|
|
124
|
+
let s = bound(key);
|
|
125
|
+
if (typeof s !== "string" || s === key) s = key;
|
|
126
|
+
if (vars) for (const vk in vars) s = s.split(`{${vk}}`).join(String(vars[vk]));
|
|
127
|
+
return s;
|
|
128
|
+
};
|
|
129
|
+
} catch {}
|
|
93
130
|
}
|
|
94
131
|
async function api(path, payload) {
|
|
95
|
-
const
|
|
132
|
+
const res = await fetch("/dsh-sc/api/" + path, {
|
|
96
133
|
method: "POST",
|
|
97
134
|
headers: { "content-type": "application/json" },
|
|
98
135
|
body: JSON.stringify(payload)
|
|
99
136
|
});
|
|
100
|
-
const text = await
|
|
137
|
+
const text = await res.text().catch(() => "");
|
|
101
138
|
try {
|
|
102
139
|
return JSON.parse(text || "{}");
|
|
103
140
|
} catch {
|
|
104
|
-
throw new Error("bad JSON
|
|
141
|
+
throw new Error("bad JSON HTTP " + res.status);
|
|
105
142
|
}
|
|
106
143
|
}
|
|
107
144
|
const store = {
|
|
108
145
|
open: false,
|
|
109
146
|
listeners: /* @__PURE__ */ new Set()
|
|
110
147
|
};
|
|
111
|
-
function
|
|
148
|
+
function subscribeOpen(fn) {
|
|
112
149
|
store.listeners.add(fn);
|
|
113
|
-
return () =>
|
|
150
|
+
return () => {
|
|
151
|
+
store.listeners.delete(fn);
|
|
152
|
+
};
|
|
114
153
|
}
|
|
115
154
|
function setOpen(v) {
|
|
116
155
|
store.open = v;
|
|
117
156
|
store.listeners.forEach((l) => l(v));
|
|
118
157
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
"
|
|
131
|
-
zh: "本机其他",
|
|
132
|
-
en: "Other local",
|
|
133
|
-
color: "var(--dsw-alias-label-secondary, #94a3b8)"
|
|
134
|
-
},
|
|
135
|
-
unknown: {
|
|
136
|
-
zh: "未知",
|
|
137
|
-
en: "Unknown",
|
|
138
|
-
color: "var(--dsw-alias-state-error-primary, #f87171)"
|
|
139
|
-
},
|
|
140
|
-
protected: {
|
|
141
|
-
zh: "受保护",
|
|
142
|
-
en: "Protected",
|
|
143
|
-
color: "var(--dsw-alias-state-error-primary, #f87171)"
|
|
144
|
-
}
|
|
158
|
+
function toggleOpen() {
|
|
159
|
+
setOpen(!store.open);
|
|
160
|
+
}
|
|
161
|
+
function closePanel() {
|
|
162
|
+
setOpen(false);
|
|
163
|
+
}
|
|
164
|
+
const OWNERSHIP_COLOR = {
|
|
165
|
+
"conversation-confirmed": "var(--dsw-alias-state-success-primary, #4ade80)",
|
|
166
|
+
"workspace-inferred": "var(--dsw-alias-state-warn-primary, #fbbf24)",
|
|
167
|
+
"other-local": "var(--dsw-alias-label-secondary, #94a3b8)",
|
|
168
|
+
unknown: "var(--dsw-alias-state-error-primary, #f87171)",
|
|
169
|
+
protected: "var(--dsw-alias-state-error-primary, #f87171)"
|
|
145
170
|
};
|
|
146
|
-
const
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
GRACEFUL_TIMEOUT: ["未在等待时间内退出", "Graceful timeout"],
|
|
153
|
-
RESTART_UNSAFE: ["缺少安全启动信息,不能重启", "Cannot restart safely"],
|
|
154
|
-
PORT_CONFLICT: ["端口仍被占用", "Port conflict"],
|
|
155
|
-
START_TIMEOUT: ["未在预期时间开始监听", "Start timeout"]
|
|
156
|
-
};
|
|
157
|
-
const TEXTS = {
|
|
158
|
-
zh: {
|
|
159
|
-
title: "Service Console",
|
|
160
|
-
subtitle: "本机监听服务",
|
|
161
|
-
search: "搜索服务、端口或路径…",
|
|
162
|
-
config: "配置",
|
|
163
|
-
close: "关闭",
|
|
164
|
-
noSvc: "未发现服务",
|
|
165
|
-
stop: "停止",
|
|
166
|
-
restart: "重启",
|
|
167
|
-
detail: "详情",
|
|
168
|
-
confirmStop: "确认停止?",
|
|
169
|
-
confirmRestart: "确认重启?",
|
|
170
|
-
confirmTxt: "确认对 {name} (pid {pid}) 执行{action}?",
|
|
171
|
-
ok: "确认",
|
|
172
|
-
cancel: "取消",
|
|
173
|
-
stopped: "已停止",
|
|
174
|
-
restarted: "已重启",
|
|
175
|
-
evidence: "归属证据",
|
|
176
|
-
refreshInterval: "自动刷新间隔(ms)",
|
|
177
|
-
gracefulTimeout: "优雅超时(ms)",
|
|
178
|
-
forceKill: "允许强制终止",
|
|
179
|
-
allLocal: "全部本机服务",
|
|
180
|
-
servicesFound: "项服务",
|
|
181
|
-
lastScan: "最近扫描",
|
|
182
|
-
closePanel: "关闭面板"
|
|
183
|
-
},
|
|
184
|
-
en: {
|
|
185
|
-
title: "Service Console",
|
|
186
|
-
subtitle: "Listening services on this Mac",
|
|
187
|
-
search: "Search services, ports, or paths…",
|
|
188
|
-
config: "Config",
|
|
189
|
-
close: "Close",
|
|
190
|
-
noSvc: "no services found",
|
|
191
|
-
stop: "Stop",
|
|
192
|
-
restart: "Restart",
|
|
193
|
-
detail: "Detail",
|
|
194
|
-
confirmStop: "Confirm stop?",
|
|
195
|
-
confirmRestart: "Confirm restart?",
|
|
196
|
-
confirmTxt: "Run {action} on {name} (pid {pid})?",
|
|
197
|
-
ok: "OK",
|
|
198
|
-
cancel: "Cancel",
|
|
199
|
-
stopped: "Stopped",
|
|
200
|
-
restarted: "Restarted",
|
|
201
|
-
evidence: "Ownership evidence",
|
|
202
|
-
refreshInterval: "Refresh interval (ms)",
|
|
203
|
-
gracefulTimeout: "Graceful timeout (ms)",
|
|
204
|
-
forceKill: "Allow force kill",
|
|
205
|
-
allLocal: "All local services",
|
|
206
|
-
servicesFound: "services",
|
|
207
|
-
lastScan: "Last scan",
|
|
208
|
-
closePanel: "Close panel"
|
|
209
|
-
}
|
|
171
|
+
const OWNERSHIP_KEY = {
|
|
172
|
+
"conversation-confirmed": "own.conversation",
|
|
173
|
+
"workspace-inferred": "own.workspace",
|
|
174
|
+
"other-local": "own.other",
|
|
175
|
+
unknown: "own.unknown",
|
|
176
|
+
protected: "own.protected"
|
|
210
177
|
};
|
|
178
|
+
function measurePopup() {
|
|
179
|
+
const vh = window.innerHeight;
|
|
180
|
+
const header = document.querySelector("[data-slot=\"conversation.session.header\"]");
|
|
181
|
+
const composer = document.querySelector("[data-composer-card]");
|
|
182
|
+
const top = header ? Math.round(header.getBoundingClientRect().bottom) + 8 : 48;
|
|
183
|
+
const bottomLimit = composer ? Math.round(composer.getBoundingClientRect().top) - 8 : vh - 48;
|
|
184
|
+
return {
|
|
185
|
+
top,
|
|
186
|
+
height: Math.max(280, bottomLimit - top)
|
|
187
|
+
};
|
|
188
|
+
}
|
|
211
189
|
function ServiceConsoleEntry() {
|
|
212
|
-
const [
|
|
213
|
-
|
|
214
|
-
react.useEffect(() => subscribe(setLocal), []);
|
|
215
|
-
react.useEffect(() => localeCtx?.subscribe(() => setLang(currentLanguage())), []);
|
|
190
|
+
const [on, setOn] = react.useState(store.open);
|
|
191
|
+
react.useEffect(() => subscribeOpen(setOn), []);
|
|
216
192
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
193
|
+
type: "button",
|
|
194
|
+
className: service_console_module_css_default.headerBtn + (on ? " " + service_console_module_css_default.headerBtnOn : ""),
|
|
195
|
+
onClick: toggleOpen,
|
|
196
|
+
title: tr("entry.tip"),
|
|
197
|
+
"aria-label": tr("entry.tip"),
|
|
198
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: tr("entry.label") }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
199
|
+
viewBox: "0 0 16 16",
|
|
200
|
+
width: 13,
|
|
201
|
+
height: 13,
|
|
202
|
+
"aria-hidden": "true",
|
|
203
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
|
|
204
|
+
x: 2,
|
|
205
|
+
y: 3,
|
|
206
|
+
width: 12,
|
|
207
|
+
height: 10,
|
|
208
|
+
rx: 1.5,
|
|
209
|
+
fill: "none",
|
|
210
|
+
stroke: "currentColor",
|
|
211
|
+
strokeWidth: 1.3
|
|
212
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
213
|
+
d: "M5 7h6M5 10h4",
|
|
214
|
+
stroke: "currentColor",
|
|
215
|
+
strokeWidth: 1.2,
|
|
216
|
+
strokeLinecap: "round"
|
|
217
|
+
})]
|
|
218
|
+
})]
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
function ServiceConsoleSettings() {
|
|
222
|
+
const [config, setConfig] = react.useState(null);
|
|
223
|
+
react.useEffect(() => {
|
|
224
|
+
api("config", {}).then((res) => setConfig(res?.data?.config ?? null)).catch(() => {});
|
|
225
|
+
}, []);
|
|
226
|
+
const updateConfig = (patch) => {
|
|
227
|
+
api("config", {
|
|
228
|
+
action: "update",
|
|
229
|
+
patch
|
|
230
|
+
}).then((res) => {
|
|
231
|
+
if (res?.data) setConfig(res.data.config);
|
|
232
|
+
}).catch(() => {});
|
|
233
|
+
};
|
|
234
|
+
if (!config) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
235
|
+
className: service_console_module_css_default.setPage,
|
|
236
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
237
|
+
className: service_console_module_css_default.note,
|
|
238
|
+
children: "Loading…"
|
|
239
|
+
})
|
|
240
|
+
});
|
|
241
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
242
|
+
className: service_console_module_css_default.setPage,
|
|
221
243
|
children: [
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
244
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
245
|
+
className: service_console_module_css_default.setSection,
|
|
246
|
+
children: tr("settings.general")
|
|
247
|
+
}),
|
|
248
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
249
|
+
className: service_console_module_css_default.setRow,
|
|
250
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
251
|
+
className: service_console_module_css_default.setInfo,
|
|
252
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
253
|
+
className: service_console_module_css_default.setLabel,
|
|
254
|
+
children: tr("settings.gracefulTimeout")
|
|
255
|
+
})
|
|
256
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
257
|
+
className: service_console_module_css_default.setInput,
|
|
258
|
+
type: "number",
|
|
259
|
+
defaultValue: config.gracefulTimeout,
|
|
260
|
+
onBlur: (e) => updateConfig({ gracefulTimeout: parseInt(e.target.value, 10) })
|
|
261
|
+
})]
|
|
262
|
+
}),
|
|
263
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
264
|
+
className: service_console_module_css_default.setRow,
|
|
265
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
266
|
+
className: service_console_module_css_default.setInfo,
|
|
267
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
268
|
+
className: service_console_module_css_default.setLabel,
|
|
269
|
+
children: tr("settings.forceKill")
|
|
270
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
271
|
+
className: service_console_module_css_default.setCap,
|
|
272
|
+
children: tr("settings.forceKill.desc")
|
|
273
|
+
})]
|
|
274
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
275
|
+
type: "button",
|
|
276
|
+
role: "switch",
|
|
277
|
+
"aria-checked": config.forceKill,
|
|
278
|
+
className: service_console_module_css_default.switch,
|
|
279
|
+
onClick: () => updateConfig({ forceKill: !config.forceKill })
|
|
280
|
+
})]
|
|
281
|
+
}),
|
|
282
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
283
|
+
className: service_console_module_css_default.setFooter,
|
|
284
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
285
|
+
type: "button",
|
|
286
|
+
className: service_console_module_css_default.prevBtn,
|
|
287
|
+
onClick: () => updateConfig({
|
|
288
|
+
gracefulTimeout: 3e3,
|
|
289
|
+
forceKill: false
|
|
290
|
+
}),
|
|
291
|
+
children: tr("settings.restore")
|
|
292
|
+
})
|
|
293
|
+
}),
|
|
294
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
295
|
+
className: service_console_module_css_default.setNote,
|
|
296
|
+
children: tr("settings.note")
|
|
297
|
+
})
|
|
231
298
|
]
|
|
232
299
|
});
|
|
233
300
|
}
|
|
234
301
|
function ServiceConsolePanel() {
|
|
235
|
-
const [
|
|
236
|
-
const [
|
|
302
|
+
const [on, setOn] = react.useState(store.open);
|
|
303
|
+
const [shown, setShown] = react.useState(false);
|
|
304
|
+
const [closing, setClosing] = react.useState(false);
|
|
305
|
+
const [rect, setRect] = react.useState({
|
|
306
|
+
top: 48,
|
|
307
|
+
height: 480
|
|
308
|
+
});
|
|
309
|
+
const [tab, setTab] = react.useState("services");
|
|
237
310
|
const [query, setQuery] = react.useState("");
|
|
238
|
-
const [showConfig, setShowConfig] = react.useState(false);
|
|
239
|
-
const [configData, setConfigData] = react.useState(null);
|
|
240
311
|
const [view, setView] = react.useState({
|
|
241
312
|
phase: "idle",
|
|
242
313
|
at: null,
|
|
@@ -246,13 +317,50 @@ window.__ModuleLoader__.load({
|
|
|
246
317
|
const [confirming, setConfirming] = react.useState(null);
|
|
247
318
|
const [opResult, setOpResult] = react.useState(null);
|
|
248
319
|
const [expanded, setExpanded] = react.useState(null);
|
|
320
|
+
const [config, setConfig] = react.useState(null);
|
|
321
|
+
const [, setLangTick] = react.useState(0);
|
|
249
322
|
const timeoutRef = react.useRef(null);
|
|
250
|
-
react.useEffect(() =>
|
|
251
|
-
react.useEffect(() => localeCtx?.subscribe(() =>
|
|
323
|
+
react.useEffect(() => subscribeOpen(setOn), []);
|
|
324
|
+
react.useEffect(() => localeCtx?.subscribe(() => setLangTick((n) => n + 1)), []);
|
|
325
|
+
react.useEffect(() => {
|
|
326
|
+
if (on) {
|
|
327
|
+
setClosing(false);
|
|
328
|
+
setShown(false);
|
|
329
|
+
const raf = requestAnimationFrame(() => setShown(true));
|
|
330
|
+
return () => cancelAnimationFrame(raf);
|
|
331
|
+
}
|
|
332
|
+
setShown(false);
|
|
333
|
+
setClosing(true);
|
|
334
|
+
const t = setTimeout(() => setClosing(false), 200);
|
|
335
|
+
return () => clearTimeout(t);
|
|
336
|
+
}, [on]);
|
|
337
|
+
react.useEffect(() => {
|
|
338
|
+
const onKey = (e) => {
|
|
339
|
+
if (e.key === "Escape") closePanel();
|
|
340
|
+
};
|
|
341
|
+
document.addEventListener("keydown", onKey);
|
|
342
|
+
return () => document.removeEventListener("keydown", onKey);
|
|
343
|
+
}, []);
|
|
344
|
+
react.useEffect(() => {
|
|
345
|
+
const update = () => setRect(measurePopup());
|
|
346
|
+
update();
|
|
347
|
+
const ro = new ResizeObserver(update);
|
|
348
|
+
const header = document.querySelector("[data-slot=\"conversation.session.header\"]");
|
|
349
|
+
const composer = document.querySelector("[data-composer-card]");
|
|
350
|
+
if (header) ro.observe(header);
|
|
351
|
+
if (composer) ro.observe(composer);
|
|
352
|
+
window.addEventListener("resize", update);
|
|
353
|
+
return () => {
|
|
354
|
+
ro.disconnect();
|
|
355
|
+
window.removeEventListener("resize", update);
|
|
356
|
+
};
|
|
357
|
+
}, []);
|
|
252
358
|
react.useEffect(() => () => {
|
|
253
359
|
timeoutRef.current?.();
|
|
254
360
|
}, []);
|
|
255
|
-
|
|
361
|
+
react.useEffect(() => {
|
|
362
|
+
api("config", {}).then((res) => setConfig(res?.data?.config ?? null)).catch(() => {});
|
|
363
|
+
}, []);
|
|
256
364
|
const scan = react.useCallback(() => {
|
|
257
365
|
const at = (/* @__PURE__ */ new Date()).toLocaleTimeString();
|
|
258
366
|
setView((v) => ({
|
|
@@ -290,17 +398,14 @@ window.__ModuleLoader__.load({
|
|
|
290
398
|
});
|
|
291
399
|
});
|
|
292
400
|
}, []);
|
|
293
|
-
const loadConfig = react.useCallback(() => {
|
|
294
|
-
api("config", {}).then((res) => setConfigData(res?.data?.config ?? null)).catch(() => setConfigData(null));
|
|
295
|
-
}, []);
|
|
296
401
|
react.useEffect(() => {
|
|
297
|
-
if (
|
|
402
|
+
if (on && view.phase === "idle") scan();
|
|
298
403
|
}, [
|
|
299
|
-
|
|
404
|
+
on,
|
|
300
405
|
scan,
|
|
301
406
|
view.phase
|
|
302
407
|
]);
|
|
303
|
-
if (!
|
|
408
|
+
if (!on && !closing) return null;
|
|
304
409
|
const runAction = (svc, action) => {
|
|
305
410
|
setConfirming({
|
|
306
411
|
id: svc.id,
|
|
@@ -314,15 +419,14 @@ window.__ModuleLoader__.load({
|
|
|
314
419
|
if (res?.ok) setOpResult({
|
|
315
420
|
id: svc.id,
|
|
316
421
|
ok: true,
|
|
317
|
-
text: action === "stop" ?
|
|
422
|
+
text: action === "stop" ? tr("result.stopped") : tr("result.restarted")
|
|
318
423
|
});
|
|
319
424
|
else {
|
|
320
425
|
const code = res?.error?.code ?? "";
|
|
321
|
-
const msg = res?.error?.message ?? "";
|
|
322
426
|
setOpResult({
|
|
323
427
|
id: svc.id,
|
|
324
428
|
ok: false,
|
|
325
|
-
text:
|
|
429
|
+
text: tr("err." + code) || res?.error?.message || tr("result.error")
|
|
326
430
|
});
|
|
327
431
|
}
|
|
328
432
|
scan();
|
|
@@ -332,328 +436,578 @@ window.__ModuleLoader__.load({
|
|
|
332
436
|
text: "RPC error"
|
|
333
437
|
}));
|
|
334
438
|
};
|
|
335
|
-
const setConfig = (patch) => {
|
|
336
|
-
api("config", {
|
|
337
|
-
action: "update",
|
|
338
|
-
patch
|
|
339
|
-
}).then((res) => {
|
|
340
|
-
if (res?.data) setConfigData(res.data.config);
|
|
341
|
-
}).catch(() => void 0);
|
|
342
|
-
};
|
|
343
439
|
let rows = view.data?.services ?? [];
|
|
344
440
|
if (query) {
|
|
345
|
-
const q =
|
|
346
|
-
rows = rows.filter((s) => s.name.toLowerCase().
|
|
441
|
+
const q = query.toLowerCase();
|
|
442
|
+
rows = rows.filter((s) => s.name.toLowerCase().includes(q) || String(s.pid).includes(q) || (s.commandSummary ?? "").toLowerCase().includes(q) || (s.cwd ?? "").toLowerCase().includes(q) || s.listeners.some((l) => String(l.port).includes(q)));
|
|
347
443
|
}
|
|
348
|
-
const
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
view.at
|
|
355
|
-
]
|
|
356
|
-
}) : view.phase === "done" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
357
|
-
className: service_console_module_css_default.status,
|
|
358
|
-
children: [
|
|
359
|
-
"● ",
|
|
360
|
-
String(rows.length),
|
|
361
|
-
" ",
|
|
362
|
-
T.servicesFound,
|
|
363
|
-
" · ",
|
|
364
|
-
T.lastScan,
|
|
365
|
-
": ",
|
|
366
|
-
view.at
|
|
367
|
-
]
|
|
368
|
-
}) : view.phase === "error" || view.phase === "timeout" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
369
|
-
className: service_console_module_css_default.err,
|
|
370
|
-
children: ["⛔ ", view.err]
|
|
371
|
-
}) : null;
|
|
372
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
373
|
-
className: service_console_module_css_default.panel,
|
|
374
|
-
children: [
|
|
375
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
376
|
-
className: service_console_module_css_default.header,
|
|
377
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
378
|
-
className: service_console_module_css_default.titleBlock,
|
|
379
|
-
children: [
|
|
380
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
381
|
-
className: service_console_module_css_default.eyebrow,
|
|
382
|
-
children: "DSH / LOCAL RUNTIME"
|
|
383
|
-
}),
|
|
384
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: T.title }),
|
|
385
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
386
|
-
className: service_console_module_css_default.subtitle,
|
|
387
|
-
children: T.subtitle
|
|
388
|
-
})
|
|
389
|
-
]
|
|
390
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
391
|
-
className: service_console_module_css_default.headerActions,
|
|
392
|
-
children: [
|
|
393
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
394
|
-
className: service_console_module_css_default.iconBtn,
|
|
395
|
-
onClick: () => {
|
|
396
|
-
setShowConfig(!showConfig);
|
|
397
|
-
if (!showConfig) loadConfig();
|
|
398
|
-
},
|
|
399
|
-
"aria-label": T.config,
|
|
400
|
-
children: "⚙"
|
|
401
|
-
}),
|
|
402
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
403
|
-
className: service_console_module_css_default.iconBtn,
|
|
404
|
-
onClick: scan,
|
|
405
|
-
"aria-label": "Refresh",
|
|
406
|
-
children: "↻"
|
|
407
|
-
}),
|
|
408
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
409
|
-
className: service_console_module_css_default.closeBtn,
|
|
410
|
-
onClick: () => setOpen(false),
|
|
411
|
-
"aria-label": T.closePanel,
|
|
412
|
-
children: "×"
|
|
413
|
-
})
|
|
414
|
-
]
|
|
415
|
-
})]
|
|
416
|
-
}),
|
|
417
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
418
|
-
className: service_console_module_css_default.scopeLine,
|
|
419
|
-
children: [
|
|
420
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: service_console_module_css_default.liveDot }),
|
|
421
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: T.allLocal }),
|
|
422
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
423
|
-
className: service_console_module_css_default.scopeHint,
|
|
424
|
-
children: ["· ", T.subtitle]
|
|
425
|
-
}),
|
|
426
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: service_console_module_css_default.spacer })
|
|
427
|
-
]
|
|
428
|
-
}),
|
|
429
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
430
|
-
className: `${service_console_module_css_default.input} ${service_console_module_css_default.search}`,
|
|
431
|
-
placeholder: T.search,
|
|
444
|
+
const servicesBody = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
445
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
446
|
+
className: service_console_module_css_default.filterRow,
|
|
447
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
448
|
+
className: service_console_module_css_default.filter,
|
|
449
|
+
type: "text",
|
|
432
450
|
value: query,
|
|
451
|
+
placeholder: tr("search.ph"),
|
|
433
452
|
onChange: (e) => setQuery(e.target.value)
|
|
434
|
-
}),
|
|
435
|
-
|
|
436
|
-
className: service_console_module_css_default.
|
|
453
|
+
}), query !== "" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
454
|
+
type: "button",
|
|
455
|
+
className: service_console_module_css_default.filterClear,
|
|
456
|
+
onClick: () => setQuery(""),
|
|
457
|
+
title: tr("action.cancel"),
|
|
458
|
+
"aria-label": tr("action.cancel"),
|
|
459
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
460
|
+
viewBox: "0 0 16 16",
|
|
461
|
+
width: 12,
|
|
462
|
+
height: 12,
|
|
463
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
464
|
+
d: "M4 4l8 8M12 4l-8 8",
|
|
465
|
+
fill: "none",
|
|
466
|
+
stroke: "currentColor",
|
|
467
|
+
strokeWidth: 1.5,
|
|
468
|
+
strokeLinecap: "round"
|
|
469
|
+
})
|
|
470
|
+
})
|
|
471
|
+
}) : null]
|
|
472
|
+
}),
|
|
473
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
474
|
+
className: service_console_module_css_default.hintLine,
|
|
475
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: service_console_module_css_default.liveDot }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: tr("panel.subtitle") })]
|
|
476
|
+
}),
|
|
477
|
+
view.phase === "scanning" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
478
|
+
className: service_console_module_css_default.note,
|
|
479
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: service_console_module_css_default.spin }), tr("status.scanning")]
|
|
480
|
+
}) : view.phase === "error" || view.phase === "timeout" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
481
|
+
className: service_console_module_css_default.noteErr,
|
|
482
|
+
children: [
|
|
483
|
+
tr("status.error"),
|
|
484
|
+
": ",
|
|
485
|
+
view.err
|
|
486
|
+
]
|
|
487
|
+
}) : null,
|
|
488
|
+
(view.data?.partialWarnings ?? []).map((w, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
489
|
+
className: service_console_module_css_default.noteWarn,
|
|
490
|
+
children: ["⚠ ", w]
|
|
491
|
+
}, `w${i}`)),
|
|
492
|
+
rows.length === 0 && view.phase === "done" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
493
|
+
className: service_console_module_css_default.empty,
|
|
494
|
+
children: tr("svc.noSvc")
|
|
495
|
+
}) : rows.map((svc) => {
|
|
496
|
+
const badgeColor = OWNERSHIP_COLOR[svc.ownership] ?? OWNERSHIP_COLOR.unknown;
|
|
497
|
+
const badgeKey = OWNERSHIP_KEY[svc.ownership] ?? "own.unknown";
|
|
498
|
+
const ports = svc.listeners.map((l) => String(l.port)).join(", ");
|
|
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";
|
|
501
|
+
const isConfirming = confirming?.id === svc.id;
|
|
502
|
+
const result = opResult?.id === svc.id ? opResult : null;
|
|
503
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
504
|
+
className: service_console_module_css_default.row,
|
|
437
505
|
children: [
|
|
438
506
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
439
|
-
className: service_console_module_css_default.
|
|
440
|
-
children: [
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
507
|
+
className: service_console_module_css_default.rowMain,
|
|
508
|
+
children: [
|
|
509
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
510
|
+
className: service_console_module_css_default.rowDot,
|
|
511
|
+
style: { color: badgeColor },
|
|
512
|
+
children: "●"
|
|
513
|
+
}),
|
|
514
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
515
|
+
className: service_console_module_css_default.rowName,
|
|
516
|
+
children: svc.name
|
|
517
|
+
}),
|
|
518
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
519
|
+
className: service_console_module_css_default.rowMeta,
|
|
520
|
+
children: [
|
|
521
|
+
":",
|
|
522
|
+
ports,
|
|
523
|
+
" · pid ",
|
|
524
|
+
svc.pid
|
|
525
|
+
]
|
|
526
|
+
}),
|
|
527
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
528
|
+
className: service_console_module_css_default.badge,
|
|
529
|
+
style: { color: badgeColor },
|
|
530
|
+
children: tr(badgeKey)
|
|
531
|
+
}),
|
|
532
|
+
svc.restartable ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
533
|
+
className: service_console_module_css_default.badge,
|
|
534
|
+
style: { color: "var(--dsw-alias-state-success-primary, #4ade80)" },
|
|
535
|
+
children: "↻"
|
|
536
|
+
}) : null,
|
|
537
|
+
url ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
|
|
538
|
+
className: service_console_module_css_default.rowAct,
|
|
539
|
+
href: url,
|
|
540
|
+
target: "_blank",
|
|
541
|
+
rel: "noreferrer",
|
|
542
|
+
title: url,
|
|
543
|
+
onClick: (e) => e.stopPropagation(),
|
|
544
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
545
|
+
viewBox: "0 0 16 16",
|
|
546
|
+
width: 12,
|
|
547
|
+
height: 12,
|
|
548
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
549
|
+
d: "M6.5 3.5h-3a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1v-3M9 2.5h4.5V7M13.5 2.5L7.5 8.5",
|
|
550
|
+
fill: "none",
|
|
551
|
+
stroke: "currentColor",
|
|
552
|
+
strokeWidth: 1.3,
|
|
553
|
+
strokeLinecap: "round",
|
|
554
|
+
strokeLinejoin: "round"
|
|
555
|
+
})
|
|
556
|
+
})
|
|
557
|
+
}) : null,
|
|
558
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: service_console_module_css_default.spacer }),
|
|
559
|
+
canControl ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
560
|
+
type: "button",
|
|
561
|
+
className: service_console_module_css_default.rowBtn,
|
|
562
|
+
onClick: (e) => {
|
|
563
|
+
e.stopPropagation();
|
|
564
|
+
runAction(svc, "stop");
|
|
565
|
+
},
|
|
566
|
+
children: isConfirming && confirming.action === "stop" ? tr("confirm.stop") : tr("action.stop")
|
|
567
|
+
}) : null,
|
|
568
|
+
svc.restartable ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
569
|
+
type: "button",
|
|
570
|
+
className: service_console_module_css_default.rowBtn,
|
|
571
|
+
onClick: (e) => {
|
|
572
|
+
e.stopPropagation();
|
|
573
|
+
runAction(svc, "restart");
|
|
574
|
+
},
|
|
575
|
+
children: isConfirming && confirming.action === "restart" ? tr("confirm.restart") : tr("action.restart")
|
|
576
|
+
}) : null,
|
|
577
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
578
|
+
type: "button",
|
|
579
|
+
className: service_console_module_css_default.rowBtn,
|
|
580
|
+
onClick: (e) => {
|
|
581
|
+
e.stopPropagation();
|
|
582
|
+
setExpanded(expanded === svc.id ? null : svc.id);
|
|
583
|
+
},
|
|
584
|
+
children: expanded === svc.id ? "▾" : tr("action.detail")
|
|
585
|
+
})
|
|
586
|
+
]
|
|
449
587
|
}),
|
|
450
|
-
/* @__PURE__ */ (0, react_jsx_runtime.
|
|
451
|
-
className: service_console_module_css_default.
|
|
452
|
-
children:
|
|
453
|
-
className: service_console_module_css_default.muted,
|
|
454
|
-
children: T.gracefulTimeout
|
|
455
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
456
|
-
className: service_console_module_css_default.input,
|
|
457
|
-
type: "number",
|
|
458
|
-
defaultValue: configData.gracefulTimeout,
|
|
459
|
-
onBlur: (e) => setConfig({ gracefulTimeout: parseInt(e.target.value, 10) })
|
|
460
|
-
})]
|
|
588
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
589
|
+
className: service_console_module_css_default.rowSub,
|
|
590
|
+
children: (svc.commandSummary ? svc.commandSummary.slice(0, 100) : "(?)") + (svc.commandSummary && svc.commandSummary.length > 100 ? "…" : "")
|
|
461
591
|
}),
|
|
462
|
-
/* @__PURE__ */ (0, react_jsx_runtime.
|
|
463
|
-
className: service_console_module_css_default.
|
|
592
|
+
svc.cwd ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
593
|
+
className: service_console_module_css_default.rowSub,
|
|
594
|
+
children: svc.cwd
|
|
595
|
+
}) : null,
|
|
596
|
+
result ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
597
|
+
className: result.ok ? service_console_module_css_default.okText : service_console_module_css_default.errText,
|
|
598
|
+
children: [result.ok ? "✅ " : "⛔ ", result.text]
|
|
599
|
+
}) : null,
|
|
600
|
+
isConfirming ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
601
|
+
className: service_console_module_css_default.confirmRow,
|
|
602
|
+
children: [
|
|
603
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
604
|
+
className: service_console_module_css_default.confirmTxt,
|
|
605
|
+
children: tr("confirm.txt", {
|
|
606
|
+
name: svc.name,
|
|
607
|
+
pid: String(svc.pid),
|
|
608
|
+
action: confirming.action === "stop" ? tr("action.stop") : tr("action.restart")
|
|
609
|
+
})
|
|
610
|
+
}),
|
|
611
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
612
|
+
type: "button",
|
|
613
|
+
className: service_console_module_css_default.confirmOk,
|
|
614
|
+
onClick: () => confirmAction(svc, confirming.action),
|
|
615
|
+
children: tr("action.confirm")
|
|
616
|
+
}),
|
|
617
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
618
|
+
type: "button",
|
|
619
|
+
className: service_console_module_css_default.confirmCancel,
|
|
620
|
+
onClick: () => setConfirming(null),
|
|
621
|
+
children: tr("action.cancel")
|
|
622
|
+
})
|
|
623
|
+
]
|
|
624
|
+
}) : null,
|
|
625
|
+
expanded === svc.id ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
626
|
+
className: service_console_module_css_default.detailBox,
|
|
627
|
+
role: "region",
|
|
628
|
+
"aria-label": tr("detail.title"),
|
|
464
629
|
children: [
|
|
465
|
-
/* @__PURE__ */ (0, react_jsx_runtime.
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
630
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
631
|
+
className: service_console_module_css_default.detailHead,
|
|
632
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: tr("detail.title") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
633
|
+
className: service_console_module_css_default.detailAccent,
|
|
634
|
+
children: tr("detail.serviceRecord")
|
|
635
|
+
})]
|
|
469
636
|
}),
|
|
470
|
-
|
|
471
|
-
|
|
637
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
638
|
+
className: service_console_module_css_default.detailGrid,
|
|
639
|
+
children: [
|
|
640
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
641
|
+
className: service_console_module_css_default.detailLabel,
|
|
642
|
+
children: tr("detail.serviceId")
|
|
643
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", { children: svc.id })] }),
|
|
644
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
645
|
+
className: service_console_module_css_default.detailLabel,
|
|
646
|
+
children: tr("detail.process")
|
|
647
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("code", { children: [
|
|
648
|
+
"PID ",
|
|
649
|
+
svc.pid,
|
|
650
|
+
" · PGID ",
|
|
651
|
+
String(svc.processGroupId ?? "-")
|
|
652
|
+
] })] }),
|
|
653
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
654
|
+
className: service_console_module_css_default.detailLabel,
|
|
655
|
+
children: tr("detail.parent")
|
|
656
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("code", { children: ["PPID ", String(svc.parentPid ?? "-")] })] }),
|
|
657
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
658
|
+
className: service_console_module_css_default.detailLabel,
|
|
659
|
+
children: tr("detail.started")
|
|
660
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", { children: String(svc.startedAt ?? "-") })] })
|
|
661
|
+
]
|
|
662
|
+
}),
|
|
663
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
664
|
+
className: service_console_module_css_default.evidenceBlock,
|
|
665
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
666
|
+
className: service_console_module_css_default.detailLabel,
|
|
667
|
+
children: tr("detail.evidence")
|
|
668
|
+
}), svc.ownershipEvidence.length ? svc.ownershipEvidence.map((ev, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
669
|
+
className: service_console_module_css_default.evidenceItem,
|
|
670
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
671
|
+
className: service_console_module_css_default.evidenceArrow,
|
|
672
|
+
children: "↳"
|
|
673
|
+
}), ev]
|
|
674
|
+
}, i)) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
675
|
+
className: service_console_module_css_default.rowSub,
|
|
676
|
+
children: "—"
|
|
677
|
+
})]
|
|
678
|
+
})
|
|
472
679
|
]
|
|
473
|
-
})
|
|
680
|
+
}) : null
|
|
474
681
|
]
|
|
475
|
-
})
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
const result = opResult?.id === svc.id ? opResult : null;
|
|
491
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
492
|
-
className: service_console_module_css_default.row,
|
|
682
|
+
}, svc.id);
|
|
683
|
+
})
|
|
684
|
+
] });
|
|
685
|
+
const settingsBody = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ServiceConsoleSettings, {});
|
|
686
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
687
|
+
className: service_console_module_css_default.layer,
|
|
688
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
689
|
+
className: service_console_module_css_default.popup + (shown ? " " + service_console_module_css_default.popupOn : ""),
|
|
690
|
+
style: {
|
|
691
|
+
top: rect.top,
|
|
692
|
+
height: rect.height
|
|
693
|
+
},
|
|
694
|
+
children: [
|
|
695
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
696
|
+
className: service_console_module_css_default.head,
|
|
493
697
|
children: [
|
|
494
|
-
/* @__PURE__ */ (0, react_jsx_runtime.
|
|
495
|
-
className: service_console_module_css_default.
|
|
496
|
-
children:
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
children: lang === "zh" ? badge.zh : badge.en
|
|
518
|
-
}),
|
|
519
|
-
svc.restartable ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
520
|
-
className: service_console_module_css_default.badge,
|
|
521
|
-
style: { color: "var(--dsw-alias-state-success-primary, #4ade80)" },
|
|
522
|
-
children: "↻"
|
|
523
|
-
}) : null,
|
|
524
|
-
url ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
|
|
525
|
-
className: service_console_module_css_default.btn,
|
|
526
|
-
href: url,
|
|
527
|
-
target: "_blank",
|
|
528
|
-
rel: "noreferrer",
|
|
529
|
-
children: "🔗"
|
|
530
|
-
}) : null,
|
|
531
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: service_console_module_css_default.spacer }),
|
|
532
|
-
canControl ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
533
|
-
className: service_console_module_css_default.btn,
|
|
534
|
-
onClick: () => runAction(svc, "stop"),
|
|
535
|
-
children: isConfirming && confirming.action === "stop" ? T.confirmStop : T.stop
|
|
536
|
-
}) : null,
|
|
537
|
-
svc.restartable ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
538
|
-
className: service_console_module_css_default.btn,
|
|
539
|
-
onClick: () => runAction(svc, "restart"),
|
|
540
|
-
children: isConfirming && confirming.action === "restart" ? T.confirmRestart : T.restart
|
|
541
|
-
}) : null,
|
|
542
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
543
|
-
className: service_console_module_css_default.btn,
|
|
544
|
-
onClick: () => setExpanded(expanded === svc.id ? null : svc.id),
|
|
545
|
-
children: expanded === svc.id ? "▾" : T.detail
|
|
546
|
-
})
|
|
547
|
-
]
|
|
698
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
699
|
+
className: service_console_module_css_default.headIco,
|
|
700
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
701
|
+
viewBox: "0 0 16 16",
|
|
702
|
+
width: 17,
|
|
703
|
+
height: 17,
|
|
704
|
+
"aria-hidden": "true",
|
|
705
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
|
|
706
|
+
x: 2,
|
|
707
|
+
y: 3,
|
|
708
|
+
width: 12,
|
|
709
|
+
height: 10,
|
|
710
|
+
rx: 1.5,
|
|
711
|
+
fill: "none",
|
|
712
|
+
stroke: "currentColor",
|
|
713
|
+
strokeWidth: 1.3
|
|
714
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
715
|
+
d: "M5 7h6M5 10h4",
|
|
716
|
+
stroke: "currentColor",
|
|
717
|
+
strokeWidth: 1.2,
|
|
718
|
+
strokeLinecap: "round"
|
|
719
|
+
})]
|
|
720
|
+
})
|
|
548
721
|
}),
|
|
549
722
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
550
|
-
className: service_console_module_css_default.
|
|
551
|
-
children: (
|
|
723
|
+
className: service_console_module_css_default.headTitle,
|
|
724
|
+
children: tr("panel.title")
|
|
552
725
|
}),
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
children:
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
className: service_console_module_css_default.btn,
|
|
570
|
-
style: { color: "var(--dsw-alias-state-error-primary, #f87171)" },
|
|
571
|
-
onClick: () => confirmAction(svc, confirming.action),
|
|
572
|
-
children: T.ok
|
|
573
|
-
}),
|
|
574
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
575
|
-
className: service_console_module_css_default.btn,
|
|
576
|
-
onClick: () => setConfirming(null),
|
|
577
|
-
children: T.cancel
|
|
726
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
727
|
+
type: "button",
|
|
728
|
+
className: service_console_module_css_default.icoBtn,
|
|
729
|
+
onClick: scan,
|
|
730
|
+
title: tr("status.lastScan"),
|
|
731
|
+
"aria-label": tr("status.lastScan"),
|
|
732
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
733
|
+
viewBox: "0 0 16 16",
|
|
734
|
+
width: 14,
|
|
735
|
+
height: 14,
|
|
736
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
737
|
+
d: "M13.5 8a5.5 5.5 0 1 1-1.61-3.89M13.5 1.5v3h-3",
|
|
738
|
+
fill: "none",
|
|
739
|
+
stroke: "currentColor",
|
|
740
|
+
strokeWidth: 1.5,
|
|
741
|
+
strokeLinecap: "round"
|
|
578
742
|
})
|
|
579
|
-
|
|
580
|
-
})
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
className: service_console_module_css_default.detailLabel,
|
|
598
|
-
children: "SERVICE ID"
|
|
599
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", { children: svc.id })] }),
|
|
600
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
601
|
-
className: service_console_module_css_default.detailLabel,
|
|
602
|
-
children: "PROCESS"
|
|
603
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("code", { children: [
|
|
604
|
-
"PID ",
|
|
605
|
-
svc.pid,
|
|
606
|
-
" · PGID ",
|
|
607
|
-
String(svc.processGroupId ?? "-")
|
|
608
|
-
] })] }),
|
|
609
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
610
|
-
className: service_console_module_css_default.detailLabel,
|
|
611
|
-
children: "PARENT"
|
|
612
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("code", { children: ["PPID ", String(svc.parentPid ?? "-")] })] }),
|
|
613
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
614
|
-
className: service_console_module_css_default.detailLabel,
|
|
615
|
-
children: "STARTED"
|
|
616
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", { children: String(svc.startedAt ?? "-") })] })
|
|
617
|
-
]
|
|
618
|
-
}),
|
|
619
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
620
|
-
className: service_console_module_css_default.evidenceBlock,
|
|
621
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
622
|
-
className: service_console_module_css_default.detailLabel,
|
|
623
|
-
children: T.evidence
|
|
624
|
-
}), svc.ownershipEvidence.length ? svc.ownershipEvidence.map((ev, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
625
|
-
className: service_console_module_css_default.evidenceItem,
|
|
626
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: "↳" }), ev]
|
|
627
|
-
}, i)) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
628
|
-
className: service_console_module_css_default.muted,
|
|
629
|
-
children: "—"
|
|
630
|
-
})]
|
|
743
|
+
})
|
|
744
|
+
}),
|
|
745
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
746
|
+
type: "button",
|
|
747
|
+
className: service_console_module_css_default.icoBtn,
|
|
748
|
+
onClick: closePanel,
|
|
749
|
+
title: tr("action.cancel"),
|
|
750
|
+
"aria-label": tr("action.cancel"),
|
|
751
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
752
|
+
viewBox: "0 0 16 16",
|
|
753
|
+
width: 14,
|
|
754
|
+
height: 14,
|
|
755
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
756
|
+
d: "M4 4l8 8M12 4l-8 8",
|
|
757
|
+
fill: "none",
|
|
758
|
+
stroke: "currentColor",
|
|
759
|
+
strokeWidth: 1.5,
|
|
760
|
+
strokeLinecap: "round"
|
|
631
761
|
})
|
|
632
|
-
|
|
633
|
-
})
|
|
762
|
+
})
|
|
763
|
+
})
|
|
634
764
|
]
|
|
635
|
-
},
|
|
636
|
-
|
|
637
|
-
|
|
765
|
+
}),
|
|
766
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
767
|
+
className: service_console_module_css_default.tabs,
|
|
768
|
+
role: "tablist",
|
|
769
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
770
|
+
type: "button",
|
|
771
|
+
role: "tab",
|
|
772
|
+
"aria-selected": tab === "services",
|
|
773
|
+
className: service_console_module_css_default.tab + (tab === "services" ? " " + service_console_module_css_default.tabOn : ""),
|
|
774
|
+
onClick: () => setTab("services"),
|
|
775
|
+
children: [
|
|
776
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
777
|
+
viewBox: "0 0 16 16",
|
|
778
|
+
width: 13,
|
|
779
|
+
height: 13,
|
|
780
|
+
"aria-hidden": "true",
|
|
781
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
|
|
782
|
+
x: 2,
|
|
783
|
+
y: 3,
|
|
784
|
+
width: 12,
|
|
785
|
+
height: 10,
|
|
786
|
+
rx: 1.5,
|
|
787
|
+
fill: "none",
|
|
788
|
+
stroke: "currentColor",
|
|
789
|
+
strokeWidth: 1.3
|
|
790
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
791
|
+
d: "M5 7h6M5 10h4",
|
|
792
|
+
stroke: "currentColor",
|
|
793
|
+
strokeWidth: 1.2,
|
|
794
|
+
strokeLinecap: "round"
|
|
795
|
+
})]
|
|
796
|
+
}),
|
|
797
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: tr("tab.services") }),
|
|
798
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: service_console_module_css_default.tabInd })
|
|
799
|
+
]
|
|
800
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
801
|
+
type: "button",
|
|
802
|
+
role: "tab",
|
|
803
|
+
"aria-selected": tab === "settings",
|
|
804
|
+
className: service_console_module_css_default.tab + (tab === "settings" ? " " + service_console_module_css_default.tabOn : ""),
|
|
805
|
+
onClick: () => setTab("settings"),
|
|
806
|
+
children: [
|
|
807
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
808
|
+
viewBox: "0 0 16 16",
|
|
809
|
+
width: 13,
|
|
810
|
+
height: 13,
|
|
811
|
+
"aria-hidden": "true",
|
|
812
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
|
|
813
|
+
cx: 8,
|
|
814
|
+
cy: 8,
|
|
815
|
+
r: 2.5,
|
|
816
|
+
fill: "none",
|
|
817
|
+
stroke: "currentColor",
|
|
818
|
+
strokeWidth: 1.3
|
|
819
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
820
|
+
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",
|
|
821
|
+
fill: "none",
|
|
822
|
+
stroke: "currentColor",
|
|
823
|
+
strokeWidth: 1.2,
|
|
824
|
+
strokeLinecap: "round"
|
|
825
|
+
})]
|
|
826
|
+
}),
|
|
827
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: tr("tab.settings") }),
|
|
828
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: service_console_module_css_default.tabInd })
|
|
829
|
+
]
|
|
830
|
+
})]
|
|
831
|
+
}),
|
|
832
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
833
|
+
className: service_console_module_css_default.tabBody,
|
|
834
|
+
children: tab === "services" ? servicesBody : settingsBody
|
|
835
|
+
})
|
|
836
|
+
]
|
|
837
|
+
})
|
|
638
838
|
});
|
|
639
839
|
}
|
|
640
840
|
//#endregion
|
|
841
|
+
//#region src/client/dictionaries.ts
|
|
842
|
+
/**
|
|
843
|
+
* dsh-service-console — i18n 词典(对齐 DSH locale.register 机制)
|
|
844
|
+
* 与 dsh-workspace-explorer 共享设计语言:flat key → template string with {vars}
|
|
845
|
+
*/
|
|
846
|
+
const ZH_DICT = {
|
|
847
|
+
"panel.title": "Service Console",
|
|
848
|
+
"panel.subtitle": "本机监听服务",
|
|
849
|
+
"entry.label": "服务",
|
|
850
|
+
"entry.tip": "服务控制台",
|
|
851
|
+
"search.ph": "搜索服务、端口或路径…",
|
|
852
|
+
"status.scanning": "正在扫描…",
|
|
853
|
+
"status.done": "{n} 项服务",
|
|
854
|
+
"status.lastScan": "最近扫描",
|
|
855
|
+
"status.error": "扫描失败",
|
|
856
|
+
"svc.noSvc": "未发现服务",
|
|
857
|
+
"svc.ports": "端口",
|
|
858
|
+
"svc.pid": "pid",
|
|
859
|
+
"svc.command": "命令",
|
|
860
|
+
"svc.cwd": "工作目录",
|
|
861
|
+
"action.stop": "停止",
|
|
862
|
+
"action.restart": "重启",
|
|
863
|
+
"action.detail": "详情",
|
|
864
|
+
"action.confirm": "确认",
|
|
865
|
+
"action.cancel": "取消",
|
|
866
|
+
"confirm.stop": "确认停止?",
|
|
867
|
+
"confirm.restart": "确认重启?",
|
|
868
|
+
"confirm.txt": "确认对 {name} (pid {pid}) 执行 {action}?",
|
|
869
|
+
"result.stopped": "已停止",
|
|
870
|
+
"result.restarted": "已重启",
|
|
871
|
+
"result.error": "操作失败",
|
|
872
|
+
"own.conversation": "本次对话",
|
|
873
|
+
"own.workspace": "工作区推断",
|
|
874
|
+
"own.other": "本机其他",
|
|
875
|
+
"own.unknown": "未知",
|
|
876
|
+
"own.protected": "受保护",
|
|
877
|
+
"detail.title": "详情",
|
|
878
|
+
"detail.serviceRecord": "SERVICE RECORD",
|
|
879
|
+
"detail.serviceId": "SERVICE ID",
|
|
880
|
+
"detail.process": "PROCESS",
|
|
881
|
+
"detail.parent": "PARENT",
|
|
882
|
+
"detail.started": "STARTED",
|
|
883
|
+
"detail.evidence": "归属证据",
|
|
884
|
+
"err.PERMISSION_DENIED": "没有权限读取或控制该服务",
|
|
885
|
+
"err.TARGET_GONE": "该服务已结束",
|
|
886
|
+
"err.PID_REUSED": "进程身份已变化,已取消操作",
|
|
887
|
+
"err.UNKNOWN_OWNERSHIP": "无法确认来源,不允许控制",
|
|
888
|
+
"err.PROTECTED_PROCESS": "受保护进程,不能操作",
|
|
889
|
+
"err.GRACEFUL_TIMEOUT": "未在等待时间内退出",
|
|
890
|
+
"err.RESTART_UNSAFE": "缺少安全启动信息,不能重启",
|
|
891
|
+
"err.PORT_CONFLICT": "端口仍被占用",
|
|
892
|
+
"err.START_TIMEOUT": "未在预期时间开始监听",
|
|
893
|
+
"tab.services": "服务",
|
|
894
|
+
"tab.settings": "设置",
|
|
895
|
+
"settings.title": "面板设置",
|
|
896
|
+
"settings.general": "通用",
|
|
897
|
+
"settings.gracefulTimeout": "优雅超时 (ms)",
|
|
898
|
+
"settings.forceKill": "允许强制终止",
|
|
899
|
+
"settings.forceKill.desc": "优雅超时后发送 SIGKILL",
|
|
900
|
+
"settings.restore": "恢复默认",
|
|
901
|
+
"settings.note": "配置在本次会话内生效,重启插件后恢复默认。",
|
|
902
|
+
"settings.nav": "Service Console"
|
|
903
|
+
};
|
|
904
|
+
const EN_DICT = {
|
|
905
|
+
"panel.title": "Service Console",
|
|
906
|
+
"panel.subtitle": "Listening services on this machine",
|
|
907
|
+
"entry.label": "Services",
|
|
908
|
+
"entry.tip": "Service Console",
|
|
909
|
+
"search.ph": "Search services, ports, or paths…",
|
|
910
|
+
"status.scanning": "Scanning…",
|
|
911
|
+
"status.done": "{n} services",
|
|
912
|
+
"status.lastScan": "Last scan",
|
|
913
|
+
"status.error": "Scan failed",
|
|
914
|
+
"svc.noSvc": "no services found",
|
|
915
|
+
"svc.ports": "Ports",
|
|
916
|
+
"svc.pid": "pid",
|
|
917
|
+
"svc.command": "Command",
|
|
918
|
+
"svc.cwd": "Working dir",
|
|
919
|
+
"action.stop": "Stop",
|
|
920
|
+
"action.restart": "Restart",
|
|
921
|
+
"action.detail": "Detail",
|
|
922
|
+
"action.confirm": "OK",
|
|
923
|
+
"action.cancel": "Cancel",
|
|
924
|
+
"confirm.stop": "Confirm stop?",
|
|
925
|
+
"confirm.restart": "Confirm restart?",
|
|
926
|
+
"confirm.txt": "Run {action} on {name} (pid {pid})?",
|
|
927
|
+
"result.stopped": "Stopped",
|
|
928
|
+
"result.restarted": "Restarted",
|
|
929
|
+
"result.error": "Action failed",
|
|
930
|
+
"own.conversation": "This chat",
|
|
931
|
+
"own.workspace": "Workspace",
|
|
932
|
+
"own.other": "Other local",
|
|
933
|
+
"own.unknown": "Unknown",
|
|
934
|
+
"own.protected": "Protected",
|
|
935
|
+
"detail.title": "Detail",
|
|
936
|
+
"detail.serviceRecord": "SERVICE RECORD",
|
|
937
|
+
"detail.serviceId": "SERVICE ID",
|
|
938
|
+
"detail.process": "PROCESS",
|
|
939
|
+
"detail.parent": "PARENT",
|
|
940
|
+
"detail.started": "STARTED",
|
|
941
|
+
"detail.evidence": "Ownership evidence",
|
|
942
|
+
"err.PERMISSION_DENIED": "No permission",
|
|
943
|
+
"err.TARGET_GONE": "Service gone",
|
|
944
|
+
"err.PID_REUSED": "PID reused",
|
|
945
|
+
"err.UNKNOWN_OWNERSHIP": "Unknown ownership",
|
|
946
|
+
"err.PROTECTED_PROCESS": "Protected process",
|
|
947
|
+
"err.GRACEFUL_TIMEOUT": "Graceful timeout",
|
|
948
|
+
"err.RESTART_UNSAFE": "Cannot restart safely",
|
|
949
|
+
"err.PORT_CONFLICT": "Port conflict",
|
|
950
|
+
"err.START_TIMEOUT": "Start timeout",
|
|
951
|
+
"tab.services": "Services",
|
|
952
|
+
"tab.settings": "Settings",
|
|
953
|
+
"settings.title": "Panel settings",
|
|
954
|
+
"settings.general": "General",
|
|
955
|
+
"settings.gracefulTimeout": "Graceful timeout (ms)",
|
|
956
|
+
"settings.forceKill": "Allow force kill",
|
|
957
|
+
"settings.forceKill.desc": "Send SIGKILL after graceful timeout",
|
|
958
|
+
"settings.restore": "Reset to defaults",
|
|
959
|
+
"settings.note": "Settings apply for this run; they reset when the plugin restarts.",
|
|
960
|
+
"settings.nav": "Service Console"
|
|
961
|
+
};
|
|
962
|
+
//#endregion
|
|
963
|
+
//#region src/client/index.tsx
|
|
964
|
+
/**
|
|
965
|
+
* dsh-service-console — Client 入口(原生包 v2)
|
|
966
|
+
*
|
|
967
|
+
* 架构对齐 dsh-workspace-explorer:
|
|
968
|
+
* - 通过 locale.register + locale.bind 实现国际化(而非硬编码 TEXTS)
|
|
969
|
+
* - 通过 webServer JSON 路由调用 Host(fetch 直连,不走 host.call / LLM)
|
|
970
|
+
* - 注册 DSH 设置壳的 settings.section 页
|
|
971
|
+
* - 注册 shell.overlay 抽屉面板 + header 入口按钮
|
|
972
|
+
*/
|
|
973
|
+
const NS = "dsh-service-console";
|
|
974
|
+
//#endregion
|
|
641
975
|
module.exports = {
|
|
642
976
|
inject: ["slots", "timer"],
|
|
643
977
|
apply(ctx) {
|
|
644
978
|
bindTimer(ctx.timer);
|
|
645
|
-
const locale = ctx.get("locale");
|
|
646
|
-
if (locale) bindLocale(locale);
|
|
647
979
|
const slots = ctx.get("slots");
|
|
648
980
|
if (slots === void 0) return;
|
|
981
|
+
const locale = ctx.get("locale");
|
|
982
|
+
if (locale !== void 0) try {
|
|
983
|
+
ctx.effect(() => {
|
|
984
|
+
const d1 = locale.register(NS, "zh", ZH_DICT);
|
|
985
|
+
const d2 = locale.register(NS, "en", EN_DICT);
|
|
986
|
+
return () => {
|
|
987
|
+
d1();
|
|
988
|
+
d2();
|
|
989
|
+
};
|
|
990
|
+
});
|
|
991
|
+
bindLocale(locale);
|
|
992
|
+
} catch (err) {
|
|
993
|
+
console.warn("[dsh-sc] locale init failed, fallback zh", String(err));
|
|
994
|
+
}
|
|
649
995
|
slots.inject("conversation.session.header.utilities", () => slots.register({
|
|
650
996
|
name: "conversation.session.header.utilities",
|
|
651
|
-
id: "
|
|
997
|
+
id: "dsh-service-console",
|
|
998
|
+
order: 25,
|
|
999
|
+
label: () => "Service Console"
|
|
652
1000
|
}, () => react.createElement(ServiceConsoleEntry)));
|
|
653
1001
|
slots.inject("shell.overlay", () => slots.register({
|
|
654
1002
|
name: "shell.overlay",
|
|
655
|
-
id: "
|
|
1003
|
+
id: "dsh-service-console-panel"
|
|
656
1004
|
}, () => react.createElement(ServiceConsolePanel)));
|
|
1005
|
+
slots.inject("settings.section", () => slots.register({
|
|
1006
|
+
name: "settings.section",
|
|
1007
|
+
id: "dsh-service-console",
|
|
1008
|
+
order: 35,
|
|
1009
|
+
label: () => "Service Console"
|
|
1010
|
+
}, () => react.createElement(ServiceConsoleSettings)));
|
|
657
1011
|
}
|
|
658
1012
|
};
|
|
659
1013
|
return module.exports;
|