@fanglinwei/agent-fit 0.7.3 → 0.8.0
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/.codex-plugin/plugin.json +1 -1
- package/README.md +17 -9
- package/VERSION +1 -1
- package/adapters/codex/modes.json +144 -0
- package/adapters/codex/profiles/terra-evaluation.json +134 -0
- package/adapters/codex/skills/agent-fit/SKILL.md +23 -56
- package/adapters/codex/skills/agent-fit/references/calibration.md +29 -1
- package/adapters/codex/skills/agent-fit/references/configuration.md +35 -2
- package/adapters/codex/skills/agent-fit/references/dispatch-contract.md +22 -0
- package/adapters/codex/skills/agent-fit/references/failure-policy.md +13 -3
- package/adapters/codex/skills/agent-fit/references/task-routing.md +23 -3
- package/bin/agent-fit.mjs +3 -3
- package/docs/README.md +1 -1
- package/docs/implementation-review.md +35 -1
- package/docs/usage.md +53 -8
- package/lib/codex.mjs +1 -1
- package/lib/install.mjs +4 -4
- package/lib/model-history.mjs +5 -4
- package/lib/models.mjs +25 -4
- package/lib/probe.mjs +4 -1
- package/lib/skill.mjs +27 -2
- package/package.json +1 -1
- package/web/app.js +3 -3
package/lib/skill.mjs
CHANGED
|
@@ -60,10 +60,35 @@ export async function inspectSkill(home) {
|
|
|
60
60
|
for (const relative of [...assets.keys(), 'references/current-mode.json', MANIFEST]) files.set(relative, await readSkillFile(root, relative));
|
|
61
61
|
const entry = files.get('SKILL.md').bytes;
|
|
62
62
|
if (!entry || !/^name: agent-fit$/m.test(entry.toString('utf8'))) fail('SKILL_CONFLICT', `目录中不是有效的 agent-fit Skill:${root}`);
|
|
63
|
-
|
|
63
|
+
const issues = [];
|
|
64
|
+
let integrity = 'clean', manifest = null;
|
|
65
|
+
const receipt = files.get(MANIFEST).bytes;
|
|
66
|
+
if (receipt === null) {
|
|
67
|
+
integrity = 'untracked';
|
|
68
|
+
issues.push({ code: 'SKILL_UPDATE_REQUIRED', message: '共享规则未登记摘要;显式预览 skill update 后更新,不把规则视为已核验。' });
|
|
69
|
+
} else {
|
|
70
|
+
try {
|
|
71
|
+
manifest = JSON.parse(receipt);
|
|
72
|
+
if (manifest?.layout !== 1 || typeof manifest.version !== 'string' || !manifest.files || typeof manifest.files !== 'object' || Array.isArray(manifest.files) || Object.keys(manifest.files).length !== assets.size || [...assets.keys()].some(name => !Object.hasOwn(manifest.files, name) || !/^[a-f0-9]{64}$/.test(manifest.files[name]))) throw new Error();
|
|
73
|
+
} catch {
|
|
74
|
+
manifest = null; integrity = 'invalid';
|
|
75
|
+
issues.push({ code: 'SKILL_MANIFEST_INVALID', message: '共享规则清单结构或文件列表无效;保留原文件,修复清单后再委派。' });
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
for (const name of assets.keys()) {
|
|
79
|
+
const actual = files.get(name).bytes;
|
|
80
|
+
if (actual === null) {
|
|
81
|
+
integrity = integrity === 'invalid' ? 'invalid' : 'incomplete';
|
|
82
|
+
issues.push({ code: 'SKILL_FILE_MISSING', file: name, message: '共享规则缺少发布资产;修复规则后再委派。' });
|
|
83
|
+
} else if (manifest && hash(actual) !== manifest.files[name]) {
|
|
84
|
+
if (integrity === 'clean') integrity = 'modified';
|
|
85
|
+
issues.push({ code: 'SKILL_FILE_MODIFIED', file: name, message: '共享规则内容与已登记摘要不符;保留用户修改,核对规则后再委派。' });
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
roots.push({ root, files, integrity, issues });
|
|
64
89
|
}
|
|
65
90
|
const identity = roots.map(({ root, files }) => [root, [...files].map(([relative, value]) => [relative, value.mode, value.bytes === null ? null : hash(value.bytes)])]);
|
|
66
|
-
return { path: roots.length ? path.join(roots[0].root, 'SKILL.md') : null, roots, revision: hash(JSON.stringify(identity)), assets };
|
|
91
|
+
return { path: roots.length ? path.join(roots[0].root, 'SKILL.md') : null, roots, revision: hash(JSON.stringify(identity)), integrity: roots[0]?.integrity ?? 'not_installed', issues: roots[0]?.issues ?? [], assets };
|
|
67
92
|
}
|
|
68
93
|
|
|
69
94
|
export async function updateSkill(home, { dryRun = false, installOnly = false, legacyState = null } = {}) {
|
package/package.json
CHANGED
package/web/app.js
CHANGED
|
@@ -4,8 +4,8 @@ const LEVELS = ['L1', 'L2', 'L3', 'L4'];
|
|
|
4
4
|
const LEVEL_LABELS = ['明确执行', '有边界的推理', '复杂推理', '高不确定性推理'];
|
|
5
5
|
const LEVEL_EXAMPLES = ['方法与验收已知,含大型确定性处理', '局部分析、有限方案选择', '多约束、竞争假设与矛盾证据', '检验关键假设、处理强耦合开放问题'];
|
|
6
6
|
const ROUTE_EXAMPLES = ['按明确格式取证、按已批准规则批量替换', '实现边界清楚的功能、修复可复现的局部问题', '跨模块根因分析、状态与生命周期问题', '多机制交互的疑难问题、约束冲突的架构取舍'];
|
|
7
|
-
const TASK_LABELS = { mechanical: '确定性机械任务', bounded: '普通有界任务', scan: '大型有界扫描或审查', deep: '大型确定性深度任务', complex: '有界复杂任务', uncertain: '高歧义、高耦合或高后果', reasoning: '复杂推理或质量验证失败', latency: '明确追求低延迟' };
|
|
8
|
-
const TASK_LEVELS = { mechanical: ['L1'], bounded: ['L2'], scan: ['L1', 'L2'], deep: ['L1', 'L2'], complex: ['L2', 'L3'], uncertain: ['L3', 'L4'], reasoning: ['L3', 'L4'], latency: LEVELS };
|
|
7
|
+
const TASK_LABELS = { mechanical: '确定性机械任务', bounded: '普通有界任务', scan: '大型有界扫描或审查', deep: '大型确定性深度任务', complex: '有界复杂任务', uncertain: '高歧义、高耦合或高后果', reasoning: '复杂推理或质量验证失败', visual: '视觉理解与图像推理', computer: '有界电脑操作', writing: '自然写作与修订', latency: '明确追求低延迟' };
|
|
8
|
+
const TASK_LEVELS = { mechanical: ['L1'], bounded: ['L2'], scan: ['L1', 'L2'], deep: ['L1', 'L2'], complex: ['L2', 'L3'], uncertain: ['L3', 'L4'], reasoning: ['L3', 'L4'], visual: ['L1', 'L2', 'L3'], computer: ['L1', 'L2', 'L3'], writing: ['L1', 'L2', 'L3'], latency: LEVELS };
|
|
9
9
|
const ROLE_LABELS = { task_scan: '扫描取证', task_execute: '范围内产出', task_review: '独立复核', task_delegate: '明确委派' };
|
|
10
10
|
const CONTRACT_LABELS = { readonly_evidence: '只读取证,保留证据与局部阻断', scoped_output: '只在明确范围内产出,独占写入', readonly_review: '只读独立复核,保留原验收要求', bounded_delegate: '遵守本次明确职责与授权范围' };
|
|
11
11
|
const $ = id => document.getElementById(id);
|
|
@@ -36,7 +36,7 @@ function custom() { return state.saved?.kind === 'custom'; }
|
|
|
36
36
|
function now() { return new Date().toLocaleTimeString('zh-CN', { hour: '2-digit', minute: '2-digit', second: '2-digit' }); }
|
|
37
37
|
function pairText(pair) { return pair ? `${pair.model} / ${pair.effort ?? '供应商默认参数'}` : '无备用'; }
|
|
38
38
|
function routePair(pair) {
|
|
39
|
-
const names = { 'gpt-6-luna': 'Luna', 'gpt-6.1-sol': 'Sol 6.1', 'gpt-6-sol': 'Sol 6', 'gpt-6-astra': 'Astra', 'gpt-5.6-sol': 'Sol 5.6' };
|
|
39
|
+
const names = { 'gpt-6.1-terra': 'Terra 6.1', 'gpt-6-luna': 'Luna', 'gpt-6.1-sol': 'Sol 6.1', 'gpt-6-sol': 'Sol 6', 'gpt-6-astra': 'Astra', 'gpt-5.6-sol': 'Sol 5.6' };
|
|
40
40
|
return pair ? `${names[pair.model] ?? pair.model} / ${pair.effort ?? '供应商默认参数'}` : '未配置';
|
|
41
41
|
}
|
|
42
42
|
function primaryPairs(definition) {
|