@sabaiway/agent-workflow-kit 23.0.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.
- package/CHANGELOG.md +24 -0
- 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/tools/detect-backends.mjs +22 -14
- package/tools/services/index.mjs +5 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,30 @@ Semantically versioned ([semver](https://semver.org)), newest first. The `versio
|
|
|
4
4
|
is the current release. `upgrade` mode reads a project's `docs/ai/.workflow-version` and applies
|
|
5
5
|
every `migrations/<version>-<slug>.md` newer than it, in semver order.
|
|
6
6
|
|
|
7
|
+
## 23.1.0 — every bridge wrapper reads its hosts and passed keys from the file in its own folder (AD-225)
|
|
8
|
+
|
|
9
|
+
**The bridge wrappers no longer carry their own copy of the Jev hosts and key: each reads them from the
|
|
10
|
+
`service-facts.txt` the kit writes into its bridge folder.** A host or key change is now one edit to the kit's service
|
|
11
|
+
files; the wrappers, their `--help` and their banners follow it. For the facts the kit ships today a run reaches the
|
|
12
|
+
same hosts, passes the same key and prints the same posture banners; a profile run's network instruction now reads
|
|
13
|
+
`the reachable host list is …`, and agy-run's line before dispatch now opens `passed variables: TYPESAFE_API_KEY;` in
|
|
14
|
+
place of `jev: TYPESAFE_API_KEY passed;`. This kit carries codex bridge 6.0.0 and antigravity bridge 8.0.0; your next
|
|
15
|
+
`/agent-workflow-kit upgrade` (or `init`) refreshes the bridges you placed, with no question.
|
|
16
|
+
|
|
17
|
+
- **A broken or missing facts file stops the run.** `codex-exec`, `codex-review`, `agy-run` and `agy-review` check the
|
|
18
|
+
file before `--help` and before any CLI starts. A missing, unreadable or malformed file exits 127 with one line
|
|
19
|
+
naming the file, the bad line and `/agent-workflow-kit upgrade`, which writes it again.
|
|
20
|
+
- **Your own `HOST` still reaches the CLI.** The wrappers keep what they read under their own names, so a `HOST`
|
|
21
|
+
variable you exported is passed on as before.
|
|
22
|
+
- **agy-review runs the agy wrapper from its own folder**, never an `agy-run` found first on your PATH, so both read the
|
|
23
|
+
same facts.
|
|
24
|
+
- **The bridge pages name no host and no key** outside the two Jev paragraphs: they say the run reaches the hosts its
|
|
25
|
+
`service-facts.txt` lists.
|
|
26
|
+
- **The setup check takes the sign-in folders from the service files.** When it cannot use one, the credentials read as
|
|
27
|
+
`unknown` and the reason is printed instead of a sign-in hint.
|
|
28
|
+
- **The service files refuse two unsafe shapes:** a `*.` host in a service the run itself reaches, and
|
|
29
|
+
`OPENAI_BASE_URL` as a passed variable.
|
|
30
|
+
|
|
7
31
|
## 23.0.0 — the kit reads each bridge's hosts and state folders from a separate file for each service (AD-224)
|
|
8
32
|
|
|
9
33
|
**The network hosts and state folders the kit sets up for a bridge now come from a separate kit file for each service
|
package/SKILL.md
CHANGED
|
@@ -3,7 +3,7 @@ name: agent-workflow-kit
|
|
|
3
3
|
description: Deploy or upgrade a portable AI-agent memory-and-workflow system in any project. Use when the user wants to bootstrap `docs/ai/` + an entry-point `AGENTS.md` (+ `CLAUDE.md` alias) + cap/archive/index enforcement in a new or existing repo, set up the Memory Map and session protocols, install the docs-rotation pre-commit hook, or run `/agent-workflow-kit` / `/agent-workflow-kit upgrade`. Triggers on phrases like "set up the memory system", "deploy the AI workflow here", "bootstrap docs/ai", "upgrade the workflow". New to the epic, story and task tier? Run `/agent-workflow-kit tier`. A typed decision with a confidence from Jev? Run `/agent-workflow-kit jev`.
|
|
4
4
|
disable-model-invocation: true
|
|
5
5
|
metadata:
|
|
6
|
-
version: '23.
|
|
6
|
+
version: '23.1.0'
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
# agent-workflow-kit
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: antigravity-cli-bridge
|
|
3
3
|
description: Delegate work to Google's Antigravity CLI (`agy`) — the successor to Gemini CLI — to reach Gemini, Claude, and GPT-OSS models under a Google AI Pro/Ultra subscription from the terminal. Use when the user wants to run a headless `agy` prompt, hand a focused task or second-opinion review to `agy`, install or authenticate Antigravity CLI, check or economise its quota/models, bridge project context into `agy`, set up a second delegated-execution backend beside Codex, or troubleshoot `agy` flags, models, auth, conversations, or its headless behaviour.
|
|
4
4
|
metadata:
|
|
5
|
-
version: '
|
|
5
|
+
version: '8.0.0'
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# antigravity-cli-bridge
|
|
@@ -44,16 +44,15 @@ wrapper [`bin/agy.sh`](bin/agy.sh) on `PATH` as `agy-run`.
|
|
|
44
44
|
|
|
45
45
|
Never read, print, copy, commit, or package that token — it is personal and is **never bundled** with
|
|
46
46
|
this skill. The wrapper [`bin/agy.sh`](bin/agy.sh) **unsets `OPENAI_BASE_URL` and every `*_API_KEY` except
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
switch you to pay-as-you-go billing.
|
|
47
|
+
the passed variables its service-facts.txt lists** (those variables pass as given) before invoking `agy`,
|
|
48
|
+
so a stray key can never silently switch you to pay-as-you-go billing.
|
|
50
49
|
|
|
51
50
|
**Caveat:** the subscription has a finite quota. Keep probes short (see *How the main agent drives
|
|
52
51
|
agy*); the model every review and kept run uses is the host posture below, never a per-call pick.
|
|
53
52
|
|
|
54
53
|
## Models
|
|
55
54
|
|
|
56
|
-
The model is **
|
|
55
|
+
The model is **a host setting**: `AGY_MODEL=<exact display string>` in the bridge settings file
|
|
57
56
|
`${XDG_CONFIG_HOME:-~/.config}/agent-workflow/bridge-settings.conf` is the host posture, else the
|
|
58
57
|
built-in default `Gemini 3.8 Flash (High)`. An `AGY_MODEL` environment value off the host posture
|
|
59
58
|
(an explicitly empty one included) is a one-off, which `agy-run` (the probe role) runs and
|
|
@@ -226,9 +225,11 @@ AGY_MODEL="<an offered display string>" agy-run \
|
|
|
226
225
|
**The Jev skill in a delegated run.** A headless `agy-run` loads the vendor's Jev skill from the user root the kit's
|
|
227
226
|
`jev-skill` command fills, `~/.gemini/config/skills` (measured 2026-10-02 on agy 1.2.14: a probe skill under that
|
|
228
227
|
root was listed, none under `~/.gemini/antigravity-cli/skills`), and `TYPESAFE_API_KEY` passes the wrappers as given
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
228
|
+
under the shared key rule: every `*_API_KEY` except the passed variables its service-facts.txt lists is unset;
|
|
229
|
+
nothing in agy's permissions is widened, no flag is added and no setting is written. The run hosts its
|
|
230
|
+
service-facts.txt lists do not widen those permissions. With a non-empty passed
|
|
231
|
+
variable, `agy-run` prints one line naming the non-empty passed variables before dispatch: a headless agy runs a
|
|
232
|
+
request that uses them only where the user's agy permissions allow commands, and the first denied command ends the run. `agy-review` makes no Jev
|
|
232
233
|
request while its model obeys its prompts, which forbid every tool; that prohibition is advisory, not a sandbox. The documented opt-in `-- --dangerously-skip-permissions`
|
|
233
234
|
stays admitted, and such a run carries the key into an agy whose network and file tool are unconfined. Two residuals
|
|
234
235
|
stand: the key now sits in every run's environment, and a `web_search` or fetch tool agy is permitted to run may reach
|
|
@@ -255,8 +256,8 @@ checklist, prompt templates, output handling). Essentials:
|
|
|
255
256
|
writes (branch/add/commit/stash/reset/rewrite) with the orchestrator, and tell `agy` in the prompt
|
|
256
257
|
to return findings only. Add `-- --sandbox` when delegating anything that could trigger
|
|
257
258
|
terminal/tool work; opt into `-- --add-dir . --dangerously-skip-permissions` only for a flow that
|
|
258
|
-
genuinely needs writes, then review the diff afterwards (such a run also carries
|
|
259
|
-
|
|
259
|
+
genuinely needs writes, then review the diff afterwards (such a run also carries the passed variables
|
|
260
|
+
its service-facts.txt lists, as given, into an agy whose network and file tool are unconfined).
|
|
260
261
|
|
|
261
262
|
## Complementary skills (optional, standalone-first)
|
|
262
263
|
|
|
@@ -3,25 +3,26 @@
|
|
|
3
3
|
// opt-in stays admitted. A recording stub stands in front of the harness fake agy.
|
|
4
4
|
import { describe, it, after } from 'node:test';
|
|
5
5
|
import assert from 'node:assert/strict';
|
|
6
|
-
import { writeFileSync, readFileSync, existsSync, rmSync } from 'node:fs';
|
|
6
|
+
import { writeFileSync, readFileSync, existsSync, rmSync, cpSync, 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
10
|
import { makeSandbox, farmFor, FAKE_AGY } from './agy-review-harness.test.mjs';
|
|
11
|
+
const stripGitLocationEnv = (env) => Object.fromEntries(Object.entries(env).filter(([key]) => !/^[Gg][Ii][Tt]_/.test(key)));
|
|
11
12
|
|
|
12
13
|
const HERE = dirname(fileURLToPath(import.meta.url));
|
|
13
14
|
const REVIEW = join(HERE, 'agy-review.sh');
|
|
14
15
|
const AGY_RUN = join(HERE, 'agy.sh');
|
|
15
|
-
const LIMIT = `
|
|
16
|
+
const LIMIT = `passed variables: TYPESAFE_API_KEY; a headless agy runs a request that uses them only where your agy permissions allow commands ${String.fromCharCode(0x2014)} the first denied command ends the run`;
|
|
16
17
|
const KEYS = { TYPESAFE_API_KEY: 'jev-key', ANTIGRAVITY_API_KEY: 'a', GEMINI_API_KEY: 'g', GOOGLE_API_KEY: 'o', GOOGLE_GENAI_API_KEY: 'n', FOO_API_KEY: 'foo' };
|
|
17
|
-
const PASSED = 'key=[jev-key] google=unset,unset,unset,unset foo=unset';
|
|
18
|
+
const PASSED = 'key=[jev-key] google=unset,unset,unset,unset foo=unset bar=unset';
|
|
18
19
|
|
|
19
20
|
// Every spawn of agy appends its kind and the key states; a run also says so on stderr before the fake answers.
|
|
20
21
|
const RECORDER = [
|
|
21
22
|
'#!/usr/bin/env bash',
|
|
22
23
|
'st() { if [[ -n "${!1+x}" ]]; then printf "[%s]" "${!1}"; else printf unset; fi; }',
|
|
23
24
|
'case "${1:-}" in --help|-h) kind=help ;; --version) kind=version ;; models) kind=models ;; *) kind=run; echo STUB-DISPATCH >&2 ;; esac',
|
|
24
|
-
'echo "$kind key=$(st TYPESAFE_API_KEY) google=$(st ANTIGRAVITY_API_KEY),$(st GEMINI_API_KEY),$(st GOOGLE_API_KEY),$(st GOOGLE_GENAI_API_KEY) foo=$(st FOO_API_KEY) child=$(st AW_AGY_REVIEW_CHILD)" >>"$AGY_JEV_LOG"',
|
|
25
|
+
'echo "$kind key=$(st TYPESAFE_API_KEY) google=$(st ANTIGRAVITY_API_KEY),$(st GEMINI_API_KEY),$(st GOOGLE_API_KEY),$(st GOOGLE_GENAI_API_KEY) foo=$(st FOO_API_KEY) bar=$(st BAR_API_KEY) child=$(st AW_AGY_REVIEW_CHILD)" >>"$AGY_JEV_LOG"',
|
|
25
26
|
'exec "$AGY_JEV_FAKE" "$@"',
|
|
26
27
|
'',
|
|
27
28
|
].join('\n');
|
|
@@ -43,9 +44,13 @@ const drive = (sb, wrapper, args, env = {}) => {
|
|
|
43
44
|
for (const name of ['jev-log', 'jev-argv']) rmSync(cap(name), { force: true });
|
|
44
45
|
const r = spawnSync('bash', [wrapper, ...args], {
|
|
45
46
|
cwd: sb.repo, input: '', encoding: 'utf8', timeout: 60000,
|
|
46
|
-
env: {
|
|
47
|
-
AGY_JEV_LOG: cap('jev-log'), AGY_JEV_FAKE: cap('agy-fake'), AGY_FAKE_ARGV: cap('jev-argv'), ...env },
|
|
47
|
+
env: { ...stripGitLocationEnv({ PATH: `${sb.bin}:${farmFor(['agy', 'agy-run'])}`, TMPDIR: process.env.TMPDIR ?? '/tmp',
|
|
48
|
+
AGY_JEV_LOG: cap('jev-log'), AGY_JEV_FAKE: cap('agy-fake'), AGY_FAKE_ARGV: cap('jev-argv'), ...env }),
|
|
49
|
+
HOME: sb.home, XDG_CONFIG_HOME: join(sb.home, '.config'), LC_ALL: 'C', GIT_CONFIG_GLOBAL: '/dev/null',
|
|
50
|
+
GIT_CONFIG_SYSTEM: '/dev/null', GIT_CONFIG_NOSYSTEM: '1', GIT_ATTR_NOSYSTEM: '1' },
|
|
48
51
|
});
|
|
52
|
+
assert.ifError(r.error);
|
|
53
|
+
assert.equal(r.signal, null, r.stderr);
|
|
49
54
|
const read = (name) => (existsSync(cap(name)) ? readFileSync(cap(name), 'utf8') : '');
|
|
50
55
|
const spawns = read('jev-log').split('\n').filter(Boolean).map((line) => [line.slice(0, line.indexOf(' ')), line.slice(line.indexOf(' ') + 1)]);
|
|
51
56
|
return { status: r.status, stdout: r.stdout, stderr: r.stderr, spawns, argv: read('jev-argv').split('\n').slice(0, -1) };
|
|
@@ -53,7 +58,7 @@ const drive = (sb, wrapper, args, env = {}) => {
|
|
|
53
58
|
const runDirect = (sb, env, extra = []) => drive(sb, AGY_RUN, ['a probe prompt', ...extra], env);
|
|
54
59
|
const keysOf = (env) => env.split(' child=')[0];
|
|
55
60
|
const runSpawn = (r) => (r.spawns.find(([kind]) => kind === 'run') ?? [])[1] ?? '';
|
|
56
|
-
const limitLines = (r) => r.stderr.split('\n').filter((line) =>
|
|
61
|
+
const limitLines = (r) => r.stderr.split('\n').filter((line) => /^(?:jev:|passed variables:)/.test(line));
|
|
57
62
|
|
|
58
63
|
describe('agy-run and agy-review pass the key and unset the rest — spec:jev-every-run/S4', () => {
|
|
59
64
|
for (const [label, wrapper, args] of [['agy-run', AGY_RUN, ['a probe prompt']], ['agy-review plan', REVIEW, ['plan', 'plan.md']]]) {
|
|
@@ -63,9 +68,53 @@ describe('agy-run and agy-review pass the key and unset the rest — spec:jev-ev
|
|
|
63
68
|
assert.ok(r.spawns.some(([kind]) => kind === 'run'), 'agy ran');
|
|
64
69
|
for (const [kind, env] of r.spawns) assert.equal(keysOf(env), PASSED, `${kind} spawn`);
|
|
65
70
|
});
|
|
71
|
+
it(`${label}: the facts read leaves the user's exported HOST to every spawn of agy`, () => {
|
|
72
|
+
const sb = sandbox();
|
|
73
|
+
writeFileSync(join(sb.bin, 'agy'), RECORDER.replace('child=$(st AW_AGY_REVIEW_CHILD)', '$& host=$(st HOST)'), { mode: 0o755 });
|
|
74
|
+
const r = drive(sb, wrapper, args, { HOST: 'user-box' });
|
|
75
|
+
assert.equal(r.status, 0, r.stderr);
|
|
76
|
+
assert.ok(r.spawns.length > 0, 'agy ran');
|
|
77
|
+
for (const [kind, env] of r.spawns) assert.match(env, / host=\[user-box\]$/, `${kind} spawn`);
|
|
78
|
+
});
|
|
66
79
|
}
|
|
67
80
|
});
|
|
68
81
|
|
|
82
|
+
const copyBridge = (sb) => {
|
|
83
|
+
const directory = join(sb.home, 'bridge');
|
|
84
|
+
cpSync(HERE, join(directory, 'bin'), { recursive: true });
|
|
85
|
+
cpSync(join(HERE, '..', 'capability.json'), join(directory, 'capability.json'));
|
|
86
|
+
const lines = readFileSync(join(HERE, '..', 'service-facts.txt'), 'utf8').trimEnd().split('\n');
|
|
87
|
+
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'));
|
|
88
|
+
for (const name of ['agy.sh', 'agy-review.sh']) symlinkSync(name, join(directory, 'bin', `linked-${name}`));
|
|
89
|
+
return directory;
|
|
90
|
+
};
|
|
91
|
+
describe('injected facts through symlinks — spec:jev-every-run/S26', () => {
|
|
92
|
+
it('agy-run passes FOO_API_KEY and empty BAR_API_KEY and names only the non-empty passed variable', () => {
|
|
93
|
+
const sb = sandbox();
|
|
94
|
+
const directory = copyBridge(sb);
|
|
95
|
+
const result = drive(sb, join(directory, 'bin', 'linked-agy.sh'), ['a probe prompt'], { ...KEYS, BAR_API_KEY: '' });
|
|
96
|
+
assert.equal(result.status, 0, result.stderr);
|
|
97
|
+
assert.ok(result.spawns.some(([kind]) => kind === 'run'), result.stderr);
|
|
98
|
+
for (const [kind, keys] of result.spawns) assert.equal(keysOf(keys), 'key=unset google=unset,unset,unset,unset foo=[foo] bar=[]', kind);
|
|
99
|
+
const expected = LIMIT.replace('TYPESAFE_API_KEY', 'FOO_API_KEY');
|
|
100
|
+
assert.deepEqual(limitLines(result), [expected]);
|
|
101
|
+
assert.ok(result.stderr.indexOf(expected) < result.stderr.indexOf('STUB-DISPATCH'), result.stderr);
|
|
102
|
+
});
|
|
103
|
+
it('agy-review runs its copied sibling with the same keys, ignoring a foreign agy-run on PATH and printing no limit', () => {
|
|
104
|
+
const sb = sandbox();
|
|
105
|
+
const directory = copyBridge(sb);
|
|
106
|
+
const sentinel = join(sb.home, 'foreign-invoked');
|
|
107
|
+
writeFileSync(join(sb.bin, 'agy-run'), `#!/usr/bin/env bash\nprintf invoked > '${sentinel}'\nexit 0\n`, { mode: 0o755 });
|
|
108
|
+
const result = drive(sb, join(directory, 'bin', 'linked-agy-review.sh'), ['plan', 'plan.md'], { ...KEYS, BAR_API_KEY: '' });
|
|
109
|
+
assert.equal(existsSync(sentinel), false, result.stderr);
|
|
110
|
+
assert.equal(result.status, 0, result.stderr);
|
|
111
|
+
assert.ok(result.spawns.some(([kind]) => kind === 'run'), result.stderr);
|
|
112
|
+
assert.equal(runSpawn(result), 'key=unset google=unset,unset,unset,unset foo=[foo] bar=[] child=[1]');
|
|
113
|
+
for (const [kind, keys] of result.spawns) assert.equal(keysOf(keys), 'key=unset google=unset,unset,unset,unset foo=[foo] bar=[]', kind);
|
|
114
|
+
assert.deepEqual(limitLines(result), []);
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
|
|
69
118
|
describe('the agy half of S5: an empty key and an unset key on agy-run', () => {
|
|
70
119
|
it('an empty TYPESAFE_API_KEY reaches agy empty, an unset one stays unset, and the argv is the same with the key set', () => {
|
|
71
120
|
const runs = ['jev-key', '', undefined].map((value) => runDirect(sandbox(), { TYPESAFE_API_KEY: value }));
|
|
@@ -54,6 +54,76 @@
|
|
|
54
54
|
# disagreeing flag+env pair refuses pre-spend)
|
|
55
55
|
set -euo pipefail
|
|
56
56
|
|
|
57
|
+
aw_script_dir() {
|
|
58
|
+
local src="${BASH_SOURCE[0]}" dir hops=0 max_hops=16
|
|
59
|
+
while :; do
|
|
60
|
+
case "$src" in */*) dir="${src%/*}"; dir="${dir:-/}" ;; *) dir=. ;; esac
|
|
61
|
+
dir="$(CDPATH= builtin cd -P -- "$dir" 2>/dev/null && builtin pwd -P)" || break
|
|
62
|
+
[[ -L "$src" ]] || { printf '%s\n' "$dir"; return 0; }
|
|
63
|
+
if (( hops >= max_hops )); then
|
|
64
|
+
printf 'error: exceeded %s symlink hops; could not resolve its OWN directory\n' "$max_hops" >&2
|
|
65
|
+
return 127
|
|
66
|
+
fi
|
|
67
|
+
hops=$((hops + 1))
|
|
68
|
+
src="$(command readlink -- "$src" 2>/dev/null)" || break
|
|
69
|
+
case "$src" in /*) ;; *) src="$dir/$src" ;; esac
|
|
70
|
+
done
|
|
71
|
+
printf 'error: could not resolve its OWN directory\n' >&2
|
|
72
|
+
return 127
|
|
73
|
+
}
|
|
74
|
+
aw_read_service_facts() {
|
|
75
|
+
local path="${1%/*}/service-facts.txt" line key value entry number=0 bad=0 valid seen=() run_lines=()
|
|
76
|
+
local host_re='^(\*\.)?[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]([abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-]*[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789])?(\.[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]([abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-]*[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789])?)+$'
|
|
77
|
+
local variable_re='^[ABCDEFGHIJKLMNOPQRSTUVWXYZ][ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_]*$'
|
|
78
|
+
local command_re='^[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789][abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789._-]* \*$'
|
|
79
|
+
local env directory segments LC_ALL=C
|
|
80
|
+
AW_FACT_HOST=() AW_FACT_RUN_HOST=() AW_FACT_PASSED_VARIABLE=()
|
|
81
|
+
if [[ -f "$path" && -r "$path" ]]; then
|
|
82
|
+
while IFS= read -r line; do
|
|
83
|
+
number=$((number + 1)); valid=1
|
|
84
|
+
if (( number == 1 )); then
|
|
85
|
+
[[ "$line" == "# generated from the kit's service fragments (agent-workflow-kit/tools/services/); do not edit" ]] || bad=1
|
|
86
|
+
continue
|
|
87
|
+
fi
|
|
88
|
+
key="${line%%=*}"; value="${line#*=}"
|
|
89
|
+
[[ "$line" == *=* ]] || valid=0
|
|
90
|
+
case "$key" in
|
|
91
|
+
HOST|RUN_HOST) [[ "$value" =~ $host_re ]] || valid=0
|
|
92
|
+
if [[ "$key" == RUN_HOST && "$value" == '*.'* ]]; then valid=0; fi ;;
|
|
93
|
+
PASSED_VARIABLE) [[ "$value" =~ $variable_re && "$value" != OPENAI_BASE_URL ]] || valid=0 ;;
|
|
94
|
+
EXCLUDED_COMMAND) [[ "$value" =~ $command_re ]] || valid=0 ;;
|
|
95
|
+
WRITABLE_DIR)
|
|
96
|
+
env="${value%%:*}"; directory="${value#*:}"; segments="/${directory//\\//}/"
|
|
97
|
+
[[ "$value" == *:* && ( -z "$env" || "$env" =~ $variable_re ) &&
|
|
98
|
+
( "$directory" == '~/'* || "$directory" == /* ) && "$directory" != */ &&
|
|
99
|
+
"$directory" != *[\*\?\[\]]* && ! "$directory" =~ [[:cntrl:]] && "$segments" != */../* ]] || valid=0 ;;
|
|
100
|
+
*) valid=0 ;;
|
|
101
|
+
esac
|
|
102
|
+
for entry in ${seen[@]+"${seen[@]}"}; do [[ "$entry" != "$line" ]] || valid=0; done
|
|
103
|
+
if (( ! valid )); then (( bad )) || bad=$number; continue; fi
|
|
104
|
+
seen+=("$line")
|
|
105
|
+
case "$key" in
|
|
106
|
+
HOST) AW_FACT_HOST+=("$value") ;; RUN_HOST) AW_FACT_RUN_HOST+=("$value"); run_lines+=("$number") ;;
|
|
107
|
+
PASSED_VARIABLE) AW_FACT_PASSED_VARIABLE+=("$value") ;;
|
|
108
|
+
esac
|
|
109
|
+
done <"$path"
|
|
110
|
+
if (( ! number )); then bad=1; fi
|
|
111
|
+
if [[ -n "$line" ]] && (( ! bad )); then bad=$((number + 1)); fi
|
|
112
|
+
for ((number=0; number<${#AW_FACT_RUN_HOST[@]}; number++)); do
|
|
113
|
+
valid=0
|
|
114
|
+
for entry in ${AW_FACT_HOST[@]+"${AW_FACT_HOST[@]}"}; do [[ "$entry" != "${AW_FACT_RUN_HOST[number]}" ]] || valid=1; done
|
|
115
|
+
if (( ! valid && (! bad || run_lines[number] < bad) )); then bad=${run_lines[number]}; fi
|
|
116
|
+
done
|
|
117
|
+
(( bad )) || return 0
|
|
118
|
+
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
|
|
119
|
+
else
|
|
120
|
+
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
|
|
121
|
+
fi
|
|
122
|
+
exit 127
|
|
123
|
+
}
|
|
124
|
+
HERE="$(aw_script_dir)" || exit 127
|
|
125
|
+
aw_read_service_facts "$HERE"
|
|
126
|
+
|
|
57
127
|
# --- --help / -h (pre-preflight: no agy, no login, no git tree needed) ---------
|
|
58
128
|
# Keyed ONLY on the FIRST argument — never a scan of all args (uniform rule across
|
|
59
129
|
# the four wrappers). Drift-guarded against capability.json roles.review.contract.
|
|
@@ -373,15 +443,15 @@ aw_resolve_timeout_bin() {
|
|
|
373
443
|
printf '%s' "$bin"
|
|
374
444
|
}
|
|
375
445
|
aw_scrub_billing_keys() {
|
|
376
|
-
|
|
377
|
-
# switch a run to paid billing; TYPESAFE_API_KEY is neither read nor set, so it reaches the CLI exactly as given.
|
|
378
|
-
local name
|
|
446
|
+
local name passed keep
|
|
379
447
|
unset OPENAI_BASE_URL 2>/dev/null || true
|
|
380
448
|
for name in $(compgen -v); do
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
449
|
+
[[ "$name" == *_API_KEY ]] || continue
|
|
450
|
+
keep=0
|
|
451
|
+
for passed in ${AW_FACT_PASSED_VARIABLE[@]+"${AW_FACT_PASSED_VARIABLE[@]}"}; do
|
|
452
|
+
[[ "$name" != "$passed" ]] || keep=1
|
|
453
|
+
done
|
|
454
|
+
if (( ! keep )); then unset "$name" 2>/dev/null || true; fi
|
|
385
455
|
done
|
|
386
456
|
return 0
|
|
387
457
|
}
|
|
@@ -389,7 +459,7 @@ aw_scrub_billing_keys() {
|
|
|
389
459
|
# Review-receipt identity (AD-038). AW_BRIDGE_VERSION mirrors this bridge's SKILL.md/capability.json
|
|
390
460
|
# version (drift-guarded by agy-review.test.mjs against capability.json).
|
|
391
461
|
AW_RECEIPT_BACKEND="agy"
|
|
392
|
-
AW_BRIDGE_VERSION="
|
|
462
|
+
AW_BRIDGE_VERSION="8.0.0" # aw-version-anchor
|
|
393
463
|
# D5 control-byte screen — IMMEDIATELY after resolution, BEFORE any interpolation can echo raw
|
|
394
464
|
# newline/ESC bytes into stderr/the terminal (round-2 fold).
|
|
395
465
|
if [[ "$AGY_MODEL" == *[$'\x01'-$'\x1f'$'\x7f']* ]]; then
|
|
@@ -513,41 +583,6 @@ FED_ECHO_MAX_BYTES=200
|
|
|
513
583
|
# address nobody requested and FAILS the proof, rather than vanishing from the check entirely.
|
|
514
584
|
FED_PROOF_ADDRESS_MAX=1000000000
|
|
515
585
|
|
|
516
|
-
# This wrapper's REAL directory, symlinks RESOLVED. The managed install puts a symlink on PATH
|
|
517
|
-
# (~/.local/bin/agy-review -> <placed skill>/bin/agy-review.sh), so an unresolved BASH_SOURCE names
|
|
518
|
-
# the LINK's directory — and every sibling payload below, the envelope reader most of all, would be
|
|
519
|
-
# looked for beside the link instead of beside the script. `readlink -f` is GNU-only (macOS ships
|
|
520
|
-
# BSD readlink), so the chain is walked by hand; `cd -P` resolves a symlinked directory too.
|
|
521
|
-
# The walk is HOP-BOUNDED with a loud refusal, never an unbounded loop. A symlink CYCLE cannot be
|
|
522
|
-
# reached by construction — the kernel already resolved this path to exec the script and would have
|
|
523
|
-
# failed with ELOOP — but it becomes reachable if a link is rewritten in the window between exec and
|
|
524
|
-
# this walk, and an unbounded `while` would then spin until something killed it. Past the bound the
|
|
525
|
-
# wrapper refuses BY NAME rather than guessing at a directory: a wrong answer here sends every
|
|
526
|
-
# sibling lookup somewhere arbitrary. 16 is far above any managed install (which uses ONE hop) and
|
|
527
|
-
# below the kernel's own chain limit, so it never truncates a real chain.
|
|
528
|
-
AW_SCRIPT_LINK_MAX_HOPS=16
|
|
529
|
-
aw_script_dir() {
|
|
530
|
-
local src="${BASH_SOURCE[0]}" dir hops=0
|
|
531
|
-
while [[ -L "$src" ]]; do
|
|
532
|
-
if (( hops >= AW_SCRIPT_LINK_MAX_HOPS )); then
|
|
533
|
-
echo "error: resolving this wrapper's own path exceeded ${AW_SCRIPT_LINK_MAX_HOPS} symlink hops at" >&2
|
|
534
|
-
echo " '$src' — a symlink cycle, or an absurd chain." >&2
|
|
535
|
-
return 1
|
|
536
|
-
fi
|
|
537
|
-
hops=$(( hops + 1 ))
|
|
538
|
-
dir="$(cd -P "$(dirname "$src")" && pwd)" || return 1
|
|
539
|
-
src="$(readlink "$src")" || return 1
|
|
540
|
-
case "$src" in /*) ;; *) src="$dir/$src" ;; esac
|
|
541
|
-
done
|
|
542
|
-
( cd -P "$(dirname "$src")" && pwd )
|
|
543
|
-
}
|
|
544
|
-
if ! HERE="$(aw_script_dir)"; then
|
|
545
|
-
echo "error: this wrapper could not resolve its OWN directory, so the sibling payload every review" >&2
|
|
546
|
-
echo " depends on cannot be located. Refusing before anything is spent — repair the link, or" >&2
|
|
547
|
-
echo " invoke the real script path." >&2
|
|
548
|
-
exit 127
|
|
549
|
-
fi
|
|
550
|
-
|
|
551
586
|
# --- The dispatch transport (AGY-1.1.13, Decision 1) ---------------------------
|
|
552
587
|
# EVERY review dispatch runs `--output-format json`: the CLI then answers with ONE envelope whose
|
|
553
588
|
# `response` carries the model's Markdown VERBATIM, so the wrapper reads a NAMED FIELD instead of
|
|
@@ -597,23 +632,7 @@ if [[ -z "$aw_review_timeout_bin" ]]; then
|
|
|
597
632
|
exit 127
|
|
598
633
|
fi
|
|
599
634
|
export AGY_REQUIRE_TIMEOUT_BIN=1
|
|
600
|
-
|
|
601
|
-
# fall back to the sibling agy.sh on a fresh checkout / hermetic test where agy-run is not yet linked.
|
|
602
|
-
if command -v agy-run >/dev/null 2>&1; then
|
|
603
|
-
AGY_RUN="agy-run"
|
|
604
|
-
else
|
|
605
|
-
AGY_RUN="$HERE/agy.sh"
|
|
606
|
-
fi
|
|
607
|
-
# The seam is a guarantee only when the RESOLVED child honors it: a stale installed agy-run that
|
|
608
|
-
# never reads AGY_REQUIRE_TIMEOUT_BIN would keep its uncapped lane past the parent preflight —
|
|
609
|
-
# refuse loudly and name the refresh recovery instead of dispatching on a hope.
|
|
610
|
-
aw_child_path="$(command -v "$AGY_RUN" 2>/dev/null || printf '%s' "$AGY_RUN")"
|
|
611
|
-
if ! grep -q "AGY_REQUIRE_TIMEOUT_BIN" "$aw_child_path" 2>/dev/null; then
|
|
612
|
-
echo "error: the resolved agy-run child ($aw_child_path) does not honor the AGY_REQUIRE_TIMEOUT_BIN seam —" >&2
|
|
613
|
-
echo " a stale bridge install could run uncapped past the parent preflight. Refresh the placed" >&2
|
|
614
|
-
echo " bridges (/agent-workflow-kit setup --refresh-placed), then re-run." >&2
|
|
615
|
-
exit 127
|
|
616
|
-
fi
|
|
635
|
+
AGY_RUN="$HERE/agy.sh"
|
|
617
636
|
|
|
618
637
|
# --- Pre-spend capability door (AGY-1.1.13, Decision 2) ------------------------
|
|
619
638
|
# This wrapper drives the CLI in `--output-format json`, passes --disable-slash-commands, and reads
|
|
@@ -774,8 +793,7 @@ aw_agy_catalog_check() {
|
|
|
774
793
|
}
|
|
775
794
|
export AW_AGY_CATALOG_READ=1
|
|
776
795
|
# Every child agy-run is this review's (spec jev-every-run): its prompts forbid every tool, so a review whose model
|
|
777
|
-
# obeys them sends no request
|
|
778
|
-
# TYPESAFE_API_KEY limit line.
|
|
796
|
+
# obeys them sends no request (an advisory prohibition, not a sandbox), and the child prints no limit line.
|
|
779
797
|
export AW_AGY_REVIEW_CHILD=1
|
|
780
798
|
if [[ -n "$AGY_MODEL" ]]; then aw_agy_catalog_check "$aw_review_timeout_bin" "$DEFAULT_AGY_REVIEW_MODEL"; fi
|
|
781
799
|
if [[ "$AGY_MODEL" != "$HOST_AGY_MODEL" && "$AGY_PROBE" != "1" ]]; then
|
|
@@ -2834,27 +2834,6 @@ describe('agy-review.sh — dispatch-posture labeling (D5)', { concurrency: 2 },
|
|
|
2834
2834
|
assert.match(r.stderr, /control/i);
|
|
2835
2835
|
});
|
|
2836
2836
|
|
|
2837
|
-
// The two-stage cap guarantee: the parent preflight fails closed, and the seam
|
|
2838
|
-
// (AGY_REQUIRE_TIMEOUT_BIN=1) makes the CHILD's missing-binary lane refuse too — but only a
|
|
2839
|
-
// child that HONORS the seam. A stale installed agy-run that never reads it could run uncapped
|
|
2840
|
-
// past the parent preflight, so the parent verifies the resolved child carries the seam token
|
|
2841
|
-
// and refuses loudly naming the refresh recovery otherwise.
|
|
2842
|
-
it('a STALE agy-run child that does not honor the timeout seam refuses fail-closed (never a silently uncapped dispatch)', async () => {
|
|
2843
|
-
const sb = makeSandbox();
|
|
2844
|
-
const staleDir = join(sb.home, 'stale-bin');
|
|
2845
|
-
mkdirSync(staleDir, { recursive: true });
|
|
2846
|
-
writeFileSync(join(staleDir, 'agy-run'), '#!/usr/bin/env bash\nprintf "FAKE_AGY_REVIEW_OUTPUT\\n### Verdict\\nSHIP\\n"\n', { mode: 0o755 });
|
|
2847
|
-
const r = await run(sb, {
|
|
2848
|
-
args: ['code', '--facts', 'a tiny fact'],
|
|
2849
|
-
env: { PATH: `${staleDir}:${sb.bin}:${farmFor(['agy-run'])}` },
|
|
2850
|
-
});
|
|
2851
|
-
const receipts = readReceipts(sb.repo);
|
|
2852
|
-
rmSync(sb.home, { recursive: true, force: true });
|
|
2853
|
-
assert.equal(r.status, 127, 'a seam-blind child is a stale bridge install — refuse, never dispatch uncapped');
|
|
2854
|
-
assert.match(r.stderr, /does not honor the AGY_REQUIRE_TIMEOUT_BIN seam/);
|
|
2855
|
-
assert.equal(receipts.length, 0, 'no dispatch, no receipt');
|
|
2856
|
-
});
|
|
2857
|
-
|
|
2858
2837
|
// Flow-orchestration Phase 4.2 (#26): the uncapped lane is CLOSED — without a capping binary the
|
|
2859
2838
|
// preflight refuses by name BEFORE any CLI run (the pre-fix wrapper printed timeout=uncapped and
|
|
2860
2839
|
// ran anyway). The shadow-proof resolver discipline now surfaces as the REFUSAL, not a banner.
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
# Auth: SUBSCRIPTION ONLY. We use the cached OAuth token at
|
|
10
10
|
# ~/.gemini/antigravity-cli/antigravity-oauth-token (Google AI Pro) and the
|
|
11
11
|
# quota that comes with it. To make that guarantee hard, the wrapper unsets
|
|
12
|
-
# every *_API_KEY except
|
|
12
|
+
# every *_API_KEY except the passed variables its service-facts.txt lists, so a stray
|
|
13
13
|
# key can never silently switch us to paid pay-as-you-go billing.
|
|
14
14
|
#
|
|
15
15
|
# This is a THIN, FLOW-AGNOSTIC wrapper on purpose: it just runs one headless
|
|
@@ -35,6 +35,76 @@
|
|
|
35
35
|
# # --model* and --effort* refuse — the model is AGY_MODEL)
|
|
36
36
|
set -euo pipefail
|
|
37
37
|
|
|
38
|
+
aw_script_dir() {
|
|
39
|
+
local src="${BASH_SOURCE[0]}" dir hops=0 max_hops=16
|
|
40
|
+
while :; do
|
|
41
|
+
case "$src" in */*) dir="${src%/*}"; dir="${dir:-/}" ;; *) dir=. ;; esac
|
|
42
|
+
dir="$(CDPATH= builtin cd -P -- "$dir" 2>/dev/null && builtin pwd -P)" || break
|
|
43
|
+
[[ -L "$src" ]] || { printf '%s\n' "$dir"; return 0; }
|
|
44
|
+
if (( hops >= max_hops )); then
|
|
45
|
+
printf 'error: exceeded %s symlink hops; could not resolve its OWN directory\n' "$max_hops" >&2
|
|
46
|
+
return 127
|
|
47
|
+
fi
|
|
48
|
+
hops=$((hops + 1))
|
|
49
|
+
src="$(command readlink -- "$src" 2>/dev/null)" || break
|
|
50
|
+
case "$src" in /*) ;; *) src="$dir/$src" ;; esac
|
|
51
|
+
done
|
|
52
|
+
printf 'error: could not resolve its OWN directory\n' >&2
|
|
53
|
+
return 127
|
|
54
|
+
}
|
|
55
|
+
aw_read_service_facts() {
|
|
56
|
+
local path="${1%/*}/service-facts.txt" line key value entry number=0 bad=0 valid seen=() run_lines=()
|
|
57
|
+
local host_re='^(\*\.)?[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]([abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-]*[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789])?(\.[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]([abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-]*[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789])?)+$'
|
|
58
|
+
local variable_re='^[ABCDEFGHIJKLMNOPQRSTUVWXYZ][ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_]*$'
|
|
59
|
+
local command_re='^[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789][abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789._-]* \*$'
|
|
60
|
+
local env directory segments LC_ALL=C
|
|
61
|
+
AW_FACT_HOST=() AW_FACT_RUN_HOST=() AW_FACT_PASSED_VARIABLE=()
|
|
62
|
+
if [[ -f "$path" && -r "$path" ]]; then
|
|
63
|
+
while IFS= read -r line; do
|
|
64
|
+
number=$((number + 1)); valid=1
|
|
65
|
+
if (( number == 1 )); then
|
|
66
|
+
[[ "$line" == "# generated from the kit's service fragments (agent-workflow-kit/tools/services/); do not edit" ]] || bad=1
|
|
67
|
+
continue
|
|
68
|
+
fi
|
|
69
|
+
key="${line%%=*}"; value="${line#*=}"
|
|
70
|
+
[[ "$line" == *=* ]] || valid=0
|
|
71
|
+
case "$key" in
|
|
72
|
+
HOST|RUN_HOST) [[ "$value" =~ $host_re ]] || valid=0
|
|
73
|
+
if [[ "$key" == RUN_HOST && "$value" == '*.'* ]]; then valid=0; fi ;;
|
|
74
|
+
PASSED_VARIABLE) [[ "$value" =~ $variable_re && "$value" != OPENAI_BASE_URL ]] || valid=0 ;;
|
|
75
|
+
EXCLUDED_COMMAND) [[ "$value" =~ $command_re ]] || valid=0 ;;
|
|
76
|
+
WRITABLE_DIR)
|
|
77
|
+
env="${value%%:*}"; directory="${value#*:}"; segments="/${directory//\\//}/"
|
|
78
|
+
[[ "$value" == *:* && ( -z "$env" || "$env" =~ $variable_re ) &&
|
|
79
|
+
( "$directory" == '~/'* || "$directory" == /* ) && "$directory" != */ &&
|
|
80
|
+
"$directory" != *[\*\?\[\]]* && ! "$directory" =~ [[:cntrl:]] && "$segments" != */../* ]] || valid=0 ;;
|
|
81
|
+
*) valid=0 ;;
|
|
82
|
+
esac
|
|
83
|
+
for entry in ${seen[@]+"${seen[@]}"}; do [[ "$entry" != "$line" ]] || valid=0; done
|
|
84
|
+
if (( ! valid )); then (( bad )) || bad=$number; continue; fi
|
|
85
|
+
seen+=("$line")
|
|
86
|
+
case "$key" in
|
|
87
|
+
HOST) AW_FACT_HOST+=("$value") ;; RUN_HOST) AW_FACT_RUN_HOST+=("$value"); run_lines+=("$number") ;;
|
|
88
|
+
PASSED_VARIABLE) AW_FACT_PASSED_VARIABLE+=("$value") ;;
|
|
89
|
+
esac
|
|
90
|
+
done <"$path"
|
|
91
|
+
if (( ! number )); then bad=1; fi
|
|
92
|
+
if [[ -n "$line" ]] && (( ! bad )); then bad=$((number + 1)); fi
|
|
93
|
+
for ((number=0; number<${#AW_FACT_RUN_HOST[@]}; number++)); do
|
|
94
|
+
valid=0
|
|
95
|
+
for entry in ${AW_FACT_HOST[@]+"${AW_FACT_HOST[@]}"}; do [[ "$entry" != "${AW_FACT_RUN_HOST[number]}" ]] || valid=1; done
|
|
96
|
+
if (( ! valid && (! bad || run_lines[number] < bad) )); then bad=${run_lines[number]}; fi
|
|
97
|
+
done
|
|
98
|
+
(( bad )) || return 0
|
|
99
|
+
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
|
|
100
|
+
else
|
|
101
|
+
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
|
|
102
|
+
fi
|
|
103
|
+
exit 127
|
|
104
|
+
}
|
|
105
|
+
HERE="$(aw_script_dir)" || exit 127
|
|
106
|
+
aw_read_service_facts "$HERE"
|
|
107
|
+
|
|
38
108
|
# --- --help / -h (pre-preflight: no agy, no login needed) ----------------------
|
|
39
109
|
# Keyed ONLY on the FIRST argument — never a scan of all args, else a passthrough
|
|
40
110
|
# payload like `agy-run "prompt" -- --help` would be intercepted. agy-run is the
|
|
@@ -255,15 +325,15 @@ aw_resolve_timeout_bin() {
|
|
|
255
325
|
printf '%s' "$bin"
|
|
256
326
|
}
|
|
257
327
|
aw_scrub_billing_keys() {
|
|
258
|
-
|
|
259
|
-
# switch a run to paid billing; TYPESAFE_API_KEY is neither read nor set, so it reaches the CLI exactly as given.
|
|
260
|
-
local name
|
|
328
|
+
local name passed keep
|
|
261
329
|
unset OPENAI_BASE_URL 2>/dev/null || true
|
|
262
330
|
for name in $(compgen -v); do
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
331
|
+
[[ "$name" == *_API_KEY ]] || continue
|
|
332
|
+
keep=0
|
|
333
|
+
for passed in ${AW_FACT_PASSED_VARIABLE[@]+"${AW_FACT_PASSED_VARIABLE[@]}"}; do
|
|
334
|
+
[[ "$name" != "$passed" ]] || keep=1
|
|
335
|
+
done
|
|
336
|
+
if (( ! keep )); then unset "$name" 2>/dev/null || true; fi
|
|
267
337
|
done
|
|
268
338
|
return 0
|
|
269
339
|
}
|
|
@@ -431,10 +501,14 @@ fi
|
|
|
431
501
|
|
|
432
502
|
agy_cmd=(agy "${model_flag[@]}" --print-timeout "$AGY_TIMEOUT" "${passthrough[@]}" -p "$prompt")
|
|
433
503
|
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
504
|
+
aw_passed_names=""
|
|
505
|
+
if [[ "${AW_AGY_REVIEW_CHILD:-}" != "1" ]]; then
|
|
506
|
+
for aw_name in ${AW_FACT_PASSED_VARIABLE[@]+"${AW_FACT_PASSED_VARIABLE[@]}"}; do
|
|
507
|
+
if [[ -n "${!aw_name:-}" ]]; then aw_passed_names+="${aw_passed_names:+, }$aw_name"; fi
|
|
508
|
+
done
|
|
509
|
+
if [[ -n "$aw_passed_names" ]]; then
|
|
510
|
+
echo "passed variables: $aw_passed_names; a headless agy runs a request that uses them only where your agy permissions allow commands — the first denied command ends the run" >&2
|
|
511
|
+
fi
|
|
438
512
|
fi
|
|
439
513
|
|
|
440
514
|
# Hard wall-clock cap via timeout(1) (GNU `timeout` on Linux, `gtimeout` from coreutils on macOS).
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"schema": 1,
|
|
4
4
|
"name": "antigravity-cli-bridge",
|
|
5
5
|
"kind": "execution-backend",
|
|
6
|
-
"version": "
|
|
6
|
+
"version": "8.0.0",
|
|
7
7
|
"provides": ["review", "probe"],
|
|
8
8
|
"posture": { "model": "Gemini 3.8 Flash (High)" },
|
|
9
9
|
"roles": {
|
|
@@ -180,7 +180,7 @@
|
|
|
180
180
|
{ "slot": "<extra agy flags...>", "required": false, "description": "raw agy flags after -- (a --model* or --effort* flag refuses pre-spend: the model is the host posture or the AGY_MODEL environment value)" }
|
|
181
181
|
],
|
|
182
182
|
"guardrails": [
|
|
183
|
-
{ "value": "subscription-only — every *_API_KEY
|
|
183
|
+
{ "value": "subscription-only — every *_API_KEY except the passed variables its service-facts.txt lists is unset before the run; those variables pass as given and nothing in agy's permissions is widened", "enforcement": "enforced", "source": "bin/agy.sh" },
|
|
184
184
|
{ "value": "the model is the host posture (AGY_MODEL in the bridge settings file, else Gemini 3.8 Flash (High)); AGY_MODEL in the environment sets it for one run", "enforcement": "enforced", "source": "bin/agy.sh" },
|
|
185
185
|
{ "value": "hard wall-clock cap AGY_HARD_TIMEOUT (built-in default 5m)", "enforcement": "enforced", "condition": "only while timeout(1)/gtimeout is on PATH — otherwise the wrapper warns and runs uncapped", "source": "capability.json settings.AGY_HARD_TIMEOUT" },
|
|
186
186
|
{ "value": "the prompt rides a single argv — over AGY_MAX_PROMPT_BYTES (120000) the run refuses", "enforcement": "enforced", "source": "bin/agy.sh" },
|
|
@@ -52,9 +52,9 @@ Environment:
|
|
|
52
52
|
| `AGY_MAX_PROMPT_BYTES` | `120000` | single-argv byte ceiling. `agy` takes the prompt as ONE `-p` argv; past `MAX_ARG_STRLEN` (~131072) `execve` fails with a cryptic `Argument list too long`. The wrapper measures the resolved `-`/`@file` prompt and fails loud over the ceiling. A huge **literal** `agy-run "<huge>"` fails at the wrapper's own `exec`, so route large prompts via `-`/`@file`. |
|
|
53
53
|
|
|
54
54
|
Subscription invariant: the wrapper prepends `$HOME/.local/bin` to `PATH` and clears `OPENAI_BASE_URL`
|
|
55
|
-
and every `*_API_KEY` except
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
and every `*_API_KEY` except the passed variables its service-facts.txt lists before execution; those
|
|
56
|
+
variables pass as given, with no permissions widened. Auth comes from the user's cached OAuth token,
|
|
57
|
+
never from bundled credentials.
|
|
58
58
|
|
|
59
59
|
## `agy-review` contract (review role)
|
|
60
60
|
|
|
@@ -34,7 +34,7 @@ agy
|
|
|
34
34
|
This caches an OAuth token under `~/.gemini/antigravity-cli/` (`antigravity-oauth-token`). That token
|
|
35
35
|
is **personal** — never copy, commit, package, print, or share that directory or token. This skill
|
|
36
36
|
needs no API keys and must not be configured with API-key billing; the wrapper unsets every
|
|
37
|
-
`*_API_KEY` except
|
|
37
|
+
`*_API_KEY` except the passed variables its service-facts.txt lists (which pass as given) so billing can never
|
|
38
38
|
silently fall back to pay-as-you-go.
|
|
39
39
|
|
|
40
40
|
## 3. Put the wrappers on `PATH` (`agy-run` + `agy-review`)
|