skillmkt 0.1.6 → 0.1.8
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/bin/skillmkt.js
CHANGED
|
@@ -36,9 +36,11 @@ async function bareRun(ctx) {
|
|
|
36
36
|
process.exit(1);
|
|
37
37
|
}
|
|
38
38
|
const mod = await import('../commands/init.js');
|
|
39
|
+
withState(ctx);
|
|
39
40
|
return mod.run(ctx);
|
|
40
41
|
}
|
|
41
42
|
const { renderDashboard } = await import('../lib/dashboard.js');
|
|
43
|
+
withState(ctx);
|
|
42
44
|
return renderDashboard(ctx);
|
|
43
45
|
}
|
|
44
46
|
|
package/client/commands/serve.js
CHANGED
|
@@ -9,7 +9,7 @@ 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 { scanAll } from '../lib/scanner.js';
|
|
12
|
+
import { scanAll, detectHarnesses } from '../lib/scanner.js';
|
|
13
13
|
import { probeEndpoints, chat } from '../lib/llm.js';
|
|
14
14
|
import { projectSkill, targetDirFor } from '../lib/project.js';
|
|
15
15
|
import { treeHash } from '../lib/package.js';
|
|
@@ -28,14 +28,15 @@ export async function startServer(ctx, { quiet = false, port = 0 } = {}) {
|
|
|
28
28
|
let lastActive = Date.now();
|
|
29
29
|
const idleMs = (ctx.config.daemon?.idle_minutes ?? 30) * 60e3;
|
|
30
30
|
|
|
31
|
+
const harnesses = ctx.harnesses ?? detectHarnesses(); // bareRun/init 路径 ctx 可能没 withState
|
|
31
32
|
const state = () => ({
|
|
32
33
|
hub: ctx.hub,
|
|
33
34
|
initialized: (() => { const r = readConfig(ctx.hub)._raw; return !!(r.ui || r.llm || r.default_targets); })(),
|
|
34
35
|
library: readLibrary(ctx.hub), lock: readLock(ctx.hub),
|
|
35
36
|
upstream: readUpstream(ctx.hub), conflicts: loadConflicts(ctx.hub),
|
|
36
|
-
decisions: loadDecisions(ctx.hub), harnesses
|
|
37
|
+
decisions: loadDecisions(ctx.hub), harnesses,
|
|
37
38
|
scans: fs.existsSync(path.join(ctx.hub, 'scans')) ? fs.readdirSync(path.join(ctx.hub, 'scans')).map((f) => readYAML(path.join(ctx.hub, 'scans', f))).filter(Boolean) : [],
|
|
38
|
-
scans_all: scanAll(ctx.hub,
|
|
39
|
+
scans_all: scanAll(ctx.hub, harnesses, readLibrary(ctx.hub), ctx.cwd),
|
|
39
40
|
});
|
|
40
41
|
|
|
41
42
|
const routes = {
|
|
@@ -115,7 +116,10 @@ export async function startServer(ctx, { quiet = false, port = 0 } = {}) {
|
|
|
115
116
|
res.writeHead(404); return res.end('{"error":"not found"}');
|
|
116
117
|
}
|
|
117
118
|
const h = routes[`${req.method} ${u.pathname}`];
|
|
118
|
-
if (h)
|
|
119
|
+
if (h) {
|
|
120
|
+
try { return res.end(JSON.stringify(await h())); }
|
|
121
|
+
catch (e) { res.writeHead(500); return res.end(JSON.stringify({ error: e.message })); }
|
|
122
|
+
}
|
|
119
123
|
res.writeHead(404); return res.end('{"error":"not found"}');
|
|
120
124
|
}
|
|
121
125
|
// 静态:public/ + evidence 文件(冲突截图)
|
package/client/public/app.js
CHANGED
|
@@ -124,7 +124,7 @@ async function render() {
|
|
|
124
124
|
<label class="field">api_key(env:VAR 引用,不存真值;留空=无 key)</label><input type="text" id="mkey" value="${esc(cfg.llm?.api_key || '')}">
|
|
125
125
|
<div class="row" style="margin-top:8px"><button id="smoke">测试连接</button><span id="smoke-out" class="mut"></span></div></div>
|
|
126
126
|
<div class="card"><b>skill 装到哪些 agent</b><span class="mut">(勾选后,新装的 skill 会复制进这些 agent 的 skills 目录)</span>
|
|
127
|
-
${h.map((x) => `<label class="row"><input type="checkbox" data-h="${esc(x.id)}" ${sel.has(x.id) ? 'checked' : ''} ${x.state
|
|
127
|
+
${h.map((x) => `<label class="row"><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>
|
|
128
128
|
<div class="card"><button class="primary" id="save">保存配置</button><span id="save-out" class="mut"></span></div>`;
|
|
129
129
|
app.querySelector('#probe').onclick = async () => {
|
|
130
130
|
app.querySelector('#probe-out').textContent = '扫描中…';
|
package/client/public/index.html
CHANGED
|
@@ -77,7 +77,7 @@ th { font-size: 13px; color: var(--color-ink-mut); font-weight: 500; }
|
|
|
77
77
|
footer { padding: 20px 28px; border-top: 1px solid var(--color-line); font-size: 13px; color: var(--color-ink-mut); }
|
|
78
78
|
</style></head><body>
|
|
79
79
|
<header>
|
|
80
|
-
<h1>
|
|
80
|
+
<h1>awesome-skill-market</h1>
|
|
81
81
|
<nav>
|
|
82
82
|
<button class="on" data-t="skills">skills</button>
|
|
83
83
|
<button data-t="conflicts">conflicts</button>
|