@quantiya/codevibe-core 2.0.0 → 2.0.2

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 (416) hide show
  1. package/dist/__tests__/cp-5-baseline-invariants.test.d.ts +1 -0
  2. package/dist/__tests__/prompt-parser.test.d.ts +1 -0
  3. package/dist/adapter/__tests__/capabilities.test.d.ts +1 -0
  4. package/dist/adapter/__tests__/contract-conformance.test.d.ts +1 -0
  5. package/dist/adapter/__tests__/packets.test.d.ts +1 -0
  6. package/dist/adapter/__tests__/progress.test.d.ts +1 -0
  7. package/dist/adapter/__tests__/registry.test.d.ts +1 -0
  8. package/dist/adapter/__tests__/smoke/claude.smoke.test.d.ts +1 -0
  9. package/dist/adapter/__tests__/smoke/codex.smoke.test.d.ts +1 -0
  10. package/dist/adapter/__tests__/smoke/gemini.smoke.test.d.ts +1 -0
  11. package/dist/adapter/capabilities.d.ts +68 -0
  12. package/dist/adapter/index.d.ts +7 -0
  13. package/dist/adapter/packets.d.ts +129 -0
  14. package/dist/adapter/progress.d.ts +93 -0
  15. package/dist/adapter/registry.d.ts +91 -0
  16. package/dist/adapter/types.d.ts +22 -0
  17. package/dist/appsync/__tests__/appsync-client-apply-user-decision.test.d.ts +1 -0
  18. package/dist/appsync/__tests__/appsync-client-classb.test.d.ts +1 -0
  19. package/dist/appsync/__tests__/appsync-client-event-source-filter.test.d.ts +1 -0
  20. package/dist/appsync/__tests__/appsync-client-planner.test.d.ts +1 -0
  21. package/dist/appsync/__tests__/appsync-client-task-group.test.d.ts +1 -0
  22. package/dist/appsync/__tests__/appsync-client.test.d.ts +1 -0
  23. package/dist/appsync/__tests__/cleanup-subscription.test.d.ts +1 -0
  24. package/dist/appsync/__tests__/coerce-awsjson-and-review-summary.test.d.ts +1 -0
  25. package/dist/appsync/__tests__/cp1f-quorum-sdk.test.d.ts +1 -0
  26. package/dist/appsync/__tests__/event-throttle.test.d.ts +1 -0
  27. package/dist/appsync/appsync-client.d.ts +1025 -2
  28. package/dist/appsync/event-throttle.d.ts +28 -0
  29. package/dist/appsync/index.d.ts +4 -1
  30. package/dist/appsync/queries.d.ts +34 -0
  31. package/dist/audit-keys/index.d.ts +32 -0
  32. package/dist/auth/__tests__/auth-telemetry.test.d.ts +1 -0
  33. package/dist/auth/auth-service.d.ts +32 -2
  34. package/dist/auth/auth-telemetry.d.ts +117 -6
  35. package/dist/auth/index.d.ts +1 -0
  36. package/dist/companion-mode/__tests__/persist-preference.test.d.ts +1 -0
  37. package/dist/companion-mode/__tests__/resolve-agent.test.d.ts +1 -0
  38. package/dist/companion-mode/agent-picker.d.ts +9 -0
  39. package/dist/companion-mode/index.d.ts +55 -0
  40. package/dist/companion-mode/persist-preference.d.ts +24 -0
  41. package/dist/companion-mode/resolve-agent.d.ts +41 -0
  42. package/dist/config/config.d.ts +8 -1
  43. package/dist/continuation/__tests__/dirty-state-collector.test.d.ts +1 -0
  44. package/dist/continuation/__tests__/integration.test.d.ts +1 -0
  45. package/dist/continuation/__tests__/packet-reader.test.d.ts +1 -0
  46. package/dist/continuation/__tests__/packet-writer.test.d.ts +1 -0
  47. package/dist/continuation/__tests__/parity.test.d.ts +1 -0
  48. package/dist/continuation/__tests__/status-cli.test.d.ts +1 -0
  49. package/dist/continuation/dirty-state-collector.d.ts +46 -0
  50. package/dist/continuation/index.d.ts +8 -0
  51. package/dist/continuation/packet-reader.d.ts +33 -0
  52. package/dist/continuation/packet-writer.d.ts +86 -0
  53. package/dist/continuation/types.d.ts +239 -0
  54. package/dist/credential-broker/__tests__/broker.test.d.ts +1 -0
  55. package/dist/credential-broker/__tests__/canonical.test.d.ts +1 -0
  56. package/dist/credential-broker/__tests__/scrubber.test.d.ts +1 -0
  57. package/dist/credential-broker/__tests__/upstream-client.test.d.ts +1 -0
  58. package/dist/credential-broker/__tests__/vendor-key-store.test.d.ts +1 -0
  59. package/dist/credential-broker/audit-sink.d.ts +69 -0
  60. package/dist/credential-broker/broker-config.d.ts +39 -0
  61. package/dist/credential-broker/broker-token.d.ts +123 -0
  62. package/dist/credential-broker/broker.d.ts +165 -0
  63. package/dist/credential-broker/canonical.d.ts +119 -0
  64. package/dist/credential-broker/index.d.ts +15 -0
  65. package/dist/credential-broker/scrubber.d.ts +45 -0
  66. package/dist/credential-broker/types.d.ts +141 -0
  67. package/dist/credential-broker/upstream-client.d.ts +20 -0
  68. package/dist/credential-broker/vendor-key-store.d.ts +54 -0
  69. package/dist/index.d.ts +17 -4
  70. package/dist/index.js +559 -55
  71. package/dist/keychain/__tests__/keychain-backend.test.d.ts +1 -0
  72. package/dist/keychain/keychain-backend.d.ts +82 -0
  73. package/dist/keychain/keychain-manager.d.ts +16 -2
  74. package/dist/local-executor/__tests__/agentic-disposable-repo.test.d.ts +1 -0
  75. package/dist/local-executor/__tests__/agentic-resolve.test.d.ts +1 -0
  76. package/dist/local-executor/__tests__/agentic-resolver-flag.test.d.ts +1 -0
  77. package/dist/local-executor/__tests__/authority-symlink-fixture.d.ts +15 -0
  78. package/dist/local-executor/__tests__/authority.test.d.ts +1 -0
  79. package/dist/local-executor/__tests__/class-a-emit.test.d.ts +1 -0
  80. package/dist/local-executor/__tests__/class-a-sign.test.d.ts +1 -0
  81. package/dist/local-executor/__tests__/class-b-consumer.integration.test.d.ts +1 -0
  82. package/dist/local-executor/__tests__/class-b-consumer.test.d.ts +1 -0
  83. package/dist/local-executor/__tests__/class1-reconcilers.test.d.ts +1 -0
  84. package/dist/local-executor/__tests__/class2-resolver.test.d.ts +1 -0
  85. package/dist/local-executor/__tests__/confined-model-caller.test.d.ts +1 -0
  86. package/dist/local-executor/__tests__/conflict-classifier.test.d.ts +1 -0
  87. package/dist/local-executor/__tests__/conflict-resolution-durable-store.test.d.ts +1 -0
  88. package/dist/local-executor/__tests__/conflict-resolution-store.test.d.ts +1 -0
  89. package/dist/local-executor/__tests__/cp1f-quorum-consumer.test.d.ts +1 -0
  90. package/dist/local-executor/__tests__/cp7-audit-writer.test.d.ts +1 -0
  91. package/dist/local-executor/__tests__/durable-store.test.d.ts +1 -0
  92. package/dist/local-executor/__tests__/git-lock-retry.test.d.ts +1 -0
  93. package/dist/local-executor/__tests__/hook-bridge.test.d.ts +1 -0
  94. package/dist/local-executor/__tests__/implementor-argv.test.d.ts +1 -0
  95. package/dist/local-executor/__tests__/local-executor-teams.test.d.ts +1 -0
  96. package/dist/local-executor/__tests__/local-executor.integration.test.d.ts +1 -0
  97. package/dist/local-executor/__tests__/merge-conflict-extract.test.d.ts +1 -0
  98. package/dist/local-executor/__tests__/merge-conflict-git.integration.test.d.ts +1 -0
  99. package/dist/local-executor/__tests__/merge-conflict-resolve-agentic.integration.test.d.ts +1 -0
  100. package/dist/local-executor/__tests__/merge-conflict-resolve.integration.test.d.ts +1 -0
  101. package/dist/local-executor/__tests__/merge-journal-store.test.d.ts +1 -0
  102. package/dist/local-executor/__tests__/merge-train-agentic-recovery.integration.test.d.ts +1 -0
  103. package/dist/local-executor/__tests__/merge-train-w3.integration.test.d.ts +1 -0
  104. package/dist/local-executor/__tests__/merge-train-waveb.integration.test.d.ts +1 -0
  105. package/dist/local-executor/__tests__/merge-train.test.d.ts +1 -0
  106. package/dist/local-executor/__tests__/promote-wal-store.test.d.ts +1 -0
  107. package/dist/local-executor/__tests__/revert-reconcile.test.d.ts +1 -0
  108. package/dist/local-executor/__tests__/revert-runner.test.d.ts +1 -0
  109. package/dist/local-executor/__tests__/shared-contract-detector.test.d.ts +1 -0
  110. package/dist/local-executor/__tests__/spawn.test.d.ts +1 -0
  111. package/dist/local-executor/__tests__/substrate-engage.test.d.ts +1 -0
  112. package/dist/local-executor/__tests__/team-execution-flag.test.d.ts +1 -0
  113. package/dist/local-executor/__tests__/track-registry.test.d.ts +1 -0
  114. package/dist/local-executor/__tests__/verification-runner.test.d.ts +1 -0
  115. package/dist/local-executor/__tests__/wb2-review-bundle.test.d.ts +1 -0
  116. package/dist/local-executor/__tests__/wb2-substrate-spawn.live.test.d.ts +1 -0
  117. package/dist/local-executor/__tests__/workspace-shadow.test.d.ts +1 -0
  118. package/dist/local-executor/__tests__/worktree-merge.test.d.ts +1 -0
  119. package/dist/local-executor/agentic-disposable-repo.d.ts +52 -0
  120. package/dist/local-executor/agentic-resolve.d.ts +54 -0
  121. package/dist/local-executor/agentic-resolver-flag.d.ts +9 -0
  122. package/dist/local-executor/authority.d.ts +61 -0
  123. package/dist/local-executor/class-a-emit.d.ts +140 -0
  124. package/dist/local-executor/class-a-sign.d.ts +57 -0
  125. package/dist/local-executor/class-b-consumer.d.ts +276 -0
  126. package/dist/local-executor/class-b-verify.d.ts +30 -0
  127. package/dist/local-executor/class1-reconcilers.d.ts +58 -0
  128. package/dist/local-executor/class2-resolver.d.ts +74 -0
  129. package/dist/local-executor/confined-model-caller.d.ts +39 -0
  130. package/dist/local-executor/conflict-classifier.d.ts +21 -0
  131. package/dist/local-executor/conflict-resolution-durable-store.d.ts +61 -0
  132. package/dist/local-executor/conflict-resolution-store.d.ts +210 -0
  133. package/dist/local-executor/conflict-types.d.ts +86 -0
  134. package/dist/local-executor/cp7-audit-writer.d.ts +152 -0
  135. package/dist/local-executor/durable-store.d.ts +334 -0
  136. package/dist/local-executor/git-lock-retry.d.ts +40 -0
  137. package/dist/local-executor/hook-bridge.d.ts +36 -0
  138. package/dist/local-executor/implementor-argv.d.ts +183 -0
  139. package/dist/local-executor/index.d.ts +49 -0
  140. package/dist/local-executor/local-executor-impl.d.ts +724 -0
  141. package/dist/local-executor/merge-conflict-extract.d.ts +34 -0
  142. package/dist/local-executor/merge-conflict-resolve.d.ts +101 -0
  143. package/dist/local-executor/merge-journal-store.d.ts +311 -0
  144. package/dist/local-executor/merge-train.d.ts +713 -0
  145. package/dist/local-executor/promote-wal-store.d.ts +301 -0
  146. package/dist/local-executor/resolution-set-index.d.ts +51 -0
  147. package/dist/local-executor/revert-reconcile.d.ts +89 -0
  148. package/dist/local-executor/revert-runner.d.ts +17 -0
  149. package/dist/local-executor/shared-contract-detector.d.ts +57 -0
  150. package/dist/local-executor/spawn.d.ts +34 -0
  151. package/dist/local-executor/task-group-types.d.ts +346 -0
  152. package/dist/local-executor/team-execution-flag.d.ts +21 -0
  153. package/dist/local-executor/track-registry.d.ts +50 -0
  154. package/dist/local-executor/types.d.ts +417 -0
  155. package/dist/local-executor/verification-gates/build.d.ts +6 -0
  156. package/dist/local-executor/verification-gates/deploy-preflight.d.ts +6 -0
  157. package/dist/local-executor/verification-gates/diff-sanity.d.ts +6 -0
  158. package/dist/local-executor/verification-gates/hostile-grep.d.ts +6 -0
  159. package/dist/local-executor/verification-gates/lint.d.ts +6 -0
  160. package/dist/local-executor/verification-gates/shell-runner.d.ts +40 -0
  161. package/dist/local-executor/verification-gates/source-traceability.d.ts +6 -0
  162. package/dist/local-executor/verification-gates/tests.d.ts +6 -0
  163. package/dist/local-executor/verification-gates/typecheck.d.ts +6 -0
  164. package/dist/local-executor/verification-runner.d.ts +28 -0
  165. package/dist/local-executor/wb2-review-bundle.d.ts +59 -0
  166. package/dist/local-executor/workspace-shadow.d.ts +290 -0
  167. package/dist/local-executor/worktree-merge.d.ts +601 -0
  168. package/dist/local-model/__tests__/installer.test.d.ts +1 -0
  169. package/dist/local-model/__tests__/manager.test.d.ts +1 -0
  170. package/dist/local-model/__tests__/ollama.test.d.ts +1 -0
  171. package/dist/local-model/__tests__/runtime.test.d.ts +1 -0
  172. package/dist/local-model/__tests__/state.test.d.ts +1 -0
  173. package/dist/local-model/manager.d.ts +119 -0
  174. package/dist/local-model/ollama.d.ts +27 -0
  175. package/dist/local-model/runtime.d.ts +27 -0
  176. package/dist/local-model/state.d.ts +32 -0
  177. package/dist/orchestration/__tests__/setup-bootstrap.test.d.ts +1 -0
  178. package/dist/orchestration/__tests__/setup-failure-recourse.test.d.ts +1 -0
  179. package/dist/orchestration/__tests__/setup-save.test.d.ts +1 -0
  180. package/dist/orchestration/__tests__/setup-seat-picker.test.d.ts +1 -0
  181. package/dist/orchestration/__tests__/setup-telemetry.test.d.ts +1 -0
  182. package/dist/orchestration/__tests__/setup-test-agents.test.d.ts +1 -0
  183. package/dist/orchestration/__tests__/setup-types.test.d.ts +1 -0
  184. package/dist/orchestration/__tests__/setup-wizard.test.d.ts +1 -0
  185. package/dist/orchestration/__tests__/v1-options.test.d.ts +1 -0
  186. package/dist/orchestration/detect-agents.d.ts +16 -2
  187. package/dist/orchestration/index.d.ts +1 -0
  188. package/dist/orchestration/orchestration-cli.d.ts +4 -1
  189. package/dist/orchestration/setup-bootstrap.d.ts +146 -0
  190. package/dist/orchestration/setup-failure-recourse.d.ts +23 -0
  191. package/dist/orchestration/setup-save.d.ts +47 -0
  192. package/dist/orchestration/setup-seat-picker.d.ts +72 -0
  193. package/dist/orchestration/setup-telemetry.d.ts +54 -0
  194. package/dist/orchestration/setup-test-agents.d.ts +108 -0
  195. package/dist/orchestration/setup-types.d.ts +141 -0
  196. package/dist/orchestration/setup-wizard.d.ts +57 -0
  197. package/dist/orchestration/v1-options.d.ts +97 -0
  198. package/dist/orchestration-shell/__tests__/attachments.test.d.ts +1 -0
  199. package/dist/orchestration-shell/__tests__/audit-browser.test.d.ts +1 -0
  200. package/dist/orchestration-shell/__tests__/audited-path-fixes.test.d.ts +1 -0
  201. package/dist/orchestration-shell/__tests__/bracketed-paste.test.d.ts +1 -0
  202. package/dist/orchestration-shell/__tests__/cli-authority-bridge.test.d.ts +1 -0
  203. package/dist/orchestration-shell/__tests__/cli-group-halt-wiring.test.d.ts +1 -0
  204. package/dist/orchestration-shell/__tests__/cli-orchestration-session-bootstrap.test.d.ts +1 -0
  205. package/dist/orchestration-shell/__tests__/cli-planner-stack.test.d.ts +1 -0
  206. package/dist/orchestration-shell/__tests__/cli-probe-group-status.test.d.ts +1 -0
  207. package/dist/orchestration-shell/__tests__/cli-quorum-loop-tier.test.d.ts +1 -0
  208. package/dist/orchestration-shell/__tests__/cli-singleton-enforcement.test.d.ts +1 -0
  209. package/dist/orchestration-shell/__tests__/cli-stub-session-adapter.test.d.ts +1 -0
  210. package/dist/orchestration-shell/__tests__/cli-verdict-classifier-wiring.test.d.ts +1 -0
  211. package/dist/orchestration-shell/__tests__/components.test.d.ts +1 -0
  212. package/dist/orchestration-shell/__tests__/context-store.test.d.ts +1 -0
  213. package/dist/orchestration-shell/__tests__/cp10-585-accept-echo-target.test.d.ts +1 -0
  214. package/dist/orchestration-shell/__tests__/cp10-585-loop.test.d.ts +1 -0
  215. package/dist/orchestration-shell/__tests__/cp10-585-prompts.test.d.ts +1 -0
  216. package/dist/orchestration-shell/__tests__/cp12-w2b-team-loop.test.d.ts +1 -0
  217. package/dist/orchestration-shell/__tests__/cp12-w4-team-recovery.test.d.ts +1 -0
  218. package/dist/orchestration-shell/__tests__/cp1f-quorum-loop.test.d.ts +1 -0
  219. package/dist/orchestration-shell/__tests__/cp606-team-track-user-resolved.test.d.ts +1 -0
  220. package/dist/orchestration-shell/__tests__/cp7-reviewer-substrate.test.d.ts +1 -0
  221. package/dist/orchestration-shell/__tests__/declared-test-runner.test.d.ts +1 -0
  222. package/dist/orchestration-shell/__tests__/emit-shell-event.test.d.ts +1 -0
  223. package/dist/orchestration-shell/__tests__/familiarize-routing.test.d.ts +1 -0
  224. package/dist/orchestration-shell/__tests__/gate-decision-submit.test.d.ts +1 -0
  225. package/dist/orchestration-shell/__tests__/gate-details-panel.test.d.ts +1 -0
  226. package/dist/orchestration-shell/__tests__/gate-prompts.test.d.ts +1 -0
  227. package/dist/orchestration-shell/__tests__/gate-verdict-details-dispatch.test.d.ts +1 -0
  228. package/dist/orchestration-shell/__tests__/group-decision-submit.test.d.ts +1 -0
  229. package/dist/orchestration-shell/__tests__/hostile-grep.test.d.ts +1 -0
  230. package/dist/orchestration-shell/__tests__/image-attach-e2e.test.d.ts +1 -0
  231. package/dist/orchestration-shell/__tests__/input-bar-autocomplete.test.d.ts +1 -0
  232. package/dist/orchestration-shell/__tests__/live-region-cap.test.d.ts +1 -0
  233. package/dist/orchestration-shell/__tests__/live-static-order.test.d.ts +1 -0
  234. package/dist/orchestration-shell/__tests__/mode-selection.test.d.ts +1 -0
  235. package/dist/orchestration-shell/__tests__/model-cli.test.d.ts +1 -0
  236. package/dist/orchestration-shell/__tests__/non-gate-prompt-routing.test.d.ts +1 -0
  237. package/dist/orchestration-shell/__tests__/orchestration-app-group-decision-transport.test.d.ts +1 -0
  238. package/dist/orchestration-shell/__tests__/orchestration-app-layout.test.d.ts +1 -0
  239. package/dist/orchestration-shell/__tests__/process-markers.test.d.ts +1 -0
  240. package/dist/orchestration-shell/__tests__/reducer.test.d.ts +1 -0
  241. package/dist/orchestration-shell/__tests__/reissue-team-retained-spec.test.d.ts +1 -0
  242. package/dist/orchestration-shell/__tests__/review-summary-render.test.d.ts +1 -0
  243. package/dist/orchestration-shell/__tests__/reviewer-wizard.test.d.ts +1 -0
  244. package/dist/orchestration-shell/__tests__/reviewers-format.test.d.ts +1 -0
  245. package/dist/orchestration-shell/__tests__/root-discovery.test.d.ts +1 -0
  246. package/dist/orchestration-shell/__tests__/runOrchestrationShell-classify-dispatch.test.d.ts +1 -0
  247. package/dist/orchestration-shell/__tests__/runOrchestrationShell-planner-wiring.test.d.ts +1 -0
  248. package/dist/orchestration-shell/__tests__/runOrchestrationShell-signal.test.d.ts +1 -0
  249. package/dist/orchestration-shell/__tests__/runOrchestrationShell.test.d.ts +1 -0
  250. package/dist/orchestration-shell/__tests__/serialize-submissions.test.d.ts +1 -0
  251. package/dist/orchestration-shell/__tests__/slash-router.test.d.ts +1 -0
  252. package/dist/orchestration-shell/__tests__/slash-suggest.test.d.ts +1 -0
  253. package/dist/orchestration-shell/__tests__/status-format.test.d.ts +1 -0
  254. package/dist/orchestration-shell/__tests__/sticky-preference.test.d.ts +1 -0
  255. package/dist/orchestration-shell/__tests__/task-progress.test.d.ts +1 -0
  256. package/dist/orchestration-shell/__tests__/team-decompose-routing.test.d.ts +1 -0
  257. package/dist/orchestration-shell/__tests__/team-decompose-types.test.d.ts +1 -0
  258. package/dist/orchestration-shell/__tests__/team-decompose.test.d.ts +1 -0
  259. package/dist/orchestration-shell/__tests__/team-e2e-smoke.test.d.ts +1 -0
  260. package/dist/orchestration-shell/__tests__/tier2-reviewer-selection.test.d.ts +1 -0
  261. package/dist/orchestration-shell/__tests__/web-browsing.test.d.ts +1 -0
  262. package/dist/orchestration-shell/attachments.d.ts +152 -0
  263. package/dist/orchestration-shell/audit-browser.d.ts +115 -0
  264. package/dist/orchestration-shell/audit-runner.d.ts +59 -0
  265. package/dist/orchestration-shell/bracketed-paste.d.ts +26 -0
  266. package/dist/orchestration-shell/cli.d.ts +431 -0
  267. package/dist/orchestration-shell/cli.js +44191 -0
  268. package/dist/orchestration-shell/cohort-flag.d.ts +16 -0
  269. package/dist/orchestration-shell/components/AuditLogPanel.d.ts +11 -0
  270. package/dist/orchestration-shell/components/CodeVibeLogo.d.ts +2 -0
  271. package/dist/orchestration-shell/components/ConversationPane.d.ts +13 -0
  272. package/dist/orchestration-shell/components/GateDetailsPanel.d.ts +57 -0
  273. package/dist/orchestration-shell/components/GatePanelEntry.d.ts +9 -0
  274. package/dist/orchestration-shell/components/GatePromptEntry.d.ts +16 -0
  275. package/dist/orchestration-shell/components/InputBar.d.ts +55 -0
  276. package/dist/orchestration-shell/components/LiveProgressLine.d.ts +8 -0
  277. package/dist/orchestration-shell/components/MultiTrackStatusNode.d.ts +8 -0
  278. package/dist/orchestration-shell/components/OrchestrationApp.d.ts +129 -0
  279. package/dist/orchestration-shell/components/ReviewerSetupWizard.d.ts +24 -0
  280. package/dist/orchestration-shell/components/StatusBar.d.ts +20 -0
  281. package/dist/orchestration-shell/components/nodes/AdvisoryEntry.d.ts +8 -0
  282. package/dist/orchestration-shell/components/nodes/GateStatusNode.d.ts +8 -0
  283. package/dist/orchestration-shell/components/nodes/PlannerDecisionEntry.d.ts +8 -0
  284. package/dist/orchestration-shell/components/nodes/ReviewerQuorumStatusNode.d.ts +8 -0
  285. package/dist/orchestration-shell/components/nodes/SlashOutputEntry.d.ts +8 -0
  286. package/dist/orchestration-shell/components/nodes/SubagentEventEntry.d.ts +8 -0
  287. package/dist/orchestration-shell/components/nodes/UserMessageEntry.d.ts +8 -0
  288. package/dist/orchestration-shell/context-store.d.ts +389 -0
  289. package/dist/orchestration-shell/declared-test-runner.d.ts +84 -0
  290. package/dist/orchestration-shell/emit-shell-event.d.ts +64 -0
  291. package/dist/orchestration-shell/gate-decision-submit.d.ts +245 -0
  292. package/dist/orchestration-shell/gate-prompts.d.ts +481 -0
  293. package/dist/orchestration-shell/index.d.ts +712 -0
  294. package/dist/orchestration-shell/ink-runtime.d.ts +84 -0
  295. package/dist/orchestration-shell/live-region-cap.d.ts +70 -0
  296. package/dist/orchestration-shell/live-static-order.d.ts +22 -0
  297. package/dist/orchestration-shell/mode-selection.d.ts +46 -0
  298. package/dist/orchestration-shell/non-tty-fallback.d.ts +67 -0
  299. package/dist/orchestration-shell/process-markers.d.ts +12 -0
  300. package/dist/orchestration-shell/quorum-loop.d.ts +1900 -0
  301. package/dist/orchestration-shell/reducer.d.ts +8 -0
  302. package/dist/orchestration-shell/root-discovery.d.ts +25 -0
  303. package/dist/orchestration-shell/route-browse.d.ts +20 -0
  304. package/dist/orchestration-shell/slash-router.d.ts +64 -0
  305. package/dist/orchestration-shell/slash-routes/continuation.d.ts +71 -0
  306. package/dist/orchestration-shell/slash-routes/reviewers.d.ts +41 -0
  307. package/dist/orchestration-shell/slash-suggest.d.ts +29 -0
  308. package/dist/orchestration-shell/status-format.d.ts +59 -0
  309. package/dist/orchestration-shell/sticky-preference.d.ts +24 -0
  310. package/dist/orchestration-shell/store.d.ts +17 -0
  311. package/dist/orchestration-shell/task-progress.d.ts +122 -0
  312. package/dist/orchestration-shell/team-decompose.d.ts +196 -0
  313. package/dist/orchestration-shell/types.d.ts +777 -0
  314. package/dist/orchestration-shell/vendor/ink-parse-keypress.d.ts +42 -0
  315. package/dist/orchestration-shell/web/extract.d.ts +11 -0
  316. package/dist/orchestration-shell/web/fetch.d.ts +15 -0
  317. package/dist/orchestration-shell/web/ip.d.ts +26 -0
  318. package/dist/orchestration-shell/web/sanitize.d.ts +14 -0
  319. package/dist/orchestration-shell/web/search.d.ts +16 -0
  320. package/dist/planner/__tests__/cache-clarification-bypass.test.d.ts +1 -0
  321. package/dist/planner/__tests__/cache.test.d.ts +1 -0
  322. package/dist/planner/__tests__/client.test.d.ts +1 -0
  323. package/dist/planner/__tests__/health-machine-transitions.test.d.ts +1 -0
  324. package/dist/planner/__tests__/local-gemma.test.d.ts +1 -0
  325. package/dist/planner/__tests__/types-zod.test.d.ts +1 -0
  326. package/dist/planner/adapter.d.ts +16 -0
  327. package/dist/planner/cache.d.ts +35 -0
  328. package/dist/planner/client.d.ts +103 -0
  329. package/dist/planner/health-state.d.ts +24 -0
  330. package/dist/planner/index.d.ts +7 -0
  331. package/dist/planner/local-advisory.d.ts +84 -0
  332. package/dist/planner/local-gemma.d.ts +23 -0
  333. package/dist/planner/types.d.ts +123 -0
  334. package/dist/reviewer/__tests__/antigravity-provider.test.d.ts +1 -0
  335. package/dist/reviewer/__tests__/claude-provider-json.test.d.ts +1 -0
  336. package/dist/reviewer/__tests__/cp7-reviewer-sandbox.test.d.ts +1 -0
  337. package/dist/reviewer/__tests__/output-parser-classifier-helpers.test.d.ts +1 -0
  338. package/dist/reviewer/__tests__/verdict-classifier.test.d.ts +1 -0
  339. package/dist/reviewer/index.d.ts +2 -0
  340. package/dist/reviewer/output-parser.d.ts +48 -12
  341. package/dist/reviewer/provider.d.ts +107 -3
  342. package/dist/reviewer/providers/__tests__/failure-classifier.test.d.ts +1 -0
  343. package/dist/reviewer/providers/antigravity.d.ts +49 -0
  344. package/dist/reviewer/providers/claude.d.ts +19 -4
  345. package/dist/reviewer/providers/codex.d.ts +47 -5
  346. package/dist/reviewer/providers/failure-classifier.d.ts +26 -0
  347. package/dist/reviewer/providers/gemini.d.ts +5 -4
  348. package/dist/reviewer/registry.d.ts +5 -5
  349. package/dist/reviewer/subprocess.d.ts +37 -0
  350. package/dist/reviewer/token-usage.d.ts +32 -0
  351. package/dist/reviewer/types.d.ts +5 -5
  352. package/dist/reviewer/verdict-classifier.d.ts +62 -0
  353. package/dist/session/__tests__/prepare-event-timestamp.test.d.ts +1 -0
  354. package/dist/session/__tests__/session-resume-service-keys.test.d.ts +1 -0
  355. package/dist/session/index.d.ts +1 -0
  356. package/dist/session/prepare-event-timestamp.d.ts +30 -0
  357. package/dist/session/session-rekey.d.ts +40 -0
  358. package/dist/session/session-resume.d.ts +25 -0
  359. package/dist/structural-summary/__tests__/__fixtures__/fixture-helpers.d.ts +11 -0
  360. package/dist/structural-summary/__tests__/assembler.test.d.ts +1 -0
  361. package/dist/structural-summary/__tests__/generator.test.d.ts +1 -0
  362. package/dist/structural-summary/__tests__/language-detect.test.d.ts +1 -0
  363. package/dist/structural-summary/__tests__/manifest-parsers/cargo.test.d.ts +1 -0
  364. package/dist/structural-summary/__tests__/manifest-parsers/gomod.test.d.ts +1 -0
  365. package/dist/structural-summary/__tests__/manifest-parsers/gradle.test.d.ts +1 -0
  366. package/dist/structural-summary/__tests__/manifest-parsers/index.test.d.ts +1 -0
  367. package/dist/structural-summary/__tests__/manifest-parsers/npm.test.d.ts +1 -0
  368. package/dist/structural-summary/__tests__/manifest-parsers/podfile.test.d.ts +1 -0
  369. package/dist/structural-summary/__tests__/manifest-parsers/pyproject.test.d.ts +1 -0
  370. package/dist/structural-summary/__tests__/opt-in-store.test.d.ts +1 -0
  371. package/dist/structural-summary/__tests__/privacy-filter.test.d.ts +1 -0
  372. package/dist/structural-summary/__tests__/safe-file-read.test.d.ts +1 -0
  373. package/dist/structural-summary/__tests__/user-ignore-matcher.test.d.ts +1 -0
  374. package/dist/structural-summary/__tests__/walker.test.d.ts +1 -0
  375. package/dist/structural-summary/generator.d.ts +8 -0
  376. package/dist/structural-summary/index.d.ts +7 -0
  377. package/dist/structural-summary/manifest-parsers/cargo.d.ts +3 -0
  378. package/dist/structural-summary/manifest-parsers/index.d.ts +7 -0
  379. package/dist/structural-summary/manifest-parsers/npm.d.ts +3 -0
  380. package/dist/structural-summary/manifest-parsers/other.d.ts +17 -0
  381. package/dist/structural-summary/opt-in-store.d.ts +24 -0
  382. package/dist/structural-summary/privacy-filter.d.ts +110 -0
  383. package/dist/structural-summary/safe-file-read.d.ts +11 -0
  384. package/dist/structural-summary/types.d.ts +215 -0
  385. package/dist/structural-summary/user-ignore-matcher.d.ts +9 -0
  386. package/dist/structural-summary/walker.d.ts +20 -0
  387. package/dist/substrate/__tests__/docker.test.d.ts +1 -0
  388. package/dist/substrate/__tests__/forwarder.test.d.ts +1 -0
  389. package/dist/substrate/__tests__/git-proxy.test.d.ts +1 -0
  390. package/dist/substrate/__tests__/sandbox-exec.test.d.ts +1 -0
  391. package/dist/substrate/__tests__/substrate-e2e.integration.test.d.ts +1 -0
  392. package/dist/substrate/command-runner.d.ts +19 -0
  393. package/dist/substrate/docker.d.ts +134 -0
  394. package/dist/substrate/errors.d.ts +33 -0
  395. package/dist/substrate/forwarder.d.ts +67 -0
  396. package/dist/substrate/git-proxy.d.ts +35 -0
  397. package/dist/substrate/index.d.ts +12 -0
  398. package/dist/substrate/relay-script.d.ts +27 -0
  399. package/dist/substrate/sandbox-exec.d.ts +116 -0
  400. package/dist/substrate/types.d.ts +218 -0
  401. package/dist/substrate-launch/__tests__/apikey-bootstrap.test.d.ts +1 -0
  402. package/dist/substrate-launch/__tests__/creditless-loop.integration.test.d.ts +1 -0
  403. package/dist/substrate-launch/__tests__/engage-substrate.test.d.ts +1 -0
  404. package/dist/substrate-launch/__tests__/fallback-ladder.test.d.ts +1 -0
  405. package/dist/substrate-launch/__tests__/le-env-scrub.test.d.ts +1 -0
  406. package/dist/substrate-launch/__tests__/sanitized-env.test.d.ts +1 -0
  407. package/dist/substrate-launch/apikey-bootstrap.d.ts +84 -0
  408. package/dist/substrate-launch/engage-substrate.d.ts +102 -0
  409. package/dist/substrate-launch/fallback-ladder.d.ts +49 -0
  410. package/dist/substrate-launch/index.d.ts +12 -0
  411. package/dist/substrate-launch/le-env-scrub.d.ts +77 -0
  412. package/dist/substrate-launch/sanitized-env.d.ts +73 -0
  413. package/dist/types/auth.d.ts +6 -1
  414. package/dist/types/events.d.ts +19 -2
  415. package/dist/types/reviewer.d.ts +6 -6
  416. package/package.json +21 -3
