@quantiya/codevibe-core 2.0.6 → 2.0.7

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 (159) hide show
  1. package/README.md +7 -5
  2. package/dist/agy-cli-contract.d.ts +14 -0
  3. package/dist/appsync/appsync-client.d.ts +59 -31
  4. package/dist/appsync/event-throttle.d.ts +33 -0
  5. package/dist/appsync/index.d.ts +3 -2
  6. package/dist/appsync/queries.d.ts +4 -2
  7. package/dist/auth/auth-telemetry.d.ts +26 -0
  8. package/dist/auth/vendor-key-cli.d.ts +49 -0
  9. package/dist/companion-mode/index.d.ts +36 -22
  10. package/dist/companion-mode/persist-preference.d.ts +1 -5
  11. package/dist/companion-mode/resolve-agent.d.ts +5 -4
  12. package/dist/config/config.d.ts +0 -5
  13. package/dist/credential-broker/__tests__/upstream-result-helpers.d.ts +21 -0
  14. package/dist/credential-broker/broker.d.ts +196 -12
  15. package/dist/credential-broker/chatgpt-config.d.ts +40 -0
  16. package/dist/credential-broker/index.d.ts +4 -1
  17. package/dist/credential-broker/oauth-account-lock.d.ts +104 -0
  18. package/dist/credential-broker/oauth-refresh.d.ts +72 -0
  19. package/dist/credential-broker/types.d.ts +165 -17
  20. package/dist/credential-broker/upstream-client.d.ts +3 -2
  21. package/dist/credential-broker/vendor-key-store.d.ts +32 -1
  22. package/dist/crypto/__tests__/encrypt-for-emit.test.d.ts +1 -0
  23. package/dist/crypto/encrypt-for-emit.d.ts +39 -0
  24. package/dist/crypto/index.d.ts +2 -0
  25. package/dist/daemon/__tests__/process-guards.test.d.ts +1 -0
  26. package/dist/daemon/index.d.ts +2 -0
  27. package/dist/daemon/process-guards.d.ts +38 -0
  28. package/dist/index.d.ts +17 -2
  29. package/dist/index.js +308 -281
  30. package/dist/keychain/keychain-manager.d.ts +25 -4
  31. package/dist/local-executor/__tests__/reviewer-rationale-flag.test.d.ts +1 -0
  32. package/dist/local-executor/class-a-sign.d.ts +15 -0
  33. package/dist/local-executor/group-decision-outcome.d.ts +11 -0
  34. package/dist/local-executor/implementor-argv.d.ts +89 -7
  35. package/dist/local-executor/local-executor-impl.d.ts +18 -7
  36. package/dist/local-executor/merge-conflict-resolve.d.ts +19 -0
  37. package/dist/local-executor/revert-reconcile.d.ts +12 -0
  38. package/dist/local-executor/reviewer-rationale-flag.d.ts +10 -0
  39. package/dist/local-executor/types.d.ts +1 -0
  40. package/dist/local-model/manager.d.ts +1 -1
  41. package/dist/local-model/ollama.d.ts +40 -0
  42. package/dist/orchestration/__tests__/detect-agents.test.d.ts +1 -0
  43. package/dist/orchestration/detect-agents.d.ts +10 -30
  44. package/dist/orchestration/index.d.ts +1 -2
  45. package/dist/orchestration-shell/__tests__/a1a-planner-offers.test.d.ts +1 -0
  46. package/dist/orchestration-shell/__tests__/a6-cli-surface.test.d.ts +1 -0
  47. package/dist/orchestration-shell/__tests__/advisory-attachments-dir-race.test.d.ts +1 -0
  48. package/dist/orchestration-shell/__tests__/advisory-multi-mention-panel.test.d.ts +1 -0
  49. package/dist/orchestration-shell/__tests__/advisory-panel-attachments.test.d.ts +1 -0
  50. package/dist/orchestration-shell/__tests__/advisory-quota-stdout-result.test.d.ts +1 -0
  51. package/dist/orchestration-shell/__tests__/agent-turn-context-batch.test.d.ts +1 -0
  52. package/dist/orchestration-shell/__tests__/bounded-shutdown.test.d.ts +1 -0
  53. package/dist/orchestration-shell/__tests__/brainstorm-quorum-wiring.test.d.ts +1 -0
  54. package/dist/orchestration-shell/__tests__/brainstorm-quorum.test.d.ts +1 -0
  55. package/dist/orchestration-shell/__tests__/cli-team-session-key.test.d.ts +1 -0
  56. package/dist/orchestration-shell/__tests__/command-intent.test.d.ts +1 -0
  57. package/dist/orchestration-shell/__tests__/context-compaction.test.d.ts +1 -0
  58. package/dist/orchestration-shell/__tests__/context-items-hosted-sync.test.d.ts +1 -0
  59. package/dist/orchestration-shell/__tests__/context-items-wiring.test.d.ts +1 -0
  60. package/dist/orchestration-shell/__tests__/context-items.test.d.ts +1 -0
  61. package/dist/orchestration-shell/__tests__/cp8-full-team-events.test.d.ts +1 -0
  62. package/dist/orchestration-shell/__tests__/cp8-team-decomposed-zk.test.d.ts +1 -0
  63. package/dist/orchestration-shell/__tests__/explicit-tty-exit.test.d.ts +1 -0
  64. package/dist/orchestration-shell/__tests__/mention-suggest.test.d.ts +1 -0
  65. package/dist/orchestration-shell/__tests__/route-browse-summarize-recovery.test.d.ts +1 -0
  66. package/dist/orchestration-shell/attachments.d.ts +58 -2
  67. package/dist/orchestration-shell/bounded-shutdown.d.ts +16 -0
  68. package/dist/orchestration-shell/brainstorm-quorum.d.ts +118 -0
  69. package/dist/orchestration-shell/cli.d.ts +97 -70
  70. package/dist/orchestration-shell/cli.js +30990 -22426
  71. package/dist/orchestration-shell/command-intent.d.ts +56 -0
  72. package/dist/orchestration-shell/components/InputBar.d.ts +6 -0
  73. package/dist/orchestration-shell/components/OrchestrationApp.d.ts +2 -0
  74. package/dist/orchestration-shell/context-compaction.d.ts +264 -0
  75. package/dist/orchestration-shell/context-items-hosted-sync.d.ts +19 -0
  76. package/dist/orchestration-shell/context-items.d.ts +408 -0
  77. package/dist/orchestration-shell/context-store.d.ts +162 -0
  78. package/dist/orchestration-shell/emit-shell-event.d.ts +34 -13
  79. package/dist/orchestration-shell/explicit-tty-exit.d.ts +18 -0
  80. package/dist/orchestration-shell/gate-prompts.d.ts +3 -3
  81. package/dist/orchestration-shell/index.d.ts +306 -37
  82. package/dist/orchestration-shell/mention-suggest.d.ts +11 -0
  83. package/dist/orchestration-shell/mode-selection.d.ts +4 -22
  84. package/dist/orchestration-shell/quorum-loop.d.ts +336 -20
  85. package/dist/orchestration-shell/task-progress.d.ts +2 -0
  86. package/dist/orchestration-shell/team-decompose.d.ts +37 -19
  87. package/dist/orchestration-shell/types.d.ts +71 -4
  88. package/dist/planner/index.d.ts +1 -1
  89. package/dist/planner/local-advisory.d.ts +12 -0
  90. package/dist/planner/local-gemma.d.ts +27 -0
  91. package/dist/planner/types.d.ts +7 -0
  92. package/dist/reviewer/index.d.ts +0 -2
  93. package/dist/reviewer/provider.d.ts +9 -6
  94. package/dist/reviewer/providers/antigravity.d.ts +2 -3
  95. package/dist/reviewer/registry.d.ts +9 -4
  96. package/dist/reviewer/token-usage.d.ts +10 -0
  97. package/dist/session/__tests__/device-registration-lease.test.d.ts +1 -0
  98. package/dist/session/__tests__/pending-session-create.test.d.ts +1 -0
  99. package/dist/session/__tests__/session-rekey-fingerprint.test.d.ts +1 -0
  100. package/dist/session/__tests__/session-resume-key-reconciliation.test.d.ts +1 -0
  101. package/dist/session/__tests__/session-resume-pending-first.test.d.ts +1 -0
  102. package/dist/session/device-key-watcher.d.ts +1 -0
  103. package/dist/session/index.d.ts +4 -2
  104. package/dist/session/pending-session-create.d.ts +61 -0
  105. package/dist/session/register-device-key.d.ts +11 -1
  106. package/dist/session/session-rekey.d.ts +4 -5
  107. package/dist/session/session-resume.d.ts +21 -1
  108. package/dist/substrate/docker.d.ts +7 -0
  109. package/dist/substrate/sandbox-exec.d.ts +17 -3
  110. package/dist/substrate/types.d.ts +32 -3
  111. package/dist/substrate-launch/apikey-bootstrap.d.ts +24 -1
  112. package/dist/substrate-launch/engage-substrate.d.ts +17 -0
  113. package/dist/substrate-launch/sanitized-env.d.ts +5 -5
  114. package/dist/tool-activity/__tests__/consolidator.test.d.ts +1 -0
  115. package/dist/tool-activity/__tests__/digest.test.d.ts +1 -0
  116. package/dist/tool-activity/__tests__/flock-rollout-lock.test.d.ts +1 -0
  117. package/dist/tool-activity/__tests__/ledger.test.d.ts +1 -0
  118. package/dist/tool-activity/__tests__/outbox.test.d.ts +1 -0
  119. package/dist/tool-activity/__tests__/replay-cursor.test.d.ts +1 -0
  120. package/dist/tool-activity/__tests__/session-map.test.d.ts +1 -0
  121. package/dist/tool-activity/__tests__/socket-rollout-lock.test.d.ts +1 -0
  122. package/dist/tool-activity/atomic-file.d.ts +27 -0
  123. package/dist/tool-activity/consolidator.d.ts +253 -0
  124. package/dist/tool-activity/digest.d.ts +4 -0
  125. package/dist/tool-activity/flock-rollout-lock.d.ts +68 -0
  126. package/dist/tool-activity/index.d.ts +9 -0
  127. package/dist/tool-activity/ledger.d.ts +274 -0
  128. package/dist/tool-activity/outbox.d.ts +60 -0
  129. package/dist/tool-activity/replay-cursor.d.ts +156 -0
  130. package/dist/tool-activity/session-map.d.ts +133 -0
  131. package/dist/tool-activity/socket-rollout-lock.d.ts +57 -0
  132. package/dist/tool-activity/types.d.ts +368 -0
  133. package/dist/types/encryption.d.ts +4 -0
  134. package/dist/types/events.d.ts +24 -4
  135. package/dist/types/session.d.ts +32 -2
  136. package/package.json +5 -4
  137. package/dist/orchestration/orchestration-cli.d.ts +0 -12
  138. package/dist/orchestration/setup-bootstrap.d.ts +0 -146
  139. package/dist/orchestration/setup-failure-recourse.d.ts +0 -23
  140. package/dist/orchestration/setup-save.d.ts +0 -47
  141. package/dist/orchestration/setup-seat-picker.d.ts +0 -72
  142. package/dist/orchestration/setup-telemetry.d.ts +0 -54
  143. package/dist/orchestration/setup-test-agents.d.ts +0 -108
  144. package/dist/orchestration/setup-types.d.ts +0 -146
  145. package/dist/orchestration/setup-wizard.d.ts +0 -57
  146. package/dist/orchestration-shell/cohort-flag.d.ts +0 -16
  147. package/dist/reviewer/providers/gemini.d.ts +0 -109
  148. /package/dist/{companion-mode/__tests__/detect-parallel.test.d.ts → appsync/__tests__/appsync-client-context-items.test.d.ts} +0 -0
  149. /package/dist/{orchestration-shell/__tests__/cli-stub-session-adapter.test.d.ts → appsync/__tests__/heartbeat-active.test.d.ts} +0 -0
  150. /package/dist/{orchestration/__tests__/setup-bootstrap.test.d.ts → appsync/__tests__/orphan-sweep-null-heartbeat.test.d.ts} +0 -0
  151. /package/dist/{orchestration/__tests__/setup-failure-recourse.test.d.ts → auth/__tests__/vendor-key-cli.test.d.ts} +0 -0
  152. /package/dist/{orchestration/__tests__/setup-save.test.d.ts → companion-mode/__tests__/mode-selected-emit.test.d.ts} +0 -0
  153. /package/dist/{orchestration/__tests__/setup-seat-picker.test.d.ts → companion-mode/__tests__/private-launcher-detection.test.d.ts} +0 -0
  154. /package/dist/{orchestration/__tests__/setup-telemetry.test.d.ts → companion-mode/__tests__/private-launcher-path.test.d.ts} +0 -0
  155. /package/dist/{orchestration/__tests__/setup-test-agents.test.d.ts → credential-broker/__tests__/broker-c4.test.d.ts} +0 -0
  156. /package/dist/{orchestration/__tests__/setup-types.test.d.ts → credential-broker/__tests__/broker-streaming.test.d.ts} +0 -0
  157. /package/dist/{orchestration/__tests__/setup-wizard.test.d.ts → credential-broker/__tests__/chatgpt-config.test.d.ts} +0 -0
  158. /package/dist/{reviewer/providers/__tests__/gemini-live-smoke.test.d.ts → credential-broker/__tests__/oauth-account-lock.test.d.ts} +0 -0
  159. /package/dist/{reviewer/providers/__tests__/gemini.test.d.ts → credential-broker/__tests__/oauth-refresh.test.d.ts} +0 -0
