@sabaiway/agent-workflow-kit 22.2.0 → 23.1.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 (36) hide show
  1. package/CHANGELOG.md +49 -1
  2. package/README.md +1 -1
  3. package/SKILL.md +1 -1
  4. package/bridges/antigravity-cli-bridge/SKILL.md +11 -10
  5. package/bridges/antigravity-cli-bridge/bin/agy-jev.test.mjs +56 -7
  6. package/bridges/antigravity-cli-bridge/bin/agy-review.sh +81 -63
  7. package/bridges/antigravity-cli-bridge/bin/agy-review.test.mjs +0 -21
  8. package/bridges/antigravity-cli-bridge/bin/agy.sh +86 -12
  9. package/bridges/antigravity-cli-bridge/capability.json +4 -5
  10. package/bridges/antigravity-cli-bridge/references/models-and-flags.md +3 -3
  11. package/bridges/antigravity-cli-bridge/service-facts.txt +11 -0
  12. package/bridges/antigravity-cli-bridge/setup/README.md +1 -1
  13. package/bridges/codex-cli-bridge/SKILL.md +23 -24
  14. package/bridges/codex-cli-bridge/bin/codex-exec-jev.test.mjs +82 -47
  15. package/bridges/codex-cli-bridge/bin/codex-exec.sh +133 -52
  16. package/bridges/codex-cli-bridge/bin/codex-review-jev.test.mjs +44 -14
  17. package/bridges/codex-cli-bridge/bin/codex-review.sh +103 -30
  18. package/bridges/codex-cli-bridge/capability.json +7 -8
  19. package/bridges/codex-cli-bridge/references/driving-codex.md +6 -7
  20. package/bridges/codex-cli-bridge/references/sandbox-and-flags.md +8 -11
  21. package/bridges/codex-cli-bridge/service-facts.txt +9 -0
  22. package/bridges/codex-cli-bridge/setup/README.md +3 -3
  23. package/capability.json +1 -1
  24. package/package.json +1 -1
  25. package/references/modes/recommendations.md +3 -3
  26. package/references/modes/velocity.md +1 -1
  27. package/tools/bridge-sandbox-recipe.mjs +9 -6
  28. package/tools/bridge-state-dirs.mjs +2 -2
  29. package/tools/detect-backends.mjs +23 -15
  30. package/tools/manifest/schema.md +28 -47
  31. package/tools/manifest/validate.mjs +22 -60
  32. package/tools/procedures.mjs +1 -1
  33. package/tools/services/antigravity.json +17 -0
  34. package/tools/services/codex.json +15 -0
  35. package/tools/services/index.mjs +127 -0
  36. package/tools/services/jev.json +12 -0
@@ -3,14 +3,17 @@
3
3
  // directives. Standalone harness with its own fake codex and a fake uname.
4
4
  import { describe, it, after } from 'node:test';
5
5
  import assert from 'node:assert/strict';
6
- import { mkdirSync, mkdtempSync, writeFileSync, readFileSync, existsSync, rmSync, cpSync, chmodSync, realpathSync } from 'node:fs';
6
+ import { mkdirSync, mkdtempSync, writeFileSync, readFileSync, existsSync, rmSync, cpSync, chmodSync, realpathSync, symlinkSync } from 'node:fs';
7
7
  import { join, dirname } from 'node:path';
8
8
  import { fileURLToPath } from 'node:url';
9
9
  import { spawnSync } from 'node:child_process';
10
+ const stripGitLocationEnv = (env) => Object.fromEntries(Object.entries(env).filter(([key]) => !/^[Gg][Ii][Tt]_/.test(key)));
10
11
 
11
12
  const HERE = dirname(fileURLToPath(import.meta.url));
12
13
  const REVIEW = join(HERE, 'codex-review.sh');
13
14
  const HOSTS = 'api.typesafe.ai,docs.typesafe.ai';
15
+ const childEnv = (home, env = {}) => ({ ...stripGitLocationEnv(env), HOME: home, XDG_CONFIG_HOME: join(home, '.config'),
16
+ GIT_CONFIG_GLOBAL: '/dev/null', GIT_CONFIG_SYSTEM: '/dev/null', GIT_CONFIG_NOSYSTEM: '1', GIT_ATTR_NOSYSTEM: '1', LC_ALL: 'C' });
14
17
  // The same layout as codex-exec-jev: repositories under the package's node_modules, TMPDIR their sibling.
15
18
  const FIXTURES = join(HERE, '..', 'node_modules', '.aw-fixtures');
16
19
  const TMP = join(FIXTURES, 'tmp');
