@dsh-plus/secret-env 0.1.24 → 0.1.26
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/lib/client.js +98 -92
- package/package.json +2 -2
package/lib/client.js
CHANGED
|
@@ -4,8 +4,8 @@ window.__ModuleLoader__.load({
|
|
|
4
4
|
var module = { exports: {} };
|
|
5
5
|
var exports = module.exports;
|
|
6
6
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
7
|
-
let react = require("react");
|
|
8
7
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
|
+
let react = require("react");
|
|
9
9
|
let _deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
10
10
|
//#region src/client/panel-bus.ts
|
|
11
11
|
const listeners = /* @__PURE__ */ new Set();
|
|
@@ -43,6 +43,85 @@ window.__ModuleLoader__.load({
|
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
45
|
//#endregion
|
|
46
|
+
//#region ../shared/src/client/draft.ts
|
|
47
|
+
/**
|
|
48
|
+
* 单命名空间 staged 草稿(简单配置卡片共用):读 scope 快照、播种草稿、
|
|
49
|
+
* 脏判定、保存(revision fencing + 重新装载)与状态行。
|
|
50
|
+
*
|
|
51
|
+
* 语义与官方 staged 表单一致:Host 更新不覆盖在途编辑,只有保存才写回;
|
|
52
|
+
* 保存成功后按 Host 解析值重置草稿。`from`/`patch` 参与 effect 与 useMemo
|
|
53
|
+
* 依赖,必须是模块级稳定函数(不要内联箭头函数)。
|
|
54
|
+
* @module @dsh-plus/shared/client/draft
|
|
55
|
+
*/
|
|
56
|
+
//#endregion
|
|
57
|
+
//#region ../shared/src/client/fetch.ts
|
|
58
|
+
async function parse(res, guard) {
|
|
59
|
+
const body = await res.json();
|
|
60
|
+
if (!res.ok) throw new Error(body.error ?? `HTTP ${res.status}`);
|
|
61
|
+
if (guard !== void 0 && !guard(body)) throw new Error(`响应结构不符合预期(${res.url})`);
|
|
62
|
+
return body;
|
|
63
|
+
}
|
|
64
|
+
/** GET 同源 JSON 端点。 */
|
|
65
|
+
async function getJson(route, guard) {
|
|
66
|
+
return parse(await fetch(route, { credentials: "same-origin" }), guard);
|
|
67
|
+
}
|
|
68
|
+
/** POST 同源 JSON 端点(body 可省略)。 */
|
|
69
|
+
async function postJson(route, body, guard) {
|
|
70
|
+
return parse(await fetch(route, {
|
|
71
|
+
method: "POST",
|
|
72
|
+
credentials: "same-origin",
|
|
73
|
+
headers: { "content-type": "application/json" },
|
|
74
|
+
...body === void 0 ? {} : { body: JSON.stringify(body) }
|
|
75
|
+
}), guard);
|
|
76
|
+
}
|
|
77
|
+
//#endregion
|
|
78
|
+
//#region ../shared/src/client/i18n.ts
|
|
79
|
+
/** 卡片通用文案(save/discard/unsaved/loading 等四插件共有键)。 */
|
|
80
|
+
const commonZh = {
|
|
81
|
+
save: "保存",
|
|
82
|
+
saving: "保存中…",
|
|
83
|
+
discard: "放弃",
|
|
84
|
+
unsaved: "未保存",
|
|
85
|
+
loading: "加载中…",
|
|
86
|
+
unavailable: "配置服务不可用。",
|
|
87
|
+
readOnly: "当前部署无 settings provider,配置为只读;请编辑 settings.yaml。",
|
|
88
|
+
invalidNumber: "请输入正整数。",
|
|
89
|
+
collapse: "收起",
|
|
90
|
+
expand: "展开",
|
|
91
|
+
enabledOn: "已启用",
|
|
92
|
+
enabledOff: "未启用",
|
|
93
|
+
saveFailed: "保存失败,请检查填写内容。",
|
|
94
|
+
confirm: "确认",
|
|
95
|
+
cancel: "取消"
|
|
96
|
+
};
|
|
97
|
+
const commonEn = {
|
|
98
|
+
save: "Save",
|
|
99
|
+
saving: "Saving…",
|
|
100
|
+
discard: "Discard",
|
|
101
|
+
unsaved: "Unsaved",
|
|
102
|
+
loading: "Loading…",
|
|
103
|
+
unavailable: "Settings service unavailable.",
|
|
104
|
+
readOnly: "No settings provider in this deployment; config is read-only. Edit settings.yaml.",
|
|
105
|
+
invalidNumber: "Enter a positive integer.",
|
|
106
|
+
collapse: "Collapse",
|
|
107
|
+
expand: "Expand",
|
|
108
|
+
enabledOn: "On",
|
|
109
|
+
enabledOff: "Off",
|
|
110
|
+
saveFailed: "Save failed; check the fields.",
|
|
111
|
+
confirm: "Confirm",
|
|
112
|
+
cancel: "Cancel"
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* own 覆盖同键合并(返回新对象,入参不可变)。
|
|
116
|
+
* 返回类型保留两侧键集合,调用方据此派生 DictKey。
|
|
117
|
+
*/
|
|
118
|
+
function mergeDict(base, own) {
|
|
119
|
+
return {
|
|
120
|
+
...base,
|
|
121
|
+
...own
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
//#endregion
|
|
46
125
|
//#region ../../node_modules/.pnpm/lucide-react@1.38.0_react@18.2.0/node_modules/lucide-react/dist/esm/shared/src/utils/mergeClasses.mjs
|
|
47
126
|
/**
|
|
48
127
|
* @license lucide-react v1.38.0 - ISC
|
|
@@ -222,103 +301,35 @@ window.__ModuleLoader__.load({
|
|
|
222
301
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EyeOff, { ...lucideProps(props) });
|
|
223
302
|
}
|
|
224
303
|
//#endregion
|
|
225
|
-
//#region ../shared/src/client/fetch.ts
|
|
226
|
-
async function parse(res, guard) {
|
|
227
|
-
const body = await res.json();
|
|
228
|
-
if (!res.ok) throw new Error(body.error ?? `HTTP ${res.status}`);
|
|
229
|
-
if (guard !== void 0 && !guard(body)) throw new Error(`响应结构不符合预期(${res.url})`);
|
|
230
|
-
return body;
|
|
231
|
-
}
|
|
232
|
-
/** GET 同源 JSON 端点。 */
|
|
233
|
-
async function getJson(route, guard) {
|
|
234
|
-
return parse(await fetch(route, { credentials: "same-origin" }), guard);
|
|
235
|
-
}
|
|
236
|
-
/** POST 同源 JSON 端点(body 可省略)。 */
|
|
237
|
-
async function postJson(route, body, guard) {
|
|
238
|
-
return parse(await fetch(route, {
|
|
239
|
-
method: "POST",
|
|
240
|
-
credentials: "same-origin",
|
|
241
|
-
headers: { "content-type": "application/json" },
|
|
242
|
-
...body === void 0 ? {} : { body: JSON.stringify(body) }
|
|
243
|
-
}), guard);
|
|
244
|
-
}
|
|
245
|
-
//#endregion
|
|
246
|
-
//#region ../shared/src/client/i18n.ts
|
|
247
|
-
/** 卡片通用文案(save/discard/unsaved/loading 等四插件共有键)。 */
|
|
248
|
-
const commonZh = {
|
|
249
|
-
save: "保存",
|
|
250
|
-
saving: "保存中…",
|
|
251
|
-
discard: "放弃",
|
|
252
|
-
unsaved: "未保存",
|
|
253
|
-
loading: "加载中…",
|
|
254
|
-
unavailable: "配置服务不可用。",
|
|
255
|
-
readOnly: "当前部署无 settings provider,配置为只读;请编辑 settings.yaml。",
|
|
256
|
-
invalidNumber: "请输入正整数。",
|
|
257
|
-
collapse: "收起",
|
|
258
|
-
expand: "展开",
|
|
259
|
-
enabledOn: "已启用",
|
|
260
|
-
enabledOff: "未启用",
|
|
261
|
-
saveFailed: "保存失败,请检查填写内容。",
|
|
262
|
-
confirm: "确认",
|
|
263
|
-
cancel: "取消"
|
|
264
|
-
};
|
|
265
|
-
const commonEn = {
|
|
266
|
-
save: "Save",
|
|
267
|
-
saving: "Saving…",
|
|
268
|
-
discard: "Discard",
|
|
269
|
-
unsaved: "Unsaved",
|
|
270
|
-
loading: "Loading…",
|
|
271
|
-
unavailable: "Settings service unavailable.",
|
|
272
|
-
readOnly: "No settings provider in this deployment; config is read-only. Edit settings.yaml.",
|
|
273
|
-
invalidNumber: "Enter a positive integer.",
|
|
274
|
-
collapse: "Collapse",
|
|
275
|
-
expand: "Expand",
|
|
276
|
-
enabledOn: "On",
|
|
277
|
-
enabledOff: "Off",
|
|
278
|
-
saveFailed: "Save failed; check the fields.",
|
|
279
|
-
confirm: "Confirm",
|
|
280
|
-
cancel: "Cancel"
|
|
281
|
-
};
|
|
282
|
-
/**
|
|
283
|
-
* own 覆盖同键合并(返回新对象,入参不可变)。
|
|
284
|
-
* 返回类型保留两侧键集合,调用方据此派生 DictKey。
|
|
285
|
-
*/
|
|
286
|
-
function mergeDict(base, own) {
|
|
287
|
-
return {
|
|
288
|
-
...base,
|
|
289
|
-
...own
|
|
290
|
-
};
|
|
291
|
-
}
|
|
292
|
-
//#endregion
|
|
293
304
|
//#region ../shared/src/client/styles.ts
|
|
294
305
|
/**
|
|
295
|
-
*
|
|
296
|
-
*
|
|
297
|
-
*
|
|
306
|
+
* 配置分节样式工厂(各插件 client 的公共收编版)。
|
|
307
|
+
*
|
|
308
|
+
* 目标宿主 dsh 0.2.1-alpha.1:插件页把配置视图放进已有页面级内边距的容器里
|
|
309
|
+
* (`div.detailSections[data-plugin-config]` 或 `section.detailSection[data-plugin-config]`),
|
|
310
|
+
* 外层无边框——故这里输出的是**无边框分节**(小节标题 13px/600、字段 12px 0、
|
|
311
|
+
* 横向零内边距、页脚非 sticky),度量对齐官方设置页
|
|
312
|
+
* (`@deepseek-ai/dsh-client-ui-primitives` 的 settings-form)。
|
|
313
|
+
*
|
|
314
|
+
* 移动端与可达性(767px 断点 + pointer:coarse,对齐 ui-mobile-fit 约定):
|
|
298
315
|
* - 窄屏 input/textarea 16px(防 iOS 聚焦缩放)、可点目标 ≥44px;
|
|
299
|
-
* -
|
|
300
|
-
* - 展开态 body 底部 sticky 保存栏(长表单滚动中始终可达)。
|
|
316
|
+
* - 页脚按钮等宽换行、状态文字独占一行。
|
|
301
317
|
* 沿用官方 data-plugin / data-plugin-css 约定(HMR 据此卸载),不覆盖上游选择器。
|
|
302
318
|
* @module @dsh-plus/shared/client/styles
|
|
303
319
|
*/
|
|
304
|
-
/**
|
|
320
|
+
/** 生成全套分节 CSS;prefix 为插件类名前缀(如 'dne'),extra 为插件特有规则。 */
|
|
305
321
|
function cardCss(prefix, extra = "") {
|
|
306
322
|
return `
|
|
307
|
-
.${prefix}-
|
|
308
|
-
.${prefix}-
|
|
309
|
-
.${prefix}-
|
|
310
|
-
.${prefix}-
|
|
311
|
-
.${prefix}-
|
|
312
|
-
.${prefix}-
|
|
313
|
-
.${prefix}-
|
|
314
|
-
.${prefix}-description{color:var(--dsw-alias-label-tertiary);font-size:13px;line-height:1.5}
|
|
315
|
-
.${prefix}-chevron{color:var(--dsw-alias-label-tertiary);flex:none;transition:transform .16s;display:inline-flex}
|
|
316
|
-
.${prefix}-chevronOpen{transform:rotate(180deg)}
|
|
323
|
+
.${prefix}-section{box-sizing:border-box;flex-direction:column;width:100%;min-width:0;padding:16px 0;display:flex}
|
|
324
|
+
.${prefix}-sectionHead{align-items:center;gap:8px;min-width:0;display:flex}
|
|
325
|
+
.${prefix}-sectionTitle{min-width:0;color:var(--dsw-alias-label-primary);flex:1;margin:0;font-size:13px;font-weight:600;line-height:1.5}
|
|
326
|
+
.${prefix}-sectionBadge{white-space:nowrap;border-radius:999px;flex:none;padding:1px 8px;font-size:11px;font-weight:500;line-height:17px}
|
|
327
|
+
.${prefix}-sectionDesc{color:var(--dsw-alias-label-tertiary);margin:4px 0 0;font-size:12px;line-height:1.5}
|
|
328
|
+
.${prefix}-sectionBody{flex-direction:column;min-width:0;display:flex}
|
|
329
|
+
.${prefix}-sectionFooter{align-items:center;gap:8px;padding-top:16px;display:flex;flex-wrap:wrap}
|
|
317
330
|
.${prefix}-pending{white-space:nowrap;background:var(--dsw-alias-bg-module-platform);color:var(--dsw-alias-label-secondary);border-radius:999px;flex:none;padding:1px 8px;font-size:11px;font-weight:500;line-height:17px}
|
|
318
|
-
.${prefix}-statusBadge{white-space:nowrap;border-radius:999px;flex:none;padding:1px 8px;font-size:11px;font-weight:500;line-height:17px}
|
|
319
331
|
.${prefix}-statusOn{background:var(--dsw-alias-bg-module-platform);color:var(--dsw-alias-label-secondary)}
|
|
320
332
|
.${prefix}-statusOff{color:var(--dsw-alias-label-tertiary)}
|
|
321
|
-
.${prefix}-body{border-top:1px solid var(--dsw-alias-border-l2);margin:0 16px;padding-bottom:8px}
|
|
322
333
|
.${prefix}-field{flex-direction:column;gap:6px;padding:12px 0;display:flex}
|
|
323
334
|
.${prefix}-field+.${prefix}-field{border-top:1px solid var(--dsw-alias-border-l2)}
|
|
324
335
|
.${prefix}-head{align-items:center;gap:8px;display:flex}
|
|
@@ -347,7 +358,6 @@ window.__ModuleLoader__.load({
|
|
|
347
358
|
.${prefix}-groupLabel{color:var(--dsw-alias-label-secondary);font-size:12px;font-weight:600;padding:12px 0 2px;margin:0}
|
|
348
359
|
.${prefix}-readOnly{color:var(--dsw-alias-label-tertiary);margin:12px 0 0;font-size:12px;line-height:1.5}
|
|
349
360
|
.${prefix}-warn{color:var(--dsw-alias-label-error);margin:12px 0 0;font-size:12px;line-height:1.5}
|
|
350
|
-
.${prefix}-footer{border-top:1px solid var(--dsw-alias-border-l2);justify-content:flex-end;align-items:center;gap:8px;padding:12px 0 4px;display:flex;flex-wrap:wrap}
|
|
351
361
|
.${prefix}-status{min-width:0;color:var(--dsw-alias-label-secondary);flex:1;margin:0;font-size:12px;line-height:1.5}
|
|
352
362
|
.${prefix}-statusError{color:var(--dsw-alias-label-error)}
|
|
353
363
|
.${prefix}-btn{appearance:none;font:inherit;cursor:pointer;border:1px solid #0000;border-radius:8px;padding:5px 14px;font-size:13px;line-height:1.5}
|
|
@@ -357,14 +367,10 @@ window.__ModuleLoader__.load({
|
|
|
357
367
|
.${prefix}-btn:disabled{opacity:.4;cursor:default}
|
|
358
368
|
.${prefix}-btn:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}
|
|
359
369
|
@media (max-width:767px){
|
|
360
|
-
.${prefix}-body{margin:0 10px}
|
|
361
|
-
.${prefix}-header{padding:12px 12px}
|
|
362
370
|
.${prefix}-input,.${prefix}-select{font-size:16px;height:40px}
|
|
363
371
|
.${prefix}-checkRow{min-height:44px;padding:8px 0}
|
|
364
|
-
.${prefix}-footer{position:sticky;bottom:0;background:var(--dsw-alias-bg-layer-2);margin:0 -10px;padding:10px 10px 6px;border-top:1px solid var(--dsw-alias-border-l2);border-bottom-left-radius:12px;border-bottom-right-radius:12px}
|
|
365
372
|
.${prefix}-status{flex-basis:100%;flex:none}
|
|
366
373
|
.${prefix}-btn{min-height:44px;flex:1;min-width:96px}
|
|
367
|
-
.${prefix}-statusBadge{display:none}
|
|
368
374
|
}
|
|
369
375
|
@media (pointer:coarse){
|
|
370
376
|
.${prefix}-btn{min-height:44px}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dsh-plus/secret-env",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.26",
|
|
4
4
|
"description": "dsh-plus service+ui plugin: 密钥环境变量——以 $DSH_VAR_* 变量名向 agent 暴露密钥(全局持久/会话级/一次性),执行期经 dsh-shell-env 原生注入,值不进消息流,不影响缓存率",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"src"
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@dsh-plus/shared": "0.1.
|
|
22
|
+
"@dsh-plus/shared": "0.1.32"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"@deepseek-ai/cordis": "^4.0.4",
|