@jiyr0119/dsh-service-console 0.7.1 → 0.7.2

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/dsh.plugin.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "id": "dsh-external/dsh-service-console",
3
- "version": "0.7.1",
3
+ "version": "0.7.2",
4
4
  "main": "./lib/index.js",
5
5
  "description": "本地开发服务控制台:发现监听端口,识别服务归属,安全查看/停止/重启。Local development service console for DSH.",
6
6
  "engines": {
@@ -0,0 +1,158 @@
1
+ //#region src/client/dictionaries.ts
2
+ /**
3
+ * dsh-service-console — i18n 词典(对齐 DSH locale.register 机制)
4
+ * 与 dsh-workspace-explorer 共享设计语言:flat key → template string with {vars}
5
+ *
6
+ * 类型化:ZH_DICT 的键集是词典权威(ConsoleKey);EN_DICT 必须同键集
7
+ * (satisfies Record<ConsoleKey, string> —— 缺键/多键都是编译错误)。
8
+ */
9
+ const ZH_DICT = {
10
+ "plugin.name": "服务控制台",
11
+ "panel.title": "Service Console",
12
+ "panel.subtitle": "本机监听服务",
13
+ "entry.label": "服务",
14
+ "entry.tip": "服务控制台",
15
+ "search.ph": "搜索服务、端口或路径…",
16
+ "status.scanning": "正在扫描…",
17
+ "status.done": "{n} 项服务",
18
+ "status.lastScan": "最近扫描",
19
+ "status.error": "扫描失败",
20
+ "svc.noSvc": "未发现服务",
21
+ "svc.ports": "端口",
22
+ "svc.pid": "pid",
23
+ "svc.command": "命令",
24
+ "svc.cwd": "工作目录",
25
+ "action.stop": "停止",
26
+ "action.restart": "重启",
27
+ "action.detail": "详情",
28
+ "action.confirm": "确认",
29
+ "action.cancel": "取消",
30
+ "action.pending": "处理中…",
31
+ "confirm.stop": "确认停止?",
32
+ "confirm.restart": "确认重启?",
33
+ "confirm.txt": "确认对 {name} (pid {pid}) 执行 {action}?",
34
+ "result.stopped": "已停止",
35
+ "result.restarted": "已重启",
36
+ "result.error": "操作失败",
37
+ "own.conversation": "本次对话",
38
+ "own.workspace": "工作区推断",
39
+ "own.other": "本机其他",
40
+ "own.unknown": "未知",
41
+ "own.protected": "受保护",
42
+ "scope.conversation": "本次对话",
43
+ "scope.workspace": "当前工作区",
44
+ "scope.machine": "本机",
45
+ "scope.machineWarn": "本机范围可能影响其他项目的服务",
46
+ "detail.title": "详情",
47
+ "detail.serviceRecord": "SERVICE RECORD",
48
+ "detail.serviceId": "SERVICE ID",
49
+ "detail.process": "PROCESS",
50
+ "detail.parent": "PARENT",
51
+ "detail.started": "STARTED",
52
+ "detail.evidence": "归属证据",
53
+ "err.PERMISSION_DENIED": "没有权限读取或控制该服务",
54
+ "err.TARGET_GONE": "该服务已结束",
55
+ "err.PID_REUSED": "进程身份已变化,已取消操作",
56
+ "err.UNKNOWN_OWNERSHIP": "无法确认来源,不允许控制",
57
+ "err.PROTECTED_PROCESS": "受保护进程,不能操作",
58
+ "err.GRACEFUL_TIMEOUT": "未在等待时间内退出",
59
+ "err.RESTART_UNSAFE": "缺少安全启动信息,不能重启",
60
+ "err.PORT_CONFLICT": "端口仍被占用",
61
+ "err.START_TIMEOUT": "未在预期时间开始监听",
62
+ "tab.services": "服务",
63
+ "tab.settings": "设置",
64
+ "settings.title": "面板设置",
65
+ "settings.general": "通用",
66
+ "settings.refreshInterval": "自动刷新间隔",
67
+ "settings.refresh.desc": "面板打开时定期自动重新扫描",
68
+ "settings.refreshOff": "关闭",
69
+ "settings.refreshN": "{n} 秒",
70
+ "settings.defaultScope": "默认范围",
71
+ "settings.showUnknown": "显示未知服务",
72
+ "settings.showUnknown.desc": "关闭后隐藏归属未知的服务",
73
+ "settings.gracefulTimeout": "优雅超时 (ms)",
74
+ "settings.forceKill": "允许强制终止",
75
+ "settings.forceKill.desc": "优雅超时后发送 SIGKILL",
76
+ "settings.restore": "恢复默认",
77
+ "settings.note": "配置持久保存在 ~/.dsh/plugins/dsh-service-console/config.json。",
78
+ "settings.nav": "Service Console",
79
+ "star.developer": "开发者",
80
+ "star.ask": "⭐ 顺手留颗 Star,作者能高兴一整天",
81
+ "star.cta": "行,给你一颗 Star"
82
+ };
83
+ const EN_DICT = {
84
+ "plugin.name": "Service Console",
85
+ "panel.title": "Service Console",
86
+ "panel.subtitle": "Listening services on this machine",
87
+ "entry.label": "Services",
88
+ "entry.tip": "Service Console",
89
+ "search.ph": "Search services, ports, or paths…",
90
+ "status.scanning": "Scanning…",
91
+ "status.done": "{n} services",
92
+ "status.lastScan": "Last scan",
93
+ "status.error": "Scan failed",
94
+ "svc.noSvc": "no services found",
95
+ "svc.ports": "Ports",
96
+ "svc.pid": "pid",
97
+ "svc.command": "Command",
98
+ "svc.cwd": "Working dir",
99
+ "action.stop": "Stop",
100
+ "action.restart": "Restart",
101
+ "action.detail": "Detail",
102
+ "action.confirm": "OK",
103
+ "action.cancel": "Cancel",
104
+ "action.pending": "Working…",
105
+ "confirm.stop": "Confirm stop?",
106
+ "confirm.restart": "Confirm restart?",
107
+ "confirm.txt": "Run {action} on {name} (pid {pid})?",
108
+ "result.stopped": "Stopped",
109
+ "result.restarted": "Restarted",
110
+ "result.error": "Action failed",
111
+ "own.conversation": "This chat",
112
+ "own.workspace": "Workspace",
113
+ "own.other": "Other local",
114
+ "own.unknown": "Unknown",
115
+ "own.protected": "Protected",
116
+ "scope.conversation": "This chat",
117
+ "scope.workspace": "Workspace",
118
+ "scope.machine": "This machine",
119
+ "scope.machineWarn": "Machine scope may affect services of other projects",
120
+ "detail.title": "Detail",
121
+ "detail.serviceRecord": "SERVICE RECORD",
122
+ "detail.serviceId": "SERVICE ID",
123
+ "detail.process": "PROCESS",
124
+ "detail.parent": "PARENT",
125
+ "detail.started": "STARTED",
126
+ "detail.evidence": "Ownership evidence",
127
+ "err.PERMISSION_DENIED": "No permission",
128
+ "err.TARGET_GONE": "Service gone",
129
+ "err.PID_REUSED": "PID reused",
130
+ "err.UNKNOWN_OWNERSHIP": "Unknown ownership",
131
+ "err.PROTECTED_PROCESS": "Protected process",
132
+ "err.GRACEFUL_TIMEOUT": "Graceful timeout",
133
+ "err.RESTART_UNSAFE": "Cannot restart safely",
134
+ "err.PORT_CONFLICT": "Port conflict",
135
+ "err.START_TIMEOUT": "Start timeout",
136
+ "tab.services": "Services",
137
+ "tab.settings": "Settings",
138
+ "settings.title": "Panel settings",
139
+ "settings.general": "General",
140
+ "settings.refreshInterval": "Auto-refresh interval",
141
+ "settings.refresh.desc": "Re-scan automatically while the panel is open",
142
+ "settings.refreshOff": "Off",
143
+ "settings.refreshN": "{n}s",
144
+ "settings.defaultScope": "Default scope",
145
+ "settings.showUnknown": "Show unknown services",
146
+ "settings.showUnknown.desc": "Hide services with unknown ownership when off",
147
+ "settings.gracefulTimeout": "Graceful timeout (ms)",
148
+ "settings.forceKill": "Allow force kill",
149
+ "settings.forceKill.desc": "Send SIGKILL after graceful timeout",
150
+ "settings.restore": "Reset to defaults",
151
+ "settings.note": "Saved to ~/.dsh/plugins/dsh-service-console/config.json — persists across restarts.",
152
+ "settings.nav": "Service Console",
153
+ "star.developer": "Developer",
154
+ "star.ask": "⭐ Drop a Star if it helped — it makes the author's day",
155
+ "star.cta": "★ Give a Star"
156
+ };
157
+ //#endregion
158
+ export { EN_DICT, ZH_DICT };
@@ -11,7 +11,10 @@ function registerDictionaries(locale, ns, dicts) {
11
11
  try {
12
12
  const off = locale.register(ns, code, dict);
13
13
  if (typeof off === "function") offs.push(off);
14
- } catch {}
14
+ } catch (error) {
15
+ const message = error instanceof Error ? error.message : String(error);
16
+ if (!/already has locale/.test(message)) console.warn("[dsh-service-console] locale.register(" + ns + ", " + code + ") failed:", message);
17
+ }
15
18
  }
