harness-everything 0.20.7 → 0.21.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/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +14 -0
- package/benchmarks/fixtures/system-one-routing.json +549 -0
- package/benchmarks/results/system-one/cua-s1-forms-cpu-2026-09-23/README.md +62 -0
- package/benchmarks/results/system-one/cua-s1-forms-cpu-2026-09-23/report.json +856 -0
- package/ci/fixtures/system-one-provider.cjs +13 -0
- package/ci/mechanism-system-one-contract.test.js +48 -0
- package/ci/mechanism-system-one-evaluation.test.js +87 -0
- package/ci/mechanism-system-one-install.test.js +95 -0
- package/ci/mechanism-system-one-provider.test.js +63 -0
- package/ci/mechanism-system-one-router.test.js +101 -0
- package/ci/system-one-adapter-test.py +56 -0
- package/docs/platform-capabilities.md +11 -0
- package/docs/system-one-routing.md +202 -0
- package/harness-everything/SKILL.md +1 -1
- package/harness-everything/scripts/system-one/contract.js +45 -0
- package/harness-everything/scripts/system-one/cua_adapter.py +94 -0
- package/harness-everything/scripts/system-one/evaluate.js +98 -0
- package/harness-everything/scripts/system-one/install.js +152 -0
- package/harness-everything/scripts/system-one/provider.js +76 -0
- package/harness-everything/scripts/system-one/router.js +37 -0
- package/harness-everything/scripts/tier-router.js +16 -0
- package/opencode-plugin/plugin.json +1 -1
- package/package.json +2 -1
- package/plugins/harness-everything/.codex-plugin/plugin.json +1 -1
- package/plugins/harness-everything/plugin.json +1 -1
- package/plugins/harness-everything/skills/harness-everything/SKILL.md +1 -1
- package/plugins/harness-everything/skills/harness-everything/scripts/system-one/contract.js +45 -0
- package/plugins/harness-everything/skills/harness-everything/scripts/system-one/cua_adapter.py +94 -0
- package/plugins/harness-everything/skills/harness-everything/scripts/system-one/evaluate.js +98 -0
- package/plugins/harness-everything/skills/harness-everything/scripts/system-one/install.js +152 -0
- package/plugins/harness-everything/skills/harness-everything/scripts/system-one/provider.js +76 -0
- package/plugins/harness-everything/skills/harness-everything/scripts/system-one/router.js +37 -0
- package/plugins/harness-everything/skills/harness-everything/scripts/tier-router.js +16 -0
- package/sbom.cdx.json +7 -7
- package/scripts/evaluate-system-one.js +57 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
// Deliberately synthetic transport fixture, never model-quality evidence.
|
|
3
|
+
const mode = process.argv[2];
|
|
4
|
+
if (mode === 'timeout') setInterval(() => {}, 1000);
|
|
5
|
+
else if (mode === 'overflow') process.stdout.write('x'.repeat(2 * 1024 * 1024));
|
|
6
|
+
else if (mode === 'exit') process.exit(3);
|
|
7
|
+
else if (mode === 'invalid') console.log('not-json');
|
|
8
|
+
else { let input = ''; process.stdin.on('data', c => { input += c; }); process.stdin.on('end', () => {
|
|
9
|
+
const req = JSON.parse(input);
|
|
10
|
+
console.log(JSON.stringify({ schemaVersion: 1, requestHash: req.requestHash, catalogHash: req.catalogHash,
|
|
11
|
+
model: { id: 'fixture', revision: 'fixture-v1', domain: mode === 'forms' ? 'forms-v1' : 'harness-routing-v1' },
|
|
12
|
+
scores: req.options.map((o, i) => ({ id: o.id, probability: i === 0 ? 1 : 0 })) }));
|
|
13
|
+
}); }
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const { test } = require('node:test');
|
|
3
|
+
const assert = require('node:assert/strict');
|
|
4
|
+
const { createRequest, validateRequest, decide } = require('../harness-everything/scripts/system-one/contract');
|
|
5
|
+
const options = [{ id: 'tier1', text: 'Bounded edit' }, { id: 'tier3', text: 'Architecture' }];
|
|
6
|
+
const request = () => createRequest('tier', '修正 typo', options);
|
|
7
|
+
function response(req, p = [0.95, 0.05]) {
|
|
8
|
+
return { schemaVersion: 1, requestHash: req.requestHash, catalogHash: req.catalogHash,
|
|
9
|
+
model: { id: 'test', revision: 'test-v1', domain: 'harness-routing-v1' },
|
|
10
|
+
scores: req.options.map((o, i) => ({ id: o.id, probability: p[i] })) };
|
|
11
|
+
}
|
|
12
|
+
test('S1-C01 complete response, no mutation and repeatability', () => {
|
|
13
|
+
const req = request(); const res = response(req); const before = JSON.stringify({ req, res });
|
|
14
|
+
assert.deepEqual(decide(req, res), { status: 'accepted', reason: 'scored', selectedId: 'tier1', confidence: 0.95, margin: 0.8999999999999999, model: res.model });
|
|
15
|
+
assert.deepEqual(decide(req, res), decide(req, res));
|
|
16
|
+
assert.equal(JSON.stringify({ req, res }), before);
|
|
17
|
+
assert.deepEqual(req, request());
|
|
18
|
+
assert.equal(validateRequest(req), true);
|
|
19
|
+
assert.notEqual(req.requestHash, createRequest('tier', 'other', options).requestHash);
|
|
20
|
+
assert.notEqual(req.catalogHash, createRequest('tier', 'other', [...options].reverse()).catalogHash);
|
|
21
|
+
});
|
|
22
|
+
test('S1-C02 rejected input partitions and byte boundaries', () => {
|
|
23
|
+
for (const context of ['', ' ', null, 1, {}, 'x'.repeat(65537)]) assert.throws(() => createRequest('tier', context, options), { code: 'invalid-request' });
|
|
24
|
+
for (const task of ['', null, 'A', 'a'.repeat(81)]) assert.throws(() => createRequest(task, 'x', options));
|
|
25
|
+
for (const opts of [null, [], [options[0]], [options[0], options[0]], [{ id: 'x', text: '' }, options[1]], [{ ...options[0], extra: true }, options[1]], [{ id: 1, text: 'x' }, options[1]], [{ id: 'x', text: '中'.repeat(1366) }, options[1]], Array.from({ length: 257 }, (_, i) => ({ id: 'a' + i, text: 'x' }))]) assert.throws(() => createRequest('tier', 'x', opts));
|
|
26
|
+
const max = createRequest('a'.repeat(80), 'x'.repeat(65536), Array.from({ length: 256 }, (_, i) => ({ id: 'a' + i, text: 'x'.repeat(4096) })));
|
|
27
|
+
assert.equal(validateRequest(max), true);
|
|
28
|
+
for (const mutate of [r => { r.extra = 1; }, r => { delete r.context; }, r => { r.schemaVersion = 2; }, r => { r.options.reverse(); }, r => { r.context = 'replay'; }]) {
|
|
29
|
+
const r = request(); mutate(r); assert.throws(() => validateRequest(r));
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
test('S1-C03 complete output validation and no raw-data leakage', () => {
|
|
33
|
+
const req = request();
|
|
34
|
+
for (const mutate of [r => { r.schemaVersion = 2; }, r => { r.requestHash = 'stale'; }, r => { r.catalogHash = 'stale'; }, r => { r.scores.pop(); }, r => { r.scores.push(r.scores[0]); }, r => { r.scores.reverse(); }, r => { r.scores[1].id = r.scores[0].id; }, r => { r.scores[0].probability = NaN; }, r => { r.scores[0].probability = Infinity; }, r => { r.scores[0].probability = -1; }, r => { r.scores[0].probability = 1.1; }, r => { r.scores[0].probability = '0.95'; }, r => { r.scores[0].probability = 0.8; }, r => { r.scores[0].extra = 'secret'; }, r => { r.model.extra = 'secret'; }, r => { r.model.revision = ''; }, r => { delete r.model; }, r => { r.extra = 'secret'; }]) {
|
|
35
|
+
const res = response(req); mutate(res);
|
|
36
|
+
assert.deepEqual(decide(req, res), { status: 'invalid-output', reason: 'invalid-response', selectedId: null, confidence: null, margin: null, model: null });
|
|
37
|
+
}
|
|
38
|
+
for (const value of [null, [], 'invalid']) assert.equal(decide(req, value).status, 'invalid-output');
|
|
39
|
+
});
|
|
40
|
+
test('S1-C04 abstention and policy boundaries', () => {
|
|
41
|
+
const req = request(); const res = response(req);
|
|
42
|
+
res.model.domain = 'forms-v1'; assert.equal(decide(req, res).reason, 'domain-mismatch');
|
|
43
|
+
assert.equal(decide(req, response(req, [0.5, 0.5]), { minConfidence: 0, minMargin: 0 }).reason, 'tie');
|
|
44
|
+
assert.equal(decide(req, response(req, [0.8, 0.2])).reason, 'low-confidence');
|
|
45
|
+
assert.equal(decide(req, response(req, [0.6, 0.4]), { minConfidence: 0.5, minMargin: 0.3 }).reason, 'low-margin');
|
|
46
|
+
assert.equal(decide(req, response(req, [1, 0]), { minConfidence: 1, minMargin: 1 }).status, 'accepted');
|
|
47
|
+
for (const policy of [null, { minConfidence: NaN }, { minMargin: -1 }, { minConfidence: 2 }, { extra: 1 }, { domain: '' }]) assert.throws(() => decide(req, response(req), policy), { code: 'invalid-policy' });
|
|
48
|
+
});
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const { test } = require('node:test');
|
|
3
|
+
const fs = require('node:fs');
|
|
4
|
+
const os = require('node:os');
|
|
5
|
+
const path = require('node:path');
|
|
6
|
+
const { spawnSync } = require('node:child_process');
|
|
7
|
+
const assert = require('node:assert/strict');
|
|
8
|
+
const { createRequest } = require('../harness-everything/scripts/system-one/contract');
|
|
9
|
+
const { TIER_OPTIONS } = require('../harness-everything/scripts/system-one/router');
|
|
10
|
+
const { validateCorpus, evaluate } = require('../harness-everything/scripts/system-one/evaluate');
|
|
11
|
+
const make = () => ({ schemaVersion: 1, cases: [
|
|
12
|
+
{ id: 'a', family: 'typo', split: 'holdout', language: 'en', source: 'human:fixture', reviewed: false, request: createRequest('tier', 'fix typo', TIER_OPTIONS), gold: 'tier1' },
|
|
13
|
+
{ id: 'b', family: 'unclear', split: 'holdout', language: 'zh-TW', source: 'human:fixture', reviewed: false, request: createRequest('tier', '看看這個', TIER_OPTIONS), gold: null },
|
|
14
|
+
] });
|
|
15
|
+
const decision = id => ({ status: id ? 'accepted' : 'abstain', reason: id ? 'scored' : 'unclassified', selectedId: id, confidence: 1, margin: 1, model: { id: 'fixture', revision: 'v1', domain: 'harness-routing-v1' } });
|
|
16
|
+
const oneHot = id => TIER_OPTIONS.map(o => (o.id === (id || 'unclassified') ? 1 : 0));
|
|
17
|
+
function records() { return make().cases.map(c => ({ id: c.id, baseline: 'tier2', runs: [0, 1].map(() => ({ decision: decision(c.gold), scores: oneHot(c.gold), latencyMs: 20, coldStart: true })) })); }
|
|
18
|
+
test('S1-E01 exact paired metrics, no promotion from fixtures or cold timing', () => {
|
|
19
|
+
const result = evaluate(make(), records());
|
|
20
|
+
assert.equal(result.model.accuracy, 1); assert.equal(result.model.coverage, 0.5);
|
|
21
|
+
assert.equal(result.model.acceptedPrecision, 1); assert.equal(result.model.acceptedErrorRate, 0);
|
|
22
|
+
assert.equal(result.model.macroF1, 0.5); assert.equal(result.baseline.accuracy, 0);
|
|
23
|
+
assert.equal(result.agreement, 1); assert.equal(result.latency.coldP95Ms, 20); assert.equal(result.latency.warmP95Ms, null);
|
|
24
|
+
assert.equal(result.rolloutReady, false); assert.equal(result.gates.reviewedHoldout, false);
|
|
25
|
+
assert.equal(result.gates.policyEvidence, false); assert.equal(result.gates.liveHostEvidence, false);
|
|
26
|
+
assert.deepEqual(evaluate(make(), records()), evaluate(make(), records()));
|
|
27
|
+
});
|
|
28
|
+
test('S1-E02 corpus completeness, family leakage and no duplicated prompts', () => {
|
|
29
|
+
assert.equal(validateCorpus(make()), true);
|
|
30
|
+
for (const mutate of [c => { c.schemaVersion = 2; }, c => { c.extra = true; }, c => { c.cases = []; }, c => { c.cases[1].id = 'a'; }, c => { c.cases[1].family = 'typo'; c.cases[1].split = 'train'; }, c => { c.cases[1].request = c.cases[0].request; }, c => { c.cases[0].gold = 'unknown'; }, c => { c.cases[0].language = 'unknown'; }, c => { c.cases[0].reviewed = 'yes'; }, c => { c.cases[0].source = ''; }, c => { c.cases[0].request = createRequest('tier', 'x', [{ id: 'x', text: 'x' }, { id: 'y', text: 'y' }]); }, c => { delete c.cases[0].family; }, c => { c.cases[0].extra = 1; }]) { const c = make(); mutate(c); assert.throws(() => validateCorpus(c)); }
|
|
31
|
+
});
|
|
32
|
+
test('S1-E03 missing/extra/invalid predictions cannot silently improve scores', () => {
|
|
33
|
+
for (const mutate of [r => r.pop(), r => r.push(r[0]), r => { r[0].id = 'unknown'; }, r => { r[0].runs.pop(); }, r => { r[0].runs[0].decision.selectedId = 'unknown'; }, r => { r[0].runs[0].latencyMs = NaN; }, r => { r[0].runs[0].latencyMs = -1; }, r => { r[0].runs[0].coldStart = 'false'; }, r => { r[0].runs[0].decision.status = 'abstain'; }, r => { r[0].baseline = 'unknown'; }, r => { r[0].runs[0].decision.model.revision = 'v2'; }]) { const r = records(); mutate(r); assert.throws(() => evaluate(make(), r)); }
|
|
34
|
+
for (const mutate of [r => { delete r[0].runs[0].scores; }, r => { r[0].runs[0].scores = [1, 0, 0]; }, r => { r[0].runs[0].scores = [0.5, 0.5, 0, 0]; }, r => { r[0].runs[0].scores = [1, 0, 0, NaN]; }, r => { r[0].runs[0].scores = null; }, r => { r[0].runs[0].decision = { status: 'unavailable', reason: 'provider-timeout' }; }]) { const r = records(); mutate(r); assert.throws(() => evaluate(make(), r)); }
|
|
35
|
+
const r = records(); r[0].runs[1].decision = decision('tier3'); r[0].runs[1].scores = oneHot('tier3');
|
|
36
|
+
assert.equal(evaluate(make(), r).agreement, 0.5);
|
|
37
|
+
});
|
|
38
|
+
test('S1-E06 repeatability compares the full score vector, not only top-2 summaries', () => {
|
|
39
|
+
const r = records();
|
|
40
|
+
const accepted = { status: 'accepted', reason: 'scored', selectedId: 'tier1', confidence: 0.9, margin: 0.85, model: { id: 'fixture', revision: 'v1', domain: 'harness-routing-v1' } };
|
|
41
|
+
r[0].runs[0] = { decision: { ...accepted }, scores: [0.9, 0.05, 0.03, 0.02], latencyMs: 20, coldStart: true };
|
|
42
|
+
r[0].runs[1] = { decision: { ...accepted }, scores: [0.9, 0.05, 0.02, 0.03], latencyMs: 20, coldStart: true };
|
|
43
|
+
const report = evaluate(make(), r);
|
|
44
|
+
assert.equal(report.agreement, 0.5); assert.equal(report.gates.repeatability, false);
|
|
45
|
+
r[0].runs[1].scores = [0.9, 0.05, 0.03, 0.02];
|
|
46
|
+
assert.equal(evaluate(make(), r).agreement, 1);
|
|
47
|
+
r.forEach(x => x.runs.forEach(v => { v.decision = { status: 'unavailable', reason: 'provider-config' }; v.scores = null; }));
|
|
48
|
+
assert.equal(evaluate(make(), r).agreement, 1);
|
|
49
|
+
});
|
|
50
|
+
test('S1-E04 zero coverage and wrong accepted predictions fail quality gates', () => {
|
|
51
|
+
const r = records(); r.forEach(x => x.runs.forEach(v => { v.decision = { status: 'unavailable', reason: 'provider-config' }; v.scores = null; }));
|
|
52
|
+
const report = evaluate(make(), r);
|
|
53
|
+
assert.equal(report.model.coverage, 0); assert.equal(report.model.acceptedPrecision, null); assert.equal(report.rolloutReady, false);
|
|
54
|
+
const wrong = records(); wrong.forEach(x => x.runs.forEach(v => { v.decision = decision('tier3'); v.scores = oneHot('tier3'); }));
|
|
55
|
+
assert.equal(evaluate(make(), wrong).model.acceptedErrorRate, 1);
|
|
56
|
+
});
|
|
57
|
+
test('S1-E05 real evaluation CLI repeats with only documented timing volatility', () => {
|
|
58
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'harness-s1-eval-'));
|
|
59
|
+
try {
|
|
60
|
+
const root = path.resolve(__dirname, '..');
|
|
61
|
+
const input = path.join(dir, 'corpus.json'); fs.writeFileSync(input, JSON.stringify(make()));
|
|
62
|
+
const run = () => {
|
|
63
|
+
const output = path.join(dir, 'report.json');
|
|
64
|
+
const child = spawnSync(process.execPath, [path.join(root, 'scripts/evaluate-system-one.js'), input, path.join(dir, 'missing.json'), output], { encoding: 'utf8', cwd: root });
|
|
65
|
+
assert.equal(child.status, 0, child.stderr);
|
|
66
|
+
const report = JSON.parse(fs.readFileSync(output, 'utf8'));
|
|
67
|
+
assert.equal(report.model.coverage, 0); assert.equal(report.rolloutReady, false);
|
|
68
|
+
assert.equal(report.records[0].runs[0].decision.reason, 'provider-config');
|
|
69
|
+
assert.equal(report.records[0].runs[0].scores, null);
|
|
70
|
+
assert.deepEqual(report.evidence.source, { status: 'unavailable', reason: 'provider-config' });
|
|
71
|
+
assert.equal(report.evidence.environment.python, null);
|
|
72
|
+
assert.equal(report.gates.sourceProvenance, false);
|
|
73
|
+
report.records.forEach(r => r.runs.forEach(v => { v.latencyMs = 0; }));
|
|
74
|
+
report.latency.coldP95Ms = 0;
|
|
75
|
+
return { status: child.status, stdout: child.stdout, stderr: child.stderr, report, files: fs.readdirSync(dir).sort() };
|
|
76
|
+
};
|
|
77
|
+
assert.deepEqual(run(), run());
|
|
78
|
+
} finally { fs.rmSync(dir, { recursive: true, force: true }); }
|
|
79
|
+
});
|
|
80
|
+
test('S1-E07 source provenance gate requires the pinned cua_s1 revision', () => {
|
|
81
|
+
const recorded = status => ({ status: 'recorded', provenance: { python: { implementation: 'CPython', version: '3.12.4' }, cuaS1: { distribution: 'cua-s1', version: '0.1.0', sourceRevision: null, pinnedRevision: 'b'.repeat(40), sourceRevisionStatus: status }, torch: null } });
|
|
82
|
+
assert.equal(evaluate(make(), records()).gates.sourceProvenance, false);
|
|
83
|
+
assert.equal(evaluate(make(), records(), { status: 'unavailable', reason: 'provider-exit' }).gates.sourceProvenance, false);
|
|
84
|
+
for (const status of ['unavailable', 'mismatch']) assert.equal(evaluate(make(), records(), recorded(status)).gates.sourceProvenance, false);
|
|
85
|
+
assert.equal(evaluate(make(), records(), recorded('pinned')).gates.sourceProvenance, true);
|
|
86
|
+
assert.equal(evaluate(make(), records(), recorded('pinned')).rolloutReady, false);
|
|
87
|
+
});
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const { test } = require('node:test');
|
|
3
|
+
const assert = require('node:assert/strict');
|
|
4
|
+
const fs = require('node:fs');
|
|
5
|
+
const os = require('node:os');
|
|
6
|
+
const path = require('node:path');
|
|
7
|
+
const { createHash } = require('node:crypto');
|
|
8
|
+
const { spawnSync } = require('node:child_process');
|
|
9
|
+
const install = require('../harness-everything/scripts/system-one/install');
|
|
10
|
+
const { validateManifest, PINNED_CUA_S1_REVISION } = require('../harness-everything/scripts/system-one/provider');
|
|
11
|
+
const script = path.join(__dirname, '../harness-everything/scripts/system-one/install.js');
|
|
12
|
+
const sha = buf => createHash('sha256').update(buf).digest('hex');
|
|
13
|
+
|
|
14
|
+
test('S1-I01 pins stay consistent with the provider contract', () => {
|
|
15
|
+
const { PINS } = install;
|
|
16
|
+
assert.equal(PINS.cuaS1Revision, PINNED_CUA_S1_REVISION);
|
|
17
|
+
assert.ok(PINS.cuaS1Spec.includes(`@${PINNED_CUA_S1_REVISION}#subdirectory=libs/cua-s1/python`));
|
|
18
|
+
assert.match(PINS.modelRevision, /^[0-9a-f]{40}$/);
|
|
19
|
+
assert.equal(PINS.modelId, 'cua-ai/cua-s1-forms'); assert.equal(PINS.domain, 'forms-v1');
|
|
20
|
+
for (const file of Object.values(PINS.files)) {
|
|
21
|
+
assert.match(file.sha256, /^[0-9a-f]{64}$/); assert.ok(Number.isInteger(file.size) && file.size > 0);
|
|
22
|
+
assert.equal(install.fileUrl(file.name), `https://huggingface.co/cua-ai/cua-s1-forms/resolve/${PINS.modelRevision}/${file.name}`);
|
|
23
|
+
}
|
|
24
|
+
assert.equal(path.basename(PINS.files.config.name, '.json'), path.basename(PINS.files.weights.name, '.safetensors'));
|
|
25
|
+
const dir = path.resolve(os.tmpdir(), 'system-one');
|
|
26
|
+
const manifest = install.buildManifest(dir, path.join(dir, 'venv', 'python'));
|
|
27
|
+
assert.equal(validateManifest(manifest), true);
|
|
28
|
+
assert.equal(manifest.checkpoint, path.join(dir, 'checkpoints', PINS.modelRevision, PINS.files.weights.name));
|
|
29
|
+
assert.equal(manifest.weightsSha256, PINS.files.weights.sha256); assert.equal(manifest.configSha256, PINS.files.config.sha256);
|
|
30
|
+
assert.equal(manifest.revision, PINS.modelRevision); assert.equal(manifest.timeoutMs, 10000);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
test('S1-I02 interpreter selection accepts only the upstream-supported Python range', () => {
|
|
34
|
+
for (const v of ['3.11.0', '3.12.4', '3.13.6']) assert.equal(install.supportedPython(v), true);
|
|
35
|
+
for (const v of ['3.10.9', '3.14.0', '2.7.18', '3.13', '', 'x', null]) assert.equal(install.supportedPython(v), false);
|
|
36
|
+
const win = install.pythonCandidates('win32');
|
|
37
|
+
assert.deepEqual(win[0], ['py', '-3.13']);
|
|
38
|
+
assert.ok(win.every(c => !c.includes('-3.14')));
|
|
39
|
+
assert.deepEqual(install.pythonCandidates('linux')[0], ['python3.13']);
|
|
40
|
+
assert.equal(install.venvPython('/x', 'win32'), path.join('/x', 'venv', 'Scripts', 'python.exe'));
|
|
41
|
+
assert.equal(install.venvPython('/x', 'linux'), path.join('/x', 'venv', 'bin', 'python'));
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
test('S1-I03 argument parsing is explicit and rejects ambiguous input', () => {
|
|
45
|
+
const home = install.parseArgs([]);
|
|
46
|
+
assert.equal(home.dir, path.join(os.homedir(), '.agents', 'harness-everything', 'system-one'));
|
|
47
|
+
assert.equal(home.python, null); assert.equal(home.dryRun, false);
|
|
48
|
+
const dir = path.resolve(os.tmpdir(), 's1');
|
|
49
|
+
assert.deepEqual(install.parseArgs(['--dir', dir, '--python', 'py', '--dry-run']), { dir, python: 'py', dryRun: true });
|
|
50
|
+
for (const argv of [['--dir', 'relative'], ['--dir'], ['--python'], ['--unknown'], ['extra'], ['--dry-run', '--dry-run']]) {
|
|
51
|
+
assert.throws(() => install.parseArgs(argv), { message: 'usage' });
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
test('S1-I04 downloads are verified before an atomic write; a valid file is reused', async () => {
|
|
56
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'harness-s1-install-'));
|
|
57
|
+
try {
|
|
58
|
+
const good = Buffer.from('pinned-bytes\r\n');
|
|
59
|
+
const spec = { name: 'x.json', sha256: sha(good), size: good.length };
|
|
60
|
+
const dest = path.join(dir, 'x.json');
|
|
61
|
+
let calls = 0;
|
|
62
|
+
const fetcher = bytes => async () => { calls++; return bytes; };
|
|
63
|
+
for (const bad of [Buffer.from('tampered-bytes'), Buffer.concat([good, Buffer.from('x')]), Buffer.alloc(0)]) {
|
|
64
|
+
await assert.rejects(install.ensureFile('https://example.invalid/x', dest, spec, fetcher(bad)), /download-verification/);
|
|
65
|
+
assert.equal(fs.existsSync(dest), false);
|
|
66
|
+
assert.deepEqual(fs.readdirSync(dir), []);
|
|
67
|
+
}
|
|
68
|
+
assert.equal(await install.ensureFile('https://example.invalid/x', dest, spec, fetcher(good)), 'downloaded');
|
|
69
|
+
assert.ok(fs.readFileSync(dest).equals(good));
|
|
70
|
+
const before = calls;
|
|
71
|
+
assert.equal(await install.ensureFile('https://example.invalid/x', dest, spec, fetcher(good)), 'verified-existing');
|
|
72
|
+
assert.equal(calls, before);
|
|
73
|
+
fs.writeFileSync(dest, 'corrupted');
|
|
74
|
+
assert.equal(await install.ensureFile('https://example.invalid/x', dest, spec, fetcher(good)), 'downloaded');
|
|
75
|
+
assert.ok(fs.readFileSync(dest).equals(good));
|
|
76
|
+
} finally { fs.rmSync(dir, { recursive: true, force: true }); }
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
test('S1-I05 dry run prints the pinned plan and changes nothing, repeatably', () => {
|
|
80
|
+
const dir = path.join(fs.mkdtempSync(path.join(os.tmpdir(), 'harness-s1-dry-')), 'target');
|
|
81
|
+
try {
|
|
82
|
+
const run = () => spawnSync(process.execPath, [script, '--dir', dir, '--python', 'python-not-used', '--dry-run'], { encoding: 'utf8' });
|
|
83
|
+
const one = run(); const two = run();
|
|
84
|
+
assert.equal(one.status, 0, one.stderr); assert.equal(one.stdout, two.stdout);
|
|
85
|
+
const plan = JSON.parse(one.stdout);
|
|
86
|
+
assert.equal(plan.dryRun, true); assert.equal(plan.dir, dir);
|
|
87
|
+
assert.equal(plan.manifest, path.join(dir, 'manifest.json'));
|
|
88
|
+
assert.ok(plan.steps.some(s => s.includes(install.PINS.cuaS1Spec)));
|
|
89
|
+
assert.ok(plan.steps.some(s => s.includes(install.PINS.torchIndex)));
|
|
90
|
+
assert.deepEqual(plan.env, { HARNESS_SYSTEM_ONE_MODE: 'shadow', HARNESS_SYSTEM_ONE_CONFIG: path.join(dir, 'manifest.json') });
|
|
91
|
+
assert.equal(fs.existsSync(dir), false);
|
|
92
|
+
const bad = spawnSync(process.execPath, [script, '--dir', 'relative'], { encoding: 'utf8' });
|
|
93
|
+
assert.equal(bad.status, 2); assert.match(bad.stderr, /Usage/);
|
|
94
|
+
} finally { fs.rmSync(path.dirname(dir), { recursive: true, force: true }); }
|
|
95
|
+
});
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const { test } = require('node:test');
|
|
3
|
+
const assert = require('node:assert/strict');
|
|
4
|
+
const path = require('node:path');
|
|
5
|
+
const fs = require('node:fs');
|
|
6
|
+
const os = require('node:os');
|
|
7
|
+
const { spawnSync } = require('node:child_process');
|
|
8
|
+
const { createRequest, decide } = require('../harness-everything/scripts/system-one/contract');
|
|
9
|
+
const { score, runProvider, validateManifest, provenance, validateProvenance, PINNED_CUA_S1_REVISION } = require('../harness-everything/scripts/system-one/provider');
|
|
10
|
+
const fixture = path.join(__dirname, 'fixtures/system-one-provider.cjs');
|
|
11
|
+
const request = createRequest('tier', '修正 typo; $(never execute)', [{ id: 'tier1', text: 'Small' }, { id: 'tier3', text: 'Large' }]);
|
|
12
|
+
const manifest = () => ({ schemaVersion: 1, python: 'python3', checkpoint: path.resolve('model.safetensors'), weightsSha256: 'a'.repeat(64), configSha256: 'b'.repeat(64), modelId: 'test', revision: 'v1', domain: 'harness-routing-v1' });
|
|
13
|
+
test('S1-P01 real IPC exact input/output repeated in clean child processes', () => {
|
|
14
|
+
const one = runProvider(request, process.execPath, [fixture, 'ok']);
|
|
15
|
+
const two = runProvider(request, process.execPath, [fixture, 'ok']);
|
|
16
|
+
assert.deepEqual(one, two); assert.equal(one.status, 'scored');
|
|
17
|
+
assert.equal(decide(request, one.response).selectedId, 'tier1');
|
|
18
|
+
assert.deepEqual(Object.keys(one).sort(), ['response', 'status']);
|
|
19
|
+
});
|
|
20
|
+
test('S1-P02 unavailable, timeout, output bounds, malformed output and repeatability', () => {
|
|
21
|
+
for (const [mode, reason] of [['timeout', 'provider-timeout'], ['overflow', 'provider-output-limit'], ['exit', 'provider-exit'], ['invalid', 'provider-json']]) {
|
|
22
|
+
// Only the timeout case uses a short budget; child startup under parallel CI load can exceed 300ms.
|
|
23
|
+
const call = () => runProvider(request, process.execPath, [fixture, mode], mode === 'timeout' ? 300 : 10000);
|
|
24
|
+
assert.deepEqual(call(), { status: 'unavailable', reason }); assert.deepEqual(call(), call());
|
|
25
|
+
}
|
|
26
|
+
assert.deepEqual(runProvider(request, path.join(os.tmpdir(), 'absent-system-one-python'), []), { status: 'unavailable', reason: 'provider-unavailable' });
|
|
27
|
+
assert.deepEqual(score(request, '/missing/system-one-manifest.json'), { status: 'unavailable', reason: 'provider-config' });
|
|
28
|
+
});
|
|
29
|
+
test('S1-P03 trusted manifest validation', () => {
|
|
30
|
+
assert.equal(validateManifest(manifest()), true);
|
|
31
|
+
assert.equal(validateManifest({ ...manifest(), timeoutMs: 1 }), true);
|
|
32
|
+
assert.equal(validateManifest({ ...manifest(), timeoutMs: 10000 }), true);
|
|
33
|
+
for (const change of [{ schemaVersion: 2 }, { python: '' }, { checkpoint: 'relative.safetensors' }, { checkpoint: path.resolve('model.pt') }, { weightsSha256: 'abc' }, { configSha256: null }, { modelId: '' }, { revision: null }, { domain: '' }, { timeoutMs: 0 }, { timeoutMs: 10001 }, { timeoutMs: '100' }, { unexpected: true }, { modelId: 'cua-ai/cua-s1-forms' }]) assert.throws(() => validateManifest({ ...manifest(), ...change }));
|
|
34
|
+
for (const key of Object.keys(manifest())) { const m = manifest(); delete m[key]; assert.throws(() => validateManifest(m)); }
|
|
35
|
+
});
|
|
36
|
+
test('S1-P04 Python artifact validation and byte-limit rejection without ML dependency', () => {
|
|
37
|
+
const python = process.env.PYTHON || (process.platform === 'win32' ? 'python' : 'python3');
|
|
38
|
+
const result = spawnSync(python, [path.join(__dirname, 'system-one-adapter-test.py')], { encoding: 'utf8' });
|
|
39
|
+
assert.equal(result.status, 0, result.stderr || String(result.error));
|
|
40
|
+
assert.match(result.stderr, /OK/);
|
|
41
|
+
});
|
|
42
|
+
test('S1-P05 runtime/source provenance is recorded, and a missing or mismatched revision stays visible', () => {
|
|
43
|
+
const probe = rev => ({ schemaVersion: 1, python: { implementation: 'CPython', version: '3.12.4' }, cuaS1: { distribution: 'cua-s1', version: '0.1.0', sourceRevision: rev }, torch: '2.5.1' });
|
|
44
|
+
assert.equal(validateProvenance(probe(PINNED_CUA_S1_REVISION)).cuaS1.sourceRevisionStatus, 'pinned');
|
|
45
|
+
assert.equal(validateProvenance(probe('0'.repeat(40))).cuaS1.sourceRevisionStatus, 'mismatch');
|
|
46
|
+
assert.equal(validateProvenance(probe(null)).cuaS1.sourceRevisionStatus, 'unavailable');
|
|
47
|
+
assert.equal(validateProvenance(probe(null)).cuaS1.pinnedRevision, PINNED_CUA_S1_REVISION);
|
|
48
|
+
for (const mutate of [p => { p.schemaVersion = 2; }, p => { p.extra = 1; }, p => { delete p.torch; }, p => { p.python.version = ''; }, p => { p.python.extra = 1; }, p => { p.cuaS1.sourceRevision = 'abc'; }, p => { p.cuaS1.sourceRevision = 'A'.repeat(40); }, p => { p.cuaS1.version = 1; }, p => { p.cuaS1.extra = 1; }, p => { p.torch = 'x'.repeat(129); }, p => { p.python.version = '3.12\n'; }]) {
|
|
49
|
+
const p = probe(null); mutate(p); assert.throws(() => validateProvenance(p));
|
|
50
|
+
}
|
|
51
|
+
assert.deepEqual(provenance('/missing/system-one-manifest.json'), { status: 'unavailable', reason: 'provider-config' });
|
|
52
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'harness-s1-prov-'));
|
|
53
|
+
try {
|
|
54
|
+
const python = process.env.PYTHON || (process.platform === 'win32' ? 'python' : 'python3');
|
|
55
|
+
const file = path.join(dir, 'manifest.json');
|
|
56
|
+
fs.writeFileSync(file, JSON.stringify({ ...manifest(), python, checkpoint: path.join(dir, 'absent.safetensors') }));
|
|
57
|
+
const one = provenance(file); const two = provenance(file);
|
|
58
|
+
assert.deepEqual(one, two);
|
|
59
|
+
assert.equal(one.status, 'recorded', JSON.stringify(one));
|
|
60
|
+
assert.match(one.provenance.python.version, /^3\.\d+\.\d+/);
|
|
61
|
+
if (one.provenance.cuaS1.distribution === null) assert.equal(one.provenance.cuaS1.sourceRevisionStatus, 'unavailable');
|
|
62
|
+
} finally { fs.rmSync(dir, { recursive: true, force: true }); }
|
|
63
|
+
});
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const { test } = require('node:test');
|
|
3
|
+
const assert = require('node:assert/strict');
|
|
4
|
+
const { spawnSync } = require('node:child_process');
|
|
5
|
+
const path = require('node:path');
|
|
6
|
+
const { selectTier, TIER_OPTIONS } = require('../harness-everything/scripts/system-one/router');
|
|
7
|
+
const root = path.resolve(__dirname, '..');
|
|
8
|
+
function scorer(id = 'tier2', domain = 'harness-routing-v1') {
|
|
9
|
+
return req => ({ status: 'scored', response: { schemaVersion: 1, requestHash: req.requestHash, catalogHash: req.catalogHash,
|
|
10
|
+
model: { id: 'fixture', revision: 'v1', domain }, scores: req.options.map(o => ({ id: o.id, probability: o.id === id ? 1 : 0 })) } });
|
|
11
|
+
}
|
|
12
|
+
test('S1-R01 off/shadow/prefer and rollback', () => {
|
|
13
|
+
const input = { prompt: '實作功能', tier: 'Unclassified' };
|
|
14
|
+
const forbidden = () => { throw new Error('must not invoke'); };
|
|
15
|
+
assert.deepEqual(selectTier(input, {}, forbidden), { tier: input.tier, diagnostic: null });
|
|
16
|
+
assert.equal(selectTier(input, { HARNESS_SYSTEM_ONE_MODE: 'off' }, forbidden).tier, input.tier);
|
|
17
|
+
for (const mode of ['shadow', 'prefer']) {
|
|
18
|
+
let captured;
|
|
19
|
+
const result = selectTier(input, { HARNESS_SYSTEM_ONE_MODE: mode }, req => { captured = req; return scorer()(req); });
|
|
20
|
+
assert.deepEqual(captured.options, TIER_OPTIONS);
|
|
21
|
+
assert.equal(result.tier, mode === 'prefer' ? 'Tier 2 (Standard Task)' : input.tier);
|
|
22
|
+
assert.equal(result.diagnostic.status, 'accepted');
|
|
23
|
+
assert.ok(!JSON.stringify(result.diagnostic).includes(input.prompt));
|
|
24
|
+
}
|
|
25
|
+
assert.equal(selectTier(input, { HARNESS_SYSTEM_ONE_MODE: 'unknown' }, forbidden).diagnostic.reason, 'invalid-mode');
|
|
26
|
+
});
|
|
27
|
+
test('S1-R02 explicit precedence, abstention and every failure leave fallback intact', () => {
|
|
28
|
+
const env = { HARNESS_SYSTEM_ONE_MODE: 'prefer' };
|
|
29
|
+
const input = { prompt: 'use fable architecture', tier: 'Tier 3 (Macro Task)' };
|
|
30
|
+
assert.equal(selectTier({ ...input, explicit: true }, env, scorer('tier1')).tier, input.tier);
|
|
31
|
+
for (const provider of [scorer('unclassified'), scorer('tier1', 'forms-v1'), () => ({ status: 'unavailable', reason: 'provider-timeout' }), () => ({ status: 'scored', response: null }), () => { throw new Error('secret'); }]) {
|
|
32
|
+
const result = selectTier(input, env, provider);
|
|
33
|
+
assert.equal(result.tier, input.tier);
|
|
34
|
+
assert.ok(!JSON.stringify(result).includes('secret'));
|
|
35
|
+
}
|
|
36
|
+
assert.equal(selectTier({ ...input, prompt: '' }, env, scorer()).diagnostic.reason, 'invalid-request');
|
|
37
|
+
});
|
|
38
|
+
test('S1-R03 real CLI/kernel off parity and shadow failure repeated', () => {
|
|
39
|
+
const script = path.join(root, 'harness-everything/scripts/kernel-router-core.js');
|
|
40
|
+
const run = mode => spawnSync(process.execPath, [script, 'deploy to production'], { cwd: root, encoding: 'utf8', env: { ...process.env, HARNESS_SYSTEM_ONE_MODE: mode, HARNESS_SYSTEM_ONE_CONFIG: '' } });
|
|
41
|
+
const off = run('off'); assert.equal(off.status, 0);
|
|
42
|
+
const baseline = run(''); assert.equal(off.stdout, baseline.stdout);
|
|
43
|
+
const one = run('shadow'); const two = run('shadow');
|
|
44
|
+
assert.equal(one.status, 0); assert.equal(one.stdout, two.stdout); assert.equal(one.stderr, two.stderr);
|
|
45
|
+
assert.match(one.stdout, /SYSTEM ONE.*provider-config/);
|
|
46
|
+
const parse = text => JSON.parse(text.match(/ROUTER WORKFLOW PLAN \(JSON\): (.*)/)[1]);
|
|
47
|
+
assert.deepEqual(parse(one.stdout), parse(off.stdout));
|
|
48
|
+
assert.equal(parse(one.stdout).actionGate.required, true);
|
|
49
|
+
});
|
|
50
|
+
test('S1-R04 integrated accepted route preserves policy and explicit model choice', () => {
|
|
51
|
+
const provider = require('../harness-everything/scripts/system-one/provider');
|
|
52
|
+
const original = provider.score; const log = console.log; const env = process.env.HARNESS_SYSTEM_ONE_MODE;
|
|
53
|
+
try {
|
|
54
|
+
process.env.HARNESS_SYSTEM_ONE_MODE = 'prefer'; console.log = () => {};
|
|
55
|
+
provider.score = scorer('tier1');
|
|
56
|
+
const { run } = require('../harness-everything/scripts/tier-router');
|
|
57
|
+
const risky = run('deploy to production; save lesson to memory');
|
|
58
|
+
assert.equal(risky.workflowPlan.actionGate.required, true);
|
|
59
|
+
assert.notEqual(risky.workflowPlan.memory.write, 'none');
|
|
60
|
+
const explicit = run('use fable-staged without subagents');
|
|
61
|
+
assert.notEqual(explicit.workflowPlan.strategy, 'direct-single');
|
|
62
|
+
assert.ok(explicit.workflowPlan.requiredInvariants.includes('replan-after-repeated-failure'));
|
|
63
|
+
const normal = run('unusual bounded wording');
|
|
64
|
+
assert.equal(normal.workflowPlan.tier, 'tier1');
|
|
65
|
+
} finally { provider.score = original; console.log = log; if (env === undefined) delete process.env.HARNESS_SYSTEM_ONE_MODE; else process.env.HARNESS_SYSTEM_ONE_MODE = env; }
|
|
66
|
+
});
|
|
67
|
+
test('S1-R05 structural floor: a scorer can raise but never lower a deterministic macro/multi-task tier', () => {
|
|
68
|
+
const env = { HARNESS_SYSTEM_ONE_MODE: 'prefer' };
|
|
69
|
+
const macro = { prompt: 'audit every skill in the repository', tier: 'Tier 3 (Macro Task)', floor: 'tier3' };
|
|
70
|
+
for (const id of ['tier1', 'tier2']) {
|
|
71
|
+
const result = selectTier(macro, env, scorer(id));
|
|
72
|
+
assert.equal(result.tier, macro.tier);
|
|
73
|
+
assert.equal(result.diagnostic.applied, false);
|
|
74
|
+
assert.equal(result.diagnostic.reason, 'structural-floor');
|
|
75
|
+
assert.equal(result.diagnostic.selectedId, id);
|
|
76
|
+
}
|
|
77
|
+
const multi = { prompt: 'x', tier: 'Tier 2 (Standard Task)', floor: 'tier2' };
|
|
78
|
+
assert.equal(selectTier(multi, env, scorer('tier1')).tier, multi.tier);
|
|
79
|
+
assert.equal(selectTier(multi, env, scorer('tier3')).tier, 'Tier 3 (Macro Task)');
|
|
80
|
+
assert.equal(selectTier({ ...multi, floor: null }, env, scorer('tier1')).tier, 'Tier 1 (Trivial)');
|
|
81
|
+
assert.equal(selectTier({ ...multi, floor: 'tier9' }, env, () => { throw new Error('must not invoke'); }).diagnostic.reason, 'invalid-request');
|
|
82
|
+
|
|
83
|
+
const provider = require('../harness-everything/scripts/system-one/provider');
|
|
84
|
+
const original = provider.score; const log = console.log; const mode = process.env.HARNESS_SYSTEM_ONE_MODE;
|
|
85
|
+
try {
|
|
86
|
+
console.log = () => {};
|
|
87
|
+
const { run } = require('../harness-everything/scripts/tier-router');
|
|
88
|
+
for (const prompt of ['audit every skill in the repository', 'Refactor the parser. Then update the tests and also the docs. Finally rerun CI.']) {
|
|
89
|
+
process.env.HARNESS_SYSTEM_ONE_MODE = 'off';
|
|
90
|
+
const lexical = run(prompt).workflowPlan;
|
|
91
|
+
process.env.HARNESS_SYSTEM_ONE_MODE = 'prefer'; provider.score = scorer('tier1');
|
|
92
|
+
assert.deepEqual(run(prompt).workflowPlan, lexical);
|
|
93
|
+
provider.score = original;
|
|
94
|
+
}
|
|
95
|
+
process.env.HARNESS_SYSTEM_ONE_MODE = 'prefer'; provider.score = scorer('tier1');
|
|
96
|
+
const plan = run('audit every skill in the repository').workflowPlan;
|
|
97
|
+
assert.equal(plan.tier, 'tier3');
|
|
98
|
+
assert.notEqual(plan.strategy, 'direct-single');
|
|
99
|
+
assert.equal(plan.verification.independent, true);
|
|
100
|
+
} finally { provider.score = original; console.log = log; if (mode === undefined) delete process.env.HARNESS_SYSTEM_ONE_MODE; else process.env.HARNESS_SYSTEM_ONE_MODE = mode; }
|
|
101
|
+
});
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"""Stdlib adapter tests: no claim of real checkpoint inference."""
|
|
2
|
+
import hashlib
|
|
3
|
+
import importlib.util
|
|
4
|
+
import json
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
import tempfile
|
|
7
|
+
import unittest
|
|
8
|
+
|
|
9
|
+
path = Path(__file__).resolve().parents[1] / 'harness-everything/scripts/system-one/cua_adapter.py'
|
|
10
|
+
spec = importlib.util.spec_from_file_location('adapter', path)
|
|
11
|
+
adapter = importlib.util.module_from_spec(spec)
|
|
12
|
+
spec.loader.exec_module(adapter)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class AdapterTests(unittest.TestCase):
|
|
16
|
+
def test_artifact_hash_and_pickle_rejection(self):
|
|
17
|
+
with tempfile.TemporaryDirectory() as root:
|
|
18
|
+
weights = Path(root) / 'model.safetensors'
|
|
19
|
+
weights.write_bytes(b'synthetic-not-real-weights')
|
|
20
|
+
sidecar = weights.with_suffix('.json')
|
|
21
|
+
sidecar.write_text('{}', encoding='utf-8')
|
|
22
|
+
manifest = {'checkpoint': str(weights), 'weightsSha256': hashlib.sha256(weights.read_bytes()).hexdigest(), 'configSha256': hashlib.sha256(sidecar.read_bytes()).hexdigest()}
|
|
23
|
+
self.assertEqual(adapter.verify_artifacts(manifest), weights)
|
|
24
|
+
sidecar.write_text('{"changed":true}', encoding='utf-8')
|
|
25
|
+
with self.assertRaisesRegex(ValueError, 'artifact-hash'):
|
|
26
|
+
adapter.verify_artifacts(manifest)
|
|
27
|
+
manifest['checkpoint'] = str(weights.with_suffix('.pt'))
|
|
28
|
+
with self.assertRaisesRegex(ValueError, 'checkpoint-format'):
|
|
29
|
+
adapter.verify_artifacts(manifest)
|
|
30
|
+
|
|
31
|
+
def test_byte_limits_no_truncation(self):
|
|
32
|
+
request = {'context': '中文', 'options': [{'text': 'abc'}, {'text': 'x'}]}
|
|
33
|
+
adapter.check_limits(request, {'context_tokens': 6, 'option_tokens': 3})
|
|
34
|
+
for config in [{'context_tokens': 5, 'option_tokens': 3}, {'context_tokens': 6, 'option_tokens': 2}]:
|
|
35
|
+
with self.assertRaisesRegex(ValueError, 'input-too-long'):
|
|
36
|
+
adapter.check_limits(request, config)
|
|
37
|
+
|
|
38
|
+
def test_source_revision_only_from_recorded_vcs_commit(self):
|
|
39
|
+
commit = 'b7f7e2d8714609853a29c7d049140bc46aec0954'
|
|
40
|
+
vcs = {'url': 'https://github.com/trycua/cua', 'vcs_info': {'vcs': 'git', 'commit_id': commit}, 'subdirectory': 'libs/cua-s1/python'}
|
|
41
|
+
self.assertEqual(adapter.source_revision(json.dumps(vcs)), commit)
|
|
42
|
+
for text in ['', 'not-json', '[]', json.dumps({'url': 'file:///src', 'dir_info': {'editable': True}}),
|
|
43
|
+
json.dumps({'vcs_info': {'commit_id': 'main'}}), json.dumps({'vcs_info': {'commit_id': commit.upper()}}), json.dumps({'vcs_info': []})]:
|
|
44
|
+
self.assertIsNone(adapter.source_revision(text))
|
|
45
|
+
self.assertIsNone(adapter.source_revision(None))
|
|
46
|
+
|
|
47
|
+
def test_provenance_shape_without_ml_dependency(self):
|
|
48
|
+
result = adapter.provenance()
|
|
49
|
+
self.assertEqual(set(result), {'schemaVersion', 'python', 'cuaS1', 'torch'})
|
|
50
|
+
self.assertEqual(set(result['python']), {'implementation', 'version'})
|
|
51
|
+
self.assertEqual(set(result['cuaS1']), {'distribution', 'version', 'sourceRevision'})
|
|
52
|
+
self.assertEqual(json.loads(json.dumps(result)), result)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
if __name__ == '__main__':
|
|
56
|
+
unittest.main()
|
|
@@ -120,3 +120,14 @@ The OpenCode adapter uses the documented plugin API and has deterministic mechan
|
|
|
120
120
|
The matrix records the official documentation reviewed for each platform. Important source families include [OpenAI plugin packaging](https://developers.openai.com/plugins/build/plugins), [OpenAI public submission](https://developers.openai.com/plugins/deploy/submission), [Codex skills](https://learn.chatgpt.com/docs/build-skills), [Codex hooks](https://learn.chatgpt.com/docs/hooks), [Claude skills](https://code.claude.com/docs/en/skills), [OpenCode skills](https://opencode.ai/docs/skills), [GitHub Copilot Agent Skills](https://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-cloud-agent/add-skills), [Cursor skills](https://cursor.com/docs/skills), [Continue rules](https://docs.continue.dev/customize/rules), and [Hermes skills](https://hermes-agent.nousresearch.com/docs/user-guide/features/skills).
|
|
121
121
|
|
|
122
122
|
When a platform behavior changes, update this page, `docs/platform-compatibility.json`, and every affected current-state surface in the same change. `npm run test:docs:capabilities` and the compatibility mechanism suite enforce the repository-side contract; they do not replace manual live-host evidence.
|
|
123
|
+
# Experimental System One routing
|
|
124
|
+
|
|
125
|
+
The shared tier router supports opt-in `HARNESS_SYSTEM_ONE_MODE=shadow|prefer`
|
|
126
|
+
with a local CUA-S1 provider manifest (`HARNESS_SYSTEM_ONE_CONFIG`). Default `off`
|
|
127
|
+
retains existing behavior; `prefer` never lowers a tier below the deterministic
|
|
128
|
+
structural floor. Canonical and packaged runtime copies use the same
|
|
129
|
+
contract; this establishes no new live-host capability. Python, PyTorch and a
|
|
130
|
+
compatible local checkpoint are optional external dependencies, not npm payloads;
|
|
131
|
+
the explicit `npm run system-one:install` sets them up and hooks never run it.
|
|
132
|
+
Public Skills-only artifacts do not acquire lifecycle hooks from this feature.
|
|
133
|
+
See [System One routing](system-one-routing.md) for limits, rollback and evidence.
|