harness-everything 0.20.7 → 0.22.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.
Files changed (50) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/CHANGELOG.md +26 -0
  4. package/benchmarks/fixtures/system-one-routing.json +549 -0
  5. package/benchmarks/results/system-one/cua-s1-forms-cpu-2026-09-23/README.md +62 -0
  6. package/benchmarks/results/system-one/cua-s1-forms-cpu-2026-09-23/report.json +856 -0
  7. package/benchmarks/results/system-one/cua-s1-forms-resident-cpu-2026-09-23/README.md +74 -0
  8. package/benchmarks/results/system-one/cua-s1-forms-resident-cpu-2026-09-23/report.json +856 -0
  9. package/ci/fixtures/system-one-provider.cjs +13 -0
  10. package/ci/fixtures/system-one-resident-stub.py +28 -0
  11. package/ci/mechanism-packaging-bytecode.test.js +61 -0
  12. package/ci/mechanism-system-one-contract.test.js +48 -0
  13. package/ci/mechanism-system-one-evaluation.test.js +87 -0
  14. package/ci/mechanism-system-one-install.test.js +106 -0
  15. package/ci/mechanism-system-one-provider.test.js +63 -0
  16. package/ci/mechanism-system-one-resident.test.js +185 -0
  17. package/ci/mechanism-system-one-router.test.js +101 -0
  18. package/ci/system-one-adapter-test.py +222 -0
  19. package/docs/platform-capabilities.md +14 -0
  20. package/docs/system-one-routing.md +271 -0
  21. package/harness-everything/SKILL.md +1 -1
  22. package/harness-everything/scripts/system-one/contract.js +45 -0
  23. package/harness-everything/scripts/system-one/cua_adapter.py +353 -0
  24. package/harness-everything/scripts/system-one/evaluate.js +98 -0
  25. package/harness-everything/scripts/system-one/install.js +161 -0
  26. package/harness-everything/scripts/system-one/provider.js +79 -0
  27. package/harness-everything/scripts/system-one/resident.js +176 -0
  28. package/harness-everything/scripts/system-one/router.js +37 -0
  29. package/harness-everything/scripts/tier-router.js +16 -0
  30. package/opencode-plugin/plugin.json +1 -1
  31. package/package.json +2 -1
  32. package/plugins/harness-everything/.codex-plugin/plugin.json +1 -1
  33. package/plugins/harness-everything/plugin.json +1 -1
  34. package/plugins/harness-everything/scripts/lib/packaging-noise.js +6 -0
  35. package/plugins/harness-everything/scripts/lib/skills.js +2 -0
  36. package/plugins/harness-everything/skills/harness-everything/SKILL.md +1 -1
  37. package/plugins/harness-everything/skills/harness-everything/scripts/system-one/contract.js +45 -0
  38. package/plugins/harness-everything/skills/harness-everything/scripts/system-one/cua_adapter.py +353 -0
  39. package/plugins/harness-everything/skills/harness-everything/scripts/system-one/evaluate.js +98 -0
  40. package/plugins/harness-everything/skills/harness-everything/scripts/system-one/install.js +161 -0
  41. package/plugins/harness-everything/skills/harness-everything/scripts/system-one/provider.js +79 -0
  42. package/plugins/harness-everything/skills/harness-everything/scripts/system-one/resident.js +176 -0
  43. package/plugins/harness-everything/skills/harness-everything/scripts/system-one/router.js +37 -0
  44. package/plugins/harness-everything/skills/harness-everything/scripts/tier-router.js +16 -0
  45. package/sbom.cdx.json +7 -7
  46. package/scripts/build-openai-submission.js +2 -0
  47. package/scripts/evaluate-system-one.js +66 -0
  48. package/scripts/lib/packaging-noise.js +6 -0
  49. package/scripts/lib/skills.js +2 -0
  50. package/scripts/sync-openai-plugin.js +2 -1
