@monotykamary/dsh-client-ui-settings-updates 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.i18n.yaml +6 -0
- package/README.md +17 -0
- package/README.zh.md +17 -0
- package/lib/client.js +333 -0
- package/lib/index.js +6 -0
- package/lib/invariant.js +10 -0
- package/lib/types/client/UpdateSettings.d.ts +19 -0
- package/lib/types/client/index.d.ts +16 -0
- package/lib/types/client/locales.d.ts +20 -0
- package/lib/types/index.d.ts +4 -0
- package/lib/types/invariant.d.ts +7 -0
- package/package.json +75 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 DeepSeek
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.i18n.yaml
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Bilingual-pair consistency record (docs/i18n/README.md): the git blob hash of each
|
|
2
|
+
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
|
3
|
+
# after editing either side, bring the other along and re-record with:
|
|
4
|
+
# pnpm run verify-translation-pairing --write packages/client/ui-settings-updates/README.md
|
|
5
|
+
README.md: dd28f0b00021a4b799527eaa65bc087a1b5e6f51
|
|
6
|
+
README.zh.md: 8452b848daa50b94105ad474f8327c42e388e0e2
|
package/README.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# `@monotykamary/dsh-client-ui-settings-updates`
|
|
2
|
+
|
|
3
|
+
English | [中文](README.zh.md)
|
|
4
|
+
|
|
5
|
+
Web Settings Consumer for `distributionUpdate`: it adds an Updates page, checks the registry when its trigger badge mounts, and marks Settings when the tested distribution has a semantic upgrade. Before model setup, its ordered onboarding step reads the startup diagnostic snapshot and blocks the application when shell, sandbox, or DSH-home readiness is unavailable; the user may explicitly continue, while the Updates page retains every check and remediation. The page shows the installation channel and upgrades, offers the detached update action for npm-global and source installations, and shows channel guidance only for externally managed installations. Cards and status text use the shared theme tokens, while retry, check, and update actions use the shared `Button` variants.
|
|
6
|
+
|
|
7
|
+
## Model Experience
|
|
8
|
+
|
|
9
|
+
None, as this browser-only Settings package registers no prompt, tool, message, or provider request.
|
|
10
|
+
|
|
11
|
+
#### KV Cache effect
|
|
12
|
+
|
|
13
|
+
None; this package never assembles model input.
|
|
14
|
+
|
|
15
|
+
## Known Limitations and Deferred Work
|
|
16
|
+
|
|
17
|
+
- Completion of a detached update requires restarting DSH; the old page does not stream the worker status file.
|
package/README.zh.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# `@monotykamary/dsh-client-ui-settings-updates`
|
|
2
|
+
|
|
3
|
+
[English](README.md) | 中文
|
|
4
|
+
|
|
5
|
+
`distributionUpdate` 的 Web 设置 Consumer:添加更新页面,在设置入口 Badge 挂载时检查 Registry,并在经过测试的发行版存在语义化升级时标记设置。在模型设置之前,它的有序 onboarding 步骤会读取启动诊断快照;shell、沙箱或 DSH home 未就绪时会阻塞应用,用户可以明确选择仍然继续,而更新页面会保留每项检查与修复指引。页面显示安装渠道与升级,为 npm 全局安装和源码安装提供分离更新操作,并且只为外部管理的安装显示渠道指引。卡片和状态文本使用共享主题 token,重试、检查与更新操作使用共享 `Button` 变体。
|
|
6
|
+
|
|
7
|
+
## 模型体验
|
|
8
|
+
|
|
9
|
+
无;该浏览器设置包仅面向操作者,不注册提示词、工具、消息或提供方请求。
|
|
10
|
+
|
|
11
|
+
#### KV Cache 影响
|
|
12
|
+
|
|
13
|
+
无;该包从不组装模型输入。
|
|
14
|
+
|
|
15
|
+
## 已知限制与待办事项
|
|
16
|
+
|
|
17
|
+
- 分离更新完成后需要重启 DSH;旧页面不会流式读取 Worker 状态文件。
|
package/lib/client.js
ADDED
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
window.__ModuleLoader__.load({
|
|
2
|
+
id: "@monotykamary/dsh-client-ui-settings-updates",
|
|
3
|
+
factory: (require) => {
|
|
4
|
+
var module = { exports: {} };
|
|
5
|
+
var exports = module.exports;
|
|
6
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
7
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
|
+
let react = require("react");
|
|
9
|
+
let _monotykamary_dsh_client_ui_primitives = require("@monotykamary/dsh-client-ui-primitives");
|
|
10
|
+
//#region \0dsh-css:/home/runner/work/deepseek-harness/deepseek-harness/packages/client/ui-settings-updates/src/client/UpdateSettings.module.css.mjs
|
|
11
|
+
const css = ".Fitqkq_section{color:var(--dsw-alias-label-primary);flex-direction:column;gap:20px;padding:24px;display:flex}.Fitqkq_heading,.Fitqkq_package,.Fitqkq_actions{justify-content:space-between;align-items:center;gap:12px;display:flex}.Fitqkq_heading>div,.Fitqkq_failure{flex-direction:column;align-items:flex-start;gap:8px;display:flex}.Fitqkq_heading p,.Fitqkq_status{color:var(--dsw-alias-label-secondary)}.Fitqkq_packages{flex-direction:column;gap:8px;padding:0;list-style:none;display:flex}.Fitqkq_package,.Fitqkq_command,.Fitqkq_warning,.Fitqkq_notice{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-2);border-radius:8px;padding:12px}.Fitqkq_package code,.Fitqkq_command{color:var(--dsw-alias-label-secondary)}.Fitqkq_command{overflow-wrap:anywhere}.Fitqkq_state{color:var(--dsw-alias-label-secondary)}.Fitqkq_state[data-available=true],.Fitqkq_warning{color:var(--dsw-alias-state-warning-primary)}.Fitqkq_notice{color:var(--dsw-alias-state-success-primary)}.Fitqkq_health,.Fitqkq_readinessContent,.Fitqkq_diagnostics{flex-direction:column;gap:12px;display:flex}.Fitqkq_diagnostics{padding:0;list-style:none}.Fitqkq_diagnostics li{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-2);border-radius:8px;padding:12px}.Fitqkq_diagnostics li[data-severity=blocking]{color:var(--dsw-alias-state-error-primary)}.Fitqkq_readinessDialog{width:min(560px,100vw - 32px)}.Fitqkq_readinessContent{color:var(--dsw-alias-label-primary);padding:24px}.Fitqkq_badge{background:var(--dsw-alias-state-error-primary);border-radius:50%;flex:none;width:8px;height:8px}";
|
|
12
|
+
const tagId = "@monotykamary/dsh-client-ui-settings-updates/UpdateSettings.module.css";
|
|
13
|
+
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
|
|
14
|
+
const tag = document.createElement("style");
|
|
15
|
+
tag.dataset.plugin = "@monotykamary/dsh-client-ui-settings-updates";
|
|
16
|
+
tag.dataset.pluginCss = tagId;
|
|
17
|
+
tag.textContent = css;
|
|
18
|
+
document.head.appendChild(tag);
|
|
19
|
+
}
|
|
20
|
+
var UpdateSettings_module_css_default = {
|
|
21
|
+
"actions": "Fitqkq_actions",
|
|
22
|
+
"badge": "Fitqkq_badge",
|
|
23
|
+
"command": "Fitqkq_command",
|
|
24
|
+
"diagnostics": "Fitqkq_diagnostics",
|
|
25
|
+
"failure": "Fitqkq_failure",
|
|
26
|
+
"heading": "Fitqkq_heading",
|
|
27
|
+
"health": "Fitqkq_health",
|
|
28
|
+
"notice": "Fitqkq_notice",
|
|
29
|
+
"package": "Fitqkq_package",
|
|
30
|
+
"packages": "Fitqkq_packages",
|
|
31
|
+
"readinessContent": "Fitqkq_readinessContent",
|
|
32
|
+
"readinessDialog": "Fitqkq_readinessDialog",
|
|
33
|
+
"section": "Fitqkq_section",
|
|
34
|
+
"state": "Fitqkq_state",
|
|
35
|
+
"status": "Fitqkq_status",
|
|
36
|
+
"warning": "Fitqkq_warning"
|
|
37
|
+
};
|
|
38
|
+
//#endregion
|
|
39
|
+
//#region lib/types/client/UpdateSettings.js
|
|
40
|
+
const ignoreImplicitDismiss = () => {};
|
|
41
|
+
/** Block first-run interaction until host prerequisites are acknowledged or ready. */
|
|
42
|
+
function InstallationReadiness({ snapshot, complete, t }) {
|
|
43
|
+
const [state, setState] = (0, react.useState)({ loading: true });
|
|
44
|
+
const titleRef = (0, react.useRef)(null);
|
|
45
|
+
(0, react.useEffect)(() => {
|
|
46
|
+
let current = true;
|
|
47
|
+
snapshot().then((value) => {
|
|
48
|
+
if (current) setState({
|
|
49
|
+
loading: false,
|
|
50
|
+
diagnostics: value.diagnostics
|
|
51
|
+
});
|
|
52
|
+
}, () => {
|
|
53
|
+
if (current) setState({
|
|
54
|
+
loading: false,
|
|
55
|
+
diagnostics: []
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
return () => {
|
|
59
|
+
current = false;
|
|
60
|
+
};
|
|
61
|
+
}, [snapshot]);
|
|
62
|
+
const blocking = state.loading ? [] : state.diagnostics.filter((item) => item.severity === "blocking");
|
|
63
|
+
(0, react.useEffect)(() => {
|
|
64
|
+
if (!state.loading && blocking.length === 0) complete();
|
|
65
|
+
}, [
|
|
66
|
+
blocking.length,
|
|
67
|
+
complete,
|
|
68
|
+
state.loading
|
|
69
|
+
]);
|
|
70
|
+
(0, react.useEffect)(() => {
|
|
71
|
+
if (blocking.length === 0) return;
|
|
72
|
+
const root = document.getElementById("root");
|
|
73
|
+
if (root === null) return;
|
|
74
|
+
const previous = root.inert;
|
|
75
|
+
root.inert = true;
|
|
76
|
+
titleRef.current?.focus();
|
|
77
|
+
return () => {
|
|
78
|
+
root.inert = previous;
|
|
79
|
+
};
|
|
80
|
+
}, [blocking.length]);
|
|
81
|
+
if (state.loading || blocking.length === 0) return null;
|
|
82
|
+
return (0, react_jsx_runtime.jsx)(_monotykamary_dsh_client_ui_primitives.Modal, {
|
|
83
|
+
open: true,
|
|
84
|
+
title: t("readinessTitle"),
|
|
85
|
+
onClose: ignoreImplicitDismiss,
|
|
86
|
+
headless: true,
|
|
87
|
+
className: UpdateSettings_module_css_default.readinessDialog,
|
|
88
|
+
children: (0, react_jsx_runtime.jsxs)("div", {
|
|
89
|
+
className: UpdateSettings_module_css_default.readinessContent,
|
|
90
|
+
children: [
|
|
91
|
+
(0, react_jsx_runtime.jsx)("h2", {
|
|
92
|
+
ref: titleRef,
|
|
93
|
+
tabIndex: -1,
|
|
94
|
+
children: t("readinessTitle")
|
|
95
|
+
}),
|
|
96
|
+
(0, react_jsx_runtime.jsx)("p", { children: t("readinessDescription") }),
|
|
97
|
+
(0, react_jsx_runtime.jsx)("ul", {
|
|
98
|
+
className: UpdateSettings_module_css_default.diagnostics,
|
|
99
|
+
children: blocking.map((item) => (0, react_jsx_runtime.jsxs)("li", { children: [(0, react_jsx_runtime.jsx)("strong", { children: item.summary }), item.remediation === null ? null : (0, react_jsx_runtime.jsx)("p", { children: item.remediation })] }, item.id))
|
|
100
|
+
}),
|
|
101
|
+
(0, react_jsx_runtime.jsx)(_monotykamary_dsh_client_ui_primitives.Button, {
|
|
102
|
+
variant: "outline",
|
|
103
|
+
onClick: complete,
|
|
104
|
+
children: t("readinessContinue")
|
|
105
|
+
})
|
|
106
|
+
]
|
|
107
|
+
})
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
/** Render a dot only when the explicit registry check finds an update. */
|
|
111
|
+
function UpdateBadge({ check }) {
|
|
112
|
+
const [available, setAvailable] = (0, react.useState)(false);
|
|
113
|
+
(0, react.useEffect)(() => {
|
|
114
|
+
let current = true;
|
|
115
|
+
check().then((snapshot) => {
|
|
116
|
+
if (current) setAvailable(snapshot.updateAvailable);
|
|
117
|
+
}, () => {});
|
|
118
|
+
return () => {
|
|
119
|
+
current = false;
|
|
120
|
+
};
|
|
121
|
+
}, [check]);
|
|
122
|
+
return available ? (0, react_jsx_runtime.jsx)("span", {
|
|
123
|
+
className: UpdateSettings_module_css_default.badge,
|
|
124
|
+
"data-update-available": true,
|
|
125
|
+
"aria-hidden": "true"
|
|
126
|
+
}) : null;
|
|
127
|
+
}
|
|
128
|
+
/** Render distribution versions, channel guidance, and the update action. */
|
|
129
|
+
function UpdateSettings({ check, start, t }) {
|
|
130
|
+
const [request, setRequest] = (0, react.useState)(0);
|
|
131
|
+
const [state, setState] = (0, react.useState)({ status: "loading" });
|
|
132
|
+
(0, react.useEffect)(() => {
|
|
133
|
+
let current = true;
|
|
134
|
+
check().then((snapshot) => {
|
|
135
|
+
if (current) setState({
|
|
136
|
+
status: "ready",
|
|
137
|
+
snapshot
|
|
138
|
+
});
|
|
139
|
+
}, (error) => {
|
|
140
|
+
if (current) setState({
|
|
141
|
+
status: "error",
|
|
142
|
+
message: error instanceof Error ? error.message : String(error)
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
return () => {
|
|
146
|
+
current = false;
|
|
147
|
+
};
|
|
148
|
+
}, [check, request]);
|
|
149
|
+
if (state.status === "loading") return (0, react_jsx_runtime.jsx)("p", {
|
|
150
|
+
className: UpdateSettings_module_css_default.status,
|
|
151
|
+
children: t("checking")
|
|
152
|
+
});
|
|
153
|
+
if (state.status === "error") return (0, react_jsx_runtime.jsxs)("div", {
|
|
154
|
+
className: UpdateSettings_module_css_default.failure,
|
|
155
|
+
children: [(0, react_jsx_runtime.jsxs)("p", {
|
|
156
|
+
role: "alert",
|
|
157
|
+
children: [
|
|
158
|
+
t("failed"),
|
|
159
|
+
": ",
|
|
160
|
+
state.message
|
|
161
|
+
]
|
|
162
|
+
}), (0, react_jsx_runtime.jsx)(_monotykamary_dsh_client_ui_primitives.Button, {
|
|
163
|
+
variant: "outline",
|
|
164
|
+
onClick: () => {
|
|
165
|
+
setRequest((value) => value + 1);
|
|
166
|
+
},
|
|
167
|
+
children: t("retry")
|
|
168
|
+
})]
|
|
169
|
+
});
|
|
170
|
+
const { snapshot } = state;
|
|
171
|
+
const startUpdate = () => {
|
|
172
|
+
start().then((launch) => {
|
|
173
|
+
setState({
|
|
174
|
+
status: "ready",
|
|
175
|
+
snapshot,
|
|
176
|
+
launch
|
|
177
|
+
});
|
|
178
|
+
});
|
|
179
|
+
};
|
|
180
|
+
return (0, react_jsx_runtime.jsxs)("div", {
|
|
181
|
+
className: UpdateSettings_module_css_default.section,
|
|
182
|
+
children: [
|
|
183
|
+
(0, react_jsx_runtime.jsxs)("div", {
|
|
184
|
+
className: UpdateSettings_module_css_default.heading,
|
|
185
|
+
children: [(0, react_jsx_runtime.jsxs)("div", { children: [(0, react_jsx_runtime.jsx)("h2", { children: t("title") }), (0, react_jsx_runtime.jsxs)("p", { children: [
|
|
186
|
+
t("channel"),
|
|
187
|
+
": ",
|
|
188
|
+
(0, react_jsx_runtime.jsx)("strong", { children: snapshot.channel })
|
|
189
|
+
] })] }), (0, react_jsx_runtime.jsx)("span", {
|
|
190
|
+
className: UpdateSettings_module_css_default.state,
|
|
191
|
+
"data-available": snapshot.updateAvailable,
|
|
192
|
+
children: t(snapshot.updateAvailable ? "available" : "current")
|
|
193
|
+
})]
|
|
194
|
+
}),
|
|
195
|
+
snapshot.error !== null ? (0, react_jsx_runtime.jsx)("p", {
|
|
196
|
+
role: "alert",
|
|
197
|
+
className: UpdateSettings_module_css_default.warning,
|
|
198
|
+
children: snapshot.error
|
|
199
|
+
}) : null,
|
|
200
|
+
(0, react_jsx_runtime.jsxs)("div", {
|
|
201
|
+
className: UpdateSettings_module_css_default.health,
|
|
202
|
+
children: [(0, react_jsx_runtime.jsx)("h3", { children: t("readinessChecks") }), (0, react_jsx_runtime.jsx)("ul", {
|
|
203
|
+
className: UpdateSettings_module_css_default.diagnostics,
|
|
204
|
+
children: snapshot.diagnostics.map((item) => (0, react_jsx_runtime.jsxs)("li", {
|
|
205
|
+
"data-severity": item.severity,
|
|
206
|
+
children: [(0, react_jsx_runtime.jsx)("strong", { children: item.summary }), item.remediation === null ? null : (0, react_jsx_runtime.jsx)("p", { children: item.remediation })]
|
|
207
|
+
}, item.id))
|
|
208
|
+
})]
|
|
209
|
+
}),
|
|
210
|
+
(0, react_jsx_runtime.jsx)("ul", {
|
|
211
|
+
className: UpdateSettings_module_css_default.packages,
|
|
212
|
+
children: snapshot.packages.map((pkg) => (0, react_jsx_runtime.jsxs)("li", {
|
|
213
|
+
className: UpdateSettings_module_css_default.package,
|
|
214
|
+
children: [(0, react_jsx_runtime.jsx)("strong", { children: pkg.name }), (0, react_jsx_runtime.jsxs)("code", { children: [pkg.installed, pkg.latest === null || !pkg.updateAvailable ? "" : ` → ${pkg.latest}`] })]
|
|
215
|
+
}, pkg.name))
|
|
216
|
+
}),
|
|
217
|
+
snapshot.updateCommand !== null ? (0, react_jsx_runtime.jsx)("code", {
|
|
218
|
+
className: UpdateSettings_module_css_default.command,
|
|
219
|
+
children: snapshot.updateCommand
|
|
220
|
+
}) : null,
|
|
221
|
+
(0, react_jsx_runtime.jsxs)("div", {
|
|
222
|
+
className: UpdateSettings_module_css_default.actions,
|
|
223
|
+
children: [(0, react_jsx_runtime.jsx)(_monotykamary_dsh_client_ui_primitives.Button, {
|
|
224
|
+
variant: "outline",
|
|
225
|
+
onClick: () => {
|
|
226
|
+
setRequest((value) => value + 1);
|
|
227
|
+
},
|
|
228
|
+
children: t("check")
|
|
229
|
+
}), snapshot.updateAvailable ? (0, react_jsx_runtime.jsx)(_monotykamary_dsh_client_ui_primitives.Button, {
|
|
230
|
+
variant: "primary",
|
|
231
|
+
onClick: startUpdate,
|
|
232
|
+
children: t("update")
|
|
233
|
+
}) : null]
|
|
234
|
+
}),
|
|
235
|
+
state.launch !== void 0 ? (0, react_jsx_runtime.jsx)("p", {
|
|
236
|
+
className: UpdateSettings_module_css_default.notice,
|
|
237
|
+
role: "status",
|
|
238
|
+
children: state.launch.message
|
|
239
|
+
}) : null
|
|
240
|
+
]
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
//#endregion
|
|
244
|
+
//#region lib/types/client/locales.js
|
|
245
|
+
const en = {
|
|
246
|
+
nav: "Updates",
|
|
247
|
+
title: "Distribution updates",
|
|
248
|
+
channel: "Install channel",
|
|
249
|
+
checking: "Checking for updates…",
|
|
250
|
+
failed: "Update check failed",
|
|
251
|
+
retry: "Retry",
|
|
252
|
+
available: "Update available",
|
|
253
|
+
current: "Up to date",
|
|
254
|
+
check: "Check again",
|
|
255
|
+
update: "Update DSH",
|
|
256
|
+
readinessTitle: "Host setup needs attention",
|
|
257
|
+
readinessDescription: "These prerequisites can prevent shell or sandbox tools from running reliably.",
|
|
258
|
+
readinessContinue: "Continue anyway",
|
|
259
|
+
readinessChecks: "Host readiness"
|
|
260
|
+
};
|
|
261
|
+
const zh = {
|
|
262
|
+
nav: "更新",
|
|
263
|
+
title: "发行版更新",
|
|
264
|
+
channel: "安装渠道",
|
|
265
|
+
checking: "正在检查更新…",
|
|
266
|
+
failed: "更新检查失败",
|
|
267
|
+
retry: "重试",
|
|
268
|
+
available: "有可用更新",
|
|
269
|
+
current: "已是最新版本",
|
|
270
|
+
check: "再次检查",
|
|
271
|
+
update: "更新 DSH",
|
|
272
|
+
readinessTitle: "宿主机设置需要处理",
|
|
273
|
+
readinessDescription: "这些前置条件可能导致 shell 或沙箱工具无法可靠运行。",
|
|
274
|
+
readinessContinue: "仍然继续",
|
|
275
|
+
readinessChecks: "宿主机就绪状态"
|
|
276
|
+
};
|
|
277
|
+
//#endregion
|
|
278
|
+
//#region lib/types/client/index.js
|
|
279
|
+
/** Settings page and trigger badge for DSH distribution updates. */
|
|
280
|
+
/** Locale namespace owned by the Updates settings page. */
|
|
281
|
+
const NS = "settings.updates";
|
|
282
|
+
const inject = [
|
|
283
|
+
"slots",
|
|
284
|
+
"locale",
|
|
285
|
+
"remote",
|
|
286
|
+
"remote.distributionUpdate"
|
|
287
|
+
];
|
|
288
|
+
/** Register the Updates page and available-update badge. */
|
|
289
|
+
function apply(ctx) {
|
|
290
|
+
ctx.effect(() => ctx.locale.register(NS, {
|
|
291
|
+
en,
|
|
292
|
+
zh
|
|
293
|
+
}), "ui-settings-updates: dictionaries");
|
|
294
|
+
const unwrap = async (request) => {
|
|
295
|
+
const result = await request;
|
|
296
|
+
if (!result.ok) throw new Error(`${result.error.code}: ${result.error.message}`);
|
|
297
|
+
return result.value;
|
|
298
|
+
};
|
|
299
|
+
const injected = {
|
|
300
|
+
snapshot: () => unwrap(ctx.remote.distributionUpdate.snapshot()),
|
|
301
|
+
check: () => unwrap(ctx.remote.distributionUpdate.check()),
|
|
302
|
+
start: () => unwrap(ctx.remote.distributionUpdate.start())
|
|
303
|
+
};
|
|
304
|
+
const t = ctx.locale.bind(NS);
|
|
305
|
+
ctx.slots.inject("settings.onboarding", () => ctx.slots.register({
|
|
306
|
+
name: "settings.onboarding",
|
|
307
|
+
id: "installation-readiness",
|
|
308
|
+
order: -50,
|
|
309
|
+
locale: NS,
|
|
310
|
+
inject: () => ({ snapshot: injected.snapshot })
|
|
311
|
+
}, InstallationReadiness));
|
|
312
|
+
ctx.slots.inject("settings.section", () => ctx.slots.register({
|
|
313
|
+
name: "settings.section",
|
|
314
|
+
id: "updates",
|
|
315
|
+
order: 40,
|
|
316
|
+
label: () => t("nav"),
|
|
317
|
+
locale: NS,
|
|
318
|
+
inject: () => injected
|
|
319
|
+
}, UpdateSettings));
|
|
320
|
+
ctx.slots.inject("settings.trigger.badge", () => ctx.slots.register({
|
|
321
|
+
name: "settings.trigger.badge",
|
|
322
|
+
inject: () => ({ check: injected.check })
|
|
323
|
+
}, UpdateBadge));
|
|
324
|
+
}
|
|
325
|
+
//#endregion
|
|
326
|
+
exports.NS = NS;
|
|
327
|
+
exports.apply = apply;
|
|
328
|
+
exports.inject = inject;
|
|
329
|
+
return module.exports;
|
|
330
|
+
}
|
|
331
|
+
});
|
|
332
|
+
|
|
333
|
+
//# sourceMappingURL=client.js.map
|
package/lib/index.js
ADDED
package/lib/invariant.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region lib/types/invariant.js
|
|
2
|
+
const PACKAGE_NAME = "@monotykamary/dsh-client-ui-settings-updates";
|
|
3
|
+
const name = "ui-settings-updates-invariant";
|
|
4
|
+
const inject = ["invariants"];
|
|
5
|
+
/** No runtime invariant: slot registration is verified by the Client composition. */
|
|
6
|
+
const install = () => {};
|
|
7
|
+
/** Register this package's invariant companion. */
|
|
8
|
+
const apply = (ctx) => Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install));
|
|
9
|
+
//#endregion
|
|
10
|
+
export { apply, inject, name };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { DistributionUpdateLaunch, DistributionUpdateSnapshot } from '@monotykamary/dsh-api-remotes/client';
|
|
3
|
+
import type { InjectFace, PropsLocale, PropsRuntime } from '@monotykamary/dsh-client-ui-slots';
|
|
4
|
+
/** Remote operations consumed by the update page and badge. */
|
|
5
|
+
export interface UpdateInjected {
|
|
6
|
+
snapshot: () => Promise<DistributionUpdateSnapshot>;
|
|
7
|
+
check: () => Promise<DistributionUpdateSnapshot>;
|
|
8
|
+
start: () => Promise<DistributionUpdateLaunch>;
|
|
9
|
+
}
|
|
10
|
+
export type UpdateSettingsProps = PropsRuntime<'settings.section'> & PropsLocale<'settings.updates'> & InjectFace<UpdateInjected>;
|
|
11
|
+
export type UpdateBadgeProps = PropsRuntime<'settings.trigger.badge'> & InjectFace<Pick<UpdateInjected, 'check'>>;
|
|
12
|
+
export type InstallationReadinessProps = PropsRuntime<'settings.onboarding'> & PropsLocale<'settings.updates'> & InjectFace<Pick<UpdateInjected, 'snapshot'>>;
|
|
13
|
+
/** Block first-run interaction until host prerequisites are acknowledged or ready. */
|
|
14
|
+
export declare function InstallationReadiness({ snapshot, complete, t }: InstallationReadinessProps): ReactNode;
|
|
15
|
+
/** Render a dot only when the explicit registry check finds an update. */
|
|
16
|
+
export declare function UpdateBadge({ check }: UpdateBadgeProps): ReactNode;
|
|
17
|
+
/** Render distribution versions, channel guidance, and the update action. */
|
|
18
|
+
export declare function UpdateSettings({ check, start, t }: UpdateSettingsProps): ReactNode;
|
|
19
|
+
//# sourceMappingURL=UpdateSettings.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** Settings page and trigger badge for DSH distribution updates. */
|
|
2
|
+
import type { ClientContext } from '@monotykamary/dsh-client-runtime/client';
|
|
3
|
+
import { type UpdateLocaleKey } from './locales.ts';
|
|
4
|
+
export type { InstallationReadinessProps, UpdateInjected, UpdateSettingsProps, UpdateBadgeProps } from './UpdateSettings.tsx';
|
|
5
|
+
export type { UpdateLocaleKey } from './locales.ts';
|
|
6
|
+
declare module '@monotykamary/dsh-client-ui-slots' {
|
|
7
|
+
interface LocaleNamespaceMap {
|
|
8
|
+
'settings.updates': UpdateLocaleKey;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
/** Locale namespace owned by the Updates settings page. */
|
|
12
|
+
export declare const NS = "settings.updates";
|
|
13
|
+
export declare const inject: string[];
|
|
14
|
+
/** Register the Updates page and available-update badge. */
|
|
15
|
+
export declare function apply(ctx: ClientContext): void;
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const en: {
|
|
2
|
+
readonly nav: "Updates";
|
|
3
|
+
readonly title: "Distribution updates";
|
|
4
|
+
readonly channel: "Install channel";
|
|
5
|
+
readonly checking: "Checking for updates…";
|
|
6
|
+
readonly failed: "Update check failed";
|
|
7
|
+
readonly retry: "Retry";
|
|
8
|
+
readonly available: "Update available";
|
|
9
|
+
readonly current: "Up to date";
|
|
10
|
+
readonly check: "Check again";
|
|
11
|
+
readonly update: "Update DSH";
|
|
12
|
+
readonly readinessTitle: "Host setup needs attention";
|
|
13
|
+
readonly readinessDescription: "These prerequisites can prevent shell or sandbox tools from running reliably.";
|
|
14
|
+
readonly readinessContinue: "Continue anyway";
|
|
15
|
+
readonly readinessChecks: "Host readiness";
|
|
16
|
+
};
|
|
17
|
+
export declare const zh: Record<keyof typeof en, string>;
|
|
18
|
+
/** Translation keys owned by the Updates settings page. */
|
|
19
|
+
export type UpdateLocaleKey = keyof typeof en;
|
|
20
|
+
//# sourceMappingURL=locales.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Package-owned invariant companion. @module @monotykamary/dsh-client-ui-settings-updates/invariant */
|
|
2
|
+
import type { Context } from '@monotykamary/cordis';
|
|
3
|
+
export declare const name = "ui-settings-updates-invariant";
|
|
4
|
+
export declare const inject: string[];
|
|
5
|
+
/** Register this package's invariant companion. */
|
|
6
|
+
export declare const apply: (ctx: Context) => Promise<() => void>;
|
|
7
|
+
//# sourceMappingURL=invariant.d.ts.map
|
package/package.json
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@monotykamary/dsh-client-ui-settings-updates",
|
|
3
|
+
"description": "Distribution Updates page and Settings badge",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/deepseek-ai/deepseek-harness.git",
|
|
11
|
+
"directory": "packages/client/ui-settings-updates"
|
|
12
|
+
},
|
|
13
|
+
"type": "module",
|
|
14
|
+
"main": "lib/index.js",
|
|
15
|
+
"types": "lib/types/index.d.ts",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./lib/types/index.d.ts",
|
|
19
|
+
"default": "./lib/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./invariant": {
|
|
22
|
+
"types": "./lib/types/invariant.d.ts",
|
|
23
|
+
"default": "./lib/invariant.js"
|
|
24
|
+
},
|
|
25
|
+
"./client": {
|
|
26
|
+
"types": "./lib/types/client/index.d.ts",
|
|
27
|
+
"default": "./lib/client.js"
|
|
28
|
+
},
|
|
29
|
+
"./package.json": "./package.json"
|
|
30
|
+
},
|
|
31
|
+
"dsh": {
|
|
32
|
+
"client": {
|
|
33
|
+
"inject": [
|
|
34
|
+
"@monotykamary/dsh-api-remotes",
|
|
35
|
+
"@monotykamary/dsh-client-runtime",
|
|
36
|
+
"@monotykamary/dsh-client-ui-settings",
|
|
37
|
+
"@monotykamary/dsh-client-locale"
|
|
38
|
+
],
|
|
39
|
+
"platform": "web"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"license": "MIT",
|
|
43
|
+
"peerDependencies": {
|
|
44
|
+
"@monotykamary/cordis": "^4.0.1",
|
|
45
|
+
"@monotykamary/dsh-client-runtime": "^0.1.0",
|
|
46
|
+
"@monotykamary/dsh-client-ui-settings": "^0.1.0",
|
|
47
|
+
"@monotykamary/dsh-client-locale": "^0.1.0",
|
|
48
|
+
"@monotykamary/dsh-api-remotes": "^0.1.0",
|
|
49
|
+
"@monotykamary/dsh-invariants": "^0.1.0"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@types/react": "~18.3.1",
|
|
53
|
+
"react": "^18.2.0",
|
|
54
|
+
"@testing-library/react": "^16.1.0",
|
|
55
|
+
"react-dom": "^18.2.0",
|
|
56
|
+
"@monotykamary/cordis": "^4.0.1",
|
|
57
|
+
"@monotykamary/dsh-api-remotes": "^0.1.0",
|
|
58
|
+
"@monotykamary/dsh-client-locale": "^0.1.0",
|
|
59
|
+
"@monotykamary/dsh-client-ui-primitives": "^0.1.0",
|
|
60
|
+
"@monotykamary/dsh-client-runtime": "^0.1.0",
|
|
61
|
+
"@monotykamary/dsh-client-ui-settings": "^0.1.0",
|
|
62
|
+
"@monotykamary/dsh-client-ui-slots": "^0.1.0",
|
|
63
|
+
"@monotykamary/dsh-invariants": "^0.1.0"
|
|
64
|
+
},
|
|
65
|
+
"files": [
|
|
66
|
+
"lib/index.js",
|
|
67
|
+
"lib/invariant.js",
|
|
68
|
+
"lib/client.js",
|
|
69
|
+
"lib/types/**/*.d.ts"
|
|
70
|
+
],
|
|
71
|
+
"scripts": {
|
|
72
|
+
"bundle": "tsdown",
|
|
73
|
+
"watch": "tsdown --watch"
|
|
74
|
+
}
|
|
75
|
+
}
|