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.
Files changed (37) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/CHANGELOG.md +14 -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/ci/fixtures/system-one-provider.cjs +13 -0
  8. package/ci/mechanism-system-one-contract.test.js +48 -0
  9. package/ci/mechanism-system-one-evaluation.test.js +87 -0
  10. package/ci/mechanism-system-one-install.test.js +95 -0
  11. package/ci/mechanism-system-one-provider.test.js +63 -0
  12. package/ci/mechanism-system-one-router.test.js +101 -0
  13. package/ci/system-one-adapter-test.py +56 -0
  14. package/docs/platform-capabilities.md +11 -0
  15. package/docs/system-one-routing.md +202 -0
  16. package/harness-everything/SKILL.md +1 -1
  17. package/harness-everything/scripts/system-one/contract.js +45 -0
  18. package/harness-everything/scripts/system-one/cua_adapter.py +94 -0
  19. package/harness-everything/scripts/system-one/evaluate.js +98 -0
  20. package/harness-everything/scripts/system-one/install.js +152 -0
  21. package/harness-everything/scripts/system-one/provider.js +76 -0
  22. package/harness-everything/scripts/system-one/router.js +37 -0
  23. package/harness-everything/scripts/tier-router.js +16 -0
  24. package/opencode-plugin/plugin.json +1 -1
  25. package/package.json +2 -1
  26. package/plugins/harness-everything/.codex-plugin/plugin.json +1 -1
  27. package/plugins/harness-everything/plugin.json +1 -1
  28. package/plugins/harness-everything/skills/harness-everything/SKILL.md +1 -1
  29. package/plugins/harness-everything/skills/harness-everything/scripts/system-one/contract.js +45 -0
  30. package/plugins/harness-everything/skills/harness-everything/scripts/system-one/cua_adapter.py +94 -0
  31. package/plugins/harness-everything/skills/harness-everything/scripts/system-one/evaluate.js +98 -0
  32. package/plugins/harness-everything/skills/harness-everything/scripts/system-one/install.js +152 -0
  33. package/plugins/harness-everything/skills/harness-everything/scripts/system-one/provider.js +76 -0
  34. package/plugins/harness-everything/skills/harness-everything/scripts/system-one/router.js +37 -0
  35. package/plugins/harness-everything/skills/harness-everything/scripts/tier-router.js +16 -0
  36. package/sbom.cdx.json +7 -7
  37. package/scripts/evaluate-system-one.js +57 -0
@@ -0,0 +1,76 @@
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'].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.modelId === 'cua-ai/cua-s1-forms' && m.domain !== 'forms-v1')) throw new TypeError('invalid-manifest');
22
+ return true;
23
+ }
24
+ function readManifest(manifestPath) {
25
+ if (typeof manifestPath !== 'string' || !path.isAbsolute(manifestPath) || fs.statSync(manifestPath).size > 65536) throw new Error();
26
+ const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8'));
27
+ validateManifest(manifest);
28
+ return manifest;
29
+ }
30
+ function spawnJson(executable, args, input, timeoutMs) {
31
+ let result;
32
+ try {
33
+ result = spawnSync(executable, args, { input, encoding: 'utf8', shell: false,
34
+ timeout: timeoutMs, killSignal: 'SIGKILL', maxBuffer: 1024 * 1024, windowsHide: true });
35
+ } catch (_) { return unavailable('provider-unavailable'); }
36
+ if (result.error) return unavailable(result.error.code === 'ETIMEDOUT' ? 'provider-timeout'
37
+ : result.error.code === 'ENOBUFS' ? 'provider-output-limit' : 'provider-unavailable');
38
+ if (result.status !== 0) return unavailable('provider-exit');
39
+ try { return { status: 'ok', value: JSON.parse(result.stdout) }; }
40
+ catch (_) { return unavailable('provider-json'); }
41
+ }
42
+ function runProvider(request, executable, args, timeoutMs = 2000) {
43
+ validateRequest(request);
44
+ const result = spawnJson(executable, args, JSON.stringify(request), timeoutMs);
45
+ return result.status === 'ok' ? { status: 'scored', response: result.value } : result;
46
+ }
47
+ function score(request, manifestPath) {
48
+ validateRequest(request);
49
+ let manifest;
50
+ try { manifest = readManifest(manifestPath); } catch (_) { return unavailable('provider-config'); }
51
+ // Send the exact validated manifest to the child on stdin: no config reread race.
52
+ return runProvider({ ...request }, manifest.python, [ADAPTER, JSON.stringify(manifest)], manifest.timeoutMs || 2000);
53
+ }
54
+ // The probe reports what is installed; only a PEP 610 VCS commit counts as a source revision.
55
+ function validateProvenance(p) {
56
+ if (!exact(p, ['schemaVersion', 'python', 'cuaS1', 'torch']) || p.schemaVersion !== 1
57
+ || !exact(p.python, ['implementation', 'version']) || !label(p.python.implementation) || !label(p.python.version)
58
+ || !exact(p.cuaS1, ['distribution', 'version', 'sourceRevision'])
59
+ || ![p.cuaS1.distribution, p.cuaS1.version, p.torch].every(v => v === null || label(v))
60
+ || (p.cuaS1.sourceRevision !== null && !(typeof p.cuaS1.sourceRevision === 'string' && /^[0-9a-f]{40}$/.test(p.cuaS1.sourceRevision)))) {
61
+ throw new TypeError('invalid-provenance');
62
+ }
63
+ const revision = p.cuaS1.sourceRevision;
64
+ return { python: { ...p.python }, torch: p.torch, cuaS1: { ...p.cuaS1, pinnedRevision: PINNED_CUA_S1_REVISION,
65
+ sourceRevisionStatus: revision === null ? 'unavailable' : revision === PINNED_CUA_S1_REVISION ? 'pinned' : 'mismatch' } };
66
+ }
67
+ function provenance(manifestPath) {
68
+ let manifest;
69
+ try { manifest = readManifest(manifestPath); } catch (_) { return unavailable('provider-config'); }
70
+ // Metadata scans can exceed the per-score budget; use the manifest cap. No model is loaded.
71
+ const result = spawnJson(manifest.python, [ADAPTER, '--provenance'], '', 10000);
72
+ if (result.status !== 'ok') return result;
73
+ try { return { status: 'recorded', provenance: validateProvenance(result.value) }; }
74
+ catch (_) { return unavailable('provider-json'); }
75
+ }
76
+ module.exports = { score, runProvider, validateManifest, provenance, validateProvenance, PINNED_CUA_S1_REVISION };
@@ -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'];
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:8d95a5fe-dcbc-5aa9-8dc9-f8d6eae221da",
6
6
  "version": 1,