16
19
  return () => {
17
20
  for (const off of offs) try {
@@ -55,5 +58,34 @@ function bindTranslator(locale, ns) {
55
58
  }
56
59
  };
57
60
  }
61
+ /**
62
+ * 反应式 i18n 挂载(0.7.2):等 locale 服务真正可用后再注册/绑定。
63
+ *
64
+ * 0.7.1 在 apply 里一次性 `ctx.get('locale')`,有两个真实事故口,UI 都会
65
+ * 退回 `entry.label` 等原始键:
66
+ *
67
+ * 1. 服务晚到(桌面竞态):桌面客户端 `globalThis.__DSH_LOCALE__` 存在时,
68
+ * dsh-client-locale 的 apply 要先 `await bridge.read()`(Electron IPC)才
69
+ * `ctx.provide('locale')`;本插件 apply 先跑,get 取到 undefined 即整体
70
+ * 跳过 i18n。浏览器开发环境无 bridge、provide 同步完成,所以“本地验证
71
+ * 通过、用户下载后失效”。另外 cordis 的 get(strict) 在 provider fiber
72
+ * 尚未落定(state != 2)时同样返回 undefined。
73
+ * 2. 热更新双装载的 dispose 顺序:dshmarket 更新会把插件装载两次,第二次
74
+ * register 抛 already has locale 被跳过;随后旧实例卸载时若把词典 disposer
75
+ * 掉,词典即被撤走,留下没有词典的新实例回显原始键。
76
+ *
77
+ * 对策:`ctx.inject(['locale'], …)` 按平台注入等待语义在服务真正可用
78
+ * (provider fiber 就绪)后才进入;provider 重启/热更新重载都会重新进入
79
+ * 回调并重绑;词典注册保持幂等,且有意不在实例卸载时撤销(见上第 2 条),
80
+ * 注册本身只增不减,对双装载安全。
81
+ */
82
+ function attachLocale(ctx, ns, dicts, onBound) {
83
+ ctx.inject(["locale"], (sub) => {
84
+ const locale = sub.get("locale");
85
+ if (locale === void 0) return;
86
+ registerDictionaries(locale, ns, dicts);
87
+ onBound(bindTranslator(locale, ns));
88
+ });
89
+ }
58
90
  //#endregion
