@dsh-plus/secret-env 0.1.26 → 0.1.28
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 +26 -18
- package/package.json +18 -18
- package/src/client/common.ts +6 -20
package/lib/client.js
CHANGED
|
@@ -43,6 +43,30 @@ window.__ModuleLoader__.load({
|
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
45
|
//#endregion
|
|
46
|
+
//#region ../shared/src/client/clipboard.ts
|
|
47
|
+
/**
|
|
48
|
+
* 剪贴板复制助手(浏览器半共享件):`navigator.clipboard` 优先,
|
|
49
|
+
* 非安全上下文(如非 localhost 直连的 HTTP 页面)无该 API 时退 `execCommand`。
|
|
50
|
+
* @module @dsh-plus/shared/client/clipboard
|
|
51
|
+
*/
|
|
52
|
+
/** 复制文本到剪贴板;返回是否成功(失败静默,调用方自行决定是否提示)。 */
|
|
53
|
+
async function copyText(text) {
|
|
54
|
+
try {
|
|
55
|
+
await navigator.clipboard.writeText(text);
|
|
56
|
+
return true;
|
|
57
|
+
} catch {
|
|
58
|
+
const area = document.createElement("textarea");
|
|
59
|
+
area.value = text;
|
|
60
|
+
area.style.position = "fixed";
|
|
61
|
+
area.style.opacity = "0";
|
|
62
|
+
document.body.appendChild(area);
|
|
63
|
+
area.select();
|
|
64
|
+
const ok = document.execCommand("copy");
|
|
65
|
+
area.remove();
|
|
66
|
+
return ok;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
//#endregion
|
|
46
70
|
//#region ../shared/src/client/draft.ts
|
|
47
71
|
/**
|
|
48
72
|
* 单命名空间 staged 草稿(简单配置卡片共用):读 scope 快照、播种草稿、
|
|
@@ -918,8 +942,9 @@ ${extra}
|
|
|
918
942
|
//#endregion
|
|
919
943
|
//#region src/client/common.ts
|
|
920
944
|
/**
|
|
921
|
-
*
|
|
945
|
+
* 浏览器半共享小件:错误码文案映射、变量名输入规则
|
|
922
946
|
* (设置页与会话控件共用;名称规则与 node 半 names.ts 同源)。
|
|
947
|
+
* 复制助手已收编到 `@dsh-plus/shared/client`(llm-pi 目录浏览器是第二个使用方)。
|
|
923
948
|
* @module secret-env/client/common
|
|
924
949
|
*/
|
|
925
950
|
/** 端点错误 → 本地化文案(未知码回落 internal)。 */
|
|
@@ -936,23 +961,6 @@ ${extra}
|
|
|
936
961
|
if (raw.trim() === "") return null;
|
|
937
962
|
return validateSuffix(normalizeSuffix(raw));
|
|
938
963
|
}
|
|
939
|
-
/** 复制文本到剪贴板(clipboard API 缺席时退 execCommand)。 */
|
|
940
|
-
async function copyText(text) {
|
|
941
|
-
try {
|
|
942
|
-
await navigator.clipboard.writeText(text);
|
|
943
|
-
return true;
|
|
944
|
-
} catch {
|
|
945
|
-
const area = document.createElement("textarea");
|
|
946
|
-
area.value = text;
|
|
947
|
-
area.style.position = "fixed";
|
|
948
|
-
area.style.opacity = "0";
|
|
949
|
-
document.body.appendChild(area);
|
|
950
|
-
area.select();
|
|
951
|
-
const ok = document.execCommand("copy");
|
|
952
|
-
area.remove();
|
|
953
|
-
return ok;
|
|
954
|
-
}
|
|
955
|
-
}
|
|
956
964
|
//#endregion
|
|
957
965
|
//#region src/client/panel.tsx
|
|
958
966
|
/**
|
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.28",
|
|
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,27 +19,27 @@
|
|
|
19
19
|
"src"
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@dsh-plus/shared": "0.1.
|
|
22
|
+
"@dsh-plus/shared": "0.1.34"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
|
-
"@deepseek-ai/cordis": "^4.0.
|
|
26
|
-
"@deepseek-ai/dsh-credentials": "^0.2.
|
|
27
|
-
"@deepseek-ai/dsh-host-webserver": "^0.2.
|
|
28
|
-
"@deepseek-ai/dsh-settings": "^0.2.
|
|
29
|
-
"@deepseek-ai/dsh-shell-env": "^0.2.
|
|
30
|
-
"@deepseek-ai/schemastery": "^3.18.
|
|
25
|
+
"@deepseek-ai/cordis": "^4.0.5-alpha.1",
|
|
26
|
+
"@deepseek-ai/dsh-credentials": "^0.2.1-alpha.1",
|
|
27
|
+
"@deepseek-ai/dsh-host-webserver": "^0.2.1-alpha.1",
|
|
28
|
+
"@deepseek-ai/dsh-settings": "^0.2.1-alpha.1",
|
|
29
|
+
"@deepseek-ai/dsh-shell-env": "^0.2.1-alpha.1",
|
|
30
|
+
"@deepseek-ai/schemastery": "^3.18.5-alpha.1"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@deepseek-ai/cordis": "4.0.
|
|
34
|
-
"@deepseek-ai/dsh-client-ui-commands": "0.2.
|
|
35
|
-
"@deepseek-ai/dsh-client-ui-primitives": "0.2.
|
|
36
|
-
"@deepseek-ai/dsh-credentials": "0.2.
|
|
37
|
-
"@deepseek-ai/dsh-host-webserver": "0.2.
|
|
38
|
-
"@deepseek-ai/dsh-session": "0.2.
|
|
39
|
-
"@deepseek-ai/dsh-settings": "0.2.
|
|
40
|
-
"@deepseek-ai/dsh-shell-env": "0.2.
|
|
41
|
-
"@deepseek-ai/dsh-tools": "0.2.
|
|
42
|
-
"@deepseek-ai/schemastery": "3.18.
|
|
33
|
+
"@deepseek-ai/cordis": "4.0.5-alpha.1",
|
|
34
|
+
"@deepseek-ai/dsh-client-ui-commands": "0.2.1-alpha.1",
|
|
35
|
+
"@deepseek-ai/dsh-client-ui-primitives": "0.2.1-alpha.1",
|
|
36
|
+
"@deepseek-ai/dsh-credentials": "0.2.1-alpha.1",
|
|
37
|
+
"@deepseek-ai/dsh-host-webserver": "0.2.1-alpha.1",
|
|
38
|
+
"@deepseek-ai/dsh-session": "0.2.1-alpha.1",
|
|
39
|
+
"@deepseek-ai/dsh-settings": "0.2.1-alpha.1",
|
|
40
|
+
"@deepseek-ai/dsh-shell-env": "0.2.1-alpha.1",
|
|
41
|
+
"@deepseek-ai/dsh-tools": "0.2.1-alpha.1",
|
|
42
|
+
"@deepseek-ai/schemastery": "3.18.5-alpha.1",
|
|
43
43
|
"@types/node": "26.4.0",
|
|
44
44
|
"@types/react": "~18.3.31",
|
|
45
45
|
"react": "^18.2.0"
|
package/src/client/common.ts
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* 浏览器半共享小件:错误码文案映射、变量名输入规则
|
|
3
3
|
* (设置页与会话控件共用;名称规则与 node 半 names.ts 同源)。
|
|
4
|
+
* 复制助手已收编到 `@dsh-plus/shared/client`(llm-pi 目录浏览器是第二个使用方)。
|
|
4
5
|
* @module secret-env/client/common
|
|
5
6
|
*/
|
|
7
|
+
import { copyText } from '@dsh-plus/shared/client'
|
|
8
|
+
|
|
6
9
|
import { type NameError, normalizeSuffix, validateSuffix } from '../names.ts'
|
|
7
10
|
import { ApiError } from './api.ts'
|
|
8
11
|
import { errorKeyOf, type Translate } from './i18n.ts'
|
|
9
12
|
|
|
13
|
+
export { copyText }
|
|
14
|
+
|
|
10
15
|
/** 端点错误 → 本地化文案(未知码回落 internal)。 */
|
|
11
16
|
export function errorText(t: Translate, error: unknown): string {
|
|
12
17
|
const code = error instanceof ApiError ? error.code : 'internal'
|
|
@@ -25,22 +30,3 @@ export function nameErrorOf(raw: string): NameError | null {
|
|
|
25
30
|
if (raw.trim() === '') return null
|
|
26
31
|
return validateSuffix(normalizeSuffix(raw))
|
|
27
32
|
}
|
|
28
|
-
|
|
29
|
-
/** 复制文本到剪贴板(clipboard API 缺席时退 execCommand)。 */
|
|
30
|
-
export async function copyText(text: string): Promise<boolean> {
|
|
31
|
-
try {
|
|
32
|
-
await navigator.clipboard.writeText(text)
|
|
33
|
-
return true
|
|
34
|
-
} catch {
|
|
35
|
-
// 回落:非安全上下文(如非 localhost 直连)无 clipboard API。
|
|
36
|
-
const area = document.createElement('textarea')
|
|
37
|
-
area.value = text
|
|
38
|
-
area.style.position = 'fixed'
|
|
39
|
-
area.style.opacity = '0'
|
|
40
|
-
document.body.appendChild(area)
|
|
41
|
-
area.select()
|
|
42
|
-
const ok = document.execCommand('copy')
|
|
43
|
-
area.remove()
|
|
44
|
-
return ok
|
|
45
|
-
}
|
|
46
|
-
}
|