@@ -87,9 +87,26 @@ export declare class KeychainManager {
87
87
  */
88
88
  isTokenExpired(tokens: TokenData): boolean;
89
89
  /**
90
- * Get session key for a session, decrypting from encryptedKeys if needed
90
+ * Get the session key for a session.
91
+ *
92
+ * When `encryptedKeys` are provided they are the AUTHORITATIVE source and the
93
+ * cache is trusted ONLY if its stored generation matches `sessionKeyGen`
94
+ * (tool-event consolidation §4.5 / Stage-2 Codex H2 / #230 Finding 1). A
95
+ * generation mismatch — the session was RECREATED under a new key (K2) while
96
+ * the cache still holds the prior generation's key (K1) — forces a fresh
97
+ * derive from `encryptedKeys`, so `getSessionKey` can never hand back a stale
98
+ * K1 for a K2 session. On a cache hit at the matching generation the cached
99
+ * key is returned (a re-derive per event would be a needless ECDH cost, and
100
+ * the ONLY writers of a generation's entry are this method's own derive and
101
+ * `cacheSessionKey`-with-the-derived-key, so the entry is always authoritative
102
+ * for its generation).
103
+ *
104
+ * When `encryptedKeys` are NOT provided (cache-only callers — e.g. the
105
+ * orchestration QuorumLoop's `getSessionKey(sessionId)`), the cached key is
106
+ * returned regardless of generation. This preserves the shipped cache-only
107
+ * behavior; those callers do not participate in the generation-binding.
91
108
  */
92
- getSessionKey(sessionId: string, encryptedKeys?: EncryptedSessionKey[]): Promise<string | null>;
109
+ getSessionKey(sessionId: string, encryptedKeys?: EncryptedSessionKey[], sessionKeyGen?: string | null): Promise<string | null>;
93
110
  /**
94
111
  * Generate and encrypt a new session key for all devices.
95
112
  *
@@ -115,9 +132,13 @@ export declare class KeychainManager {
115
132
  skippedDeviceIds: string[];
116
133
  };
117
134
  /**
118
- * Cache a session key
135
+ * Cache a session key, optionally bound to the session GENERATION it was
136
+ * derived under (§4.5). Callers that hold the authoritative key + generation
137
+ * (the session create/resume path) pass `sessionKeyGen` so a later
138
+ * `getSessionKey(..., encryptedKeys, gen)` trusts the entry only at the
139
+ * matching generation. Legacy cache-only callers omit it (stored as `null`).
119
140
  */
120
- cacheSessionKey(sessionId: string, sessionKey: string): void;
141
+ cacheSessionKey(sessionId: string, sessionKey: string, sessionKeyGen?: string | null): void;
121
142
  /**
122
143
  * Get a cached session key without touching the backend or attempting
123
144
  * to decrypt from encryptedKeys. Returns null if the session key is not
@@ -23,6 +23,21 @@ export interface DeviceSigningKey {
23
23
  * exact canonical string and catch future json-freeze JCS drift.
24
24
  */
25
25
  export declare function canonicalJsonForSigning(obj: Record<string, unknown>, signatureFieldName: string): string;
26
+ /**
27
+ * Sign `canonical` (the JCS string) with the device's P-256 key under
28
+ * ECDSA-P-256-with-SHA-256, returning the STANDARD-base64 of the raw 64-byte
29
+ * r‖s (IEEE P-1363) signature. Matches the Rust verifier's
30
+ * `Signature::from_slice(&B64.decode(sig))` decode path (signing.rs:203-218).
31
+ */
32
+ export declare function signCanonical(canonical: string, keys: DeviceSigningKey): string;
33
+ /**
34
+ * Generic writer-attestation signing primitive. Unlike Class A envelopes,
35
+ * every field in this closed object is in the signing domain; the signature
36
+ * is carried in the adjacent GraphQL input rather than embedded in `payload`.
37
+ */
38
+ export declare function signWriterEventPayload(payload: Record<string, unknown>, keys: DeviceSigningKey): string;
39
+ export declare const WRITER_EVENT_ATTESTATION_SCHEMA: "codevibe.encrypted_desktop_event.writer.v1";
40
+ export declare function signWriterEventEnvelope(envelope: Record<string, unknown>, keys: DeviceSigningKey): string;
26
41
  /**
27
42
  * Sign a Class A envelope object. The canonical bytes are the JCS of the
28
43
  * envelope with `signature` removed (matching Rust
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Map a group-escalation decision label to its authoritative
3
+ * `TEAM_GROUP_RESOLVED.outcome` const. Both accept-family decisions resolve the
4
+ * group `complete`; each reject-family decision has its OWN distinct terminal so
5
+ * mobile can tell abort / restart / plain-reject apart (the closed-enum promise).
6
+ *
7
+ * A label outside the closed 5-option set (only reachable from a corrupt persisted
8
+ * marker — the SDK re-validates live labels) maps to the safest `group_user_rejected`
9
+ * so a recovered decision still resolves the group rather than stranding it.
10
+ */
11
+ export declare function decisionToGroupOutcome(decision: string): string;
@@ -15,6 +15,20 @@ export interface ImplementorArgvPlan {
15
15
  /** Where the final proposal text is captured from after `await handle.done`. */
16
16
  capture: ImplementorCaptureSurface;
17
17
  }
18
+ /**
19
+ * Claude read-only advisory variant for broad @agent/@all brainstorm turns.
20
+ *
21
+ * This is intentionally separate from `buildImplementorArgv('CLAUDE', 'plan')`:
22
+ * normal plan mode keeps Read/Grep/Glob for explicit repo inspection, while
23
+ * broad advisory turns should answer without crawling the workspace. Keeping
24
+ * this as a first-class argv builder lets the command allowlist and drift tests
25
+ * cover the exact runtime command instead of relying on ad hoc shell rewrites.
26
+ *
27
+ * Claude CLI has two related controls: `--allowed-tools` restricts an available
28
+ * tool set, while `--tools ""` disables all built-in tools. Use the latter here
29
+ * because broad advisory turns should have no file-inspection tools at all.
30
+ */
31
+ export declare function buildClaudeNoToolsPlanArgv(): ImplementorArgvPlan;
18
32
  /**
19
33
  * D9 — the ONE shared `CODEVIBE_AGY_MODEL` resolver used by BOTH
20
34
  * `buildImplementorArgv` (the spawned argv) and `agyImplementorAllowlistEntries`
@@ -44,10 +58,19 @@ export declare const AGY_IMPLEMENTOR_PRINT_TIMEOUT = "3600s";
44
58
  * static template can neither pin the value nor omit it when set. Two
45
59
  * FULLY-PINNED templates (plan `--sandbox` vs execute
46
60
  * `--dangerously-skip-permissions` — the N-3 defense-in-depth split), with
47
- * `<workdir>` as the SOLE trailing wildcard. Appended by
61
+ * `<workdir> --print <prompt>` under the trailing wildcard. The prompt is
62
+ * necessarily argv-visible because Agy 1.1.2 removed its stdin prompt mode;
63
+ * the fixed mode/model/timeout prefix remains pinned. Appended by
48
64
  * `makeImplementorCommandScope` at scope construction.
49
65
  */
50
66
  export declare function agyImplementorAllowlistEntries(): string[];
67
+ /**
68
+ * Materialize the trusted stdin payload into Agy 1.1.2's required
69
+ * `--print <prompt>` argument. Fail closed unless the argv is the exact
70
+ * canonical placeholder shape produced by `buildImplementorArgv`; callers
71
+ * cannot use this helper to rewrite arbitrary Agy commands.
72
+ */
73
+ export declare function bindAgyPrintPrompt(argv: readonly string[], prompt: string | undefined, workingDir: string): string[];
51
74
  /**
52
75
  * D3 — the abs-path brief preamble for an agy implementor/decomposer/resolver
53
76
  * spawn. agy is WORKSPACE-CENTRIC: it ignores the process cwd, so the brief
@@ -60,9 +83,12 @@ export declare function agyImplementorAllowlistEntries(): string[];
60
83
  export declare function agyWorkdirBriefPreamble(workdir: string): string;
61
84
  /**
62
85
  * Build the implementor invocation argv for `agent` in `mode`. The leading
63
- * executable name (`claude` / `codex` / `gemini` / `agy`) is the argv[0] so
64
- * callers can pass the whole array to `spawnImplementor` (which resolves the
65
- * binary from PATH). The brief is fed on stdin by the caller (`stdinPayload`).
86
+ * executable name (`claude` / `codex` / `agy`) is the argv[0] so callers can
87
+ * pass the whole array to `spawnImplementor` (which resolves the binary from
88
+ * PATH). The caller supplies the brief through `stdinPayload`; Claude and
89
+ * Codex receive it on stdin, while Agy's spawn boundary replaces the canonical
90
+ * final empty `--print` placeholder with that validated payload. (GEMINI is
91
+ * SUNSET — the `case 'GEMINI'` throws; it is never a routable implementor.)
66
92
  *
67
93
  * `workdir` (AGY-2.0 D3) is REQUIRED for ANTIGRAVITY (agy is
68
94
  * workspace-centric — `--add-dir <workdir>` is its only view of the tree; the
@@ -71,6 +97,31 @@ export declare function agyWorkdirBriefPreamble(workdir: string): string;
71
97
  * ignore it.
72
98
  */
73
99
  export declare function buildImplementorArgv(agent: AgentKind, mode: ImplementorMode, workdir?: string): ImplementorArgvPlan;
100
+ /**
101
+ * A1b (Codex summary never-read fix, READ side) — read a Codex implementor's
102
+ * `--output-last-message` capture file, resolving the HOST path the same way
103
+ * the reviewer provider does (`src/reviewer/providers/codex.ts::
104
+ * resolveLastMessagePaths` — the lifted shared pattern, not a duplicate):
105
+ *
106
+ * 1. The direct capture path (`plan.capture.path`, an absolute `os.tmpdir()`
107
+ * file) — the legacy/unconfined case, where codex wrote the host tmp file.
108
+ * 2. `<workdir>/<basename>` — the CONFINED-substrate case. This candidate is
109
+ * only ever populated because the spawn path REWRITES the codex argv:
110
+ * `relocateCodexLastMessageForSubstrate` (below) turns the absolute value
111
+ * into a bare basename when the substrate is proven engaged, so codex
112
+ * (cwd = workdir on both A1/A5 backends) writes `<workdir>/<basename>` —
113
+ * host-readable via the A1 bind-mount / the A5 shared fs. Without that
114
+ * write-side rewrite an absolute tmp path is unwritable (A5) or lands in
115
+ * the container's own /tmp (A1) and no read candidate could ever find it.
116
+ * The workdir is the round's shadow dir.
117
+ *
118
+ * The first readable candidate wins; it is best-effort unlinked after the read
119
+ * (we own the file's lifecycle — mirrors the reviewer/decomposer cleanup).
120
+ * NEVER throws: a missing/unreadable file on every candidate returns `''` (the
121
+ * summary is an audit-only nicety; the captured diff, not the summary, is the
122
+ * round's contract).
123
+ */
124
+ export declare function readImplementorLastMessage(capturePath: string, workdir?: string): string;
74
125
  /**
75
126
  * Positive runtime evidence that this process is ACTUALLY inside a container —
76
127
  * the confinement boundary that `CODEVIBE_TRUSTED_CONTAINER` asserts. Docker
@@ -118,7 +169,7 @@ export declare function isTrustedContainerBoundary(env?: NodeJS.ProcessEnv, inCo
118
169
  * namespaces / macOS Seatbelt) and is the only filesystem confinement.
119
170
  *
120
171
  * NARROW BY DESIGN:
121
- * - Only CODEX is affected (Claude/Gemini have no bwrap inner sandbox).
172
+ * - Only CODEX is affected (Claude + Antigravity have no bwrap inner sandbox).
122
173
  * - Only `workspace-write` (the EXECUTE variant) is rewritten. `read-only`
123
174
  * (PLAN mode) is left untouched — it is a DELIBERATE write restriction, and
124
175
  * `danger-full-access` would let a plan-mode agent write, violating the plan
@@ -127,6 +178,37 @@ export declare function isTrustedContainerBoundary(env?: NodeJS.ProcessEnv, inCo
127
178
  * Pure; returns a NEW array when it rewrites, the same array otherwise.
128
179
  */
129
180
  export declare function applyOuterBoundarySandbox(argv: readonly string[], agent: AgentKind, outerBoundaryConfines: boolean): string[];
181
+ /**
182
+ * A1b (Codex summary never-read fix, WRITE side) — substrate-aware relocation
183
+ * of the Codex `--output-last-message` value. Mirrors the reviewer provider's
184
+ * `resolveLastMessagePaths(sandboxed=true, …)` contract on the IMPLEMENTOR
185
+ * path: under the CP-7 substrate codex CANNOT write the host `os.tmpdir()`
186
+ * (A1 Docker never mounts host /tmp — an absolute tmp path writes the
187
+ * CONTAINER's own /tmp, unreadable by the host; A5 Seatbelt grants writes to
188
+ * the WORKDIR only — the write is DENIED outright; the reviewer provider
189
+ * documents the same false-on-both-backends failure at codex.ts:143-152). So
190
+ * when the substrate is PROVEN engaged, rewrite the absolute capture path to
191
+ * its bare BASENAME: codex's cwd IS the workdir on both backends (A5 `exec`
192
+ * spawns with `cwd: workdir`; A1 runs in `/workspace`, the workdir
193
+ * bind-mount), so the file lands at `<workdir>/<basename>` — exactly where
194
+ * `readImplementorLastMessage`'s relocated candidate reads it back.
195
+ *
196
+ * Called from `LocalExecutor.spawnImplementor` at the SAME per-spawn rewrite
197
+ * point as `applyOuterBoundarySandbox`, gated on the engager's OWN
198
+ * `substrateEngaged` proof — NOT predicted at argv-build time (the engage
199
+ * outcome — substrate vs reduced_trust vs legacy — is only knowable when the
200
+ * engager actually runs), and NOT on the trusted-container boundary (there the
201
+ * desktop and codex share ONE fs namespace, so the absolute tmp path works and
202
+ * must stay — it is read candidate #1).
203
+ *
204
+ * NARROW BY DESIGN (mirrors `applyOuterBoundarySandbox`):
205
+ * - Only CODEX (the only file-capture agent) is affected.
206
+ * - Only when `substrateEngaged`; the unconfined argv is byte-identical.
207
+ * - The command-allowlist templates end `--output-last-message *`, so the
208
+ * rewritten argv still passes `enforceCommand` (drift-guard-tested).
209
+ * Pure; returns a NEW array when it rewrites, a copy otherwise.
210
+ */
211
+ export declare function relocateCodexLastMessageForSubstrate(argv: readonly string[], agent: AgentKind, substrateEngaged: boolean): string[];
130
212
  /**
131
213
  * Authority `commandAllowlist` entries covering EVERY (agent, mode) argv
132
214
  * `buildImplementorArgv` can produce. The single-impl + team LEs seed this
@@ -142,8 +224,8 @@ export declare function applyOuterBoundarySandbox(argv: readonly string[], agent
142
224
  *
143
225
  * Matching (authority.ts `enforceCommand`): an entry is a LITERAL full
144
226
  * `argv.join(' ')` match, OR a ` *`-suffix TEMPLATE (prefix match).
145
- * - Claude / Gemini argvs are fixed → literal entries. (Gemini's `-p ''`
146
- * empty arg yields a DOUBLE space in the join — preserved verbatim here.)
227
+ * - Claude argvs are fixed → literal entries. (Gemini is SUNSET as of
228
+ * 2026-07 and is no longer a routable implementor, so it has no entry.)
147
229
  * - Codex carries a per-spawn temp path in `--output-last-message <tmp>` →
148
230
  * a ` *` template: the literal prefix up to `--output-last-message`, then
149
231
  * the wildcard absorbs the varying path + trailing `-`.
@@ -17,15 +17,15 @@ import type { TrackTipsView } from './durable-store';
17
17
  * `tier:'none'` (moat-OFF) reduced-trust badge.
18
18
  *
19
19
  * The ordinary `emitShellEvent` chokepoint RESOLVES WITHOUT EMITTING when the
20
- * cohort flag is off, the session is a `cp1a-local-*` stub, or no session key
21
- * exists (see `emit-shell-event.ts`); the team store tap likewise ignores the
20
+ * no session key exists (see
21
+ * `emit-shell-event.ts`); the team store tap likewise ignores the
22
22
  * `cp7_reduced_trust` notification. A `tier:'none'` badge routed through it can
23
23
  * therefore "succeed" (await resolves) while the user sees NOTHING — and the
24
24
  * legacy unsandboxed spawn would proceed on only a WARN.
25
25
  *
26
26
  * A `StrictBadgeSink` MUST instead CONFIRM that the user-facing NOTIFICATION was
27
27
  * ACTUALLY delivered (e.g. `createEvent` was invoked) and THROW when it cannot
28
- * deliver (cohort off / no session / stub / tap-ignored). For `tier:'none'` a
28
+ * deliver (no session / stub / tap-ignored). For `tier:'none'` a
29
29
  * throw → FAIL CLOSED (no legacy spawn). It is INTENTIONALLY separate from the
30
30
  * audit emit: audit emission stays on the existing Class-A / shell-event path;
31
31
  * this sink is ONLY the user-facing moat-OFF warning.
@@ -73,6 +73,7 @@ export type SubstrateEngageResult = {
73
73
  reducedTrust: boolean;
74
74
  reducedTrustReason?: string;
75
75
  substrateHandle: SubstrateHandle;
76
+ agentConfigDir?: string;
76
77
  refreshBrokerToken(): Promise<void>;
77
78
  teardown(): Promise<void>;
78
79
  } | {
@@ -94,6 +95,16 @@ export type SubstrateEngager = (input: {
94
95
  agentKind: AgentKind;
95
96
  workdir: string;
96
97
  role: ProcessRole;
98
+ /**
99
+ * A1d (design §8.1) — the spawn demands hard confinement (`SpawnArgs.
100
+ * requireConfined`; today only the WB2 agentic class-2 resolver dispatch).
101
+ * Threaded so the engager can build the WRITE-CONFINED resolver row for a
102
+ * broker-less reduced-trust agent (GEMINI/ANTIGRAVITY) instead of returning
103
+ * an immediate `reduced_trust` — which the requireConfined guard below would
104
+ * fail-close to the human gate (the design's mandatory fallback, which still
105
+ * applies whenever the row cannot be established).
106
+ */
107
+ requireConfined?: boolean;
97
108
  }) => Promise<SubstrateEngageResult>;
