@sabaiway/agent-workflow-kit 23.3.1 → 23.4.1

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 (54) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/README.md +1 -1
  3. package/SKILL.md +1 -1
  4. package/bridges/antigravity-cli-bridge/SKILL.md +2 -2
  5. package/bridges/antigravity-cli-bridge/bin/agy-review-harness.test.mjs +7 -1
  6. package/bridges/antigravity-cli-bridge/bin/agy-review-honesty.test.mjs +2 -1
  7. package/bridges/antigravity-cli-bridge/bin/agy-review-model-screen.test.mjs +2 -1
  8. package/bridges/antigravity-cli-bridge/bin/agy-review.sh +18 -10
  9. package/bridges/antigravity-cli-bridge/bin/agy-review.test.mjs +50 -50
  10. package/bridges/antigravity-cli-bridge/bin/agy.sh +6 -2
  11. package/bridges/antigravity-cli-bridge/bin/agy.test.mjs +5 -5
  12. package/bridges/antigravity-cli-bridge/capability.json +2 -2
  13. package/bridges/antigravity-cli-bridge/references/models-and-flags.md +1 -1
  14. package/bridges/antigravity-cli-bridge/setup/README.md +1 -1
  15. package/bridges/codex-cli-bridge/SKILL.md +1 -1
  16. package/bridges/codex-cli-bridge/bin/codex-exec-jev.test.mjs +73 -93
  17. package/bridges/codex-cli-bridge/bin/codex-exec.sh +7 -3
  18. package/bridges/codex-cli-bridge/bin/codex-exec.test.mjs +6 -10
  19. package/bridges/codex-cli-bridge/bin/codex-fixtures-harness.test.mjs +77 -0
  20. package/bridges/codex-cli-bridge/bin/codex-fixtures.test.mjs +215 -0
  21. package/bridges/codex-cli-bridge/bin/codex-model-posture.test.mjs +18 -18
  22. package/bridges/codex-cli-bridge/bin/codex-review-honesty.test.mjs +2 -1
  23. package/bridges/codex-cli-bridge/bin/codex-review-jev.test.mjs +13 -13
  24. package/bridges/codex-cli-bridge/bin/codex-review.sh +17 -10
  25. package/bridges/codex-cli-bridge/bin/codex-review.test.mjs +30 -29
  26. package/bridges/codex-cli-bridge/capability.json +1 -1
  27. package/bridges/typesafe-jev-bridge/SKILL.md +19 -12
  28. package/bridges/typesafe-jev-bridge/bin/jev-ask-harness.test.mjs +109 -0
  29. package/bridges/typesafe-jev-bridge/bin/jev-ask.sh +9 -4
  30. package/bridges/typesafe-jev-bridge/bin/jev-ask.test.mjs +108 -104
  31. package/bridges/typesafe-jev-bridge/bin/jev-client.mjs +27 -13
  32. package/bridges/typesafe-jev-bridge/capability.json +11 -1
  33. package/capability.json +1 -1
  34. package/package.json +2 -1
  35. package/references/modes/bridge-settings.md +6 -5
  36. package/references/modes/coverage-check.md +1 -1
  37. package/tools/apply-danger-check.mjs +2 -2
  38. package/tools/bridge-settings-read.mjs +8 -3
  39. package/tools/bridge-settings.mjs +28 -43
  40. package/tools/coverage-check.mjs +9 -8
  41. package/tools/detect-backends.mjs +1 -1
  42. package/tools/distribution-files/retired.mjs +7 -7
  43. package/tools/distribution-files/scripts.mjs +10 -11
  44. package/tools/ensure-ops.mjs +21 -21
  45. package/tools/ensure-specs.mjs +10 -9
  46. package/tools/family-registry.mjs +4 -4
  47. package/tools/git-hooks.mjs +5 -5
  48. package/tools/manifest/schema.md +4 -1
  49. package/tools/manifest/validate.mjs +10 -0
  50. package/tools/node-evidence.mjs +14 -12
  51. package/tools/recommendations.mjs +2 -2
  52. package/tools/review-state-build.mjs +3 -2
  53. package/tools/review-state.mjs +1 -1
  54. package/tools/write-lanes.mjs +2 -2
@@ -1,79 +1,64 @@
1
- import { describe, it, after } from 'node:test';
1
+ import { describe, it } from 'node:test';
2
2
  import assert from 'node:assert/strict';
3
3
  import { mkdirSync, mkdtempSync, writeFileSync, readFileSync, existsSync, rmSync, cpSync, chmodSync, realpathSync, statSync, symlinkSync } from 'node:fs';
4
4
  import { tmpdir } from 'node:os';
5
5
  import { join, dirname } from 'node:path';
6
6
  import { fileURLToPath } from 'node:url';
7
7
  import { spawnSync } from 'node:child_process';
8
+ import { makeFixtureRepo, openSuiteScopes } from './codex-fixtures-harness.test.mjs';
8
9
  const stripGitLocationEnv = (env) => Object.fromEntries(Object.entries(env).filter(([key]) => !/^[Gg][Ii][Tt]_/.test(key)));
9
10
  const HERE = dirname(fileURLToPath(import.meta.url));
10
11
  const EXEC = join(HERE, 'codex-exec.sh');
11
12
  const HOSTS = 'api.typesafe.ai,docs.typesafe.ai';
12
13
  const childEnv = (home, env = {}) => ({ ...stripGitLocationEnv(env), HOME: home, XDG_CONFIG_HOME: join(home, '.config'),
13
14
  GIT_CONFIG_GLOBAL: '/dev/null', GIT_CONFIG_SYSTEM: '/dev/null', GIT_CONFIG_NOSYSTEM: '1', GIT_ATTR_NOSYSTEM: '1', LC_ALL: 'C' });
14
- const FIXTURES = join(HERE, '..', 'node_modules', '.aw-fixtures');
15
- const TMP = join(FIXTURES, 'tmp');
16
- mkdirSync(TMP, { recursive: true });
17
- mkdirSync(join(FIXTURES, 'repos'), { recursive: true });
18
- const ROOT = mkdtempSync(join(FIXTURES, 'repos', 'exec-jev-'));
19
- after(() => rmSync(ROOT, { recursive: true, force: true }));
15
+ const { repos, tmp, profileSkip } = await openSuiteScopes('codex-exec-jev');
20
16
  const REAL_UNAME = spawnSync('bash', ['-c', 'type -P uname'], { encoding: 'utf8' }).stdout.trim();