@@ -0,0 +1,79 @@
1
+ 'use strict';
2
+ const fs = require('node:fs');
3
+ const path = require('node:path');
4
+ const { spawnSync } = require('node:child_process');
5
+ const { validateRequest } = require('./contract');
6
+ // Upstream cua_s1 source revision documented in docs/system-one-routing.md.
7
+ const PINNED_CUA_S1_REVISION = 'b7f7e2d8714609853a29c7d049140bc46aec0954';
8
+ const ADAPTER = path.join(__dirname, 'cua_adapter.py');
9
+ const unavailable = reason => ({ status: 'unavailable', reason });
10
+ const exact = (value, keys) => value && typeof value === 'object' && !Array.isArray(value)
11
+ && Object.keys(value).length === keys.length && keys.every(k => Object.hasOwn(value, k));
12
+ const label = value => typeof value === 'string' && value.length > 0 && value.length <= 128 && !/[\u0000-\u001f]/.test(value);
13
+ function validateManifest(m) {
14
+ const required = ['schemaVersion', 'python', 'checkpoint', 'weightsSha256', 'configSha256', 'modelId', 'revision', 'domain'];
15
+ if (!m || typeof m !== 'object' || Array.isArray(m) || required.some(k => !Object.hasOwn(m, k))
16
+ || Object.keys(m).some(k => ![...required, 'timeoutMs', 'transport', 'idleTimeoutMs'].includes(k)) || m.schemaVersion !== 1
17
+ || ['python', 'modelId', 'revision', 'domain'].some(k => typeof m[k] !== 'string' || !m[k].trim() || m[k].length > 4096 || m[k].includes('\0'))
18
+ || typeof m.checkpoint !== 'string' || !path.isAbsolute(m.checkpoint) || path.extname(m.checkpoint) !== '.safetensors'
19
+ || ['weightsSha256', 'configSha256'].some(k => typeof m[k] !== 'string' || !/^[a-f0-9]{64}$/.test(m[k]))
20
+ || (m.timeoutMs !== undefined && (!Number.isInteger(m.timeoutMs) || m.timeoutMs < 1 || m.timeoutMs > 10000))
21
+ || (m.transport !== undefined && !['oneshot', 'resident'].includes(m.transport))
22
+ || (m.idleTimeoutMs !== undefined && (!Number.isInteger(m.idleTimeoutMs) || m.idleTimeoutMs < 60000 || m.idleTimeoutMs > 14400000))
23
+ || (m.modelId === 'cua-ai/cua-s1-forms' && m.domain !== 'forms-v1')) throw new TypeError('invalid-manifest');
24
+ return true;
25
+ }
26
+ function readManifest(manifestPath) {
27
+ if (typeof manifestPath !== 'string' || !path.isAbsolute(manifestPath) || fs.statSync(manifestPath).size > 65536) throw new Error();
28
+ const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8'));
29
+ validateManifest(manifest);
30
+ return manifest;
31
+ }
32
+ function spawnJson(executable, args, input, timeoutMs) {
33
+ let result;
34
+ try {
35
+ result = spawnSync(executable, args, { input, encoding: 'utf8', shell: false,
36
+ timeout: timeoutMs, killSignal: 'SIGKILL', maxBuffer: 1024 * 1024, windowsHide: true });
37
+ } catch (_) { return unavailable('provider-unavailable'); }
38
+ if (result.error) return unavailable(result.error.code === 'ETIMEDOUT' ? 'provider-timeout'
39
+ : result.error.code === 'ENOBUFS' ? 'provider-output-limit' : 'provider-unavailable');
40
+ if (result.status !== 0) return unavailable('provider-exit');
41
+ try { return { status: 'ok', value: JSON.parse(result.stdout) }; }
42
+ catch (_) { return unavailable('provider-json'); }
43
+ }
44
+ function runProvider(request, executable, args, timeoutMs = 2000) {
45
+ validateRequest(request);
46
+ const result = spawnJson(executable, args, JSON.stringify(request), timeoutMs);
47
+ return result.status === 'ok' ? { status: 'scored', response: result.value } : result;
48
+ }
49
+ function score(request, manifestPath) {
50
+ validateRequest(request);
51
+ let manifest;
52
+ try { manifest = readManifest(manifestPath); } catch (_) { return unavailable('provider-config'); }
53
+ if (manifest.transport === 'resident') return require('./resident').score({ ...request }, manifest, manifestPath);
54
+ // Send the exact validated manifest to the child on stdin: no config reread race.
55
+ return runProvider({ ...request }, manifest.python, [ADAPTER, JSON.stringify(manifest)], manifest.timeoutMs || 2000);
56
+ }
57
+ // The probe reports what is installed; only a PEP 610 VCS commit counts as a source revision.
58
+ function validateProvenance(p) {
59
+ if (!exact(p, ['schemaVersion', 'python', 'cuaS1', 'torch']) || p.schemaVersion !== 1
60
+ || !exact(p.python, ['implementation', 'version']) || !label(p.python.implementation) || !label(p.python.version)
61
+ || !exact(p.cuaS1, ['distribution', 'version', 'sourceRevision'])
62
+ || ![p.cuaS1.distribution, p.cuaS1.version, p.torch].every(v => v === null || label(v))
63
+ || (p.cuaS1.sourceRevision !== null && !(typeof p.cuaS1.sourceRevision === 'string' && /^[0-9a-f]{40}$/.test(p.cuaS1.sourceRevision)))) {
64
+ throw new TypeError('invalid-provenance');
65
+ }
66
+ const revision = p.cuaS1.sourceRevision;
67
+ return { python: { ...p.python }, torch: p.torch, cuaS1: { ...p.cuaS1, pinnedRevision: PINNED_CUA_S1_REVISION,
68
+ sourceRevisionStatus: revision === null ? 'unavailable' : revision === PINNED_CUA_S1_REVISION ? 'pinned' : 'mismatch' } };
69
+ }
70
+ function provenance(manifestPath) {
71
+ let manifest;
72
+ try { manifest = readManifest(manifestPath); } catch (_) { return unavailable('provider-config'); }
73
+ // Metadata scans can exceed the per-score budget; use the manifest cap. No model is loaded.
74
+ const result = spawnJson(manifest.python, [ADAPTER, '--provenance'], '', 10000);
75
+ if (result.status !== 'ok') return result;
76
+ try { return { status: 'recorded', provenance: validateProvenance(result.value) }; }
77
+ catch (_) { return unavailable('provider-json'); }
78
+ }
79
+ module.exports = { score, runProvider, validateManifest, readManifest, provenance, validateProvenance, PINNED_CUA_S1_REVISION };
@@ -0,0 +1,176 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+ // Resident System One client: one verified model stays loaded in a loopback server.
4
+ // A score never blocks on model loading; a cold start returns provider-starting (lexical route wins).
5
+ const fs = require('node:fs');
6
+ const path = require('node:path');
7
+ const { createHash } = require('node:crypto');
8
+ const { spawn } = require('node:child_process');
9
+ const { Worker } = require('node:worker_threads');
10
+ const { validateRequest } = require('./contract');
11
+
12
+ const ADAPTER = path.join(__dirname, 'cua_adapter.py');
13
+ const LOCK_TTL_MS = 60000;
14
+ const CALL_TIMEOUT_MS = 1000;
15
+ const MAX_REPLY_BYTES = 1024 * 1024;
16
+ const unavailable = reason => ({ status: 'unavailable', reason });
17
+ const sleep = ms => Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
18
+ const exact = (value, keys) => value && typeof value === 'object' && !Array.isArray(value)
19
+ && Object.keys(value).length === keys.length && keys.every(k => Object.hasOwn(value, k));
20
+ const defaultCommand = manifest => [manifest.python, [ADAPTER, '--serve']];
21
+
22
+ function stateFiles(manifest, manifestPath) {
23
+ const digest = createHash('sha256').update(JSON.stringify(manifest)).digest('hex').slice(0, 16);
24
+ const base = path.join(path.dirname(manifestPath), `system-one-resident-${digest}`);
25
+ return { state: `${base}.json`, lock: `${base}.starting` };
26
+ }
27
+ function readState(file) {
28
+ try {
29
+ const s = JSON.parse(fs.readFileSync(file, 'utf8'));
30
+ if (exact(s, ['schemaVersion', 'pid', 'port', 'token', 'startedAt']) && s.schemaVersion === 1
31
+ && Number.isInteger(s.pid) && s.pid > 0 && Number.isInteger(s.port) && s.port > 0 && s.port < 65536
32
+ && typeof s.token === 'string' && /^[0-9a-f]{64}$/.test(s.token) && Number.isFinite(s.startedAt)) return s;
33
+ } catch (_) { /* absent or unreadable state means no usable server */ }
34
+ return null;
35
+ }
36
+ function lockInfo(file) {
37
+ try {
38
+ const ageMs = Date.now() - fs.statSync(file).mtimeMs;
39
+ let failed = null;
40
+ try { const body = JSON.parse(fs.readFileSync(file, 'utf8')); if (typeof body.failed === 'string') failed = body.failed; } catch (_) { /* partial write */ }
41
+ return { ageMs, failed };
42
+ } catch (_) { return null; }
43
+ }
44
+ function pidAlive(pid) {
45
+ try { process.kill(pid, 0); return true; } catch (err) { return err.code === 'EPERM'; }
46
+ }
47
+ function removeIfSame(file, state) {
48
+ const current = readState(file);
49
+ if (current && current.pid === state.pid && current.token === state.token) { try { fs.unlinkSync(file); } catch (_) { /* raced */ } }
50
+ }
51
+
52
+ // One socket round trip on a worker thread; the caller blocks with Atomics.wait (router API is synchronous).
53
+ const WORKER = `
54
+ const net = require('node:net');
55
+ const { workerData } = require('node:worker_threads');
56
+ const { port, payload, signal, out } = workerData;
57
+ const view = new Uint8Array(out); const chunks = []; let size = 0; let done = false;
58
+ const finish = (code, buf) => {
59
+ if (done) return; done = true;
60
+ if (buf) { view.set(buf); Atomics.store(signal, 1, buf.length); }
61
+ Atomics.store(signal, 0, code); Atomics.notify(signal, 0);
62
+ };
63
+ const socket = net.connect({ port, host: '127.0.0.1' }, () => socket.end(payload));
64
+ socket.on('data', c => { size += c.length; if (size > view.length) { finish(4); socket.destroy(); } else chunks.push(c); });
65
+ socket.on('end', () => finish(1, Buffer.concat(chunks)));
66
+ socket.on('error', e => finish(e.code === 'ECONNREFUSED' ? 2 : 3));
67
+ `;
68
+ function callSync(port, message, timeoutMs = CALL_TIMEOUT_MS) {
69
+ const signal = new Int32Array(new SharedArrayBuffer(8));
70
+ const out = new SharedArrayBuffer(MAX_REPLY_BYTES);
71
+ let worker;
72
+ try {
73
+ worker = new Worker(WORKER, { eval: true, workerData: { port, payload: `${JSON.stringify(message)}\n`, signal, out } });
74
+ worker.unref();
75
+ } catch (_) { return { error: 'io' }; }
76
+ Atomics.wait(signal, 0, 0, timeoutMs);
77
+ const code = Atomics.load(signal, 0);
78
+ worker.terminate();
79
+ if (code === 0) return { error: 'timeout' };
80
+ if (code !== 1) return { error: code === 2 ? 'refused' : code === 4 ? 'limit' : 'io' };
81
+ try { return { reply: JSON.parse(Buffer.from(out, 0, Atomics.load(signal, 1)).toString('utf8')) }; }
82
+ catch (_) { return { error: 'json' }; }
83
+ }
84
+
85
+ function start(manifest, files, deps) {
86
+ const lock = lockInfo(files.lock);
87
+ if (lock && lock.ageMs < LOCK_TTL_MS) return unavailable(lock.failed ? 'provider-unavailable' : 'provider-starting');
88
+ if (lock) { try { fs.unlinkSync(files.lock); } catch (_) { /* another caller replaced it */ } }
89
+ try { fs.writeFileSync(files.lock, JSON.stringify({ createdAt: Date.now() }), { flag: 'wx', mode: 0o600 }); }
90
+ catch (_) { return unavailable('provider-starting'); }
91
+ let child = null;
92
+ try {
93
+ const [exe, prefix] = (deps.command || defaultCommand)(manifest);
94
+ child = spawn(exe, [...prefix, JSON.stringify(manifest), files.state, files.lock],
95
+ { detached: true, stdio: 'ignore', windowsHide: true, shell: false });
96
+ child.on('error', () => { /* recorded synchronously below: a failed spawn has no pid */ });
97
+ child.unref();
98
+ } catch (_) { child = null; }
99
+ // The async 'error' event cannot run while callers block in Atomics.wait, so record the failure now.
100
+ if (!child || !child.pid) {
101
+ try { fs.writeFileSync(files.lock, JSON.stringify({ createdAt: Date.now(), failed: 'spawn-failed' })); } catch (_) { /* best effort */ }
102
+ return unavailable('provider-unavailable');
103
+ }
104
+ return unavailable('provider-starting');
105
+ }
106
+ // Returns a live server state, or null after removing state that provably belongs to a dead server.
107
+ function liveState(files) {
108
+ const state = readState(files.state);
109
+ if (state && !pidAlive(state.pid)) { removeIfSame(files.state, state); return null; }
110
+ return state;
111
+ }
112
+ function score(request, manifest, manifestPath, deps = {}) {
113
+ validateRequest(request);
114
+ const files = stateFiles(manifest, manifestPath);
115
+ const state = liveState(files);
116
+ if (!state) return start(manifest, files, deps);
117
+ const result = callSync(state.port, { token: state.token, op: 'score', request });
118
+ if (result.reply) {
119
+ if (result.reply.ok === true && Object.hasOwn(result.reply, 'response')) return { status: 'scored', response: result.reply.response };
120
+ if (result.reply.ok === false) return unavailable(result.reply.reason === 'unauthorized' ? 'provider-unavailable' : 'provider-exit');
121
+ return unavailable('provider-json');
122
+ }
123
+ if (result.error === 'refused') { removeIfSame(files.state, state); return start(manifest, files, deps); }
124
+ return unavailable({ timeout: 'provider-timeout', limit: 'provider-output-limit', json: 'provider-json' }[result.error] || 'provider-unavailable');
125
+ }
126
+ function ping(state) {
127
+ const result = callSync(state.port, { token: state.token, op: 'ping' });
128
+ return result.reply && result.reply.ok === true ? result.reply : null;
129
+ }
130
+ function ensureReady(manifest, manifestPath, waitMs, deps = {}) {
131
+ const files = stateFiles(manifest, manifestPath);
132
+ const deadline = Date.now() + waitMs;
133
+ while (Date.now() < deadline) {
134
+ const state = liveState(files);
135
+ if (state && ping(state)) return true;
136
+ if (!state) {
137
+ const lock = lockInfo(files.lock);
138
+ if (lock && lock.failed && lock.ageMs < LOCK_TTL_MS) return false;
139
+ if (!lock || lock.ageMs >= LOCK_TTL_MS) start(manifest, files, deps);
140
+ }
141
+ sleep(100);
142
+ }
143
+ return false;
144
+ }
145
+ function status(manifest, manifestPath) {
146
+ const state = liveState(stateFiles(manifest, manifestPath));
147
+ const reply = state && ping(state);
148
+ return reply ? { running: true, pid: state.pid, port: state.port, startedAt: state.startedAt, model: reply.model } : { running: false };
149
+ }
150
+ function stop(manifest, manifestPath) {
151
+ const files = stateFiles(manifest, manifestPath);
152
+ const state = liveState(files);
153
+ if (!state) return false;
154
+ const result = callSync(state.port, { token: state.token, op: 'shutdown' });
155
+ if (!(result.reply && result.reply.ok === true)) {
156
+ try { process.kill(state.pid); } catch (_) { /* already exited */ }
157
+ removeIfSame(files.state, state);
158
+ }
159
+ return true;
160
+ }
161
+
162
+ if (require.main === module) {
163
+ const [op, manifestPath, extra] = process.argv.slice(2);
164
+ let manifest = null;
165
+ try {
166
+ if (!['start', 'status', 'stop'].includes(op) || extra) throw new Error('usage');
167
+ manifest = require('./provider').readManifest(manifestPath);
168
+ } catch (_) {
169
+ console.error('Usage: resident.js start|status|stop <absolute manifest path>');
170
+ process.exit(2);
171
+ }
172
+ if (op === 'start') process.exitCode = ensureReady(manifest, manifestPath, 60000) ? 0 : 1;
173
+ if (op === 'stop') stop(manifest, manifestPath);
174
+ process.stdout.write(`${JSON.stringify(status(manifest, manifestPath))}\n`);
175
+ }
176
+ module.exports = { stateFiles, readState, callSync, score, ensureReady, status, stop, LOCK_TTL_MS, CALL_TIMEOUT_MS };
@@ -0,0 +1,37 @@
1
+ 'use strict';
2
+ const { createRequest, decide } = require('./contract');
3
+ const provider = require('./provider');
4
+ const TIER_OPTIONS = Object.freeze([
5
+ { id: 'tier1', text: 'A small bounded edit or operation with clear scope.' },
6
+ { id: 'tier2', text: 'Implementation or bug fix needing iterative testing.' },
7
+ { id: 'tier3', text: 'Architecture, repository-wide change or multi-stage engineering.' },
8
+ { id: 'unclassified', text: 'Unclear intent, insufficient context or outside these categories.' },
9
+ ].map(Object.freeze));
10
+ const LABELS = { tier1: 'Tier 1 (Trivial)', tier2: 'Tier 2 (Standard Task)', tier3: 'Tier 3 (Macro Task)' };
11
+ const RANK = { tier1: 1, tier2: 2, tier3: 3 };
12
+ // input.floor is the deterministic structural minimum; a scorer may raise the tier, never lower it below the floor.
13
+ function selectTier(input, env = process.env, scorer = provider.score) {
14
+ const mode = env.HARNESS_SYSTEM_ONE_MODE || 'off';
15
+ if (mode === 'off') return { tier: input.tier, diagnostic: null };
16
+ const fallback = (reason, status = 'unavailable') => ({ tier: input.tier, diagnostic: { mode: ['shadow', 'prefer'].includes(mode) ? mode : 'invalid', status, reason } });
17
+ if (!['shadow', 'prefer'].includes(mode)) return fallback('invalid-mode');
18
+ if (input.floor != null && !Object.hasOwn(RANK, input.floor)) return fallback('invalid-request');
19
+ let request;
20
+ try { request = createRequest('tier', input.prompt, TIER_OPTIONS); }
21
+ catch (_) { return fallback('invalid-request'); }
22
+ let result;
23
+ try { result = scorer(request, env.HARNESS_SYSTEM_ONE_CONFIG); }
24
+ catch (_) { return fallback('provider-unavailable'); }
25
+ if (!result || result.status !== 'scored') {
26
+ const allowed = ['provider-timeout', 'provider-output-limit', 'provider-exit', 'provider-json', 'provider-config', 'provider-unavailable', 'provider-starting'];
27
+ return fallback(allowed.includes(result?.reason) ? result.reason : 'provider-unavailable');
28
+ }
29
+ const decision = decide(request, result.response);
30
+ if (decision.selectedId === 'unclassified') Object.assign(decision, { selectedId: null, status: 'abstain', reason: 'unclassified' });
31
+ const accepted = decision.status === 'accepted';
32
+ const belowFloor = accepted && input.floor != null && RANK[decision.selectedId] < RANK[input.floor];
33
+ const applied = mode === 'prefer' && accepted && !input.explicit && !belowFloor;
34
+ const reason = input.explicit && accepted ? 'explicit-precedence' : belowFloor ? 'structural-floor' : decision.reason;
35
+ return { tier: applied ? LABELS[decision.selectedId] : input.tier, diagnostic: { mode, ...decision, applied, reason } };
36
+ }
37
+ module.exports = { selectTier, TIER_OPTIONS };
@@ -313,6 +313,19 @@ function run(userPrompt, context) {
313
313
  }
