harness-everything 0.51.0 → 0.53.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 (97) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/.github/workflows/ci.yml +23 -0
  4. package/CHANGELOG.md +54 -0
  5. package/benchmarks/results/doc-evidence-e1/cycle-2026-11-11-a-evid-001.md +123 -0
  6. package/benchmarks/results/doc-evidence-e1/cycle-2026-11-11-b-route-001.md +130 -0
  7. package/benchmarks/results/live-host/opencode-2026-11-15-workspace/README.md +7 -0
  8. package/benchmarks/results/live-host/opencode-2026-11-15-workspace/live-workspace-probe.js +16 -0
  9. package/benchmarks/results/live-host/opencode-2026-11-15-workspace/live-workspace-trace-2026-11-15.jsonl +4 -0
  10. package/ci/mechanism-2am-observations-session-import.test.js +4 -1
  11. package/ci/mechanism-2n-opencode-plugin.test.js +1 -1
  12. package/ci/mechanism-2p-opencode-v2-entrypoint.test.js +18 -3
  13. package/ci/mechanism-338-opencode-async.test.js +20 -3
  14. package/ci/mechanism-34-observations.test.js +127 -23
  15. package/ci/mechanism-341-opencode-lane.test.js +7 -1
  16. package/ci/mechanism-349-ci-change-scope.test.js +260 -0
  17. package/ci/mechanism-397-cycle-import.test.js +399 -0
  18. package/ci/mechanism-397-host-acceptance.test.js +119 -0
  19. package/ci/mechanism-397-opencode-observations.test.js +1922 -0
  20. package/ci/mechanism-handoff-file.test.js +121 -0
  21. package/ci/mechanism-system-one-contract.test.js +9 -2
  22. package/ci/mechanism-system-one-curves.test.js +223 -0
  23. package/ci/mechanism-system-one-cycle.test.js +1204 -0
  24. package/ci/mechanism-system-one-evaluation.test.js +32 -5
  25. package/ci/mechanism-system-one-handoff-input.test.js +208 -0
  26. package/ci/mechanism-system-one-install.test.js +202 -77
  27. package/ci/mechanism-system-one-live.test.js +361 -0
  28. package/ci/mechanism-system-one-relevance.test.js +11 -1
  29. package/ci/mechanism-system-one-train.test.js +136 -53
  30. package/ci/system-one-adapter-test.py +331 -0
  31. package/ci/system-one-train-test.py +116 -24
  32. package/docs/adr/EVID-001.md +123 -0
  33. package/docs/adr/ROUTE-001-error-lesson-delivery.md +305 -0
  34. package/docs/governed-index.md +2 -0
  35. package/docs/platform-capabilities.md +13 -6
  36. package/docs/routing.md +2 -2
  37. package/docs/system-one-cycle.md +77 -0
  38. package/docs/system-one-observations.md +43 -11
  39. package/docs/system-one-routing.md +163 -115
  40. package/docs/system-one-suggestion-gates.md +6 -8
  41. package/docs/system-one-training.md +44 -7
  42. package/docs/workflow-runtime.md +19 -0
  43. package/harness-everything/SKILL.md +1 -1
  44. package/harness-everything/scripts/kernel-router.js +2 -1
  45. package/harness-everything/scripts/system-one/contract.js +19 -15
  46. package/harness-everything/scripts/system-one/cua_adapter.py +211 -17
  47. package/harness-everything/scripts/system-one/evaluate.js +4 -9
  48. package/harness-everything/scripts/system-one/handoff-input.js +76 -0
  49. package/harness-everything/scripts/system-one/install.js +281 -113
  50. package/harness-everything/scripts/system-one/manifest.js +58 -0
  51. package/harness-everything/scripts/system-one/provider.js +96 -2
  52. package/harness-everything/scripts/system-one/resident.js +47 -1
  53. package/harness-everything/scripts/system-one/router.js +80 -1
  54. package/harness-everything/scripts/tier-router.js +21 -6
  55. package/hooks/scripts/lib/observations.js +48 -7
  56. package/opencode-plugin/README.md +22 -8
  57. package/opencode-plugin/index.mjs +424 -44
  58. package/opencode-plugin/plugin.json +1 -1
  59. package/package.json +1 -1
  60. package/plugins/harness-everything/.codex-plugin/plugin.json +1 -1
  61. package/plugins/harness-everything/hooks/scripts/lib/observations.js +48 -7
  62. package/plugins/harness-everything/plugin.json +1 -1
  63. package/plugins/harness-everything/scripts/handoff-file.js +223 -0
  64. package/plugins/harness-everything/skills/harness-everything/SKILL.md +1 -1
  65. package/plugins/harness-everything/skills/harness-everything/scripts/kernel-router.js +2 -1
  66. package/plugins/harness-everything/skills/harness-everything/scripts/system-one/contract.js +19 -15
  67. package/plugins/harness-everything/skills/harness-everything/scripts/system-one/cua_adapter.py +211 -17
  68. package/plugins/harness-everything/skills/harness-everything/scripts/system-one/evaluate.js +4 -9
  69. package/plugins/harness-everything/skills/harness-everything/scripts/system-one/handoff-input.js +76 -0
  70. package/plugins/harness-everything/skills/harness-everything/scripts/system-one/install.js +281 -113
  71. package/plugins/harness-everything/skills/harness-everything/scripts/system-one/manifest.js +58 -0
  72. package/plugins/harness-everything/skills/harness-everything/scripts/system-one/provider.js +96 -2
  73. package/plugins/harness-everything/skills/harness-everything/scripts/system-one/resident.js +47 -1
  74. package/plugins/harness-everything/skills/harness-everything/scripts/system-one/router.js +80 -1
  75. package/plugins/harness-everything/skills/harness-everything/scripts/tier-router.js +21 -6
  76. package/sbom.cdx.json +7 -7
  77. package/scripts/ci-change-scope.js +59 -0
  78. package/scripts/handoff-file.js +223 -0
  79. package/scripts/sync-openai-plugin.js +4 -0
  80. package/scripts/system-one-calibrate.js +108 -41
  81. package/scripts/system-one-curves.js +472 -0
  82. package/scripts/system-one-cycle/adjudication-input.js +65 -0
  83. package/scripts/system-one-cycle/build.js +165 -0
  84. package/scripts/system-one-cycle/collect.js +67 -0
  85. package/scripts/system-one-cycle/common.js +175 -0
  86. package/scripts/system-one-cycle/engines.js +62 -0
  87. package/scripts/system-one-cycle/evaluate.js +73 -0
  88. package/scripts/system-one-cycle/judge.js +106 -0
  89. package/scripts/system-one-cycle/label.js +59 -0
  90. package/scripts/system-one-cycle/package.js +173 -0
  91. package/scripts/system-one-cycle/score.py +111 -0
  92. package/scripts/system-one-cycle/train.js +136 -0
  93. package/scripts/system-one-cycle.js +136 -0
  94. package/scripts/system-one-observations-export.js +58 -6
  95. package/scripts/system-one-observations-import-store.js +128 -0
  96. package/scripts/system-one-observations-review.js +4 -5
  97. package/scripts/system-one-train.py +117 -61
