instar 1.2.76 → 1.2.78

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/commands/init.d.ts.map +1 -1
  2. package/dist/commands/init.js +21 -1
  3. package/dist/commands/init.js.map +1 -1
  4. package/dist/core/Config.d.ts +2 -14
  5. package/dist/core/Config.d.ts.map +1 -1
  6. package/dist/core/Config.js +50 -1
  7. package/dist/core/Config.js.map +1 -1
  8. package/dist/core/PostUpdateMigrator.d.ts.map +1 -1
  9. package/dist/core/PostUpdateMigrator.js +64 -3
  10. package/dist/core/PostUpdateMigrator.js.map +1 -1
  11. package/dist/core/SessionManager.d.ts.map +1 -1
  12. package/dist/core/SessionManager.js +14 -2
  13. package/dist/core/SessionManager.js.map +1 -1
  14. package/dist/core/codexHookArm.d.ts +81 -0
  15. package/dist/core/codexHookArm.d.ts.map +1 -0
  16. package/dist/core/codexHookArm.js +191 -0
  17. package/dist/core/codexHookArm.js.map +1 -0
  18. package/dist/core/codexHookTrust.d.ts +52 -0
  19. package/dist/core/codexHookTrust.d.ts.map +1 -0
  20. package/dist/core/codexHookTrust.js +114 -0
  21. package/dist/core/codexHookTrust.js.map +1 -0
  22. package/dist/core/installCodexHooks.d.ts.map +1 -1
  23. package/dist/core/installCodexHooks.js +19 -12
  24. package/dist/core/installCodexHooks.js.map +1 -1
  25. package/dist/core/types.d.ts +4 -0
  26. package/dist/core/types.d.ts.map +1 -1
  27. package/dist/core/types.js.map +1 -1
  28. package/dist/providers/adapters/openai-codex/canary/codexHookContractCanary.d.ts +21 -0
  29. package/dist/providers/adapters/openai-codex/canary/codexHookContractCanary.d.ts.map +1 -1
  30. package/dist/providers/adapters/openai-codex/canary/codexHookContractCanary.js +63 -3
  31. package/dist/providers/adapters/openai-codex/canary/codexHookContractCanary.js.map +1 -1
  32. package/package.json +1 -1
  33. package/scripts/pre-push-e2e-scope.mjs +83 -0
  34. package/scripts/safe-merge.mjs +87 -0
  35. package/src/data/builtin-manifest.json +18 -18
  36. package/upgrades/1.2.77.md +99 -0
  37. package/upgrades/1.2.78.md +49 -0
  38. package/upgrades/side-effects/codex-full-parity-bundle.md +46 -0
  39. package/upgrades/side-effects/codex-parity-arm-model-literal.md +24 -0
  40. package/upgrades/side-effects/codex-parity-arm-vitest-guard.md +31 -0
  41. package/upgrades/side-effects/codex-parity-asdf-and-model-badge.md +41 -0
  42. package/upgrades/side-effects/codex-parity-asdf-convergence-fixes.md +44 -0
  43. package/upgrades/side-effects/codex-parity-c3-scope-coherence-reentry.md +34 -0
  44. package/upgrades/side-effects/codex-parity-c4-canary-drift.md +33 -0
  45. package/upgrades/side-effects/codex-parity-p0-arm-realpath-liveproof.md +35 -0
  46. package/upgrades/side-effects/codex-parity-p0-arm-wiring.md +40 -0
  47. package/upgrades/side-effects/codex-parity-p0-hook-arm.md +50 -0
  48. package/upgrades/side-effects/codex-parity-p0-hook-trust-core.md +43 -0
  49. package/upgrades/side-effects/codex-parity-stop-trio-and-deferral.md +76 -0