98
109
  export interface LocalExecutorImplDeps {
99
110
  sessionId: string;
@@ -114,7 +125,7 @@ export interface LocalExecutorImplDeps {
114
125
  /**
115
126
  * Builds the `SpawnArgs.argv` for a track's implementor given the track
116
127
  * payload + canonicalized state dir. The shell knows which agent binary
117
- * (claude/gemini/codex) to invoke and the prompt wiring; the LE only
128
+ * (claude/codex/agy) to invoke and the prompt wiring; the LE only
118
129
  * orchestrates spawn + idempotency + state-dir isolation. When omitted, the
119
130
  * MergeGate happy-path + idempotency tests still exercise the registry via a
120
131
  * `spawnTrackImplementor` stub.
@@ -201,8 +212,8 @@ export interface LocalExecutorImplDeps {
201
212
  * `tier:'none'` (moat-OFF) reduced-trust badge. When supplied (production
202
213
  * wiring in cli.ts), the moat-OFF badge is delivered through THIS sink — which
203
214
  * confirms the NOTIFICATION actually reached `createEvent` and THROWS on a
204
- * silent no-op (cohort off / no session key / stub / tap-ignored) — instead of
205
- * the cohort-gated `emitShellEvent` that can resolve without emitting. A throw
215
+ * silent no-op (no session key / stub / tap-ignored) — instead of
216
+ * `emitShellEvent` that can resolve without emitting. A throw
206
217
  * here makes the `tier:'none'` path FAIL CLOSED (no unsandboxed spawn).
207
218
  *
208
219
  * ABSENT (default) → the legacy behavior: the badge goes through
@@ -448,7 +459,7 @@ export declare class LocalExecutorImpl implements LocalExecutor {
448
459
  * ambient `process.env` reachable): the badge MUST be DELIVERED before the
449
460
  * agent runs. It is routed through the STRICT delivery sink
450
461
  * (`deps.strictBadgeSink`) which CONFIRMS the NOTIFICATION actually reached
451
- * `createEvent` and THROWS on a silent no-op (cohort off / no session key /
462
+ * `createEvent` and THROWS on a silent no-op (no session key /
452
463
  * stub / tap-ignored) — the ordinary `emitShellEvent` would RESOLVE without
453
464
  * emitting in those cases (Finding 2). This method AWAITS that delivery with
454
465
  * a bounded timeout and RE-THROWS on a reject/timeout. The WARN log stays
@@ -33,6 +33,17 @@ export interface ConflictResolverContext {
33
33
  class2Paths: readonly string[];
34
34
  implementorAgent: string;
35
35
  implementorTaskId: string;
36
+ /**
37
+ * A1d / P2 resolver-intent (design §5/§8.1) — the slot's two sides, so the
38
+ * resolver builder can compute BOTH sides' bounded INTENT diffs
39
+ * (`baseSha → oursCommit` = the integration so far; `baseSha → theirsCommit`
40
+ * = the incoming track) for the resolver brief. `baseSha` is optional
41
+ * (absent on the reconstruction-replay path) — absent ⇒ the intent-diff
42
+ * projection degrades gracefully (brief shape unchanged).
43
+ */
44
+ oursCommit: string;
45
+ theirsCommit: string;
46
+ baseSha?: string;
36
47
  }) => Promise<AgenticResolveOutcome>;