59
- export { bindTranslator, registerDictionaries };
91
+ export { attachLocale, bindTranslator, registerDictionaries };
package/lib/client.js CHANGED
@@ -40,76 +40,76 @@ window.__ModuleLoader__.load({
40
40
  document.head.appendChild(tag);
41
41
  }
42
42
  var service_console_module_css_default = {
43
- "tabBody": "PuSt5a_tabBody",
44
- "rowName": "PuSt5a_rowName",
45
- "noteWarn": "PuSt5a_noteWarn",
46
- "headerBtnOn": "PuSt5a_headerBtnOn",
43
+ "icoBtn": "PuSt5a_icoBtn",
47
44
  "filter": "PuSt5a_filter",
48
- "confirmRow": "PuSt5a_confirmRow",
49
- "detailAccent": "PuSt5a_detailAccent",
50
- "filterRow": "PuSt5a_filterRow",
51
- "segGroup": "PuSt5a_segGroup",
52
45
  "starLink": "PuSt5a_starLink",
53
- "setCap": "PuSt5a_setCap",
54
- "tabInd": "PuSt5a_tabInd",
55
- "hintWarn": "PuSt5a_hintWarn",
46
+ "confirmRow": "PuSt5a_confirmRow",
47
+ "evidenceItem": "PuSt5a_evidenceItem",
48
+ "okText": "PuSt5a_okText",
49
+ "errText": "PuSt5a_errText",
50
+ "starInfo": "PuSt5a_starInfo",
51
+ "tabBody": "PuSt5a_tabBody",
52
+ "evidenceArrow": "PuSt5a_evidenceArrow",
56
53
  "confirmTxt": "PuSt5a_confirmTxt",
57
- "detailHead": "PuSt5a_detailHead",
58
- "rowDot": "PuSt5a_rowDot",
59
- "setSection": "PuSt5a_setSection",
60
- "popup": "PuSt5a_popup",
61
- "setInput": "PuSt5a_setInput",
62
- "segBtn": "PuSt5a_segBtn",
63
- "headIco": "PuSt5a_headIco",
64
- "detailLabel": "PuSt5a_detailLabel",
65
- "icoBtn": "PuSt5a_icoBtn",
54
+ "popupOn": "PuSt5a_popupOn",
55
+ "filterRow": "PuSt5a_filterRow",
56
+ "head": "PuSt5a_head",
57
+ "rowBtn": "PuSt5a_rowBtn",
58
+ "rowMeta": "PuSt5a_rowMeta",
59
+ "row": "PuSt5a_row",
66
60
  "tab": "PuSt5a_tab",
67
- "rowMain": "PuSt5a_rowMain",
68
- "setPage": "PuSt5a_setPage",
69
- "switch": "PuSt5a_switch",
61
+ "headTitle": "PuSt5a_headTitle",
62
+ "sc-spin": "PuSt5a_sc-spin",
63
+ "rowAct": "PuSt5a_rowAct",
64
+ "filterClear": "PuSt5a_filterClear",
70
65
  "rowSub": "PuSt5a_rowSub",
66
+ "hintLine": "PuSt5a_hintLine",
67
+ "setInfo": "PuSt5a_setInfo",
68
+ "liveDot": "PuSt5a_liveDot",
69
+ "noteErr": "PuSt5a_noteErr",
70
+ "evidenceBlock": "PuSt5a_evidenceBlock",
71
+ "note": "PuSt5a_note",
72
+ "detailGrid": "PuSt5a_detailGrid",
71
73
  "badge": "PuSt5a_badge",
72
- "spin": "PuSt5a_spin",
73
74
  "confirmCancel": "PuSt5a_confirmCancel",
74
- "empty": "PuSt5a_empty",
75
- "setSelect": "PuSt5a_setSelect",
76
- "segBtnOn": "PuSt5a_segBtnOn",
75
+ "layer": "PuSt5a_layer",
76
+ "setCap": "PuSt5a_setCap",
77
+ "detailHead": "PuSt5a_detailHead",
78
+ "setSection": "PuSt5a_setSection",
79
+ "rowDot": "PuSt5a_rowDot",
80
+ "tabInd": "PuSt5a_tabInd",
81
+ "starRow": "PuSt5a_starRow",
77
82
  "tabs": "PuSt5a_tabs",
78
- "setInfo": "PuSt5a_setInfo",
79
- "popupOn": "PuSt5a_popupOn",
80
- "tabOn": "PuSt5a_tabOn",
83
+ "headIco": "PuSt5a_headIco",
84
+ "segBtnOn": "PuSt5a_segBtnOn",
81
85
  "confirmOk": "PuSt5a_confirmOk",
82
- "spacer": "PuSt5a_spacer",
83
- "setNote": "PuSt5a_setNote",
84
- "detailGrid": "PuSt5a_detailGrid",
85
86
  "detailBox": "PuSt5a_detailBox",
86
- "rowBtn": "PuSt5a_rowBtn",
87
- "starInfo": "PuSt5a_starInfo",
88
- "row": "PuSt5a_row",
89
- "hintLine": "PuSt5a_hintLine",
90
- "okText": "PuSt5a_okText",
91
- "sc-spin": "PuSt5a_sc-spin",
92
- "prevBtn": "PuSt5a_prevBtn",
93
- "setRow": "PuSt5a_setRow",
94
- "layer": "PuSt5a_layer",
95
- "rowMeta": "PuSt5a_rowMeta",
96
- "rowAct": "PuSt5a_rowAct",
97
- "starSection": "PuSt5a_starSection",
98
- "evidenceBlock": "PuSt5a_evidenceBlock",
99
- "evidenceItem": "PuSt5a_evidenceItem",
100
- "liveDot": "PuSt5a_liveDot",
87
+ "popup": "PuSt5a_popup",
88
+ "headerBtn": "PuSt5a_headerBtn",
89
+ "empty": "PuSt5a_empty",
101
90
  "setLabel": "PuSt5a_setLabel",
102
- "evidenceArrow": "PuSt5a_evidenceArrow",
103
- "starRow": "PuSt5a_starRow",
104
- "note": "PuSt5a_note",
105
91
  "setFooter": "PuSt5a_setFooter",
106
- "headerBtn": "PuSt5a_headerBtn",
107
- "noteErr": "PuSt5a_noteErr",
92
+ "hintWarn": "PuSt5a_hintWarn",
93
+ "prevBtn": "PuSt5a_prevBtn",
94
+ "starSection": "PuSt5a_starSection",
95
+ "detailLabel": "PuSt5a_detailLabel",
96
+ "setInput": "PuSt5a_setInput",
97
+ "segGroup": "PuSt5a_segGroup",
98
+ "tabOn": "PuSt5a_tabOn",
99
+ "rowName": "PuSt5a_rowName",
100
+ "setSelect": "PuSt5a_setSelect",
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",
108
+ "setNote": "PuSt5a_setNote",
108
109
  "starLabel": "PuSt5a_starLabel",
109
- "headTitle": "PuSt5a_headTitle",
110
- "head": "PuSt5a_head",
111
- "filterClear": "PuSt5a_filterClear",
112
- "errText": "PuSt5a_errText"
110
+ "spacer": "PuSt5a_spacer",
111
+ "rowMain": "PuSt5a_rowMain",
112
+ "detailAccent": "PuSt5a_detailAccent"
113
113
  };
114
114
  //#endregion
115
115
  //#region src/client/ServiceConsole.tsx
@@ -1043,7 +1043,10 @@ window.__ModuleLoader__.load({
1043
1043
  try {
1044
1044
  const off = locale.register(ns, code, dict);
1045
1045
  if (typeof off === "function") offs.push(off);
1046
- } catch {}
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
+ }
1047
1050
  }
1048
1051
  return () => {
1049
1052
  for (const off of offs) try {
@@ -1087,6 +1090,35 @@ window.__ModuleLoader__.load({
1087
1090
  }
1088
1091
  };
1089
1092
  }
1093
+ /**
1094
+ * 反应式 i18n 挂载(0.7.2):等 locale 服务真正可用后再注册/绑定。
1095
+ *
1096
+ * 0.7.1 在 apply 里一次性 `ctx.get('locale')`,有两个真实事故口,UI 都会
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
+ * 注册本身只增不减,对双装载安全。
1113
+ */
1114
+ function attachLocale(ctx, ns, dicts, onBound) {
1115
+ ctx.inject(["locale"], (sub) => {
1116
+ const locale = sub.get("locale");
1117
+ if (locale === void 0) return;
1118
+ registerDictionaries(locale, ns, dicts);
1119
+ onBound(bindTranslator(locale, ns));
1120
+ });
1121
+ }
1090
1122
  //#endregion
1091
1123
  //#region src/client/dictionaries.ts
1092
1124
  /**
@@ -1256,13 +1288,10 @@ window.__ModuleLoader__.load({
1256
1288
  inject: ["slots", "timer"],
1257
1289
  apply(ctx) {
1258
1290
  bindTimer(ctx.timer);
1259
- const locale = ctx.get("locale");
1260
- if (locale !== void 0) {
1261
- ctx.effect(() => registerDictionaries(locale, NS, [["zh", ZH_DICT], ["en", EN_DICT]]));
1262
- const bound = bindTranslator(locale, NS);
1291
+ attachLocale(ctx, NS, [["zh", ZH_DICT], ["en", EN_DICT]], (bound) => {
1263
1292
  labelT = bound.t;
1264
1293
  bindLocale(bound);
1265
- }
1294
+ });
1266
1295
  ctx.effect(() => ctx.slots.inject("conversation.session.header.utilities", () => ctx.slots.register({
1267
1296
  name: "conversation.session.header.utilities",
1268
1297
  id: "dsh-service-console",
@@ -1,5 +1,5 @@
1
1
  /**
2
- * i18n 注册/绑定(热挂载与双装载幂等,0.7.1)
2
+ * i18n 注册/绑定(热挂载与双装载幂等,0.7.1;locale 晚到反应式挂载,0.7.2)
3
3
  *
4
4
  * 桌面 dshmarket 热更新会把插件装载两次:第二次 locale.register 抛
5
5
  * "already has locale",webServer.register 抛 "duplicate exact route"。
@@ -28,3 +28,30 @@ export declare function registerDictionaries(locale: LocaleCompat, ns: string, d
28
28
  * 变量插值手工兜底(旧版 bound 可能不支持 params)。
29
29
  */
30
30
  export declare function bindTranslator(locale: LocaleCompat, ns: string): BoundLocale;
31
+ /** 宿主上下文最小面:本模块只用到 get / inject(真实 ctx 来自 @deepseek-ai/cordis) */
32
+ export interface PluginContextCompat {
33
+ get(name: string, strict?: boolean): unknown;
34
+ inject(deps: string[], callback: (ctx: PluginContextCompat) => void): unknown;
35
+ }
36
+ /**
37
+ * 反应式 i18n 挂载(0.7.2):等 locale 服务真正可用后再注册/绑定。
38
+ *
39
+ * 0.7.1 在 apply 里一次性 `ctx.get('locale')`,有两个真实事故口,UI 都会
40
+ * 退回 `entry.label` 等原始键:
41
+ *
42
+ * 1. 服务晚到(桌面竞态):桌面客户端 `globalThis.__DSH_LOCALE__` 存在时,
43
+ * dsh-client-locale 的 apply 要先 `await bridge.read()`(Electron IPC)才
44
+ * `ctx.provide('locale')`;本插件 apply 先跑,get 取到 undefined 即整体
45
+ * 跳过 i18n。浏览器开发环境无 bridge、provide 同步完成,所以“本地验证
46
+ * 通过、用户下载后失效”。另外 cordis 的 get(strict) 在 provider fiber
47
+ * 尚未落定(state != 2)时同样返回 undefined。
48
+ * 2. 热更新双装载的 dispose 顺序:dshmarket 更新会把插件装载两次,第二次
49
+ * register 抛 already has locale 被跳过;随后旧实例卸载时若把词典 disposer
50
+ * 掉,词典即被撤走,留下没有词典的新实例回显原始键。
51
+ *
52
+ * 对策:`ctx.inject(['locale'], …)` 按平台注入等待语义在服务真正可用
53
+ * (provider fiber 就绪)后才进入;provider 重启/热更新重载都会重新进入
54
+ * 回调并重绑;词典注册保持幂等,且有意不在实例卸载时撤销(见上第 2 条),
55
+ * 注册本身只增不减,对双装载安全。
56
+ */
57
+ export declare function attachLocale(ctx: PluginContextCompat, ns: string, dicts: ReadonlyArray<readonly [string, Record<string, string>]>, onBound: (bound: BoundLocale) => void): void;
package/manifest.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "dsh-service-console",
3
3
  "name": "服务控制台 (Service Console)",
4
- "version": "0.7.1",
4
+ "version": "0.7.2",
5
5
  "description": "本地开发服务控制台:发现监听端口,识别归属,安全停止/重启",
6
6
  "kind": "dynamic-cordis-plugin",
7
7
  "platforms": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jiyr0119/dsh-service-console",
3
- "version": "0.7.1",
3
+ "version": "0.7.2",
4
4
  "description": "DeepSeek Harness 本地开发服务控制台(原生插件):发现监听端口,识别服务归属,安全查看/停止/重启。Local development service console for DSH.",
5
5
  "license": "MIT",
6
6
  "type": "module",