7
7
  "metadata": {
8
- "timestamp": "2026-09-22T16:17:00.105Z",
8
+ "timestamp": "2026-09-23T03:35:45.203Z",
9
9
  "tools": [
10
10
  {
11
11
  "vendor": "Harness Everything",
12
12
  "name": "generate-sbom.js",
13
- "version": "0.20.7"
13
+ "version": "0.21.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.21.0",
19
19
  "name": "harness-everything",
20
- "version": "0.20.7",
21
- "purl": "pkg:npm/harness-everything@0.20.7"
20
+ "version": "0.21.0",
21
+ "purl": "pkg:npm/harness-everything@0.21.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.21.0",
2003
2003
  "dependsOn": [
2004
2004
  "pkg:npm/%40commitlint/cli@19.8.1",
2005
2005
  "pkg:npm/%40commitlint/config-conventional@19.8.1",
@@ -0,0 +1,57 @@
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 } = require('../harness-everything/scripts/system-one/provider');
8
+ const { decide } = require('../harness-everything/scripts/system-one/contract');
9
+ const { run: route } = require('../harness-everything/scripts/tier-router');
10
+
11
+ function run(corpus, manifest) {
12
+ validateCorpus(corpus);
13
+ const records = [];
14
+ const originalMode = process.env.HARNESS_SYSTEM_ONE_MODE;
15
+ const originalLog = console.log;
16
+ try {
17
+ process.env.HARNESS_SYSTEM_ONE_MODE = 'off';
18
+ console.log = () => {};
19
+ for (const c of corpus.cases.filter(item => item.split === 'holdout')) {
20
+ const tier = route(c.request.context).workflowPlan.tier;
21
+ const runs = [];
22
+ for (let i = 0; i < 2; i++) {
23
+ const start = performance.now();
24
+ const result = score(c.request, manifest);
25
+ const decision = result.status === 'scored' ? decide(c.request, result.response) : result;
26
+ if (decision.selectedId === 'unclassified') Object.assign(decision, { status: 'abstain', reason: 'unclassified', selectedId: null });
27
+ const scores = ['accepted', 'abstain'].includes(decision.status) ? result.response.scores.map(s => s.probability) : null;
28
+ runs.push({ decision, scores, latencyMs: performance.now() - start, coldStart: true });
29
+ }
30
+ records.push({ id: c.id, baseline: tier === 'unclassified' ? null : tier, runs });
31
+ }
32
+ } finally {
33
+ console.log = originalLog;
34
+ if (originalMode === undefined) delete process.env.HARNESS_SYSTEM_ONE_MODE;
35
+ else process.env.HARNESS_SYSTEM_ONE_MODE = originalMode;
36
+ }
37
+ let artifact = null;
38
+ try {
39
+ const m = JSON.parse(fs.readFileSync(manifest, 'utf8'));
40
+ artifact = { declaredModelId: m.modelId, declaredRevision: m.revision, weightsSha256: m.weightsSha256, configSha256: m.configSha256 };
41
+ } catch (_) { /* Missing provider remains an explicit unavailable measurement. */ }
42
+ const source = provenance(manifest);
43
+ return { ...evaluate(corpus, records, source), evidence: { kind: 'offline-one-shot', artifact, source,
44
+ environment: { cpu: os.cpus()[0]?.model || 'unknown', os: `${os.platform()} ${os.release()} ${os.arch()}`, node: process.version,
45
+ python: source.status === 'recorded' ? source.provenance.python : null, threads: 1 },
46
+ limitations: ['No independently verified holdout review', 'No warm inference measurement', 'No live-host or policy evidence'] }, records };
47
+ }
48
+ if (require.main === module) {
49
+ try {
50
+ const [input, manifest, output, extra] = process.argv.slice(2);
51
+ if (!input || !manifest || !output || extra) throw new Error('usage');
52
+ const report = run(JSON.parse(fs.readFileSync(input, 'utf8')), manifest);
53
+ fs.writeFileSync(output, JSON.stringify(report, null, 2) + '\n');
54
+ console.log(JSON.stringify({ cases: report.cases, coverage: report.model.coverage, rolloutReady: report.rolloutReady }));
55
+ } catch (_) { console.error('System One evaluation failed: invalid corpus, arguments, or output path.'); process.exitCode = 1; }
56
+ }
57
+ module.exports = { run };