@quantiya/codevibe-core 2.0.1 → 2.0.3

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 (284) hide show
  1. package/dist/__tests__/prompt-parser.test.d.ts +1 -0
  2. package/dist/adapter/registry.d.ts +69 -2
  3. package/dist/appsync/__tests__/appsync-client-event-source-filter.test.d.ts +1 -0
  4. package/dist/appsync/__tests__/appsync-client-task-group.test.d.ts +1 -0
  5. package/dist/appsync/__tests__/cleanup-subscription.test.d.ts +1 -0
  6. package/dist/appsync/__tests__/coerce-awsjson-and-review-summary.test.d.ts +1 -0
  7. package/dist/appsync/__tests__/cp1f-quorum-sdk.test.d.ts +1 -0
  8. package/dist/appsync/__tests__/event-throttle.test.d.ts +1 -0
  9. package/dist/appsync/appsync-client.d.ts +621 -10
  10. package/dist/appsync/event-throttle.d.ts +28 -0
  11. package/dist/appsync/index.d.ts +3 -0
  12. package/dist/appsync/queries.d.ts +19 -0
  13. package/dist/audit-keys/index.d.ts +32 -0
  14. package/dist/auth/auth-service.d.ts +32 -2
  15. package/dist/auth/auth-telemetry.d.ts +19 -1
  16. package/dist/auth/index.d.ts +1 -0
  17. package/dist/companion-mode/__tests__/detect-parallel.test.d.ts +1 -0
  18. package/dist/companion-mode/index.d.ts +4 -3
  19. package/dist/companion-mode/persist-preference.d.ts +1 -1
  20. package/dist/config/config.d.ts +8 -1
  21. package/dist/continuation/__tests__/dirty-state-collector.test.d.ts +1 -0
  22. package/dist/continuation/__tests__/integration.test.d.ts +1 -0
  23. package/dist/continuation/__tests__/packet-reader.test.d.ts +1 -0
  24. package/dist/continuation/__tests__/packet-writer.test.d.ts +1 -0
  25. package/dist/continuation/__tests__/parity.test.d.ts +1 -0
  26. package/dist/continuation/__tests__/status-cli.test.d.ts +1 -0
  27. package/dist/continuation/dirty-state-collector.d.ts +46 -0
  28. package/dist/continuation/index.d.ts +8 -0
  29. package/dist/continuation/packet-reader.d.ts +33 -0
  30. package/dist/continuation/packet-writer.d.ts +86 -0
  31. package/dist/continuation/types.d.ts +239 -0
  32. package/dist/credential-broker/__tests__/broker.test.d.ts +1 -0
  33. package/dist/credential-broker/__tests__/canonical.test.d.ts +1 -0
  34. package/dist/credential-broker/__tests__/scrubber.test.d.ts +1 -0
  35. package/dist/credential-broker/__tests__/upstream-client.test.d.ts +1 -0
  36. package/dist/credential-broker/__tests__/vendor-key-store.test.d.ts +1 -0
  37. package/dist/credential-broker/audit-sink.d.ts +69 -0
  38. package/dist/credential-broker/broker-config.d.ts +39 -0
  39. package/dist/credential-broker/broker-token.d.ts +123 -0
  40. package/dist/credential-broker/broker.d.ts +165 -0
  41. package/dist/credential-broker/canonical.d.ts +119 -0
  42. package/dist/credential-broker/index.d.ts +15 -0
  43. package/dist/credential-broker/scrubber.d.ts +45 -0
  44. package/dist/credential-broker/types.d.ts +141 -0
  45. package/dist/credential-broker/upstream-client.d.ts +20 -0
  46. package/dist/credential-broker/vendor-key-store.d.ts +54 -0
  47. package/dist/index.d.ts +6 -1
  48. package/dist/index.js +427 -124
  49. package/dist/keychain/__tests__/keychain-backend.test.d.ts +1 -0
  50. package/dist/keychain/keychain-backend.d.ts +82 -0
  51. package/dist/local-executor/__tests__/agentic-disposable-repo.test.d.ts +1 -0
  52. package/dist/local-executor/__tests__/agentic-resolve.test.d.ts +1 -0
  53. package/dist/local-executor/__tests__/agentic-resolver-flag.test.d.ts +1 -0
  54. package/dist/local-executor/__tests__/class-a-sign.test.d.ts +1 -0
  55. package/dist/local-executor/__tests__/class1-reconcilers.test.d.ts +1 -0
  56. package/dist/local-executor/__tests__/class2-resolver.test.d.ts +1 -0
  57. package/dist/local-executor/__tests__/confined-model-caller.test.d.ts +1 -0
  58. package/dist/local-executor/__tests__/conflict-classifier.test.d.ts +1 -0
  59. package/dist/local-executor/__tests__/conflict-resolution-durable-store.test.d.ts +1 -0
  60. package/dist/local-executor/__tests__/conflict-resolution-store.test.d.ts +1 -0
  61. package/dist/local-executor/__tests__/cp1f-quorum-consumer.test.d.ts +1 -0
  62. package/dist/local-executor/__tests__/cp7-audit-writer.test.d.ts +1 -0
  63. package/dist/local-executor/__tests__/durable-store.test.d.ts +1 -0
  64. package/dist/local-executor/__tests__/git-lock-retry.test.d.ts +1 -0
  65. package/dist/local-executor/__tests__/implementor-argv.test.d.ts +1 -0
  66. package/dist/local-executor/__tests__/local-executor-teams.test.d.ts +1 -0
  67. package/dist/local-executor/__tests__/merge-conflict-extract.test.d.ts +1 -0
  68. package/dist/local-executor/__tests__/merge-conflict-git.integration.test.d.ts +1 -0
  69. package/dist/local-executor/__tests__/merge-conflict-resolve-agentic.integration.test.d.ts +1 -0
  70. package/dist/local-executor/__tests__/merge-conflict-resolve.integration.test.d.ts +1 -0
  71. package/dist/local-executor/__tests__/merge-journal-store.test.d.ts +1 -0
  72. package/dist/local-executor/__tests__/merge-train-agentic-recovery.integration.test.d.ts +1 -0
  73. package/dist/local-executor/__tests__/merge-train-w3.integration.test.d.ts +1 -0
  74. package/dist/local-executor/__tests__/merge-train-waveb.integration.test.d.ts +1 -0
  75. package/dist/local-executor/__tests__/merge-train.test.d.ts +1 -0
  76. package/dist/local-executor/__tests__/promote-wal-store.test.d.ts +1 -0
  77. package/dist/local-executor/__tests__/revert-reconcile.test.d.ts +1 -0
  78. package/dist/local-executor/__tests__/revert-runner.test.d.ts +1 -0
  79. package/dist/local-executor/__tests__/shared-contract-detector.test.d.ts +1 -0
  80. package/dist/local-executor/__tests__/substrate-engage.test.d.ts +1 -0
  81. package/dist/local-executor/__tests__/team-execution-flag.test.d.ts +1 -0
  82. package/dist/local-executor/__tests__/track-registry.test.d.ts +1 -0
  83. package/dist/local-executor/__tests__/wb2-review-bundle.test.d.ts +1 -0
  84. package/dist/local-executor/__tests__/wb2-substrate-spawn.live.test.d.ts +1 -0
  85. package/dist/local-executor/__tests__/workspace-shadow.test.d.ts +1 -0
  86. package/dist/local-executor/__tests__/worktree-merge.test.d.ts +1 -0
  87. package/dist/local-executor/agentic-disposable-repo.d.ts +52 -0
  88. package/dist/local-executor/agentic-resolve.d.ts +54 -0
  89. package/dist/local-executor/agentic-resolver-flag.d.ts +9 -0
  90. package/dist/local-executor/authority.d.ts +33 -1
  91. package/dist/local-executor/class-a-emit.d.ts +3 -1
  92. package/dist/local-executor/class-a-sign.d.ts +57 -0
  93. package/dist/local-executor/class-b-consumer.d.ts +159 -4
  94. package/dist/local-executor/class-b-verify.d.ts +30 -0
  95. package/dist/local-executor/class1-reconcilers.d.ts +58 -0
  96. package/dist/local-executor/class2-resolver.d.ts +74 -0
  97. package/dist/local-executor/confined-model-caller.d.ts +39 -0
  98. package/dist/local-executor/conflict-classifier.d.ts +21 -0
  99. package/dist/local-executor/conflict-resolution-durable-store.d.ts +61 -0
  100. package/dist/local-executor/conflict-resolution-store.d.ts +210 -0
  101. package/dist/local-executor/conflict-types.d.ts +86 -0
  102. package/dist/local-executor/cp7-audit-writer.d.ts +152 -0
  103. package/dist/local-executor/durable-store.d.ts +334 -0
  104. package/dist/local-executor/git-lock-retry.d.ts +40 -0
  105. package/dist/local-executor/hook-bridge.d.ts +1 -1
  106. package/dist/local-executor/implementor-argv.d.ts +183 -0
  107. package/dist/local-executor/index.d.ts +44 -3
  108. package/dist/local-executor/local-executor-impl.d.ts +645 -4
  109. package/dist/local-executor/merge-conflict-extract.d.ts +34 -0
  110. package/dist/local-executor/merge-conflict-resolve.d.ts +101 -0
  111. package/dist/local-executor/merge-journal-store.d.ts +311 -0
  112. package/dist/local-executor/merge-train.d.ts +713 -0
  113. package/dist/local-executor/promote-wal-store.d.ts +301 -0
  114. package/dist/local-executor/resolution-set-index.d.ts +51 -0
  115. package/dist/local-executor/revert-reconcile.d.ts +89 -0
  116. package/dist/local-executor/revert-runner.d.ts +17 -0
  117. package/dist/local-executor/shared-contract-detector.d.ts +57 -0
  118. package/dist/local-executor/spawn.d.ts +29 -1
  119. package/dist/local-executor/task-group-types.d.ts +346 -0
  120. package/dist/local-executor/team-execution-flag.d.ts +21 -0
  121. package/dist/local-executor/track-registry.d.ts +50 -0
  122. package/dist/local-executor/types.d.ts +238 -4
  123. package/dist/local-executor/wb2-review-bundle.d.ts +59 -0
  124. package/dist/local-executor/workspace-shadow.d.ts +290 -0
  125. package/dist/local-executor/worktree-merge.d.ts +601 -0
  126. package/dist/local-model/__tests__/installer.test.d.ts +1 -0
  127. package/dist/local-model/__tests__/manager.test.d.ts +1 -0
  128. package/dist/local-model/__tests__/ollama.test.d.ts +1 -0
  129. package/dist/local-model/__tests__/runtime.test.d.ts +1 -0
  130. package/dist/local-model/__tests__/state.test.d.ts +1 -0
  131. package/dist/local-model/manager.d.ts +119 -0
  132. package/dist/local-model/ollama.d.ts +27 -0
  133. package/dist/local-model/runtime.d.ts +27 -0
  134. package/dist/local-model/state.d.ts +32 -0
  135. package/dist/orchestration/detect-agents.d.ts +15 -2
  136. package/dist/orchestration/setup-types.d.ts +2 -1
  137. package/dist/orchestration-shell/__tests__/attachments.test.d.ts +1 -0
  138. package/dist/orchestration-shell/__tests__/audit-browser.test.d.ts +1 -0
  139. package/dist/orchestration-shell/__tests__/audited-path-fixes.test.d.ts +1 -0
  140. package/dist/orchestration-shell/__tests__/bracketed-paste.test.d.ts +1 -0
  141. package/dist/orchestration-shell/__tests__/cli-group-halt-wiring.test.d.ts +1 -0
  142. package/dist/orchestration-shell/__tests__/cli-orchestration-session-bootstrap.test.d.ts +1 -0
  143. package/dist/orchestration-shell/__tests__/cli-probe-group-status.test.d.ts +1 -0
  144. package/dist/orchestration-shell/__tests__/cli-quorum-loop-tier.test.d.ts +1 -0
  145. package/dist/orchestration-shell/__tests__/cli-verdict-classifier-wiring.test.d.ts +1 -0
  146. package/dist/orchestration-shell/__tests__/context-store.test.d.ts +1 -0
  147. package/dist/orchestration-shell/__tests__/cp10-585-accept-echo-target.test.d.ts +1 -0
  148. package/dist/orchestration-shell/__tests__/cp10-585-loop.test.d.ts +1 -0
  149. package/dist/orchestration-shell/__tests__/cp10-585-prompts.test.d.ts +1 -0
  150. package/dist/orchestration-shell/__tests__/cp12-w2b-team-loop.test.d.ts +1 -0
  151. package/dist/orchestration-shell/__tests__/cp12-w4-team-recovery.test.d.ts +1 -0
  152. package/dist/orchestration-shell/__tests__/cp1f-quorum-loop.test.d.ts +1 -0
  153. package/dist/orchestration-shell/__tests__/cp606-team-track-user-resolved.test.d.ts +1 -0
  154. package/dist/orchestration-shell/__tests__/cp7-reviewer-substrate.test.d.ts +1 -0
  155. package/dist/orchestration-shell/__tests__/declared-test-runner.test.d.ts +1 -0
  156. package/dist/orchestration-shell/__tests__/familiarize-routing.test.d.ts +1 -0
  157. package/dist/orchestration-shell/__tests__/gate-decision-submit.test.d.ts +1 -0
  158. package/dist/orchestration-shell/__tests__/gate-details-panel.test.d.ts +1 -0
  159. package/dist/orchestration-shell/__tests__/gate-verdict-details-dispatch.test.d.ts +1 -0
  160. package/dist/orchestration-shell/__tests__/group-decision-submit.test.d.ts +1 -0
  161. package/dist/orchestration-shell/__tests__/image-attach-e2e.test.d.ts +1 -0
  162. package/dist/orchestration-shell/__tests__/input-bar-autocomplete.test.d.ts +1 -0
  163. package/dist/orchestration-shell/__tests__/live-region-cap.test.d.ts +1 -0
  164. package/dist/orchestration-shell/__tests__/live-static-order.test.d.ts +1 -0
  165. package/dist/orchestration-shell/__tests__/model-cli.test.d.ts +1 -0
  166. package/dist/orchestration-shell/__tests__/non-gate-prompt-routing.test.d.ts +1 -0
  167. package/dist/orchestration-shell/__tests__/orchestration-app-group-decision-transport.test.d.ts +1 -0
  168. package/dist/orchestration-shell/__tests__/orchestration-app-layout.test.d.ts +1 -0
  169. package/dist/orchestration-shell/__tests__/reissue-team-retained-spec.test.d.ts +1 -0
  170. package/dist/orchestration-shell/__tests__/review-summary-render.test.d.ts +1 -0
  171. package/dist/orchestration-shell/__tests__/reviewer-wizard.test.d.ts +1 -0
  172. package/dist/orchestration-shell/__tests__/reviewers-format.test.d.ts +1 -0
  173. package/dist/orchestration-shell/__tests__/root-discovery.test.d.ts +1 -0
  174. package/dist/orchestration-shell/__tests__/serialize-submissions.test.d.ts +1 -0
  175. package/dist/orchestration-shell/__tests__/slash-suggest.test.d.ts +1 -0
  176. package/dist/orchestration-shell/__tests__/status-format.test.d.ts +1 -0
  177. package/dist/orchestration-shell/__tests__/task-progress.test.d.ts +1 -0
  178. package/dist/orchestration-shell/__tests__/team-decompose-routing.test.d.ts +1 -0
  179. package/dist/orchestration-shell/__tests__/team-decompose-types.test.d.ts +1 -0
  180. package/dist/orchestration-shell/__tests__/team-decompose.test.d.ts +1 -0
  181. package/dist/orchestration-shell/__tests__/team-e2e-smoke.test.d.ts +1 -0
  182. package/dist/orchestration-shell/__tests__/tier2-reviewer-selection.test.d.ts +1 -0
  183. package/dist/orchestration-shell/__tests__/web-browsing.test.d.ts +1 -0
  184. package/dist/orchestration-shell/attachments.d.ts +152 -0
  185. package/dist/orchestration-shell/audit-browser.d.ts +115 -0
  186. package/dist/orchestration-shell/audit-runner.d.ts +59 -0
  187. package/dist/orchestration-shell/bracketed-paste.d.ts +26 -0
  188. package/dist/orchestration-shell/cli.d.ts +336 -1
  189. package/dist/orchestration-shell/cli.js +40580 -4692
  190. package/dist/orchestration-shell/components/AuditLogPanel.d.ts +11 -0
  191. package/dist/orchestration-shell/components/ConversationPane.d.ts +7 -1
  192. package/dist/orchestration-shell/components/GateDetailsPanel.d.ts +57 -0
  193. package/dist/orchestration-shell/components/GatePanelEntry.d.ts +9 -0
  194. package/dist/orchestration-shell/components/GatePromptEntry.d.ts +7 -0
  195. package/dist/orchestration-shell/components/InputBar.d.ts +17 -3
  196. package/dist/orchestration-shell/components/LiveProgressLine.d.ts +8 -0
  197. package/dist/orchestration-shell/components/MultiTrackStatusNode.d.ts +8 -0
  198. package/dist/orchestration-shell/components/OrchestrationApp.d.ts +81 -15
  199. package/dist/orchestration-shell/components/ReviewerSetupWizard.d.ts +24 -0
  200. package/dist/orchestration-shell/components/StatusBar.d.ts +15 -2
  201. package/dist/orchestration-shell/context-store.d.ts +389 -0
  202. package/dist/orchestration-shell/declared-test-runner.d.ts +84 -0
  203. package/dist/orchestration-shell/emit-shell-event.d.ts +1 -1
  204. package/dist/orchestration-shell/gate-decision-submit.d.ts +245 -0
  205. package/dist/orchestration-shell/gate-prompts.d.ts +361 -3
  206. package/dist/orchestration-shell/index.d.ts +613 -1
  207. package/dist/orchestration-shell/ink-runtime.d.ts +21 -1
  208. package/dist/orchestration-shell/live-region-cap.d.ts +70 -0
  209. package/dist/orchestration-shell/live-static-order.d.ts +22 -0
  210. package/dist/orchestration-shell/non-tty-fallback.d.ts +21 -0
  211. package/dist/orchestration-shell/quorum-loop.d.ts +1900 -0
  212. package/dist/orchestration-shell/root-discovery.d.ts +25 -0
  213. package/dist/orchestration-shell/route-browse.d.ts +20 -0
  214. package/dist/orchestration-shell/slash-router.d.ts +20 -1
  215. package/dist/orchestration-shell/slash-routes/continuation.d.ts +71 -0
  216. package/dist/orchestration-shell/slash-routes/reviewers.d.ts +41 -0
  217. package/dist/orchestration-shell/slash-suggest.d.ts +29 -0
  218. package/dist/orchestration-shell/status-format.d.ts +59 -0
  219. package/dist/orchestration-shell/task-progress.d.ts +122 -0
  220. package/dist/orchestration-shell/team-decompose.d.ts +196 -0
  221. package/dist/orchestration-shell/types.d.ts +363 -3
  222. package/dist/orchestration-shell/vendor/ink-parse-keypress.d.ts +42 -0
  223. package/dist/orchestration-shell/web/extract.d.ts +11 -0
  224. package/dist/orchestration-shell/web/fetch.d.ts +15 -0
  225. package/dist/orchestration-shell/web/ip.d.ts +26 -0
  226. package/dist/orchestration-shell/web/sanitize.d.ts +14 -0
  227. package/dist/orchestration-shell/web/search.d.ts +16 -0
  228. package/dist/planner/__tests__/local-gemma.test.d.ts +1 -0
  229. package/dist/planner/index.d.ts +2 -0
  230. package/dist/planner/local-advisory.d.ts +84 -0
  231. package/dist/planner/local-gemma.d.ts +23 -0
  232. package/dist/planner/types.d.ts +16 -6
  233. package/dist/reviewer/__tests__/antigravity-provider.test.d.ts +1 -0
  234. package/dist/reviewer/__tests__/claude-provider-json.test.d.ts +1 -0
  235. package/dist/reviewer/__tests__/cp7-reviewer-sandbox.test.d.ts +1 -0
  236. package/dist/reviewer/__tests__/output-parser-classifier-helpers.test.d.ts +1 -0
  237. package/dist/reviewer/__tests__/verdict-classifier.test.d.ts +1 -0
  238. package/dist/reviewer/index.d.ts +2 -0
  239. package/dist/reviewer/output-parser.d.ts +48 -12
  240. package/dist/reviewer/provider.d.ts +107 -3
  241. package/dist/reviewer/providers/__tests__/failure-classifier.test.d.ts +1 -0
  242. package/dist/reviewer/providers/antigravity.d.ts +49 -0
  243. package/dist/reviewer/providers/claude.d.ts +19 -4
  244. package/dist/reviewer/providers/codex.d.ts +47 -5
  245. package/dist/reviewer/providers/failure-classifier.d.ts +26 -0
  246. package/dist/reviewer/providers/gemini.d.ts +5 -4
  247. package/dist/reviewer/registry.d.ts +5 -5
  248. package/dist/reviewer/subprocess.d.ts +37 -0
  249. package/dist/reviewer/token-usage.d.ts +32 -0
  250. package/dist/reviewer/types.d.ts +5 -5
  251. package/dist/reviewer/verdict-classifier.d.ts +62 -0
  252. package/dist/session/__tests__/prepare-event-timestamp.test.d.ts +1 -0
  253. package/dist/session/index.d.ts +1 -0
  254. package/dist/session/prepare-event-timestamp.d.ts +30 -0
  255. package/dist/substrate/__tests__/docker.test.d.ts +1 -0
  256. package/dist/substrate/__tests__/forwarder.test.d.ts +1 -0
  257. package/dist/substrate/__tests__/git-proxy.test.d.ts +1 -0
  258. package/dist/substrate/__tests__/sandbox-exec.test.d.ts +1 -0
  259. package/dist/substrate/__tests__/substrate-e2e.integration.test.d.ts +1 -0
  260. package/dist/substrate/command-runner.d.ts +19 -0
  261. package/dist/substrate/docker.d.ts +134 -0
  262. package/dist/substrate/errors.d.ts +33 -0
  263. package/dist/substrate/forwarder.d.ts +67 -0
  264. package/dist/substrate/git-proxy.d.ts +35 -0
  265. package/dist/substrate/index.d.ts +12 -0
  266. package/dist/substrate/relay-script.d.ts +27 -0
  267. package/dist/substrate/sandbox-exec.d.ts +116 -0
  268. package/dist/substrate/types.d.ts +218 -0
  269. package/dist/substrate-launch/__tests__/apikey-bootstrap.test.d.ts +1 -0
  270. package/dist/substrate-launch/__tests__/creditless-loop.integration.test.d.ts +1 -0
  271. package/dist/substrate-launch/__tests__/engage-substrate.test.d.ts +1 -0
  272. package/dist/substrate-launch/__tests__/fallback-ladder.test.d.ts +1 -0
  273. package/dist/substrate-launch/__tests__/le-env-scrub.test.d.ts +1 -0
  274. package/dist/substrate-launch/__tests__/sanitized-env.test.d.ts +1 -0
  275. package/dist/substrate-launch/apikey-bootstrap.d.ts +84 -0
  276. package/dist/substrate-launch/engage-substrate.d.ts +102 -0
  277. package/dist/substrate-launch/fallback-ladder.d.ts +49 -0
  278. package/dist/substrate-launch/index.d.ts +12 -0
  279. package/dist/substrate-launch/le-env-scrub.d.ts +77 -0
  280. package/dist/substrate-launch/sanitized-env.d.ts +73 -0
  281. package/dist/types/auth.d.ts +6 -1
  282. package/dist/types/events.d.ts +3 -1
  283. package/dist/types/reviewer.d.ts +6 -6
  284. package/package.json +7 -3
