skillmkt 0.1.8 → 0.2.1
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/commands/init.js +7 -5
- package/client/commands/serve.js +30 -13
- package/client/lib/daemon.js +5 -22
- package/client/lib/dashboard.js +4 -3
- package/client/lib/llm.js +37 -22
- package/client/public/app.js +94 -56
- package/client/public/index.html +56 -41
- package/package.json +1 -1
package/client/commands/init.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import fs from 'node:fs';
|
|
3
3
|
import { ensureHub, writeConfig, readConfig } from '../lib/hub.js';
|
|
4
4
|
import { probeEndpoints, chat } from '../lib/llm.js';
|
|
5
|
-
import { openURL, readDaemon } from '../lib/daemon.js';
|
|
5
|
+
import { openURL, readDaemon, pidAlive } from '../lib/daemon.js';
|
|
6
6
|
import { choose, confirm } from '../lib/prompt.js';
|
|
7
7
|
import { ok, warn, fail, info } from '../lib/render.js';
|
|
8
8
|
|
|
@@ -27,10 +27,9 @@ export async function run(ctx) {
|
|
|
27
27
|
if (mode === 'web') {
|
|
28
28
|
// 前台语义:本进程=服务器,开页后挂住流日志,Ctrl-C 连服务一起退
|
|
29
29
|
try {
|
|
30
|
-
const
|
|
31
|
-
if (
|
|
32
|
-
|
|
33
|
-
ok(`Web 初始化已打开: ${url}(服务已在别的终端跑)`);
|
|
30
|
+
const d = readDaemon(ctx.hub);
|
|
31
|
+
if (d && pidAlive(d.pid)) {
|
|
32
|
+
ok(`Web 初始化已打开: ${openURL(d, '/#setup')}(服务已在别的终端跑)`);
|
|
34
33
|
return 0;
|
|
35
34
|
}
|
|
36
35
|
const { startServer } = await import('./serve.js');
|
|
@@ -59,6 +58,9 @@ export async function run(ctx) {
|
|
|
59
58
|
{ label: '手动输入端点', v: 'manual' },
|
|
60
59
|
{ label: '跳过(确定性功能照常用)', v: 'skip' },
|
|
61
60
|
];
|
|
61
|
+
for (const f of found.filter((x) => x.needs_key)) {
|
|
62
|
+
info(`发现 ${f.name}:${f.port}(需要密钥,模型列表读不出)——选"手动输入端点"后填 ${f.base_url}`);
|
|
63
|
+
}
|
|
62
64
|
const sel = await choose('选择模型端点:', opts);
|
|
63
65
|
if (sel.v === 'manual') {
|
|
64
66
|
// 手动输入交给 config set 提示
|
package/client/commands/serve.js
CHANGED
|
@@ -9,11 +9,11 @@ import { loadDecisions, decide } from '../lib/decide.js';
|
|
|
9
9
|
import { readLibrary, readLock, readConfig, writeConfig, registerSkill, updateLock, ensureHub } from '../lib/hub.js';
|
|
10
10
|
import { readUpstream } from '../lib/state.js';
|
|
11
11
|
import { readYAML } from '../../pipeline/lib/util.js';
|
|
12
|
-
import {
|
|
12
|
+
import { detectHarnesses } from '../lib/scanner.js';
|
|
13
13
|
import { probeEndpoints, chat } from '../lib/llm.js';
|
|
14
|
-
import { projectSkill, targetDirFor } from '../lib/project.js';
|
|
14
|
+
import { projectSkill, unproject, targetDirFor } from '../lib/project.js';
|
|
15
15
|
import { treeHash } from '../lib/package.js';
|
|
16
|
-
import { ok, info
|
|
16
|
+
import { ok, info } from '../lib/render.js';
|
|
17
17
|
|
|
18
18
|
const PUB = path.join(new URL('.', import.meta.url).pathname, '../public');
|
|
19
19
|
const MIME = { '.html': 'text/html', '.js': 'text/javascript', '.css': 'text/css', '.png': 'image/png', '.svg': 'image/svg+xml' };
|
|
@@ -35,8 +35,9 @@ export async function startServer(ctx, { quiet = false, port = 0 } = {}) {
|
|
|
35
35
|
library: readLibrary(ctx.hub), lock: readLock(ctx.hub),
|
|
36
36
|
upstream: readUpstream(ctx.hub), conflicts: loadConflicts(ctx.hub),
|
|
37
37
|
decisions: loadDecisions(ctx.hub), harnesses,
|
|
38
|
-
scans: fs.existsSync(path.join(ctx.hub, 'scans'))
|
|
39
|
-
|
|
38
|
+
scans: fs.existsSync(path.join(ctx.hub, 'scans'))
|
|
39
|
+
? fs.readdirSync(path.join(ctx.hub, 'scans')).sort().map((f) => readYAML(path.join(ctx.hub, 'scans', f))).filter(Boolean)
|
|
40
|
+
: [],
|
|
40
41
|
});
|
|
41
42
|
|
|
42
43
|
const routes = {
|
|
@@ -51,7 +52,7 @@ export async function startServer(ctx, { quiet = false, port = 0 } = {}) {
|
|
|
51
52
|
const server = http.createServer(async (req, res) => {
|
|
52
53
|
lastActive = Date.now();
|
|
53
54
|
const t0 = Date.now();
|
|
54
|
-
if (!quiet) res.on('finish', () => console.log(` ${req.method} ${req.url} → ${res.statusCode} ${Date.now() - t0}ms`));
|
|
55
|
+
if (!quiet) res.on('finish', () => console.log(` ${req.method} ${req.url.replace(/token=[^&\s]+/g, 'token=***')} → ${res.statusCode} ${Date.now() - t0}ms`));
|
|
55
56
|
const u = new URL(req.url, 'http://x');
|
|
56
57
|
// auth:Bearer header 或 ?token=(SSE/img 用 query,服务端不下发 cookie)
|
|
57
58
|
const authed = req.headers.authorization === `Bearer ${token}` || u.searchParams.get('token') === token;
|
|
@@ -67,12 +68,15 @@ export async function startServer(ctx, { quiet = false, port = 0 } = {}) {
|
|
|
67
68
|
if (!authed) { res.writeHead(401, { 'content-type': 'application/json' }); return res.end('{"error":"unauthorized"}'); }
|
|
68
69
|
res.setHeader('content-type', 'application/json');
|
|
69
70
|
if (req.method === 'POST') {
|
|
70
|
-
|
|
71
|
+
let b;
|
|
72
|
+
try { b = JSON.parse(await body(req)); }
|
|
73
|
+
catch { res.writeHead(400); return res.end('{"error":"bad json"}'); }
|
|
71
74
|
try {
|
|
72
75
|
if (u.pathname === '/api/decide') {
|
|
73
76
|
const c = loadConflicts(ctx.hub).find((x) => x.id === b.id);
|
|
74
77
|
if (!c) { res.writeHead(404); return res.end('{"error":"not found"}'); }
|
|
75
|
-
|
|
78
|
+
if (!b.reason?.trim()) { res.writeHead(400); return res.end('{"error":"reason required"}'); }
|
|
79
|
+
decide(ctx.hub, c, { resolution: b.resolution, custom: b.custom || null, reason: b.reason, by: 'web-ui' });
|
|
76
80
|
c.status = 'resolved';
|
|
77
81
|
const { writeConflict } = await import('../lib/conflicts.js');
|
|
78
82
|
writeConflict(ctx.hub, c);
|
|
@@ -101,6 +105,12 @@ export async function startServer(ctx, { quiet = false, port = 0 } = {}) {
|
|
|
101
105
|
if (!s) { res.writeHead(404); return res.end('{"error":"not found"}'); }
|
|
102
106
|
const dest = path.join(ctx.hub, 'skills', name);
|
|
103
107
|
const lockTargets = {};
|
|
108
|
+
// 取消勾选的目标:删掉已复制的副本(否则孤儿文件遗留且 drift 检不出)
|
|
109
|
+
for (const t of s.targets || []) {
|
|
110
|
+
if (targets.includes(t)) continue;
|
|
111
|
+
const dir = targetDirFor(ctx, t, name);
|
|
112
|
+
if (dir) unproject(name, dir);
|
|
113
|
+
}
|
|
104
114
|
for (const t of targets) {
|
|
105
115
|
const dir = targetDirFor(ctx, t, name);
|
|
106
116
|
if (!dir) continue;
|
|
@@ -122,11 +132,18 @@ export async function startServer(ctx, { quiet = false, port = 0 } = {}) {
|
|
|
122
132
|
}
|
|
123
133
|
res.writeHead(404); return res.end('{"error":"not found"}');
|
|
124
134
|
}
|
|
125
|
-
// 静态:public/
|
|
126
|
-
|
|
127
|
-
let file
|
|
128
|
-
if (p.startsWith('/evidence/'))
|
|
129
|
-
|
|
135
|
+
// 静态:public/ 公开;/evidence/ 需鉴权且锁死在 hub/evidence 内(防 ../ 穿越读 config.yml 等)
|
|
136
|
+
const p = u.pathname === '/' ? '/index.html' : u.pathname;
|
|
137
|
+
let file;
|
|
138
|
+
if (p.startsWith('/evidence/')) {
|
|
139
|
+
if (!authed) { res.writeHead(401); return res.end(); }
|
|
140
|
+
const evDir = path.join(ctx.hub, 'evidence');
|
|
141
|
+
file = path.join(evDir, p.slice('/evidence/'.length));
|
|
142
|
+
if (!path.resolve(file).startsWith(path.resolve(evDir))) { res.writeHead(403); return res.end(); }
|
|
143
|
+
} else {
|
|
144
|
+
file = path.join(PUB, p);
|
|
145
|
+
if (!path.resolve(file).startsWith(PUB)) { res.writeHead(403); return res.end(); }
|
|
146
|
+
}
|
|
130
147
|
if (!fs.existsSync(file) || fs.statSync(file).isDirectory()) { res.writeHead(404); return res.end('nf'); }
|
|
131
148
|
res.setHeader('content-type', MIME[path.extname(file)] || 'application/octet-stream');
|
|
132
149
|
fs.createReadStream(file).pipe(res);
|
package/client/lib/daemon.js
CHANGED
|
@@ -1,33 +1,15 @@
|
|
|
1
|
-
// daemon.js —
|
|
1
|
+
// daemon.js — daemon.json{pid,port,token,started} + openURL + CLI 自动接管
|
|
2
2
|
import fs from 'node:fs';
|
|
3
3
|
import path from 'node:path';
|
|
4
|
-
import
|
|
5
|
-
import { spawn, execFileSync } from 'node:child_process';
|
|
4
|
+
import { execFileSync } from 'node:child_process';
|
|
6
5
|
|
|
7
6
|
export const daemonFile = (hub) => path.join(hub, 'daemon.json');
|
|
8
|
-
const
|
|
7
|
+
export const pidAlive = (pid) => { try { process.kill(pid, 0); return true; } catch { return false; } };
|
|
9
8
|
|
|
10
9
|
export function readDaemon(hub) {
|
|
11
10
|
try { return JSON.parse(fs.readFileSync(daemonFile(hub), 'utf8')); } catch { return null; }
|
|
12
11
|
}
|
|
13
12
|
|
|
14
|
-
export async function ensureDaemon(ctx) {
|
|
15
|
-
const d = readDaemon(ctx.hub);
|
|
16
|
-
if (d && alive(d.pid)) return d;
|
|
17
|
-
const bin = path.join(new URL('.', import.meta.url).pathname, '../bin/skillmkt.js');
|
|
18
|
-
const child = spawn(process.execPath, [bin, 'serve', '--daemon'], {
|
|
19
|
-
env: { ...process.env, SKILLMKT_HOME: ctx.hub },
|
|
20
|
-
detached: true, stdio: 'ignore',
|
|
21
|
-
});
|
|
22
|
-
child.unref();
|
|
23
|
-
for (let i = 0; i < 40; i++) {
|
|
24
|
-
await new Promise((r) => setTimeout(r, 100));
|
|
25
|
-
const nd = readDaemon(ctx.hub);
|
|
26
|
-
if (nd && alive(nd.pid)) return nd;
|
|
27
|
-
}
|
|
28
|
-
throw new Error('daemon 启动超时');
|
|
29
|
-
}
|
|
30
|
-
|
|
31
13
|
export function openURL(d, route = '/') {
|
|
32
14
|
// token 必须进 ?search(location.search 可读);#fragment 只带 tab 名
|
|
33
15
|
const frag = route.includes('#') ? `#${route.split('#')[1]}` : '';
|
|
@@ -41,8 +23,9 @@ export function openURL(d, route = '/') {
|
|
|
41
23
|
export async function maybeHandoff(ctx, route = '/') {
|
|
42
24
|
if (!process.stdout.isTTY || ctx.flags.raw.cli || ctx.flags.raw.noUi) return false;
|
|
43
25
|
if (ctx.flags.raw.ui === false) return false;
|
|
26
|
+
if (ctx.config?.ui?.enabled === 'never' || ctx.config?.ui?.enabled === false) return false;
|
|
44
27
|
const d = readDaemon(ctx.hub);
|
|
45
|
-
if (d &&
|
|
28
|
+
if (d && pidAlive(d.pid)) {
|
|
46
29
|
console.log(`opened ${openURL(d, route)}(服务已在跑,Ctrl-C 那个终端的 serve 可停)`);
|
|
47
30
|
return true;
|
|
48
31
|
}
|
package/client/lib/dashboard.js
CHANGED
|
@@ -7,12 +7,13 @@ import { treeHash } from './package.js';
|
|
|
7
7
|
import { dashboard } from './render.js';
|
|
8
8
|
import { listYAML } from './yamlls.js';
|
|
9
9
|
|
|
10
|
-
export function renderDashboard(ctx) {
|
|
10
|
+
export async function renderDashboard(ctx) {
|
|
11
11
|
const { hub, library, harnesses, llm, project, config } = ctx;
|
|
12
12
|
|
|
13
|
-
// ui.enabled=always →
|
|
13
|
+
// ui.enabled=always → 前台起服务开面板(挂住流日志,Ctrl-C 一起退)
|
|
14
14
|
if (config.ui.enabled === 'always' && ctx.tty && ctx.flags.ui !== 'off') {
|
|
15
|
-
|
|
15
|
+
const { maybeHandoff } = await import('./daemon.js');
|
|
16
|
+
if (await maybeHandoff(ctx, '/')) return 0; // 接管后永不返回
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
const rows = scanAll(hub, harnesses, library, project?.root);
|
package/client/lib/llm.js
CHANGED
|
@@ -55,31 +55,46 @@ export async function chat(llm, { system = '', user, maxTokens = 64, temperature
|
|
|
55
55
|
} finally { clearTimeout(t); }
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
export const LLM_PROBES = [
|
|
59
|
-
{ port: 8001, name: 'OMLX' },
|
|
60
|
-
{ port: 11434, name: 'Ollama', probe: '/api/version' },
|
|
61
|
-
{ port: 1234, name: 'LM Studio' },
|
|
62
|
-
{ port: 8000, name: 'vLLM' },
|
|
63
|
-
{ port: 8080, name: 'mlx-lm/llama.cpp' },
|
|
64
|
-
{ port: 1337, name: 'Jan' },
|
|
65
|
-
{ port: 5000, name: 'text-gen-webui' },
|
|
66
|
-
];
|
|
58
|
+
export const LLM_PROBES = [8001, 11434, 1234, 8000, 8080, 1337, 5000];
|
|
67
59
|
|
|
68
|
-
//
|
|
69
|
-
|
|
70
|
-
const
|
|
71
|
-
const base = `http://localhost:${port}/v1`;
|
|
60
|
+
// 识别服务实现——有特征端点才冠名,认不出如实标"OpenAI 兼容服务"(oMLX 跑在 1234 时不该叫 LM Studio)
|
|
61
|
+
async function identifyImpl(port, timeoutMs) {
|
|
62
|
+
const get = async (p) => {
|
|
72
63
|
const ctrl = new AbortController();
|
|
73
64
|
const t = setTimeout(() => ctrl.abort(), timeoutMs);
|
|
74
|
-
try {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
65
|
+
try { const r = await fetch(`http://localhost:${port}${p}`, { signal: ctrl.signal }); return r.ok ? await r.json() : null; }
|
|
66
|
+
catch { return null; } finally { clearTimeout(t); }
|
|
67
|
+
};
|
|
68
|
+
if ((await get('/api/version'))?.version) return 'Ollama'; // Ollama 原生 API
|
|
69
|
+
if (await get('/api/v0/models')) return 'LM Studio API'; // 说 LM Studio 协议——也可能是 oMLX 等兼容实现
|
|
70
|
+
return 'OpenAI 兼容服务';
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// 仅 init/config 使用——并发扫端口。/v1/models 通了即收录;
|
|
74
|
+
// 401/403 时用已知环境 key 重试,仍不通则标 needs_key 保留(别静默漏掉 oMLX 这类要 key 的本地服务)
|
|
75
|
+
export async function probeEndpoints(timeoutMs = 400) {
|
|
76
|
+
const envKeys = ['SKILLMKT_LLM_API_KEY', 'OMLX_API_KEY'].map((v) => process.env[v]).filter(Boolean);
|
|
77
|
+
const results = await Promise.allSettled(LLM_PROBES.map(async (port) => {
|
|
78
|
+
const base = `http://localhost:${port}/v1`;
|
|
79
|
+
const tryModels = async (key) => {
|
|
80
|
+
const ctrl = new AbortController();
|
|
81
|
+
const t = setTimeout(() => ctrl.abort(), timeoutMs);
|
|
82
|
+
try {
|
|
83
|
+
return await fetch(`${base}/models`, {
|
|
84
|
+
signal: ctrl.signal,
|
|
85
|
+
headers: key ? { authorization: `Bearer ${key}` } : {},
|
|
86
|
+
});
|
|
87
|
+
} catch { return null; } finally { clearTimeout(t); }
|
|
88
|
+
};
|
|
89
|
+
let res = await tryModels(null);
|
|
90
|
+
if (!res) return null;
|
|
91
|
+
if (res.status === 401 || res.status === 403) {
|
|
92
|
+
for (const k of envKeys) { res = await tryModels(k); if (res?.ok) break; }
|
|
93
|
+
}
|
|
94
|
+
const name = await identifyImpl(port, timeoutMs);
|
|
95
|
+
if (!res.ok) return { name, port, base_url: base, models: [], needs_key: true };
|
|
96
|
+
const data = await res.json();
|
|
97
|
+
return { name, port, base_url: base, models: (data.data || []).map((m) => m.id) };
|
|
83
98
|
}));
|
|
84
99
|
return results.map((r) => r.value).filter(Boolean);
|
|
85
100
|
}
|
package/client/public/app.js
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
const T = new URLSearchParams(location.search).get('token') || '';
|
|
3
3
|
const api = async (p, opt) => (await fetch(`/api${p}${p.includes('?') ? '&' : '?'}token=${T}`, { headers: { authorization: `Bearer ${T}` }, ...opt })).json();
|
|
4
4
|
const el = (h) => { const d = document.createElement('div'); d.innerHTML = h; return d.firstElementChild; };
|
|
5
|
-
const esc = (s) => String(s ?? '').replace(/[&<>]/g, (c) => ({ '&': '&', '<': '<', '>': '>' }[c]));
|
|
5
|
+
const esc = (s) => String(s ?? '').replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
6
6
|
let S = null, tab = location.hash.slice(1).split('?')[0] || 'skills';
|
|
7
7
|
|
|
8
8
|
async function refresh() {
|
|
9
9
|
try { S = await api('/state'); }
|
|
10
|
-
catch (e) { document.getElementById('app').innerHTML = `<p class="pill bad"
|
|
11
|
-
if (S?.error) { document.getElementById('app').innerHTML = `<p class="pill bad">${esc(S.error)}
|
|
12
|
-
if (!location.hash && !S.initialized) { tab = 'setup'; location.hash = 'setup'; } //
|
|
10
|
+
catch (e) { document.getElementById('app').innerHTML = `<p class="pill bad">连不上本地服务:${esc(e.message)}——服务可能已退出,重跑 <code>skillmkt serve</code></p>`; return; }
|
|
11
|
+
if (S?.error) { document.getElementById('app').innerHTML = `<p class="pill bad">${esc(S.error)}——网址里的 token 已失效,重跑 <code>skillmkt serve</code> 拿新链接</p>`; return; }
|
|
12
|
+
if (!location.hash && !S.initialized) { tab = 'setup'; location.hash = 'setup'; } // 未初始化→设置页
|
|
13
13
|
render();
|
|
14
14
|
}
|
|
15
15
|
const syncTabs = () => document.querySelectorAll('nav [data-t]').forEach((x) => x.classList.toggle('on', x.dataset.t === tab));
|
|
@@ -18,72 +18,93 @@ const es = new EventSource(`/api/events?token=${T}`);
|
|
|
18
18
|
es.addEventListener('decide', () => refresh());
|
|
19
19
|
es.addEventListener('config', () => refresh());
|
|
20
20
|
es.addEventListener('targets', () => refresh());
|
|
21
|
-
|
|
22
|
-
es.
|
|
21
|
+
const live = document.getElementById('live');
|
|
22
|
+
es.onopen = () => { live.classList.remove('off'); live.innerHTML = '<span class="dot"></span>已连接'; };
|
|
23
|
+
es.onerror = () => { live.classList.add('off'); live.innerHTML = '<span class="dot"></span>已断开'; };
|
|
23
24
|
|
|
25
|
+
// 机器状态 → 人话
|
|
26
|
+
const CN = {
|
|
27
|
+
installed: '已安装', available: '可用', likely: '疑似已装', absent: '未检测到',
|
|
28
|
+
managed: '已纳入管理', external: '未管理', 'hub-untracked': '未登记',
|
|
29
|
+
clean: '安全', suspicious: '可疑', malicious: '危险',
|
|
30
|
+
pending: '待处理', decided: '已裁决', resolved: '已裁决', dismissed: '已忽略',
|
|
31
|
+
outdated: '有更新', missing: '文件缺失', 'content-differs': '内容被改过', drifted: '有改动',
|
|
32
|
+
'keep-a': '采用 A', 'keep-b': '采用 B', merge: '已合并', active: '生效中',
|
|
33
|
+
};
|
|
24
34
|
const pill = (v) => {
|
|
25
|
-
const cls = ['clean', 'installed', 'active', 'managed', 'keep-a', 'keep-b'].includes(v) ? 'ok'
|
|
26
|
-
: ['malicious', 'pending', 'missing', 'outdated'].includes(v) ? 'bad' : 'warn';
|
|
27
|
-
return `<span class="pill ${cls}">${esc(v)}</span>`;
|
|
35
|
+
const cls = ['clean', 'installed', 'active', 'managed', 'keep-a', 'keep-b', 'decided', 'resolved', 'merge'].includes(v) ? 'ok'
|
|
36
|
+
: ['malicious', 'pending', 'missing', 'outdated', 'content-differs'].includes(v) ? 'bad' : 'warn';
|
|
37
|
+
return `<span class="pill ${cls}">${esc(CN[v] || v)}</span>`;
|
|
28
38
|
};
|
|
29
39
|
|
|
30
40
|
async function render() {
|
|
31
41
|
const app = document.getElementById('app');
|
|
32
|
-
document.getElementById('foot').textContent =
|
|
42
|
+
document.getElementById('foot').textContent = `数据目录:${S.hub}`;
|
|
33
43
|
syncTabs();
|
|
34
44
|
|
|
35
45
|
if (tab === 'skills') {
|
|
36
46
|
const skills = Object.entries(S.library.skills || {});
|
|
37
|
-
app.innerHTML = `<h2
|
|
38
|
-
<
|
|
39
|
-
|
|
47
|
+
app.innerHTML = `<h2>已安装的 skill(${skills.length})</h2>
|
|
48
|
+
<p class="desc">通过 skillmkt 安装、统一管理的 skill。点开「安装位置」可以决定它出现在哪些 AI 工具的 skills 目录里。</p>`
|
|
49
|
+
+ (skills.map(([n, s]) => `
|
|
50
|
+
<div class="card"><div class="row"><b>${esc(n)}</b><span class="mut">${esc(s.version || '')}</span><span class="mut">${esc(s.source?.registry || '')}</span>${pill(s.audit || 'clean')}
|
|
51
|
+
<span class="mut" style="margin-left:auto">装在:${(s.targets || []).map((t) => esc(CN[t] || t)).join('、') || '仅仓库'}</span>
|
|
40
52
|
<button data-tg="${esc(n)}">安装位置</button></div>
|
|
41
|
-
<div class="tgbox" data-box="${esc(n)}" style="display:none;margin-top:
|
|
53
|
+
<div class="tgbox" data-box="${esc(n)}" style="display:none;margin-top:10px"></div></div>`).join('')
|
|
54
|
+
|| `<div class="empty">还没有安装任何 skill。<br>在终端运行 <code>skillmkt install 名称</code> 安装;不知道装什么可以先 <code>skillmkt search 关键词</code> 搜一搜。</div>`);
|
|
42
55
|
app.querySelectorAll('[data-tg]').forEach((b) => b.onclick = () => {
|
|
43
56
|
const box = app.querySelector(`[data-box="${b.dataset.tg}"]`);
|
|
44
57
|
if (box.style.display === 'block') { box.style.display = 'none'; return; }
|
|
45
58
|
const s = S.library.skills[b.dataset.tg];
|
|
46
59
|
box.style.display = 'block';
|
|
47
|
-
box.innerHTML = `<label class="field"
|
|
48
|
-
(S.harnesses || []).filter((x) => x.state
|
|
49
|
-
`<label class="
|
|
50
|
-
+ `<div class="row" style="margin-top:
|
|
60
|
+
box.innerHTML = `<label class="field">复制到这些 AI 工具(取消勾选会把已复制的删掉)</label>` +
|
|
61
|
+
(S.harnesses || []).filter((x) => x.state !== 'absent' && !x.detectOnly).map((x) =>
|
|
62
|
+
`<label class="check"><input type="checkbox" data-th="${esc(x.id)}" ${(s.targets || []).includes(x.id) ? 'checked' : ''}> ${esc(x.id)} ${pill(x.state)} <span class="mut">${esc(x.primaryDir || '')}</span></label>`).join('')
|
|
63
|
+
+ `<div class="row" style="margin-top:10px"><button class="primary tgo">保存安装位置</button><span class="tout mut"></span></div>`;
|
|
51
64
|
box.querySelector('.tgo').onclick = async () => {
|
|
52
65
|
const ts = [...box.querySelectorAll('[data-th]:checked')].map((x) => x.dataset.th);
|
|
53
66
|
const r = await api('/targets', { method: 'POST', body: JSON.stringify({ name: b.dataset.tg, targets: ts }) });
|
|
54
|
-
box.querySelector('.tout').textContent = r.ok ? '
|
|
67
|
+
box.querySelector('.tout').textContent = r.ok ? '已保存并生效' : `失败:${r.error}`;
|
|
55
68
|
refresh();
|
|
56
69
|
};
|
|
57
70
|
});
|
|
58
|
-
app.innerHTML += `<h2
|
|
71
|
+
app.innerHTML += `<h2>你电脑上的 AI 工具</h2>
|
|
72
|
+
<p class="desc">检测到的 agent 及其 skills 目录。「可用」表示工具已安装、目录会在首次安装 skill 时自动建好。</p>`
|
|
73
|
+
+ (S.harnesses || []).map((h) => `<div class="card row"><b>${esc(h.id)}</b>${pill(h.state)}<span class="mut">${esc(h.primaryDir || h.dirs?.[0]?.path || '')}</span></div>`).join('');
|
|
59
74
|
const up = S.upstream.skills || {};
|
|
60
|
-
|
|
75
|
+
const outs = Object.entries(up).filter(([, u]) => u.outdated);
|
|
76
|
+
if (outs.length) app.innerHTML += `<h2>有更新可用(${outs.length})</h2>
|
|
77
|
+
<p class="desc">上游发布了新版本。终端运行 <code>skillmkt upgrade</code> 更新。</p>`
|
|
78
|
+
+ outs.map(([n]) => `<div class="card row"><b>${esc(n)}</b>${pill('outdated')}</div>`).join('');
|
|
61
79
|
}
|
|
62
80
|
|
|
63
81
|
if (tab === 'conflicts') {
|
|
64
82
|
const cs = S.conflicts || [];
|
|
65
83
|
const pendN = cs.filter((c) => c.status === 'pending').length;
|
|
66
|
-
app.innerHTML = `<h2
|
|
84
|
+
app.innerHTML = `<h2>冲突处理(${pendN} 条待处理)</h2>
|
|
85
|
+
<p class="desc">不同 skill 对同一件事给出相反规则时,需要你拍板。每条冲突填一句理由,然后选 A、选 B、自己合并,或者标为误报。</p>`;
|
|
67
86
|
for (const c of cs) {
|
|
68
87
|
const card = el(`<div class="card"><div class="row"><b>${esc(c.id)}</b>${pill(c.status)}<span class="mut">${esc(c.domain || '')}</span></div>
|
|
69
|
-
<div class="side a"
|
|
70
|
-
<div class="side b"
|
|
71
|
-
${c.ai_explanation ? `<p class="mut"
|
|
72
|
-
${c.dismiss_reason ? `<p class="mut"
|
|
88
|
+
<div class="side a"><span class="who">方案 A · 来自 ${esc(c.sides[0].source)}</span>${esc(c.sides[0].text)}</div>
|
|
89
|
+
<div class="side b"><span class="who">方案 B · 来自 ${esc(c.sides[1].source)}</span>${esc(c.sides[1].text)}</div>
|
|
90
|
+
${c.ai_explanation ? `<p class="mut">AI 分析:${esc(c.ai_explanation)}</p>` : ''}
|
|
91
|
+
${c.dismiss_reason ? `<p class="mut">误报原因:${esc(c.dismiss_reason)}</p>` : ''}
|
|
73
92
|
<div class="ev-imgs"></div>
|
|
74
|
-
${c.status === 'pending' ?
|
|
75
|
-
<
|
|
76
|
-
<
|
|
77
|
-
<div class="
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
93
|
+
${c.status === 'pending' ? `
|
|
94
|
+
<label class="field">裁决理由(必填——以后翻记录时知道为什么这么选)</label>
|
|
95
|
+
<input type="text" class="reason" placeholder="例:A 的规则更具体,覆盖了 B 的场景">
|
|
96
|
+
<div class="row" style="margin-top:12px">
|
|
97
|
+
<button data-r="keep-a">采用方案 A</button><button data-r="keep-b">采用方案 B</button>
|
|
98
|
+
<button data-r="merge">自己合并两条…</button><button data-r="dismissed">其实不冲突</button><span class="err mut"></span></div>
|
|
99
|
+
<div class="editbox" style="display:none;margin-top:12px">
|
|
100
|
+
<label class="field">合并后的规则文本(已预填两条原文,直接改)</label><textarea class="mtext"></textarea>
|
|
101
|
+
<div class="row" style="margin-top:10px"><button class="primary go">提交合并</button><button class="cancel">取消</button></div></div>` : ''}</div>`);
|
|
81
102
|
if (c.evidence_files) card.querySelector('.ev-imgs').innerHTML = c.evidence_files.filter((f) => f.endsWith('.png')).map((f) => `<img class="ev" src="/evidence/${c.id}/${f}?token=${T}" alt="evidence ${esc(f)}">`).join('');
|
|
82
103
|
const post = async (resolution, custom) => {
|
|
83
|
-
|
|
84
|
-
if (!reason)
|
|
85
|
-
|
|
86
|
-
|
|
104
|
+
const reason = card.querySelector('.reason')?.value || '';
|
|
105
|
+
if (!reason.trim()) { card.querySelector('.err').textContent = '先填一句裁决理由'; card.querySelector('.reason')?.focus(); return; }
|
|
106
|
+
const r = await api('/decide', { method: 'POST', body: JSON.stringify({ id: c.id, resolution, custom, reason }) });
|
|
107
|
+
if (r?.error) { card.querySelector('.err').textContent = r.error; return; }
|
|
87
108
|
refresh();
|
|
88
109
|
};
|
|
89
110
|
card.querySelectorAll('button[data-r]').forEach((b) => b.onclick = async () => {
|
|
@@ -100,14 +121,19 @@ async function render() {
|
|
|
100
121
|
card.querySelector('.editbox .cancel')?.addEventListener('click', () => { card.querySelector('.editbox').style.display = 'none'; });
|
|
101
122
|
app.appendChild(card);
|
|
102
123
|
}
|
|
103
|
-
if (!cs.length) app.innerHTML += '<
|
|
124
|
+
if (!cs.length) app.innerHTML += '<div class="empty">没有待处理的冲突。<br>合并两个 skill 时会自动检测:<code>skillmkt merge 名字A 名字B</code></div>';
|
|
104
125
|
}
|
|
105
126
|
|
|
106
127
|
if (tab === 'review') {
|
|
107
128
|
const scans = S.scans || [];
|
|
108
|
-
app.innerHTML = `<h2
|
|
129
|
+
app.innerHTML = `<h2>安全检查记录(${scans.length})</h2>
|
|
130
|
+
<p class="desc">每次安装 skill 时做的供应链安全检查结果(恶意脚本、凭证收集等)。</p>`
|
|
131
|
+
+ (scans.map((s) => `<div class="card row"><b>${esc(s.skill || s.name || '')}</b>${pill(s.verdict)}<span class="mut">${(s.findings || []).length} 条发现${s.llm ? `,AI 复审:${esc(CN[s.llm.verdict] || s.llm.verdict)}` : ''}</span></div>`).join('')
|
|
132
|
+
|| '<div class="empty">还没有检查记录——安装 skill 时会自动生成。</div>');
|
|
109
133
|
const decs = (S.decisions || []).filter((d) => d.status === 'active');
|
|
110
|
-
if (decs.length) app.innerHTML += `<h2
|
|
134
|
+
if (decs.length) app.innerHTML += `<h2>我的裁决记录(${decs.length})</h2>
|
|
135
|
+
<p class="desc">你在「冲突处理」里做过的拍板,都在这里留底。</p>`
|
|
136
|
+
+ decs.map((d) => `<div class="card"><div class="row"><b>${esc(d.id)}</b>${pill(d.resolution)}<span class="mut">via ${esc(d.decided_by)}</span></div><p class="mut">${esc(d.reason)}</p></div>`).join('');
|
|
111
137
|
}
|
|
112
138
|
|
|
113
139
|
if (tab === 'setup') {
|
|
@@ -115,33 +141,45 @@ async function render() {
|
|
|
115
141
|
const cfg = await api('/config');
|
|
116
142
|
const installed = h.filter((x) => x.state === 'installed' && !x.detectOnly).map((x) => x.id);
|
|
117
143
|
const sel = new Set(cfg.default_targets?.length ? cfg.default_targets : installed);
|
|
118
|
-
app.innerHTML = `<h2
|
|
119
|
-
<
|
|
120
|
-
|
|
144
|
+
app.innerHTML = `<h2>设置</h2>
|
|
145
|
+
<p class="desc">一次配置即可:AI 模型可选(用于冲突自动仲裁等智能功能,不配也能正常用);安装位置决定新 skill 默认复制到哪些 AI 工具。</p>
|
|
146
|
+
<div class="card"><h3>第 1 步 · AI 模型(可选)</h3>
|
|
147
|
+
<p class="mut">点「扫描」自动发现本机正在运行的模型服务(LM Studio、Ollama、oMLX 等)。${cfg.llm?.model ? `当前使用:<code>${esc(cfg.llm.model)}</code>` : ''}</p>
|
|
148
|
+
<div class="row"><button id="probe">扫描本机模型服务</button><span id="probe-out" class="mut"></span></div>
|
|
121
149
|
<div id="eps"></div>
|
|
122
|
-
<label class="field"
|
|
123
|
-
<label class="field"
|
|
124
|
-
<label class="field"
|
|
125
|
-
<
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
150
|
+
<label class="field">服务地址</label><input type="text" id="murl" placeholder="http://localhost:1234/v1" value="${esc(cfg.llm?.base_url || '')}">
|
|
151
|
+
<label class="field">模型名称</label><input type="text" id="mmodel" placeholder="点上面扫描出的条目可自动填入" value="${esc(cfg.llm?.model || '')}">
|
|
152
|
+
<label class="field">访问密钥</label><input type="text" id="mkey" value="${esc(cfg.llm?.api_key || '')}">
|
|
153
|
+
<p class="mut">可填 <code>env:变量名</code> 引用环境变量,密钥真值不会写进配置文件;本机服务一般留空即可。</p>
|
|
154
|
+
<div class="row"><button id="smoke">测试连接</button><span id="smoke-out" class="mut"></span></div></div>
|
|
155
|
+
<div class="card"><h3>第 2 步 · skill 默认安装位置</h3>
|
|
156
|
+
<p class="mut">勾选的 AI 工具会在你安装新 skill 时自动收到一份副本。已勾过的话保存即生效。</p>
|
|
157
|
+
${h.map((x) => `<label class="check"><input type="checkbox" data-h="${esc(x.id)}" ${sel.has(x.id) ? 'checked' : ''} ${x.state === 'absent' ? 'disabled' : ''}> ${esc(x.id)} ${pill(x.state)} <span class="mut">${esc(x.primaryDir || '')}</span></label>`).join('')}</div>
|
|
158
|
+
<div class="card"><h3>第 3 步 · 保存</h3>
|
|
159
|
+
<div class="row"><button class="primary" id="save">保存设置</button><span id="save-out" class="mut"></span></div></div>`;
|
|
129
160
|
app.querySelector('#probe').onclick = async () => {
|
|
130
161
|
app.querySelector('#probe-out').textContent = '扫描中…';
|
|
131
162
|
const eps = await api('/probe');
|
|
132
|
-
app.querySelector('#eps').innerHTML = eps.flatMap((e) => e.
|
|
133
|
-
|
|
134
|
-
|
|
163
|
+
app.querySelector('#eps').innerHTML = eps.flatMap((e) => e.needs_key
|
|
164
|
+
? [`<div class="ep" data-b="${esc(e.base_url)}" data-m="">${esc(e.name)}:${e.port} — <span class="mut">需要密钥(先点这行填地址,再填密钥、测试连接)</span></div>`]
|
|
165
|
+
: e.models.slice(0, 6).map((m) => `<div class="ep" data-b="${esc(e.base_url)}" data-m="${esc(m)}">${esc(e.name)}:${e.port} — <code>${esc(m)}</code></div>`)).join('')
|
|
166
|
+
|| '<p class="mut" style="margin-top:8px">没扫到——请确认模型服务已启动(会检查 8001 / 11434 / 1234 / 8000 / 8080 / 1337 / 5000 端口)</p>';
|
|
167
|
+
app.querySelector('#probe-out').textContent = `发现 ${eps.length} 个服务,点击条目自动填入`;
|
|
168
|
+
app.querySelectorAll('#eps [data-b]').forEach((d) => d.onclick = () => {
|
|
169
|
+
app.querySelectorAll('#eps .ep').forEach((x) => x.classList.remove('sel'));
|
|
170
|
+
d.classList.add('sel');
|
|
171
|
+
app.querySelector('#murl').value = d.dataset.b; app.querySelector('#mmodel').value = d.dataset.m;
|
|
172
|
+
});
|
|
135
173
|
};
|
|
136
174
|
app.querySelector('#smoke').onclick = async () => {
|
|
137
|
-
app.querySelector('#smoke-out').textContent = '
|
|
175
|
+
app.querySelector('#smoke-out').textContent = '测试中…';
|
|
138
176
|
const r = await api('/llm-smoke', { method: 'POST', body: JSON.stringify({ base_url: app.querySelector('#murl').value, model: app.querySelector('#mmodel').value, api_key: app.querySelector('#mkey').value }) });
|
|
139
|
-
app.querySelector('#smoke-out').textContent = r.ok ?
|
|
177
|
+
app.querySelector('#smoke-out').textContent = r.ok ? `连接成功,模型回复:${r.reply}` : `连接失败:${r.error}`;
|
|
140
178
|
};
|
|
141
179
|
app.querySelector('#save').onclick = async () => {
|
|
142
180
|
const targets = [...app.querySelectorAll('[data-h]:checked')].map((x) => x.dataset.h);
|
|
143
181
|
const r = await api('/config', { method: 'POST', body: JSON.stringify({ llm: { base_url: app.querySelector('#murl').value || null, model: app.querySelector('#mmodel').value || null, api_key: app.querySelector('#mkey').value || undefined, concurrency: 2, timeout_ms: 60000 }, default_targets: targets }) });
|
|
144
|
-
app.querySelector('#save-out').textContent = r.ok ? '
|
|
182
|
+
app.querySelector('#save-out').textContent = r.ok ? '已保存到 config.yml' : `保存失败:${r.error}`;
|
|
145
183
|
refresh();
|
|
146
184
|
};
|
|
147
185
|
}
|
package/client/public/index.html
CHANGED
|
@@ -1,90 +1,105 @@
|
|
|
1
1
|
<!doctype html>
|
|
2
2
|
<html lang="zh"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
|
3
|
-
<title>skillmkt —
|
|
3
|
+
<title>skillmkt — 本地 skill 管理面板</title>
|
|
4
4
|
<style>
|
|
5
5
|
/* skillmkt panel — 依 skill/SKILL.md 规则:light-first、OKLCH 角色 token、单强调色、
|
|
6
6
|
无玻璃/渐变/emoji 图标、可见标签、focus-visible ring、每屏至多一个填充主按钮 */
|
|
7
7
|
:root {
|
|
8
|
-
--color-paper: oklch(0.
|
|
9
|
-
--color-surface: oklch(0
|
|
10
|
-
--color-ink: oklch(0.
|
|
11
|
-
--color-ink-mut: oklch(0.
|
|
12
|
-
--color-line: oklch(0.
|
|
8
|
+
--color-paper: oklch(0.985 0.001 260);
|
|
9
|
+
--color-surface: oklch(1 0 0);
|
|
10
|
+
--color-ink: oklch(0.25 0.01 260);
|
|
11
|
+
--color-ink-mut: oklch(0.50 0.01 260);
|
|
12
|
+
--color-line: oklch(0.90 0.004 260);
|
|
13
13
|
--color-accent: oklch(0.52 0.14 55); /* 烧橙——唯一强调色 */
|
|
14
|
-
--color-accent-ink: oklch(0.
|
|
14
|
+
--color-accent-ink: oklch(0.995 0.003 260);
|
|
15
15
|
--color-ok: oklch(0.52 0.11 155);
|
|
16
16
|
--color-warn: oklch(0.55 0.13 80);
|
|
17
17
|
--color-bad: oklch(0.50 0.17 28);
|
|
18
|
-
--font-body:
|
|
18
|
+
--font-body: 17px/1.7 -apple-system, "SF Pro", "PingFang SC", "Noto Sans CJK SC", sans-serif;
|
|
19
19
|
--font-display: ui-serif, Georgia, "Songti SC", serif;
|
|
20
20
|
--font-mono: ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
21
|
-
--radius:
|
|
21
|
+
--radius: 10px;
|
|
22
22
|
}
|
|
23
23
|
* { box-sizing: border-box; }
|
|
24
24
|
body { margin: 0; font: var(--font-body); background: var(--color-paper); color: var(--color-ink); }
|
|
25
25
|
|
|
26
|
-
header { display: flex; align-items: baseline; gap:
|
|
27
|
-
header
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
header { display: flex; align-items: baseline; gap: 30px; padding: 22px 32px 0; border-bottom: 1px solid var(--color-line); flex-wrap: wrap; }
|
|
27
|
+
header .brand { display: flex; align-items: baseline; gap: 12px; }
|
|
28
|
+
header h1 { font: 600 24px/1 var(--font-display); margin: 0; letter-spacing: -0.01em; text-wrap: balance; }
|
|
29
|
+
header .tag { font-size: 14px; color: var(--color-ink-mut); }
|
|
30
|
+
nav { display: flex; gap: 6px; }
|
|
31
|
+
nav button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 18px 12px;
|
|
32
|
+
font: inherit; font-size: 16px; color: var(--color-ink-mut); cursor: pointer; }
|
|
31
33
|
nav button.on { color: var(--color-ink); border-bottom-color: var(--color-accent); }
|
|
32
34
|
nav button:hover { color: var(--color-ink); }
|
|
33
|
-
#live { margin-left: auto; font-size:
|
|
35
|
+
#live { margin-left: auto; font-size: 14px; color: var(--color-ink-mut); padding-bottom: 12px; display: flex; align-items: center; gap: 7px; }
|
|
36
|
+
#live .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--color-ok); }
|
|
37
|
+
#live.off .dot { background: var(--color-bad); }
|
|
34
38
|
|
|
35
|
-
main { padding:
|
|
36
|
-
h2 { font: 600
|
|
39
|
+
main { padding: 30px 32px 80px; max-width: 1060px; }
|
|
40
|
+
h2 { font: 600 21px/1.3 var(--font-display); margin: 38px 0 4px; text-wrap: balance; }
|
|
37
41
|
h2:first-child { margin-top: 0; }
|
|
42
|
+
.desc { margin: 0 0 18px; color: var(--color-ink-mut); font-size: 15.5px; max-width: 64ch; }
|
|
38
43
|
.mut { color: var(--color-ink-mut); }
|
|
39
|
-
code { font-family: var(--font-mono); font-size: 0.
|
|
44
|
+
code { font-family: var(--font-mono); font-size: 0.9em; background: color-mix(in oklch, var(--color-ink) 5%, var(--color-paper)); padding: 1px 5px; border-radius: 4px; }
|
|
40
45
|
|
|
41
46
|
.card { background: var(--color-surface); border: 1px solid var(--color-line); border-radius: var(--radius);
|
|
42
|
-
padding:
|
|
43
|
-
.
|
|
47
|
+
padding: 18px 20px; margin-bottom: 14px; }
|
|
48
|
+
.card h3 { font: 600 17px/1.3 var(--font-body); margin: 0 0 6px; }
|
|
49
|
+
.row { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; }
|
|
44
50
|
.row.end { justify-content: flex-end; }
|
|
45
51
|
|
|
46
|
-
.pill { display: inline-block; padding:
|
|
47
|
-
font-size:
|
|
52
|
+
.pill { display: inline-block; padding: 2px 11px; border: 1px solid var(--color-line); border-radius: 99px;
|
|
53
|
+
font-size: 13.5px; line-height: 1.6; color: var(--color-ink-mut); white-space: nowrap; }
|
|
48
54
|
.pill.ok { color: var(--color-ok); border-color: color-mix(in oklch, var(--color-ok) 40%, var(--color-line)); }
|
|
49
55
|
.pill.warn { color: var(--color-warn); border-color: color-mix(in oklch, var(--color-warn) 45%, var(--color-line)); }
|
|
50
56
|
.pill.bad { color: var(--color-bad); border-color: color-mix(in oklch, var(--color-bad) 45%, var(--color-line)); }
|
|
51
57
|
|
|
52
|
-
button { font: inherit; padding:
|
|
58
|
+
button { font: inherit; font-size: 15.5px; padding: 8px 18px; border: 1px solid var(--color-line); border-radius: 8px;
|
|
53
59
|
background: var(--color-surface); color: var(--color-ink); cursor: pointer; }
|
|
54
60
|
button:hover { border-color: var(--color-ink-mut); }
|
|
55
|
-
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible {
|
|
61
|
+
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
|
|
56
62
|
outline: 2px solid var(--color-accent); outline-offset: 2px; }
|
|
57
63
|
button.primary { background: var(--color-accent); border-color: var(--color-accent); color: var(--color-accent-ink); }
|
|
58
64
|
button.primary:hover { filter: brightness(0.94); }
|
|
65
|
+
button:disabled { opacity: 0.45; cursor: default; }
|
|
59
66
|
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
|
|
60
67
|
|
|
61
|
-
label.field { display: block; margin:
|
|
68
|
+
label.field { display: block; margin: 14px 0 4px; font-size: 14.5px; color: var(--color-ink-mut); }
|
|
62
69
|
input[type=text], input:not([type]), textarea, select {
|
|
63
|
-
width: 100%; font: inherit; padding:
|
|
64
|
-
border-radius:
|
|
65
|
-
textarea { min-height:
|
|
70
|
+
width: 100%; font: inherit; font-size: 16px; padding: 9px 13px; border: 1px solid var(--color-line);
|
|
71
|
+
border-radius: 8px; background: var(--color-paper); color: var(--color-ink); }
|
|
72
|
+
textarea { min-height: 7rem; resize: vertical; font-family: var(--font-mono); font-size: 14.5px; }
|
|
73
|
+
input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--color-accent); margin-right: 2px; }
|
|
74
|
+
label.check { display: flex; gap: 10px; align-items: center; padding: 7px 4px; cursor: pointer; border-radius: 6px; }
|
|
75
|
+
label.check:hover { background: color-mix(in oklch, var(--color-ink) 4%, var(--color-surface)); }
|
|
66
76
|
|
|
67
|
-
.side { padding:
|
|
77
|
+
.side { padding: 14px 16px; border-left: 3px solid var(--color-line); margin: 10px 0; font-size: 15.5px;
|
|
78
|
+
background: color-mix(in oklch, var(--color-ink) 3%, var(--color-surface)); border-radius: 0 8px 8px 0; }
|
|
79
|
+
.side .who { display: block; font-size: 14px; font-weight: 600; margin-bottom: 4px; }
|
|
68
80
|
.side.a { border-color: var(--color-accent); }
|
|
69
81
|
.side.b { border-color: var(--color-warn); }
|
|
70
|
-
img.ev { max-width:
|
|
82
|
+
img.ev { max-width: 420px; width: 100%; border: 1px solid var(--color-line); border-radius: 8px; margin: 8px 10px 0 0; }
|
|
71
83
|
|
|
72
|
-
.ep { cursor: pointer; padding:
|
|
84
|
+
.ep { cursor: pointer; padding: 8px 12px; border-radius: 8px; font-size: 15.5px; }
|
|
73
85
|
.ep:hover { background: var(--color-paper); }
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
th {
|
|
77
|
-
|
|
86
|
+
.ep.sel { background: color-mix(in oklch, var(--color-accent) 10%, var(--color-surface)); }
|
|
87
|
+
table { width: 100%; border-collapse: collapse; font-size: 15.5px; }
|
|
88
|
+
td, th { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--color-line); }
|
|
89
|
+
th { font-size: 14px; color: var(--color-ink-mut); font-weight: 500; }
|
|
90
|
+
.empty { padding: 26px 20px; color: var(--color-ink-mut); }
|
|
91
|
+
.empty code { font-size: 14.5px; }
|
|
92
|
+
footer { padding: 22px 32px; border-top: 1px solid var(--color-line); font-size: 14px; color: var(--color-ink-mut); }
|
|
78
93
|
</style></head><body>
|
|
79
94
|
<header>
|
|
80
|
-
<h1>awesome-skill-market</h1>
|
|
95
|
+
<div class="brand"><h1>awesome-skill-market</h1><span class="tag">skillmkt 本地管理面板</span></div>
|
|
81
96
|
<nav>
|
|
82
|
-
<button class="on" data-t="skills"
|
|
83
|
-
<button data-t="conflicts"
|
|
84
|
-
<button data-t="review"
|
|
85
|
-
<button data-t="setup"
|
|
97
|
+
<button class="on" data-t="skills">已安装</button>
|
|
98
|
+
<button data-t="conflicts">冲突处理</button>
|
|
99
|
+
<button data-t="review">安全审核</button>
|
|
100
|
+
<button data-t="setup">设置</button>
|
|
86
101
|
</nav>
|
|
87
|
-
<span id="live"></span>
|
|
102
|
+
<span id="live"><span class="dot"></span>连接中…</span>
|
|
88
103
|
</header>
|
|
89
104
|
<main id="app"><p class="mut">载入中…</p></main>
|
|
90
105
|
<footer id="foot"></footer>
|