21
17
  const FAKE_CODEX = [
22
18
  '#!/usr/bin/env bash', 'set -u',
23
- 'st() { if [[ -n "${!1+x}" ]]; then printf "[%s]" "${!1}"; else printf unset; fi; }',
24
- 'rec() { echo "$1 key=$(st TYPESAFE_API_KEY) openai=$(st OPENAI_API_KEY) codex=$(st CODEX_API_KEY) foo=$(st FOO_API_KEY) base=$(st OPENAI_BASE_URL) bar=$(st BAR_API_KEY)" >>"$CODEX_FAKE_LOG"; }',
25
- 'case "${1:-}" in',
26
- ' login) rec login; echo "Logged in using ChatGPT"; exit 0 ;;',
27
- ' --version) rec version; echo "${CODEX_FAKE_VERSION-codex-cli 0.160.0}"; exit 0 ;;',
28
- ' debug) rec catalog; cat <<EOF',
19
+ 'st() { if [[ -n "${!1+x}" ]]; then printf "[%s]" "${!1}"; else printf unset; fi; }', 'rec() { echo "$1 key=$(st TYPESAFE_API_KEY) openai=$(st OPENAI_API_KEY) codex=$(st CODEX_API_KEY) foo=$(st FOO_API_KEY) base=$(st OPENAI_BASE_URL) bar=$(st BAR_API_KEY)" >>"$CODEX_FAKE_LOG"; }',
20
+ 'case "${1:-}" in', ' login) rec login; echo "Logged in using ChatGPT"; exit 0 ;;',
21
+ ' --version) rec version; echo "${CODEX_FAKE_VERSION-codex-cli 0.160.0}"; exit 0 ;;', ' debug) rec catalog; cat <<EOF',
29
22
  '{"models":[{"slug":"gpt-6.1-sol","priority":1,"visibility":"list","default_reasoning_level":"low","supported_reasoning_levels":[{"effort":"low"},{"effort":"medium"},{"effort":"high"}]}]}',
30
- 'EOF', ' exit 0 ;;',
31
- 'esac', 'rec run',
32
- '{ for a in "$@"; do echo "$a"; done; } >"$CODEX_FAKE_ARGV"',
33
- 'cat >"$CODEX_FAKE_STDIN"',
34
- 'out=""; prev=""; for a in "$@"; do if [[ "$prev" == "-o" ]]; then out="$a"; fi; prev="$a"; done',
35
- 'if [[ -n "$out" ]]; then echo "${CODEX_FAKE_FINAL:-FAKE_FINAL}" >"$out"; fi',
36
- 'echo "{\\"type\\":\\"thread.started\\",\\"thread_id\\":\\"sess-jev\\"}"',
37
- 'if [[ -n "${CODEX_FAKE_PRE:-}" ]]; then echo "$CODEX_FAKE_PRE"; fi',
38
- 'echo "{\\"type\\":\\"turn.started\\"}"',
39
- 'if [[ -n "${CODEX_FAKE_POST:-}" ]]; then echo "$CODEX_FAKE_POST"; fi',
40
- 'echo "{\\"type\\":\\"turn.completed\\",\\"usage\\":{}}"',
41
- 'exit "${CODEX_FAKE_EXIT:-0}"',
42
- '',
23
+ 'EOF', ' exit 0 ;;', 'esac', 'rec run',
24
+ '{ for a in "$@"; do echo "$a"; done; } >"$CODEX_FAKE_ARGV"', 'cat >"$CODEX_FAKE_STDIN"',
25
+ 'out=""; prev=""; for a in "$@"; do if [[ "$prev" == "-o" ]]; then out="$a"; fi; prev="$a"; done', 'if [[ -n "$out" ]]; then echo "${CODEX_FAKE_FINAL:-FAKE_FINAL}" >"$out"; fi',
26
+ 'echo "{\\"type\\":\\"thread.started\\",\\"thread_id\\":\\"sess-jev\\"}"', 'if [[ -n "${CODEX_FAKE_PRE:-}" ]]; then echo "$CODEX_FAKE_PRE"; fi',
27
+ 'echo "{\\"type\\":\\"turn.started\\"}"', 'if [[ -n "${CODEX_FAKE_POST:-}" ]]; then echo "$CODEX_FAKE_POST"; fi',
28
+ 'echo "{\\"type\\":\\"turn.completed\\",\\"usage\\":{}}"', 'exit "${CODEX_FAKE_EXIT:-0}"', '',
43
29
  ].join('\n');
44
- const FAKE_UNAME = ['#!/usr/bin/env bash', 'if [[ $# -eq 0 || "$1" == "-s" ]]; then echo "${CODEX_FAKE_UNAME:-Linux}"; exit 0; fi',
45
- `exec "${REAL_UNAME}" "$@"`, ''].join('\n');
30
+ const FAKE_UNAME = ['#!/usr/bin/env bash', 'if [[ $# -eq 0 || "$1" == "-s" ]]; then echo "${CODEX_FAKE_UNAME:-Linux}"; exit 0; fi', `exec "${REAL_UNAME}" "$@"`, ''].join('\n');
46
31
  const CONTRACT = '# dispatch\n\n```aw-dispatch-contract\n{"nonce":"n1","scope":"probe"}\n```\n';