37
48
  /** Shared-contract detector tuning (always-gate globs + planner shared_contracts). */
38
49
  detectorOpts?: SharedContractDetectorOptions;
@@ -98,4 +109,12 @@ export declare function resolveSlotConflicts(args: {
98
109
  incomingImplementorTaskId?: string;
99
110
  /** CP-14 WB2 — tags durable records PENDING for this resolve attempt (recovery case 3). */
100
111
  attemptId?: string;
112
+ /**
113
+ * A1d / P2 resolver-intent — the merge-train's pinned integration base
114
+ * (`foundation.baseSha` / the journal record's `baseSha`), threaded through to
115
+ * the agentic resolver so it can compute both sides' intent diffs. Optional:
116
+ * absent (e.g. the reconstruction-replay caller) ⇒ no intent diffs (graceful
117
+ * degrade; never gates a resolve).
118
+ */
119
+ baseSha?: string;
101
120
  }): Promise<SlotResolveResult>;
@@ -63,6 +63,18 @@ export interface ReconcileDeps {
63
63
  * to a later start (the marker survives; never block on a missing key).
64
64
  */
65
65
  getSessionKey?: (sessionId: string) => Promise<string | null>;
66
+ /**
67
+ * CP-8-FULL Stage-2 R1 Codex F1/HIGH — drive the per-track + group convergence
68
+ * emit (the SAME `driveGroupDecisionConvergence` chokepoint the live gate uses)
69
+ * for a CLAIM-crash-recovered decision, so a decision COMMITted at startup still
70
+ * emits its typed `TEAM_TRACK_STATUS` + `TEAM_GROUP_RESOLVED` terminal to mobile
71
+ * (D4: mobile keys the resolved banner off `TEAM_GROUP_RESOLVED`). Present for a
72
+ * TEAM session alongside `commitClient`; ABSENT (non-team / older callers) → the
73
+ * recovery COMMIT still lands, only the wire emit is skipped (no regression vs the
74
+ * pre-CP-8 recovery, which emitted nothing). The outcome is the DECISION-driven
75
+ * `decisionToGroupOutcome` — identical to the live path, so the two never diverge.
76
+ */
77
+ driveGroupConvergence?: (taskGroupId: string, outcome: string) => Promise<void>;
66
78
  /** Optional clock injection for deterministic GC tests. */
67
79
  now?: () => number;
68
80
  }