314
314
  }
315
315
 
316
+ const { selectTier } = require('./system-one/router');
317
+ const structuralFloor = hasMacroSignal ? 'tier3'
318
+ : !isTrivialDocsEdit && hasMultipleTasks && hasMultipleSentences ? 'tier2' : null;
319
+ const semantic = selectTier({ prompt: userPrompt, tier: recommendedTier, floor: structuralFloor,
320
+ explicit: Boolean(detectExplicitStrategy(userPrompt, detectFableModel(userPrompt))) });
321
+ if (semantic.diagnostic) console.log(`\n=> SYSTEM ONE: ${JSON.stringify(semantic.diagnostic)}`);
322
+ if (semantic.diagnostic?.applied) {
323
+ recommendedTier = semantic.tier;
324
+ rationale = 'System One selected a tier from the fixed catalog; deterministic policy remains authoritative.';
325
+ reasonCodes.splice(loadedConfig.reasonCodes.length);
326
+ addReason(reasonCodes, 'system-one-tier');
327
+ }
328
+
316
329
  console.log(`\n=> RECOMMENDED TIER: ${recommendedTier}`);
317
330
  console.log(`=> RATIONALE: ${rationale}`);
318
331
 
@@ -447,6 +460,7 @@ function run(userPrompt, context) {
447
460
  return contract;
448
461
  }