@@ -0,0 +1,334 @@
1
+ import type { ShadowChangeKind, ShadowDiffFile } from './workspace-shadow';
2
+ import type { ImageAttachment } from '../orchestration-shell/types';
3
+ /** The current manifest schema version (append-only; bump on a breaking shape change). */
4
+ export declare const REVERT_MANIFEST_VERSION: 1;
5
+ /** Marker stored in `preImageRef` for a file that did NOT exist pre-promote (a created file). */
6
+ export declare const ABSENT_PREIMAGE: "ABSENT";
7
+ /** Default TTL for a true-orphan manifest GC fallback (~48h, LOCK #589-I). */
8
+ export declare const ORPHAN_TTL_MS: number;
9
+ /**
10
+ * The lifecycle of a group's revert record — the GC-predicate key (LOCK #589-I).
11
+ * A group is GC-eligible ONLY in a terminal lifecycle (`accepted` /
12
+ * `reject_revert_complete`) OR past the orphan TTL. `in_flight` and
13
+ * `reject_revert_in_progress` ALWAYS survive a restart.
14
+ */
15
+ export type RevertLifecycle = 'in_flight' | 'accepted' | 'reject_revert_in_progress' | 'reject_revert_complete';
16
+ /** One applied-file entry in the durable revert manifest. */
17
+ export interface RevertManifestEntry {
18
+ /** The track that applied this path. */
19
+ trackIndex: number;
20
+ /** Monotonic apply order ACROSS the whole group (reverse order drives reverse-apply). */
21
+ promoteOrder: number;
22
+ /** Path RELATIVE to the workspace root. */
23
+ path: string;
24
+ /** How the promote changed the file. */
25
+ changeKind: ShadowChangeKind;
26
+ /**
27
+ * Where the pre-image CONTENT lives — a `preimages/<sha>.blob` relative ref, OR
28
+ * the {@link ABSENT_PREIMAGE} marker for a `created` file (nothing to restore).
29
+ */
30
+ preImageRef: string;
31
+ /** SHA-256 of the pre-image content; `null` for an absent (created) file. */
32
+ preImageHash: string | null;
33
+ /** SHA-256 of the applied content; `null` for a `deleted` file. */
34
+ postPromoteHash: string | null;
35
+ }
36
+ /** The revert-manifest record-type-1 slot. */
37
+ export interface RevertManifestSlot {
38
+ promotes: RevertManifestEntry[];
39
+ }
40
+ /**
41
+ * Record-type-4 slot (PHASE-589/469 W3.2, HIGH-1 / LOCK #589-J) — the durable
42
+ * "a group decision was CLAIMED but not yet COMMITted" marker. Persisted at CLAIM
43
+ * time (in `submitGroupDecision`, right after the CLAIM phase mints `claimToken`)
44
+ * so a desktop crash BETWEEN the CLAIM and the COMMIT can resume the side-effect
45
+ * AND drive the COMMIT on the next startup reconcile. Cleared after the terminal
46
+ * COMMIT lands (so it is never re-driven). Content-bounded:
47
+ * - `decision` — the closed 5-option label (e.g. `REJECT_WITH_NOTES`);
48
+ * - `claimToken` — the opaque race-arbiter token the COMMIT must echo (NOT a
49
+ * secret — a discriminator, not an auth credential);
50
+ * - `notes` — the user's OWN `*_WITH_NOTES` plaintext, re-sent E2E-encrypted by
51
+ * the resumed COMMIT. It is at-rest under the SAME `0600`/atomic/no-symlink
52
+ * guards as every other slot (LOCK #589-G), and NEVER logged (#589-G "no file
53
+ * content in any log" — `notes` is the user's text).
54
+ */
55
+ export interface PendingGroupDecision {
56
+ decision: string;
57
+ claimToken: string;
58
+ notes?: string;
59
+ }
60
+ /**
61
+ * Record-type-3 slot (PHASE-589/469 W3.2 RESIDUAL 1) — the retained `/team`
62
+ * launch input a `REJECT_RESTART` re-dispatches from. `workItems` is the wire
63
+ * `WorkItemInput[]` (ownership scopes / agents / isSharedTestOwner — NO brief on
64
+ * the wire); `briefs` is the per-track plaintext brief as `[trackIndex, brief]`
65
+ * pairs (the durable round-trip of the in-memory `Map<number,string>`). Typed
66
+ * `unknown[]` here so the store stays decoupled from the team wire types (it only
67
+ * JSON-round-trips the spec); `launchTeamFromWorkItems` casts back at reissue.
68
+ */
69
+ export interface RetainedTeamLaunchSpec {
70
+ workItems: unknown[];
71
+ briefs: [number, string][];
72
+ /**
73
+ * IMAGE-ATTACHMENT-DESIGN.md §5 — retained image-attachment refs (paths +
74
+ * metadata, NEVER bytes) so a `REJECT_RESTART` reissue re-copies from
75
+ * `sourcePath` (fail-soft if a source moved). Append-only field — a pre-image
76
+ * record without it decodes via the `?? undefined` read.
77
+ */
78
+ attachments?: ImageAttachment[];
79
+ /**
80
+ * §13 Option-2 — the ordered-with-DUPLICATES resolved carried-path list aligned with
81
+ * the `[Image #N]` chip numbers in `briefs`, so a `REJECT_RESTART` reissue re-runs the
82
+ * same number-based chip rewrite. Append-only; a pre-image record decodes as undefined.
83
+ */
84
+ attachmentPaths?: string[];
85
+ }
86
+ /** The unified durable record under `<taskGroupId>/manifest.json` (#589-G). */
87
+ export interface RevertRecordV1 {
88
+ version: typeof REVERT_MANIFEST_VERSION;
89
+ taskGroupId: string;
90
+ /** The GC-predicate key (LOCK #589-I). */
91
+ lifecycle: RevertLifecycle;
92
+ createdAtMs: number;
93
+ updatedAtMs: number;
94
+ /** Record type 1 — the revert manifest (outlives apply until group terminal). */
95
+ revertManifest: RevertManifestSlot;
96
+ /** Record type 2 — the optional #598 reviewed snapshot (cleared at promote). */
97
+ reviewedSnapshot: ShadowDiffFile[] | null;
98
+ /**
99
+ * Record type 3 — the optional retained `/team` launch spec (RESIDUAL 1). `null`
100
+ * until a team launch persists it; read by `REJECT_RESTART` reissue. Append-only
101
+ * field — a pre-W3.2-RESIDUAL record without it decodes via the `?? null` reads.
102
+ */
103
+ teamLaunchSpec?: RetainedTeamLaunchSpec | null;
104
+ /**
105
+ * Record type 4 — the optional CLAIMED-but-not-COMMITted group decision (HIGH-1
106
+ * / LOCK #589-J). Persisted at CLAIM time, cleared after the terminal COMMIT.
107
+ * A non-null value on startup means a CLAIM-crash → the reconcile resumes the
108
+ * revert (reject family) + drives the COMMIT with the persisted `claimToken`.
109
+ * Append-only field — a pre-HIGH-1 record decodes via the `?? null` reads.
110
+ */
111
+ pendingDecision?: PendingGroupDecision | null;
112
+ }
113
+ /**
114
+ * Stable cursor key for ONE manifest entry (W3-H1). The crash-resume cursor MUST
115
+ * key on the entry IDENTITY `(promoteOrder, path)`, NOT the path alone: a single
116
+ * path promoted MORE THAN ONCE (track/round promoted `shared.ts` C→B, then B→A)
117
+ * has TWO manifest entries with the SAME path but different `promoteOrder`. A
118
+ * path-only cursor records `shared.ts` after the newest step, so a crash before
119
+ * the older step makes resume SKIP the older entry (same path) → the tree is left
120
+ * dirty (stuck at B instead of the oldest baseline). The separator is a single
121
+ * space; `promoteOrder` is a non-negative integer (no spaces), so the leading
122
+ * maximal digit-run before the first space uniquely decomposes `(promoteOrder,
123
+ * path)` — the key is collision-free. Keys are only string-compared (Set
124
+ * membership), never parsed back. (Exported so the revert-runner reads/writes the
125
+ * SAME key.)
126
+ */
127
+ export declare function revertEntryKey(promoteOrder: number, relPath: string): string;
128
+ /** The write-ahead revert journal — crash-resume cursor (LOCK #589-I). */
129
+ export interface RevertJournalV1 {
130
+ version: 1;
131
+ taskGroupId: string;
132
+ state: 'reverting' | 'complete';
133
+ startedAtMs: number;
134
+ /**
135
+ * Paths already reverted in THIS pass. RETAINED for backward-compat (a pre-W3-H1
136
+ * in-flight journal carries only this) + human-readable diagnostics; the resume
137
+ * cursor is now keyed on {@link revertedEntryKeys}, NOT this path-only list.
138
+ */
139
+ revertedPaths: string[];
140
+ /**
141
+ * W3-H1 — the PER-ENTRY resume cursor: `revertEntryKey(promoteOrder, path)` for
142
+ * each manifest entry reverted in THIS pass. Resume skips by ENTRY identity (not
143
+ * path), so a same-path multi-promote reverts EVERY remaining step in reverse
144
+ * order after a mid-revert crash. Append-only field — a pre-W3-H1 journal decodes
145
+ * via the `?? []` reads (its in-flight steps re-run, which is idempotent: the
146
+ * 3-hash check in revertOne no-ops an already-reverted entry).
147
+ */
148
+ revertedEntryKeys?: string[];
149
+ }
150
+ /** Manifest entries a promote contributes, BEFORE the content is spilled to blobs. */
151
+ export interface PromoteManifestInput {
152
+ trackIndex: number;
153
+ promoteOrder: number;
154
+ path: string;
155
+ changeKind: ShadowChangeKind;
156
+ /** The pre-image content (the file currently on disk); `null` = absent (created). */
157
+ preImageContent: string | null;
158
+ /** SHA-256 of `preImageContent`; `null` when absent. */
159
+ preImageHash: string | null;
160
+ /** SHA-256 of the applied content; `null` for a deleted file. */
161
+ postPromoteHash: string | null;
162
+ }
163
+ /**
164
+ * CP-14 Wave A — one committed track tip (a merge-train input). Written at the
165
+ * per-track `promoteShadowLocked` seam under `team.execution=worktree_merge`;
166
+ * read by the merge gate to build the `MergeTrainTrack[]`. Durable so a desktop
167
+ * crash between a track commit and the merge gate doesn't lose the tip (a lost
168
+ * tip = a dropped track = data loss → the gate FAILS CLOSED on any absent tip).
169
+ */
170
+ export interface TrackTipRecord {
171
+ trackIndex: number;
172
+ /** The persistent track branch, `codevibe/track/<group>/<idx>`. */
173
+ trackBranch: string;
174
+ /** The committed tip SHA the merge-train merges. */
175
+ trackTip: string;
176
+ }
177
+ /** The durable track-tip record the merge gate reads to build its merge-train. */
178
+ export interface TrackTipsView {
179
+ /** The pinned group base, or null if no tips were ever recorded. */
180
+ baseSha: string | null;
181
+ tips: TrackTipRecord[];
182
+ }
183
+ /**
184
+ * The pure durable-store. ONE instance per desktop; all paths derive from
185
+ * {@link rootDir} (overridable for deterministic tests).
186
+ */
187
+ export declare class RevertManifestStore {
188
+ private readonly rootDir;
189
+ /**
190
+ * CP-14 Wave A (Codex r2 MED) — per-group serialization for the track-tips
191
+ * read-modify-write. Two tracks of the SAME group authorize concurrently (the
192
+ * shadow mutex is per-TASK, not per-group), so two `appendTrackTip` calls could
193
+ * both read the old record and the later writer would clobber the earlier tip
194
+ * (a lost durable tip = an approved track's work vanishes from the merge gate's
195
+ * only source of truth). A per-group promise chain serializes the RMW.
196
+ */
197
+ private readonly trackTipChains;
198
+ constructor(opts?: {
199
+ rootDir?: string;
200
+ });
201
+ /** Serialize `fn` against other track-tip RMW for the same group (Codex r2 MED). */
202
+ private withTrackTipLock;
203
+ /** The per-group directory `<root>/<taskGroupId>/`. */
204
+ private groupDir;
205
+ /**
206
+ * Validate `taskGroupId` is a safe SINGLE path segment so a malicious id can't
207
+ * escape `<root>/` (defense-in-depth; ids are ULIDs server-side, but never
208
+ * trust a field as a path segment, #589-G).
209
+ */
210
+ private safeSegment;
211
+ /**
212
+ * Make a directory tree with `0700` on every created component.
213
+ * `recursive: true` honors `mode` for the components it creates.
214
+ */
215
+ private mkdirSecure;
216
+ /**
217
+ * Refuse to operate under a path whose any in-`rootDir` component is a symlink
218
+ * (LOCK #589-G "no symlink following"). lstat each component from `rootDir`
219
+ * down; a symlinked component throws. Missing components are fine (not yet
220
+ * created). The `rootDir` itself is lstat-checked too.
221
+ */
222
+ private assertNoSymlinkComponents;
223
+ /**
224
+ * Atomic write: write `<final>.tmp.<pid>.<rand>` (`0600`) → fsync → rename →
225
+ * fsync(dir). Refuses symlinked components first. NEVER logs CONTENT.
226
+ */
227
+ private atomicWrite;
228
+ private readJson;
229
+ /**
230
+ * Append a track's promote entries to the group manifest, BEFORE the tree
231
+ * mutates (LOCK #589-I). Spills pre-image content to `preimages/<sha>.blob`.
232
+ * Creates the record (`in_flight`) on first call. Idempotent on
233
+ * `(promoteOrder, path)` — a re-promote of the SAME entry overwrites it (a
234
+ * crash-redelivered promote does not double-append).
235
+ *
236
+ * NEVER logs file content.
237
+ */
238
+ appendPromote(taskGroupId: string, _trackIndex: number, entries: PromoteManifestInput[]): Promise<void>;
239
+ private writeRecord;
240
+ /** Read the full unified record, or `null` if none exists. */
241
+ readRecord(taskGroupId: string): Promise<RevertRecordV1 | null>;
242
+ /** Read just the manifest entries (empty when no record). */
243
+ readManifest(taskGroupId: string): Promise<RevertManifestEntry[]>;
244
+ /**
245
+ * Record a track's committed tip (the merge-train input) at the per-track
246
+ * `promoteShadowLocked` seam, BEFORE the merge gate runs. Idempotent on
247
+ * `trackIndex` — a re-committed track (crash-redelivered TaskAuthorized)
248
+ * overwrites its prior tip rather than duplicating. Atomic + symlink-guarded
249
+ * (same primitive as the revert manifest). NEVER logs content (only SHAs).
250
+ */
251
+ appendTrackTip(taskGroupId: string, baseSha: string, tip: TrackTipRecord): Promise<void>;
252
+ /**
253
+ * Read the pinned group base + all committed track tips (base `null` + empty
254
+ * when none). The merge gate builds its `MergeTrainTrack[]` from this DURABLE
255
+ * copy (the single source of truth) and FAILS CLOSED if an expected member's
256
+ * tip is missing.
257
+ */
258
+ readTrackTips(taskGroupId: string): Promise<TrackTipsView>;
259
+ /** Read a pre-image blob's content by its manifest `preImageRef`. */
260
+ readPreImage(taskGroupId: string, preImageRef: string): Promise<string>;
261
+ private setLifecycle;
262
+ /** Group accepted/kept → terminal lifecycle `accepted` (GC-eligible). */
263
+ markAccepted(taskGroupId: string): Promise<void>;
264
+ /** A reject revert has STARTED → `reject_revert_in_progress` (never GC'd). */
265
+ markRevertInProgress(taskGroupId: string): Promise<void>;
266
+ /** A reject revert COMPLETED → terminal lifecycle `reject_revert_complete` (GC-eligible). */
267
+ markRevertComplete(taskGroupId: string): Promise<void>;
268
+ /** Is this group's LOCAL revert lifecycle terminal (the GC-eligible predicate)? */
269
+ isLifecycleTerminal(lifecycle: RevertLifecycle): boolean;
270
+ /** Store the reviewed snapshot for a track promote (cleared at promote via {@link clearReviewedSnapshot}). */
271
+ setReviewedSnapshot(taskGroupId: string, snapshot: ShadowDiffFile[]): Promise<void>;
272
+ /** Read the reviewed snapshot, or `null`. */
273
+ getReviewedSnapshot(taskGroupId: string): Promise<ShadowDiffFile[] | null>;
274
+ /** Clear the reviewed snapshot at promote (its lifecycle ends here; the manifest survives). */
275
+ clearReviewedSnapshot(taskGroupId: string): Promise<void>;
276
+ /**
277
+ * Persist the ORIGINAL `/team` launch spec for a group (RESIDUAL 1), so a
278
+ * `REJECT_RESTART` can re-dispatch the WHOLE team from it after a restart. Creates
279
+ * the record (`in_flight`) on first call (a team launch persists this BEFORE any
280
+ * promote, so the record may not exist yet). Idempotent overwrite. NEVER logs the
281
+ * brief CONTENT (only counts — #589-G).
282
+ */
283
+ setTeamLaunchSpec(taskGroupId: string, spec: RetainedTeamLaunchSpec): Promise<void>;
284
+ /** Read the retained `/team` launch spec, or `null` (no record / never set). */
285
+ getTeamLaunchSpec(taskGroupId: string): Promise<RetainedTeamLaunchSpec | null>;
286
+ /**
287
+ * Persist the CLAIMED-but-not-COMMITted group decision (HIGH-1 / LOCK #589-J),
288
+ * written at CLAIM time so a crash before COMMIT resumes on the next startup.
289
+ * Creates the record (`in_flight`) on first call (a decision is claimed only on
290
+ * a live in-flight group, so the manifest already exists, but the `?? default`
291
+ * keeps this total). Idempotent overwrite. NEVER logs the `notes` CONTENT — only
292
+ * the closed `decision` label (#589-G).
293
+ */
294
+ setPendingDecision(taskGroupId: string, pending: PendingGroupDecision): Promise<void>;
295
+ /** Read the pending (claimed-not-committed) decision, or `null`. */
296
+ getPendingDecision(taskGroupId: string): Promise<PendingGroupDecision | null>;
297
+ /**
298
+ * Clear the pending decision after the terminal COMMIT lands (so the reconcile
299
+ * never re-drives it). No-op when there is no record / nothing pending.
300
+ */
301
+ clearPendingDecision(taskGroupId: string): Promise<void>;
302
+ /**
303
+ * Begin a revert journal (or read the existing one to RESUME). If a
304
+ * `reverting` journal already exists, return it (the caller resumes,
305
+ * skipping `revertedPaths`); otherwise start a fresh one.
306
+ */
307
+ beginRevert(taskGroupId: string): Promise<RevertJournalV1>;
308
+ /** Read the current journal (or `null`). */
309
+ readJournal(taskGroupId: string): Promise<RevertJournalV1 | null>;
310
+ private writeJournal;
311
+ /**
312
+ * Record ONE reverted manifest ENTRY (append-only resume cursor). W3-H1: the
313
+ * cursor is keyed on the entry IDENTITY `(promoteOrder, path)` — NOT path alone —
314
+ * so a same-path multi-promote records EACH step independently and a crash-resume
315
+ * reverts every remaining step. The path is ALSO appended (legacy/diagnostics
316
+ * compat). Idempotent on the entry key (a redelivered record is a no-op);
317
+ * atomic + append-only per LOCK #589-G.
318
+ */
319
+ recordReverted(taskGroupId: string, relPath: string, promoteOrder: number): Promise<void>;
320
+ /** Mark the journal complete (the revert finished this pass). */
321
+ endRevert(taskGroupId: string): Promise<void>;
322
+ /** List every group id with a durable record under `<root>/`. */
323
+ listManifests(): Promise<string[]>;
324
+ /**
325
+ * GC predicate (LOCK #589-I): delete a group's `<taskGroupId>/` ONLY when its
326
+ * LOCAL lifecycle is terminal (`accepted` / `reject_revert_complete`) OR it is
327
+ * past the orphan TTL. NEVER GC `in_flight` / `reject_revert_in_progress` —
328
+ * "engine terminal alone" is INSUFFICIENT (the caller reconciles BEFORE GC).
329
+ * Returns the ids it removed.
330
+ */
331
+ gc(now?: number, ttlMs?: number): Promise<string[]>;
332
+ }
333
+ /** SHA-256 hex of UTF-8 content (exported for the promote-site manifest capture). */
334
+ export declare function hashManifestContent(content: string): string;
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Is `msg` a TRANSIENT git lock-contention error (retryable), vs a genuine
3
+ * failure? A real `.lock`-file collision ALWAYS carries "unable to create
4
+ * '.../<name>.lock': File exists" (for a loose ref, `index.lock`, or
5
+ * `packed-refs.lock`); we also match the top-level "another git process" hint.
6
+ *
7
+ * DELIBERATELY narrow — it does NOT match the bare "cannot lock ref '<ref>':
8
+ * …" prefix, because git uses that SAME prefix for two NON-transient outcomes:
9
+ * - "cannot lock ref '<ref>': reference already exists" — the create-only
10
+ * (`update-ref <ref> <sha> ''`) refusal, which the caller inspects +
11
+ * handles idempotently. Retrying it would loop forever against a
12
+ * legitimately-existing branch (the bug this narrowing fixes).
13
+ * - "cannot lock ref '<ref>': is at X but expected Y" — a real CAS
14
+ * expected-old mismatch (the ref genuinely moved), which must surface.
15
+ * The transient variant ("cannot lock ref …: Unable to create '….lock': File
16
+ * exists") is still caught via the "unable to create" clause.
17
+ */
18
+ export declare function isGitLockContention(msg: string): boolean;
19
+ export interface GitLockRetryOpts {
20
+ /** Injected for tests (zero wall-clock). Defaults to a real setTimeout. */
21
+ sleep?: (ms: number) => Promise<void>;
22
+ /** Override the attempt cap (default 5). */
23
+ maxAttempts?: number;
24
+ /** Override the exponential base delay (default 100ms). */
25
+ baseDelayMs?: number;
26
+ }
27
+ /**
28
+ * Run a single git op with (a) serialization onto the shared process-global
29
+ * chain and (b) retry-with-exponential-backoff on transient lock contention.
30
+ *
31
+ * `op` MUST be a single leaf git invocation (one `execFile`/`git()` call), NEVER
32
+ * a compound helper that awaits ANOTHER `withGitLockRetry` op inside it — a
33
+ * nested chained op would deadlock (the inner await can never acquire the chain
34
+ * the outer op holds). Sequential chained ops are fine (that is the point).
35
+ *
36
+ * A non-lock error (or the final attempt) propagates unchanged, so a caller's
37
+ * typed errors (e.g. a real CAS mismatch) surface intact — only lock
38
+ * contention is absorbed.
39
+ */
40
+ export declare function withGitLockRetry<T>(op: () => Promise<T>, opts?: GitLockRetryOpts): Promise<T>;
@@ -3,7 +3,7 @@ import { ClassAEmitter, ClassAEmitterContext } from './class-a-emit';
3
3
  import { AgentKind, HookEvent } from './types';
4
4
  export type EmitShellEventFn = (args: {
5
5
  sessionId: string;
6
- type: 'USER_PROMPT' | 'ASSISTANT_RESPONSE' | 'INTERACTIVE_PROMPT' | 'LOCAL_AUTHORITY_REFUSAL' | 'NOTIFICATION';
6
+ type: 'USER_PROMPT' | 'ASSISTANT_RESPONSE' | 'INTERACTIVE_PROMPT' | 'LOCAL_AUTHORITY_REFUSAL' | 'NOTIFICATION' | 'CONTINUATION_PACKET_FAILED';
7
7
  content?: string;
8
8
  metadata?: Record<string, unknown>;
9
9
  timestamp?: string;
@@ -0,0 +1,183 @@
1
+ import type { AuthorityScope } from './authority';
2
+ import type { AgentKind } from './types';
3
+ /** Read-only "plan" vs write "execute" authority for the implementor. */
4
+ export type ImplementorMode = 'plan' | 'execute';
5
+ /** Where to read the implementor's final proposal text from after exit. */
6
+ export type ImplementorCaptureSurface = {
7
+ kind: 'stdout';
8
+ } | {
9
+ kind: 'file';
10
+ path: string;
11
+ };
12
+ export interface ImplementorArgvPlan {
13
+ /** Argv WITHOUT the leading executable (the LE/spawn supplies the binary). */
14
+ argv: string[];
15
+ /** Where the final proposal text is captured from after `await handle.done`. */
16
+ capture: ImplementorCaptureSurface;
17
+ }
18
+ /**
19
+ * D9 — the ONE shared `CODEVIBE_AGY_MODEL` resolver used by BOTH
20
+ * `buildImplementorArgv` (the spawned argv) and `agyImplementorAllowlistEntries`
21
+ * (the authority templates) so the two can never drift. Absent/empty → `null`
22
+ * (omit `--model`, agy default). Invalid → THROW fail-closed with a clear
23
+ * operator error (surfaces at scope construction / spawn, never a silent
24
+ * mangled spawn).
25
+ *
26
+ * LIFETIME: the env is resolved ONCE into the authority scope at
27
+ * `LocalExecutor` construction (`makeImplementorCommandScope`) — mutating
28
+ * `CODEVIBE_AGY_MODEL` mid-session drifts the spawn argv from the cached
29
+ * template → a false-positive AuthorityError. Fixed-per-executor-lifecycle;
30
+ * tests that mutate the env MUST rebuild the scope/executor.
31
+ */
32
+ export declare function resolveAgyModel(env?: NodeJS.ProcessEnv): string | null;
33
+ /**
34
+ * agy's INTERNAL print-mode ceiling for implementor runs. Deliberately
35
+ * generous (implementor spawns have no fixed external timeout on the round
36
+ * path) and FIXED — it is part of the pinned allowlist template prefix, so it
37
+ * cannot vary per spawn.
38
+ */
39
+ export declare const AGY_IMPLEMENTOR_PRINT_TIMEOUT = "3600s";
40
+ /**
41
+ * D3 (agy-R2-iter4 MED fix) — the COMPUTED per-mode agy allowlist entries.
42
+ * Kept OUT of the static `IMPLEMENTOR_COMMAND_ALLOWLIST` const because
43
+ * `--model <value>` is resolved from `CODEVIBE_AGY_MODEL` at RUNTIME — a
44
+ * static template can neither pin the value nor omit it when set. Two
45
+ * FULLY-PINNED templates (plan `--sandbox` vs execute
46
+ * `--dangerously-skip-permissions` — the N-3 defense-in-depth split), with
47
+ * `<workdir>` as the SOLE trailing wildcard. Appended by
48
+ * `makeImplementorCommandScope` at scope construction.
49
+ */
50
+ export declare function agyImplementorAllowlistEntries(): string[];
51
+ /**
52
+ * D3 — the abs-path brief preamble for an agy implementor/decomposer/resolver
53
+ * spawn. agy is WORKSPACE-CENTRIC: it ignores the process cwd, so the brief
54
+ * MUST name the working directory by ABSOLUTE path (the cwd-phrased default
55
+ * contract would silently no-op into agy's own scratch dir — the
56
+ * empty-shadow-diff hazard). Prepended to the standard contract by the spawn
57
+ * sites (quorum-loop `composeImplementorStdin`, team decomposer, agentic
58
+ * resolver).
59
+ */
60
+ export declare function agyWorkdirBriefPreamble(workdir: string): string;
61
+ /**
62
+ * 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`).
66
+ *
67
+ * `workdir` (AGY-2.0 D3) is REQUIRED for ANTIGRAVITY (agy is
68
+ * workspace-centric — `--add-dir <workdir>` is its only view of the tree; the
69
+ * agy case throws FAIL-CLOSED without it so a missed call site errors loudly
70
+ * instead of silently no-oping into agy's scratch). The cwd-based agents
71
+ * ignore it.
72
+ */
73
+ export declare function buildImplementorArgv(agent: AgentKind, mode: ImplementorMode, workdir?: string): ImplementorArgvPlan;
74
+ /**
75
+ * Positive runtime evidence that this process is ACTUALLY inside a container —
76
+ * the confinement boundary that `CODEVIBE_TRUSTED_CONTAINER` asserts. Docker
77
+ * drops `/.dockerenv`; Podman drops `/run/.containerenv`; containerd / cri-o /
78
+ * Kubernetes / LXC surface in PID 1's cgroup. Best-effort + FAIL-CLOSED: any fs
79
+ * error, or a non-Linux host with no markers, returns `false`. Bare macOS /
80
+ * Windows desktops (no container) return `false`. Pure read; no side effects.
81
+ */
82
+ export declare function isInsideContainer(): boolean;
83
+ /**
84
+ * `CODEVIBE_TRUSTED_CONTAINER` — a desktop-set signal that the LE is ALREADY
85
+ * running inside a container that confines it (e.g. the dogfood image, or any
86
+ * externally-sandboxed CI runner), even when the CP-7 substrate itself did not
87
+ * engage (no NESTED runtime available). When honored, the implementor's own
88
+ * inner sandbox is redundant AND, for Codex, actively broken (bwrap can't create
89
+ * a namespace in a nested/unprivileged container), so the outer container is
90
+ * treated as the confinement boundary.
91
+ *
92
+ * Stage-2 r1 Codex HIGH — DEFENSE IN DEPTH: an ambient env var ALONE is too weak
93
+ * a boundary signal. A stray `CODEVIBE_TRUSTED_CONTAINER` in a developer's
94
+ * persistent shell, or a misconfigured CI runner, would otherwise run Codex
95
+ * `--sandbox danger-full-access` on a BARE HOST with ambient credentials
96
+ * reachable. So the env flag is honored ONLY when `isInsideContainer()` returns
97
+ * POSITIVE runtime evidence that a confining boundary actually exists: the env
98
+ * says "a boundary confines me", the runtime check PROVES one is present. A bare
99
+ * host with a stray env var → `false` → Codex keeps its own `workspace-write`
100
+ * sandbox. The dogfood image (a real Docker container) passes both. The
101
+ * container check is injectable for tests.
102
+ */
103
+ export declare function isTrustedContainerBoundary(env?: NodeJS.ProcessEnv, inContainer?: () => boolean): boolean;
104
+ /**
105
+ * CP-7 substrate-aware Codex sandbox selection. When an OUTER confinement
106
+ * boundary already isolates the implementor — the CP-7 substrate engaged (Docker
107
+ * `--network none` / sandbox-exec), OR a marked trusted container
108
+ * (`CODEVIBE_TRUSTED_CONTAINER`) — rewrite the Codex EXECUTE argv's
109
+ * `--sandbox workspace-write` → `--sandbox danger-full-access`.
110
+ *
111
+ * Rationale: Codex's `workspace-write` builds its OWN inner sandbox with
112
+ * bubblewrap, which cannot create a user namespace inside a nested/unprivileged
113
+ * container and aborts before any file operation ("bwrap: No permissions to
114
+ * create a new namespace"). When an outer boundary already confines the agent
115
+ * (the CP-7 design intent — the substrate IS the sandbox), Codex's inner sandbox
116
+ * is both redundant and a hard blocker, so we drop it. On a BARE host (no outer
117
+ * boundary), `workspace-write` is KEPT — there bwrap works (Linux user
118
+ * namespaces / macOS Seatbelt) and is the only filesystem confinement.
119
+ *
120
+ * NARROW BY DESIGN:
121
+ * - Only CODEX is affected (Claude/Gemini have no bwrap inner sandbox).
122
+ * - Only `workspace-write` (the EXECUTE variant) is rewritten. `read-only`
123
+ * (PLAN mode) is left untouched — it is a DELIBERATE write restriction, and
124
+ * `danger-full-access` would let a plan-mode agent write, violating the plan
125
+ * contract.
126
+ * - No-op when `outerBoundaryConfines` is false.
127
+ * Pure; returns a NEW array when it rewrites, the same array otherwise.
128
+ */
129
+ export declare function applyOuterBoundarySandbox(argv: readonly string[], agent: AgentKind, outerBoundaryConfines: boolean): string[];
130
+ /**
131
+ * Authority `commandAllowlist` entries covering EVERY (agent, mode) argv
132
+ * `buildImplementorArgv` can produce. The single-impl + team LEs seed this
133
+ * into their authority scope at construction (cli.ts) so `enforceCommand`
134
+ * (authority.ts) permits the implementor spawn.
135
+ *
136
+ * CP-1.f Hybrid authority split (2026-06-05): the DESKTOP is the authority on
137
+ * WHICH agent binaries may run (this fixed allowlist); the engine authorizes
138
+ * per-task PATH scopes (writeScopes/readScopes) via the TaskAuthorized Class-B
139
+ * packet. Seeding commands desktop-side is the smaller, safer attack surface —
140
+ * an engine-supplied command allowlist would let a compromised backend
141
+ * authorize arbitrary command strings.
142
+ *
143
+ * Matching (authority.ts `enforceCommand`): an entry is a LITERAL full
144
+ * `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.)
147
+ * - Codex carries a per-spawn temp path in `--output-last-message <tmp>` →
148
+ * a ` *` template: the literal prefix up to `--output-last-message`, then
149
+ * the wildcard absorbs the varying path + trailing `-`.
150
+ *
151
+ * DRIFT GUARD: `__tests__/implementor-argv.test.ts` asserts every
152
+ * `buildImplementorArgv(agent, mode)` output passes `enforceCommand` against
153
+ * this list — an argv-builder change not mirrored here fails the test.
154
+ */
155
+ export declare const IMPLEMENTOR_COMMAND_ALLOWLIST: readonly string[];
156
+ /**
157
+ * Build the LE authority scope seeding ONLY the implementor command allowlist —
158
+ * no write/read/network grants. `writeScopes`/`readScopes` stay empty (the
159
+ * engine authorizes paths via TaskAuthorized; the CP-7 substrate, not this
160
+ * scope, confines filesystem writes). `implementor` is NOT a network-gated
161
+ * spawn role (`ROLES_REQUIRING_NETWORK` in spawn.ts excludes it), so
162
+ * `networkAllowed: false` does not block the implementor spawn.
163
+ */
164
+ export declare function makeImplementorCommandScope(): AuthorityScope;
165
+ /**
166
+ * The Codex EXECUTE-under-confinement command (`danger-full-access`) authority
167
+ * entry — kept OUT of the ambient `IMPLEMENTOR_COMMAND_ALLOWLIST` and granted
168
+ * ONLY per-spawn via `withBoundaryConfinedCommandAuthority` (Stage-2 r2 Codex
169
+ * HIGH). Same ` *` template shape as the other Codex entries (the per-spawn temp
170
+ * path after `--output-last-message` is absorbed by the wildcard).
171
+ */
172
+ export declare const CODEX_DANGER_FULL_ACCESS_COMMAND = "codex exec --sandbox danger-full-access --skip-git-repo-check --color never --json --ephemeral --output-last-message *";
173
+ /**
174
+ * Return a scope that ADDS the boundary-confined Codex `danger-full-access`
175
+ * command authority (`CODEX_DANGER_FULL_ACCESS_COMMAND`) to `scope`'s
176
+ * `commandAllowlist`. The spawn path calls this ONLY when `outerBoundaryConfines`
177
+ * is proven (CP-7 substrate engaged OR a verified trusted container) — so the
178
+ * dangerous command is authorized for exactly the spawn that an outer boundary
179
+ * isolates, and NEVER ambiently. On an unconfined spawn the base scope (without
180
+ * this entry) makes `enforceCommand` fail-closed on any danger argv. Idempotent;
181
+ * returns `scope` unchanged if already present.
182
+ */
183
+ export declare function withBoundaryConfinedCommandAuthority(scope: AuthorityScope): AuthorityScope;
@@ -1,8 +1,49 @@
1
1
  export { AuthorityError, AuthorityRefusal, AuthorityRefusalCategory, AuthorityScope, FileNotFound, enforceCommand, enforceNetwork, enforceRead, enforceWrite, safeReadFile, safeWriteFile, } from './authority';
2
2
  export { spawnHealthProbe, spawnImplementor, spawnReviewer } from './spawn';
3
- export { AgentKind, AuthorityAction, ClassBInbound, ExecutorError, FailureClass, FileChangeKind, HookEvent, ImplementorHandle, LocalExecutor, ProbeHandle, ProcessExitedInfo, ProcessRole, ProcessSpawnedInfo, ReviewerHandle, SignedEnvelope, SpawnArgs, SpawnArgsInvalid, SpawnHandleBase, } from './types';
3
+ export { AgentKind, AuthorityAction, ClassBInbound, ExecutorError, FailureClass, FileChangeKind, GateDispatchPayload, GateDispatchReviewerSeat, HookEvent, ImplementorHandle, LocalExecutor, MergeGateDispatchPayload, ProbeHandle, ProcessExitedInfo, ProcessRole, ProcessSpawnedInfo, ReviewerHandle, ReviewerDispatchPayload, ReviseFeedbackPayload, ReviseSeatFinding, SignedEnvelope, SpawnArgs, SpawnArgsInvalid, SpawnHandleBase, TaskGroupHaltedPayload, TrackAssignedPayload, TrackConflictContext, } from './types';
4
+ export { agyImplementorAllowlistEntries, agyWorkdirBriefPreamble, AGY_IMPLEMENTOR_PRINT_TIMEOUT, buildImplementorArgv, IMPLEMENTOR_COMMAND_ALLOWLIST, makeImplementorCommandScope, resolveAgyModel, type ImplementorArgvPlan, type ImplementorCaptureSurface, type ImplementorMode, } from './implementor-argv';
5
+ export { verifyClassBEd25519, classBCanonicalForSigning, ed25519PublicKeyFromRaw, type ClassBCryptoVerifyResult, } from './class-b-verify';
6
+ export { TrackRegistry, TrackProcess, trackKey } from './track-registry';
4
7
  export { EmitShellEventFn, HookBridge, HookBridgeDeps, } from './hook-bridge';
5
- export { LocalExecutorImpl, LocalExecutorImplDeps, makeEmptyScope, } from './local-executor-impl';
8
+ export { LocalExecutorImpl, LocalExecutorImplDeps, MergeGateAppSyncClient, MergeGateContentEncryptor, makeEmptyScope, } from './local-executor-impl';
9
+ export type { SubstrateEngager, SubstrateEngageResult, StrictBadgeSink, } from './local-executor-impl';
10
+ export { Cp7AuditWriter, CP7_CANONICAL_FORM_VERSION, GENESIS_PREV_HASH, canonicalJson, canonicalEntryBytes, computeEntryHash, verifyChain, } from './cp7-audit-writer';
11
+ export type { Cp7AuditEntry } from './cp7-audit-writer';
6
12
  export { ClassAEmitter, ClassAEmitterContext, ClassAEnvelope, ClassAMessageType, ClassASink, DEFAULT_DEDUPE_CAP, EmitterLogger, ExecutionEventKind, ExecutorRefusalPayload, FileChangePayload, LocalStubSink, ProcessExitedPayload, ProcessSpawnedPayload, ToolUsePayload, VerificationGateKind, VerificationResultPayload, VerificationRunPayload, isValidUlid, } from './class-a-emit';
7
13
  export { DEFAULT_GATE_TIMEOUT_MS, GateRunResult, SUMMARY_CAP_BYTES, TIMEOUT_EXIT_CODE, VerificationGateRequest, VerificationRunnerDeps, runVerificationGates, truncateUtf8Safe, } from './verification-runner';
8
- export { ClassBConsumer, ClassBConsumerDeps, ClassBConsumerState, ClassBVerificationResult, INBOUND_REPLAY_CAP, INBOUND_REPLAY_TTL_MS, UlidReplayRegistry, verifyClassBSignature, } from './class-b-consumer';
14
+ export { ClassBConsumer, ClassBConsumerDeps, ClassBConsumerState, ClassBVerificationResult, INBOUND_REPLAY_CAP, INBOUND_REPLAY_TTL_MS, UlidReplayRegistry, verifyClassBSignature, normalizeTrackAssignedWire, isValidTrackAssignedPayload, } from './class-b-consumer';
15
+ export { DeviceSigningKey, canonicalJsonForSigning, signClassAEnvelope, signMergeClassification, } from './class-a-sign';
16
+ export { ContractRefInput, CreateTaskGroupInput, CreateTaskGroupResult, DisjointnessRejection, DisjointnessViolation, EncryptedPayloadInput, FailingCondition, MergeClassificationInput, MergeFailureClass, MergeResult, MergeRetryTarget, MergeRetryTargetKind, OwnershipScopeInput, RecommendedOption, SubmitMergeGateVerdictInput, SubmitMergeGateVerdictResult, SubmitTrackVerificationOutcomeInput, SubmitTrackVerificationOutcomeResult, TeamTrackFailureReason, TrackChangedFiles, UserCeilingsInput, WorkItemInput, ClaimGroupDecisionInput, ClaimGroupDecisionResult, GroupDecisionLabel, GroupDecisionPhase, } from './task-group-types';
17
+ export { RevertManifestStore, REVERT_MANIFEST_VERSION, ABSENT_PREIMAGE, ORPHAN_TTL_MS, hashManifestContent, } from './durable-store';
18
+ export type { RevertLifecycle, RevertManifestEntry, RevertManifestSlot, RevertRecordV1, RevertJournalV1, PromoteManifestInput, RetainedTeamLaunchSpec, PendingGroupDecision, TrackTipRecord, TrackTipsView, } from './durable-store';
19
+ export { revertGroup } from './revert-runner';
20
+ export type { RevertResult } from './revert-runner';
21
+ export { reconcileRevertManifestsThenGc } from './revert-reconcile';
22
+ export type { EngineGroupState, ReconcileDeps, ReconcileResult, ReconcileCommitClient, } from './revert-reconcile';
23
+ export { DEFAULT_TEAM_EXECUTION, TEAM_EXECUTION_ENV_VAR, isTeamExecution, resolveTeamExecution, isWorktreeMergeEnabled, } from './team-execution-flag';
24
+ export type { TeamExecution } from './team-execution-flag';
25
+ export { PromoteWalStore, PROMOTE_WAL_VERSION, computePromoteKey, } from './promote-wal-store';
26
+ export type { PromoteMode, PromoteWalRecord, PromoteStartedInput, } from './promote-wal-store';
27
+ export { MERGE_IMPL_ID, resolveMergeImplId, BranchStateMismatchError, trackBranchName, integrationBranchName, stashBranchName, rescueRefName, rescueLiveRefName, promotedTipRefName, createIntegrationBranch, createTrackBranch, promoteIntegration, revertToPrePromote, recoverPromote, recoverAllPromotes, gcDanglingPromptly, cleanupGroupRepo, mergeTreeOffBranch, commitTreeOffBranch, treeOf, pinnedGit, } from './worktree-merge';
28
+ export type { BranchFoundation, PromoteOutcome, RevertToPrePromoteOutcome, PromoteRecoveryOutcome, WorktreeMergeRaceHooks, MergeTreeResult, } from './worktree-merge';
29
+ export { MergeJournalStore, MERGE_JOURNAL_VERSION, computeMergeKey, } from './merge-journal-store';
30
+ export type { MergeJournalRecord, MergeJournalTrack, MergeStepRecord, MergeGroupInput, MergeGroupWriteResult, MergeStepInput, } from './merge-journal-store';
31
+ export { MergeOrderError, RefCasMismatchError, MERGE_KEY_TRAILER, MERGE_COMMIT_DATE, MERGE_COMMIT_IDENTITY, computeMergeOrder, runMergeTrain, deriveMergeGateId, recoverMergeTrain, runTier1OnIntegrationWorktree, runWorktreeMergeGate, } from './merge-train';
32
+ export type { MergeTrainTrack, MergeOrder, MergeTrainOutcome, MergeTrainRecoveryOutcome, MergeTrainRecoveryHooks, Tier1Outcome, Tier1GateConfig, MergeGateResult, WorktreeMergeGateArgs, } from './merge-train';
33
+ export { RESOLUTION_SET_TRAILER, buildMergeCommitMessage } from './merge-train';
34
+ export { detectSharedContract, isHardSharedContract, globToRegExp, pathMatchesGlob, } from './shared-contract-detector';
35
+ export type { SharedContractCategory, SharedContractMatch, SharedContractDetectorOptions, } from './shared-contract-detector';
36
+ export { classifyConflict } from './conflict-classifier';
37
+ export type { ConflictKind, GitObjectType, ConflictSide, ConflictFileMeta, ConflictClass, ConflictClassification, ConflictHunk, } from './conflict-types';
38
+ export { attemptClass1, reconcileLockfile, lockfileCanonicalEntries } from './class1-reconcilers';
39
+ export type { Class1ReconcileResult } from './class1-reconcilers';
40
+ export { computeConflictId, hashResolvedBytes, snapshotSides, verifyResolvedBytes, InMemoryConflictResolutionStore, } from './conflict-resolution-store';
41
+ export type { ConflictIdInput, ConflictSidesSnapshot, ConflictResolutionRecord, ConflictResolutionStore, } from './conflict-resolution-store';
42
+ export { resolveClass2, assembleResolverPrompt, promptByteSize } from './class2-resolver';
43
+ export type { ResolverPrompt, ResolverModelResult, ConflictModelCaller, ResolveClass2Input, ResolveClass2Deps, ResolveClass2Result, } from './class2-resolver';
44
+ export { parseDiff3Conflicts, hunksFromSegments, composeResolvedFile, hasConflictMarkers, } from './merge-conflict-extract';
45
+ export type { ConflictSegment } from './merge-conflict-extract';
46
+ export { resolveSlotConflicts } from './merge-conflict-resolve';
47
+ export type { ConflictResolverContext, HumanGatedConflict, SlotResolveResult, } from './merge-conflict-resolve';
48
+ export { mergeBaseOf, lsTreeEntry, diff3MergeBlobs, extractThreeWayConflict, assembleResolvedTree, } from './worktree-merge';
49
+ export type { TreeEntry } from './worktree-merge';