47
- const initRepo = (repo) => {
48
- mkdirSync(repo, { recursive: true });
49
- const git = (...args) => spawnSync('git', args, { cwd: repo, encoding: 'utf8', env: childEnv(join(ROOT, 'template', 'home'), { PATH: process.env.PATH }) });
50
- git('init', '-q');
32
+ const TEMPLATE = join(repos, 'template');
33
+ for (const name of ['bin', 'home', 'repo']) mkdirSync(join(TEMPLATE, name), { recursive: true });
34
+ for (const [name, body] of [['codex', FAKE_CODEX], ['uname', FAKE_UNAME]]) writeFileSync(join(TEMPLATE, 'bin', name), body, { mode: 0o755 });
35
+ {
36
+ const repo = join(TEMPLATE, 'repo');
37
+ const git = (...args) => {
38
+ const result = spawnSync('git', args, { cwd: repo, encoding: 'utf8', env: childEnv(join(TEMPLATE, 'home'), { PATH: process.env.PATH }) });
39
+ assert.ifError(result.error);
40
+ assert.equal(result.signal, null, result.stderr);
41
+ assert.equal(result.status, 0, result.stderr);
42
+ };
43
+ makeFixtureRepo((args) => git(...args), repo, ['-q']);
51
44
  git('config', 'user.email', 'probe@example.com');
52
45
  git('config', 'user.name', 'probe');
53
46
  writeFileSync(join(repo, 'AGENTS.md'), '# AGENTS\n\nHard Constraints: none (test fixture).\n');
54
47
  git('add', '-A');
55
48
  git('commit', '-qm', 'base');
56
49
  writeFileSync(join(repo, 'task.md'), CONTRACT);
57
- };
58
- const TEMPLATE = join(ROOT, 'template');
59
- mkdirSync(join(TEMPLATE, 'bin'), { recursive: true });
60
- mkdirSync(join(TEMPLATE, 'home'));
61
- writeFileSync(join(TEMPLATE, 'bin', 'codex'), FAKE_CODEX);
62
- writeFileSync(join(TEMPLATE, 'bin', 'uname'), FAKE_UNAME);
63
- initRepo(join(TEMPLATE, 'repo'));
64
- const sandbox = () => {
65
- const dir = mkdtempSync(join(ROOT, 'sb-'));
50
+ }
51
+ const sandbox = (root = tmp) => {
52
+ const dir = mkdtempSync(join(root, 'sb-'));
66
53
  cpSync(TEMPLATE, dir, { recursive: true });
67
- for (const name of ['codex', 'uname']) chmodSync(join(dir, 'bin', name), 0o755);
68
- return { dir, bin: join(dir, 'bin'), home: join(dir, 'home'), repo: join(dir, 'repo'),
69
- state: join(dir, 'home', '.local', 'state', 'agent-workflow', 'codex-jev-profile-refused') };
54
+ return { dir, bin: join(dir, 'bin'), home: join(dir, 'home'), repo: join(dir, 'repo'), state: join(dir, 'home', '.local', 'state', 'agent-workflow', 'codex-jev-profile-refused') };
70
55
  };
71
56
  const drive = (sb, args, env = {}, cwd = sb.repo) => {
72
57
  const cap = (name) => join(sb.dir, name);
73
58
  for (const name of ['log', 'argv', 'stdin']) rmSync(cap(name), { force: true });
74
59
  const r = spawnSync('bash', [sb.wrapper ?? EXEC, ...args], {
75
60
  cwd, input: 'do the thing', encoding: 'utf8', timeout: 60000,
76
- env: childEnv(sb.home, { PATH: `${sb.bin}:${process.env.PATH}`, TMPDIR: TMP, CODEX_FAKE_LOG: cap('log'),
61
+ env: childEnv(sb.home, { PATH: `${sb.bin}:${process.env.PATH}`, TMPDIR: tmp, CODEX_FAKE_LOG: cap('log'),
77
62
  CODEX_FAKE_ARGV: cap('argv'), CODEX_FAKE_STDIN: cap('stdin'), ...env }),
78
63
  });
79
64
  assert.ifError(r.error);
@@ -143,8 +128,7 @@ const OTHER_SHAPE = item({ id: 'item_0', type: 'error', message: 'Unknown config
143
128
  const command = (output, exitCode, status) => item({ id: 'item_1', type: 'command_execution', command: 'bash -lc ls', aggregated_output: output, exit_code: exitCode, status });
144
129
  const BWRAP = 'bwrap: execvp /usr/lib/node_modules/@openai/codex/vendor/x86_64-unknown-linux-musl/bin/codex: No such file or directory\n';
145
130
  const receiptOf = (sb) => JSON.parse(readFileSync(join(sb.repo, '.git', 'agent-workflow-exec-receipt-5-codex-n1.json'), 'utf8'));
146
- const RECEIPT_KEYS = ['schema', 'kind', 'state', 'backend', 'nonce', 'owner', 'contractDigest', 'wrapperVersion', 'posture', 'capS',
147
- 'killGraceS', 'sessionId', 'exitStatus', 'outcome', 'reportDigest', 'reportLength', 'timestamp'];
131
+ const RECEIPT_KEYS = ['schema', 'kind', 'state', 'backend', 'nonce', 'owner', 'contractDigest', 'wrapperVersion', 'posture', 'capS', 'killGraceS', 'sessionId', 'exitStatus', 'outcome', 'reportDigest', 'reportLength', 'timestamp'];
148
132
  const stateLines = (sb) => (existsSync(sb.state) ? readFileSync(sb.state, 'utf8').split('\n').filter(Boolean) : []);
149
133
  describe('the key rule on codex-exec — spec:jev-every-run/S1', () => {
150
134
  it('a fresh run hands codex only TYPESAFE_API_KEY of the keys, and the login, version and catalog spawns see the same env', () => {
@@ -155,16 +139,16 @@ describe('the key rule on codex-exec — spec:jev-every-run/S1', () => {
155
139
  });
156
140
  });
157
141
  describe('a resumed run — spec:jev-every-run/S2', () => {
158
- it('keeps the key rule and carries the profile overrides with no sandbox_mode', () => {
159
- const r = drive(sandbox(), ['--resume', 'sess-1', '-'], KEYS);
142
+ it('keeps the key rule and carries the profile overrides with no sandbox_mode', { skip: profileSkip }, () => {
143
+ const r = drive(sandbox(repos), ['--resume', 'sess-1', '-'], KEYS);
160
144
  assertProfile(r);
161
145
  assert.deepEqual(r.argv.slice(0, 3), ['exec', 'resume', 'sess-1']);
162
146
  for (const [kind, env] of spawnsOf(r)) assert.equal(env, PASSED, `${kind} spawn`);
163
147
  });
164
148
  });
165
149
  describe('an empty key and an unset key — spec:jev-every-run/S5', () => {
166
- it('an empty TYPESAFE_API_KEY reaches codex empty, an unset one stays unset, and the argv is the same with the key set', () => {
167
- const runs = ['jev-key', '', undefined].map((value) => drive(sandbox(), ['-'], { TYPESAFE_API_KEY: value }));
150
+ it('an empty TYPESAFE_API_KEY reaches codex empty, an unset one stays unset, and the argv is the same with the key set', { skip: profileSkip }, () => {
151
+ const runs = ['jev-key', '', undefined].map((value) => drive(sandbox(repos), ['-'], { TYPESAFE_API_KEY: value }));
168
152
  assert.deepEqual(runs.map((r) => runEnv(r)?.split(' ')[0]), ['key=[jev-key]', 'key=[]', 'key=unset']);
169
153
  const normalized = runs.map((r) => r.argv.map((arg, i) => (r.argv[i - 1] === '-o' ? '<out>' : arg)).join(' '));
170
154
  assert.equal(normalized[1], normalized[0]);
@@ -174,8 +158,8 @@ describe('an empty key and an unset key — spec:jev-every-run/S5', () => {
174
158
  });
175
159
  describe('the exec profile on Linux from codex-cli 0.160.0 — spec:jev-every-run/S7', () => {
176
160
  for (const version of ['0.160.0', '0.161.0', '1.0.0']) {
177
- it(`codex-cli ${version}: the exec profile exactly, neither --sandbox nor sandbox_mode`, () => {
178
- assertProfile(drive(sandbox(), ['-'], { CODEX_FAKE_VERSION: `codex-cli ${version}` }));
161
+ it(`codex-cli ${version}: the exec profile exactly, neither --sandbox nor sandbox_mode`, { skip: profileSkip }, () => {
162
+ assertProfile(drive(sandbox(repos), ['-'], { CODEX_FAKE_VERSION: `codex-cli ${version}` }));
179
163
  });
180
164
  }
181
165
  });
@@ -186,8 +170,8 @@ describe('the fallback by OS and by temp root — spec:jev-every-run/S9', () =>
186
170
  assert.equal(runEnv(r), PASSED);
187
171
  assert.equal(bannerOf(r), unreachable('not linux (Darwin)'));
188
172
  });
189
- it('a repository root under the realpath of TMPDIR falls back; a sibling sharing its name prefix does not', () => {
190
- const sb = sandbox();
173
+ it('a repository root under the realpath of TMPDIR falls back; a sibling sharing its name prefix does not', { skip: profileSkip }, () => {
174
+ const sb = sandbox(repos);
191
175
  const root = join(sb.dir, 'pfx');
192
176
  cpSync(sb.repo, join(root, 'repo'), { recursive: true });
193
177
  const under = drive(sb, ['-'], { ...KEYS, TMPDIR: root }, join(root, 'repo'));
@@ -197,8 +181,8 @@ describe('the fallback by OS and by temp root — spec:jev-every-run/S9', () =>
197
181
  cpSync(sb.repo, join(sb.dir, 'pfx-repo'), { recursive: true });
198
182
  assertProfile(drive(sb, ['-'], { TMPDIR: root }, join(sb.dir, 'pfx-repo')));
199
183
  });
200
- it('a worktree whose git common dir is under TMPDIR falls back', () => {
201
- const sb = sandbox();
184
+ it('a worktree whose git common dir is under TMPDIR falls back', { skip: profileSkip }, () => {
185
+ const sb = sandbox(repos);
202
186
  const root = join(sb.dir, 'tmproot');
203
187
  cpSync(sb.repo, join(root, 'main'), { recursive: true });
204
188
  spawnSync('git', ['worktree', 'add', '-q', join(sb.dir, 'wt')], { cwd: join(root, 'main'), encoding: 'utf8', env: childEnv(sb.home, { PATH: process.env.PATH }) });
@@ -216,16 +200,12 @@ describe('the fallback by OS and by temp root — spec:jev-every-run/S9', () =>
216
200
  assert.equal(bannerOf(old), unreachable(`repository under ${realpathSync(root)}`));
217
201
  });
218
202
  it('a repository under /tmp falls back naming /tmp', () => {
219
- const repo = mkdtempSync(join(tmpdir(), 'exec-jev-tmp-'));
220
- try {
221
- cpSync(join(TEMPLATE, 'repo'), repo, { recursive: true });
222
- const underTmp = realpathSync(repo).startsWith(`${realpathSync('/tmp')}/`);
223
- const r = drive(sandbox(), ['-'], { TMPDIR: underTmp ? TMP : tmpdir() }, repo);
224
- assertFallback(r);
225
- assert.equal(bannerOf(r), unreachable(`repository under ${underTmp ? '/tmp' : realpathSync(tmpdir())}`));
226
- } finally {
227
- rmSync(repo, { recursive: true, force: true });
228
- }
203
+ const repo = mkdtempSync(join(tmp, 'exec-jev-tmp-'));
204
+ cpSync(join(TEMPLATE, 'repo'), repo, { recursive: true });
205
+ const underTmp = realpathSync(repo).startsWith(`${realpathSync('/tmp')}/`);
206
+ const r = drive(sandbox(), ['-'], { TMPDIR: underTmp ? tmp : tmpdir() }, repo);
207
+ assertFallback(r);
208
+ assert.equal(bannerOf(r), unreachable(`repository under ${underTmp ? '/tmp' : realpathSync(tmpdir())}`));
229
209
  });
230
210
  });
231
211
  describe('the fallback by version and by the refused record — spec:jev-every-run/S10', () => {
@@ -239,8 +219,8 @@ describe('the fallback by version and by the refused record — spec:jev-every-r
239
219
  assert.equal(bannerOf(r), unreachable(reason));
240
220
  });
241
221
  }
242
- it('a listed version with this run\'s digest falls back naming the file; another digest or another version runs the profile', () => {
243
- const sb = sandbox();
222
+ it('a listed version with this run\'s digest falls back naming the file; another digest or another version runs the profile', { skip: profileSkip }, () => {
223
+ const sb = sandbox(repos);
244
224
  assert.equal(drive(sb, ['-'], { CODEX_FAKE_PRE: P13 }).status, 72);
245
225
  const [entry] = stateLines(sb);
246
226
  assert.match(entry ?? '', /^0\.160\.0 [0-9a-f]{64}$/);
@@ -257,8 +237,8 @@ describe('the fallback by version and by the refused record — spec:jev-every-r
257
237
  });
258
238
  describe('the profile error item before the turn — spec:jev-every-run/S11', () => {
259
239
  for (const [label, shape] of [['the P13 shape', P13], ['the P1 shape', P1]]) {
260
- it(`${label}, printed twice before turn.started: exit 72, one entry appended, a transport-failure receipt`, () => {
261
- const sb = sandbox();
240
+ it(`${label}, printed twice before turn.started: exit 72, one entry appended, a transport-failure receipt`, { skip: profileSkip }, () => {
241
+ const sb = sandbox(repos);
262
242
  const r = drive(sb, ['--nonce', 'n1', 'task.md'], { CODEX_FAKE_PRE: `${shape}\n${shape}` });
263
243
  assert.equal(r.status, 72, r.stderr);
264
244
  assert.ok(r.stderr.includes(JSON.parse(shape).item.message), 'the matched message is printed');
@@ -271,15 +251,15 @@ describe('the profile error item before the turn — spec:jev-every-run/S11', ()
271
251
  });
272
252
  }
273
253
  for (const [label, env] of [['after turn.started', { CODEX_FAKE_POST: P13 }], ['in another shape', { CODEX_FAKE_PRE: OTHER_SHAPE }]]) {
274
- it(`${label}: the run ends as today and nothing is appended`, () => {
275
- const sb = sandbox();
254
+ it(`${label}: the run ends as today and nothing is appended`, { skip: profileSkip }, () => {
255
+ const sb = sandbox(repos);
276
256
  const r = drive(sb, ['-'], env);
277
257
  assertProfile(r);
278
258
  assert.equal(existsSync(sb.state), false);
279
259
  });
280
260
  }
281
- it('a failed write warns once naming the path and still exits 72 with its receipt', () => {
282
- const sb = sandbox();
261
+ it('a failed write warns once naming the path and still exits 72 with its receipt', { skip: profileSkip }, () => {
262
+ const sb = sandbox(repos);
283
263
  mkdirSync(dirname(dirname(sb.state)), { recursive: true });
284
264
  writeFileSync(dirname(sb.state), 'a file where the state directory belongs\n');
285
265
  const r = drive(sb, ['--nonce', 'n1', 'task.md'], { CODEX_FAKE_PRE: P13 });
@@ -289,8 +269,8 @@ describe('the profile error item before the turn — spec:jev-every-run/S11', ()
289
269
  });
290
270
  });
291
271
  describe('bwrap: execvp in a failed command — spec:jev-every-run/S12', () => {
292
- it('exits 72 without touching the state file', () => {
293
- const sb = sandbox();
272
+ it('exits 72 without touching the state file', { skip: profileSkip }, () => {
273
+ const sb = sandbox(repos);
294
274
  const r = drive(sb, ['--nonce', 'n1', 'task.md'], { CODEX_FAKE_POST: command(BWRAP, 1, 'failed') });
295
275
  assert.equal(r.status, 72, r.stderr);
296
276
  assert.ok(r.stderr.includes('bwrap: execvp'), r.stderr);
@@ -299,8 +279,8 @@ describe('bwrap: execvp in a failed command — spec:jev-every-run/S12', () => {
299
279
  });
300
280
  });
301
281
  describe('the same strings where they never fire — spec:jev-every-run/S13', () => {
302
- it('inside a successful command\'s output and in the final message: exit 0, a success receipt, no state file', () => {
303
- const sb = sandbox();
282
+ it('inside a successful command\'s output and in the final message: exit 0, a success receipt, no state file', { skip: profileSkip }, () => {
283
+ const sb = sandbox(repos);
304
284
  const r = drive(sb, ['--nonce', 'n1', 'task.md'], { CODEX_FAKE_POST: command(`${P13_TEXT}\n${BWRAP}`, 0, 'completed'),
305
285
  CODEX_FAKE_FINAL: `${P13_TEXT} ${BWRAP}` });
306
286
  assertProfile(r);
@@ -310,8 +290,8 @@ describe('the same strings where they never fire — spec:jev-every-run/S13', ()
310
290
  });
311
291
  });
312
292
  describe('the exec banner and the receipt — spec:jev-every-run/S14', () => {
313
- it('a profile run reads sandbox=jev-profile and the two hosts before source=, the receipt keys unchanged', () => {
314
- const sb = sandbox();
293
+ it('a profile run reads sandbox=jev-profile and the two hosts before source=, the receipt keys unchanged', { skip: profileSkip }, () => {
294
+ const sb = sandbox(repos);
315
295
  const r = drive(sb, ['--nonce', 'n1', 'task.md']);
316
296
  assertProfile(r);
317
297
  assert.equal(bannerOf(r), banner('jev-profile', HOSTS));
@@ -325,16 +305,16 @@ describe('the exec banner and the receipt — spec:jev-every-run/S14', () => {
325
305
  });
326
306
  describe('the execution directive and the resume reminder — spec:jev-every-run/S17', () => {
327
307
  const HOST_LINE = 'the reachable host list is api.typesafe.ai, docs.typesafe.ai; network access to any other host is an escalation: STOP and report.';
328
- it('a fresh profile run names the two hosts and the other-host escalation; a fallback run keeps network access whole', () => {
329
- const profile = drive(sandbox(), ['-']);
308
+ it('a fresh profile run names the two hosts and the other-host escalation; a fallback run keeps network access whole', { skip: profileSkip }, () => {
309
+ const profile = drive(sandbox(repos), ['-']);
330
310
  assertProfile(profile);
331
311
  assert.ok(profile.prompt.includes(`5. Do NOT commit. Network: ${HOST_LINE}`), profile.prompt);
332
312
  const fallback = drive(sandbox(), ['-'], { CODEX_FAKE_UNAME: 'Darwin' });
333
313
  assert.ok(fallback.prompt.includes('escalation (network access, writes outside the repo'), fallback.prompt);
334
314
  assert.doesNotMatch(fallback.prompt, /typesafe/);
335
315
  });
336
- it('a resume states its current posture: the hosts on a profile run, network access on the next run of the same session that falls back', () => {
337
- const sb = sandbox();
316
+ it('a resume states its current posture: the hosts on a profile run, network access on the next run of the same session that falls back', { skip: profileSkip }, () => {
317
+ const sb = sandbox(repos);
338
318
  const profile = drive(sb, ['--resume', 'sess-1', '-']);
339
319
  assertProfile(profile);
340
320
  assert.ok(profile.prompt.includes(`Network, as of this run (it replaces any earlier statement): ${HOST_LINE}`), profile.prompt);
@@ -355,8 +335,8 @@ const copyBridge = (sb, transform = (lines) => lines) => {
355
335
  return { ...sb, wrapper };
356
336
  };
357
337
  describe('injected facts through a symlink — spec:jev-every-run/S26', () => {
358
- it('renders only the injected hosts and passes exactly the listed variables, including empty values', () => {
359
- const sb = copyBridge(sandbox(), (lines) => [lines[0], 'HOST=a.example', 'HOST=b.example', 'RUN_HOST=a.example', 'RUN_HOST=b.example', lines.find((line) => line.startsWith('WRITABLE_DIR=')), 'PASSED_VARIABLE=FOO_API_KEY', 'PASSED_VARIABLE=BAR_API_KEY']);
338
+ it('renders only the injected hosts and passes exactly the listed variables, including empty values', { skip: profileSkip }, () => {
339
+ const sb = copyBridge(sandbox(repos), (lines) => [lines[0], 'HOST=a.example', 'HOST=b.example', 'RUN_HOST=a.example', 'RUN_HOST=b.example', lines.find((line) => line.startsWith('WRITABLE_DIR=')), 'PASSED_VARIABLE=FOO_API_KEY', 'PASSED_VARIABLE=BAR_API_KEY']);
360
340
  const env = { ...KEYS, BAR_API_KEY: '' };
361
341
  const fresh = drive(sb, ['-'], env), resume = drive(sb, ['--resume', 'sess-1', '-'], env), help = drive(sb, ['--help'], env);
362
342
  for (const result of [fresh, resume, help]) { assert.equal(result.status, 0, result.stderr); assert.doesNotMatch([result.argv.join(' '), result.prompt, result.stderr, result.stdout].join('\n'), /typesafe\.ai/i); }
@@ -390,10 +370,10 @@ describe('run hosts choose posture and preserve the shipped profile — spec:jev
390
370
  assert.equal(help.status, 0, help.stderr);
391
371
  assert.match(help.stdout.split('\n')[0], /network off/);
392
372
  });
393
- it('characterize-first: both shipped profiles retain the exact overrides and recorded refusal digest', () => {
373
+ it('characterize-first: both shipped profiles retain the exact overrides and recorded refusal digest', { skip: profileSkip }, () => {
394
374
  const common = ['default_permissions=jev', 'permissions.jev.network.enabled=true', 'permissions.jev.network.domains={"api.typesafe.ai"="allow","docs.typesafe.ai"="allow"}'];
395
375
  for (const [wrapper, filesystem, digest] of [['codex-exec.sh', 'permissions.jev.filesystem={":root"="read",":tmpdir"="write",":slash_tmp"="write",":workspace_roots"={"."="write"}}', 'f693ef134a9c6d5b41042b91260726d4179d99ccadc149270f1ddba09cdc99e8'], ['codex-review.sh', 'permissions.jev.filesystem={":root"="read"}', 'c68a3f5f7be241f7cecf5328a3541063e1f25365f216798aff42b719164f9159']]) {
396
- const sb = { ...sandbox(), wrapper: join(HERE, wrapper) };
376
+ const sb = { ...sandbox(repos), wrapper: join(HERE, wrapper) };
397
377
  const result = drive(sb, wrapper === 'codex-exec.sh' ? ['-'] : ['plan', 'task.md'], { CODEX_FAKE_PRE: P13 });
398
378
  assert.equal(result.status, 72, result.stderr);
399
379
  assert.deepEqual(result.argv.flatMap((arg, index) => result.argv[index - 1] === '-c' && /^(default_permissions|permissions\.)/.test(arg) ? ['-c', arg] : []), [...common, filesystem].flatMap((arg) => ['-c', arg]));
@@ -403,8 +383,8 @@ describe('run hosts choose posture and preserve the shipped profile — spec:jev
403
383
  });
404
384
  describe('the probe passthrough under the profile — spec:jev-every-run/S18', () => {
405
385
  for (const flag of [['--add-dir', '/x'], ['-C', '/x'], ['--cd', '/x'], ['--enable', 'foo'], ['--disable', 'foo']]) {
406
- it(`CODEX_PROBE=1 with ${flag[0]}: refused pre-spend under the profile, admitted under the fallback`, () => {
407
- const refused = drive(sandbox(), ['-', '--', ...flag], { CODEX_PROBE: '1' });
386
+ it(`CODEX_PROBE=1 with ${flag[0]}: refused pre-spend under the profile, admitted under the fallback`, { skip: profileSkip }, () => {
387
+ const refused = drive(sandbox(repos), ['-', '--', ...flag], { CODEX_PROBE: '1' });
408
388
  assert.equal(refused.status, 2, refused.stderr);
409
389
  assert.equal(spawnsOf(refused).some(([kind]) => kind === 'run'), false, 'no run is spent');
410
390
  const admitted = drive(sandbox(), ['-', '--', ...flag], { CODEX_PROBE: '1', CODEX_FAKE_UNAME: 'Darwin' });
@@ -412,8 +392,8 @@ describe('the probe passthrough under the profile — spec:jev-every-run/S18', (
412
392
  assert.ok(admitted.argv.includes(flag[0]), admitted.argv.join(' '));
413
393
  });
414
394
  }
415
- it('exactly these five: --ignore-rules stays admitted under the profile', () => {
416
- const r = drive(sandbox(), ['-', '--', '--ignore-rules'], { CODEX_PROBE: '1' });
395
+ it('exactly these five: --ignore-rules stays admitted under the profile', { skip: profileSkip }, () => {
396
+ const r = drive(sandbox(repos), ['-', '--', '--ignore-rules'], { CODEX_PROBE: '1' });
417
397
  assertProfile(r);
418
398
  assert.ok(r.argv.includes('--ignore-rules'));
419
399
  });
@@ -277,7 +277,7 @@ aw_settings_file() {
277
277
  printf '%s/agent-workflow/bridge-settings.conf' "${XDG_CONFIG_HOME:-$HOME/.config}"
278
278
  }
279
279
  aw_settings_known() {
280
- case " CODEX_SERVICE_TIER CODEX_HARD_TIMEOUT CODEX_REVIEW_MAX_TOTAL_BYTES AGY_HARD_TIMEOUT AGY_REVIEW_ALLOW_ADDDIR AGY_REVIEW_MAX_TOTAL_BYTES CODEX_MODEL CODEX_EFFORT AGY_MODEL " in
280
+ case " CODEX_SERVICE_TIER CODEX_HARD_TIMEOUT CODEX_REVIEW_MAX_TOTAL_BYTES AGY_HARD_TIMEOUT AGY_REVIEW_ALLOW_ADDDIR AGY_REVIEW_MAX_TOTAL_BYTES CODEX_MODEL CODEX_EFFORT AGY_MODEL JEV_MODEL " in
281
281
  *" $1 "*) return 0 ;;
282
282
  *) return 1 ;;
283
283
  esac
@@ -377,7 +377,11 @@ aw_read_posture() {
377
377
  AW_HOST_VALUE="$value"
378
378
  AW_HOST_SOURCE="setting"
379
379
  elif (( notify )); then
380
- echo "warning: $key in bridge settings file '$file' is empty or carries a control byte — using the built-in default '$default'." >&2
380
+ if [[ -n "$default" ]]; then
381
+ echo "warning: $key in bridge settings file '$file' is empty or carries a control byte — using the built-in default '$default'." >&2
382
+ else
383
+ echo "warning: $key in bridge settings file '$file' is empty or carries a control byte — using the manifest's default." >&2
384
+ fi
381
385
  fi
382
386
  fi
383
387
  fi
@@ -509,7 +513,7 @@ CHATGPT_LOGIN_GUARD="Logged in using ChatGPT"
509
513
  # receipt this wrapper mints; scripts/release/version-sync.mjs bumps it under the one-anchor-per-file
510
514
  # rule, so a release can never leave it behind (the AD-053 drift class).
511
515
  AW_RECEIPT_BACKEND="codex"
512
- AW_BRIDGE_VERSION="6.0.0" # aw-version-anchor
516
+ AW_BRIDGE_VERSION="6.0.2" # aw-version-anchor
513
517
  # The kill grace handed to timeout(1) as --kill-after, and recorded in the receipt as killGraceS:
514
518
  # ONE constant, so the number the ledger checks against the dispatch deadline is the number the run
515
519
  # actually applied.
@@ -9,6 +9,7 @@ import { join, dirname, resolve } from 'node:path';
9
9
  import { fileURLToPath } from 'node:url';
10
10
  import { spawnSync, execFile } from 'node:child_process';
11
11
  import { createHash } from 'node:crypto';
12
+ import { makeFixtureRepo } from './codex-fixtures-harness.test.mjs';
12
13
 
13
14
  const HERE = dirname(fileURLToPath(import.meta.url));
14
15
  const WRAPPER = join(HERE, 'codex-exec.sh');
@@ -101,7 +102,7 @@ const TEMPLATE_ROOT = (() => {
101
102
  const repo = join(root, 'repo');
102
103
  mkdirSync(repo);
103
104
  const g = (...args) => spawnSync('git', args, { cwd: repo, encoding: 'utf8' });
104
- g('init', '-q');
105
+ makeFixtureRepo((args) => g(...args), repo, ['-q']);
105
106
  g('config', 'user.email', 'probe@example.com');
106
107
  g('config', 'user.name', 'probe');
107
108
  writeFileSync(join(repo, 'AGENTS.md'), '# AGENTS\n\nHard Constraints: none (test fixture).\n');
@@ -1453,15 +1454,10 @@ describe('codex-exec.sh — bridge settings file semantics (bridges 2.3.0)', { c
1453
1454
  });
1454
1455
  });
1455
1456
 
1456
- // ── settings surface ⟷ manifest (drift guard, D6) ────────────────────────────────
1457
- // The manifest `settings` block is the single source: the --help Settings section
1458
- // renders this wrapper's applied subset, and the shell constants (registry, applied
1459
- // subset, typed validation arms) stay set-equal to the UNION of both bridges' blocks
1460
- // (the reader recognizes every family key). The sibling manifest resolves identically
1461
- // in the repo layout and in the kit's bridges/ mirror layout.
1462
1457
  const SETTINGS_HEADER = 'Settings file (KEY=VALUE, parsed never sourced; env wins over file, file wins over built-in default):';
1463
1458
  const SIBLING_MANIFEST = JSON.parse(readFileSync(join(HERE, '..', '..', 'antigravity-cli-bridge', 'capability.json'), 'utf8'));
1464
- const ALL_SETTINGS = [...(MANIFEST.settings ?? []), ...(SIBLING_MANIFEST.settings ?? [])];
1459
+ const JUDGE_MANIFEST = JSON.parse(readFileSync(join(HERE, '..', '..', 'typesafe-jev-bridge', 'capability.json'), 'utf8'));
1460
+ const ALL_SETTINGS = [MANIFEST, SIBLING_MANIFEST, JUDGE_MANIFEST].flatMap((manifest) => manifest.settings ?? []);
1465
1461
  const SETTINGS_CMD = 'codex-exec';
1466
1462
 
1467
1463
  describe('codex-exec.sh — settings surface ⟷ manifest (D6, manifest-pinned)', { concurrency: 2 }, () => {
@@ -1477,10 +1473,10 @@ describe('codex-exec.sh — settings surface ⟷ manifest (D6, manifest-pinned)'
1477
1473
 
1478
1474
  const source = readFileSync(WRAPPER, 'utf8');
1479
1475
 
1480
- it('aw_settings_known carries exactly the UNION of both bridges settings keys', async () => {
1476
+ it('aw_settings_known carries exactly the UNION of three bridges settings keys', async () => {
1481
1477
  const m = source.match(/aw_settings_known\(\) \{\n case " ([^"]+) " in/);
1482
1478
  assert.ok(m, 'aw_settings_known registry case not found');
1483
- assert.ok(ALL_SETTINGS.length >= 5, 'both manifests must contribute settings');
1479
+ assert.ok(ALL_SETTINGS.some((setting) => setting.key === 'JEV_MODEL'), 'the manifest union must include JEV_MODEL');
1484
1480
  setEq(m[1].trim().split(/\s+/), ALL_SETTINGS.map((s) => s.key), 'shell registry ⟷ manifest union');
1485
1481
  });
1486
1482
 
@@ -0,0 +1,77 @@
1
+ import { after } from 'node:test';
2
+ import { spawnSync } from 'node:child_process';
3
+ import { existsSync, lstatSync, mkdirSync, mkdtempSync, realpathSync, rmSync } from 'node:fs';
4
+ import { tmpdir } from 'node:os';
5
+ import { dirname, isAbsolute, join, relative, sep } from 'node:path';
6
+ import { fileURLToPath, pathToFileURL } from 'node:url';
7
+
8
+ const HERE = dirname(fileURLToPath(import.meta.url));
9
+ const REPOS_NAME = '.test-repos';
10
+ const MAINTENANCE_OFF = 'maintenance.auto=false';
11
+ const REMOVE_OPTIONS = { recursive: true, force: true };
12
+ const stripGitEnv = (env) => Object.fromEntries(Object.entries(env).filter(([key]) => !/^[Gg][Ii][Tt]_/.test(key)));
13
+ const isInside = (parent, path) => {
14
+ const suffix = relative(parent, path);
15
+ return suffix === '' || (suffix !== '..' && !suffix.startsWith(`..${sep}`) && !isAbsolute(suffix));
16
+ };
17
+ const runGit = (args, cwd, env) => spawnSync('git', args, { cwd, env: stripGitEnv(env), encoding: 'utf8' });
18
+
19
+ export const makeFixtureRepo = (run, dir, initArgs = []) => {
20
+ run(['init', ...initArgs, dir]);
21
+ run(['-C', dir, 'config', 'maintenance.auto', 'false']);
22
+ return dir;
23
+ };
24
+
25
+ export const cloneFixtureRepo = (run, source, dir, cloneArgs = []) => {
26
+ run(['clone', '-c', MAINTENANCE_OFF, ...cloneArgs, source, dir]);
27
+ return dir;
28
+ };
29
+
30
+ export const resolveTestReposRoot = ({ here = HERE, env = process.env } = {}) => {
31
+ const result = runGit(['rev-parse', '--show-toplevel'], here, env);
32
+ if (result.error) throw result.error;
33
+ if (result.signal) throw new Error(`git rev-parse at ${here}: signal ${result.signal}`);
34
+ if (result.status !== 0) return null;
35
+ const top = realpathSync(result.stdout.replace(/\n$/, ''));
36
+ return { top, root: join(top, REPOS_NAME) };
37
+ };
38
+
39
+ export const judgeTestReposRoot = async ({ here = HERE, env = process.env, tmp = tmpdir() } = {}) => {
40
+ const location = resolveTestReposRoot({ here, env });
41
+ if (!location) return { ok: false, fact: `No git work tree at ${here}` };
42
+ const { top, root } = location;
43
+ const realHere = realpathSync(here);
44
+ const allowed = [join(top, 'codex-cli-bridge', 'bin'), join(top, 'agent-workflow-kit', 'bridges', 'codex-cli-bridge', 'bin')];
45
+ if (!allowed.includes(realHere)) return { ok: false, fact: `Unexpected harness folder ${here}` };
46
+ const versionModule = join(top, 'scripts', 'release', 'version-sync.mjs');
47
+ for (const required of [versionModule, join(top, 'scripts', 'sync-mirrors.mjs')]) {
48
+ if (!existsSync(required)) return { ok: false, fact: `Missing checkout file ${required}` };
49
+ }
50
+ const { FAMILY_DIRS } = await import(pathToFileURL(versionModule).href);
51
+ const realRoot = lstatSync(root, { throwIfNoEntry: false }) ? realpathSync(root) : root;
52
+ for (const directory of FAMILY_DIRS) {
53
+ const familyPath = join(top, directory);
54
+ const familyRoot = existsSync(familyPath) ? realpathSync(familyPath) : familyPath;
55
+ if (isInside(familyRoot, realRoot)) return { ok: false, fact: `Fixture root lies inside family directory ${familyRoot}` };
56
+ }
57
+ const ignored = runGit(['check-ignore', '-q', `${root}${sep}`], top, env);
58
+ if (ignored.error) return { ok: false, fact: `Cannot check ignore for ${root}: ${ignored.error.code ?? ignored.error.message}` };
59
+ if (ignored.signal) return { ok: false, fact: `Cannot check ignore for ${root}: signal ${ignored.signal}` };
60
+ if (ignored.status !== 0) return { ok: false, fact: `Fixture root ${root} is not confirmed ignored: status ${ignored.status}` };
61
+ const realTmp = realpathSync(tmp);
62
+ if (isInside(top, realTmp)) return { ok: false, fact: `Temporary directory ${realTmp} lies inside checkout` };
63
+ return { ok: true, top, root, underSlashTmp: isInside(realpathSync('/tmp'), realRoot) };
64
+ };
65
+
66
+ export const openSuiteScopes = async (name, options = {}) => {
67
+ const judgment = await judgeTestReposRoot(options);
68
+ if (!judgment.ok) throw new Error(judgment.fact);
69
+ mkdirSync(judgment.root, { recursive: true });
70
+ const repos = mkdtempSync(join(judgment.root, `${name}-`));
71
+ const tmp = mkdtempSync(join(realpathSync(options.tmp ?? tmpdir()), `${name}-`));
72
+ after(() => {
73
+ try { rmSync(repos, REMOVE_OPTIONS); }
74
+ finally { rmSync(tmp, REMOVE_OPTIONS); }
75
+ });
76
+ return { repos, tmp, profileSkip: judgment.underSlashTmp ? 'Checkout lies under /tmp, where the exec wrapper takes its fallback' : false };
77
+ };