@morehao/dsh-skills-console 0.3.2 → 0.3.3
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/client.js +56 -22
- package/lib/routes.js +6 -3
- package/package.json +1 -1
package/client.js
CHANGED
|
@@ -99,7 +99,9 @@ var DICT = {
|
|
|
99
99
|
"view.agent": "按 Agent",
|
|
100
100
|
autoLink: "自动接入",
|
|
101
101
|
"settings.title": "插件设置",
|
|
102
|
-
"
|
|
102
|
+
"id.copy": "复制安装标识",
|
|
103
|
+
"id.copied": "已复制安装标识",
|
|
104
|
+
"id.copyFailed": "复制失败,请重试",
|
|
103
105
|
"placement.label": "侧边栏入口",
|
|
104
106
|
"placement.effect": "切换后立即生效",
|
|
105
107
|
"placement.on": "已开启",
|
|
@@ -287,7 +289,9 @@ var DICT = {
|
|
|
287
289
|
"view.agent": "By agent",
|
|
288
290
|
"autoLink": "Auto-link",
|
|
289
291
|
"settings.title": "Plugin settings",
|
|
290
|
-
"
|
|
292
|
+
"id.copy": "Copy install specifier",
|
|
293
|
+
"id.copied": "Install specifier copied",
|
|
294
|
+
"id.copyFailed": "Copy failed, please retry",
|
|
291
295
|
"placement.label": "Sidebar entry",
|
|
292
296
|
"placement.effect": "Applies immediately",
|
|
293
297
|
"placement.on": "on",
|
|
@@ -448,6 +452,17 @@ var DICT = {
|
|
|
448
452
|
"viewer.info.none": "None"
|
|
449
453
|
}
|
|
450
454
|
};
|
|
455
|
+
async function copyText(text) {
|
|
456
|
+
const value = String(text ?? "");
|
|
457
|
+
if (!value) return false;
|
|
458
|
+
try {
|
|
459
|
+
if (typeof navigator === "undefined" || !navigator.clipboard?.writeText) return false;
|
|
460
|
+
await navigator.clipboard.writeText(value);
|
|
461
|
+
return true;
|
|
462
|
+
} catch {
|
|
463
|
+
return false;
|
|
464
|
+
}
|
|
465
|
+
}
|
|
451
466
|
function buildTranslate(locale) {
|
|
452
467
|
const active = () => {
|
|
453
468
|
try {
|
|
@@ -835,13 +850,19 @@ var CSS = `
|
|
|
835
850
|
.dshsc-head-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-left: auto; }
|
|
836
851
|
.dshsc-title-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
|
|
837
852
|
|
|
838
|
-
/*
|
|
839
|
-
.dshsc-id { display: inline-flex; align-items: center; gap:
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
853
|
+
/* 身份:按「安装时输入的包名」显示(@scope/name@version),等宽 + 可点复制 */
|
|
854
|
+
.dshsc-id { display: inline-flex; align-items: center; gap: 5px; box-sizing: border-box; min-width: 0;
|
|
855
|
+
max-width: 100%; height: 22px; padding: 0 6px 0 7px; border: 1px solid var(--dsw-alias-border-l1);
|
|
856
|
+
border-radius: 6px; background: var(--dsw-alias-bg-layer-1); color: var(--dsw-alias-label-tertiary);
|
|
857
|
+
font-family: var(--ds-font-family-code, ui-monospace, SFMono-Regular, Menlo, monospace);
|
|
858
|
+
font-size: 11px; line-height: 1; white-space: nowrap; cursor: pointer;
|
|
859
|
+
transition: background .12s ease, border-color .12s ease, color .12s ease; }
|
|
860
|
+
.dshsc-id:hover { border-color: var(--dsw-alias-border-l2); background: var(--dsw-alias-bg-layer-2);
|
|
861
|
+
color: var(--dsw-alias-label-primary); }
|
|
862
|
+
.dshsc-id:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 1px; }
|
|
863
|
+
.dshsc-spec { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
|
|
864
|
+
.dshsc-idcopy { display: inline-flex; flex: none; opacity: .5; transition: opacity .12s ease; }
|
|
865
|
+
.dshsc-id:hover .dshsc-idcopy, .dshsc-id:focus-visible .dshsc-idcopy { opacity: 1; }
|
|
845
866
|
|
|
846
867
|
/* 插件级工具(设置 / GitHub):跟在身份胶囊后面,用细线分组;鬼影按钮不和业务按钮抢权重 */
|
|
847
868
|
.dshsc-tools { display: inline-flex; align-items: center; gap: 2px; flex: none; margin-left: 2px;
|
|
@@ -1737,6 +1758,11 @@ function useSkillReader(row) {
|
|
|
1737
1758
|
}
|
|
1738
1759
|
|
|
1739
1760
|
// client/views/header.js
|
|
1761
|
+
function installSpec(plugin) {
|
|
1762
|
+
const name = plugin?.fullName || plugin?.name;
|
|
1763
|
+
if (!name) return null;
|
|
1764
|
+
return plugin.version ? `${name}@${plugin.version}` : name;
|
|
1765
|
+
}
|
|
1740
1766
|
function Header({
|
|
1741
1767
|
t,
|
|
1742
1768
|
page,
|
|
@@ -1755,8 +1781,14 @@ function Header({
|
|
|
1755
1781
|
onChangePlacement,
|
|
1756
1782
|
onOpenAutoLink,
|
|
1757
1783
|
onAddSkill,
|
|
1758
|
-
onAddSubscription
|
|
1784
|
+
onAddSubscription,
|
|
1785
|
+
onToast
|
|
1759
1786
|
}) {
|
|
1787
|
+
const spec = installSpec(plugin);
|
|
1788
|
+
async function copySpec() {
|
|
1789
|
+
const ok = await copyText(spec);
|
|
1790
|
+
onToast?.(ok ? { kind: "ok", text: t("id.copied") } : { kind: "err", text: t("id.copyFailed") });
|
|
1791
|
+
}
|
|
1760
1792
|
const headTools = h(
|
|
1761
1793
|
"div",
|
|
1762
1794
|
{ className: "dshsc-tools" },
|
|
@@ -1828,17 +1860,18 @@ function Header({
|
|
|
1828
1860
|
"div",
|
|
1829
1861
|
{ className: "dshsc-title-row" },
|
|
1830
1862
|
h("h2", { className: "dshsc-title" }, page ? t("page.title") : t("section.title")),
|
|
1831
|
-
//
|
|
1832
|
-
|
|
1833
|
-
"
|
|
1834
|
-
{
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
"
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1863
|
+
// 身份:按「安装时输入的包名」显示,点一下整段复制(Host 从 package.json 注入)
|
|
1864
|
+
spec ? h(
|
|
1865
|
+
"button",
|
|
1866
|
+
{
|
|
1867
|
+
type: "button",
|
|
1868
|
+
className: "dshsc-id",
|
|
1869
|
+
title: `${t("id.copy")}:${spec}`,
|
|
1870
|
+
"aria-label": `${t("id.copy")}:${spec}`,
|
|
1871
|
+
onClick: () => void copySpec()
|
|
1872
|
+
},
|
|
1873
|
+
h("span", { className: "dshsc-spec" }, spec),
|
|
1874
|
+
h("span", { className: "dshsc-idcopy", "aria-hidden": "true" }, h(CopyIcon, { size: 11 }))
|
|
1842
1875
|
) : null,
|
|
1843
1876
|
headTools
|
|
1844
1877
|
),
|
|
@@ -3966,7 +3999,8 @@ function Section({ t, page = false, pickDirectory, onPlacementChange }) {
|
|
|
3966
3999
|
onChangePlacement: (next) => void changePlacement(next),
|
|
3967
4000
|
onOpenAutoLink: () => setModal({ type: "autolink" }),
|
|
3968
4001
|
onAddSkill: actions.requestAddSkill,
|
|
3969
|
-
onAddSubscription: actions.requestAddSubscription
|
|
4002
|
+
onAddSubscription: actions.requestAddSubscription,
|
|
4003
|
+
onToast: (next) => setToast(next)
|
|
3970
4004
|
}),
|
|
3971
4005
|
error ? h("div", { className: "dshsc-banner err" }, `${error} · `, h("button", { className: "dshsc-btn ghost", onClick: () => void reload() }, t("action.retry"))) : null,
|
|
3972
4006
|
data?.readOnly ? h("div", { className: "dshsc-banner warn" }, t("banner.readonly")) : null,
|
package/lib/routes.js
CHANGED
|
@@ -6,8 +6,10 @@ export const ROUTE_PREFIX = '/api/morehao/skills-console';
|
|
|
6
6
|
const MAX_BODY = 256 * 1024;
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
9
|
+
* 插件身份:包名 + 版本,随 /state 下发。
|
|
10
|
+
* - `name`:去掉 scope 的短名(兼容老前端);
|
|
11
|
+
* - `fullName`:带 scope 的真实包名,页头据此拼成可复制的安装标识 `@scope/name@version`。
|
|
12
|
+
* 从 package.json 读一次 —— 前端别硬编码版本,否则两处漂移。
|
|
11
13
|
*/
|
|
12
14
|
export const PLUGIN_INFO = (() => {
|
|
13
15
|
try {
|
|
@@ -15,11 +17,12 @@ export const PLUGIN_INFO = (() => {
|
|
|
15
17
|
const name = String(pkg.name || 'dsh-skills-console');
|
|
16
18
|
return {
|
|
17
19
|
name: name.includes('/') ? name.slice(name.lastIndexOf('/') + 1) : name,
|
|
20
|
+
fullName: name,
|
|
18
21
|
version: pkg.version || null,
|
|
19
22
|
repository: pkg.repository?.url || null,
|
|
20
23
|
};
|
|
21
24
|
} catch {
|
|
22
|
-
return { name: 'dsh-skills-console', version: null, repository: null };
|
|
25
|
+
return { name: 'dsh-skills-console', fullName: 'dsh-skills-console', version: null, repository: null };
|
|
23
26
|
}
|
|
24
27
|
})();
|
|
25
28
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@morehao/dsh-skills-console",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "统一管理本地技能的安装、更新、删除与接入,让同一份技能在多个 Agent 间复用。A skill manager for DeepSeek Harness: install, update, remove, link and toggle agent skills.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "morehao <morehao@qq.com>",
|