@@ -0,0 +1,116 @@
1
+ import type { CommandRunner, Substrate, SubstrateHandle, SubstrateSpec } from './types';
2
+ /** Injectable deps — default-wired to the real runtime; stubbed in unit tests. */
3
+ export interface SandboxExecDeps {
4
+ /** Process layer (default: `node:child_process`). */
5
+ runner?: CommandRunner;
6
+ /** Override the temp dir for the generated profile (default: os.tmpdir()). */
7
+ profileRoot?: string;
8
+ /**
9
+ * Override the platform check (default: `process.platform`). A5 is macOS-only
10
+ * — a non-`darwin` platform yields {@link SubstrateUnavailableError}.
11
+ */
12
+ platform?: NodeJS.Platform;
13
+ }
14
+ /**
15
+ * Generate the Seatbelt profile string for a worktree (§3.1, `coarse` tier).
16
+ *
17
+ * Profile shape (the load-bearing tokens the conformance test pins):
18
+ * `(version 1)` `(deny default)` — deny everything not explicitly allowed.
19
+ * `(allow process-exec*)` / `(allow process-fork)` — let the agent process
20
+ * bootstrap + spawn its own tooling.
21
+ * `(allow mach-lookup)` + `(deny mach-lookup (global-name "com.apple.
22
+ * SecurityServer"/"…securityd"/"…securityd.xpc"))`
23
+ * — broad mach IPC to launch, but the Keychain
24
+ * (securityd) services denied last as DEFENSE-IN-
25
+ * DEPTH against a same-user agent reading the
26
+ * vendor key via keytar's `SecKeychain*` mach
27
+ * path. Empirically (see the deny block below),
28
+ * keytar leaks the vendor key ONLY when BOTH the
29
+ * securityd mach service AND the keychain DB
30
+ * *file* are reachable; A5 never grants `$HOME`
31
+ * (so the keychain file is already denied), and
32
+ * this securityd deny is the second, independent
33
+ * lock. Either lock alone blocks keytar — kept
34
+ * belt-and-suspenders.
35
+ * `(allow file-read* (literal "/"))` — read the ROOT dir itself. **Empirically
36
+ * load-bearing:** without it the dyld bootstrap
37
+ * cannot resolve absolute paths and the process
38
+ * SIGABRTs (a `subpath "/usr"` rule does NOT
39
+ * cover the `/` directory entry). This is the
40
+ * fix for the Stage-1 HIGH-3 "profile cannot
41
+ * launch a binary" finding.
42
+ * `(allow file-read* (subpath ...))` — reads scoped to the system dirs a
43
+ * process needs + the worktree. NOT a broad
44
+ * read of `/` (host dotfiles/keychain stay
45
+ * unreadable).
46
+ * `(allow file-write* (subpath <wd>))` — writes scoped to the worktree ONLY.
47
+ * NOTE: `<wd>` MUST be the CANONICAL (realpath)
48
+ * path — on macOS `/tmp`→`/private/tmp`, and a
49
+ * non-canonical write rule silently fails to
50
+ * match. The caller canonicalizes before launch.
51
+ * `(deny network*)` — deny all network…
52
+ * `(allow network-outbound (remote ip "localhost:*"))` — …except loopback.
53
+ *
54
+ * Loopback-only is the documented WEAK tier: it cannot pin the single broker
55
+ * port, so any other localhost listener stays reachable. The reduced-trust
56
+ * badge (`egressFidelity: 'coarse'`) signals this.
57
+ *
58
+ * @param workdir the worktree path (SHOULD be canonical — see file header).
59
+ * @param execPath the Node interpreter to grant read on (default
60
+ * `process.execPath`); injectable for deterministic tests.
61
+ */
62
+ export declare function buildSeatbeltProfile(workdir: string, execPath?: string,
63
+ /**
64
+ * CP-7 PART D — extra READ-ONLY dirs to grant (the apiKeyHelper bootstrap dir
65
+ * holding the helper script + broker-token file + agent config). Read-only:
66
+ * the agent reads the current token; no write grant (the host owns rotation).
67
+ * These are explicit, scoped subpaths — NOT $HOME / /Users (the MED-fix
68
+ * invariant that host secrets stay unreadable still holds).
69
+ */
70
+ extraReadDirs?: readonly string[],
71
+ /**
72
+ * Stage-2 HIGH (Codex — the `.git` credential leak). The host path of the
73
+ * SCRUBBED `.git` proxy (built by `git-proxy.ts`, same as A1's mount). When
74
+ * provided, the profile (a) GRANTS read on it (read-only — the agent runs
75
+ * `git` against it via `GIT_DIR`) and (b) DENIES read+write of the REAL
76
+ * `<workdir>/.git`, so the agent CANNOT read the host repo's credential
77
+ * helpers / tokenized remotes / hooks / reflogs directly. Without this the A5
78
+ * agent runs on the host fs and the `(allow file-read* (subpath "<wd>"))`
79
+ * grant would expose the real `.git`. Null/absent for a non-git workdir (the
80
+ * `.git` deny is still emitted — denying a non-existent path is harmless and
81
+ * keeps the profile shape uniform).
82
+ */
83
+ gitProxyDir?: string | null,
84
+ /**
85
+ * r5 HIGH-1 (Codex) — the home dir to anchor the file-keychain (`~/.codevibe`)
86
+ * DENY at. Default `os.homedir()`; injectable for deterministic tests. The
87
+ * deny is the second, independent lock on the file-keychain dir (default-deny
88
+ * already blocks $HOME — see {@link FILE_KEYCHAIN_DIR_NAME}).
89
+ */
90
+ homedir?: string,
91
+ /**
92
+ * CP-7 W3 — Stage-2 r1 HIGH (A5 "outside workdir → default-denied" is not
93
+ * universal). The RESOLVED per-task audit DIR (the sibling `.codevibe/audit/
94
+ * <group>/<track>/` tree). A5 grants broad READ subpaths for tooling (`/usr`,
95
+ * `/Library`, `/opt/homebrew`, `/usr/local`, `/opt/local`); if the repo/workdir
96
+ * (and therefore the sibling audit dir) lives UNDER one of those prefixes, the
97
+ * audit dir would be READABLE by the sandboxed agent even though it sits
98
+ * outside `workdir`. We emit an explicit TRAILING `(deny file-read* file-write*
99
+ * (subpath "<auditDir>"))` AFTER all the broad allows (Seatbelt last-match-
100
+ * wins, exactly like the `<wd>/.git` + `~/.codevibe` denies) so the agent can
101
+ * never read or tamper with the forensic record regardless of prefix overlap.
102
+ * Null/absent → no audit deny is emitted (e.g. a unit test without a real audit
103
+ * tree); production always threads the resolved audit dir.
104
+ */
105
+ auditDir?: string | null): string;
106
+ /**
107
+ * A5 macOS `sandbox-exec` substrate (`egressFidelity: 'coarse'`). See file
108
+ * header. NOT the default — the LE selects it as the macOS Docker-fallback.
109
+ */
110
+ export declare class SandboxExecSubstrate implements Substrate {
111
+ private readonly runner;
112
+ private readonly profileRoot;
113
+ private readonly platform;
114
+ constructor(deps?: SandboxExecDeps);
115
+ launch(spec: SubstrateSpec): Promise<SubstrateHandle>;
116
+ }
@@ -0,0 +1,218 @@
1
+ import type { Readable, Writable } from "node:stream";
2
+ /**
3
+ * Isolation backend for a substrate. `firecracker` is [DEF →
4
+ * A3-after-C2] — declared so the union admits the hosted runner without
5
+ * reopening the contract; not implemented in Rung 1.
6
+ */
7
+ export type IsolationTech = "docker" | "sandbox_exec" | "firecracker";
8
+ /**
9
+ * How tightly the substrate can pin egress to the single broker
10
+ * destination.
11
+ *
12
+ * - `strict`: single-destination allow-list (A1 netns / A3 VM net) —
13
+ * all other egress is dropped at the substrate's egress proxy.
14
+ * - `coarse`: loopback-only; cannot pin the exact broker port (A5
15
+ * Seatbelt) — the documented "weak for I3" tier. A `coarse` session
16
+ * is surfaced via {@link SubstrateHandle.egressFidelity} so the LE
17
+ * badges it reduced-trust.
18
+ */
19
+ export type EgressFidelity = "strict" | "coarse";
20
+ /**
21
+ * The full launch spec the LE passes to {@link Substrate.launch}.
22
+ * PHASE-CP-7-DESIGN §3.1.
23
+ */
24
+ export interface SubstrateSpec {
25
+ isolationTech: IsolationTech;
26
+ /**
27
+ * Canonical host path of the session worktree — the ONLY filesystem
28
+ * mounted (§6 Q3 git-proxy).
29
+ */
30
+ workdir: string;
31
+ /**
32
+ * Where the broker actually listens on the HOST (e.g.
33
+ * `127.0.0.1:<ephemeral>`).
34
+ */
35
+ hostBrokerAddr: string;
36
+ /**
37
+ * What the agent points at FROM INSIDE the sandbox + the strict
38
+ * egress target. The container's `127.0.0.1` is NOT the host's, so the
39
+ * impl bridges sandbox→host. **A1 Option A (W2):** the agent dials a
40
+ * loopback `http://127.0.0.1:<port>` served by an in-container relay that
41
+ * forwards to a bind-mounted host UDS, which a host-side relay drains into
42
+ * the broker — under `--network none` the container has no host route, so a
43
+ * bind-mounted UDS is the only channel. (A5 uses host loopback directly.)
44
+ */
45
+ sandboxBrokerUrl: string;
46
+ /**
47
+ * Orchestration `task_id` = the audit scope (§3.5). The egress proxy
48
+ * keys `egress_denied` on it, so the SUBSTRATE needs it (not only the
49
+ * broker).
50
+ */
51
+ taskId: string;
52
+ /**
53
+ * The COMPLETE env the agent sees — built by the LE, wiped of every
54
+ * ambient cred (I1), WITH the §3.6 marker keys already folded in (the
55
+ * LE knows the implementor role at launch). `exec()` injects nothing
56
+ * further.
57
+ */
58
+ sanitizedEnv: Readonly<Record<string, string>>;
59
+ /**
60
+ * CP-7 PART D (§3.3 agy-R3 bootstrap) — OPTIONAL, additive. The host
61
+ * directory holding the agent's `apiKeyHelper` script + the broker-token
62
+ * file + the agent config (Claude `settings.json` / Codex `config.toml`),
63
+ * bind-mounted READ-ONLY into the sandbox at `sandboxDir` so the wiped,
64
+ * `--network none` agent can read the CURRENT broker token from a file
65
+ * WITHOUT a network/IPC fetch. The host LE REFRESHES the token file
66
+ * out-of-band on rotation; the read-only mount lets the host rewrite the
67
+ * underlying file while the agent can only READ it (it cannot forge/rotate
68
+ * a token). MUST live OUTSIDE the workdir mount so it never lands in the
69
+ * repo/diff. Absent → no bootstrap mount (e.g. a reviewer/probe, or a path
70
+ * that supplies the helper another way). A LOCAL-ONLY field — never on any
71
+ * wire; every existing `SubstrateSpec` construction still compiles.
72
+ */
73
+ agentBootstrap?: {
74
+ /** Host dir holding the helper script + token file + agent config (0700). */
75
+ hostDir: string;
76
+ /** Read-only mount point inside the sandbox (NOT under the workdir). */
77
+ sandboxDir: string;
78
+ };
79
+ /**
80
+ * CP-7 W3 — Stage-2 r1 HIGH (A5 audit-readability). OPTIONAL, additive. The
81
+ * RESOLVED per-task audit DIR (the sibling `.codevibe/audit/<group>/<track>/`
82
+ * tree the strict writer appends to). Threaded ONLY so the A5 Seatbelt profile
83
+ * can emit an explicit TRAILING `(deny file-read* file-write* (subpath
84
+ * "<auditDir>"))` — the agent must never read/forge the forensic record even if
85
+ * the repo/workdir lives under a broad-read tooling prefix (`/usr`, `/Library`,
86
+ * `/opt/homebrew`, …). A1 never mounts the audit tree, so it ignores this. A
87
+ * LOCAL-ONLY field — never on any wire; every existing `SubstrateSpec`
88
+ * construction still compiles (absent → no audit deny is emitted).
89
+ */
90
+ auditDir?: string;
91
+ }
92
+ /**
93
+ * A structural `ChildProcess` subset. The LE widens its internal child
94
+ * type to `ChildProcess | SubstrateProc` so `wireLifecycle`
95
+ * (spawn.ts:200-213, which calls `stream.destroy()/.destroyed` + kill +
96
+ * `on('close'|'error')`) consumes it unchanged.
97
+ *
98
+ * The `node:stream` `Writable`/`Readable` types are used (NOT
99
+ * `NodeJS.WritableStream`/`ReadableStream`) because the former expose
100
+ * `destroy()`/`destroyed`, which `wireLifecycle` depends on.
101
+ */
102
+ export interface SubstrateProc {
103
+ readonly pid: number | undefined;
104
+ readonly stdin: Writable | null;
105
+ readonly stdout: Readable | null;
106
+ readonly stderr: Readable | null;
107
+ kill(signal?: NodeJS.Signals): boolean;
108
+ on(event: "close" | "error" | "exit", cb: (...a: unknown[]) => void): this;
109
+ }
110
+ /**
111
+ * A live substrate instance. PHASE-CP-7-DESIGN §3.1.
112
+ */
113
+ export interface SubstrateHandle {
114
+ readonly id: string;
115
+ /**
116
+ * Surfaced so a `coarse` (A5) session carries a reduced-trust badge.
117
+ */
118
+ readonly egressFidelity: EgressFidelity;
119
+ exec(argv: string[], opts: {
120
+ stdinTty: boolean;
121
+ timeoutMs?: number;
122
+ signal?: AbortSignal;
123
+ }): Promise<SubstrateProc>;
124
+ /** Idempotent; MUST destroy the sandbox + its fs view. */
125
+ teardown(): Promise<void>;
126
+ }
127
+ /**
128
+ * The substrate factory the LE drives. A1/A5 implement this; A3 is a
129
+ * [DEF] later impl of the SAME interface.
130
+ */
131
+ export interface Substrate {
132
+ launch(spec: SubstrateSpec): Promise<SubstrateHandle>;
133
+ }
134
+ /**
135
+ * One blocked-egress observation — the host-side forwarder (A1) or
136
+ * Seatbelt-violation observer (A5) invokes the {@link EgressObservationHook}
137
+ * with this on any connection/target it cannot honor. Fields mirror the
138
+ * §3.5 `egress_denied` payload so W3 forwards them directly.
139
+ */
140
+ export interface EgressDenialDetail {
141
+ /** The non-broker destination the sandbox tried to reach. */
142
+ destination: string;
143
+ /** Transport protocol observed (e.g. `tcp`). */
144
+ protocol: string;
145
+ /** Why it was denied (e.g. `non-broker-destination`, `connect-failed`). */
146
+ denialReason: string;
147
+ /** Orchestration task_id — the §3.5 audit scope. */
148
+ taskId: string;
149
+ /**
150
+ * A proxy-assigned stable id per denial event (§3.5 dedup discriminator —
151
+ * the `ProgressEvent`/`ToolUse` model). The W2 forwarder mints it; W3 keys
152
+ * the `egress_denied` dedup on it.
153
+ */
154
+ callerEventId: string;
155
+ }
156
+ /**
157
+ * The W3-wired audit seam. The W2 substrate invokes this for each blocked
158
+ * outbound attempt. **W3 wires the emit** (`egress_denied` → the LE strict
159
+ * audit sink); the W2 default is {@link NOOP_EGRESS_HOOK}. Injected via the
160
+ * substrate constructor so the locked {@link SubstrateSpec}/{@link Substrate}
161
+ * interfaces stay unchanged (the hook is a dependency, not a wire field).
162
+ *
163
+ * Returns `void` (best-effort observation) — the §3.5 rationale: a kernel-
164
+ * dropped packet is already in the safe (denied) state, so the audit cannot
165
+ * gate the (already-blocked) effect. W3's emit is fire-and-forget here.
166
+ */
167
+ export type EgressObservationHook = (detail: EgressDenialDetail) => void;
168
+ /** The W2 default observation hook — a no-op. [W3 wires the emit] */
169
+ export declare const NOOP_EGRESS_HOOK: EgressObservationHook;
170
+ /** Result of a one-shot (await-to-completion) command run. */
171
+ export interface CommandResult {
172
+ /** Exit code, or `null` if the process was signal-killed. */
173
+ exitCode: number | null;
174
+ stdout: string;
175
+ stderr: string;
176
+ }
177
+ /**
178
+ * A long-lived spawned process the runner hands back for `docker exec` /
179
+ * `sandbox-exec <argv>` — structurally a {@link SubstrateProc} (so the LE's
180
+ * `wireLifecycle` consumes it) plus nothing more.
181
+ */
182
+ export type RunnerProc = SubstrateProc;
183
+ /**
184
+ * The injected process layer for the A1/A5 impls (§3.1). `run` is the
185
+ * await-to-completion form (network create/rm, container run/kill — the impl
186
+ * inspects exit code/stderr); `spawnLong` is the streaming form for the agent
187
+ * process (`docker exec` / `sandbox-exec`) whose lifecycle the LE wires.
188
+ *
189
+ * **HIGH fix (Stage-2): `spawnLong` MUST accept an explicit `env`/`cwd`.** The
190
+ * A5 path spawns the agent via `spawnLong`; if it inherits `process.env`, every
191
+ * ambient credential (`ANTHROPIC_API_KEY`, …) leaks into the sandboxed agent —
192
+ * an I1 violation that defeats the whole moat. When `env` is supplied the
193
+ * spawned process sees EXACTLY that env (no `process.env` merge). When `env` is
194
+ * `undefined` the legacy inherit-`process.env` behavior is retained (used only
195
+ * for non-agent spawns that have no isolation requirement).
196
+ */
197
+ export interface CommandRunner {
198
+ /** Run a command to completion, capturing stdout/stderr + exit code. */
199
+ run(argv: string[], opts?: {
200
+ timeoutMs?: number;
201
+ input?: string;
202
+ }): Promise<CommandResult>;
203
+ /**
204
+ * Spawn a streaming, long-lived process (the agent under the sandbox).
205
+ *
206
+ * `env`, when present, is the COMPLETE environment the child sees — there is
207
+ * NO `process.env` merge (I1: a host ambient credential MUST NOT reach the
208
+ * sandboxed agent). `cwd`, when present, sets the child's working directory.
209
+ */
210
+ spawnLong(argv: string[], opts: {
211
+ stdinTty: boolean;
212
+ signal?: AbortSignal;
213
+ /** EXACT child env (no `process.env` merge). Absent → inherit (legacy). */
214
+ env?: Readonly<Record<string, string>>;
215
+ /** Child working directory. Absent → inherit the parent's cwd. */
216
+ cwd?: string;
217
+ }): RunnerProc;
218
+ }
@@ -0,0 +1,84 @@
1
+ import type { VendorProvider } from "../credential-broker/types";
2
+ /** The fixed filenames inside the bootstrap dir (host + sandbox agree). */
3
+ export declare const HELPER_SCRIPT_NAME = "broker-apikey-helper.sh";
4
+ export declare const TOKEN_FILE_NAME = "broker-token";
5
+ /** Claude reads `settings.json`'s `apiKeyHelper`; Codex reads `config.toml`. */
6
+ export declare const CLAUDE_SETTINGS_NAME = "settings.json";
7
+ export declare const CODEX_CONFIG_NAME = "config.toml";
8
+ /** Where, inside the sandbox, the bootstrap dir is mounted (NOT the workdir). */
9
+ export declare const SANDBOX_BOOTSTRAP_DIR = "/codevibe/agent";
10
+ /** The Codex model-provider id the broker config registers. */
11
+ export declare const CODEX_PROVIDER_ID = "codevibe_broker";
12
+ /** Inputs for materializing the bootstrap. */
13
+ export interface ApiKeyBootstrapInput {
14
+ provider: VendorProvider;
15
+ /** The URL the agent dials the broker at FROM INSIDE the sandbox. */
16
+ sandboxBrokerUrl: string;
17
+ /**
18
+ * The CURRENT broker token to seed the token file with (the broker minted it
19
+ * at start). Rotation later goes through {@link ApiKeyBootstrap.refresh}.
20
+ */
21
+ initialToken: string;
22
+ /**
23
+ * The mount point of the bootstrap dir INSIDE the sandbox. For A1 Docker this
24
+ * is the `:ro` mount (e.g. {@link SANDBOX_BOOTSTRAP_DIR}). For A5 the sandbox
25
+ * fs IS the host fs, so the in-sandbox path equals the (mkdtemp'd) host dir —
26
+ * pass `{ sandboxDirEqualsHostDir: true }` instead of a literal `sandboxDir`.
27
+ * Used to bake ABSOLUTE in-sandbox paths into the helper/config.
28
+ */
29
+ sandboxDir?: string;
30
+ /**
31
+ * A5 mode — the bootstrap is NOT mounted; the sandbox reads it directly from
32
+ * the host fs, so the in-sandbox path == the created host dir. When true,
33
+ * `sandboxDir` is ignored and the baked paths use the host dir.
34
+ */
35
+ sandboxDirEqualsHostDir?: boolean;
36
+ /** Override the host root for the bootstrap dir (default os.tmpdir()). */
37
+ hostRoot?: string;
38
+ /**
39
+ * The host path of the agent's rw WORKDIR mount (the worktree). The token
40
+ * file + helper MUST live OUTSIDE this dir — otherwise the broker token (and
41
+ * the helper) become visible/writable through the agent's workdir mount,
42
+ * defeating the read-only bootstrap mount (Stage-2 M-2). `create` `realpath`s
43
+ * BOTH the resolved bootstrap dir and this path and FAILS CLOSED if the
44
+ * bootstrap dir is inside or equal to the workdir. Required for the substrate
45
+ * path (the LE always knows the workdir); tests that don't pass it skip the
46
+ * check (no workdir to collide with).
47
+ */
48
+ workdir?: string;
49
+ }
50
+ /**
51
+ * A materialized apiKeyHelper bootstrap. Holds the host paths so the LE can
52
+ * REFRESH the token file on rotation and TEAR DOWN (remove) the dir at session
53
+ * end. The `spec` it exposes is exactly what {@link
54
+ * import('../substrate/types').SubstrateSpec.agentBootstrap} wants.
55
+ */
56
+ export declare class ApiKeyBootstrap {
57
+ /** Host dir holding the helper + token file + agent config (0700). */
58
+ readonly hostDir: string;
59
+ /** In-sandbox mount point of {@link hostDir}. */
60
+ readonly sandboxDir: string;
61
+ /** Host path of the token file (the LE rewrites this on rotation). */
62
+ private readonly tokenFileHostPath;
63
+ private constructor();
64
+ /**
65
+ * Materialize the bootstrap: create the host dir (0700), write the token file
66
+ * (0600), the helper script (0700, executable), and the agent config. Returns
67
+ * the live {@link ApiKeyBootstrap}.
68
+ */
69
+ static create(input: ApiKeyBootstrapInput): Promise<ApiKeyBootstrap>;
70
+ /** The `SubstrateSpec.agentBootstrap` value for this bootstrap. */
71
+ get spec(): {
72
+ hostDir: string;
73
+ sandboxDir: string;
74
+ };
75
+ /**
76
+ * REFRESH the broker token (rotation / on a broker 401). Atomically rewrites
77
+ * the token file (write a temp + rename) so the agent never reads a partial
78
+ * token. The agent's helper re-runs on its next call / on a 401 and picks up
79
+ * the new value. The agent's mount is read-only, so ONLY the host can do this.
80
+ */
81
+ refresh(token: string): Promise<void>;
82
+ /** Remove the bootstrap dir (session teardown). Idempotent. */
83
+ destroy(): Promise<void>;
84
+ }
@@ -0,0 +1,102 @@
1
+ import { type RotationHandle } from "../credential-broker";
2
+ import type { BrokerDeps } from "../credential-broker/broker";
3
+ import type { ModelGatewayBroker, UpstreamClient, VendorProvider } from "../credential-broker/types";
4
+ import type { ProcessRole } from "../local-executor/types";
5
+ import type { SubstrateHandle } from "../substrate/types";
6
+ import { type FallbackLadderDeps } from "./fallback-ladder";
7
+ /** Map the implementor agent to the broker provider (Claude+Codex only, §6 Q4). */
8
+ export declare function providerForAgent(agentKind: "CLAUDE" | "GEMINI" | "CODEX" | "ANTIGRAVITY"): VendorProvider | null;
9
+ /** Inputs the LE passes to engage the moat for one implementor session. */
10
+ export interface EngageSubstrateInput {
11
+ /** Orchestration task_id — the audit scope (§3.5). */
12
+ taskId: string;
13
+ /**
14
+ * The agent to engage for. CLAUDE/CODEX are Trusted (substrate + broker);
15
+ * GEMINI/ANTIGRAVITY are reduced-trust (§6 Q4) — for those,
16
+ * `engageSubstrate` RETURNS a `reduced_trust` EngageResult (AGY-2.0 D7)
17
+ * so raw-wired callers (`cli.ts` engagers → `engageSubstrateForSpawn` /
18
+ * `engageReviewerSubstrate`) route them onto the legacy+badge path instead
19
+ * of crashing the spawn loop.
20
+ */
21
+ agentKind: "CLAUDE" | "GEMINI" | "CODEX" | "ANTIGRAVITY";
22
+ /** Canonical host path of the session worktree (the only fs mounted). */
23
+ workdir: string;
24
+ /** The implementor role marker value (always 'implementor' here). */
25
+ role: ProcessRole;
26
+ /** Ladder deps (injectable for tests). */
27
+ ladderDeps?: FallbackLadderDeps;
28
+ /** Broker upstream client override (tests inject a stub; default real fetch). */
29
+ upstreamClient?: UpstreamClient;
30
+ /** Broker vendor-key store / audit sink overrides (forwarded to the broker). */
31
+ brokerDeps?: Pick<BrokerDeps, "vendorKeyStore" | "auditSink">;
32
+ /**
33
+ * CP-7 W3 — explicit per-task `audit.jsonl` path override (tests). Production
34
+ * leaves this unset: `engageSubstrate` DERIVES it from `workdir` (the
35
+ * stateDir) as the sibling `<repoRootCanonical>/.codevibe/audit/<group>/
36
+ * <track>/audit.jsonl` (§W3.2). Either way the fail-closed containment guard
37
+ * asserts the resolved path is OUTSIDE the workdir before launch.
38
+ */
39
+ auditPath?: string;
40
+ /** Broker factory override (tests inject a stub broker). */
41
+ makeBroker?: (deps: BrokerDeps) => ModelGatewayBroker & {
42
+ currentBrokerToken(): {
43
+ value: string;
44
+ expiresAtMs: number;
45
+ } | null;
46
+ rotateBrokerToken?(): RotationHandle | null;
47
+ /** M-3 — confirm the helper file holds the rotated token (drop grace). */
48
+ commitBrokerTokenRotation?(handle?: RotationHandle): void;
49
+ /** M-3 — file rewrite failed; restore the prior token (fail closed). */
50
+ rollbackBrokerTokenRotation?(handle?: RotationHandle): void;
51
+ };
52
+ /**
53
+ * Broker-token refresh interval (ms). The LE re-mints + rewrites the
54
+ * apiKeyHelper token file every interval (well within the 30-min TTL) so a
55
+ * long session never hits an expired-token 401 loop. Default 10 min; set
56
+ * `0` to disable the timer (tests). NEVER persisted/logged.
57
+ */
58
+ tokenRefreshIntervalMs?: number;
59
+ /** Bootstrap host-root override (tests). */
60
+ bootstrapHostRoot?: string;
61
+ /** Safe locale source for the sanitized env (default: none). */
62
+ localeSource?: Readonly<Record<string, string | undefined>>;
63
+ }
64
+ /**
65
+ * The substrate-engaged result: the spawn seam runs the agent via
66
+ * `substrateHandle`, with `finalEnv` already folded with the §3.6 markers (it
67
+ * is informational here — the handle already carries it as `sanitizedEnv`).
68
+ * `refreshBrokerToken` is wired to the bootstrap so the LE can rotate.
69
+ */
70
+ export interface SubstrateEngaged {
71
+ mode: "substrate";
72
+ tier: "docker" | "sandbox_exec";
73
+ /** Reduced-trust badge for the A5 coarse tier (false for A1 strict). */
74
+ reducedTrust: boolean;
75
+ reducedTrustReason?: string;
76
+ substrateHandle: SubstrateHandle;
77
+ /** The complete env the agent runs under (markers folded) — for assertions. */
78
+ finalEnv: Readonly<Record<string, string>>;
79
+ /** Rotate the broker token in the bootstrap token file (on a broker 401). */
80
+ refreshBrokerToken(): Promise<void>;
81
+ /** Stop the broker (zeroize), destroy the bootstrap, tear down the substrate. */
82
+ teardown(): Promise<void>;
83
+ }
84
+ /** The reduced-trust (moat-OFF) result the LE surfaces with a prominent badge. */
85
+ export interface ReducedTrustEngaged {
86
+ mode: "reduced_trust";
87
+ reducedTrust: true;
88
+ reducedTrustReason: string;
89
+ /** No broker, no substrate — the LE uses the legacy nodeSpawn path. */
90
+ teardown(): Promise<void>;
91
+ }
92
+ export type EngageResult = SubstrateEngaged | ReducedTrustEngaged;
93
+ /**
94
+ * Engage the trusted-execution moat for one implementor session (PARTs B–F).
95
+ *
96
+ * Fail-closed contract: on the SUBSTRATE branch, if the broker can't start OR
97
+ * the bootstrap can't be written OR the substrate can't launch, we ROLL BACK
98
+ * (stop broker, destroy bootstrap) and THROW — we do NOT silently downgrade to
99
+ * an unsandboxed run. The ONLY non-substrate path is the ladder explicitly
100
+ * choosing reduced-trust (no runtime available), which returns the badge.
101
+ */
102
+ export declare function engageSubstrate(input: EngageSubstrateInput): Promise<EngageResult>;
@@ -0,0 +1,49 @@
1
+ import type { DockerSubstrateDeps } from "../substrate/docker";
2
+ import type { SandboxExecDeps } from "../substrate/sandbox-exec";
3
+ import type { CommandRunner, Substrate } from "../substrate/types";
4
+ /** Which rung of the §6 Q2 ladder was selected. */
5
+ export type SubstrateTier = "docker" | "sandbox_exec" | "reduced_trust";
6
+ /**
7
+ * The ladder's result. A `substrate` is present for the two real tiers; the
8
+ * `reduced_trust` tier has `substrate: null` (the LE takes the legacy path +
9
+ * the prominent badge).
10
+ */
11
+ export type SubstrateSelection = {
12
+ tier: "docker";
13
+ substrate: Substrate;
14
+ /** Strict egress (single-destination allow-list) — full moat. */
15
+ reducedTrust: false;
16
+ } | {
17
+ tier: "sandbox_exec";
18
+ substrate: Substrate;
19
+ /** Coarse egress (loopback-only) — reduced-trust BADGE per §3.1. */
20
+ reducedTrust: true;
21
+ reducedTrustReason: string;
22
+ } | {
23
+ tier: "reduced_trust";
24
+ substrate: null;
25
+ /** No substrate — the moat is OFF this session (legacy path). */
26
+ reducedTrust: true;
27
+ reducedTrustReason: string;
28
+ };
29
+ /** Injectable deps for the ladder (so it is testable without a real daemon). */
30
+ export interface FallbackLadderDeps {
31
+ /** Process layer for the `docker version` probe (default real). */
32
+ runner?: CommandRunner;
33
+ /** Platform override (default `process.platform`). */
34
+ platform?: NodeJS.Platform;
35
+ /** Deps forwarded to the chosen DockerSubstrate. */
36
+ dockerDeps?: DockerSubstrateDeps;
37
+ /** Deps forwarded to the chosen SandboxExecSubstrate. */
38
+ sandboxExecDeps?: SandboxExecDeps;
39
+ /** Substrate factory overrides (tests inject stubs). */
40
+ makeDocker?: (deps?: DockerSubstrateDeps) => Substrate;
41
+ makeSandboxExec?: (deps?: SandboxExecDeps) => Substrate;
42
+ }
43
+ /**
44
+ * Resolve the §6 Q2 ladder. Returns the chosen substrate + tier, or the
45
+ * reduced-trust sentinel. NEVER throws for "no substrate available" — that is a
46
+ * VALID (reduced-trust) outcome the LE surfaces with a badge; it throws only on
47
+ * a programming error.
48
+ */
49
+ export declare function selectSubstrate(deps?: FallbackLadderDeps): Promise<SubstrateSelection>;
@@ -0,0 +1,12 @@
1
+ export { engageSubstrate, providerForAgent, } from "./engage-substrate";
2
+ export type { EngageSubstrateInput, EngageResult, SubstrateEngaged, ReducedTrustEngaged, } from "./engage-substrate";
3
+ export { selectSubstrate } from "./fallback-ladder";
4
+ export type { SubstrateSelection, SubstrateTier, FallbackLadderDeps, } from "./fallback-ladder";
5
+ export { buildSanitizedBaseEnv, assertNoAmbientCreds, SAFE_ENV_ALLOWLIST, SANDBOX_DEFAULT_PATH, } from "./sanitized-env";
6
+ export type { SanitizedEnvInput } from "./sanitized-env";
7
+ export { ApiKeyBootstrap, SANDBOX_BOOTSTRAP_DIR, HELPER_SCRIPT_NAME, TOKEN_FILE_NAME, CODEX_PROVIDER_ID, } from "./apikey-bootstrap";
8
+ export type { ApiKeyBootstrapInput } from "./apikey-bootstrap";
9
+ export { scrubLeEnvOrReexec, buildScrubbedLeEnv, findCredShapedKeys, isCredShapedEnvKey, LE_ENV_SCRUBBED_MARKER, } from "./le-env-scrub";
10
+ export type { LeEnvScrubDeps } from "./le-env-scrub";
11
+ export { Cp7AuditWriter, CP7_CANONICAL_FORM_VERSION, GENESIS_PREV_HASH, canonicalJson, canonicalEntryBytes, computeEntryHash, verifyChain, } from "../local-executor/cp7-audit-writer";
12
+ export type { Cp7AuditEntry } from "../local-executor/cp7-audit-writer";