449
462
 
463
+ if (require.main === module) {
450
464
  let userPrompt = process.argv[2] || '';
451
465
  let hookContext = null;
452
466
 
@@ -471,3 +485,5 @@ if (process.argv[2]) {
471
485
  run(userPrompt, hookContext);
472
486
  });
473
487
  }
488
+ }
489
+ module.exports = { run };
package/sbom.cdx.json CHANGED
@@ -2,23 +2,23 @@
2
2
  "$schema": "https://cyclonedx.org/schema/bom-1.7.schema.json",
3
3
  "bomFormat": "CycloneDX",
4
4
  "specVersion": "1.7",
5
- "serialNumber": "urn:uuid:12ceeeac-7f99-5fb2-82a3-768d5d708e00",
5
+ "serialNumber": "urn:uuid:0f18cc7a-103c-5369-a33b-bdbe1bf12efb",
6
6
  "version": 1,
7
7
  "metadata": {
8
- "timestamp": "2026-09-22T16:17:00.105Z",
8
+ "timestamp": "2026-09-23T05:03:30.779Z",
9
9
  "tools": [
10
10
  {
11
11
  "vendor": "Harness Everything",
12
12
  "name": "generate-sbom.js",
13
- "version": "0.20.7"
13
+ "version": "0.22.0"
14
14
  }
15
15
  ],
16
16
  "component": {
17
17
  "type": "application",
18
- "bom-ref": "pkg:npm/harness-everything@0.20.7",
18
+ "bom-ref": "pkg:npm/harness-everything@0.22.0",
19
19
  "name": "harness-everything",
20
- "version": "0.20.7",
21
- "purl": "pkg:npm/harness-everything@0.20.7"
20
+ "version": "0.22.0",
21
+ "purl": "pkg:npm/harness-everything@0.22.0"
22
22
  }
23
23
  },