@@ -0,0 +1,50 @@
1
+ # Side-Effects Review: P0 hook-arming orchestration (codexHookArm)
2
+
3
+ ## Change
4
+ New `src/core/codexHookArm.ts` + unit tests — the P0 arming orchestration (the half that decides
5
+ whether/what to arm and verifies the outcome), per the approved+converged spec (P0 / G2 verdict +
6
+ §7 gates F1-F3):
7
+
8
+ - `armCodexHooks({projectDir, codexHome?, trustDriver?})` — idempotent: returns `already-armed`
9
+ (no spawn) when all of the agent's project hook slots are already trusted+enabled (F2); `skipped`
10
+ when the project hooks.json is NOT instar-owned (F1 manifest verify — never blind-trust); else
11
+ drives Codex's trust flow then READS BACK config.toml to confirm (`armed` / `partial` with the
12
+ still-untrusted + the user-disabled slots surfaced, F3 — never silently re-enables).
13
+ - `projectHooksAreInstarOwned(projectDir)` — F1: the project `.codex/hooks.json` must match
14
+ buildInstarCodexHookGroups (expected instar hooks present) AND carry no instar-marker command
15
+ pointing outside THIS project's hooks dir (anti-injection).
16
+ - `makeTmuxTrustDriver({tmuxPath, codexBinary, model})` — the default driver: spawns interactive
17
+ Codex in tmux (CODEX_HOME scoped, **NO `--dangerously-bypass-*` flags** — F1), polls capture-pane
18
+ (bounded ~40s) for the trust prompt, sends Down+Enter to pick "Trust all and continue", then
19
+ exits + kills the pane. The fragile keystroke step is INJECTED so the orchestration is unit-tested
20
+ without a real codex; the driver itself is validated by test-as-self on a live agent.
21
+
22
+ ## Why
23
+ G2 verdict: arming the agent's own project hooks via Codex's trust state is inherently per-agent
24
+ (path-keyed) and avoids the rejected machine-wide managed-config. This module makes that arming
25
+ idempotent, safe (manifest-verified, no bypass flags), and verifiable (readback) — the F1-F3 gates
26
+ the convergence review demanded.
27
+
28
+ ## Scope / blast radius
29
+ - New code; the orchestration is pure-ish (fs reads + an injected driver). `armCodexHooks` is NOT
30
+ yet wired into install/migrate (next increment) — no runtime behavior change until then.
31
+ - When wired, it only ever arms the agent's OWN project hooks (path-scoped); the operator's
32
+ personal Codex (other cwd) is untouched. The tmux driver runs without sandbox/approval bypass.
33
+ - No migration impact yet (new code, ships with dist). The B2 atomic-with-migration wiring is the
34
+ next step. <!-- tracked: codex-full-parity -->
35
+
36
+ ## Signal vs Authority / Over-block
37
+ - N/A — this arms safety hooks (makes them run); it adds no new gate authority. The hooks
38
+ themselves keep their existing signal/authority split.
39
+
40
+ ## Rollback
41
+ - Delete the module + test. Not yet referenced by any call path.
42
+
43
+ ## Tests
44
+ - `tests/unit/codexHookArm.test.ts`: 7 — manifest-owned true/false; already-armed skips the driver
45
+ (idempotent); manifest-mismatch refuses to drive; arms+readback; partial when readback incomplete;
46
+ user-disabled surfaced not re-enabled. Green. tsc clean.
47
+ - Live test-as-self of the tmux keystroke driver: batched with the P0 joint live-proof on codey.
48
+
49
+ ## Publish
50
+ - Feature branch `echo/codex-parity-audit`. Ships atomic with P1 (spec §7 B2).
@@ -0,0 +1,43 @@
1
+ # Side-Effects Review: P0 hook-trust core (parse + idempotency)
2
+
3
+ ## Change
4
+ New pure-function module `src/core/codexHookTrust.ts` + unit tests — the testable
5
+ foundation of P0 (Codex hook auto-arming), per the approved+converged master spec
6
+ (`docs/specs/codex-full-parity-fixes.md`, P0 / G2 verdict):
7
+
8
+ - `parseCodexHookTrust(configTomlBody, hooksJsonPath)` — line-based parse of the
9
+ `[hooks.state]` entries that belong to a specific project hooks.json path (no TOML dep,
10
+ matching instar's deliberate no-TOML-parser stance). Returns per-slot trusted_hash + enabled.
11
+ - `codexHooksArmingStatus(...)` — F2 idempotency: which of the agent's project hooks are
12
+ still untrusted vs explicitly disabled (so the arming step is skippable when already armed,
13
+ and never silently re-enables a user-disabled hook — F3).
14
+ - `expectedHookSlots(hooks)` — derives `<state_event>:<group>:<idx>` slots from a Codex
15
+ hooks.json config (the shape buildInstarCodexHookGroups produces), with the event→state-key
16
+ lowercase/snake_case map Codex uses.
17
+
18
+ ## Why
19
+ P0's G2 verdict (spec §P0): per-agent scoping comes from trust entries being keyed by the
20
+ project hooks.json PATH, so instar arms only its own project hooks. This module is the
21
+ read/verify half — it lets the arming step be idempotent (skip a TUI spawn when already
22
+ trusted) and lets a post-arm readback confirm trust actually took (F2). Pure functions, fully
23
+ unit-testable; the fragile spawn/keystroke driver is a separate later module (codexHookArm).
24
+
25
+ ## Scope / blast radius
26
+ - Pure, side-effect-free parsing. Not yet wired into any call path (building block). No runtime
27
+ behavior change until the arming driver + wiring land. No migration impact (new code, ships
28
+ with dist).
29
+
30
+ ## Signal vs Authority / Over-block
31
+ - N/A — read/verify only; no gating, no authority.
32
+
33
+ ## Rollback
34
+ - Delete the module + test. Nothing references it yet.
35
+
36
+ ## Tests
37
+ - `tests/unit/codexHookTrust.test.ts`: 8 tests — path-scoped parsing, enabled default-true +
38
+ explicit-false, arming-status (untrusted/disabled/allArmed), fresh-agent = fully untrusted,
39
+ slot derivation. Green. tsc clean. Sample config mirrors the real codey [hooks.state] shape.
40
+
41
+ ## Publish
42
+ - Feature branch `echo/codex-parity-audit` (rebased onto JKHeadley/main before PR). Part of the
43
+ P0 bundle, which ships atomic with P1 (spec §7 B2).
@@ -0,0 +1,76 @@
1
+ # Side-Effects Review: Codex parity P1 — correct Stop trio + deferral-detector on PreToolUse (Codex-aware)
2
+
3
+ ## Change
4
+ From the APPROVED master spec (`docs/specs/codex-full-parity-fixes.md`, P1):
5
+
6
+ 1. **`installCodexHooks.ts` — fix the Codex Stop review trio.** Codex `Stop` now wires
7
+ `response-review + claim-intercept-response + scope-coherence-checkpoint`, MIRRORING
8
+ the Claude Stop trio (`settings-template.json`). Previously it wrongly wired
9
+ `response-review + deferral-detector + scope-coherence` — it had dropped
10
+ `claim-intercept-response` (the anti-confabulation Stop hook) and substituted
11
+ `deferral-detector`, a PreToolUse hook whose `tool_name==='Bash'` guard makes it a
12
+ silent no-op on a Stop payload (PROVEN dead via payload replay, ledger §1).
13
+ 2. **`installCodexHooks.ts` — deferral-detector moved to Codex `PreToolUse`** (where it
14
+ lives on Claude), joining dangerous-command-guard + external-operation-gate +
15
+ grounding-before-messaging.
16
+ 3. **`PostUpdateMigrator.getDeferralDetectorHook()` — Codex-aware payload.** The script
17
+ now accepts `tool_name` ∈ {`Bash`, `exec_command`} and reads
18
+ `tool_input.command || tool_input.cmd` — the same fix class already applied to
19
+ dangerous-command-guard and grounding-before-messaging. Previously Claude-only.
20
+ 4. **`codexHookContractCanary.ts` — corrected invariant lock.** Now asserts the correct
21
+ Stop trio (with claim-intercept-response), asserts deferral-detector is on PreToolUse,
22
+ and FAILS if deferral-detector ever appears on Stop again (locks out the regression).
23
+ The canary previously asserted the WRONG trio — it had encoded the bug as correct.
24
+
25
+ ## Why
26
+ - The Stop trio must match Claude's so Codex agents get the same end-of-turn review
27
+ (coherence + anti-confabulation + scope). deferral-detector on Stop did nothing; the
28
+ real anti-confabulation hook (claim-intercept-response) was absent.
29
+ - deferral-detector on PreToolUse + Codex-aware means it actually inspects Codex shell
30
+ (`exec_command`) messaging commands, not just Claude `Bash` — so its false-blocker /
31
+ orphan-TODO checklist fires on Codex too.
32
+
33
+ ## Scope / blast radius
34
+ - `claim-intercept-response.js` is already installed for Codex agents (PostUpdateMigrator
35
+ hook-install set + on codey on disk), so wiring it onto Stop references an installed
36
+ script (no dangling reference; `validateHookReferences` guards this).
37
+ - Migration parity: `migrateHooks` re-runs `installCodexHooks` for codex-cli agents
38
+ (always-overwrite for instar-owned groups), so existing Codex agents pick up the
39
+ corrected wiring on update. deferral-detector.js is always-overwrite, so existing
40
+ agents get the Codex-aware payload reading too. NOTE: rewriting hooks.json changes the
41
+ hashes → Codex marks them "needs review" until trusted; the trust-activation gap is
42
+ P0 (separate fix). This change makes the wiring CORRECT; P0 makes it ACTIVE.
43
+ - Claude agents unaffected — the deferral-detector payload change is purely additive
44
+ (still reads Bash/command; now ALSO exec_command/cmd).
45
+
46
+ ## Signal vs Authority
47
+ - Unchanged. All three Stop hooks remain low-context signal emitters that POST to the
48
+ server's review endpoints for the authoritative decision; deferral-detector still only
49
+ injects a checklist (`decision:'approve'` + additionalContext), never blocks.
50
+
51
+ ## Over-block / autonomy risk
52
+ - None added. scope-coherence retains its self-throttle; claim-intercept-response and
53
+ response-review behave on Codex as on Claude (PENDING the payload-field confirmation —
54
+ see "Known follow-up").
55
+
56
+ ## Known follow-up (tracked) <!-- tracked: codex-full-parity -->
57
+ - response-review.js and claim-intercept-response.js both read `input.last_assistant_message`
58
+ on Stop. Whether Codex's Stop payload populates that exact field is being confirmed by
59
+ capturing a real Codex Stop payload (next P1 commit). If Codex names it differently,
60
+ those two get the same multi-field-accept treatment. The WIRING here is correct
61
+ regardless; this is about the two scripts' payload-field reads.
62
+
63
+ ## Rollback
64
+ - Revert the installCodexHooks Stop/PreToolUse arrays, the canary edits, and the
65
+ deferral-detector generator edit. No data migration, no config change.
66
+
67
+ ## Tests
68
+ - `installCodexHooks.test.ts`: trio assertion updated to claim-intercept-response; +1 test
69
+ that deferral-detector is on PreToolUse and NOT Stop. 9 green.
70
+ - `codexHookContractCanary.test.ts`: invariant assertions updated (+ deferralOnPreToolUse). 6 green.
71
+ - `deferral-detector-orphan-todo.test.ts`: +2 Codex `exec_command`/`cmd` cases (fires on
72
+ orphan-TODO; ignores clean). 16 green. tsc clean.
73
+ - Live test-as-self: batched with the rest of the build before merge.
74
+
75
+ ## Publish
76
+ - Feature branch `echo/codex-parity-audit` (rebased onto JKHeadley/main before PR). Patch release.