@@ -0,0 +1,10 @@
1
+ /** The env var that enables reviewer-visible implementor rationale (opt-IN). */
2
+ export declare const REVIEWER_RATIONALE_ENV_VAR = "CODEVIBE_REVIEWER_RATIONALE";
3
+ /**
4
+ * Is reviewer-visible implementor rationale enabled? DEFAULT-OFF. ONLY the
5
+ * canonical truthy tokens (`1`/`true`/`on`/`yes`, case-insensitive) enable it;
6
+ * anything else — including unset, empty, and garbage — is OFF (fail-closed:
7
+ * a typo can never silently widen what reviewers see). `env` is injected for
8
+ * deterministic tests; production passes `process.env`.
9
+ */
10
+ export declare function isReviewerRationaleEnabled(env?: NodeJS.ProcessEnv): boolean;
@@ -15,6 +15,7 @@ export interface SpawnArgs {
15
15
  stdinPayload?: string;
16
16
  signal?: AbortSignal;
17
17
  taskId?: string;
18
+ lifecycleAudit?: 'active_task' | 'none';
18
19
  onProcessSpawned?: ProcessSpawnedHook;
19
20
  onProcessExited?: ProcessExitedHook;
20
21
  substrate?: SubstrateHandle;
@@ -4,7 +4,7 @@ import { type LocalModelState, type LocalModelStateStore } from './state';
4
4
  import { type OllamaPullProgressListener } from './ollama';
5
5
  import type { LocalGemmaPlannerRunner } from '../planner/local-gemma';
6
6
  export type LocalModelCommand = 'install' | 'status' | 'remove' | 'enable' | 'warm' | 'health-check';
7
- export type LocalModelEntitlementSource = 'backend' | 'unauthenticated' | 'unavailable';
7
+ export type LocalModelEntitlementSource = 'backend' | 'environment' | 'unauthenticated' | 'unavailable';
8
8
  export interface LocalModelEntitlement {
9
9
  tier: Tier | 'UNKNOWN';
10
10
  source: LocalModelEntitlementSource;
@@ -13,6 +13,29 @@ export type OllamaRuntimeConfigResult = {
13
13
  ok: false;
14
14
  reason: string;
15
15
  };
16
+ /**
17
+ * Dogfood #618 — keep the model RESIDENT between shell turns. Ollama's default
18
+ * keep_alive is 5 minutes: a user who reads a brainstorm for 6 minutes before
19
+ * replying pays a full model reload on the next turn, and on a busy machine
20
+ * that reload can blow the whole request timeout. Sent on EVERY generate (each
21
+ * turn re-ups the window) and on the shell-start pre-warm.
22
+ */
23
+ export declare const OLLAMA_KEEP_ALIVE = "30m";
24
+ /**
25
+ * Dogfood #618 — floor for ADVISORY generations (brainstorm/familiarize
26
+ * fallback, up to 700–1400 output tokens on a 12B + long conversation-context
27
+ * prompts). Measured warm long-context brainstorm ≈ 6s on an idle machine, but
28
+ * a cold reload + busy machine blew the shared 60s cap in real dogfood. The
29
+ * fast-fail 60s default stays for CLASSIFY (≤256 tokens, turn-blocking); an
30
+ * explicit higher CODEVIBE_LOCAL_MODEL_TIMEOUT_MS still wins over this floor.
31
+ */
32
+ export declare const ADVISORY_TIMEOUT_FLOOR_MS = 180000;
33
+ /**
34
+ * Advisory requests use the LARGER of the configured timeout and the advisory
35
+ * floor, still clamped to the global max — so the env var can raise but never
36
+ * silently shrink an advisory below its floor.
37
+ */
38
+ export declare function advisoryTimeoutMs(configTimeoutMs: number): number;
16
39
  /**
17
40
  * The `/api/pull` STALL window. A real multi-GB model pull runs for many minutes, so the
18
41
  * pull must NOT use the single-shot inference timeout ({@link requestOllamaJson}). Instead we
@@ -60,5 +83,22 @@ export declare class OllamaGemmaPlannerRunner implements LocalGemmaPlannerRunner
60
83
  constructor(config: OllamaRuntimeConfig);
61
84
  classify(promptText: string): Promise<string>;
62
85
  generateAdvisory(promptText: string, options?: LocalGemmaAdvisoryOptions): Promise<string>;
86
+ /**
87
+ * Dogfood #618 — fire-and-forget model pre-warm. Sends a LOAD-ONLY generate
88
+ * (empty prompt: Ollama loads the model into memory and returns immediately,
89
+ * response text is empty by design — so this does NOT go through
90
+ * `requestOllamaGenerate`, which rejects empty responses) with the standard
91
+ * keep_alive. NEVER throws: resolves `true` when the model is resident,
92
+ * `false` on any error — pre-warm failure must not affect shell startup.
93
+ */
94
+ warm(): Promise<boolean>;
95
+ /**
96
+ * #618 Stage-2 (agy MEDIUM) — release the model on shell exit. Without this,
97
+ * quitting the shell leaves the 12B (7.4GB) resident for up to the full
98
+ * keep_alive window, starving other host work. `keep_alive: 0` unloads
99
+ * immediately; the next shell start's pre-warm covers the reload cost.
100
+ * Fire-and-forget shape like warm(): unref'd, short cap, never throws.
101
+ */
102
+ unload(): Promise<boolean>;
63
103
  probe(): Promise<PlannerProbeResult>;
64
104
  }
@@ -2,6 +2,7 @@ import { Logger } from '../logger';
2
2
  import { AppSyncClient } from '../appsync';
3
3
  import { CapabilityRegistry } from '../adapter/capabilities';
4
4
  export type DetectableAgent = 'CLAUDE' | 'GEMINI' | 'CODEX' | 'ANTIGRAVITY';
5
+ declare function launcherCompatiblePath(env: NodeJS.ProcessEnv, commonPaths?: string[]): string;
5
6
  /**
6
7
  * Returns the subset of agents present on PATH. Uses `command -v`
7
8
  * (POSIX-standard) rather than `which` for portability across macOS
@@ -12,10 +13,15 @@ export type DetectableAgent = 'CLAUDE' | 'GEMINI' | 'CODEX' | 'ANTIGRAVITY';
12
13
  * installed agents CAN change between plugin launches (user installs
13
14
  * a new agent) and the caller decides how often to re-probe.
14
15
  */
15
- export declare function detectInstalledAgents(): DetectableAgent[];
16
+ export declare function detectInstalledAgents(env?: NodeJS.ProcessEnv): DetectableAgent[];
17
+ declare function isAgentInstalled(agent: DetectableAgent, env: NodeJS.ProcessEnv, commonPaths?: string[]): boolean;
18
+ export declare const __testing: {
19
+ isAgentInstalled: typeof isAgentInstalled;
20
+ launcherCompatiblePath: typeof launcherCompatiblePath;
21
+ };
16
22
  /**
17
23
  * Detect-and-push convenience for plugin daemon startup. All three
18
- * plugins (Claude, Gemini, Codex) call this once at start(). Runs
24
+ * plugins (Claude, Codex, Antigravity) call this once at start(). Runs
19
25
  * the local PATH probe, then pushes the set to the backend via
20
26
  * updateAvailableAgents. Idempotent — the backend dedupes and stores.
21
27
  * Non-fatal on the network failure path (caller should `.catch()`
@@ -25,7 +31,7 @@ export declare function detectInstalledAgents(): DetectableAgent[];
25
31
  * CP-1.f LOCK RP-3 — `replace` semantics. `User.availableAgents` is a
26
32
  * cross-device UNION by default (`replace=false`), which never removes a
27
33
  * stale agent (a `GEMINI` from a prior device/install would linger and
28
- * get composed into the reviewer panel → `spawn gemini ENOENT`). The
34
+ * get composed into the reviewer panel → unsupported agent spawn). The
29
35
  * orchestration shell passes `replace=true` so the stored set is EXACTLY
30
36
  * the current orchestration host's installed agents, AND — also per
31
37
  * RP-3 — always writes even on zero detection (no skip-on-empty) so a
@@ -41,30 +47,4 @@ export declare function detectInstalledAgents(): DetectableAgent[];
41
47
  * Default false (1.x companion union path).
42
48
  */
43
49
  export declare function pushDetectedAgents(client: AppSyncClient, log: Pick<Logger, 'info' | 'warn'>, capabilityRegistry?: CapabilityRegistry, detectFn?: () => DetectableAgent[], replace?: boolean): Promise<void>;
44
- /**
45
- * Quorum 2.0 (2f.0.a.6) per-session orchestration CLI override applier.
46
- * All three plugin wrappers (`codevibe-claude`, `codevibe-gemini`,
47
- * `codevibe-codex`) export `CODEVIBE_ORCHESTRATION_OVERRIDE=true|false`
48
- * to the tmux env when the user passes `--orchestration` /
49
- * `--no-orchestration`. The daemon inherits this via the hook env
50
- * chain and calls THIS function after every session-creation site
51
- * to pin the per-session decision — wins outright over the server's
52
- * User.orchestrationEnabledDefault auto-populate.
53
- *
54
- * Called from each plugin's daemon at every session-creation call
55
- * site. Claude has one (handleSessionStart covers new + /resume
56
- * because Claude Code fires SessionStart on /resume). Gemini has
57
- * two (handleSessionStart + switchToResumedSession — /resume doesn't
58
- * fire SessionStart in Gemini). Codex has two (createLaunchSession
59
- * + handleSessionStarted — launch session gets replaced by runtime
60
- * session_meta).
61
- *
62
- * Non-fatal on error — a failed override doesn't block session setup;
63
- * the server's auto-populate decision stands and the user can flip
64
- * the session via mobile toggle after the fact.
65
- *
66
- * @param client AppSyncClient authenticated for the session's owner
67
- * @param sessionId Backend session ID (post-resumeOrCreateSession)
68
- * @param log Logger
69
- */
70
- export declare function applyPerSessionOrchestrationOverride(client: AppSyncClient, sessionId: string, log: Pick<Logger, 'info' | 'warn'>): Promise<void>;
50
+ export {};
@@ -1,3 +1,2 @@
1
- export { detectInstalledAgents, pushDetectedAgents, applyPerSessionOrchestrationOverride, type DetectableAgent, } from './detect-agents';
2
- export { runOrchestrationCli } from './orchestration-cli';
1
+ export { detectInstalledAgents, pushDetectedAgents, type DetectableAgent, } from './detect-agents';
3
2
  export { V1_ORCHESTRATION_PROMPT_KIND, V1_ORCHESTRATION_OPTIONS, mapOptionNumberToUserDecisionKind, mapOptionToUserDecisionKind, type V1OrchestrationOption, type V1UserDecisionKind, } from './v1-options';