harness-everything 1.5.2 → 1.5.4

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 (30) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/CHANGELOG.md +12 -0
  4. package/benchmarks/results/live-host/agy-2026-12-02-linux-loader/README.md +33 -0
  5. package/ci/mechanism-468-dispatch-cli.test.js +99 -4
  6. package/ci/mechanism-548-bigint-identity.test.js +252 -5
  7. package/ci/mechanism-error-ledger-promote.test.js +122 -1
  8. package/ci/mechanism-system-one-install.test.js +50 -0
  9. package/docs/error-handling/details/c8-dispatch-cli.md +12 -0
  10. package/docs/platform-capabilities.md +8 -1
  11. package/docs/platform-compatibility.json +3 -3
  12. package/docs/system-one-cycle.md +2 -1
  13. package/harness-everything/SKILL.md +1 -1
  14. package/harness-everything/scripts/system-one/cua_adapter.py +4 -2
  15. package/harness-everything/scripts/system-one/install.js +1 -5
  16. package/harness-everything/scripts/system-one/manifest.js +7 -3
  17. package/harness-everything/scripts/system-one/provider.js +3 -4
  18. package/opencode-plugin/plugin.json +1 -1
  19. package/package.json +1 -1
  20. package/plugins/harness-everything/.antigravity-plugin/plugin.json +1 -1
  21. package/plugins/harness-everything/.codex-plugin/plugin.json +1 -1
  22. package/plugins/harness-everything/plugin.json +1 -1
  23. package/plugins/harness-everything/skills/harness-everything/SKILL.md +1 -1
  24. package/plugins/harness-everything/skills/harness-everything/scripts/system-one/cua_adapter.py +4 -2
  25. package/plugins/harness-everything/skills/harness-everything/scripts/system-one/install.js +1 -5
  26. package/plugins/harness-everything/skills/harness-everything/scripts/system-one/manifest.js +7 -3
  27. package/plugins/harness-everything/skills/harness-everything/scripts/system-one/provider.js +3 -4
  28. package/sbom.cdx.json +7 -7
  29. package/scripts/dispatch.js +90 -7
  30. package/scripts/system-one-cycle/package.js +2 -2
@@ -129,10 +129,11 @@ function writeApproval(value, file = path.join(TMP, 'approval.json')) {
129
129
  return file;
130
130
  }
131
131
 