@@ -25,7 +28,7 @@ const FAKE_CODEX = [
25
28
  '#!/usr/bin/env bash',
26
29
  'set -u',
27
30
  'st() { if [[ -n "${!1+x}" ]]; then printf "[%s]" "${!1}"; else printf unset; fi; }',
28
- '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)" >>"$CODEX_FAKE_LOG"; }',
31
+ '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"; }',
29
32
  'case "${1:-}" in',
30
33
  ' login) rec login; echo "Logged in using ChatGPT"; exit 0 ;;',
31
34
  ' --version) rec version; echo "${CODEX_FAKE_VERSION-codex-cli 0.160.0}"; exit 0 ;;',
@@ -61,7 +64,7 @@ mkdirSync(join(TEMPLATE, 'repo'));
61
64
  writeFileSync(join(TEMPLATE, 'bin', 'codex'), FAKE_CODEX);
62
65
  writeFileSync(join(TEMPLATE, 'bin', 'uname'), FAKE_UNAME);
63
66
  {
64
- const git = (...args) => spawnSync('git', args, { cwd: join(TEMPLATE, 'repo'), encoding: 'utf8' });
67
+ const git = (...args) => spawnSync('git', args, { cwd: join(TEMPLATE, 'repo'), encoding: 'utf8', env: childEnv(join(TEMPLATE, 'home'), { PATH: process.env.PATH }) });
65
68
  git('init', '-q');
66
69
  git('config', 'user.email', 'probe@example.com');
67
70
  git('config', 'user.name', 'probe');
@@ -71,9 +74,8 @@ writeFileSync(join(TEMPLATE, 'bin', 'uname'), FAKE_UNAME);
71
74
  git('commit', '-qm', 'base');
72
75
  }
73
76
 
74
- let sequence = 0;
75
77
  const sandbox = ({ skills = true } = {}) => {
76
- const dir = join(ROOT, `sb-${++sequence}`);
78
+ const dir = mkdtempSync(join(ROOT, 'sb-'));
77
79
  cpSync(TEMPLATE, dir, { recursive: true });
78
80
  for (const name of ['codex', 'uname']) chmodSync(join(dir, 'bin', name), 0o755);
79
81
  const sb = { dir, bin: join(dir, 'bin'), home: join(dir, 'home'), repo: join(dir, 'repo'),
@@ -89,11 +91,13 @@ const PLAN = ['plan', 'plan.md'];
89
91
  const drive = (sb, args, env = {}, cwd = sb.repo) => {
90
92
  const cap = (name) => join(sb.dir, name);
91
93
  for (const name of ['log', 'argv', 'stdin', 'skills']) rmSync(cap(name), { force: true });
92
- const r = spawnSync('bash', [REVIEW, ...args], {
94
+ const r = spawnSync('bash', [sb.wrapper ?? REVIEW, ...args], {
93
95
  cwd, input: '', encoding: 'utf8', timeout: 60000,
94
- env: { PATH: `${sb.bin}:${process.env.PATH}`, HOME: sb.home, TMPDIR: TMP, CODEX_FAKE_LOG: cap('log'), CODEX_FAKE_ARGV: cap('argv'),
95
- CODEX_FAKE_STDIN: cap('stdin'), CODEX_FAKE_SKILLS: cap('skills'), ...env },
96
+ env: childEnv(sb.home, { PATH: `${sb.bin}:${process.env.PATH}`, TMPDIR: TMP, CODEX_FAKE_LOG: cap('log'), CODEX_FAKE_ARGV: cap('argv'),
97
+ CODEX_FAKE_STDIN: cap('stdin'), CODEX_FAKE_SKILLS: cap('skills'), ...env }),
96
98
  });
99
+ assert.ifError(r.error);
100
+ assert.equal(r.signal, null, r.stderr);
97
101
  const read = (name) => (existsSync(cap(name)) ? readFileSync(cap(name), 'utf8') : '');
98
102
  const spawns = read('log').split('\n').filter(Boolean).map((line) => [line.slice(0, line.indexOf(' ')), line.slice(line.indexOf(' ') + 1)]);
99
103
  return { status: r.status, stdout: r.stdout, stderr: r.stderr, spawns, runs: spawns.filter(([kind]) => kind === 'run').length,
@@ -104,11 +108,11 @@ const overrides = (argv) => Object.fromEntries(argv.flatMap((arg, i) => (argv[i
104
108
  ? [[arg.slice(0, arg.indexOf('=')), arg.slice(arg.indexOf('=') + 1)]] : [])));
105
109
  // A reader for the TOML inline tables a profile override carries.
106
110
  const inline = (text) => {
107
- let at = 0;
111
+ const cursor = { at: 0 };
108
112
  const eat = (re) => {
109
- const m = re.exec(text.slice(at));
113
+ const m = re.exec(text.slice(cursor.at));
110
114
  assert.ok(m, `an inline table: ${text}`);
111
- at += m[0].length;
115
+ cursor.at += m[0].length;
112
116
  return m;
113
117
  };
114
118
  const value = () => {
@@ -123,7 +127,7 @@ const inline = (text) => {
123
127
  return table;
124
128
  };
125
129
  const parsed = value();
126
- assert.equal(text.slice(at).trim(), '', `nothing after the inline table: ${text}`);
130
+ assert.equal(text.slice(cursor.at).trim(), '', `nothing after the inline table: ${text}`);
127
131
  return parsed;
128
132
  };
129
133
  const PROFILE_KEYS = ['default_permissions', 'permissions.jev.filesystem', 'permissions.jev.network.domains', 'permissions.jev.network.enabled'];
@@ -146,7 +150,7 @@ const assertFallback = (r) => {
146
150
  const bannerOf = (r) => r.stderr.split('\n').find((line) => line.startsWith('review posture: ')) ?? '';
147
151
  const banner = (jev) => `review posture: model=gpt-6.1-sol effort=high tier=standard jev=${jev} source=model:default,effort:default timeout=1800s`;
148
152
  const KEYS = { TYPESAFE_API_KEY: 'jev-key', OPENAI_API_KEY: 'sk-live', CODEX_API_KEY: 'ck', FOO_API_KEY: 'foo', OPENAI_BASE_URL: 'http://proxy' };
149
- const PASSED = 'key=[jev-key] openai=unset codex=unset foo=unset base=unset';
153
+ const PASSED = 'key=[jev-key] openai=unset codex=unset foo=unset base=unset bar=unset';
150
154
  const runEnv = (r) => (r.spawns.find(([kind]) => kind === 'run') ?? [])[1];
151
155
  const item = (body) => JSON.stringify({ type: 'item.completed', item: body });
152
156
  const P13_TEXT = 'Configured filesystem path `:root` is not recognized by this version of Codex and will be ignored. Upgrade Codex if this path is required.';
@@ -281,7 +285,7 @@ describe('the three fence directives — spec:jev-every-run/S16', () => {
281
285
  for (const [args, env] of [[PLAN, {}], [['code'], {}], [['code'], { CODEX_REVIEW_MAX_TOTAL_BYTES: '1' }]]) {
282
286
  const r = drive(sandbox(), args, env);
283
287
  assertProfile(r);
284
- for (const text of ['.agents/skills', 'api.typesafe.ai', 'docs.typesafe.ai', NO_WRITE]) assert.ok(r.prompt.includes(text), `${args[0]} ${text}`);
288
+ for (const text of ['.agents/skills', ' The reachable host list is api.typesafe.ai, docs.typesafe.ai; every other host is refused, and still no file may be edited, created or deleted.', NO_WRITE]) assert.ok(r.prompt.includes(text), `${args[0]} ${text}`);
285
289
  }
286
290
  });
287
291
  it('the oversized code review keeps its one exception, the precomputed-diff file', () => {
@@ -299,3 +303,29 @@ describe('the three fence directives — spec:jev-every-run/S16', () => {
299
303
  assert.equal(bare.prompt.includes('.agents/skills'), false);
300
304
  });
301
305
  });
306
+
307
+ const copyBridge = (sb) => {
308
+ const directory = join(sb.dir, 'bridge');
309
+ cpSync(HERE, join(directory, 'bin'), { recursive: true });
310
+ cpSync(join(HERE, '..', 'capability.json'), join(directory, 'capability.json'));
311
+ const lines = readFileSync(join(HERE, '..', 'service-facts.txt'), 'utf8').trimEnd().split('\n');
312
+ writeFileSync(join(directory, 'service-facts.txt'), [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', ''].join('\n'));
313
+ const wrapper = join(directory, 'bin', 'linked-review');
314
+ symlinkSync('codex-review.sh', wrapper);
315
+ return { ...sb, wrapper };
316
+ };
317
+ describe('injected facts through a symlink — spec:jev-every-run/S26', () => {
318
+ it('renders only the injected hosts in domains, banner and every fence directive and passes the listed variables', () => {
319
+ const sb = copyBridge(sandbox());
320
+ for (const [args, env] of [[PLAN, {}], [['code'], {}], [['code'], { CODEX_REVIEW_MAX_TOTAL_BYTES: '1' }]]) {
321
+ const result = drive(sb, args, { ...KEYS, BAR_API_KEY: '', ...env });
322
+ assert.equal(result.status, 0, result.stderr);
323
+ assert.equal(overrides(result.argv)['permissions.jev.network.domains'], '{"a.example"="allow","b.example"="allow"}');
324
+ assert.equal(bannerOf(result), banner('a.example,b.example'));
325
+ assert.ok(result.prompt.includes(' The reachable host list is a.example, b.example; every other host is refused, and still no file may be edited, created or deleted.'), result.prompt);
326
+ assert.doesNotMatch([result.argv.join(' '), result.prompt, result.stderr, result.stdout].join('\n'), /typesafe\.ai/i);
327
+ assert.ok(result.spawns.length > 0, result.stderr);
328
+ for (const [kind, keys] of result.spawns) assert.equal(keys, 'key=unset openai=unset codex=unset foo=[foo] base=unset bar=[]', kind);
329
+ }
330
+ });
331
+ });
@@ -2,7 +2,7 @@
2
2
  # Read-only ADVISORY review BY the OpenAI Codex CLI. Runs read-only — on Linux with
3
3
  # codex-cli 0.160.0 or newer, off a codex version and profile digest recorded as
4
4
  # refused, under the permissions profile `jev` with no write entry
5
- # (network to api.typesafe.ai and docs.typesafe.ai only), elsewhere under --sandbox
5
+ # (network to the run hosts its service-facts.txt lists), elsewhere under --sandbox
6
6
  # read-only — so codex structurally CANNOT edit/create/delete files or write to git
7
7
  # — it can only read and emit findings. The orchestrator reads those findings and
8
8
  # decides what to act on; codex never applies them itself.
@@ -37,6 +37,76 @@
37
37
  # anywhere on disk remain readable under read-only — read-scoping is a prompt concern).
38
38
  set -euo pipefail
39
39
 
40
+ aw_script_dir() {
41
+ local src="${BASH_SOURCE[0]}" dir hops=0 max_hops=16
42
+ while :; do
43
+ case "$src" in */*) dir="${src%/*}"; dir="${dir:-/}" ;; *) dir=. ;; esac
44
+ dir="$(CDPATH= builtin cd -P -- "$dir" 2>/dev/null && builtin pwd -P)" || break
45
+ [[ -L "$src" ]] || { printf '%s\n' "$dir"; return 0; }
46
+ if (( hops >= max_hops )); then
47
+ printf 'error: exceeded %s symlink hops; could not resolve its OWN directory\n' "$max_hops" >&2
48
+ return 127
49
+ fi
50
+ hops=$((hops + 1))
51
+ src="$(command readlink -- "$src" 2>/dev/null)" || break
52
+ case "$src" in /*) ;; *) src="$dir/$src" ;; esac
53
+ done
54
+ printf 'error: could not resolve its OWN directory\n' >&2
55
+ return 127
56
+ }
57
+ aw_read_service_facts() {
58
+ local path="${1%/*}/service-facts.txt" line key value entry number=0 bad=0 valid seen=() run_lines=()
59
+ local host_re='^(\*\.)?[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]([abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-]*[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789])?(\.[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]([abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-]*[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789])?)+$'
60
+ local variable_re='^[ABCDEFGHIJKLMNOPQRSTUVWXYZ][ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_]*$'
61
+ local command_re='^[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789][abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789._-]* \*$'
62
+ local env directory segments LC_ALL=C
63
+ AW_FACT_HOST=() AW_FACT_RUN_HOST=() AW_FACT_PASSED_VARIABLE=()
64
+ if [[ -f "$path" && -r "$path" ]]; then
65
+ while IFS= read -r line; do
66
+ number=$((number + 1)); valid=1
67
+ if (( number == 1 )); then
68
+ [[ "$line" == "# generated from the kit's service fragments (agent-workflow-kit/tools/services/); do not edit" ]] || bad=1
69
+ continue
70
+ fi
71
+ key="${line%%=*}"; value="${line#*=}"
72
+ [[ "$line" == *=* ]] || valid=0
73
+ case "$key" in
74
+ HOST|RUN_HOST) [[ "$value" =~ $host_re ]] || valid=0
75
+ if [[ "$key" == RUN_HOST && "$value" == '*.'* ]]; then valid=0; fi ;;
76
+ PASSED_VARIABLE) [[ "$value" =~ $variable_re && "$value" != OPENAI_BASE_URL ]] || valid=0 ;;
77
+ EXCLUDED_COMMAND) [[ "$value" =~ $command_re ]] || valid=0 ;;
78
+ WRITABLE_DIR)
79
+ env="${value%%:*}"; directory="${value#*:}"; segments="/${directory//\\//}/"
80
+ [[ "$value" == *:* && ( -z "$env" || "$env" =~ $variable_re ) &&
81
+ ( "$directory" == '~/'* || "$directory" == /* ) && "$directory" != */ &&
82
+ "$directory" != *[\*\?\[\]]* && ! "$directory" =~ [[:cntrl:]] && "$segments" != */../* ]] || valid=0 ;;
83
+ *) valid=0 ;;
84
+ esac
85
+ for entry in ${seen[@]+"${seen[@]}"}; do [[ "$entry" != "$line" ]] || valid=0; done
86
+ if (( ! valid )); then (( bad )) || bad=$number; continue; fi
87
+ seen+=("$line")
88
+ case "$key" in
89
+ HOST) AW_FACT_HOST+=("$value") ;; RUN_HOST) AW_FACT_RUN_HOST+=("$value"); run_lines+=("$number") ;;
90
+ PASSED_VARIABLE) AW_FACT_PASSED_VARIABLE+=("$value") ;;
91
+ esac
92
+ done <"$path"
93
+ if (( ! number )); then bad=1; fi
94
+ if [[ -n "$line" ]] && (( ! bad )); then bad=$((number + 1)); fi
95
+ for ((number=0; number<${#AW_FACT_RUN_HOST[@]}; number++)); do
96
+ valid=0
97
+ for entry in ${AW_FACT_HOST[@]+"${AW_FACT_HOST[@]}"}; do [[ "$entry" != "${AW_FACT_RUN_HOST[number]}" ]] || valid=1; done
98
+ if (( ! valid && (! bad || run_lines[number] < bad) )); then bad=${run_lines[number]}; fi
99
+ done
100
+ (( bad )) || return 0
101
+ printf 'error: %s: invalid facts at line %s; remove whatever is at that path and run /agent-workflow-kit upgrade to write it again\n' "$path" "$bad" >&2
102
+ else
103
+ printf 'error: %s: not a readable regular file; remove whatever is at that path and run /agent-workflow-kit upgrade to write it again\n' "$path" >&2
104
+ fi
105
+ exit 127
106
+ }
107
+ HERE="$(aw_script_dir)" || exit 127
108
+ aw_read_service_facts "$HERE"
109
+
40
110
  # --- --help / -h (pre-preflight: no codex, no login, no git tree needed) -------
41
111
  # Keyed ONLY on the FIRST argument — never a scan of all args (uniform rule across
42
112
  # the four wrappers, so an open wrapper's passthrough payload is never intercepted).
@@ -101,16 +171,16 @@ Settings file (KEY=VALUE, parsed never sourced; env wins over file, file wins ov
101
171
  CODEX_REVIEW_MAX_TOTAL_BYTES — inline-payload cap, integer bytes 1..100000000 (default 1500000); above it the diff rides via a git-dir temp file
102
172
 
103
173
  Notes:
104
- the review posture banner states what the run reaches in a jev= field:
105
- jev=api.typesafe.ai,docs.typesafe.ai when the run carries the read-only permissions profile `jev`
106
- (Linux, codex-cli 0.160.0 or newer, a version and profile digest not recorded as refused), else
107
- jev=unreachable (<reason>) under --sandbox read-only; a run whose codex refuses the profile exits
108
- 72 with no receipt; then a banner-only source=model:<s>,effort:<s> field — where each value came
109
- from: default, setting or environment — then a banner-only timeout=<duration> field — exactly the
110
- duration handed to timeout(1); the hard-timeout preflight fails CLOSED when no timeout/gtimeout
111
- binary exists (the wrapper refuses by name before any CLI run, so an uncapped review run can no
112
- longer happen), and none of the three fields enters the receipt posture or the D5 banner↔receipt
113
- parity
174
+ the review posture banner states what the run reaches in a jev= field: the run hosts its
175
+ service-facts.txt lists when the run carries the read-only permissions profile `jev` (Linux,
176
+ codex-cli 0.160.0 or newer, a version and profile digest not recorded as refused), else
177
+ jev=unreachable (<reason>) under --sandbox read-only; a run whose codex refuses the profile
178
+ exits 72 with no receipt; then a banner-only source=model:<s>,effort:<s> field — where each
179
+ value came from: default, setting or environment — then a banner-only timeout=<duration> field —
180
+ exactly the duration handed to timeout(1); the hard-timeout preflight fails CLOSED when no
181
+ timeout/gtimeout binary exists (the wrapper refuses by name before any CLI run, so an uncapped
182
+ review run can no longer happen), and none of the three fields enters the receipt posture or the
183
+ D5 banner↔receipt parity
114
184
  quote the posture banner verbatim when labeling this dispatch — the banner is the machine-stated
115
185
  posture; a prose re-type drifts
116
186
 
@@ -326,15 +396,15 @@ aw_resolve_timeout_bin() {
326
396
  printf '%s' "$bin"
327
397
  }
328
398
  aw_scrub_billing_keys() {
329
- # The one key rule (spec jev-every-run): OPENAI_BASE_URL and every *_API_KEY are unset, so a stray key can never
330
- # switch a run to paid billing; TYPESAFE_API_KEY is neither read nor set, so it reaches the CLI exactly as given.
331
- local name
399
+ local name passed keep
332
400
  unset OPENAI_BASE_URL 2>/dev/null || true
333
401
  for name in $(compgen -v); do
334
- case "$name" in
335
- TYPESAFE_API_KEY) ;;
336
- *_API_KEY) unset "$name" 2>/dev/null || true ;;
337
- esac
402
+ [[ "$name" == *_API_KEY ]] || continue
403
+ keep=0
404
+ for passed in ${AW_FACT_PASSED_VARIABLE[@]+"${AW_FACT_PASSED_VARIABLE[@]}"}; do
405
+ [[ "$name" != "$passed" ]] || keep=1
406
+ done
407
+ if (( ! keep )); then unset "$name" 2>/dev/null || true; fi
338
408
  done
339
409
  return 0
340
410
  }
@@ -342,7 +412,7 @@ aw_scrub_billing_keys() {
342
412
  # Review-receipt identity (AD-038). AW_BRIDGE_VERSION mirrors this bridge's SKILL.md/capability.json
343
413
  # version (drift-guarded by codex-review.test.mjs against capability.json).
344
414
  AW_RECEIPT_BACKEND="codex"
345
- AW_BRIDGE_VERSION="5.0.1" # aw-version-anchor
415
+ AW_BRIDGE_VERSION="6.0.0" # aw-version-anchor
346
416
  # Generous hard cap for a slow review at the host posture's effort (subscription latency varies).
347
417
  CODEX_HARD_TIMEOUT="${CODEX_HARD_TIMEOUT:-1800}"
348
418
  # Above this assembled-payload size (bytes), the diff goes via a git-dir-local temp
@@ -413,15 +483,16 @@ if [[ -z "$timeout_bin" ]]; then
413
483
  fi
414
484
 
415
485
  # --- The permissions profile `jev` (spec jev-every-run) — byte-identical in codex-exec.sh and codex-review.sh ---
416
- # On Linux with codex-cli 0.160.0 or newer a run carries the profile `jev` by four -c overrides, with neither
417
- # --sandbox nor sandbox_mode beside them: its filesystem part is this wrapper's AW_PROFILE_FILESYSTEM, and its
418
- # network reaches api.typesafe.ai and docs.typesafe.ai and no other host (a literal of this bridge, which never
419
- # imports the kit). Elsewhere, and on a codex version and profile digest recorded as refused, the run keeps
420
- # today's flags and its banner says jev=unreachable (<reason>). Each run, a resume included, chooses afresh.
486
+ # The run hosts come from service-facts.txt.
421
487
  AW_PROFILE_FLOOR="0.160.0"
422
- AW_PROFILE_HOSTS="api.typesafe.ai,docs.typesafe.ai"
488
+ aw_profile_domains="" aw_run_hosts="" aw_reachable_hosts=""
489
+ for aw_host in ${AW_FACT_RUN_HOST[@]+"${AW_FACT_RUN_HOST[@]}"}; do
490
+ aw_profile_domains+="${aw_profile_domains:+,}\"$aw_host\"=\"allow\""
491
+ aw_run_hosts+="${aw_run_hosts:+,}$aw_host"
492
+ aw_reachable_hosts+="${aw_reachable_hosts:+, }$aw_host"
493
+ done
423
494
  AW_PROFILE_FLAGS=(-c default_permissions=jev -c permissions.jev.network.enabled=true
424
- -c 'permissions.jev.network.domains={"api.typesafe.ai"="allow","docs.typesafe.ai"="allow"}'
495
+ -c "permissions.jev.network.domains={$aw_profile_domains}"
425
496
  -c "permissions.jev.filesystem=$AW_PROFILE_FILESYSTEM")
426
497
  # The version on the first line of `codex --version` ("codex-cli X.Y.Z[-pre]"); nothing when unreadable.
427
498
  aw_codex_version() { # $1 = the timeout binary or ""
@@ -488,7 +559,9 @@ aw_profile_choose() { # $1 = the timeout binary or "", $2 = the repository's t
488
559
  profile_version="$(aw_codex_version "$1")"
489
560
  profile_digest="$(aw_profile_digest)"
490
561
  os="$(uname -s 2>/dev/null)" || os=""
491
- if [[ "$os" != "Linux" ]]; then
562
+ if (( ! ${#AW_FACT_RUN_HOST[@]} )); then
563
+ profile_reason="no run host in service-facts.txt"
564
+ elif [[ "$os" != "Linux" ]]; then
492
565
  profile_reason="not linux (${os:-unreadable})"
493
566
  elif [[ -z "$profile_version" ]]; then
494
567
  profile_reason="codex version unreadable"
@@ -501,7 +574,7 @@ aw_profile_choose() { # $1 = the timeout binary or "", $2 = the repository's t
501
574
  else
502
575
  profile_on=1
503
576
  fi
504
- if (( profile_on )); then profile_label="$AW_PROFILE_HOSTS"; else profile_label="unreachable ($profile_reason)"; fi
577
+ if (( profile_on )); then profile_label="$aw_run_hosts"; else profile_label="unreachable ($profile_reason)"; fi
505
578
  profile_label="${profile_label//[$'\x01'-$'\x1f'$'\x7f']/?}"
506
579
  return 0
507
580
  }
@@ -1188,7 +1261,7 @@ REVIEW_ARTIFACT_PATH=""
1188
1261
 
1189
1262
  # The user's real Codex skill root, resolved before the fence home repoints HOME (spec jev-every-run): when it
1190
1263
  # exists, the fence home links .agents/skills to it on a profile and a fallback run alike, read-only in both, and
1191
- # the fence directives admit reading it; on a profile run they also name the two reachable hosts.
1264
+ # the fence directives admit reading it; on a profile run they also name the run hosts.
1192
1265
  skills_root="$(builtin cd -P -- "$HOME/.agents/skills" 2>/dev/null && builtin pwd -P)" || skills_root=""
1193
1266
  fence_skills=""
1194
1267
  if [[ -n "$skills_root" ]]; then
@@ -1196,7 +1269,7 @@ if [[ -n "$skills_root" ]]; then
1196
1269
  fi
1197
1270
  fence_hosts=""
1198
1271
  if (( profile_on )); then
1199
- fence_hosts=" The hosts api.typesafe.ai and docs.typesafe.ai are reachable; every other host is refused, and still no file may be edited, created or deleted."
1272
+ fence_hosts=" The reachable host list is $aw_reachable_hosts; every other host is refused, and still no file may be edited, created or deleted."
1200
1273
  fi
1201
1274
 
1202
1275
  case "$mode" in
@@ -3,7 +3,7 @@
3
3
  "schema": 1,
4
4
  "name": "codex-cli-bridge",
5
5
  "kind": "execution-backend",
6
- "version": "5.0.1",
6
+ "version": "6.0.0",
7
7
  "posture": { "model": "gpt-6.1-sol", "effort": "high", "tier": null },
8
8
  "provides": ["execute", "review"],
9
9
  "roles": {
@@ -31,7 +31,7 @@
31
31
  "nested-sandbox limit: codex-exec ships its OWN OS sandbox (bwrap workspace-write) and cannot run nested inside a harness sandbox (the FS turns read-only) — route it OUTSIDE the harness sandbox (excludedCommands / a per-run consented bypass) on the OBSERVED bwrap/EPERM failure, never a preemptive blanket",
32
32
  "exec posture banner: ONE stderr line before dispatch states the ACTUAL run posture — exec posture: model=… effort=… tier=… sandbox=jev-profile|workspace-write session=fresh|resume:<id> jev=… source=… timeout=… — from RESOLVED post-validation values; the resume id is validated pre-spend, control bytes in a model, effort, tier or timeout value refuse pre-spend, and a jev= reason shows a control byte as ?",
33
33
  "threat model: the sidecar byte and grammar screens detect corrupted input under a trusted parent environment. A hostile parent environment — including exported shell functions or PATH substitution of core/backend commands — is outside the threat model and can substitute the backend itself. Targeted shadow-proof resolution protects banner/dispatch honesty from accidental shadowing; it is not an environment security boundary",
34
- "the exec posture banner states what the run reaches in a jev= field: jev=api.typesafe.ai,docs.typesafe.ai when the run carries the permissions profile `jev` (Linux, codex-cli 0.160.0 or newer, a repository outside every temp root, a version and profile digest not recorded as refused), else jev=unreachable (<reason>) on today's workspace-write flags with network off; a run whose codex refuses the profile exits 72 with no success receipt and, for a refused profile key, records its version and digest when the state file can be written, so the next run on them takes today's flags; then a banner-only source=model:<s>,effort:<s> field — where each value came from: default, setting or environment — then a banner-only timeout=<duration|uncapped> field — exactly the duration handed to timeout(1), uncapped when no timeout/gtimeout binary caps the run; INFORMATIONAL only: none of the three is persisted in a receipt or session sidecar",
34
+ "the exec posture banner states what the run reaches in a jev= field: the run hosts its service-facts.txt lists when the run carries the permissions profile `jev` (Linux, codex-cli 0.160.0 or newer, a repository outside every temp root, a version and profile digest not recorded as refused), else jev=unreachable (<reason>) on today's workspace-write flags with network off; a run whose codex refuses the profile exits 72 with no success receipt and, for a refused profile key, records its version and digest when the state file can be written, so the next run on them takes today's flags; then a banner-only source=model:<s>,effort:<s> field — where each value came from: default, setting or environment — then a banner-only timeout=<duration|uncapped> field — exactly the duration handed to timeout(1), uncapped when no timeout/gtimeout binary caps the run; INFORMATIONAL only: none of the three is persisted in a receipt or session sidecar",
35
35
  "quote the posture banner verbatim when labeling this dispatch — the banner is the machine-stated posture; a prose re-type drifts",
36
36
  "every-run nested-sandbox scan (DUAL policy, deliberately two different rules): the scan runs on EVERY completed run, not only a failed one, because a run that SURVIVES the nested-sandbox failure exits 0 with an ungrounded answer and nothing said so. Failed run (rc != 0): the existing loose whole-trace combination rule prints the recovery hint. Successful run (rc == 0): a warning fires ONLY on precise per-item evidence — both a sandbox-mechanism token AND a permission/read-only failure token inside the aggregated_output of ONE command_execution item whose failure is PROVEN (a nonzero exit_code, or the serialized status \"failed\"); a null exit_code is never failure by itself, tokens split across two items never fire, and a successful command's output never fires. The answer is printed FIRST on stdout, then the warning on stderr. HONEST RESIDUAL: the exit status does NOT change on that lane (a distinct nonzero exit would give a heuristic scan DENY polarity, refusing real work whenever the scan over-warns), so an orchestrator keying on exit status alone can still bank an ungrounded answer — the stderr warning is the signal"
37
37
  ]
@@ -51,7 +51,7 @@
51
51
  "continue": [],
52
52
  "receipt": "side effect — a successful review appends one JSON receipt line to <git dir>/agent-workflow-review-receipts.jsonl (AW_REVIEW_RECEIPTS overrides): fingerprint = sha256 over the canonical uncommitted-state payload (staged diff + unstaged diff + untracked-not-ignored contents — the review-payload domain; never-committable untracked paths — character/block devices, FIFOs, sockets — are excluded from the domain entirely, untracked symlinks/directories ride as name-only notes) in code mode, the artifact-file sha256 in plan mode; durationS = integer wall-clock seconds from CLI start through verdict parsing and the wrapper prints review duration: <n>s; blocking = the count of [blocker] and [major] lines (schema mode: findings with either severity; a payload whose findings cannot be counted fails the run, no receipt); artifactPath = the normalized realpath on plan receipts only (repo-relative inside the work tree, absolute otherwise), while a double quote, backslash or control byte refuses pre-spend because the receipt encoder cannot carry it; verdict parsed from the mandated literal verdict line (schema mode: the verdict field); always fresh:true (one-shot) + grounded:true (native AGENTS.md auto-merge, factsHash null); probe = whether the run relaxed the quality guards (CODEX_PROBE=1), written on EVERY receipt so it self-declares — the kit's review-state gate rejects a probe-marked receipt (a probe review never attests) and equally rejects an unmarked one (silence is not a declaration); posture = the ACTUAL run posture {model, effort, tier} (tier null on the standard tier), written on EVERY receipt (D5) — the gate rejects a receipt with an absent/invalid posture (a pre-D5 wrapper minted it; re-run the review), one stderr banner line states the same posture, and a posture value carrying control bytes refuses pre-spend in every mode; a run whose final message carries NO recognized 'Verdict: <ship|revise|rethink>' line — empty or missing output included — exits 4 with NO receipt (D4: a FAILED review to RE-RUN, never a fatal session error); when the dispatch nonce seam is supplied — the AW_REVIEW_NONCE environment value or its plain-argument equivalent --nonce <n> (one seam: the flag assigns the same value; supplying both with different values refuses pre-spend) — under the safe grammar [A-Za-z0-9._-]{1,64} (anything else refuses pre-spend), the wrapper first mints the finding MANIFEST {schema, backend, nonce, fingerprint, findings} beside the receipts file (agent-workflow-finding-manifest-<backend>-<nonce>.json; atomic, no-clobber — a byte-identical rewrite is an idempotent no-op, different bytes refuse loudly) ORDERED before the receipt append — a failed manifest write EXCLUDES the receipt append, so a nonce-supplied dispatch can never land a receipt without its readable manifest; a nonce-less invocation adds NO nonce field and mints NO finding manifest (the existing wrapperVersion field still changes with each bridge release); a write failure warns, never fails the review",
53
53
  "notes": [
54
- "the review posture banner states what the run reaches in a jev= field: jev=api.typesafe.ai,docs.typesafe.ai when the run carries the read-only permissions profile `jev` (Linux, codex-cli 0.160.0 or newer, a version and profile digest not recorded as refused), else jev=unreachable (<reason>) under --sandbox read-only; a run whose codex refuses the profile exits 72 with no receipt; then a banner-only source=model:<s>,effort:<s> field — where each value came from: default, setting or environment — then a banner-only timeout=<duration> field — exactly the duration handed to timeout(1); the hard-timeout preflight fails CLOSED when no timeout/gtimeout binary exists (the wrapper refuses by name before any CLI run, so an uncapped review run can no longer happen), and none of the three fields enters the receipt posture or the D5 banner↔receipt parity",
54
+ "the review posture banner states what the run reaches in a jev= field: the run hosts its service-facts.txt lists when the run carries the read-only permissions profile `jev` (Linux, codex-cli 0.160.0 or newer, a version and profile digest not recorded as refused), else jev=unreachable (<reason>) under --sandbox read-only; a run whose codex refuses the profile exits 72 with no receipt; then a banner-only source=model:<s>,effort:<s> field — where each value came from: default, setting or environment — then a banner-only timeout=<duration> field — exactly the duration handed to timeout(1); the hard-timeout preflight fails CLOSED when no timeout/gtimeout binary exists (the wrapper refuses by name before any CLI run, so an uncapped review run can no longer happen), and none of the three fields enters the receipt posture or the D5 banner↔receipt parity",
55
55
  "quote the posture banner verbatim when labeling this dispatch — the banner is the machine-stated posture; a prose re-type drifts"
56
56
  ]
57
57
  }
@@ -81,7 +81,7 @@
81
81
  { "slot": "<extra codex flags...>", "required": false, "description": "extra codex flags, filtered by the guarded passthrough tiers" }
82
82
  ],
83
83
  "guardrails": [
84
- { "value": "runs under codex's OWN OS sandbox: the permissions profile `jev` (workspace writes, network to api.typesafe.ai and docs.typesafe.ai only), else workspace-write with network off", "enforcement": "enforced", "condition": "the profile needs Linux, codex-cli 0.160.0+, a repo outside every temp root and no recorded refusal; it cannot nest inside another sandbox — route it outside on the OBSERVED failure", "source": "capability.json roles.execute.contract.notes" },
84
+ { "value": "runs under codex's OWN OS sandbox: the permissions profile `jev` (workspace writes, network to the run hosts its service-facts.txt lists), else workspace-write with network off", "enforcement": "enforced", "condition": "profile: run hosts in service-facts.txt, Linux, codex-cli 0.160.0+, repo outside temp roots, no recorded refusal; cannot nest in a sandbox — route outside on OBSERVED failure", "source": "capability.json roles.execute.contract.notes" },
85
85
  { "value": "the guarded passthrough blocks model / sandbox / approval overrides", "enforcement": "enforced", "condition": "under the permissions profile `jev` even CODEX_PROBE=1 refuses --add-dir, -C, --cd, --enable and --disable", "source": "bin/codex-exec.sh" },
86
86
  { "value": "hard wall-clock cap CODEX_HARD_TIMEOUT (built-in default 3600s)", "enforcement": "enforced", "condition": "only while timeout(1)/gtimeout is on PATH — otherwise the wrapper warns and runs uncapped, and a NONCED run refuses pre-spend", "source": "capability.json settings.CODEX_HARD_TIMEOUT" },
87
87
  { "value": "ONE exec posture stderr banner line states the ACTUAL run posture before dispatch (session=fresh|resume:<id>; jev= names the reachable hosts or why none; jev= and timeout= are banner-only)", "enforcement": "enforced", "source": "bin/codex-exec.sh" },
@@ -140,7 +140,7 @@
140
140
  { "slot": "[--nonce <n>]", "required": false, "description": "the flow dispatch nonce — the plain-argument lane onto the AW_REVIEW_NONCE seam (round-open prints the value; flag and a non-empty env must agree)" }
141
141
  ],
142
142
  "guardrails": [
143
- { "value": "read-only — the permissions profile `jev` with no write entry, else --sandbox read-only: codex cannot edit, create or delete a file", "enforcement": "enforced", "condition": "the profile runs on Linux with codex-cli 0.160.0 or newer, off a codex version and profile digest recorded as refused, and reaches api.typesafe.ai and docs.typesafe.ai only", "source": "bin/codex-review.sh" },
143
+ { "value": "read-only — the permissions profile `jev` with no write entry, else --sandbox read-only: codex cannot edit, create or delete a file", "enforcement": "enforced", "condition": "Linux, codex-cli 0.160.0+, no recorded version/profile-digest refusal; reaches the run hosts its service-facts.txt lists", "source": "bin/codex-review.sh" },
144
144
  { "value": "runs on the host posture's model and effort", "enforcement": "enforced", "condition": "a one-off is refused pre-spend unless CODEX_PROBE=1 marks a throwaway probe", "source": "bin/codex-review.sh" },
145
145
  { "value": "a successful review appends one receipt line the review-state gate reads", "enforcement": "enforced", "condition": "a receipt write failure warns and the review still succeeds — the tree then reads un-receipted", "source": "capability.json roles.review.contract.receipt" }
146
146
  ],
@@ -163,7 +163,7 @@
163
163
  { "slot": "[extra focus...]", "required": false, "description": "extra focus words appended to the review directive" }
164
164
  ],
165
165
  "guardrails": [
166
- { "value": "read-only — the permissions profile `jev` with no write entry, else --sandbox read-only: codex cannot edit, create or delete a file", "enforcement": "enforced", "condition": "the profile runs on Linux with codex-cli 0.160.0 or newer, off a codex version and profile digest recorded as refused, and reaches api.typesafe.ai and docs.typesafe.ai only", "source": "bin/codex-review.sh" },
166
+ { "value": "read-only — the permissions profile `jev` with no write entry, else --sandbox read-only: codex cannot edit, create or delete a file", "enforcement": "enforced", "condition": "Linux, codex-cli 0.160.0+, no recorded version/profile-digest refusal; reaches the run hosts its service-facts.txt lists", "source": "bin/codex-review.sh" },
167
167
  { "value": "an oversized change set rides via a git-dir temp file, never truncated", "enforcement": "enforced", "source": "bin/codex-review.sh" },
168
168
  { "value": "a successful review appends one receipt line the review-state gate reads", "enforcement": "enforced", "condition": "a receipt write failure warns and the review still succeeds — the tree then reads un-receipted", "source": "capability.json roles.review.contract.receipt" }
169
169
  ],
@@ -228,8 +228,7 @@
228
228
  "effect": "codex-review code: above this assembled-payload size (bytes) the diff rides via a git-dir temp file instead of inline — never truncated."
229
229
  }
230
230
  ],
231
- "networkHosts": ["chatgpt.com", "*.chatgpt.com", "api.typesafe.ai", "docs.typesafe.ai"],
232
- "writableDirs": [{ "env": "CODEX_HOME", "default": "~/.codex" }],
231
+ "services": ["codex", "jev"],
233
232
  "detect": {
234
233
  "installed": {
235
234
  "env": "CODEX_CLI_BRIDGE_DIR",
@@ -38,7 +38,7 @@ Every dispatch states its ACTUAL posture on ONE stderr line: `codex-exec` emits
38
38
  (fresh and resume alike, only after the resume id is resolved and validated), `codex-review` emits
39
39
  `review posture: model=… effort=… tier=… jev=… source=… timeout=…`. When you label a dispatch for a user or a
40
40
  record, **quote the posture banner verbatim** — the banner is the machine-stated posture; a prose
41
- re-type drifts. The `jev=` field says what the run reaches: `jev=api.typesafe.ai,docs.typesafe.ai` under
41
+ re-type drifts. The `jev=` field says what the run reaches: the run hosts its service-facts.txt lists under
42
42
  the permissions profile `jev`, else `jev=unreachable (<reason>)` on today's flags (`codex-exec`:
43
43
  `sandbox=workspace-write`, network off; `codex-review`: `--sandbox read-only`); a run whose codex refuses
44
44
  the profile exits 72. The `jev=`, `source=` (`model:<s>,effort:<s>`, each `default`, `setting` or
@@ -50,7 +50,7 @@ CLOSED pre-spend there) — informational, never part of a receipt or the banner
50
50
 
51
51
  Use **`codex-exec`** when there is a concrete plan or focused instruction to implement, the project
52
52
  declares Hard Constraints + gates in `AGENTS.md`, the work fits `workspace-write` with no network beyond
53
- `api.typesafe.ai` and `docs.typesafe.ai`, and you can review the resulting diff.
53
+ the run hosts its service-facts.txt lists, and you can review the resulting diff.
54
54
 
55
55
  Use **`codex-review plan`** for a cold second opinion on a plan before executing it (risks, missing or
56
56
  mis-ordered steps, scope creep, missing gates).
@@ -97,9 +97,9 @@ codex-exec --resume <session-id> <file|-> # explicit session id
97
97
  ```
98
98
 
99
99
  Resume continues the SAME codex session, so you avoid re-sending the original context. It runs through
100
- the wrapper, which **re-establishes every invariant** (the subscription-only key rule — every `*_API_KEY`
101
- but `TYPESAFE_API_KEY` unset — `--ignore-user-config`, the host posture's model/effort) and **restates the
102
- full posture via `-c`** — because `codex exec resume` resets the sandbox/approval/network posture and
100
+ the wrapper, which **re-establishes every invariant** (the subscription-only key rule — unset every
101
+ `*_API_KEY` except the passed variables its service-facts.txt lists — `--ignore-user-config`, the host
102
+ posture's model/effort) and **restates the full posture via `-c`** — because `codex exec resume` resets the sandbox/approval/network posture and
103
103
  rejects `-s`/`--add-dir`/`-C`, the wrapper passes `-c approval_policy=never` and the posture it chooses
104
104
  afresh for this run: the profile `jev`'s four overrides, or `-c sandbox_mode=workspace-write -c
105
105
  sandbox_workspace_write.network_access=false`. A resume takes no passthrough flags and an
@@ -117,8 +117,7 @@ iterating on the same task; start a fresh `codex-exec` when the task changes.
117
117
  boundary must be a real executable; the real git path is baked into the shim, not exposed as an env
118
118
  var). `git config` is read-only too (blocked on a write flag or a `<name> <value>` set form). The
119
119
  orchestrator commits after review.
120
- - **New dependencies / network installs** are done by hand (exec reaches at most `api.typesafe.ai` and
121
- `docs.typesafe.ai`), then codex is re-dispatched.
120
+ - **New dependencies / network installs** are done by hand (exec reaches only the run hosts its service-facts.txt lists), then codex is re-dispatched.
122
121
  - **A hung run** is killed at `CODEX_HARD_TIMEOUT` (exec 3600s / review 1800s) and reported (exit
123
122
  124/137); raise it for a known-healthy slow run.
124
123
 
@@ -9,7 +9,7 @@ wrapper commands are `codex-exec` and `codex-review`, backed by `bin/codex-exec.
9
9
 
10
10
  | Level | Can write? | Network? | Wrapper that uses it |
11
11
  |---|---|---|---|
12
- | permissions profile `jev` | exec: the repository, `/tmp` and `$TMPDIR`; review: nothing | `api.typesafe.ai` and `docs.typesafe.ai` only | both wrappers on Linux with codex-cli 0.160.0 or newer (conditions below) |
12
+ | permissions profile `jev` | exec: the repository, `/tmp` and `$TMPDIR`; review: nothing | the run hosts its service-facts.txt lists | both wrappers on Linux with codex-cli 0.160.0 or newer (conditions below) |
13
13
  | `read-only` | no | no | `codex-review`, the fallback (codex only reads + emits findings) |
14
14
  | `workspace-write` | repository, `/tmp` and `$TMPDIR` | off (forced off) | `codex-exec`, the fallback (codex edits the repo) |
15
15
  | `danger-full-access` | anywhere | yes | never used by this skill |
@@ -37,11 +37,11 @@ On Linux with codex-cli 0.160.0 or newer, from a repository outside every temp r
37
37
  version and profile digest recorded as refused, the first two
38
38
  posture flags (`--sandbox workspace-write` and the `network_access=false` override) give way to the
39
39
  permissions profile `jev` — four overrides, never beside `--sandbox` or `sandbox_mode` (codex refuses
40
- both together):
40
+ both together). Here `$run_domains` is the domain table rendered from the run hosts its service-facts.txt lists:
41
41
 
42
42
  ```bash
43
43
  -c default_permissions=jev -c permissions.jev.network.enabled=true \
44
- -c 'permissions.jev.network.domains={"api.typesafe.ai"="allow","docs.typesafe.ai"="allow"}' \
44
+ -c "permissions.jev.network.domains=$run_domains" \
45
45
  -c 'permissions.jev.filesystem={":root"="read",":tmpdir"="write",":slash_tmp"="write",":workspace_roots"={"."="write"}}'
46
46
  ```
47
47
 
@@ -104,10 +104,9 @@ Note that `--skip-git-repo-check` (tier 2) only relaxes **codex's own** git-repo
104
104
  preflight still **requires a git work tree and a root `AGENTS.md`** and STOPs first if either is
105
105
  missing — passing it does not let `codex-exec` run outside a repo.
106
106
 
107
- ## Network: two hosts at most
107
+ ## Network
108
108
 
109
- A run reaches `api.typesafe.ai` and `docs.typesafe.ai` under the permissions profile `jev` and no other
110
- host; on today's flags `codex-exec` keeps the network off. Either way **new dependencies and any other
109
+ A run reaches the run hosts its service-facts.txt lists under the permissions profile `jev`; on today's flags `codex-exec` keeps the network off. Either way **new dependencies and any other
111
110
  network step are installed by a human**, not by codex: if a task needs a new package, codex must STOP
112
111
  and report it; the orchestrator installs it, then re-dispatches. The profile runs on Linux with
113
112
  codex-cli 0.160.0 or newer, off a codex version and profile digest recorded as refused and, for
@@ -207,9 +206,8 @@ no-op — while `codex-review` **refuses pre-spend** (the fail-closed hard-timeo
207
206
 
208
207
  Both wrappers, before invoking codex:
209
208
 
210
- - **unset** `OPENAI_BASE_URL` and every `*_API_KEY` except `TYPESAFE_API_KEY` (`OPENAI_API_KEY` and
211
- `CODEX_API_KEY` included), so a stray key can't switch to paid api-key billing; `TYPESAFE_API_KEY`
212
- passes as given (empty stays empty, unset stays unset) and changes no flag;
209
+ - **unset** `OPENAI_BASE_URL` and every `*_API_KEY` except the passed variables its service-facts.txt lists,
210
+ so a stray key can't switch to paid api-key billing; those variables pass as given (empty stays empty, unset stays unset) and change no flag;
213
211
  - pass **`--ignore-user-config`** so a personal `~/.codex/config.toml` cannot change behaviour. Auth
214
212
  still works: codex reads the cached login from `CODEX_HOME` (`~/.codex`) regardless of that flag;
215
213
  - preflight `codex login status` and refuse unless it contains `Logged in using ChatGPT`;
@@ -264,8 +262,7 @@ exec` over the precomputed diff instead, keeping every invariant intact.
264
262
  from the target project root.
265
263
  - **`exceeded the hard cap`** (exit 124/137): the run hit `CODEX_HARD_TIMEOUT` — raise it for a
266
264
  known-healthy slow run, or narrow the task, then re-dispatch.
267
- - **codex wants to install a dependency**: it can't (exec reaches at most `api.typesafe.ai` and
268
- `docs.typesafe.ai`) — install it by hand, then re-dispatch.
265
+ - **codex wants to install a dependency**: it can't (exec reaches only the run hosts its service-facts.txt lists) — install it by hand, then re-dispatch.
269
266
  - **exit 72**: codex refused the permissions profile `jev` (the message is on stderr). A refused profile
270
267
  key, codex's error item before the first turn, is recorded for that wrapper's profile digest when the
271
268
  state file can be written (otherwise the wrapper prints one warning naming the file), so that wrapper's
@@ -0,0 +1,9 @@
1
+ # generated from the kit's service fragments (agent-workflow-kit/tools/services/); do not edit
2
+ HOST=chatgpt.com
3
+ HOST=*.chatgpt.com
4
+ HOST=api.typesafe.ai
5
+ HOST=docs.typesafe.ai
6
+ RUN_HOST=api.typesafe.ai
7
+ RUN_HOST=docs.typesafe.ai
8
+ WRITABLE_DIR=CODEX_HOME:~/.codex
9
+ PASSED_VARIABLE=TYPESAFE_API_KEY
@@ -29,7 +29,7 @@ codex login status # expect: Logged in using ChatGPT
29
29
  This caches credentials under `CODEX_HOME` (`~/.codex`, e.g. `~/.codex/auth.json`). That directory is
30
30
  **personal** — never copy, commit, package, print, or share it. This skill needs **no API keys** and
31
31
  must not be configured with api-key billing; both wrappers unset `OPENAI_BASE_URL` and every
32
- `*_API_KEY` except `TYPESAFE_API_KEY` (the one key a run passes, as given) and pass
32
+ `*_API_KEY` except the passed variables its service-facts.txt lists (which pass as given) and pass
33
33
  `--ignore-user-config`, so billing can never silently fall back to pay-as-you-go and a personal
34
34
  `~/.codex/config.toml` can never change behaviour.
35
35
 
@@ -72,8 +72,8 @@ if it reports a missing git work tree or root `AGENTS.md`, run it from a project
72
72
  - The wrappers are **subscription-only** by design and will not use api-key billing.
73
73
  - `codex-exec` runs **workspace-write**; `codex-review` runs **read-only**. On Linux with codex-cli
74
74
  0.160.0 or newer, off a codex version and profile digest recorded as refused and, for `codex-exec`, from
75
- a repository outside every temp root, both carry the permissions profile `jev`, whose network reaches `api.typesafe.ai`
76
- and `docs.typesafe.ai` and no other host; elsewhere the network stays off. They also run on the host posture — `CODEX_MODEL` / `CODEX_EFFORT` from the
75
+ a repository outside every temp root, both carry the permissions profile `jev`, whose network reaches the run hosts its service-facts.txt
76
+ lists; elsewhere the network stays off. They also run on the host posture — `CODEX_MODEL` / `CODEX_EFFORT` from the
77
77
  bridge settings file, else `gpt-6.1-sol` / `high` — checked against the installed CLI's catalog,
78
78
  and refuse a one-off model or effort unless `CODEX_PROBE=1` (see `../SKILL.md`), enforce a hard
79
79
  timeout, capture only codex's final message, and block codex from writing git via a shim — see
package/capability.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "schema": 1,
4
4
  "name": "agent-workflow-kit",
5
5
  "kind": "composition-root",
6
- "version": "22.2.0",
6
+ "version": "23.1.0",
7
7
  "provides": [],
8
8
  "roles": {},
9
9
  "detect": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sabaiway/agent-workflow-kit",
3
- "version": "22.2.0",
3
+ "version": "23.1.0",
4
4
  "description": "Portable, cross-agent memory & workflow for AI coding agents — Claude Code, Codex, Cursor, Devin Desktop. One command deploys an AGENTS.md entry point + docs/ai context with cap/archive/index enforcement into any repo.",
5
5
  "keywords": [
6
6
  "ai-agents",