@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.
@@ -3,7 +3,7 @@
3
3
  "schema": 1,
4
4
  "name": "codex-cli-bridge",
5
5
  "kind": "execution-backend",
6
- "version": "5.1.0",
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
  ],
@@ -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
@@ -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": "23.0.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": "23.0.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",
@@ -23,6 +23,7 @@ import { existsSync, statSync, accessSync, realpathSync, constants } from 'node:
23
23
  import { join } from 'node:path';
24
24
  import os from 'node:os';
25
25
  import { isDirectRun } from './direct-run.mjs';
26
+ import { loadServiceFragments } from './services/index.mjs';
26
27
  import { validateManifest, UNSUPPORTED, INVALID } from './manifest/validate.mjs';
27
28
 
28
29
  // Probe states. `unknown` (a wrapped fs error) NEVER counts as present in any readiness rule.
@@ -50,7 +51,7 @@ const EXPECTED_KIND = 'execution-backend';
50
51
 
51
52
  // The kit-owned registry: the per-backend facts the detector needs even when a bridge is NOT
52
53
  // installed (no manifest on disk to read). Kept in lockstep with the in-repo manifests by the
53
- // drift-guard test. `credential.env: null` → no env override exists (do not invent one).
54
+ // drift-guard test. Credential directories come from the named service fragment.
54
55
  // `roleCmds` is the role-keyed source of truth (role → the PATH wrapper cmd), mirroring each bridge
55
56
  // manifest `roles[role].cmd`, drift-guarded. Two derivations ride on it, both drift-guarded against the
56
57
  // manifests: `wrapperCmds` (the deduped set the readiness probe checks — a stale install missing one
@@ -85,7 +86,7 @@ const RAW_BACKENDS = [
85
86
  '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',
86
87
  '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 ?',
87
88
  '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',
88
- "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",
89
+ "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",
89
90
  'quote the posture banner verbatim when labeling this dispatch — the banner is the machine-stated posture; a prose re-type drifts',
90
91
  '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',
91
92
  ],
@@ -99,7 +100,7 @@ const RAW_BACKENDS = [
99
100
  continue: [],
100
101
  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',
101
102
  notes: [
102
- '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',
103
+ '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',
103
104
  'quote the posture banner verbatim when labeling this dispatch — the banner is the machine-stated posture; a prose re-type drifts',
104
105
  ],
105
106
  },
