skillmkt 0.4.15 → 0.4.17
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/lib/dashboard.js +3 -3
- package/client/lib/llm.js +17 -5
- package/client/lib/render.js +5 -2
- package/package.json +1 -1
package/client/lib/dashboard.js
CHANGED
|
@@ -25,8 +25,8 @@ export async function renderDashboard(ctx) {
|
|
|
25
25
|
const upstream = readYAMLFile(path.join(hub, 'state', 'upstream.yml'), { skills: {} });
|
|
26
26
|
const conflicts = listYAML(path.join(hub, 'conflicts'));
|
|
27
27
|
|
|
28
|
-
// llm 解析链有 env
|
|
29
|
-
const
|
|
30
|
-
dashboard({ hub, library, scan: { rows, harnesses, managedHash }, upstream, conflicts, llm, llmVia, project });
|
|
28
|
+
// llm 解析链有 env/.env 兜底——非 config 来源时标注,免得用户困惑
|
|
29
|
+
const configFile = fs.existsSync(path.join(hub, 'config.yml'));
|
|
30
|
+
dashboard({ hub, library, scan: { rows, harnesses, managedHash }, upstream, conflicts, llm, llmVia: llm?.via, configFile, project });
|
|
31
31
|
return 0;
|
|
32
32
|
}
|
package/client/lib/llm.js
CHANGED
|
@@ -71,12 +71,23 @@ export function resolveKeyRef(keyRef, ctx) {
|
|
|
71
71
|
|
|
72
72
|
export function resolveLLM(ctx) {
|
|
73
73
|
if (ctx.flags.noLlm) return null;
|
|
74
|
-
//
|
|
75
|
-
const
|
|
74
|
+
// 取值优先级:flag > 真环境变量 > cwd/.env > hub/.env > config.llm(via 记来源供展示)
|
|
75
|
+
const envHub = ctx.hub ? loadDotEnv(path.join(ctx.hub, '.env')) : {};
|
|
76
|
+
const envCwd = loadDotEnv(path.join(ctx.cwd, '.env'));
|
|
77
|
+
const env = { ...envHub, ...envCwd, ...process.env };
|
|
76
78
|
const cfg = ctx.config.llm || {};
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
79
|
+
const pick = (flagV, names, cfgV) => {
|
|
80
|
+
if (flagV) return [flagV, 'flag'];
|
|
81
|
+
for (const n of names) {
|
|
82
|
+
if (process.env[n]) return [process.env[n], `env ${n}`];
|
|
83
|
+
if (envCwd[n]) return [envCwd[n], `${n}(cwd/.env)`];
|
|
84
|
+
if (envHub[n]) return [envHub[n], `${n}(hub/.env)`];
|
|
85
|
+
}
|
|
86
|
+
return [cfgV, 'config'];
|
|
87
|
+
};
|
|
88
|
+
const [base, via] = pick(ctx.flags.baseUrl, ['SKILLMKT_LLM_BASE_URL', 'OMLX_BASE_URL'], cfg.base_url);
|
|
89
|
+
const [model] = pick(ctx.flags.model, ['SKILLMKT_LLM_MODEL', 'OMLX_MODEL'], cfg.model);
|
|
90
|
+
const [keyRef] = pick(ctx.flags.apiKeyEnv, ['SKILLMKT_LLM_API_KEY', 'OMLX_API_KEY'], cfg.api_key);
|
|
80
91
|
if (!base || !model) return null;
|
|
81
92
|
// api_key:"env:VAR"→环境变量;"enc:v1:…"→本机解密;裸值(不建议)原样用
|
|
82
93
|
const key = keyRef?.startsWith('env:') ? env[keyRef.slice(4)] : keyRef?.startsWith('enc:') ? decryptSecret(keyRef) : keyRef;
|
|
@@ -84,6 +95,7 @@ export function resolveLLM(ctx) {
|
|
|
84
95
|
base_url: base.replace(/\/+$/, ''),
|
|
85
96
|
model,
|
|
86
97
|
api_key: key || '',
|
|
98
|
+
via: via === 'config' ? null : via,
|
|
87
99
|
concurrency: +(cfg.concurrency ?? 2),
|
|
88
100
|
timeout_ms: +(cfg.timeout_ms ?? 60000),
|
|
89
101
|
};
|
package/client/lib/render.js
CHANGED
|
@@ -25,7 +25,7 @@ export const fail = (s) => err(`✗ ${s}`);
|
|
|
25
25
|
export const info = (s) => err(` ${s}`);
|
|
26
26
|
|
|
27
27
|
// 裸跑仪表盘:只摆"需要注意力"的信息
|
|
28
|
-
export function dashboard({ hub, library, scan, upstream, conflicts, llm, llmVia, project }) {
|
|
28
|
+
export function dashboard({ hub, library, scan, upstream, conflicts, llm, llmVia, configFile = true, project }) {
|
|
29
29
|
const skills = Object.keys(library.skills || {});
|
|
30
30
|
const updates = Object.keys(upstream?.skills || {}).filter(
|
|
31
31
|
(n) => upstream.skills[n]?.tree_hash !== (scan.managedHash?.[n] ?? null) && upstream.skills[n]
|
|
@@ -35,7 +35,7 @@ export function dashboard({ hub, library, scan, upstream, conflicts, llm, llmVia
|
|
|
35
35
|
const audits = skills.map((n) => library.skills[n].audit);
|
|
36
36
|
const bad = audits.filter((a) => a === 'suspicious' || a === 'quarantined').length;
|
|
37
37
|
|
|
38
|
-
err(`skillmkt · hub ${hub}${llm ? ` · llm ${llm.model} ✓${llmVia
|
|
38
|
+
err(`skillmkt · hub ${hub}${llm ? ` · llm ${llm.model} ✓${llmVia ? L(`(来自 ${llmVia},未写 config.yml)`, ` (from ${llmVia}, not in config.yml)`) : ''}` : ''}`);
|
|
39
39
|
err('');
|
|
40
40
|
err(`skills ${skills.length} installed${updates ? ` · ${updates} update available` : ''} · audit ${audits.length - bad}✓${bad ? `/${bad}⚠` : ''}`);
|
|
41
41
|
const hs = scan.harnesses.filter((h) => h.state !== 'absent')
|
|
@@ -48,6 +48,9 @@ export function dashboard({ hub, library, scan, upstream, conflicts, llm, llmVia
|
|
|
48
48
|
const hints = [];
|
|
49
49
|
if (pending) hints.push(L('skillmkt conflicts --ui 裁决冲突(开面板看图)', 'skillmkt conflicts --ui decide conflicts (visual panel)'));
|
|
50
50
|
if (updates) hints.push(L('skillmkt outdated 看可更新项', 'skillmkt outdated view updates'));
|
|
51
|
+
if (!configFile) hints.push(llmVia
|
|
52
|
+
? L('skillmkt init 把设置写进 config.yml(现在全靠环境变量兜底)', 'skillmkt init write settings to config.yml (currently env-only)')
|
|
53
|
+
: L('skillmkt init 初始化设置(语言/模型/目标 agent)', 'skillmkt init set up language/model/agents'));
|
|
51
54
|
hints.push(externals
|
|
52
55
|
? L('skillmkt list 安装矩阵 + ◌external 路径', 'skillmkt list install matrix + ◌external paths')
|
|
53
56
|
: L('skillmkt list 安装矩阵', 'skillmkt list install matrix'));
|