@skillfm/local 2.7.10 → 2.7.11
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/README.md +2 -2
- package/dist/_vendored-contracts/beacon-assets-v1.d.ts +160 -0
- package/dist/_vendored-contracts/beacon-assets-v1.d.ts.map +1 -0
- package/dist/_vendored-contracts/beacon-assets-v1.js +29 -0
- package/dist/_vendored-contracts/beacon-assets-v1.js.map +1 -0
- package/dist/_vendored-contracts/beacon-mcp-tools-v1.d.ts +373 -0
- package/dist/_vendored-contracts/beacon-mcp-tools-v1.d.ts.map +1 -0
- package/dist/_vendored-contracts/beacon-mcp-tools-v1.js +131 -0
- package/dist/_vendored-contracts/beacon-mcp-tools-v1.js.map +1 -0
- package/dist/_vendored-contracts/beacon-preferences-v1.d.ts +68 -0
- package/dist/_vendored-contracts/beacon-preferences-v1.d.ts.map +1 -0
- package/dist/_vendored-contracts/beacon-preferences-v1.js +26 -0
- package/dist/_vendored-contracts/beacon-preferences-v1.js.map +1 -0
- package/dist/_vendored-contracts/beacon-rule-protocol-v1.d.ts +208 -0
- package/dist/_vendored-contracts/beacon-rule-protocol-v1.d.ts.map +1 -0
- package/dist/_vendored-contracts/beacon-rule-protocol-v1.js +25 -0
- package/dist/_vendored-contracts/beacon-rule-protocol-v1.js.map +1 -0
- package/dist/_vendored-contracts/beacon-usage-v1.d.ts +88 -0
- package/dist/_vendored-contracts/beacon-usage-v1.d.ts.map +1 -0
- package/dist/_vendored-contracts/beacon-usage-v1.js +27 -0
- package/dist/_vendored-contracts/beacon-usage-v1.js.map +1 -0
- package/dist/_vendored-contracts/index.d.ts +29 -0
- package/dist/_vendored-contracts/index.d.ts.map +1 -1
- package/dist/_vendored-contracts/index.js.map +1 -1
- package/dist/_vendored-contracts/safe-skill-observation-v1.d.ts +149 -0
- package/dist/_vendored-contracts/safe-skill-observation-v1.d.ts.map +1 -0
- package/dist/_vendored-contracts/safe-skill-observation-v1.js +23 -0
- package/dist/_vendored-contracts/safe-skill-observation-v1.js.map +1 -0
- package/dist/_vendored-contracts/skill-distribution.d.ts +16 -0
- package/dist/_vendored-contracts/skill-distribution.d.ts.map +1 -1
- package/dist/_vendored-contracts/skill-distribution.js.map +1 -1
- package/dist/{safe → agent-forcing}/claude-code-skill-v2.d.ts +7 -4
- package/dist/agent-forcing/claude-code-skill-v2.d.ts.map +1 -0
- package/dist/{safe → agent-forcing}/claude-code-skill-v2.js +21 -19
- package/dist/agent-forcing/claude-code-skill-v2.js.map +1 -0
- package/dist/{safe/safe-rules.d.ts → agent-forcing/forcing-rules.d.ts} +6 -15
- package/dist/agent-forcing/forcing-rules.d.ts.map +1 -0
- package/dist/agent-forcing/forcing-rules.js +203 -0
- package/dist/agent-forcing/forcing-rules.js.map +1 -0
- package/dist/agent-forcing/index.d.ts +5 -0
- package/dist/agent-forcing/index.d.ts.map +1 -0
- package/dist/agent-forcing/index.js +6 -0
- package/dist/agent-forcing/index.js.map +1 -0
- package/dist/{safe → agent-forcing}/injectors.d.ts +7 -7
- package/dist/agent-forcing/injectors.d.ts.map +1 -0
- package/dist/{safe → agent-forcing}/injectors.js +24 -21
- package/dist/agent-forcing/injectors.js.map +1 -0
- package/dist/agent-forcing/slash-commands.d.ts +49 -0
- package/dist/agent-forcing/slash-commands.d.ts.map +1 -0
- package/dist/agent-forcing/slash-commands.js +166 -0
- package/dist/agent-forcing/slash-commands.js.map +1 -0
- package/dist/{safe → agent-forcing}/types.d.ts +1 -1
- package/dist/agent-forcing/types.d.ts.map +1 -0
- package/dist/{safe → agent-forcing}/types.js +4 -4
- package/dist/agent-forcing/types.js.map +1 -0
- package/dist/agent-hints.d.ts +1 -1
- package/dist/agent-hints.d.ts.map +1 -1
- package/dist/agent-hints.js +35 -41
- package/dist/agent-hints.js.map +1 -1
- package/dist/beacon/apprentice-capabilities.d.ts +10 -0
- package/dist/beacon/apprentice-capabilities.d.ts.map +1 -0
- package/dist/beacon/apprentice-capabilities.js +34 -0
- package/dist/beacon/apprentice-capabilities.js.map +1 -0
- package/dist/checkup/dimension-1-usage.d.ts +8 -1
- package/dist/checkup/dimension-1-usage.d.ts.map +1 -1
- package/dist/checkup/dimension-1-usage.js +3 -2
- package/dist/checkup/dimension-1-usage.js.map +1 -1
- package/dist/checkup/dimension-2-context.d.ts +12 -0
- package/dist/checkup/dimension-2-context.d.ts.map +1 -0
- package/dist/checkup/dimension-2-context.js +56 -0
- package/dist/checkup/dimension-2-context.js.map +1 -0
- package/dist/checkup/dimension-5-behavior.d.ts +12 -0
- package/dist/checkup/dimension-5-behavior.d.ts.map +1 -0
- package/dist/checkup/dimension-5-behavior.js +40 -0
- package/dist/checkup/dimension-5-behavior.js.map +1 -0
- package/dist/checkup/dimension-6-injection.d.ts +41 -0
- package/dist/checkup/dimension-6-injection.d.ts.map +1 -0
- package/dist/checkup/dimension-6-injection.js +74 -0
- package/dist/checkup/dimension-6-injection.js.map +1 -0
- package/dist/checkup/index.d.ts +3 -0
- package/dist/checkup/index.d.ts.map +1 -1
- package/dist/checkup/index.js +3 -0
- package/dist/checkup/index.js.map +1 -1
- package/dist/checkup/last-report.d.ts +32 -0
- package/dist/checkup/last-report.d.ts.map +1 -0
- package/dist/checkup/last-report.js +91 -0
- package/dist/checkup/last-report.js.map +1 -0
- package/dist/checkup/report.d.ts +13 -1
- package/dist/checkup/report.d.ts.map +1 -1
- package/dist/checkup/report.js +5 -3
- package/dist/checkup/report.js.map +1 -1
- package/dist/forcing-cli.d.ts +2 -0
- package/dist/forcing-cli.d.ts.map +1 -0
- package/dist/forcing-cli.js +2 -0
- package/dist/forcing-cli.js.map +1 -0
- package/dist/guard/bin.js +0 -0
- package/dist/guard/cli.js +2 -2
- package/dist/guard/cli.js.map +1 -1
- package/dist/guard/prompt-context.d.ts +3 -3
- package/dist/guard/prompt-context.d.ts.map +1 -1
- package/dist/guard/prompt-context.js +24 -42
- package/dist/guard/prompt-context.js.map +1 -1
- package/dist/harness/templates.d.ts +1 -1
- package/dist/harness/templates.js +1 -1
- package/dist/harness/templates.js.map +1 -1
- package/dist/index.js +14 -20
- package/dist/index.js.map +1 -1
- package/dist/mcp/brain-client.d.ts.map +1 -1
- package/dist/mcp/brain-client.js +3 -0
- package/dist/mcp/brain-client.js.map +1 -1
- package/dist/mcp/index.d.ts +1 -0
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +5 -0
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/tools/_sentry-descriptions.js +2 -2
- package/dist/mcp/tools/_sentry-descriptions.js.map +1 -1
- package/dist/mcp/tools/checkup.d.ts +17 -2
- package/dist/mcp/tools/checkup.d.ts.map +1 -1
- package/dist/mcp/tools/checkup.js +41 -3
- package/dist/mcp/tools/checkup.js.map +1 -1
- package/dist/mcp/tools/index.d.ts +3 -16
- package/dist/mcp/tools/index.d.ts.map +1 -1
- package/dist/mcp/tools/index.js +40 -228
- package/dist/mcp/tools/index.js.map +1 -1
- package/dist/mcp/tools/install-module.d.ts +25 -0
- package/dist/mcp/tools/install-module.d.ts.map +1 -0
- package/dist/mcp/tools/install-module.js +87 -0
- package/dist/mcp/tools/install-module.js.map +1 -0
- package/dist/mcp/tools/send-daily-report.d.ts +29 -0
- package/dist/mcp/tools/send-daily-report.d.ts.map +1 -0
- package/dist/mcp/tools/send-daily-report.js +61 -0
- package/dist/mcp/tools/send-daily-report.js.map +1 -0
- package/dist/mcp/tools/setup-agent-forcing.d.ts +19 -0
- package/dist/mcp/tools/setup-agent-forcing.d.ts.map +1 -0
- package/dist/mcp/tools/setup-agent-forcing.js +86 -0
- package/dist/mcp/tools/setup-agent-forcing.js.map +1 -0
- package/dist/mcp/tools/setup-gateway.d.ts +2 -1
- package/dist/mcp/tools/setup-gateway.d.ts.map +1 -1
- package/dist/mcp/tools/setup-gateway.js +24 -6
- package/dist/mcp/tools/setup-gateway.js.map +1 -1
- package/dist/mcp/tools/setup-safe.d.ts +1 -18
- package/dist/mcp/tools/setup-safe.d.ts.map +1 -1
- package/dist/mcp/tools/setup-safe.js +1 -89
- package/dist/mcp/tools/setup-safe.js.map +1 -1
- package/dist/mcp/tools/unlock.d.ts +2 -2
- package/dist/mcp/tools/unlock.d.ts.map +1 -1
- package/dist/mcp/tools/unlock.js +40 -27
- package/dist/mcp/tools/unlock.js.map +1 -1
- package/dist/mcp-stdio/bin.js +0 -0
- package/dist/mcp-stdio/server.d.ts.map +1 -1
- package/dist/mcp-stdio/server.js +108 -265
- package/dist/mcp-stdio/server.js.map +1 -1
- package/dist/safe/index.d.ts +4 -4
- package/dist/safe/index.d.ts.map +1 -1
- package/dist/safe/index.js +7 -4
- package/dist/safe/index.js.map +1 -1
- package/dist/safe-cli.d.ts +6 -0
- package/dist/safe-cli.d.ts.map +1 -1
- package/dist/safe-cli.js +13 -5
- package/dist/safe-cli.js.map +1 -1
- package/dist/safe-observation/collector.d.ts +21 -0
- package/dist/safe-observation/collector.d.ts.map +1 -0
- package/dist/safe-observation/collector.js +101 -0
- package/dist/safe-observation/collector.js.map +1 -0
- package/dist/safe-observation/store.d.ts +34 -0
- package/dist/safe-observation/store.d.ts.map +1 -0
- package/dist/safe-observation/store.js +80 -0
- package/dist/safe-observation/store.js.map +1 -0
- package/dist/save-token/gateway-setup.d.ts +33 -3
- package/dist/save-token/gateway-setup.d.ts.map +1 -1
- package/dist/save-token/gateway-setup.js +165 -18
- package/dist/save-token/gateway-setup.js.map +1 -1
- package/dist/scheduler/brain-push-client.d.ts.map +1 -1
- package/dist/scheduler/brain-push-client.js +13 -2
- package/dist/scheduler/brain-push-client.js.map +1 -1
- package/dist/scheduler/types.d.ts +5 -0
- package/dist/scheduler/types.d.ts.map +1 -1
- package/dist/scheduler/types.js +3 -1
- package/dist/scheduler/types.js.map +1 -1
- package/dist/setup-safe.d.ts +20 -0
- package/dist/setup-safe.d.ts.map +1 -0
- package/dist/setup-safe.js +93 -0
- package/dist/setup-safe.js.map +1 -0
- package/dist/skill-installer/index.d.ts +9 -0
- package/dist/skill-installer/index.d.ts.map +1 -1
- package/dist/skill-installer/index.js +20 -1
- package/dist/skill-installer/index.js.map +1 -1
- package/dist/skill-md/template.d.ts +18 -4
- package/dist/skill-md/template.d.ts.map +1 -1
- package/dist/skill-md/template.js +253 -59
- package/dist/skill-md/template.js.map +1 -1
- package/dist/skill-runner/discovery.d.ts.map +1 -1
- package/dist/skill-runner/discovery.js +8 -5
- package/dist/skill-runner/discovery.js.map +1 -1
- package/dist/skill-tunnel/cli.d.ts.map +1 -1
- package/dist/skill-tunnel/cli.js +22 -0
- package/dist/skill-tunnel/cli.js.map +1 -1
- package/dist/skill-tunnel/client.d.ts +5 -0
- package/dist/skill-tunnel/client.d.ts.map +1 -1
- package/dist/skill-tunnel/client.js +2 -0
- package/dist/skill-tunnel/client.js.map +1 -1
- package/dist/skill-tunnel/local-bridge.d.ts +9 -0
- package/dist/skill-tunnel/local-bridge.d.ts.map +1 -1
- package/dist/skill-tunnel/local-bridge.js +24 -1
- package/dist/skill-tunnel/local-bridge.js.map +1 -1
- package/package.json +3 -3
- package/dist/beacon-cleanup/audit.d.ts +0 -24
- package/dist/beacon-cleanup/audit.d.ts.map +0 -1
- package/dist/beacon-cleanup/audit.js +0 -292
- package/dist/beacon-cleanup/audit.js.map +0 -1
- package/dist/safe/claude-code-skill-v2.d.ts.map +0 -1
- package/dist/safe/claude-code-skill-v2.js.map +0 -1
- package/dist/safe/injectors.d.ts.map +0 -1
- package/dist/safe/injectors.js.map +0 -1
- package/dist/safe/safe-rules.d.ts.map +0 -1
- package/dist/safe/safe-rules.js +0 -152
- package/dist/safe/safe-rules.js.map +0 -1
- package/dist/safe/types.d.ts.map +0 -1
- package/dist/safe/types.js.map +0 -1
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
// sdk/skillfm-local/src/agent-forcing/slash-commands.ts
|
|
2
|
+
//
|
|
3
|
+
// SkillFM slash command installer for Claude Code.
|
|
4
|
+
//
|
|
5
|
+
// Installs / removes ~/.claude/commands/skillfm.md (+ sf.md alias) so users
|
|
6
|
+
// can type `/skillfm` (or `/sf`) to manually trigger the Beacon checkup
|
|
7
|
+
// (the manual-trigger version of the daily report).
|
|
8
|
+
//
|
|
9
|
+
// Lifecycle: bound to the SAFE setup flow. injectClaudeCode() also installs
|
|
10
|
+
// the slash commands; removeAllInjections() also removes them.
|
|
11
|
+
import { promises as fs, existsSync } from 'node:fs';
|
|
12
|
+
import path from 'node:path';
|
|
13
|
+
import { homedir } from 'node:os';
|
|
14
|
+
const SLASH_MARKER_START = '<!-- skillfm-slash-command auto-installed, do not edit by hand -->';
|
|
15
|
+
const SLASH_MARKER_END = '<!-- skillfm-slash-command end -->';
|
|
16
|
+
/** Where Claude Code reads user-level slash commands from. */
|
|
17
|
+
function commandsDir() {
|
|
18
|
+
return path.join(homedir(), '.claude', 'commands');
|
|
19
|
+
}
|
|
20
|
+
export function skillfmSlashCommandPath() {
|
|
21
|
+
return path.join(commandsDir(), 'skillfm.md');
|
|
22
|
+
}
|
|
23
|
+
export function skillfmSlashCommandAliasPath() {
|
|
24
|
+
return path.join(commandsDir(), 'sf.md');
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Render the body of /skillfm. Prompt-style (instructs the agent how to
|
|
28
|
+
* proceed) rather than tool-call-style — a rendered prompt is more robust
|
|
29
|
+
* across models than a literal tool-call payload.
|
|
30
|
+
*
|
|
31
|
+
* The "扫描期间" (scan window) is computed from sidecar local
|
|
32
|
+
* `~/.skillfm/last-report.json`, which the `skillfm_checkup` tool reads /
|
|
33
|
+
* updates as a side-effect when called with `since_last_report: true`.
|
|
34
|
+
*/
|
|
35
|
+
export function renderSkillFmSlashCommand(opts = {}) {
|
|
36
|
+
const sidecar = opts.sidecar_url ?? 'http://127.0.0.1:19821';
|
|
37
|
+
const ver = opts.version ?? '?';
|
|
38
|
+
return `---
|
|
39
|
+
description: SkillFM 一键扫描 — Beacon 全面体检 (从上次报告到现在的期间)
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
${SLASH_MARKER_START}
|
|
43
|
+
|
|
44
|
+
# /skillfm — 一键扫描
|
|
45
|
+
|
|
46
|
+
跑 SkillFM Beacon 一键扫描,相当于 daily report 的手动触发版。扫描期间 =
|
|
47
|
+
上次报告到现在。
|
|
48
|
+
|
|
49
|
+
## 任务
|
|
50
|
+
|
|
51
|
+
1. 调 \`skillfm_checkup({ full: true, since_last_report: true })\` MCP tool。
|
|
52
|
+
- tool 内部读 \`~/.skillfm/last-report.json\` 拿 last_report_at(首次时
|
|
53
|
+
默认 24h ago)
|
|
54
|
+
- 跑 5 维度全面体检(用量 / 文件 / 上下文 / behavior / injection 防御)
|
|
55
|
+
- 注入维度的 \`sinceHours\` 以 last_report_at 为基准
|
|
56
|
+
- tool 完成后内部更新 last_report_at = now(side-effect)
|
|
57
|
+
2. 把 tool 返回的 \`rendered\` 字段直接 surface 给用户(已包含扫描期间标
|
|
58
|
+
注)。不要改写 / 概括 / 加自己的话。
|
|
59
|
+
3. 如果 tool 返 \`{ ok: false, error }\`,把 \`error.message\` 如实显示。
|
|
60
|
+
|
|
61
|
+
## 不要做
|
|
62
|
+
|
|
63
|
+
- ❌ 不要凭空给用户报告里的数字(必须来自 tool 实际返回)
|
|
64
|
+
- ❌ 不要跳过 tool 直接走 \`curl\` / \`bash\`
|
|
65
|
+
- ❌ 不要把 \`since_last_report\` 改成自己估的固定时间窗
|
|
66
|
+
|
|
67
|
+
${SLASH_MARKER_END}
|
|
68
|
+
|
|
69
|
+
> Auto-installed by skillfm-local v${ver} · sidecar ${sidecar}
|
|
70
|
+
> 卸载: \`npx -y -p @skillfm/local skillfm-local forcing uninstall\`
|
|
71
|
+
`;
|
|
72
|
+
}
|
|
73
|
+
export function renderSkillFmSlashCommandAlias(opts = {}) {
|
|
74
|
+
const ver = opts.version ?? '?';
|
|
75
|
+
return `---
|
|
76
|
+
description: /skillfm 别名(SkillFM 一键扫描)
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
${SLASH_MARKER_START}
|
|
80
|
+
|
|
81
|
+
# /sf — /skillfm 别名
|
|
82
|
+
|
|
83
|
+
跑 \`/skillfm\`:调 \`skillfm_checkup({ full: true, since_last_report: true })\`,
|
|
84
|
+
surface 返回的 \`rendered\` 给用户(扫描期间 = 上次报告到现在)。
|
|
85
|
+
|
|
86
|
+
${SLASH_MARKER_END}
|
|
87
|
+
|
|
88
|
+
> Auto-installed by skillfm-local v${ver}
|
|
89
|
+
`;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Install the /skillfm + /sf slash commands. Idempotent: re-running
|
|
93
|
+
* overwrites with the latest template body (so version bumps land).
|
|
94
|
+
*/
|
|
95
|
+
export async function installClaudeCodeSlashCommands(opts = {}) {
|
|
96
|
+
const dir = commandsDir();
|
|
97
|
+
const skillfmPath = skillfmSlashCommandPath();
|
|
98
|
+
const aliasPath = skillfmSlashCommandAliasPath();
|
|
99
|
+
try {
|
|
100
|
+
if (!existsSync(dir)) {
|
|
101
|
+
await fs.mkdir(dir, { recursive: true });
|
|
102
|
+
}
|
|
103
|
+
const refreshed = existsSync(skillfmPath) || existsSync(aliasPath);
|
|
104
|
+
await fs.writeFile(skillfmPath, renderSkillFmSlashCommand(opts), 'utf-8');
|
|
105
|
+
await fs.writeFile(aliasPath, renderSkillFmSlashCommandAlias(opts), 'utf-8');
|
|
106
|
+
return {
|
|
107
|
+
installed: true,
|
|
108
|
+
paths: [skillfmPath, aliasPath],
|
|
109
|
+
refreshed_existing: refreshed,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
catch (err) {
|
|
113
|
+
return {
|
|
114
|
+
installed: false,
|
|
115
|
+
paths: [],
|
|
116
|
+
refreshed_existing: false,
|
|
117
|
+
error: err instanceof Error ? err.message : String(err),
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Remove the /skillfm + /sf slash commands. Only removes files we own
|
|
123
|
+
* (verified by SLASH_MARKER_START presence) — never deletes a hand-edited
|
|
124
|
+
* skillfm.md that doesn't carry our marker.
|
|
125
|
+
*/
|
|
126
|
+
export async function removeClaudeCodeSlashCommands() {
|
|
127
|
+
const targets = [skillfmSlashCommandPath(), skillfmSlashCommandAliasPath()];
|
|
128
|
+
const removed = [];
|
|
129
|
+
try {
|
|
130
|
+
for (const p of targets) {
|
|
131
|
+
if (!existsSync(p))
|
|
132
|
+
continue;
|
|
133
|
+
let body = '';
|
|
134
|
+
try {
|
|
135
|
+
body = await fs.readFile(p, 'utf-8');
|
|
136
|
+
}
|
|
137
|
+
catch {
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
if (!body.includes(SLASH_MARKER_START)) {
|
|
141
|
+
// Hand-edited or unrelated file — leave alone.
|
|
142
|
+
continue;
|
|
143
|
+
}
|
|
144
|
+
await fs.unlink(p);
|
|
145
|
+
removed.push(p);
|
|
146
|
+
}
|
|
147
|
+
return { removed: removed.length > 0, paths: removed };
|
|
148
|
+
}
|
|
149
|
+
catch (err) {
|
|
150
|
+
return {
|
|
151
|
+
removed: removed.length > 0,
|
|
152
|
+
paths: removed,
|
|
153
|
+
error: err instanceof Error ? err.message : String(err),
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
/** Detect whether either slash command file is currently installed. */
|
|
158
|
+
export function detectClaudeCodeSlashCommands() {
|
|
159
|
+
const paths = [];
|
|
160
|
+
for (const p of [skillfmSlashCommandPath(), skillfmSlashCommandAliasPath()]) {
|
|
161
|
+
if (existsSync(p))
|
|
162
|
+
paths.push(p);
|
|
163
|
+
}
|
|
164
|
+
return { installed: paths.length > 0, paths };
|
|
165
|
+
}
|
|
166
|
+
//# sourceMappingURL=slash-commands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slash-commands.js","sourceRoot":"","sources":["../../src/agent-forcing/slash-commands.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,EAAE;AACF,mDAAmD;AACnD,EAAE;AACF,4EAA4E;AAC5E,wE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version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/agent-forcing/types.ts"],"names":[],"mappings":"AAkBA,MAAM,MAAM,SAAS,GACjB,UAAU,GACV,aAAa,GACb,QAAQ,GACR,OAAO,GACP,UAAU,CAAC;AAEf,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,SAAS,CAAC;IACnB,yBAAyB;IACzB,QAAQ,EAAE,OAAO,CAAC;IAClB,kEAAkE;IAClE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mCAAmC;IACnC,gBAAgB,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,SAAS,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4BAA4B;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oBAAoB;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa;IACb,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,gDAAgD;AAChD,eAAO,MAAM,oBAAoB,sEAAsE,CAAC;AACxG,eAAO,MAAM,kBAAkB,qCAAqC,CAAC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
// sdk/skillfm-local/src/
|
|
1
|
+
// sdk/skillfm-local/src/agent-forcing/types.ts
|
|
2
2
|
//
|
|
3
|
-
//
|
|
4
|
-
// 注入 SKILLFM-AGENT-GUIDE 强
|
|
3
|
+
// Agent Forcing Adapter — install 时主动检测各 harness workspace files +
|
|
4
|
+
// 注入 SKILLFM-AGENT-GUIDE 强 forcing rule 进 system prompt.
|
|
5
5
|
//
|
|
6
6
|
// 真问题 (Eric 反馈, turn 4 真测):
|
|
7
7
|
// - MiniMax-M2.7 instruction following 弱, 倾向 generic exec, 不调 SkillFM MCP tool
|
|
8
8
|
// - MCP tool description 写多强都输 system prompt 注入 (训练数据 bias)
|
|
9
|
-
// - 真解 = 各 harness workspace files 加 SkillFM
|
|
9
|
+
// - 真解 = 各 harness workspace files 加 SkillFM forcing rule, agent 必看
|
|
10
10
|
//
|
|
11
11
|
// 各 harness 真注入路径 (调研验证):
|
|
12
12
|
// OpenClaw: ~/.openclaw/workspace/SKILLFM-AGENT-GUIDE.md
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/agent-forcing/types.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,EAAE;AACF,mEAAmE;AACnE,yDAAyD;AACzD,EAAE;AACF,4BAA4B;AAC5B,iFAAiF;AACjF,8DAA8D;AAC9D,sEAAsE;AACtE,EAAE;AACF,0BAA0B;AAC1B,2DAA2D;AAC3D,gEAAgE;AAChE,qDAAqD;AACrD,6CAA6C;AAC7C,sDAAsD;AACtD,mDAAmD;AAgCnD,gDAAgD;AAChD,MAAM,CAAC,MAAM,oBAAoB,GAAG,mEAAmE,CAAC;AACxG,MAAM,CAAC,MAAM,kBAAkB,GAAG,kCAAkC,CAAC"}
|
package/dist/agent-hints.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Agent Hint — sidecar → agent 的指令文案 (双语并列)
|
|
3
3
|
*
|
|
4
|
-
* 场景: 用户跑 `npx -y
|
|
4
|
+
* 场景: 用户跑 `npx -y @skillfm/local@latest start` 或 POST /activate/poll
|
|
5
5
|
* 成功后, sidecar 返回的 JSON 里带 `hint_for_agent`, agent 读后决定下一步动作 +
|
|
6
6
|
* 对用户说什么.
|
|
7
7
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-hints.d.ts","sourceRoot":"","sources":["../src/agent-hints.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,MAAM,MAAM,YAAY,GACpB,oBAAoB,GACpB,mBAAmB,GACnB,uBAAuB,CAAC;AAE5B,UAAU,aAAa;IACrB,iCAAiC;IACjC,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;
|
|
1
|
+
{"version":3,"file":"agent-hints.d.ts","sourceRoot":"","sources":["../src/agent-hints.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,MAAM,MAAM,YAAY,GACpB,oBAAoB,GACpB,mBAAmB,GACnB,uBAAuB,CAAC;AAE5B,UAAU,aAAa;IACrB,iCAAiC;IACjC,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAkHD;;GAEG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,YAAY,EAAE,IAAI,GAAE,aAAkB,GAAG,MAAM,CAY7E"}
|
package/dist/agent-hints.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Agent Hint — sidecar → agent 的指令文案 (双语并列)
|
|
3
3
|
*
|
|
4
|
-
* 场景: 用户跑 `npx -y
|
|
4
|
+
* 场景: 用户跑 `npx -y @skillfm/local@latest start` 或 POST /activate/poll
|
|
5
5
|
* 成功后, sidecar 返回的 JSON 里带 `hint_for_agent`, agent 读后决定下一步动作 +
|
|
6
6
|
* 对用户说什么.
|
|
7
7
|
*
|
|
@@ -20,18 +20,16 @@ const ACTIVATION_SUCCESS_ZH = [
|
|
|
20
20
|
'`npx -y -p @skillfm/local skillfm-local init --v3`',
|
|
21
21
|
'完成项目级三层防御安装(写 SKILL.md priming + 自动检测 harness 写 PreToolUse hook + MCP 服务注册)。',
|
|
22
22
|
'该命令幂等 — 已安装过会自动 skip,不会破坏用户文件。',
|
|
23
|
-
'⚠️ 然后告诉用户「SkillFM
|
|
24
|
-
'1)
|
|
25
|
-
'
|
|
26
|
-
'
|
|
27
|
-
' 进入 BYOK 时, **每个** provider 都必须先调 skillfm_byok({action:"explain_provider_key", provider}) 拿引导,',
|
|
23
|
+
'⚠️ 然后告诉用户「SkillFM 已就绪!🎉」并按以下顺序引导(不要跳到赚钱技能):',
|
|
24
|
+
'1) Beacon 监控 (默认免费, 已启动): 调用 skillfm_list_credentials 看用户已配哪些 LLM provider。',
|
|
25
|
+
' 如果是空的, 用对话方式问用户: "要我开始监控你的 LLM 花费吗? 你用 OpenAI / Anthropic / DeepSeek / 豆包 / Qwen / Kimi 哪些?"',
|
|
26
|
+
'⚠️ 用户回答后, **每个** provider 都必须先调 skillfm_explain_provider_key({provider}) 拿引导,',
|
|
28
27
|
' 把返回的 why_needed / steps / risk_level / risk_explain / revoke_url / byok_safety / key_format_hint 完整转译为自然语言告诉用户 (不要省略风险等级和撤销链接)。',
|
|
29
28
|
' 让用户看明白 (a) 这是什么 key (b) 怎么去 provider 控制台生成 (c) 这 key 能干啥不能干啥 (d) 我们怎么保护 (e) 出问题怎么撤销。',
|
|
30
|
-
' 用户给 key 后用
|
|
31
|
-
'
|
|
32
|
-
'
|
|
33
|
-
'
|
|
34
|
-
'安全铁律: 让用户给 API key 是敏感操作, 不得作为安装后的默认第一步。**每次**都必须先调 skillfm_byok 的 explain_provider_key action 拿真链接 + 风险等级再让用户去生成, 不要凭空让用户给 "billing-only key" 这种术语。',
|
|
29
|
+
' 用户给 key 后用 skillfm_save_credential 保存。验 key_format_hint 不对要先问用户确认。',
|
|
30
|
+
'2) 用户问"你能干啥"才 GET /skills 列赚钱技能 — 不要主动推。当前主推赚钱技能仅 1 个 (xianyu 闲鱼 AI 头像), 其他在迭代中。',
|
|
31
|
+
'核心原则: SkillFM 三件事是「管 AI 资产 + 省 token + 装赚钱技能」, 默认先帮用户管 + 省 (Beacon, 免费), 赚钱技能用户主动问再讲。',
|
|
32
|
+
'安全铁律: 让用户给 API key 是敏感操作, **每次**都必须先调 explain_provider_key 拿真链接 + 风险等级再让用户去生成, 不要凭空让用户给 "billing-only key" 这种术语。',
|
|
35
33
|
].join(' ');
|
|
36
34
|
const ACTIVATION_SUCCESS_EN = [
|
|
37
35
|
'[English] Activation successful! brain_key saved to ~/.skillfm/config.json.',
|
|
@@ -41,18 +39,17 @@ const ACTIVATION_SUCCESS_EN = [
|
|
|
41
39
|
'to complete project-level three-layer defense installation',
|
|
42
40
|
'(SKILL.md priming + auto-detect harness PreToolUse hook + MCP server registration).',
|
|
43
41
|
'This command is idempotent — already-installed files will be skipped, never overwritten.',
|
|
44
|
-
'⚠️ Then tell the user "SkillFM is ready!" and onboard in this order (
|
|
45
|
-
'1)
|
|
46
|
-
'
|
|
47
|
-
'
|
|
48
|
-
' In BYOK, for EACH provider you MUST call skillfm_byok({action:"explain_provider_key", provider}) FIRST,',
|
|
42
|
+
'⚠️ Then tell the user "SkillFM is ready! 🎉" and onboard in this order (do NOT jump to earning skills):',
|
|
43
|
+
'1) Beacon monitoring (default free, already started): call skillfm_list_credentials to see which providers are configured.',
|
|
44
|
+
' If empty, ask conversationally: "Want me to start monitoring your LLM spend? Which providers do you use — OpenAI / Anthropic / DeepSeek / Doubao / Qwen / Kimi?"',
|
|
45
|
+
'⚠️ Once the user tells you which providers, for EACH one you MUST call skillfm_explain_provider_key({provider}) FIRST,',
|
|
49
46
|
' then translate the returned why_needed / steps / risk_level / risk_explain / revoke_url / byok_safety / key_format_hint into natural language for the user.',
|
|
50
47
|
' Do NOT skip risk_level and revoke_url. The user must understand (a) what kind of key this is (b) how to generate it on the provider console (c) what the key can/cannot do (d) how we protect it (BYOK encrypted local) (e) how to revoke if needed.',
|
|
51
|
-
' After the user provides the key, call
|
|
52
|
-
'
|
|
53
|
-
'
|
|
54
|
-
'Core principle: SkillFM
|
|
55
|
-
'Safety rule: asking the user for an API key is sensitive
|
|
48
|
+
' After the user provides the key, call skillfm_save_credential to save. If the key does not match key_format_hint, confirm with the user first.',
|
|
49
|
+
'2) Only call GET /skills when the user asks "what can you do" — do not proactively push earning skills.',
|
|
50
|
+
' The earning catalog currently surfaces 1 skill (xianyu — Xianyu AI avatar gigs); others are in iteration.',
|
|
51
|
+
'Core principle: SkillFM = manage AI assets + save tokens + earning skills. Default first helps with manage + save (Beacon, free).',
|
|
52
|
+
'Safety rule: asking the user for an API key is sensitive — ALWAYS call skillfm_explain_provider_key first to get the real generation link + risk level. Never use jargon like "billing-only key" without explanation.',
|
|
56
53
|
].join(' ');
|
|
57
54
|
// ── running_activated ─────────────────────────────────────────────────
|
|
58
55
|
function runningActivatedZh(url) {
|
|
@@ -61,17 +58,15 @@ function runningActivatedZh(url) {
|
|
|
61
58
|
'⚠️ 检查项目级初始化:如果用户当前 workspace 没有 SKILL.md 文件,请先在 workspace 执行',
|
|
62
59
|
'`npx -y -p @skillfm/local skillfm-local init --v3`',
|
|
63
60
|
'完成三层防御安装(SKILL.md + harness hooks + MCP 注册),该命令幂等可重复跑。',
|
|
64
|
-
'⚠️ 然后告诉用户「SkillFM 已就绪!」并按以下顺序 onboard
|
|
65
|
-
'1)
|
|
66
|
-
'
|
|
67
|
-
'
|
|
68
|
-
' 进入 BYOK 时, **每个** provider 都必须先调 skillfm_byok({action:"explain_provider_key", provider}) 拿引导,',
|
|
61
|
+
'⚠️ 然后告诉用户「SkillFM 已就绪!」并按以下顺序 onboard:',
|
|
62
|
+
'1) Beacon 监控 (默认免费, 已启动): 调用 skillfm_list_credentials 看用户已配哪些 LLM provider。',
|
|
63
|
+
' 如果空, 问用户用 OpenAI / Anthropic / DeepSeek / 豆包 / Qwen / Kimi 哪些。',
|
|
64
|
+
'⚠️ 用户回答后, **每个** provider 都必须先调 skillfm_explain_provider_key 拿引导,',
|
|
69
65
|
' 把 steps / risk_level / risk_explain / revoke_url / byok_safety / key_format_hint 完整转译给用户。',
|
|
70
|
-
' 不要省略风险和撤销链接。用户给 key 后用
|
|
71
|
-
'
|
|
72
|
-
'
|
|
73
|
-
'
|
|
74
|
-
'安全铁律: 让用户给 API key 不得作为安装后的默认第一步;需要 BYOK 时必须先调 skillfm_byok 的 explain_provider_key action, 不要凭空让用户给"billing-only key"这种术语。',
|
|
66
|
+
' 不要省略风险和撤销链接。用户给 key 后用 skillfm_save_credential 保存。',
|
|
67
|
+
'2) 用户问"你能干啥"才 GET /skills 列赚钱技能 (当前仅 xianyu 真上线)。不要主动推赚钱技能。',
|
|
68
|
+
'SkillFM 核心定位: 管 AI 资产 + 省 token (默认免费) + 装赚钱技能 (用户主动)。',
|
|
69
|
+
'安全铁律: 让用户给 API key 必须先调 explain_provider_key, 不要凭空让用户给"billing-only key"这种术语。',
|
|
75
70
|
].join(' ');
|
|
76
71
|
}
|
|
77
72
|
function runningActivatedEn(url) {
|
|
@@ -81,17 +76,16 @@ function runningActivatedEn(url) {
|
|
|
81
76
|
'first run `npx -y -p @skillfm/local skillfm-local init --v3` in the workspace',
|
|
82
77
|
'to complete three-layer defense installation (SKILL.md + harness hooks + MCP registration).',
|
|
83
78
|
'This command is idempotent and safe to re-run.',
|
|
84
|
-
'⚠️ Then tell the user "SkillFM is ready!" and onboard in this order
|
|
85
|
-
'1)
|
|
86
|
-
'
|
|
87
|
-
'
|
|
88
|
-
' In BYOK, for EACH provider you MUST call skillfm_byok({action:"explain_provider_key", provider}) first,',
|
|
79
|
+
'⚠️ Then tell the user "SkillFM is ready!" and onboard in this order:',
|
|
80
|
+
'1) Beacon monitoring (default free, already started): call skillfm_list_credentials to see which providers are configured.',
|
|
81
|
+
' If empty, ask which of OpenAI / Anthropic / DeepSeek / Doubao / Qwen / Kimi the user uses.',
|
|
82
|
+
'⚠️ Once the user tells you which providers, for EACH one you MUST call skillfm_explain_provider_key first,',
|
|
89
83
|
' then translate steps / risk_level / risk_explain / revoke_url / byok_safety / key_format_hint to the user.',
|
|
90
|
-
' Do not skip risk and revoke. After user provides key, use
|
|
91
|
-
|
|
92
|
-
'
|
|
93
|
-
'SkillFM
|
|
94
|
-
'Safety rule: asking the user for API keys is sensitive
|
|
84
|
+
' Do not skip risk and revoke. After user provides key, use skillfm_save_credential to save.',
|
|
85
|
+
`2) Only call GET ${url}/skills when the user asks what you can do (currently only xianyu is shipped).`,
|
|
86
|
+
'Do not proactively push earning skills.',
|
|
87
|
+
'SkillFM positioning: manage AI assets + save tokens (free default) + earning skills (user-driven).',
|
|
88
|
+
'Safety rule: asking the user for API keys is sensitive — ALWAYS call skillfm_explain_provider_key first. Never use jargon like "billing-only key" without explanation.',
|
|
95
89
|
].join(' ');
|
|
96
90
|
}
|
|
97
91
|
// ── running_not_activated ─────────────────────────────────────────────
|
package/dist/agent-hints.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-hints.js","sourceRoot":"","sources":["../src/agent-hints.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAYH,MAAM,gBAAgB,GACpB,iDAAiD,CAAC;AAEpD,yEAAyE;AAEzE,MAAM,qBAAqB,GAAG;IAC5B,uDAAuD;IACvD,+BAA+B;IAC/B,oDAAoD;IACpD,8EAA8E;IAC9E,gCAAgC;IAChC,
|
|
1
|
+
{"version":3,"file":"agent-hints.js","sourceRoot":"","sources":["../src/agent-hints.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAYH,MAAM,gBAAgB,GACpB,iDAAiD,CAAC;AAEpD,yEAAyE;AAEzE,MAAM,qBAAqB,GAAG;IAC5B,uDAAuD;IACvD,+BAA+B;IAC/B,oDAAoD;IACpD,8EAA8E;IAC9E,gCAAgC;IAChC,8CAA8C;IAC9C,6EAA6E;IAC7E,iGAAiG;IACjG,+EAA+E;IAC/E,oIAAoI;IACpI,yFAAyF;IACzF,uEAAuE;IACvE,kFAAkF;IAClF,uFAAuF;IACvF,kHAAkH;CACnH,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAEZ,MAAM,qBAAqB,GAAG;IAC5B,6EAA6E;IAC7E,eAAe;IACf,8DAA8D;IAC9D,oDAAoD;IACpD,4DAA4D;IAC5D,qFAAqF;IACrF,0FAA0F;IAC1F,yGAAyG;IACzG,4HAA4H;IAC5H,qKAAqK;IACrK,wHAAwH;IACxH,gKAAgK;IAChK,yPAAyP;IACzP,mJAAmJ;IACnJ,yGAAyG;IACzG,8GAA8G;IAC9G,mIAAmI;IACnI,uNAAuN;CACxN,CAAC,IAAI,CAA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SAAS,CAAC,GAAiB,EAAE,OAAsB,EAAE;IACnE,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,IAAI,EAAE,CAAC;IAC3B,QAAQ,GAAG,EAAE,CAAC;QACZ,KAAK,oBAAoB;YACvB,OAAO,CAAC,qBAAqB,EAAE,qBAAqB,EAAE,gBAAgB,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACvF,KAAK,mBAAmB;YACtB,OAAO,CAAC,kBAAkB,CAAC,GAAG,CAAC,EAAE,kBAAkB,CAAC,GAAG,CAAC,EAAE,gBAAgB,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC3F,KAAK,uBAAuB;YAC1B,OAAO,CAAC,qBAAqB,CAAC,GAAG,CAAC,EAAE,qBAAqB,CAAC,GAAG,CAAC,EAAE,gBAAgB,CAAC,CAAC,IAAI,CACpF,MAAM,CACP,CAAC;IACN,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface BeaconApprenticeCapability {
|
|
2
|
+
name: string;
|
|
3
|
+
label_zh: string;
|
|
4
|
+
label_en: string;
|
|
5
|
+
description: string;
|
|
6
|
+
required_by: Array<'apprentice-manifest' | 'beacon-sidecar'>;
|
|
7
|
+
}
|
|
8
|
+
export declare const APRENTICE_CAPABILITIES: BeaconApprenticeCapability[];
|
|
9
|
+
export declare function getApprenticeCapabilityCatalog(): BeaconApprenticeCapability[];
|
|
10
|
+
//# sourceMappingURL=apprentice-capabilities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apprentice-capabilities.d.ts","sourceRoot":"","sources":["../../src/beacon/apprentice-capabilities.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,KAAK,CAAC,qBAAqB,GAAG,gBAAgB,CAAC,CAAC;CAC9D;AAED,eAAO,MAAM,sBAAsB,EAAE,0BAA0B,EA6B9D,CAAC;AAEF,wBAAgB,8BAA8B,IAAI,0BAA0B,EAAE,CAE7E"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export const APRENTICE_CAPABILITIES = [
|
|
2
|
+
{
|
|
3
|
+
name: 'payout_provider_setup',
|
|
4
|
+
label_zh: '海外收款通道搭建',
|
|
5
|
+
label_en: 'Payout Provider Setup',
|
|
6
|
+
description: 'Wise → Payoneer → Stripe Atlas fallback chain with BYOK-safe KYC scaffolding.',
|
|
7
|
+
required_by: ['apprentice-manifest', 'beacon-sidecar'],
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
name: 'competitive_benchmark',
|
|
11
|
+
label_zh: '竞品榜单调研',
|
|
12
|
+
label_en: 'Competitive Benchmark',
|
|
13
|
+
description: 'Top-list extraction, title patterning, price distribution, and review know-how signals.',
|
|
14
|
+
required_by: ['apprentice-manifest', 'beacon-sidecar'],
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
name: 'xpost_launch_helper',
|
|
18
|
+
label_zh: '跨平台发帖助手',
|
|
19
|
+
label_en: 'Cross-post Launch Helper',
|
|
20
|
+
description: 'Manual push-send launch copy for Reddit, X, Pinterest, and Hacker News.',
|
|
21
|
+
required_by: ['apprentice-manifest', 'beacon-sidecar'],
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: 'user_prerequisites_check',
|
|
25
|
+
label_zh: '用户前置条件检查',
|
|
26
|
+
label_en: 'User Prerequisites Check',
|
|
27
|
+
description: 'D-1 readiness gate for TOTP, international cards, overseas SMS, and KYC docs.',
|
|
28
|
+
required_by: ['apprentice-manifest', 'beacon-sidecar'],
|
|
29
|
+
},
|
|
30
|
+
];
|
|
31
|
+
export function getApprenticeCapabilityCatalog() {
|
|
32
|
+
return APRENTICE_CAPABILITIES.map((capability) => ({ ...capability }));
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=apprentice-capabilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apprentice-capabilities.js","sourceRoot":"","sources":["../../src/beacon/apprentice-capabilities.ts"],"names":[],"mappings":"AAQA,MAAM,CAAC,MAAM,sBAAsB,GAAiC;IAClE;QACE,IAAI,EAAE,uBAAuB;QAC7B,QAAQ,EAAE,UAAU;QACpB,QAAQ,EAAE,uBAAuB;QACjC,WAAW,EAAE,+EAA+E;QAC5F,WAAW,EAAE,CAAC,qBAAqB,EAAE,gBAAgB,CAAC;KACvD;IACD;QACE,IAAI,EAAE,uBAAuB;QAC7B,QAAQ,EAAE,QAAQ;QAClB,QAAQ,EAAE,uBAAuB;QACjC,WAAW,EAAE,yFAAyF;QACtG,WAAW,EAAE,CAAC,qBAAqB,EAAE,gBAAgB,CAAC;KACvD;IACD;QACE,IAAI,EAAE,qBAAqB;QAC3B,QAAQ,EAAE,SAAS;QACnB,QAAQ,EAAE,0BAA0B;QACpC,WAAW,EAAE,yEAAyE;QACtF,WAAW,EAAE,CAAC,qBAAqB,EAAE,gBAAgB,CAAC;KACvD;IACD;QACE,IAAI,EAAE,0BAA0B;QAChC,QAAQ,EAAE,UAAU;QACpB,QAAQ,EAAE,0BAA0B;QACpC,WAAW,EAAE,+EAA+E;QAC5F,WAAW,EAAE,CAAC,qBAAqB,EAAE,gBAAgB,CAAC;KACvD;CACF,CAAC;AAEF,MAAM,UAAU,8BAA8B;IAC5C,OAAO,sBAAsB,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,UAAU,EAAE,CAAC,CAAC,CAAC;AACzE,CAAC"}
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import type { ReconciliationResult } from '../reconciliation/index.js';
|
|
2
|
-
import type { LocalUsageStore } from '../usage-local/store.js';
|
|
2
|
+
import type { LocalUsageStore, UsageQuery } from '../usage-local/store.js';
|
|
3
3
|
import type { DimensionStatus } from './types.js';
|
|
4
4
|
export interface UsageDimDeps {
|
|
5
5
|
store: LocalUsageStore;
|
|
6
6
|
reconciliations: ReconciliationResult[];
|
|
7
|
+
/**
|
|
8
|
+
* Optional usage-aggregation window override. When provided (e.g. by the
|
|
9
|
+
* `/skillfm` flow with since_last_report), F3 single-model concentration
|
|
10
|
+
* check uses this window instead of the default `timeWindow('today')`.
|
|
11
|
+
* Lets the manual scan reflect the period since the previous report.
|
|
12
|
+
*/
|
|
13
|
+
usageWindow?: UsageQuery;
|
|
7
14
|
}
|
|
8
15
|
/**
|
|
9
16
|
* 算用量维度的 findings + status
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dimension-1-usage.d.ts","sourceRoot":"","sources":["../../src/checkup/dimension-1-usage.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"dimension-1-usage.d.ts","sourceRoot":"","sources":["../../src/checkup/dimension-1-usage.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE3E,OAAO,KAAK,EAAE,eAAe,EAAqB,MAAM,YAAY,CAAC;AAErE,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,eAAe,CAAC;IACvB,eAAe,EAAE,oBAAoB,EAAE,CAAC;IACxC;;;;;OAKG;IACH,WAAW,CAAC,EAAE,UAAU,CAAC;CAC1B;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,YAAY,GAAG,eAAe,CAoFvE;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,eAAe,EAAE,oBAAoB,EAAE,GAAG,MAAM,EAAE,CAIxF"}
|
|
@@ -55,8 +55,9 @@ export function checkDimensionUsage(deps) {
|
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
// F3: 单 model 占比 > 80% (暗示 E1 router 候选, surface 给用户但 fix 是 Pro)
|
|
58
|
-
|
|
59
|
-
const
|
|
58
|
+
// Window: caller-provided (since_last_report) or default 'today'.
|
|
59
|
+
const window = deps.usageWindow ?? timeWindow('today');
|
|
60
|
+
const byModel = deps.store.aggregateByModel(window);
|
|
60
61
|
const totalToday = byModel.reduce((s, m) => s + m.total_cost_usd, 0);
|
|
61
62
|
if (totalToday > 0.5) { // 至少有 ¥3.65 才有意义看
|
|
62
63
|
const top = byModel.sort((a, b) => b.total_cost_usd - a.total_cost_usd)[0];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dimension-1-usage.js","sourceRoot":"","sources":["../../src/checkup/dimension-1-usage.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,EAAE;AACF,2BAA2B;AAC3B,oDAAoD;AAIpD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"dimension-1-usage.js","sourceRoot":"","sources":["../../src/checkup/dimension-1-usage.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,EAAE;AACF,2BAA2B;AAC3B,oDAAoD;AAIpD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAerD;;;;;;;;GAQG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAkB;IACpD,MAAM,QAAQ,GAAc,EAAE,CAAC;IAE/B,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;QACvC,WAAW;QACX,IAAI,GAAG,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC3B,QAAQ,CAAC,IAAI,CAAC;gBACZ,QAAQ,EAAE,GAAG,GAAG,CAAC,QAAQ,SAAS,GAAG,CAAC,aAAa,EAAE,OAAO,CAAC,CAA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AAE,OAAO,SAAS,CAAC;IACrD,IAAI,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC;QAAE,OAAO,MAAM,CAAC;IAC/C,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface ContextCleanupCandidate {
|
|
2
|
+
path: string;
|
|
3
|
+
bytes: number;
|
|
4
|
+
label: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function buildContextCleanupPlan(roots?: string[]): Promise<{
|
|
7
|
+
roots: string[];
|
|
8
|
+
candidates: ContextCleanupCandidate[];
|
|
9
|
+
bytes_freed: number;
|
|
10
|
+
items_count: number;
|
|
11
|
+
}>;
|
|
12
|
+
//# sourceMappingURL=dimension-2-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dimension-2-context.d.ts","sourceRoot":"","sources":["../../src/checkup/dimension-2-context.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAwCD,wBAAsB,uBAAuB,CAAC,KAAK,GAAE,MAAM,EAA0B,GAAG,OAAO,CAAC;IAC9F,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,UAAU,EAAE,uBAAuB,EAAE,CAAC;IACtC,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC,CASD"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// sdk/skillfm-local/src/checkup/dimension-2-context.ts
|
|
2
|
+
//
|
|
3
|
+
// 维度 2 上下文 prune helper — 为 Pro 一键整理 / prune-context 复用。
|
|
4
|
+
import * as fs from 'node:fs';
|
|
5
|
+
import * as path from 'node:path';
|
|
6
|
+
import { homedir } from 'node:os';
|
|
7
|
+
const DEFAULT_CONTEXT_ROOTS = [
|
|
8
|
+
path.join(homedir(), '.skillfm', 'session-memory'),
|
|
9
|
+
path.join(homedir(), '.skillfm', 'context'),
|
|
10
|
+
path.join(homedir(), '.openclaw', 'agents'),
|
|
11
|
+
];
|
|
12
|
+
async function collectFiles(root, maxDepth = 4) {
|
|
13
|
+
const out = [];
|
|
14
|
+
if (!fs.existsSync(root))
|
|
15
|
+
return out;
|
|
16
|
+
async function walk(current, depth) {
|
|
17
|
+
if (depth > maxDepth)
|
|
18
|
+
return;
|
|
19
|
+
let stat;
|
|
20
|
+
try {
|
|
21
|
+
stat = await fs.promises.stat(current);
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if (stat.isFile()) {
|
|
27
|
+
out.push({ path: current, bytes: stat.size, label: 'context-memory' });
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
if (!stat.isDirectory())
|
|
31
|
+
return;
|
|
32
|
+
let entries;
|
|
33
|
+
try {
|
|
34
|
+
entries = await fs.promises.readdir(current, { withFileTypes: true });
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
for (const ent of entries) {
|
|
40
|
+
await walk(path.join(current, ent.name), depth + 1);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
await walk(root, 0);
|
|
44
|
+
return out;
|
|
45
|
+
}
|
|
46
|
+
export async function buildContextCleanupPlan(roots = DEFAULT_CONTEXT_ROOTS) {
|
|
47
|
+
const candidates = (await Promise.all(roots.map((root) => collectFiles(root)))).flat();
|
|
48
|
+
const bytes_freed = candidates.reduce((sum, item) => sum + item.bytes, 0);
|
|
49
|
+
return {
|
|
50
|
+
roots,
|
|
51
|
+
candidates,
|
|
52
|
+
bytes_freed,
|
|
53
|
+
items_count: candidates.length,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=dimension-2-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dimension-2-context.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AAC;YACH,OAAO,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;QACxE,CAAC;QAAC,MAAM,CAAC;YACP,OAAO;QACT,CAAC;QACD,KAAK,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;YAC1B,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,CAAC,IAAI,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;QACtD,CAAC;IACH,CAAC;IAED,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACpB,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAAC,QAAkB,qBAAqB;IAMnF,MAAM,UAAU,GAAG,CAAC,MAAM,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IACvF,MAAM,WAAW,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,GAAG,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IAC1E,OAAO;QACL,KAAK;QACL,UAAU;QACV,WAAW;QACX,WAAW,EAAE,UAAU,CAAC,MAAM;KAC/B,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface BehaviorResetCandidate {
|
|
2
|
+
path: string;
|
|
3
|
+
bytes: number;
|
|
4
|
+
label: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function buildBehaviorResetPlan(roots?: string[]): Promise<{
|
|
7
|
+
roots: string[];
|
|
8
|
+
candidates: BehaviorResetCandidate[];
|
|
9
|
+
bytes_freed: number;
|
|
10
|
+
items_count: number;
|
|
11
|
+
}>;
|
|
12
|
+
//# sourceMappingURL=dimension-5-behavior.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dimension-5-behavior.d.ts","sourceRoot":"","sources":["../../src/checkup/dimension-5-behavior.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAyBD,wBAAsB,sBAAsB,CAAC,KAAK,GAAE,MAAM,EAA2B,GAAG,OAAO,CAAC;IAC9F,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,UAAU,EAAE,sBAAsB,EAAE,CAAC;IACrC,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC,CASD"}
|