@sabaiway/agent-workflow-kit 23.0.0 → 23.2.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.
- package/CHANGELOG.md +50 -0
- package/README.md +1 -1
- package/SKILL.md +1 -1
- package/bridges/antigravity-cli-bridge/SKILL.md +11 -10
- package/bridges/antigravity-cli-bridge/bin/agy-jev.test.mjs +56 -7
- package/bridges/antigravity-cli-bridge/bin/agy-review.sh +80 -62
- package/bridges/antigravity-cli-bridge/bin/agy-review.test.mjs +0 -21
- package/bridges/antigravity-cli-bridge/bin/agy.sh +86 -12
- package/bridges/antigravity-cli-bridge/capability.json +2 -2
- package/bridges/antigravity-cli-bridge/references/models-and-flags.md +3 -3
- package/bridges/antigravity-cli-bridge/setup/README.md +1 -1
- package/bridges/codex-cli-bridge/SKILL.md +23 -24
- package/bridges/codex-cli-bridge/bin/codex-exec-jev.test.mjs +82 -47
- package/bridges/codex-cli-bridge/bin/codex-exec.sh +133 -52
- package/bridges/codex-cli-bridge/bin/codex-review-jev.test.mjs +44 -14
- package/bridges/codex-cli-bridge/bin/codex-review.sh +103 -30
- package/bridges/codex-cli-bridge/capability.json +6 -6
- package/bridges/codex-cli-bridge/references/driving-codex.md +6 -7
- package/bridges/codex-cli-bridge/references/sandbox-and-flags.md +8 -11
- package/bridges/codex-cli-bridge/setup/README.md +3 -3
- package/capability.json +1 -1
- package/package.json +1 -1
- package/references/modes/recommendations.md +2 -2
- package/references/modes/setup.md +2 -0
- package/references/modes/upgrade.md +3 -3
- package/references/modes/velocity.md +1 -1
- package/tools/apply-danger-check.mjs +1 -1
- package/tools/bridge-sandbox-recipe.mjs +7 -3
- package/tools/bridge-settings-read.mjs +2 -0
- package/tools/detect-backends.mjs +22 -14
- package/tools/fs-safe.mjs +2 -2
- package/tools/manifest/schema.md +2 -2
- package/tools/refresh-parity.mjs +3 -3
- package/tools/services/antigravity.json +3 -0
- package/tools/services/codex.json +5 -0
- package/tools/services/index.mjs +49 -5
- package/tools/services/jev.json +1 -0
- package/tools/setup-backends.mjs +37 -48
- package/tools/velocity-profile.mjs +1 -1
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
# - codex may edit the repo and the temp dirs, nothing else: on Linux with codex-cli 0.160.0 or
|
|
13
13
|
# newer, from a repository outside every temp root and off a codex version and profile digest
|
|
14
14
|
# recorded as refused, the run carries the permissions profile `jev` (workspace write, network to
|
|
15
|
-
#
|
|
15
|
+
# the run hosts its service-facts.txt lists); elsewhere today's workspace-write sandbox with network off. The banner's
|
|
16
16
|
# jev= field says which; new dependencies / network installs are done by a human
|
|
17
17
|
# - approval_policy=never: there is no TTY in exec; anything needing escalation
|
|
18
18
|
# is refused and reported, then handled by hand
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
#
|
|
31
31
|
# Auth: SUBSCRIPTION ONLY. Uses the cached ChatGPT login under CODEX_HOME
|
|
32
32
|
# (~/.codex). The wrapper unsets OPENAI_BASE_URL and every *_API_KEY except
|
|
33
|
-
#
|
|
33
|
+
# the passed variables its service-facts.txt lists, and passes --ignore-user-config, so a stray
|
|
34
34
|
# key or a personal ~/.codex/config.toml can never silently switch billing or change
|
|
35
35
|
# behaviour. No credentials are bundled.
|
|
36
36
|
#
|
|
@@ -44,14 +44,90 @@
|
|
|
44
44
|
# CODEX_PROBE=1 CODEX_MODEL=<slug> codex-exec <file> # throwaway probe (the one route to a one-off)
|
|
45
45
|
set -euo pipefail
|
|
46
46
|
|
|
47
|
+
aw_script_dir() {
|
|
48
|
+
local src="${BASH_SOURCE[0]}" dir hops=0 max_hops=16
|
|
49
|
+
while :; do
|
|
50
|
+
case "$src" in */*) dir="${src%/*}"; dir="${dir:-/}" ;; *) dir=. ;; esac
|
|
51
|
+
dir="$(CDPATH= builtin cd -P -- "$dir" 2>/dev/null && builtin pwd -P)" || break
|
|
52
|
+
[[ -L "$src" ]] || { printf '%s\n' "$dir"; return 0; }
|
|
53
|
+
if (( hops >= max_hops )); then
|
|
54
|
+
printf 'error: exceeded %s symlink hops; could not resolve its OWN directory\n' "$max_hops" >&2
|
|
55
|
+
return 127
|
|
56
|
+
fi
|
|
57
|
+
hops=$((hops + 1))
|
|
58
|
+
src="$(command readlink -- "$src" 2>/dev/null)" || break
|
|
59
|
+
case "$src" in /*) ;; *) src="$dir/$src" ;; esac
|
|
60
|
+
done
|
|
61
|
+
printf 'error: could not resolve its OWN directory\n' >&2
|
|
62
|
+
return 127
|
|
63
|
+
}
|
|
64
|
+
aw_read_service_facts() {
|
|
65
|
+
local path="${1%/*}/service-facts.txt" line key value entry number=0 bad=0 valid seen=() run_lines=()
|
|
66
|
+
local host_re='^(\*\.)?[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]([abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-]*[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789])?(\.[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]([abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-]*[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789])?)+$'
|
|
67
|
+
local variable_re='^[ABCDEFGHIJKLMNOPQRSTUVWXYZ][ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_]*$'
|
|
68
|
+
local command_re='^[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789][abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789._-]* \*$'
|
|
69
|
+
local env directory segments LC_ALL=C
|
|
70
|
+
AW_FACT_HOST=() AW_FACT_RUN_HOST=() AW_FACT_PASSED_VARIABLE=()
|
|
71
|
+
if [[ -f "$path" && -r "$path" ]]; then
|
|
72
|
+
while IFS= read -r line; do
|
|
73
|
+
number=$((number + 1)); valid=1
|
|
74
|
+
if (( number == 1 )); then
|
|
75
|
+
[[ "$line" == "# generated from the kit's service fragments (agent-workflow-kit/tools/services/); do not edit" ]] || bad=1
|
|
76
|
+
continue
|
|
77
|
+
fi
|
|
78
|
+
key="${line%%=*}"; value="${line#*=}"
|
|
79
|
+
[[ "$line" == *=* ]] || valid=0
|
|
80
|
+
case "$key" in
|
|
81
|
+
HOST|RUN_HOST) [[ "$value" =~ $host_re ]] || valid=0
|
|
82
|
+
if [[ "$key" == RUN_HOST && "$value" == '*.'* ]]; then valid=0; fi ;;
|
|
83
|
+
PASSED_VARIABLE) [[ "$value" =~ $variable_re && "$value" != OPENAI_BASE_URL ]] || valid=0 ;;
|
|
84
|
+
EXCLUDED_COMMAND) [[ "$value" =~ $command_re ]] || valid=0 ;;
|
|
85
|
+
WRITABLE_DIR)
|
|
86
|
+
env="${value%%:*}"; directory="${value#*:}"; segments="/${directory//\\//}/"
|
|
87
|
+
[[ "$value" == *:* && ( -z "$env" || "$env" =~ $variable_re ) &&
|
|
88
|
+
( "$directory" == '~/'* || "$directory" == /* ) && "$directory" != */ &&
|
|
89
|
+
"$directory" != *[\*\?\[\]]* && ! "$directory" =~ [[:cntrl:]] && "$segments" != */../* ]] || valid=0 ;;
|
|
90
|
+
*) valid=0 ;;
|
|
91
|
+
esac
|
|
92
|
+
for entry in ${seen[@]+"${seen[@]}"}; do [[ "$entry" != "$line" ]] || valid=0; done
|
|
93
|
+
if (( ! valid )); then (( bad )) || bad=$number; continue; fi
|
|
94
|
+
seen+=("$line")
|
|
95
|
+
case "$key" in
|
|
96
|
+
HOST) AW_FACT_HOST+=("$value") ;; RUN_HOST) AW_FACT_RUN_HOST+=("$value"); run_lines+=("$number") ;;
|
|
97
|
+
PASSED_VARIABLE) AW_FACT_PASSED_VARIABLE+=("$value") ;;
|
|
98
|
+
esac
|
|
99
|
+
done <"$path"
|
|
100
|
+
if (( ! number )); then bad=1; fi
|
|
101
|
+
if [[ -n "$line" ]] && (( ! bad )); then bad=$((number + 1)); fi
|
|
102
|
+
for ((number=0; number<${#AW_FACT_RUN_HOST[@]}; number++)); do
|
|
103
|
+
valid=0
|
|
104
|
+
for entry in ${AW_FACT_HOST[@]+"${AW_FACT_HOST[@]}"}; do [[ "$entry" != "${AW_FACT_RUN_HOST[number]}" ]] || valid=1; done
|
|
105
|
+
if (( ! valid && (! bad || run_lines[number] < bad) )); then bad=${run_lines[number]}; fi
|
|
106
|
+
done
|
|
107
|
+
(( bad )) || return 0
|
|
108
|
+
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
|
|
109
|
+
else
|
|
110
|
+
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
|
|
111
|
+
fi
|
|
112
|
+
exit 127
|
|
113
|
+
}
|
|
114
|
+
HERE="$(aw_script_dir)" || exit 127
|
|
115
|
+
aw_read_service_facts "$HERE"
|
|
116
|
+
|
|
47
117
|
# --- --help / -h (pre-preflight: no codex, no login, no git tree needed) -------
|
|
48
118
|
# Keyed ONLY on the FIRST argument — never a scan of all args, else a passthrough
|
|
49
119
|
# payload like `codex-exec f - -- --help` would be intercepted.
|
|
50
120
|
# The contract below is drift-guarded against capability.json roles.execute.contract.
|
|
51
121
|
case "${1:-}" in
|
|
52
122
|
--help|-h)
|
|
123
|
+
aw_help_network="network off"
|
|
124
|
+
if (( ${#AW_FACT_RUN_HOST[@]} )); then
|
|
125
|
+
aw_help_hosts=""
|
|
126
|
+
for aw_host in "${AW_FACT_RUN_HOST[@]}"; do aw_help_hosts+="${aw_help_hosts:+, }$aw_host"; done
|
|
127
|
+
aw_help_network="network where the profile runs (the reachable host list is $aw_help_hosts) and off elsewhere"
|
|
128
|
+
fi
|
|
129
|
+
printf '%s\n' "codex-exec — delegate plan/instruction EXECUTION to the OpenAI Codex CLI (subscription-only; writes to the repository and the temp dirs only, $aw_help_network, git writes blocked — the orchestrator commits)."
|
|
53
130
|
cat <<'HELP'
|
|
54
|
-
codex-exec — delegate plan/instruction EXECUTION to the OpenAI Codex CLI (subscription-only; writes to the repository and the temp dirs only, network to api.typesafe.ai and docs.typesafe.ai where the profile runs and off elsewhere, git writes blocked — the orchestrator commits).
|
|
55
131
|
|
|
56
132
|
Usage:
|
|
57
133
|
codex-exec [--nonce <n>] <plan-file|->
|
|
@@ -125,39 +201,42 @@ Notes:
|
|
|
125
201
|
nested inside a harness sandbox (the FS turns read-only) — route it OUTSIDE the harness sandbox
|
|
126
202
|
(excludedCommands / a per-run consented bypass) on the OBSERVED bwrap/EPERM failure, never a
|
|
127
203
|
preemptive blanket
|
|
128
|
-
exec posture banner: ONE stderr line before dispatch states the ACTUAL run posture —
|
|
129
|
-
|
|
130
|
-
from RESOLVED post-validation values; the resume id is validated
|
|
131
|
-
a model, effort, tier or timeout value refuse pre-spend, and a jev=
|
|
204
|
+
exec posture banner: ONE stderr line before dispatch states the ACTUAL run posture — exec
|
|
205
|
+
posture: model=… effort=… tier=… sandbox=jev-profile|workspace-write session=fresh|resume:<id>
|
|
206
|
+
jev=… source=… timeout=… — from RESOLVED post-validation values; the resume id is validated
|
|
207
|
+
pre-spend, control bytes in a model, effort, tier or timeout value refuse pre-spend, and a jev=
|
|
208
|
+
reason shows a control byte as ?
|
|
132
209
|
threat model: the sidecar byte and grammar screens detect corrupted input under a trusted parent
|
|
133
210
|
environment. A hostile parent environment — including exported shell functions or PATH
|
|
134
211
|
substitution of core/backend commands — is outside the threat model and can substitute the
|
|
135
|
-
backend itself. Targeted shadow-proof resolution protects banner/dispatch honesty from
|
|
136
|
-
shadowing; it is not an environment security boundary
|
|
137
|
-
the exec posture banner states what the run reaches in a jev= field:
|
|
138
|
-
when the run carries the permissions profile `jev` (Linux, codex-cli
|
|
139
|
-
outside every temp root, a version and profile digest not
|
|
140
|
-
jev=unreachable (<reason>) on today's workspace-write flags with
|
|
141
|
-
refuses the profile exits 72 with no success receipt and, for a
|
|
142
|
-
version and digest when the state file can be written, so the
|
|
143
|
-
source=model:<s>,effort:<s> field —
|
|
144
|
-
|
|
145
|
-
uncapped
|
|
146
|
-
|
|
212
|
+
backend itself. Targeted shadow-proof resolution protects banner/dispatch honesty from
|
|
213
|
+
accidental shadowing; it is not an environment security boundary
|
|
214
|
+
the exec posture banner states what the run reaches in a jev= field: the run hosts its
|
|
215
|
+
service-facts.txt lists when the run carries the permissions profile `jev` (Linux, codex-cli
|
|
216
|
+
0.160.0 or newer, a repository outside every temp root, a version and profile digest not
|
|
217
|
+
recorded as refused), else jev=unreachable (<reason>) on today's workspace-write flags with
|
|
218
|
+
network off; a run whose codex refuses the profile exits 72 with no success receipt and, for a
|
|
219
|
+
refused profile key, records its version and digest when the state file can be written, so the
|
|
220
|
+
next run on them takes today's flags; then a banner-only source=model:<s>,effort:<s> field —
|
|
221
|
+
where each value came from: default, setting or environment — then a banner-only
|
|
222
|
+
timeout=<duration|uncapped> field — exactly the duration handed to timeout(1), uncapped when no
|
|
223
|
+
timeout/gtimeout binary caps the run; INFORMATIONAL only: none of the three is persisted in a
|
|
224
|
+
receipt or session sidecar
|
|
147
225
|
quote the posture banner verbatim when labeling this dispatch — the banner is the machine-stated
|
|
148
226
|
posture; a prose re-type drifts
|
|
149
227
|
every-run nested-sandbox scan (DUAL policy, deliberately two different rules): the scan runs on
|
|
150
|
-
EVERY completed run, not only a failed one, because a run that SURVIVES the nested-sandbox
|
|
151
|
-
exits 0 with an ungrounded answer and nothing said so. Failed run (rc != 0): the
|
|
152
|
-
whole-trace combination rule prints the recovery hint. Successful run (rc == 0):
|
|
153
|
-
ONLY on precise per-item evidence — both a sandbox-mechanism token AND a
|
|
154
|
-
failure token inside the aggregated_output of ONE command_execution item
|
|
155
|
-
(a nonzero exit_code, or the serialized status "failed"); a null
|
|
156
|
-
itself, tokens split across two items never fire, and a successful
|
|
157
|
-
The answer is printed FIRST on stdout, then the warning on stderr.
|
|
158
|
-
status does NOT change on that lane (a distinct nonzero exit would
|
|
159
|
-
polarity, refusing real work whenever the scan over-warns), so an
|
|
160
|
-
status alone can still bank an ungrounded answer — the stderr
|
|
228
|
+
EVERY completed run, not only a failed one, because a run that SURVIVES the nested-sandbox
|
|
229
|
+
failure exits 0 with an ungrounded answer and nothing said so. Failed run (rc != 0): the
|
|
230
|
+
existing loose whole-trace combination rule prints the recovery hint. Successful run (rc == 0):
|
|
231
|
+
a warning fires ONLY on precise per-item evidence — both a sandbox-mechanism token AND a
|
|
232
|
+
permission/read-only failure token inside the aggregated_output of ONE command_execution item
|
|
233
|
+
whose failure is PROVEN (a nonzero exit_code, or the serialized status "failed"); a null
|
|
234
|
+
exit_code is never failure by itself, tokens split across two items never fire, and a successful
|
|
235
|
+
command's output never fires. The answer is printed FIRST on stdout, then the warning on stderr.
|
|
236
|
+
HONEST RESIDUAL: the exit status does NOT change on that lane (a distinct nonzero exit would
|
|
237
|
+
give a heuristic scan DENY polarity, refusing real work whenever the scan over-warns), so an
|
|
238
|
+
orchestrator keying on exit status alone can still bank an ungrounded answer — the stderr
|
|
239
|
+
warning is the signal
|
|
161
240
|
|
|
162
241
|
Settings file (KEY=VALUE, parsed never sourced; env wins over file, file wins over built-in default):
|
|
163
242
|
${XDG_CONFIG_HOME:-~/.config}/agent-workflow/bridge-settings.conf
|
|
@@ -367,15 +446,15 @@ aw_resolve_timeout_bin() {
|
|
|
367
446
|
printf '%s' "$bin"
|
|
368
447
|
}
|
|
369
448
|
aw_scrub_billing_keys() {
|
|
370
|
-
|
|
371
|
-
# switch a run to paid billing; TYPESAFE_API_KEY is neither read nor set, so it reaches the CLI exactly as given.
|
|
372
|
-
local name
|
|
449
|
+
local name passed keep
|
|
373
450
|
unset OPENAI_BASE_URL 2>/dev/null || true
|
|
374
451
|
for name in $(compgen -v); do
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
452
|
+
[[ "$name" == *_API_KEY ]] || continue
|
|
453
|
+
keep=0
|
|
454
|
+
for passed in ${AW_FACT_PASSED_VARIABLE[@]+"${AW_FACT_PASSED_VARIABLE[@]}"}; do
|
|
455
|
+
[[ "$name" != "$passed" ]] || keep=1
|
|
456
|
+
done
|
|
457
|
+
if (( ! keep )); then unset "$name" 2>/dev/null || true; fi
|
|
379
458
|
done
|
|
380
459
|
return 0
|
|
381
460
|
}
|
|
@@ -430,7 +509,7 @@ CHATGPT_LOGIN_GUARD="Logged in using ChatGPT"
|
|
|
430
509
|
# receipt this wrapper mints; scripts/release/version-sync.mjs bumps it under the one-anchor-per-file
|
|
431
510
|
# rule, so a release can never leave it behind (the AD-053 drift class).
|
|
432
511
|
AW_RECEIPT_BACKEND="codex"
|
|
433
|
-
AW_BRIDGE_VERSION="
|
|
512
|
+
AW_BRIDGE_VERSION="6.0.0" # aw-version-anchor
|
|
434
513
|
# The kill grace handed to timeout(1) as --kill-after, and recorded in the receipt as killGraceS:
|
|
435
514
|
# ONE constant, so the number the ledger checks against the dispatch deadline is the number the run
|
|
436
515
|
# actually applied.
|
|
@@ -496,15 +575,16 @@ if [[ ! -f AGENTS.md ]]; then
|
|
|
496
575
|
fi
|
|
497
576
|
|
|
498
577
|
# --- The permissions profile `jev` (spec jev-every-run) — byte-identical in codex-exec.sh and codex-review.sh ---
|
|
499
|
-
#
|
|
500
|
-
# --sandbox nor sandbox_mode beside them: its filesystem part is this wrapper's AW_PROFILE_FILESYSTEM, and its
|
|
501
|
-
# network reaches api.typesafe.ai and docs.typesafe.ai and no other host (a literal of this bridge, which never
|
|
502
|
-
# imports the kit). Elsewhere, and on a codex version and profile digest recorded as refused, the run keeps
|
|
503
|
-
# today's flags and its banner says jev=unreachable (<reason>). Each run, a resume included, chooses afresh.
|
|
578
|
+
# The run hosts come from service-facts.txt.
|
|
504
579
|
AW_PROFILE_FLOOR="0.160.0"
|
|
505
|
-
|
|
580
|
+
aw_profile_domains="" aw_run_hosts="" aw_reachable_hosts=""
|
|
581
|
+
for aw_host in ${AW_FACT_RUN_HOST[@]+"${AW_FACT_RUN_HOST[@]}"}; do
|
|
582
|
+
aw_profile_domains+="${aw_profile_domains:+,}\"$aw_host\"=\"allow\""
|
|
583
|
+
aw_run_hosts+="${aw_run_hosts:+,}$aw_host"
|
|
584
|
+
aw_reachable_hosts+="${aw_reachable_hosts:+, }$aw_host"
|
|
585
|
+
done
|
|
506
586
|
AW_PROFILE_FLAGS=(-c default_permissions=jev -c permissions.jev.network.enabled=true
|
|
507
|
-
-c
|
|
587
|
+
-c "permissions.jev.network.domains={$aw_profile_domains}"
|
|
508
588
|
-c "permissions.jev.filesystem=$AW_PROFILE_FILESYSTEM")
|
|
509
589
|
# The version on the first line of `codex --version` ("codex-cli X.Y.Z[-pre]"); nothing when unreadable.
|
|
510
590
|
aw_codex_version() { # $1 = the timeout binary or ""
|
|
@@ -571,7 +651,9 @@ aw_profile_choose() { # $1 = the timeout binary or "", $2 = the repository's t
|
|
|
571
651
|
profile_version="$(aw_codex_version "$1")"
|
|
572
652
|
profile_digest="$(aw_profile_digest)"
|
|
573
653
|
os="$(uname -s 2>/dev/null)" || os=""
|
|
574
|
-
if
|
|
654
|
+
if (( ! ${#AW_FACT_RUN_HOST[@]} )); then
|
|
655
|
+
profile_reason="no run host in service-facts.txt"
|
|
656
|
+
elif [[ "$os" != "Linux" ]]; then
|
|
575
657
|
profile_reason="not linux (${os:-unreadable})"
|
|
576
658
|
elif [[ -z "$profile_version" ]]; then
|
|
577
659
|
profile_reason="codex version unreadable"
|
|
@@ -584,7 +666,7 @@ aw_profile_choose() { # $1 = the timeout binary or "", $2 = the repository's t
|
|
|
584
666
|
else
|
|
585
667
|
profile_on=1
|
|
586
668
|
fi
|
|
587
|
-
if (( profile_on )); then profile_label="$
|
|
669
|
+
if (( profile_on )); then profile_label="$aw_run_hosts"; else profile_label="unreachable ($profile_reason)"; fi
|
|
588
670
|
profile_label="${profile_label//[$'\x01'-$'\x1f'$'\x7f']/?}"
|
|
589
671
|
return 0
|
|
590
672
|
}
|
|
@@ -650,13 +732,12 @@ aw_profile_choose "$timeout_bin" "$(aw_repo_temp_root)"
|
|
|
650
732
|
network_flags=()
|
|
651
733
|
if (( profile_on )); then
|
|
652
734
|
aw_sandbox_label="jev-profile"
|
|
653
|
-
read -r -d '' aw_network_item <<
|
|
654
|
-
5. Do NOT commit. Network: the
|
|
655
|
-
reachable; network access to any other host is an escalation: STOP and report.
|
|
735
|
+
read -r -d '' aw_network_item <<ITEM || true
|
|
736
|
+
5. Do NOT commit. Network: the reachable host list is $aw_reachable_hosts; network access to any other host is an escalation: STOP and report.
|
|
656
737
|
If you hit another blocker needing escalation (writes outside the repo, a live
|
|
657
738
|
approval, or an ambiguous decision), STOP and report it clearly — never guess.
|
|
658
739
|
ITEM
|
|
659
|
-
aw_network_line="Network, as of this run (it replaces any earlier statement): the
|
|
740
|
+
aw_network_line="Network, as of this run (it replaces any earlier statement): the reachable host list is $aw_reachable_hosts; network access to any other host is an escalation: STOP and report."
|
|
660
741
|
else
|
|
661
742
|
aw_sandbox_label="workspace-write"
|
|
662
743
|
network_flags=(-c sandbox_workspace_write.network_access=false)
|
|
@@ -683,7 +764,7 @@ ORCHESTRATOR EXECUTION CONTRACT — read before the task, follow it exactly:
|
|
|
683
764
|
task). If the project declares NO gate set, STOP and report — do NOT invent
|
|
684
765
|
checks. Fix every failure before finishing.
|
|
685
766
|
DIRECTIVE
|
|
686
|
-
# Item 5 states this run's posture (spec jev-every-run): the
|
|
767
|
+
# Item 5 states this run's posture (spec jev-every-run): the run hosts on a profile run, network access whole on a fallback run.
|
|
687
768
|
ORCHESTRATOR_DIRECTIVE="$ORCHESTRATOR_DIRECTIVE"$'\n'"$aw_network_item"$'\n\nTASK:'
|
|
688
769
|
|
|
689
770
|
read -r -d '' RESUME_REMINDER <<'REMINDER' || true
|
|
@@ -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,
|
|
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}`,
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
106
|
-
|
|
107
|
-
jev=unreachable (<reason>) under --sandbox read-only; a run whose codex refuses the profile
|
|
108
|
-
72 with no receipt; then a banner-only source=model:<s>,effort:<s> field — where each
|
|
109
|
-
from: default, setting or environment — then a banner-only timeout=<duration> field —
|
|
110
|
-
duration handed to timeout(1); the hard-timeout preflight fails CLOSED when no
|
|
111
|
-
binary exists (the wrapper refuses by name before any CLI run, so an uncapped
|
|
112
|
-
longer happen), and none of the three fields enters the receipt posture or the
|
|
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
|
-
|
|
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
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
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="
|
|
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
|
-
#
|
|
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
|
-
|
|
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
|
|
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
|
|
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="$
|
|
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
|
|
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
|
|
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
|