24
24
  "components": [
@@ -1999,7 +1999,7 @@
1999
1999
  ]
2000
2000
  },
2001
2001
  {
2002
- "ref": "pkg:npm/harness-everything@0.20.7",
2002
+ "ref": "pkg:npm/harness-everything@0.22.0",
2003
2003
  "dependsOn": [
2004
2004
  "pkg:npm/%40commitlint/cli@19.8.1",
2005
2005
  "pkg:npm/%40commitlint/config-conventional@19.8.1",
@@ -4,6 +4,7 @@
4
4
  const crypto = require('crypto');
5
5
  const fs = require('fs');
6
6
  const path = require('path');
7
+ const { isPackagingNoise } = require('./lib/packaging-noise');
7
8
 
8
9
  const ROOT = path.resolve(__dirname, '..');
9
10
  const SKILLS_ROOT = path.join(ROOT, 'plugins', 'harness-everything', 'skills');
@@ -24,6 +25,7 @@ function parseArgs(argv) {
24
25
 
25
26
  function filesUnder(root, base = root, out = []) {
26
27
  for (const entry of fs.readdirSync(root, { withFileTypes: true })) {
28
+ if (isPackagingNoise(entry.name)) continue;
27
29
  const full = path.join(root, entry.name);
28
30
  if (entry.isDirectory()) filesUnder(full, base, out);
29
31
  else if (entry.isFile()) out.push(path.relative(base, full).replace(/\\/g, '/'));
@@ -0,0 +1,66 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+ const fs = require('node:fs');
4
+ const os = require('node:os');
5
+ const { performance } = require('node:perf_hooks');
6
+ const { validateCorpus, evaluate } = require('../harness-everything/scripts/system-one/evaluate');
7
+ const { score, provenance, readManifest } = require('../harness-everything/scripts/system-one/provider');
8
+ const resident = require('../harness-everything/scripts/system-one/resident');
9
+ const { decide } = require('../harness-everything/scripts/system-one/contract');
10
+ const { run: route } = require('../harness-everything/scripts/tier-router');
11
+
12
+ function run(corpus, manifest) {
13
+ validateCorpus(corpus);
14
+ let config = null;
15
+ try { config = readManifest(manifest); } catch (_) { /* Missing provider remains an explicit unavailable measurement. */ }
16
+ // Resident runs are measured only after readiness, so every sample is warm; one-shot samples are cold.
17
+ const warm = config?.transport === 'resident';
18
+ const wasRunning = warm && resident.status(config, manifest).running;
19
+ const ready = warm && resident.ensureReady(config, manifest, 60000);
20
+ const records = [];
21
+ const originalMode = process.env.HARNESS_SYSTEM_ONE_MODE;
22
+ const originalLog = console.log;
23
+ try {
24
+ process.env.HARNESS_SYSTEM_ONE_MODE = 'off';
25
+ console.log = () => {};
26
+ for (const c of corpus.cases.filter(item => item.split === 'holdout')) {
27
+ const tier = route(c.request.context).workflowPlan.tier;
28
+ const runs = [];
29
+ for (let i = 0; i < 2; i++) {
30
+ const start = performance.now();
31
+ const result = score(c.request, manifest);
32
+ const decision = result.status === 'scored' ? decide(c.request, result.response) : result;
33
+ if (decision.selectedId === 'unclassified') Object.assign(decision, { status: 'abstain', reason: 'unclassified', selectedId: null });
34
+ const scores = ['accepted', 'abstain'].includes(decision.status) ? result.response.scores.map(s => s.probability) : null;
35
+ runs.push({ decision, scores, latencyMs: performance.now() - start, coldStart: !warm });
36
+ }
37
+ records.push({ id: c.id, baseline: tier === 'unclassified' ? null : tier, runs });
38
+ }
39
+ } finally {
40
+ if (warm && !wasRunning) resident.stop(config, manifest);
41
+ console.log = originalLog;
42
+ if (originalMode === undefined) delete process.env.HARNESS_SYSTEM_ONE_MODE;
43
+ else process.env.HARNESS_SYSTEM_ONE_MODE = originalMode;
44
+ }
45
+ let artifact = null;
46
+ try {
47
+ const m = JSON.parse(fs.readFileSync(manifest, 'utf8'));
48
+ artifact = { declaredModelId: m.modelId, declaredRevision: m.revision, weightsSha256: m.weightsSha256, configSha256: m.configSha256 };
49
+ } catch (_) { /* Missing provider remains an explicit unavailable measurement. */ }
50
+ const source = provenance(manifest);
51
+ return { ...evaluate(corpus, records, source), evidence: { kind: warm ? 'offline-resident' : 'offline-one-shot', artifact, source,
52
+ residentReady: warm ? ready : null,
53
+ environment: { cpu: os.cpus()[0]?.model || 'unknown', os: `${os.platform()} ${os.release()} ${os.arch()}`, node: process.version,
54
+ python: source.status === 'recorded' ? source.provenance.python : null, threads: 1 },
55
+ limitations: ['No independently verified holdout review', ...(warm ? [] : ['No warm inference measurement']), 'No live-host or policy evidence'] }, records };
56
+ }
57
+ if (require.main === module) {
58
+ try {
59
+ const [input, manifest, output, extra] = process.argv.slice(2);
60
+ if (!input || !manifest || !output || extra) throw new Error('usage');
61
+ const report = run(JSON.parse(fs.readFileSync(input, 'utf8')), manifest);
62
+ fs.writeFileSync(output, JSON.stringify(report, null, 2) + '\n');
63
+ console.log(JSON.stringify({ cases: report.cases, coverage: report.model.coverage, rolloutReady: report.rolloutReady }));
64
+ } catch (_) { console.error('System One evaluation failed: invalid corpus, arguments, or output path.'); process.exitCode = 1; }
65
+ }
66
+ module.exports = { run };
@@ -0,0 +1,6 @@
1
+ 'use strict';
2
+ // Untracked local/CI build artifacts that no distribution (installer copy, plugin mirror,
3
+ // public submission) may ship, even when they exist in the working tree.
4
+ const isPackagingNoise = name => name === '__pycache__' || /\.py[co]$/.test(name);
5
+
6
+ module.exports = { isPackagingNoise };
@@ -2,11 +2,13 @@
2
2
  const fs = require('fs');
3
3
  const path = require('path');
4
4
  const manifest = require('./manifest');
5
+ const { isPackagingNoise } = require('./packaging-noise');
5
6
 
6
7
  function copyDir(src, dest) {
7
8
  fs.mkdirSync(dest, { recursive: true });
8
9
  const entries = fs.readdirSync(src, { withFileTypes: true });
9
10
  for (const entry of entries) {
11
+ if (isPackagingNoise(entry.name)) continue;
10
12
  const srcPath = path.join(src, entry.name);
11
13
  const destPath = path.join(dest, entry.name);
12
14
  if (entry.isDirectory()) copyDir(srcPath, destPath);
@@ -3,6 +3,7 @@
3
3
 
4
4
  const fs = require('fs');
5
5
  const path = require('path');
6
+ const { isPackagingNoise } = require('./lib/packaging-noise');
6
7
 
7
8
  const ROOT = path.resolve(__dirname, '..');
8
9
  const manifest = JSON.parse(fs.readFileSync(path.join(ROOT, '.claude-plugin', 'plugin.json'), 'utf8'));
@@ -32,7 +33,7 @@ function syncTree(source, destination) {
32
33
  fs.rmSync(destination, { recursive: true, force: true });
33
34
  fs.mkdirSync(path.dirname(destination), { recursive: true });
34
35
  if (fs.statSync(source).isDirectory()) {
35
- fs.cpSync(source, destination, { recursive: true });
36
+ fs.cpSync(source, destination, { recursive: true, filter: src => !isPackagingNoise(path.basename(src)) });
36
37
  normalizeTree(destination);
37
38
  } else {
38
39
  fs.copyFileSync(source, destination);