@@ -21,7 +21,7 @@ test('S1-E01 exact paired metrics, no promotion from fixtures or cold timing', (
21
21
  assert.equal(result.model.acceptedPrecision, 1); assert.equal(result.model.acceptedErrorRate, 0);
22
22
  assert.equal(result.model.macroF1, 0.5); assert.equal(result.baseline.accuracy, 0);
23
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);
24
+ assert.equal(Object.hasOwn(result, 'rolloutReady'), false); assert.equal(result.gates.reviewedHoldout, false);
25
25
  assert.equal(result.gates.policyEvidence, false); assert.equal(result.gates.liveHostEvidence, false);
26
26
  assert.deepEqual(evaluate(make(), records()), evaluate(make(), records()));
27
27
  });
@@ -31,10 +31,37 @@ test('S1-E02 corpus completeness, family leakage and no duplicated prompts', ()
31
31
  });
32
32
  test('S1-E03 missing/extra/invalid predictions cannot silently improve scores', () => {
33
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)); }
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 = [1.1, 0, 0, 0]; }, r => { r[0].runs[0].scores = [-0.1, 1.1, 0, 0]; }, 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
35
  const r = records(); r[0].runs[1].decision = decision('tier3'); r[0].runs[1].scores = oneHot('tier3');
36
36
  assert.equal(evaluate(make(), r).agreement, 0.5);
37
37
  });