@@ -108,7 +109,7 @@ const RAW_BACKENDS = [
108
109
  // The per-backend receipt-deadline default (seconds) the capability block reports — the review
109
110
  // wrapper's built-in hard cap (CODEX_HARD_TIMEOUT review default), an OFFLINE registry fact.
110
111
  deadlineDefaultS: 1800,
111
- credential: { env: 'CODEX_HOME', default: '~/.codex', file: 'auth.json' },
112
+ credential: { service: 'codex', file: 'auth.json' },
112
113
  setupUrl: 'https://github.com/sabaiway/agent-workflow/blob/main/codex-cli-bridge/setup/README.md',
113
114
  setupPathLocal: 'setup/README.md',
114
115
  // The short canonical guided commands. Binary-install is platform-variant and longer, so it is
@@ -151,7 +152,7 @@ const RAW_BACKENDS = [
151
152
  bin: 'agy',
152
153
  // AGY_HARD_TIMEOUT's built-in review default is 30m — reported in seconds, an OFFLINE registry fact.
153
154
  deadlineDefaultS: 1800,
154
- credential: { env: null, default: '~/.gemini/antigravity-cli', file: 'antigravity-oauth-token' },
155
+ credential: { service: 'antigravity', file: 'antigravity-oauth-token' },
155
156
  setupUrl: 'https://github.com/sabaiway/agent-workflow/blob/main/antigravity-cli-bridge/setup/README.md',
156
157
  setupPathLocal: 'setup/README.md',
157
158
  guide: { setupRef: 'antigravity-cli-bridge/setup/README.md', loginCmd: 'agy', verifyCmd: 'echo "say OK" | agy-run -' },
@@ -263,13 +264,19 @@ const probeFile = (file, deps = {}) => {
263
264
  // "authed?" = existence of the credential-marker file (read-only). NEVER runs the subscription CLI.
264
265
  // Report wording is "credentials present/missing/unknown", never "authenticated".
265
266
  export const probeCredential = (entry, deps = {}) => {
266
- const dir = resolveDir(
267
- { env: entry.credential.env, default: entry.credential.default },
268
- deps.getenv ?? process.env,
269
- deps.home ?? os.homedir(),
270
- );
271
- const file = join(dir, entry.credential.file);
272
- return { state: probeFile(file, deps), path: file };
267
+ const service = entry.credential.service;
268
+ try {
269
+ const fragment = (deps.loadServiceFragments ?? loadServiceFragments)()?.[service];
270
+ if (!fragment) return { state: UNKNOWN, path: null, reason: `${service}: service fragment missing` };
271
+ if (!Array.isArray(fragment.writableDirs) || fragment.writableDirs.length !== 1) {
272
+ return { state: UNKNOWN, path: null, reason: `${service}: expected exactly one writableDirs entry` };
273
+ }
274
+ const dir = resolveDir(fragment.writableDirs[0], deps.getenv ?? process.env, deps.home ?? os.homedir());
275
+ const file = join(dir, entry.credential.file);
276
+ return { state: probeFile(file, deps), path: file };
277
+ } catch (error) {
278
+ return { state: UNKNOWN, path: null, reason: `${service}: ${error?.message ?? String(error)}` };
279
+ }
273
280
  };
274
281
 
275
282
  const computeReadiness = (manifestState, cli, credentials, wrappers) => {
@@ -348,7 +355,7 @@ export const detectBackend = (entry, deps = {}) => {
348
355
  manifestReason,
349
356
  skillDir: installed ? resolvedDir : null,
350
357
  cli: { bin: entry.bin, state: cliProbe.state, path: cliProbe.path ?? null },
351
- credentials: { state: credentials.state, path: credentials.path },
358
+ credentials: { state: credentials.state, path: credentials.path, ...(credentials.reason ? { reason: credentials.reason } : {}) },
352
359
  wrappers,
353
360
  readiness,
354
361
  setupHint,
@@ -384,7 +391,7 @@ export const guideFor = (status) => {
384
391
  if (status.credentials.state !== PRESENT) {
385
392
  out.push({
386
393
  need: 'credentials',
387
- hint: `sign in once (subscription): ${guide?.loginCmd ?? 'see the setup README'} (verify: ${guide?.verifyCmd ?? 'see the setup README'})`,
394
+ hint: status.credentials.reason ?? `sign in once (subscription): ${guide?.loginCmd ?? 'see the setup README'} (verify: ${guide?.verifyCmd ?? 'see the setup README'})`,
388
395
  });
389
396
  }
390
397
  return out;
@@ -400,6 +407,7 @@ const setupTarget = (s) => s.setupHint.local ?? s.setupHint.url;
400
407
  // Next-step hint per readiness. Deliberately never says "authenticated"/"authed" — only
401
408
  // "credentials present/missing" (detection is file-presence, not a live login check).
402
409
  const nextStep = (s) => {
410
+ if (s.credentials.reason) return s.credentials.reason;
403
411
  switch (s.readiness) {
404
412
  case READY:
405
413
  return null;
@@ -57,8 +57,12 @@ const validateFragment = (fragment, path) => {
57
57
  validateList(fragment.writableDirs, path, 'writableDirs', isDirectoryEntry, (entry) => entry.default);
58
58
  validateList(fragment.excludedCommands, path, 'excludedCommands',
59
59
  (command) => typeof command === 'string' && EXCLUDED_COMMAND_RE.test(command));
60
- validateList(fragment.passedVariables, path, 'passedVariables', isVariable);
60
+ validateList(fragment.passedVariables, path, 'passedVariables',
61
+ (value) => isVariable(value) && value !== 'OPENAI_BASE_URL');
61
62
  if (typeof fragment.runReachesHosts !== 'boolean') refuseSchema(path, 'runReachesHosts', 'must be a boolean');
63
+ if (fragment.runReachesHosts && fragment.hosts.some((host) => host.startsWith('*.'))) {
64
+ refuseSchema(path, 'hosts', 'must not contain a wildcard when runReachesHosts is true');
65
+ }
62
66
  return fragment;
63
67
  };
64
68