132
- function invoke(target, report, approval, harness = ROOT, extraEnv = {}) {
132
+ function invoke(target, report, approval, harness = ROOT, extraEnv = {}, preload = null) {
133
133
  const env = { ...process.env, ...extraEnv };
134
134
  delete env.HARNESS_SYSTEM_ONE_MODE;
135
135
  return childProcess.spawnSync(process.execPath, [
136
+ ...(preload ? ['-r', preload] : []),
136
137
  SCRIPT, '--target', target, '--report', report,
137
138
  '--approval', approval, '--harness', harness, '--json'
138
139
  ], { cwd: ROOT, encoding: 'utf8', env });
@@ -222,6 +223,83 @@ function makeSyncHarness(name, afterWrite, duringRollback = '') {
222
223
  return harness;
223
224
  }
224
225
 
226
+ function writeRollbackIdentityPreload(fixture, file, { site, mismatch, previousIndex }) {
227
+ const indexFile = path.join(fixture.errorsDir, 'index.jsonl');
228
+ const recordFile = path.join(fixture.errorsDir, 'E-0002-parser-edge-case.md');
229
+ const finalIndexStat = previousIndex ? 4 : 3;
230
+ write(file, `
231
+ 'use strict';
232
+ const fs = require('node:fs');
233
+ const path = require('node:path');
234
+ const indexKey = path.resolve(${JSON.stringify(indexFile)});
235
+ const recordKey = path.resolve(${JSON.stringify(recordFile)});
236
+ const large = 2n ** 60n;
237
+ const mismatch = ${JSON.stringify(mismatch)};
238
+ const site = ${JSON.stringify(site)};
239
+ const finalIndexStat = ${finalIndexStat};
240
+ const originalLstat = fs.lstatSync;
241
+ const originalOpen = fs.openSync;
242
+ const originalFstat = fs.fstatSync;
243
+ const indexFds = new Set();
244
+ const recordFds = new Set();
245
+ let indexStatCount = 0;
246
+ let pendingIndexIno = large;
247
+ fs.lstatSync = function (file, options) {
248
+ const result = originalLstat.call(this, file, options);
249
+ const key = path.resolve(String(file));
250
+ if (options && options.bigint && key === indexKey) {
251
+ indexStatCount++;
252
+ pendingIndexIno = large + (site.startsWith('index-') && mismatch && indexStatCount === finalIndexStat ? 1n : 0n);
253
+ result.dev = large;
254
+ result.ino = pendingIndexIno;
255
+ } else if (options && options.bigint && key === recordKey) {
256
+ result.dev = large;
257
+ result.ino = large + (site === 'new-record' && mismatch ? 1n : 0n);
258
+ }
259
+ return result;
260
+ };
261
+ fs.openSync = function (file, ...args) {
262
+ const fd = originalOpen.call(this, file, ...args);
263
+ const key = path.resolve(String(file));
264
+ if (key === indexKey) indexFds.add(fd);
265
+ if (key === recordKey) recordFds.add(fd);
266
+ return fd;
267
+ };
268
+ fs.fstatSync = function (fd, options) {
269
+ const result = originalFstat.call(this, fd, options);
270
+ if (options && options.bigint && indexFds.has(fd)) {
271
+ result.dev = large;
272
+ result.ino = pendingIndexIno;
273
+ } else if (options && options.bigint && recordFds.has(fd)) {
274
+ result.dev = large;
275
+ result.ino = large;
276
+ }
277
+ return result;
278
+ };
279
+ `);
280
+ return { indexFile, recordFile };
281
+ }
282
+
283
+ function replaceAfterWrite(site, replacementCopy) {
284
+ const errorsDir = "path.join(args[args.indexOf('--root') + 1], '.agents', 'harness-everything', 'errors')";
285
+ if (site === 'new-record') {
286
+ return [
287
+ ` const file = path.join(${errorsDir}, 'E-0002-parser-edge-case.md');`,
288
+ ' const temporary = `${file}.replacement`;',
289
+ " fs.writeFileSync(temporary, Buffer.concat([fs.readFileSync(file), Buffer.from('\\n<!-- replacement record -->\\n')]));",
290
+ ` fs.copyFileSync(temporary, ${JSON.stringify(replacementCopy)});`,
291
+ ' fs.renameSync(temporary, file);'
292
+ ].join('\n');
293
+ }
294
+ return [
295
+ ` const file = path.join(${errorsDir}, 'index.jsonl');`,
296
+ ' const temporary = `${file}.replacement`;',
297
+ ` fs.copyFileSync(file, ${JSON.stringify(replacementCopy)});`,
298
+ ' fs.copyFileSync(file, temporary);',
299
+ ' fs.renameSync(temporary, file);'
300
+ ].join('\n');
301
+ }
302
+
225
303
  try {
226
304
  // The whole happy path uses the real CLI and target-root sync implementation.
227
305
  const success = seedFixture();
@@ -405,6 +483,49 @@ try {
405
483
  `rollback recognizes its own replacement, removes the new record, and restores prior index bytes: ${syncFailureResult.error}`);
406
484
  assert.equal(runSync(syncFailure.root).status, 0, 'the target index remains current after rollback');
407
485
 
486
+ assert.equal(Number(2n ** 60n), Number((2n ** 60n) + 1n),
487
+ 'rollback fixture IDs must be distinct bigint values that collide as Number');
488
+ function checkRollbackIdentity(site, mismatch) {
489
+ const fixture = seedFixture();
490
+ const indexFile = path.join(fixture.errorsDir, 'index.jsonl');
491
+ const previousIndex = site !== 'index-missing';
492
+ if (!previousIndex) fs.unlinkSync(indexFile);
493
+ const before = snapshot(fixture.errorsDir);
494
+ const replacementCopy = path.join(TMP, `rollback-${site}-${mismatch ? 'mismatch' : 'match'}.replacement`);
495
+ const harness = makeSyncHarness(`rollback-${site}-${mismatch ? 'mismatch' : 'match'}-harness`,
496
+ replaceAfterWrite(site, replacementCopy));
497
+ const preload = path.join(TMP, `rollback-${site}-${mismatch ? 'mismatch' : 'match'}.cjs`);
498
+ const { recordFile } = writeRollbackIdentityPreload(fixture, preload, { site, mismatch, previousIndex });
499
+ const result = resultFor(invoke(fixture.root, fixture.report, fixture.approval, harness, {}, preload), 1);
500
+ assert.equal(result.ok, false, 'the injected final check fails after successful publication');
501
+
502
+ const after = snapshot(fixture.errorsDir);
503
+ if (mismatch && site.startsWith('index-')) {
504
+ assert.match(result.error, site === 'index-missing'
505
+ ? /index changed before the owned replacement could be removed/
506
+ : /index changed before the owned replacement could be restored/);
507
+ assert.equal(fs.existsSync(recordFile), false, 'matched record identity lets rollback remove its own record');
508
+ assert.deepEqual(fs.readFileSync(indexFile), fs.readFileSync(replacementCopy),
509
+ 'mismatched index identity preserves the replacement index bytes');
510
+ assert.notDeepEqual(after, before, 'the refusal remains visible as a recovery state');
511
+ } else if (mismatch) {
512
+ assert.match(result.error, /new record was replaced by another writer/);
513
+ assert.deepEqual(fs.readFileSync(recordFile), fs.readFileSync(replacementCopy),
514
+ 'mismatched record identity preserves the replacement record bytes');
515
+ assert.deepEqual(fs.readFileSync(indexFile), Buffer.from(before['index.jsonl'], 'base64'),
516
+ 'the independent matched index identity restores the prior index');
517
+ assert.notDeepEqual(after, before, 'the preserved replacement record remains visible');
518
+ } else {
519
+ assert.match(result.error, /injected final check failure; ledger restored to its pre-promotion state/);
520
+ assert.deepEqual(after, before, 'matched bigint identities allow the same rollback branch to complete');
521
+ }
522
+ }
523
+
524
+ for (const site of ['index-missing', 'index-existing', 'new-record']) {
525
+ checkRollbackIdentity(site, true);
526
+ checkRollbackIdentity(site, false);
527
+ }
528
+
408
529
  const rollbackContention = seedFixture();
409
530
  const secondCandidate = rollbackContention.reportJson.candidates.find(candidate =>
410
531
  candidate.id !== rollbackContention.selected.id && candidate.sources.some(source => source.type === 'git'));
@@ -67,6 +67,56 @@ test('S1-I01 local install copies the manifest-shaped checkpoint without activat
67
67
  } finally { remove(root, home); }
68
68
  });
69
69
 
70
+ test('443 R4: cycle, publish, install, manifest and both runtimes agree on version IDs', t => {
71
+ const root = tempDir('harness-s1-version-repo-');
72
+ const home = tempDir('harness-s1-version-home-');
73
+ t.after(() => remove(root, home));
74
+ const { validateVersion, publishVersion } = require('../scripts/system-one-cycle/package');
75
+ const adapterDir = path.dirname(script);
76
+ const python = process.env.PYTHON || (process.platform === 'win32' ? 'python' : 'python3');
77
+ const activeFile = path.join(home, 'active.json');
78
+ const loadAdapter = () => spawnSync(python, ['-B', '-c',
79
+ "import sys; sys.path.insert(0,sys.argv[2]); import cua_adapter; b=cua_adapter.load_active_bundle(sys.argv[1], scorer_loader=lambda *_: (lambda _r: [], {})); print(b['version'])",
80
+ activeFile, adapterDir], { encoding: 'utf8' });
81
+ const env = { ...process.env, HARNESS_SYSTEM_ONE_HOME: home };
82
+ const version = 's1-2026-12';
83
+ const source = makeRepo(root, version, '.safetensors');
84
+ const manifestFile = path.join(source, 'manifest.json');
85
+ const manifest = JSON.parse(fs.readFileSync(manifestFile, 'utf8'));
86
+ const installed = install.installVersion(root, version, home);
87
+ const pointer = install.activate(version, home);
88
+ assert.equal(validateVersion(version), version);
89
+ assert.equal(validateVersionManifest(manifest).version, version);
90
+ assert.equal(readActive(env)?.version, version);
91
+ const live = loadAdapter();
92
+ assert.equal(live.status, 0, live.stderr);
93
+ assert.equal(live.stdout.trim(), version);
94
+ assert.equal(validateVersion('v' + '1'.repeat(79)).length, 80);
95
+
96
+ for (const invalid of ['S1-2026-12', 'v' + '1'.repeat(80), '', '../model', 'a/b', 'a\\b', '.hidden', 'v1\n']) {
97
+ const witness = JSON.stringify(invalid);
98
+ assert.throws(() => validateVersion(invalid), /invalid --version/, witness);
99
+ assert.throws(() => publishVersion({ dataDir: root, version: invalid }), /invalid --version/, witness);
100
+ assert.throws(() => install.installVersion(root, invalid, home), /invalid-version/, witness);
101
+ assert.throws(() => install.activate(invalid, home), /invalid-version/, witness);
102
+ assert.throws(() => validateVersionManifest({ ...manifest, version: invalid }), /invalid-manifest/, witness);
103
+ assert.deepEqual(JSON.parse(fs.readFileSync(activeFile)), pointer, witness);
104
+
105
+ // A previous version does not participate in manifest validation.
106
+ for (const field of ['previous', 'version']) {
107
+ fs.writeFileSync(activeFile, JSON.stringify({ ...pointer, [field]: invalid }));
108
+ assert.throws(() => install.readActive(home), /invalid-active-pointer/, witness);
109
+ assert.equal(readActive(env), null, witness);
110
+ const rejected = loadAdapter();
111
+ assert.equal(rejected.error, undefined);
112
+ assert.equal(rejected.status, 1, witness);
113
+ assert.match(rejected.stderr, /ValueError: active-pointer/, witness);
114
+ }
115
+ fs.writeFileSync(activeFile, JSON.stringify(pointer));
116
+ }
117
+ assert.equal(readActive(env)?.dir, installed.dir);
118
+ });
119
+
70
120
  test('S1-I02 install rejects a tampered stage hash before copying any version', () => {
71
121
  const root = tempDir('harness-s1-repo-'); const home = tempDir('harness-s1-home-');
72
122
  try {
@@ -30,6 +30,18 @@ npm run --silent dispatch -- --runner <codex|opencode|agy> --model <id> \
30
30
 
31
31
  In JSON mode the common shape is `{ok, code, phase, message}` with resolved `runner`, `model`, and existing `evidence` paths when available. A validated requested Codex `--effort` is also returned as `effort`; it records the request and does not claim the provider applied it. For `agy`, JSON also returns `sandbox: "requested"`; it records the requested `--sandbox` flag only and does not claim proven isolation (scope any isolation claim to separately executed evidence). Dry run also returns `argv` and `cwd`; Codex's generated raw-output argument uses a `<run-id>` placeholder. Human-mode refusals go to stderr. Child logs and raw output stay in evidence files, not in the JSON result.
32
32
 
33
+ ## Usage field
34
+
35
+ A completed runner process is measured before report validation, so a valid BLOCKED delivery (and a later report-validation refusal) can include `usage: { "totalTokens": <integer>, "mark"?: "OVER-BUDGET" }` when its structured telemetry is supported. Missing, malformed, incomplete, or uncertain telemetry returns `usage: null`. The same total is printed in the human DONE message. `OVER-BUDGET` is advisory and appears only when the cache-inclusive total is **strictly greater than 30,000,000**. It does not change the exit code, report status, timeout, or cleanup path. Runner failures and interruptions return `usage: null`.
36
+
37
+ | Runner | Structured execution channel and accepted usage shape | Cache accounting | Evidence boundary |
38
+ | --- | --- | --- | --- |
39
+ | Codex | `codex exec ... --json`; exactly one JSONL `turn.completed` event with integer `usage.input_tokens`, `usage.cached_input_tokens`, and `usage.output_tokens`. Total = `input_tokens + output_tokens`. All-zero usage is unknown because Codex can emit `Usage::default()` when no token update was received. | Codex `input_tokens` already includes cached input; `cached_input_tokens` is validated as a subset and is not added again. | **Fixture:** `468-dispatch` mechanism test. [Codex CLI v0.172.0 source](https://github.com/openai/codex/blob/rust-v0.172.0/codex-rs/exec/src/event_processor_with_jsonl_output.rs#L120-L130) emits a terminal turn event with usage and uses the all-zero default when no token update was received; no retained C8 live run has this telemetry capture. |
40
+ | OpenCode | `opencode run ... --format json`; JSONL `step_finish` events with unique `part.id`, `part.type: "step-finish"`, `part.tokens.{total,input,output,reasoning,cache:{read,write}}`; final step reason must be `stop`. Total = sum of each `tokens.total`. | Each step's native `tokens.total` is checked against input, output, reasoning and cache-read counts. Any nonzero cache-write count is reported as unknown because retained complete-run evidence does not establish whether `tokens.total` includes writes. | **Fixture:** `468-dispatch` mechanism test. **Real-host:** two retained OpenCode 2.1.4 JSONL traces end with `tool-calls`, so they provide no complete live measurement; the C8 stdout channel is not live-traced. [OpenCode documents JSONL run output](https://opencode.ai/docs/cli/commands/). |
41
+ | `agy` | `agy -p ... --output-format json`; one JSON object with `status: "SUCCESS"` and integer `usage.{input_tokens,output_tokens,thinking_tokens,cache_read_tokens,total_tokens}`. Require `total_tokens = input_tokens + output_tokens`. | `input_tokens` includes cache reads; `thinking_tokens` is within output and `cache_read_tokens` is within input. Neither subset is added again. | **Fixture:** `468-dispatch` mechanism test. [Google documents this JSON envelope and fields](https://antigravity.google/docs/cli/headless/); previous retained C8 AGY runs used text mode and have no usage trace. |
42
+
43
+ Only the runner's structured stdout is parsed. Human `tokens used` prose, malformed JSON, invalid counts, duplicate/missing terminal events, non-final OpenCode stop events, and incomplete runs produce `usage: null`; no arbitrary log or task/runner-authored text is treated as usage.
44
+
33
45
  ## Exit and JSON codes
34
46
 
35
47
  | Exit | JSON `code` | Meaning |
@@ -45,6 +45,13 @@ can therefore coexist with unresolved changes. The coordinator owns
45
45
  even when the hook is silent. The source and package fixtures cover these
46
46
  behaviors. Windows host delivery remains to be verified.
47
47
 
48
+ ### Antigravity Linux plugin loading
49
+
50
+ [AGY CLI 1.5.21 evidence](../benchmarks/results/live-host/agy-2026-12-02-linux-loader/README.md)
51
+ records validation, global installation and enabled-plugin discovery on
52
+ Debian 13.7. The project-only and clean control sessions stopped at
53
+ authentication before lifecycle evidence was available.
54
+
48
55
  ### Antigravity Windows shell handoff
49
56
 
50
57
  [AGY CLI 1.5.17 evidence](../benchmarks/results/live-host/agy-2026-11-26-516-read-only/README.md)
@@ -88,7 +95,7 @@ A shared matcher (`hooks/scripts/lib/ledger-match.js`) selects workspace ledger
88
95
  | Platform surface | Standalone skills | Plugin support | Hooks/lifecycle | Project scope | Global scope | Current evidence boundary |
89
96
  | --- | --- | --- | --- | --- | --- | --- |
90
97
  | Codex | `Supported` | `Mechanism verified` | `Partial`: user-hook compatibility capture is live-verified for `UserPromptSubmit` and `Stop` on one Windows Codex CLI host; native plugin hooks remain mechanism-verified | `.agents/skills/`, `AGENTS.md` | `~/.agents/skills/` | [Live evidence](../benchmarks/results/live-host/codex-2026-10-13/README.md) verifies two consecutive turns on Codex CLI 0.162.1; native plugin mounting, other lifecycle events, and other versions remain unverified. |
91
- | Antigravity (AGY) | `Supported` | `Partial` (`Mechanism verified`; global Desktop App `2.34.0` load and `agy` CLI `1.5.15` `validate`/`list --json` live-verified on macOS, plus `agy` CLI `1.5.16` `validate`/`list --json` on Windows; `validate --strict` fails on 2 multi-host warnings; temp `.agents/plugins/` hook discovery observed via `agy --print`) | `Partial`: `Mechanism verified` for all adapters; Desktop App `2.34.0` + CLI `1.5.15` (macOS) live-verified `SessionStart`, `PreInvocation` dedup, `PreToolUse` (`write_file`/`run_command`), `PostToolUse` edit tracking, and `Stop` (`NO_TOOL_CALL`); Windows Desktop + CLI `1.5.16` (`harness-everything` `1.0.1`) live-verified `SessionStart`, `PreInvocation`, and bounded 1-continuation `Stop`; `PostToolUse` omits `exitCode`/`error` on shell outcomes on macOS `2.34.0`/CLI `1.5.15` and Windows Desktop, so unknown shell outcomes grant no verification credit (`exitCode === 0` required); IDE write tools (`write_to_file`/`replace_file_content`/`multi_replace_file_content`) and live `model_stop` remain mechanism-only | `.agents/plugins/harness-everything/`, `.agents/rules/AGENTS.md` | `~/.gemini/config/plugins/harness-everything/` | [Mechanism evidence](../benchmarks/results/live-host/agy-2026-11-22/README.md) + [macOS partial live-host evidence](../benchmarks/results/live-host/agy-2026-11-23/README.md) + [Windows partial live-host evidence](../benchmarks/results/live-host/agy-2026-11-25/README.md); `/hooks` TUI view, full project-scope `harness-everything` isolation, IDE write tools, live shell `exitCode: 0` verification credit, and live `Stop` `model_stop` remain open in issue #514. |
98
+ | Antigravity (AGY) | `Supported` | `Partial` (`Mechanism verified`; global Desktop App `2.34.0` load and `agy` CLI `1.5.15` `validate`/`list --json` live-verified on macOS, plus `agy` CLI `1.5.16` `validate`/`list --json` on Windows and CLI `1.5.21` global validation, installation and discovery on Linux; `validate --strict` fails on 2 multi-host warnings; temp `.agents/plugins/` hook discovery observed via `agy --print`) | `Partial`: `Mechanism verified` for all adapters; Desktop App `2.34.0` + CLI `1.5.15` (macOS) live-verified `SessionStart`, `PreInvocation` dedup, `PreToolUse` (`write_file`/`run_command`), `PostToolUse` edit tracking, and `Stop` (`NO_TOOL_CALL`); Windows Desktop + CLI `1.5.16` (`harness-everything` `1.0.1`) live-verified `SessionStart`, `PreInvocation`, and bounded 1-continuation `Stop`; `PostToolUse` omits `exitCode`/`error` on shell outcomes on macOS `2.34.0`/CLI `1.5.15` and Windows Desktop, so unknown shell outcomes grant no verification credit (`exitCode === 0` required); IDE write tools (`write_to_file`/`replace_file_content`/`multi_replace_file_content`) and live `model_stop` remain mechanism-only | `.agents/plugins/harness-everything/`, `.agents/rules/AGENTS.md` | `~/.gemini/config/plugins/harness-everything/` | [Mechanism evidence](../benchmarks/results/live-host/agy-2026-11-22/README.md) + [macOS partial live-host evidence](../benchmarks/results/live-host/agy-2026-11-23/README.md) + [Windows partial live-host evidence](../benchmarks/results/live-host/agy-2026-11-25/README.md) + [Linux CLI loader evidence](../benchmarks/results/live-host/agy-2026-12-02-linux-loader/README.md); `/hooks` TUI view, full project-scope `harness-everything` isolation, IDE write tools, live shell `exitCode: 0` verification credit, and live `Stop` `model_stop` remain open in issue #514. |
92
99
  | ChatGPT / OpenAI Plugin | `Unknown` for a repository-local standalone path | `Mechanism verified` | `Partial`: local Work/Codex hooks are separate from ordinary Chat | Managed workspace marketplace | Not established | The public Skills-only bundle is mechanically reproducible; import, approval, and live behavior remain `Unknown`. |
93
100
  | Claude Code | `Supported` | `Supported` | `Mechanism verified` for Harness configuration | `.claude/skills/` | `~/.claude/skills/` | Native Claude surfaces and the state-specific plugin sync command are mechanically checked; fresh-host execution is not preserved here. |
94
101
  | OpenCode | `Supported` | `Partial` (V2 plugin API only; OpenCode 1.x / V1 unsupported; V2 default-export load verified live on OpenCode 2.1.3 macOS via server-log only, in the 2.1.4 macOS 26.6.2 V2 lifecycle trace and 2.1.4 macOS workspace trace, and in the 2.4.1 macOS 26.7.3 long-lived server runs; full router injection trace remains mechanism-tested on V2) | `Partial` (V2 default-export load, V2 tool hooks, V2 event envelope + `session.execution.succeeded`, and completion → verification → reminder delivery on a long-lived server are live-observed on OpenCode 2.1.4 macOS 26.6.2; observation recording + training export — with router/context injection indirectly observed as the model emitted the injected label contract — and mid-turn live steering delivery shape are live-observed on OpenCode 2.4.1 macOS 26.7.3 on a long-lived server; E-0003 ledger-lesson context delivery after a matched `git commit` is live-observed on OpenCode 2.4.1 macOS (paired run, after the action); full router/context injection trace, lesson delivery before the action, session create/delete reset, and cancellation remain mechanism-verified only; retained 1.18.31 project-scope `.js` loading and edit/verification state artifact is historical/unsupported V1 evidence) | `.opencode/skills/`, `.agents/skills/`, `.opencode/plugins/` | `~/.config/opencode/skills/`, `~/.agents/skills/`, `~/.config/opencode/plugins/` | **V2-only support boundary (#453):** OpenCode V2 plugin API family only (OpenCode 1.x / V1 unsupported; no validated minimum patch version claimed). Tested V2 live observations: an isolated [OpenCode 2.1.4/macOS 26.6.2 V2 lifecycle trace](../benchmarks/results/live-host/opencode-2026-11-24-v2-lifecycle/README.md) (one host/version/run establishing V2 default-export load, V2 tool hooks, V2 event envelope + `session.execution.succeeded` completion, and completion → verification → reminder delivery on a long-lived server; `opencode run --standalone` exits before verification finishes), V2 default-export load on OpenCode 2.1.3 (macOS, 2026-10-23, server-log evidence only), a separate [OpenCode 2.1.4/macOS session workspace trace](../benchmarks/results/live-host/opencode-2026-11-15-workspace/README.md) observing `ctx.session.get({sessionID})` returning `location.directory` for two sessions matching setup (no mismatch test or V2 hook fire), and two isolated OpenCode 2.4.1/macOS 26.7.3 long-lived server runs (`OPENCODE_PASSWORD` required): [turn → export trace](../benchmarks/results/live-host/opencode-2026-11-28-397-turn-export/README.md) (observation recording for two turns + idempotent training export; router/context injection indirectly observed as the model emitted the injected label contract, not a full injection trace) and [steering trace](../benchmarks/results/live-host/opencode-2026-11-28-450-steering-trace/README.md) (mid-turn live steering delivery shape, witness-only for #450). Full router/context injection trace, ledger lessons, session create/delete reset, cancellation, and workspace mismatch handling remain mechanism evidence only. [Retained historical/unsupported V1 evidence](../benchmarks/results/live-host/opencode-2026-09-16/README.md) (OpenCode 1.18.31, macOS) documents project-scope `.js` loading and edit/verification state in one V1 host session, with a post-reset final snapshot, hard lock only an interactive observation with no retained blocked-tool trace, and operator-seeded then agent-rewritten reflection; it is preserved as historical/unsupported evidence only and does not establish current V2 support. `.mjs` auto-discovery is silently ignored (issue #127); global scope, npm-package installation, and other host versions remain unverified (as do other OSes). |
@@ -290,15 +290,15 @@
290
290
  ],
291
291
  "capabilities": {
292
292
  "standaloneSkills": {"status": "Supported", "notes": "Harness bundles all 28 canonical skills in plugins/harness-everything/skills/ and syncs rules/AGENTS.md; standalone AGY skill-only targets are not separately registered in installer.js."},
293
- "pluginSupport": {"status": "Partial", "paths": {"manifest": [".antigravity-plugin/plugin.json"], "project": [".agents/plugins/harness-everything"], "global": ["~/.gemini/config/plugins/harness-everything"]}, "notes": "Package parity is mechanism-verified; global Desktop App 2.34.0 (macOS) GetAllPlugins load and agy CLI 1.5.15 validate/list --json are live-verified (validate exits 0 with 2 multi-host warnings; --strict exits 1). Project-scope .agents/plugins/ hook discovery was observed on agy CLI 1.5.15 via a temporary probe plugin; full project-scope harness-everything isolation and Desktop App project scope remain unverified."},
293
+ "pluginSupport": {"status": "Partial", "paths": {"manifest": [".antigravity-plugin/plugin.json"], "project": [".agents/plugins/harness-everything"], "global": ["~/.gemini/config/plugins/harness-everything"]}, "notes": "Package parity is mechanism-verified; global Desktop App 2.34.0 (macOS) GetAllPlugins load and agy CLI 1.5.15 validate/list --json are live-verified (validate exits 0 with 2 multi-host warnings; --strict exits 1). Linux agy CLI 1.5.21 also validated, installed and listed the global plugin. Project-scope .agents/plugins/ hook discovery was observed on agy CLI 1.5.15 via a temporary probe plugin; full project-scope harness-everything isolation and Desktop App project scope remain unverified."},
294
294
  "bundledSkills": {"status": "Mechanism verified", "paths": {"skills": ["plugins/harness-everything/skills/<name>/SKILL.md"]}, "notes": "Package checks verify all 28 canonical skills, and agy plugin validate --json (1.5.15) counted skills: 28; live invocation across all 28 skills remains unverified."},
295
295
  "hooksLifecycle": {"status": "Partial", "notes": "Deterministic mechanism tests cover SessionStart, PreInvocation, PreToolUse, PostToolUse, and Stop. Desktop App 2.34.0 and CLI 1.5.15 (macOS) live-verified SessionStart, PreInvocation, PreToolUse (write_file/run_command), PostToolUse edit timestamps, and Stop (NO_TOOL_CALL). Host limits: PostToolUse omits exitCode and error on shell non-zero exit (1) on both Desktop 2.34.0 and CLI 1.5.15, so unknown shell outcomes grant no verification credit and preserve failed state (explicit exitCode === 0 required); IDE write tools (write_to_file, replace_file_content, multi_replace_file_content) and live Stop model_stop remain unverified."},
296
296
  "projectScope": {"status": "Partial", "paths": {"plugins": [".agents/plugins/harness-everything"], "rules": [".agents/rules/AGENTS.md"]}, "notes": "agy CLI 1.5.15 plugin list --json only lists global plugins, while agy --print discovered and executed project-scope .agents/plugins/ hooks from a temporary probe plugin. Full project-scope harness-everything isolation without global install and Desktop App project-scope loading remain unverified."},
297
- "globalScope": {"status": "Partial", "paths": {"plugins": ["~/.gemini/config/plugins/harness-everything"]}, "notes": "Global load and hook execution are live-verified on Antigravity 2.0 Desktop App 2.34.0 (macOS), agy CLI 1.5.15 (macOS), and Windows Antigravity Desktop + agy CLI 1.5.16; Linux and other AGY versions remain unverified."},
297
+ "globalScope": {"status": "Partial", "paths": {"plugins": ["~/.gemini/config/plugins/harness-everything"]}, "notes": "Global load and hook execution are live-verified on Antigravity 2.0 Desktop App 2.34.0 (macOS), agy CLI 1.5.15 (macOS), and Windows Antigravity Desktop + agy CLI 1.5.16. Linux agy CLI 1.5.21 verified global installation and discovery. Linux lifecycle hooks and other AGY versions remain unverified."},
298
298
  "installUninstallSymmetry": {"status": "Mechanism verified", "notes": "scripts/plugin-sync.js --host agy install/update/dry-run and staged rollback are covered by mechanism tests and synced live to global scope; plugin-sync.js does not provide uninstall symmetry."},
299
299
  "assetsReferences": {"status": "Mechanism verified", "notes": "Packaged skills, rules/AGENTS.md byte-for-byte parity, and packaged agy-*.js hook scripts are verified by ci/mechanism-agy-plugin-package.test.js."},
300
300
  "updateSync": {"status": "Partial", "notes": "scripts/plugin-sync.js --host agy --json is mechanism-tested and was observed live updating ~/.gemini/config/plugins/harness-everything on macOS; other OSes and project-scope sync live behavior remain unverified."},
301
- "liveHostVerification": {"status": "Partial", "evidence": "benchmarks/results/live-host/agy-2026-11-23/README.md", "notes": "Partial live-host evidence covers global Antigravity 2.0 Desktop App 2.34.0 (macOS), agy CLI 1.5.15 (macOS), and Windows Desktop + agy CLI 1.5.16 (benchmarks/results/live-host/agy-2026-11-25/README.md): plugin validate/list, SessionStart, PreInvocation, PreToolUse (write_file/run_command), PostToolUse edit timestamps, bounded Stop continuation (NO_TOOL_CALL / direct revision + workspace fingerprint), and temporary project-scope hook discovery. IDE write tools, live shell exitCode: 0 verification credit, live Stop model_stop, full project-scope isolation, and Linux hosts remain unverified."}
301
+ "liveHostVerification": {"status": "Partial", "evidence": "benchmarks/results/live-host/agy-2026-11-23/README.md", "notes": "Partial live-host evidence covers global Antigravity 2.0 Desktop App 2.34.0 (macOS), agy CLI 1.5.15 (macOS), and Windows Desktop + agy CLI 1.5.16 (benchmarks/results/live-host/agy-2026-11-25/README.md): plugin validate/list, SessionStart, PreInvocation, PreToolUse (write_file/run_command), PostToolUse edit timestamps, bounded Stop continuation (NO_TOOL_CALL / direct revision + workspace fingerprint), and temporary project-scope hook discovery. Linux AGY CLI 1.5.21 validated, installed and listed the enabled global plugin (benchmarks/results/live-host/agy-2026-12-02-linux-loader/README.md). Linux lifecycle hooks, IDE write tools, live shell exitCode: 0 verification credit, live Stop model_stop, and full project-scope isolation remain unverified."}
302
302
  }
303
303
  }
304
304
  ]
@@ -18,7 +18,8 @@ flowchart LR
18
18
  - Use a fresh, private directory for this cycle, outside the Harness checkout. On POSIX hosts the scripts set directory permissions to `0700` and data files to `0600`; on Windows, use a user-private directory with a restrictive ACL.
19
19
  - For cross-month comparisons, choose one absolute private history file outside the checkout and every cycle directory, then pass the same `--history` path to each month's `evaluate` or `all` command. If omitted, history remains at `<private-cycle-dir>/training/history.jsonl` for compatibility and is cycle-local.
20
20
  - Set `--since` to the last completed collection boundary. `collect` requires this date and accepts an optional `--sessions` path for a non-default Codex session directory.
21
- - Pick a version id containing letters, numbers, dots, underscores, or hyphens. Reuse the same data directory and version id to resume; use a new directory for the next month.
21
+ - Use a version ID of 1–80 characters starting with a lowercase ASCII letter or digit. Subsequent characters may include lowercase ASCII letters, digits, dots, underscores, and hyphens. Version IDs are used as written. Reuse the same data directory and version id to resume; use a new directory for the next month.
22
+ - An existing active pointer with an invalid version ID requires manual recovery. Preserve that installation and its pointer, then install and activate a checkpoint published with a valid ID in a clean directory using `--dir`. Set `HARNESS_SYSTEM_ONE_HOME` to that directory for runtime use.
22
23
  - Replace the placeholders in the commands below with real paths, dates, and a version id.
23
24
 
24
25
  ## Steps
@@ -4,7 +4,7 @@ description: "Route software/project work through Harness: classify tier/topolog
4
4
  license: Apache-2.0
5
5
  metadata:
6
6
  author: Miya Daniel
7
- version: 1.5.2
7
+ version: 1.5.4
8
8
  ---
9
9
 
10
10
  # Harness Everything
@@ -195,9 +195,9 @@ def load_active_bundle(active_path, expected_fingerprint=None, scorer_loader=Non
195
195
  pointer = json.loads(active_path.read_text(encoding='utf-8'))
196
196
  if (not isinstance(pointer, dict) or set(pointer) != {'schemaVersion', 'version', 'dir', 'previous', 'activatedAt'}
197
197
  or pointer.get('schemaVersion') != 1 or not isinstance(pointer.get('version'), str)
198
- or not ID_PATTERN.fullmatch(pointer['version']) or not isinstance(pointer.get('dir'), str)
198
+ or not VERSION_PATTERN.fullmatch(pointer['version']) or not isinstance(pointer.get('dir'), str)
199
199
  or not Path(pointer['dir']).is_absolute()
200
- or (pointer.get('previous') is not None and (not isinstance(pointer['previous'], str) or not ID_PATTERN.fullmatch(pointer['previous'])))
200
+ or (pointer.get('previous') is not None and (not isinstance(pointer['previous'], str) or not VERSION_PATTERN.fullmatch(pointer['previous'])))
201
201
  or not isinstance(pointer.get('activatedAt'), str)):
202
202
  raise ValueError('active-pointer')
203
203
  directory = Path(pointer['dir'])
@@ -260,6 +260,8 @@ MAX_CLIENTS = 64
260
260
  READ_DEADLINE_S = 1.0 # never longer than the Node client's 1000 ms call deadline
261
261
  STARTUP_REASONS = ('artifact-hash', 'checkpoint-format')
262
262
  ID_PATTERN = re.compile(r'[a-z0-9._-]{1,80}')
263
+ # Version IDs match manifest.js; request tasks and options use ID_PATTERN.
264
+ VERSION_PATTERN = re.compile(r'[a-z0-9][a-z0-9._-]{0,79}')
263
265
  HASH_PATTERN = re.compile(r'[0-9a-f]{64}')
264
266
  _USER_SID = []
265
267
 
@@ -7,7 +7,7 @@ const path = require('node:path');
7
7
  const { createHash, randomBytes } = require('node:crypto');
8
8
  const { spawnSync } = require('node:child_process');
9
9
  const { PINNED_CUA_S1_REVISION } = require('./provider');
10
- const { STAGES, validateVersionManifest } = require('./manifest');
10
+ const { STAGES, validVersion, validateVersionManifest } = require('./manifest');
11
11
 
12
12
  const PINS = Object.freeze({
13
13
  cuaS1Revision: PINNED_CUA_S1_REVISION,
@@ -23,10 +23,6 @@ const versionDir = (dir, version) => path.join(path.resolve(dir), 'versions', ve
23
23
  const activePath = dir => path.join(path.resolve(dir), 'active.json');
24
24
  const hash = bytes => createHash('sha256').update(bytes).digest('hex');
25
25
 
26
- function validVersion(version) {
27
- return typeof version === 'string' && /^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(version)
28
- && version !== '.' && version !== '..';
29
- }
30
26
  function assertVersion(version) {
31
27
  if (!validVersion(version)) throw new Error('invalid-version: use a single safe version id');
32
28
  }
@@ -6,11 +6,15 @@ const path = require('node:path');
6
6
  const STAGES = ['validity', 'intent', 'tier'];
7
7
  const SAFE_ID = /^[a-z0-9._-]{1,80}$/;
8
8
  const HASH = /^[a-f0-9]{64}$/;
9
- const VERSION = /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/;
9
+ const VERSION = /^[a-z0-9][a-z0-9._-]{0,79}$/;
10
10
  const SAFE_PATH_PART = /^[A-Za-z0-9._-]+$/;
11
11
  const exact = (value, keys) => value && typeof value === 'object' && !Array.isArray(value)
12
12
  && Object.keys(value).length === keys.length && keys.every(key => Object.hasOwn(value, key));
13
13
 
14
+ function validVersion(version) {
15
+ return typeof version === 'string' && VERSION.test(version);
16
+ }
17
+
14
18
  function safeRelative(value) {
15
19
  return typeof value === 'string' && value.length > 0 && !value.includes('\\')
16
20
  && !path.posix.isAbsolute(value) && !path.win32.isAbsolute(value)
@@ -20,7 +24,7 @@ function safeRelative(value) {
20
24
  function validateVersionManifest(manifest, expectedVersion) {
21
25
  const fail = detail => { throw new TypeError(`invalid-manifest: ${detail}`); };
22
26
  if (!exact(manifest, ['schemaVersion', 'version', 'createdAt', 'stages', 'evaluation'])
23
- || manifest.schemaVersion !== 1 || typeof manifest.version !== 'string' || !VERSION.test(manifest.version)
27
+ || manifest.schemaVersion !== 1 || !validVersion(manifest.version)
24
28
  || (expectedVersion !== undefined && manifest.version !== expectedVersion)
25
29
  || typeof manifest.createdAt !== 'string' || !Number.isFinite(Date.parse(manifest.createdAt))
26
30
  || !exact(manifest.stages, STAGES)
@@ -63,4 +67,4 @@ if (require.main === module) {
63
67
  } catch (_) { process.exitCode = 1; }
64
68
  }
65
69
 
66
- module.exports = { STAGES, validateVersionManifest };
70
+ module.exports = { STAGES, validVersion, validateVersionManifest };
@@ -5,7 +5,7 @@ const path = require('node:path');
5
5
  const { createHash } = require('node:crypto');
6
6
  const { spawnSync } = require('node:child_process');
7
7
  const { createRequest, validateRequest, validateResponse } = require('./contract');
8
- const { STAGES, validateVersionManifest } = require('./manifest');
8
+ const { STAGES, validVersion, validateVersionManifest } = require('./manifest');
9
9
  // Upstream cua_s1 source revision documented in docs/system-one-routing.md.
10
10
  const PINNED_CUA_S1_REVISION = 'b7f7e2d8714609853a29c7d049140bc46aec0954';
11
11
  const ADAPTER = path.join(__dirname, 'cua_adapter.py');
@@ -18,7 +18,6 @@ const adapterName = value => typeof value === 'string' && /^[a-z][a-z0-9_-]{0,63
18
18
  // Thresholds calibrated on validation for this checkpoint (docs/system-one-training.md).
19
19
  const inRange = (v, lo, hi) => typeof v === 'number' && Number.isFinite(v) && v >= lo && v <= hi;
20
20
  const LIVE_STAGES = STAGES;
21
- const SAFE_ID = /^[a-z0-9._-]{1,80}$/;
22
21
  const sha256 = value => createHash('sha256').update(value).digest('hex');
23
22
  const MAX_LAYER_BYTES = 32 * 1024 * 1024;
24
23
  // secondaryThreshold is optional and belongs to intent checkpoints (docs/system-one-intent.md#scoring).
@@ -141,9 +140,9 @@ function readActive(env = process.env) {
141
140
  if (!pointerStat.isFile() || pointerStat.isSymbolicLink() || pointerStat.size > 65536) return null;
142
141
  const pointer = JSON.parse(fs.readFileSync(pointerPath, 'utf8'));
143
142
  if (!exact(pointer, ['schemaVersion', 'version', 'dir', 'previous', 'activatedAt']) || pointer.schemaVersion !== 1
144
- || typeof pointer.version !== 'string' || !SAFE_ID.test(pointer.version)
143
+ || !validVersion(pointer.version)
145
144
  || typeof pointer.dir !== 'string' || !path.isAbsolute(pointer.dir)
146
- || !(pointer.previous === null || (typeof pointer.previous === 'string' && SAFE_ID.test(pointer.previous)))
145
+ || !(pointer.previous === null || validVersion(pointer.previous))
147
146
  || typeof pointer.activatedAt !== 'string' || !Number.isFinite(Date.parse(pointer.activatedAt))) return null;
148
147
  const dir = pointer.dir;
149
148
  const dirStat = fs.lstatSync(dir);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "harness-enforcement",
3
3
  "description": "Repository inventory for the opencode enforcement plugin and its standalone helper",
4
- "version": "1.5.2",
4
+ "version": "1.5.4",
5
5
  "runtime": "index.mjs",
6
6
  "hooks": {
7
7
  "verify": "hooks/verify.js"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "harness-everything",
3
- "version": "1.5.2",
3
+ "version": "1.5.4",
4
4
  "description": "Harness OS: An Orchestrated Agent Operating System for AI-driven Development",
5
5
  "main": "harness-everything/scripts/bootstrap.js",
6
6
  "bin": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "harness-everything",
3
- "version": "1.5.2",
3
+ "version": "1.5.4",
4
4
  "description": "Invariant-first engineering harness for routing, verification, and failure recovery while preserving agent autonomy.",
5
5
  "author": {
6
6
  "name": "Miya Daniel",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "harness-everything",
3
- "version": "1.5.2",
3
+ "version": "1.5.4",
4
4
  "description": "Invariant-first engineering harness for routing, verification, and failure recovery while preserving agent autonomy.",
5
5
  "author": {
6
6
  "name": "Miya Daniel",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
3
3
  "name": "harness-everything",
4
- "version": "1.5.2",
4
+ "version": "1.5.4",
5
5
  "description": "Invariant-first engineering harness for routing, verification, and failure recovery while preserving agent autonomy.",
6
6
  "author": {
7
7
  "name": "Miya Daniel",
@@ -4,7 +4,7 @@ description: "Route software/project work through Harness: classify tier/topolog
4
4
  license: Apache-2.0
5
5
  metadata:
6
6
  author: Miya Daniel
7
- version: 1.5.2
7
+ version: 1.5.4
8
8
  ---
9
9
 
10
10
  # Harness Everything
@@ -195,9 +195,9 @@ def load_active_bundle(active_path, expected_fingerprint=None, scorer_loader=Non
195
195
  pointer = json.loads(active_path.read_text(encoding='utf-8'))
196
196
  if (not isinstance(pointer, dict) or set(pointer) != {'schemaVersion', 'version', 'dir', 'previous', 'activatedAt'}
197
197
  or pointer.get('schemaVersion') != 1 or not isinstance(pointer.get('version'), str)
198
- or not ID_PATTERN.fullmatch(pointer['version']) or not isinstance(pointer.get('dir'), str)
198
+ or not VERSION_PATTERN.fullmatch(pointer['version']) or not isinstance(pointer.get('dir'), str)
199
199
  or not Path(pointer['dir']).is_absolute()
200
- or (pointer.get('previous') is not None and (not isinstance(pointer['previous'], str) or not ID_PATTERN.fullmatch(pointer['previous'])))
200
+ or (pointer.get('previous') is not None and (not isinstance(pointer['previous'], str) or not VERSION_PATTERN.fullmatch(pointer['previous'])))
201
201
  or not isinstance(pointer.get('activatedAt'), str)):
202
202
  raise ValueError('active-pointer')
203
203
  directory = Path(pointer['dir'])
@@ -260,6 +260,8 @@ MAX_CLIENTS = 64
260
260
  READ_DEADLINE_S = 1.0 # never longer than the Node client's 1000 ms call deadline
261
261
  STARTUP_REASONS = ('artifact-hash', 'checkpoint-format')
262
262
  ID_PATTERN = re.compile(r'[a-z0-9._-]{1,80}')
263
+ # Version IDs match manifest.js; request tasks and options use ID_PATTERN.
264
+ VERSION_PATTERN = re.compile(r'[a-z0-9][a-z0-9._-]{0,79}')
263
265
  HASH_PATTERN = re.compile(r'[0-9a-f]{64}')
264
266
  _USER_SID = []
265
267
 
@@ -7,7 +7,7 @@ const path = require('node:path');
7
7
  const { createHash, randomBytes } = require('node:crypto');
8
8
  const { spawnSync } = require('node:child_process');
9
9
  const { PINNED_CUA_S1_REVISION } = require('./provider');
10
- const { STAGES, validateVersionManifest } = require('./manifest');
10
+ const { STAGES, validVersion, validateVersionManifest } = require('./manifest');
11
11
 
12
12
  const PINS = Object.freeze({
13
13
  cuaS1Revision: PINNED_CUA_S1_REVISION,
@@ -23,10 +23,6 @@ const versionDir = (dir, version) => path.join(path.resolve(dir), 'versions', ve
23
23
  const activePath = dir => path.join(path.resolve(dir), 'active.json');
24
24
  const hash = bytes => createHash('sha256').update(bytes).digest('hex');
25
25
 
26
- function validVersion(version) {
27
- return typeof version === 'string' && /^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(version)
28
- && version !== '.' && version !== '..';
29
- }
30
26
  function assertVersion(version) {
31
27
  if (!validVersion(version)) throw new Error('invalid-version: use a single safe version id');
32
28
  }
@@ -6,11 +6,15 @@ const path = require('node:path');
6
6
  const STAGES = ['validity', 'intent', 'tier'];
7
7
  const SAFE_ID = /^[a-z0-9._-]{1,80}$/;
8
8
  const HASH = /^[a-f0-9]{64}$/;
9
- const VERSION = /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/;
9
+ const VERSION = /^[a-z0-9][a-z0-9._-]{0,79}$/;
10
10
  const SAFE_PATH_PART = /^[A-Za-z0-9._-]+$/;
11
11
  const exact = (value, keys) => value && typeof value === 'object' && !Array.isArray(value)
12
12
  && Object.keys(value).length === keys.length && keys.every(key => Object.hasOwn(value, key));
13
13
 
14
+ function validVersion(version) {
15
+ return typeof version === 'string' && VERSION.test(version);
16
+ }
17
+
14
18
  function safeRelative(value) {
15
19
  return typeof value === 'string' && value.length > 0 && !value.includes('\\')
16
20
  && !path.posix.isAbsolute(value) && !path.win32.isAbsolute(value)
@@ -20,7 +24,7 @@ function safeRelative(value) {
20
24
  function validateVersionManifest(manifest, expectedVersion) {
21
25
  const fail = detail => { throw new TypeError(`invalid-manifest: ${detail}`); };
22
26
  if (!exact(manifest, ['schemaVersion', 'version', 'createdAt', 'stages', 'evaluation'])
23
- || manifest.schemaVersion !== 1 || typeof manifest.version !== 'string' || !VERSION.test(manifest.version)
27
+ || manifest.schemaVersion !== 1 || !validVersion(manifest.version)
24
28
  || (expectedVersion !== undefined && manifest.version !== expectedVersion)
25
29
  || typeof manifest.createdAt !== 'string' || !Number.isFinite(Date.parse(manifest.createdAt))
26
30
  || !exact(manifest.stages, STAGES)
@@ -63,4 +67,4 @@ if (require.main === module) {
63
67
  } catch (_) { process.exitCode = 1; }
64
68
  }
65
69
 
66
- module.exports = { STAGES, validateVersionManifest };
70
+ module.exports = { STAGES, validVersion, validateVersionManifest };
@@ -5,7 +5,7 @@ const path = require('node:path');
5
5
  const { createHash } = require('node:crypto');
6
6
  const { spawnSync } = require('node:child_process');
7
7
  const { createRequest, validateRequest, validateResponse } = require('./contract');
8
- const { STAGES, validateVersionManifest } = require('./manifest');
8
+ const { STAGES, validVersion, validateVersionManifest } = require('./manifest');
9
9
  // Upstream cua_s1 source revision documented in docs/system-one-routing.md.
10
10
  const PINNED_CUA_S1_REVISION = 'b7f7e2d8714609853a29c7d049140bc46aec0954';
11
11
  const ADAPTER = path.join(__dirname, 'cua_adapter.py');
@@ -18,7 +18,6 @@ const adapterName = value => typeof value === 'string' && /^[a-z][a-z0-9_-]{0,63
18
18
  // Thresholds calibrated on validation for this checkpoint (docs/system-one-training.md).
19
19
  const inRange = (v, lo, hi) => typeof v === 'number' && Number.isFinite(v) && v >= lo && v <= hi;
20
20
  const LIVE_STAGES = STAGES;
21
- const SAFE_ID = /^[a-z0-9._-]{1,80}$/;
22
21
  const sha256 = value => createHash('sha256').update(value).digest('hex');
23
22
  const MAX_LAYER_BYTES = 32 * 1024 * 1024;
24
23
  // secondaryThreshold is optional and belongs to intent checkpoints (docs/system-one-intent.md#scoring).
@@ -141,9 +140,9 @@ function readActive(env = process.env) {
141
140
  if (!pointerStat.isFile() || pointerStat.isSymbolicLink() || pointerStat.size > 65536) return null;
142
141
  const pointer = JSON.parse(fs.readFileSync(pointerPath, 'utf8'));
143
142
  if (!exact(pointer, ['schemaVersion', 'version', 'dir', 'previous', 'activatedAt']) || pointer.schemaVersion !== 1
144
- || typeof pointer.version !== 'string' || !SAFE_ID.test(pointer.version)
143
+ || !validVersion(pointer.version)
145
144
  || typeof pointer.dir !== 'string' || !path.isAbsolute(pointer.dir)
146
- || !(pointer.previous === null || (typeof pointer.previous === 'string' && SAFE_ID.test(pointer.previous)))
145
+ || !(pointer.previous === null || validVersion(pointer.previous))
147
146
  || typeof pointer.activatedAt !== 'string' || !Number.isFinite(Date.parse(pointer.activatedAt))) return null;
148
147
  const dir = pointer.dir;
149
148
  const dirStat = fs.lstatSync(dir);