38
+ test('S1-E10 sigmoid scores and holdout gates are reported without a rollout blocker', () => {
39
+ const r = records();
40
+ const accepted = { ...decision('tier1'), confidence: 0.9, margin: 0.9 - 0.8 };
41
+ for (const run of r[0].runs) { run.decision = accepted; run.scores = [0.9, 0.8, 0.4, 0.1]; }
42
+ const report = evaluate(make(), r);
43
+ assert.equal(report.model.coverage, 0.5);
44
+ assert.equal(report.baseline.accuracy, 0);
45
+ assert.equal(report.gates.reviewedHoldout, false);
46
+ assert.equal(Object.hasOwn(report, 'rolloutReady'), false);
47
+ });
48
+
49
+ test('F1 evaluator keeps single-winner vectors and independent relevance vectors distinct', () => {
50
+ const { gradeRelevance } = require('../harness-everything/scripts/system-one/evaluate');
51
+ const { INTENT_OPTIONS } = require('../harness-everything/scripts/system-one/catalogs');
52
+ assert.equal(evaluate(make(), records()).model.acceptedPrecision, 1);
53
+
54
+ const labels = [...INTENT_OPTIONS.map(option => option.id).filter(id => id !== 'unclassified'), null];
55
+ const ids = labels.map(id => id === null ? 'unclassified' : id);
56
+ const caseRow = { id: 'r', gold: 'fix', secondary: ['test'] };
57
+ const scores = ids.map(id => ({ fix: 0.9, test: 0.8 })[id] || 0.1);
58
+ assert.ok(scores.reduce((sum, score) => sum + score, 0) > 1);
59
+ const thresholds = Object.fromEntries(ids.filter(id => id !== 'unclassified').map(id => [id, 0.4]));
60
+ const report = gradeRelevance([caseRow], new Map([['r', { scores }]]), labels, thresholds);
61
+ assert.equal(report.cardinality.predicted, 2);
62
+ assert.equal(report.perIntent.fix.tp, 1);
63
+ assert.equal(report.perIntent.test.tp, 1);
64
+ });
38
65
  test('S1-E06 repeatability compares the full score vector, not only top-2 summaries', () => {
39
66
  const r = records();
40
67
  const accepted = { status: 'accepted', reason: 'scored', selectedId: 'tier1', confidence: 0.9, margin: 0.85, model: { id: 'fixture', revision: 'v1', domain: 'harness-routing-v1' } };
@@ -50,7 +77,7 @@ test('S1-E06 repeatability compares the full score vector, not only top-2 summar
50
77
  test('S1-E04 zero coverage and wrong accepted predictions fail quality gates', () => {
51
78
  const r = records(); r.forEach(x => x.runs.forEach(v => { v.decision = { status: 'unavailable', reason: 'provider-config' }; v.scores = null; }));
52
79
  const report = evaluate(make(), r);
53
- assert.equal(report.model.coverage, 0); assert.equal(report.model.acceptedPrecision, null); assert.equal(report.rolloutReady, false);
80
+ assert.equal(report.model.coverage, 0); assert.equal(report.model.acceptedPrecision, null); assert.equal(Object.hasOwn(report, 'rolloutReady'), false);
54
81
  const wrong = records(); wrong.forEach(x => x.runs.forEach(v => { v.decision = decision('tier3'); v.scores = oneHot('tier3'); }));
55
82
  assert.equal(evaluate(make(), wrong).model.acceptedErrorRate, 1);
56
83
  });
@@ -64,7 +91,7 @@ test('S1-E05 real evaluation CLI repeats with only documented timing volatility'
64
91
  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
92
  assert.equal(child.status, 0, child.stderr);
66
93
  const report = JSON.parse(fs.readFileSync(output, 'utf8'));
67
- assert.equal(report.model.coverage, 0); assert.equal(report.rolloutReady, false);
94
+ assert.equal(report.model.coverage, 0); assert.equal(Object.hasOwn(report, 'rolloutReady'), false);
68
95
  assert.equal(report.records[0].runs[0].decision.reason, 'provider-config');
69
96
  assert.equal(report.records[0].runs[0].scores, null);
70
97
  assert.deepEqual(report.evidence.source, { status: 'unavailable', reason: 'provider-config' });
@@ -83,7 +110,7 @@ test('S1-E07 source provenance gate requires the pinned cua_s1 revision', () =>
83
110
  assert.equal(evaluate(make(), records(), { status: 'unavailable', reason: 'provider-exit' }).gates.sourceProvenance, false);
84
111
  for (const status of ['unavailable', 'mismatch']) assert.equal(evaluate(make(), records(), recorded(status)).gates.sourceProvenance, false);
85
112
  assert.equal(evaluate(make(), records(), recorded('pinned')).gates.sourceProvenance, true);
86
- assert.equal(evaluate(make(), records(), recorded('pinned')).rolloutReady, false);
113
+ assert.equal(Object.hasOwn(evaluate(make(), records(), recorded('pinned')), 'rolloutReady'), false);
87
114
  });
88
115
  test('S1-E09 an ngram source passes provenance only with a verified artifact', () => {
89
116
  const ngramSource = verified => ({ status: 'recorded', transport: 'ngram', artifactVerified: verified });
@@ -0,0 +1,208 @@
1
+ 'use strict';
2
+ const assert = require('node:assert/strict');
3
+ const { execFileSync } = require('node:child_process');
4
+ const fs = require('node:fs');
5
+ const os = require('node:os');
6
+ const path = require('node:path');
7
+ const { performance } = require('node:perf_hooks');
8
+ const test = require('node:test');
9
+ const router = require('../harness-everything/scripts/system-one/router');
10
+
11
+ const HANDOFF_WRITER = path.resolve(__dirname, '../scripts/handoff-file.js');
12
+ const LIVE_ENV = { HARNESS_SYSTEM_ONE_MODE: 'live' };
13
+ const BODY_SENTINEL = 'BODY_SENTINEL_H1B';
14
+
15
+ function tempRoot() {
16
+ const root = fs.mkdtempSync(path.join(os.tmpdir(), 'system-one-handoff-'));
17
+ return { root, cwd: path.join(root, 'cwd') };
18
+ }
19
+
20
+ function createHandoff(directory, name, title = 'handoff-title', summary = 'handoff-summary') {
21
+ const file = path.join(directory, name);
22
+ fs.mkdirSync(path.dirname(file), { recursive: true });
23
+ execFileSync(process.execPath, [HANDOFF_WRITER, 'new', '--kind', 'implement', '--title', title,
24
+ '--summary', summary, '--out', file], { stdio: 'ignore' });
25
+ fs.appendFileSync(file, `\n${BODY_SENTINEL}`);
26
+ return file;
27
+ }
28
+
29
+ function scoredResult() {
30
+ return {
31
+ version: 'v1',
32
+ sha256: '0123456789abcdef',
33
+ stageScores: { validity: { invalid: 0.9 }, intent: null, tier: null },
34
+ thresholds: { validity: { invalid: 0.55 }, intent: {}, tier: {} },
35
+ };
36
+ }
37
+
38
+ async function scoreWith(targetRouter, prompt, cwd) {
39
+ let scoredInput;
40
+ const result = await targetRouter.prescoreLive(prompt, LIVE_ENV,
41
+ input => { scoredInput = input; return scoredResult(); }, cwd);
42
+ return { result, scoredInput };
43
+ }
44
+
45
+ test('the first live lookup handles three referenced files within the latency bound', async t => {
46
+ const { root, cwd } = tempRoot();
47
+ try {
48
+ const files = ['one.md', 'two.md', 'three.md'].map((name, index) =>
49
+ createHandoff(cwd, name, `title-${index + 1}`, `summary-${index + 1}`));
50
+ const prompt = `Review ${files.map(file => path.relative(cwd, file)).join(' ')}.`;
51
+ const started = performance.now();
52
+ const { result, scoredInput } = await scoreWith(router, prompt, cwd);
53
+ const elapsed = performance.now() - started;
54
+ assert.ok(elapsed < 100, 'three-file first-call enrichment exceeded the generous 100 ms test bound');
55
+ assert.ok(result?.inputEnrichment?.handoffFiles === 3, 'three valid headers should be counted');
56
+ assert.ok(files.every((_, index) => scoredInput.includes(`[handoff] kind=implement title=title-${index + 1} summary=summary-${index + 1}`)),
57
+ 'all three headers should contribute metadata lines');
58
+ assert.ok(!scoredInput.includes(BODY_SENTINEL), 'file bodies must not reach the scorer');
59
+ t.diagnostic(`three-file first-call enrichment: ${elapsed.toFixed(2)} ms`);
60
+ } finally {
61
+ fs.rmSync(root, { recursive: true, force: true });
62
+ }
63
+ });
64
+
65
+ test('valid headers enrich only the live scorer input and record the count in the workflow plan', async () => {
66
+ const { root, cwd } = tempRoot();
67
+ const prior = { mode: process.env.HARNESS_SYSTEM_ONE_MODE, contract: process.env.HARNESS_ROUTER_CONTRACT_PATH };
68
+ const log = console.log;
69
+ try {
70
+ const file = createHandoff(cwd, 'handoff.md', 'task-title', 'edit every file in the entire repository');
71
+ const prompt = `Please inspect ${path.relative(cwd, file)}.`;
72
+ const { result, scoredInput } = await scoreWith(router, prompt, cwd);
73
+ const summary = 'edit every file in the entire repository';
74
+ assert.ok(scoredInput === `${prompt}\n[handoff] kind=implement title=task-title summary=${summary}`,
75
+ 'the scorer should receive the original prompt followed by one header line');
76
+ assert.ok(result?.inputEnrichment?.handoffFiles === 1, 'one added header should be recorded');
77
+ assert.ok(!JSON.stringify(result).includes(BODY_SENTINEL), 'the score result must not contain file body text');
78
+
79
+ process.env.HARNESS_SYSTEM_ONE_MODE = 'live';
80
+ process.env.HARNESS_ROUTER_CONTRACT_PATH = path.join(root, 'router-contract.json');
81
+ const lines = [];
82
+ console.log = value => lines.push(String(value));
83
+ const contract = require('../harness-everything/scripts/tier-router').run(prompt, { cwd }, { systemOneResult: result });
84
+ const stored = JSON.parse(fs.readFileSync(process.env.HARNESS_ROUTER_CONTRACT_PATH, 'utf8'));
85
+ assert.ok(contract.workflowPlan.systemOne.inputEnrichment.handoffFiles === 1, 'the workflow plan should record the header count');
86
+ assert.ok(stored.workflowPlan.systemOne.inputEnrichment.handoffFiles === 1, 'the stored plan should record the same count');
87
+ assert.ok(lines.some(line => line.includes('=> RECOMMENDED TIER: Unclassified')),
88
+ 'the lexical router should classify the original prompt without the header summary');
89
+ assert.ok(!JSON.stringify(stored).includes(summary), 'the stored router contract should contain only the header count');
90
+ assert.ok(!JSON.stringify(stored).includes(BODY_SENTINEL), 'the stored plan must not contain file body text');
91
+ } finally {
92
+ console.log = log;
93
+ if (prior.mode === undefined) delete process.env.HARNESS_SYSTEM_ONE_MODE;
94
+ else process.env.HARNESS_SYSTEM_ONE_MODE = prior.mode;
95
+ if (prior.contract === undefined) delete process.env.HARNESS_ROUTER_CONTRACT_PATH;
96
+ else process.env.HARNESS_ROUTER_CONTRACT_PATH = prior.contract;
97
+ fs.rmSync(root, { recursive: true, force: true });
98
+ }
99
+ });
100
+
101
+ test('missing and invalid headers add nothing', async () => {
102
+ const { root, cwd } = tempRoot();
103
+ try {
104
+ fs.mkdirSync(cwd, { recursive: true });
105
+ const absent = path.join(cwd, 'plain.md');
106
+ fs.writeFileSync(absent, 'ordinary file body');
107
+ const invalid = path.join(cwd, 'invalid.md');
108
+ fs.writeFileSync(invalid, '---\nharness-handoff: 1\nkind: unknown\ntitle: title\nsummary: summary\n---\nbody');
109
+ const prompt = `Read ${path.relative(cwd, absent)} and ${path.relative(cwd, invalid)}`;
110
+ const { result, scoredInput } = await scoreWith(router, prompt, cwd);
111
+ assert.ok(scoredInput === prompt, 'files without a valid header must leave scorer input unchanged');
112
+ assert.ok(result?.inputEnrichment?.handoffFiles === 0, 'invalid or absent headers should count as zero');
113
+ } finally {
114
+ fs.rmSync(root, { recursive: true, force: true });
115
+ }
116
+ });
117
+
118
+ test('files over one MiB and headers beyond the reader limit are ignored', async () => {
119
+ const { root, cwd } = tempRoot();
120
+ try {
121
+ fs.mkdirSync(cwd, { recursive: true });
122
+ const oversized = path.join(cwd, 'oversized.md');
123
+ fs.writeFileSync(oversized, Buffer.alloc(1024 * 1024 + 1));
124
+ const oversizedHeader = path.join(cwd, 'oversized-header.md');
125
+ fs.writeFileSync(oversizedHeader, `---\n${'x'.repeat(2100)}\n---\nbody`);
126
+ const prompt = `Read ${path.relative(cwd, oversized)} and ${path.relative(cwd, oversizedHeader)}`;
127
+ const { result, scoredInput } = await scoreWith(router, prompt, cwd);
128
+ assert.ok(scoredInput === prompt, 'oversized files or headers must add no text');
129
+ assert.ok(result?.inputEnrichment?.handoffFiles === 0, 'oversized inputs should count as zero');
130
+ } finally {
131
+ fs.rmSync(root, { recursive: true, force: true });
132
+ }
133
+ });
134
+
135
+ test('relative traversal is rejected while an explicitly written absolute path is allowed', async () => {
136
+ const { root, cwd } = tempRoot();
137
+ try {
138
+ const file = createHandoff(root, 'outside.md', 'outside-title', 'outside-summary');
139
+ fs.mkdirSync(cwd, { recursive: true });
140
+ const relativePrompt = 'Read ../outside.md';
141
+ const denied = await scoreWith(router, relativePrompt, cwd);
142
+ assert.ok(denied.scoredInput === relativePrompt, 'relative traversal outside the session cwd must be ignored');
143
+ assert.ok(denied.result?.inputEnrichment?.handoffFiles === 0, 'rejected traversal must not be counted');
144
+
145
+ const symlink = path.join(cwd, 'link.md');
146
+ let symlinkCreated = false;
147
+ try { fs.symlinkSync(file, symlink); symlinkCreated = true; } catch (_) {}
148
+ if (symlinkCreated) {
149
+ const symlinkPrompt = 'Read link.md';
150
+ const symlinkResult = await scoreWith(router, symlinkPrompt, cwd);
151
+ assert.ok(symlinkResult.scoredInput === symlinkPrompt, 'a relative symlink must not expose a file outside the session cwd');
152
+ assert.ok(symlinkResult.result?.inputEnrichment?.handoffFiles === 0, 'a rejected symlink must not be counted');
153
+ }
154
+
155
+ const absolutePrompt = `Read ${file}`;
156
+ const allowed = await scoreWith(router, absolutePrompt, cwd);
157
+ assert.ok(allowed.scoredInput === `${absolutePrompt}\n[handoff] kind=implement title=outside-title summary=outside-summary`,
158
+ 'an explicit absolute path may refer outside the session cwd');
159
+ assert.ok(allowed.result?.inputEnrichment?.handoffFiles === 1, 'the absolute hand-off should be counted');
160
+ } finally {
161
+ fs.rmSync(root, { recursive: true, force: true });
162
+ }
163
+ });
164
+
165
+ test('only the first three path candidates are considered', async () => {
166
+ const { root, cwd } = tempRoot();
167
+ try {
168
+ const files = ['one.md', 'two.md', 'three.md', 'four.md'].map((name, index) =>
169
+ createHandoff(cwd, name, `title-${index + 1}`, `summary-${index + 1}`));
170
+ const prompt = `Read ${files.map(file => path.relative(cwd, file)).join(' ')}.`;
171
+ const { result, scoredInput } = await scoreWith(router, prompt, cwd);
172
+ assert.ok(result?.inputEnrichment?.handoffFiles === 3, 'the fourth path must not be read');
173
+ assert.ok(scoredInput.includes('title-1') && scoredInput.includes('title-2') && scoredInput.includes('title-3'),
174
+ 'the first three hand-offs should be included');
175
+ assert.ok(!scoredInput.includes('title-4'), 'the fourth hand-off should be ignored');
176
+ } finally {
177
+ fs.rmSync(root, { recursive: true, force: true });
178
+ }
179
+ });
180
+
181
+ test('mode off never calls the scorer or enriches its input', async () => {
182
+ const { root, cwd } = tempRoot();
183
+ try {
184
+ const file = createHandoff(cwd, 'handoff.md');
185
+ let called = false;
186
+ const result = await router.prescoreLive(`Read ${path.relative(cwd, file)}`,
187
+ { HARNESS_SYSTEM_ONE_MODE: 'off' }, () => { called = true; return scoredResult(); }, cwd);
188
+ assert.ok(result === null, 'off mode should keep the historical no-result behavior');
189
+ assert.ok(!called, 'off mode must not call the scorer');
190
+ } finally {
191
+ fs.rmSync(root, { recursive: true, force: true });
192
+ }
193
+ });
194
+
195
+ test('the packaged router uses its packaged hand-off reader', async () => {
196
+ const { root, cwd } = tempRoot();
197
+ try {
198
+ const file = createHandoff(cwd, 'packaged.md', 'package-title', 'package-summary');
199
+ const packagedRouter = require('../plugins/harness-everything/skills/harness-everything/scripts/system-one/router');
200
+ const { result, scoredInput } = await scoreWith(packagedRouter, `Read ${path.relative(cwd, file)}`, cwd);
201
+ assert.ok(result?.inputEnrichment?.handoffFiles === 1, 'the packaged router should use the hand-off reader');
202
+ assert.ok(scoredInput.includes('[handoff] kind=implement title=package-title summary=package-summary'),
203
+ 'the packaged router should add the parsed header');
204
+ assert.ok(!scoredInput.includes(BODY_SENTINEL), 'the packaged router must not read file bodies');
205
+ } finally {
206
+ fs.rmSync(root, { recursive: true, force: true });
207
+ }
208
+ });
@@ -7,100 +7,225 @@ const path = require('node:path');
7
7
  const { createHash } = require('node:crypto');
8
8
  const { spawnSync } = require('node:child_process');
9
9
  const install = require('../harness-everything/scripts/system-one/install');
10
- const { validateManifest, PINNED_CUA_S1_REVISION } = require('../harness-everything/scripts/system-one/provider');
10
+ const { PINNED_CUA_S1_REVISION } = require('../harness-everything/scripts/system-one/provider');
11
11
  const script = path.join(__dirname, '../harness-everything/scripts/system-one/install.js');
12
12
  const sha = buf => createHash('sha256').update(buf).digest('hex');
13
+ const stages = ['validity', 'intent', 'tier'];
13
14
 
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}`);
15
+ function tempDir(prefix) {
16
+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), prefix));
17
+ return fs.realpathSync.native(dir);
18
+ }
19
+
20
+ function makeRepo(root, version = 'v1') {
21
+ const checkpoint = path.join(root, 'models', 'cua-s1', version);
22
+ fs.mkdirSync(checkpoint, { recursive: true });
23
+ const manifest = { schemaVersion: 1, version, createdAt: '2026-11-14T00:00:00.000Z', stages: {}, evaluation: 'evaluation.json' };
24
+ for (const stage of stages) {
25
+ const weights = Buffer.from(`${stage}-weights`);
26
+ const config = Buffer.from(JSON.stringify({ stage, format: 'fixture' }));
27
+ fs.writeFileSync(path.join(checkpoint, `${stage}.weights`), weights);
28
+ fs.writeFileSync(path.join(checkpoint, `${stage}.json`), config);
29
+ manifest.stages[stage] = {
30
+ weights: `${stage}.weights`, config: `${stage}.json`, sha256: sha(weights),
31
+ options: [`${stage}-a`, `${stage}-b`], thresholds: { [`${stage}-a`]: 0.5, [`${stage}-b`]: 0.6 },
32
+ };
33
+ }
34
+ fs.writeFileSync(path.join(checkpoint, manifest.evaluation), JSON.stringify({ samples: 2 }));
35
+ fs.writeFileSync(path.join(checkpoint, 'manifest.json'), `${JSON.stringify(manifest, null, 2)}\n`);
36
+ return checkpoint;
37
+ }
38
+
39
+ function withHome(home, fn) {
40
+ const previous = process.env.HARNESS_SYSTEM_ONE_HOME;
41
+ process.env.HARNESS_SYSTEM_ONE_HOME = home;
42
+ try { return fn(); }
43
+ finally {
44
+ if (previous === undefined) delete process.env.HARNESS_SYSTEM_ONE_HOME;
45
+ else process.env.HARNESS_SYSTEM_ONE_HOME = previous;
23
46
  }
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
- assert.equal(manifest.transport, 'resident'); assert.equal(manifest.idleTimeoutMs, 1800000);
47
+ }
48
+
49
+ function remove(...dirs) { for (const dir of dirs) fs.rmSync(dir, { recursive: true, force: true }); }
50
+
51
+ test('S1-I01 local install copies the manifest-shaped checkpoint without activating it', () => {
52
+ const root = tempDir('harness-s1-repo-'); const home = tempDir('harness-s1-home-');
53
+ try {
54
+ const source = makeRepo(root);
55
+ withHome(home, () => {
56
+ const result = install.installVersion(root, 'v1');
57
+ const target = path.join(home, 'versions', 'v1');
58
+ assert.equal(result.dir, target);
59
+ assert.deepEqual(fs.readdirSync(target).sort(), [
60
+ 'evaluation.json', 'intent.json', 'intent.weights', 'manifest.json',
61
+ 'tier.json', 'tier.weights', 'validity.json', 'validity.weights',
62
+ ]);
63
+ assert.equal(fs.readFileSync(path.join(target, 'manifest.json'), 'utf8'), fs.readFileSync(path.join(source, 'manifest.json'), 'utf8'));
64
+ assert.equal(fs.existsSync(path.join(home, 'active.json')), false);
65
+ });
66
+ } finally { remove(root, home); }
32
67
  });
33
68
 
34
- test('S1-I02 interpreter selection accepts only the upstream-supported Python range', () => {
35
- for (const v of ['3.11.0', '3.12.4', '3.13.6']) assert.equal(install.supportedPython(v), true);
36
- for (const v of ['3.10.9', '3.14.0', '2.7.18', '3.13', '', 'x', null]) assert.equal(install.supportedPython(v), false);
37
- const win = install.pythonCandidates('win32');
38
- assert.deepEqual(win[0], ['py', '-3.13']);
39
- assert.ok(win.every(c => !c.includes('-3.14')));
40
- assert.deepEqual(install.pythonCandidates('linux')[0], ['python3.13']);
41
- assert.equal(install.venvPython('/x', 'win32'), path.join('/x', 'venv', 'Scripts', 'python.exe'));
42
- assert.equal(install.venvPython('/x', 'linux'), path.join('/x', 'venv', 'bin', 'python'));
69
+ test('S1-I02 install rejects a tampered stage hash before copying any version', () => {
70
+ const root = tempDir('harness-s1-repo-'); const home = tempDir('harness-s1-home-');
71
+ try {
72
+ const source = makeRepo(root);
73
+ fs.writeFileSync(path.join(source, 'intent.weights'), 'tampered');
74
+ withHome(home, () => assert.throws(() => install.installVersion(root, 'v1'), /hash|verification/i));
75
+ assert.equal(fs.existsSync(path.join(home, 'versions', 'v1')), false);
76
+ assert.equal(fs.existsSync(path.join(home, 'active.json')), false);
77
+ } finally { remove(root, home); }
43
78
  });
44
79
 
45
- test('S1-I03 argument parsing is explicit and rejects ambiguous input', () => {
46
- const home = install.parseArgs([]);
47
- assert.equal(home.dir, path.join(os.homedir(), '.agents', 'harness-everything', 'system-one'));
48
- assert.equal(home.python, null); assert.equal(home.dryRun, false);
49
- const dir = path.resolve(os.tmpdir(), 's1');
50
- assert.deepEqual(install.parseArgs(['--dir', dir, '--python', 'py', '--dry-run']), { dir, python: 'py', dryRun: true });
51
- for (const argv of [['--dir', 'relative'], ['--dir'], ['--python'], ['--unknown'], ['extra'], ['--dry-run', '--dry-run']]) {
52
- assert.throws(() => install.parseArgs(argv), { message: 'usage' });
53
- }
80
+ test('install accepts referenceOnly only when its option threshold is one', () => {
81
+ const root = tempDir('harness-s1-reference-only-'); const home = tempDir('harness-s1-reference-home-');
82
+ try {
83
+ const source = makeRepo(root);
84
+ const manifestFile = path.join(source, 'manifest.json');
85
+ const manifest = JSON.parse(fs.readFileSync(manifestFile, 'utf8'));
86
+ manifest.stages.intent.thresholds['intent-a'] = 1;
87
+ manifest.stages.intent.referenceOnly = ['intent-a'];
88
+ fs.writeFileSync(manifestFile, JSON.stringify(manifest));
89
+ assert.equal(install.installVersion(root, 'v1', home).status, 'installed');
90
+
91
+ const invalidRoot = tempDir('harness-s1-reference-invalid-');
92
+ const invalidHome = tempDir('harness-s1-reference-invalid-home-');
93
+ try {
94
+ const invalidSource = makeRepo(invalidRoot);
95
+ const invalidFile = path.join(invalidSource, 'manifest.json');
96
+ const invalidManifest = JSON.parse(fs.readFileSync(invalidFile, 'utf8'));
97
+ invalidManifest.stages.intent.thresholds['intent-a'] = 0.99;
98
+ invalidManifest.stages.intent.referenceOnly = ['intent-a'];
99
+ fs.writeFileSync(invalidFile, JSON.stringify(invalidManifest));
100
+ assert.throws(() => install.installVersion(invalidRoot, 'v1', invalidHome), /invalid-manifest: malformed intent referenceOnly/);
101
+ assert.equal(fs.existsSync(path.join(invalidHome, 'versions', 'v1')), false);
102
+ } finally { remove(invalidRoot, invalidHome); }
103
+ } finally { remove(root, home); }
54
104
  });
55
105
 
56
- test('S1-I04 downloads are verified before an atomic write; a valid file is reused', async () => {
57
- const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'harness-s1-install-'));
106
+ test('S1-I03 activation and rollback round-trip through the previous pointer', () => {
107
+ const root = tempDir('harness-s1-repo-'); const home = tempDir('harness-s1-home-');
58
108
  try {
59
- const good = Buffer.from('pinned-bytes\r\n');
60
- const spec = { name: 'x.json', sha256: sha(good), size: good.length };
61
- const dest = path.join(dir, 'x.json');
62
- let calls = 0;
63
- const fetcher = bytes => async () => { calls++; return bytes; };
64
- for (const bad of [Buffer.from('tampered-bytes'), Buffer.concat([good, Buffer.from('x')]), Buffer.alloc(0)]) {
65
- await assert.rejects(install.ensureFile('https://example.invalid/x', dest, spec, fetcher(bad)), /download-verification/);
66
- assert.equal(fs.existsSync(dest), false);
67
- assert.deepEqual(fs.readdirSync(dir), []);
68
- }
69
- assert.equal(await install.ensureFile('https://example.invalid/x', dest, spec, fetcher(good)), 'downloaded');
70
- assert.ok(fs.readFileSync(dest).equals(good));
71
- const before = calls;
72
- assert.equal(await install.ensureFile('https://example.invalid/x', dest, spec, fetcher(good)), 'verified-existing');
73
- assert.equal(calls, before);
74
- fs.writeFileSync(dest, 'corrupted');
75
- assert.equal(await install.ensureFile('https://example.invalid/x', dest, spec, fetcher(good)), 'downloaded');
76
- assert.ok(fs.readFileSync(dest).equals(good));
77
- } finally { fs.rmSync(dir, { recursive: true, force: true }); }
109
+ makeRepo(root, 'v1'); makeRepo(root, 'v2');
110
+ withHome(home, () => {
111
+ install.installVersion(root, 'v1'); install.installVersion(root, 'v2');
112
+ const first = install.activate('v1');
113
+ assert.equal(first.version, 'v1'); assert.equal(first.previous, null);
114
+ assert.equal(first.dir, path.join(home, 'versions', 'v1'));
115
+ assert.ok(Number.isFinite(Date.parse(first.activatedAt)));
116
+ const env = { ...process.env, HARNESS_SYSTEM_ONE_HOME: home, HARNESS_SYSTEM_ONE_MODE: 'live' };
117
+ const activated = spawnSync(process.execPath, [script, 'activate', 'v2'], { encoding: 'utf8', env });
118
+ assert.equal(activated.status, 0, activated.stderr);
119
+ const second = JSON.parse(activated.stdout);
120
+ assert.equal(second.version, 'v2'); assert.equal(second.previous, 'v1');
121
+ assert.deepEqual(Object.keys(JSON.parse(fs.readFileSync(path.join(home, 'active.json'), 'utf8'))).sort(),
122
+ ['activatedAt', 'dir', 'previous', 'schemaVersion', 'version']);
123
+ const rolled = spawnSync(process.execPath, [script, 'rollback'], { encoding: 'utf8', env });
124
+ assert.equal(rolled.status, 0, rolled.stderr);
125
+ const rolledBack = JSON.parse(rolled.stdout);
126
+ assert.equal(rolledBack.version, 'v1'); assert.equal(rolledBack.previous, 'v2');
127
+ const shown = spawnSync(process.execPath, [script, 'status'], { encoding: 'utf8', env });
128
+ assert.equal(shown.status, 0, shown.stderr);
129
+ assert.equal(JSON.parse(shown.stdout).mode, 'live');
130
+ });
131
+ } finally { remove(root, home); }
78
132
  });
79
133
 
80
- test('S1-I06 child command output goes to stderr so stdout stays machine-readable JSON', () => {
81
- const code = `require(${JSON.stringify(script)}).exec(process.execPath, ['-e', 'console.log("pip-noise")'])`;
82
- const child = spawnSync(process.execPath, ['-e', code], { encoding: 'utf8' });
83
- assert.equal(child.status, 0, child.stderr);
84
- assert.equal(child.stdout, '');
85
- assert.match(child.stderr, /pip-noise/);
86
- const captured = spawnSync(process.execPath, ['-e', `process.stdout.write(require(${JSON.stringify(script)}).exec(process.execPath, ['-e', 'console.log("3.13.6")'], true))`], { encoding: 'utf8' });
87
- assert.equal(captured.stdout, '3.13.6');
134
+ test('S1-I04 rollback explains when no previous version is recorded', () => {
135
+ const home = tempDir('harness-s1-home-');
136
+ try {
137
+ withHome(home, () => assert.throws(() => install.rollback(), /rollback-unavailable: no previous version/));
138
+ } finally { remove(home); }
139
+ });
140
+
141
+ test('S1-I05 active pointer replacement is atomic and preserves the old pointer on rename failure', () => {
142
+ const root = tempDir('harness-s1-repo-'); const home = tempDir('harness-s1-home-');
143
+ try {
144
+ makeRepo(root, 'v1'); makeRepo(root, 'v2');
145
+ withHome(home, () => {
146
+ install.installVersion(root, 'v1'); install.installVersion(root, 'v2'); install.activate('v1');
147
+ const rename = fs.renameSync;
148
+ fs.renameSync = () => { throw new Error('simulated rename failure'); };
149
+ try { assert.throws(() => install.activate('v2'), /rename|active|atomic/i); }
150
+ finally { fs.renameSync = rename; }
151
+ assert.equal(JSON.parse(fs.readFileSync(path.join(home, 'active.json'), 'utf8')).version, 'v1');
152
+ assert.deepEqual(fs.readdirSync(home).filter(name => name.includes('.tmp')), []);
153
+ });
154
+ } finally { remove(root, home); }
88
155
  });
89
156
 
90
- test('S1-I05 dry run prints the pinned plan and changes nothing, repeatably', () => {
91
- const dir = path.join(fs.mkdtempSync(path.join(os.tmpdir(), 'harness-s1-dry-')), 'target');
157
+ test('S1-I06 status reports active and previous hash health with the live-mode hint', () => {
158
+ const root = tempDir('harness-s1-repo-'); const home = tempDir('harness-s1-home-');
92
159
  try {
93
- const run = () => spawnSync(process.execPath, [script, '--dir', dir, '--python', 'python-not-used', '--dry-run'], { encoding: 'utf8' });
160
+ const source = makeRepo(root, 'v1'); makeRepo(root, 'v2');
161
+ withHome(home, () => {
162
+ install.installVersion(root, 'v1'); install.installVersion(root, 'v2');
163
+ install.activate('v1'); install.activate('v2');
164
+ const healthy = install.status();
165
+ assert.equal(healthy.active.version, 'v2'); assert.equal(healthy.active.hashesOk, true);
166
+ assert.equal(healthy.previous.version, 'v1'); assert.equal(healthy.previous.hashesOk, true);
167
+ assert.match(healthy.modeHint, /HARNESS_SYSTEM_ONE_MODE=live/);
168
+ fs.writeFileSync(path.join(home, 'versions', 'v2', 'tier.weights'), 'tampered');
169
+ assert.equal(install.status().active.hashesOk, false);
170
+ assert.equal(fs.existsSync(path.join(source, 'manifest.json')), true);
171
+ });
172
+ } finally { remove(root, home); }
173
+ });
174
+
175
+ test('S1-I07 argument parsing requires an explicit install source and version', () => {
176
+ const root = path.resolve(os.tmpdir(), 's1-repo');
177
+ assert.deepEqual(install.parseArgs(['install', '--from', root, '--version', 'v1']), {
178
+ command: 'install', from: root, version: 'v1', dir: install.defaultDir(), python: null, dryRun: false,
179
+ });
180
+ assert.deepEqual(install.parseArgs(['activate', 'v1']), { command: 'activate', version: 'v1', dir: install.defaultDir() });
181
+ for (const argv of [[], ['install'], ['install', '--from', 'repo'], ['install', '--from', 'repo', '--version', '../bad'], ['activate'], ['rollback', 'extra'], ['status', 'extra'], ['unknown']]) {
182
+ assert.throws(() => install.parseArgs(argv), { message: 'usage' });
183
+ }
184
+ });
185
+
186
+ test('S1-I08 interpreter selection accepts only the supported Python range', () => {
187
+ for (const version of ['3.11.0', '3.12.4', '3.13.6']) assert.equal(install.supportedPython(version), true);
188
+ for (const version of ['3.10.9', '3.14.0', '2.7.18', '3.13', '', 'x', null]) assert.equal(install.supportedPython(version), false);
189
+ assert.deepEqual(install.pythonCandidates('win32')[0], ['py', '-3.13']);
190
+ assert.deepEqual(install.pythonCandidates('linux')[0], ['python3.13']);
191
+ assert.equal(install.venvPython('/x', 'win32'), path.join('/x', 'venv', 'Scripts', 'python.exe'));
192
+ assert.equal(install.venvPython('/x', 'linux'), path.join('/x', 'venv', 'bin', 'python'));
193
+ assert.ok(install.PINS.cuaS1Spec.includes(`@${PINNED_CUA_S1_REVISION}#subdirectory=libs/cua-s1/python`));
194
+ assert.equal('modelId' in install.PINS, false);
195
+ });
196
+
197
+ test('S1-I09 dry run prints setup without changing files or pinning the public forms checkpoint', () => {
198
+ const root = tempDir('harness-s1-repo-'); const home = path.join(tempDir('harness-s1-home-'), 'target');
199
+ try {
200
+ makeRepo(root);
201
+ const run = () => spawnSync(process.execPath, [script, 'install', '--from', root, '--version', 'v1', '--dir', home, '--python', 'python-not-used', '--dry-run'], { encoding: 'utf8' });
94
202
  const one = run(); const two = run();
95
203
  assert.equal(one.status, 0, one.stderr); assert.equal(one.stdout, two.stdout);
96
204
  const plan = JSON.parse(one.stdout);
97
- assert.equal(plan.dryRun, true); assert.equal(plan.dir, dir);
98
- assert.equal(plan.manifest, path.join(dir, 'manifest.json'));
99
- assert.ok(plan.steps.some(s => s.includes(install.PINS.cuaS1Spec)));
100
- assert.ok(plan.steps.some(s => s.includes(install.PINS.torchIndex)));
101
- assert.deepEqual(plan.env, { HARNESS_SYSTEM_ONE_MODE: 'shadow', HARNESS_SYSTEM_ONE_CONFIG: path.join(dir, 'manifest.json') });
102
- assert.equal(fs.existsSync(dir), false);
103
- const bad = spawnSync(process.execPath, [script, '--dir', 'relative'], { encoding: 'utf8' });
104
- assert.equal(bad.status, 2); assert.match(bad.stderr, /Usage/);
105
- } finally { fs.rmSync(path.dirname(dir), { recursive: true, force: true }); }
205
+ assert.equal(plan.dryRun, true); assert.equal(plan.dir, home); assert.equal(plan.version, 'v1');
206
+ assert.ok(plan.steps.some(step => step.includes(install.PINS.cuaS1Spec)));
207
+ assert.ok(plan.steps.some(step => step.includes(install.PINS.torchIndex)));
208
+ assert.doesNotMatch(one.stdout, /cua-ai\/cua-s1-forms|huggingface\.co/);
209
+ assert.equal(fs.existsSync(home), false);
210
+ } finally { remove(root, path.dirname(home)); }
211
+ });
212
+
213
+ test('S1-I10 child output stays off machine-readable stdout and credentials are omitted from errors', () => {
214
+ const code = `require(${JSON.stringify(script)}).exec(process.execPath, ['-e', 'console.log("pip-noise")'])`;
215
+ const child = spawnSync(process.execPath, ['-e', code], { encoding: 'utf8' });
216
+ assert.equal(child.status, 0, child.stderr); assert.equal(child.stdout, ''); assert.match(child.stderr, /pip-noise/);
217
+ assert.throws(() => install.exec('command-that-does-not-exist', ['private-repo-url'], true), error => {
218
+ assert.doesNotMatch(error.message, /private-repo-url/);
219
+ return true;
220
+ });
221
+ });
222
+
223
+ test('S1-I11 remote sources reject embedded credentials and non-SSH URLs', () => {
224
+ for (const source of ['https://example.invalid/private.git', 'ssh://git:secret@example.invalid/private.git', 'ssh://git%3Asecret@example.invalid/private.git']) {
225
+ assert.throws(() => install.sourceKind(source), error => {
226
+ assert.match(error.message, /invalid-source/);
227
+ assert.doesNotMatch(error.message, /secret|private\.git/);
228
+ return true;
229
+ });
230
+ }
106
231
  });