@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,210 @@
1
+ import type { ConflictClass, ConflictKind, ConflictSide } from './conflict-types';
2
+ /** The fields that uniquely identify a 3-way conflict region (§4.5 key). */
3
+ export interface ConflictIdInput {
4
+ repoId: string;
5
+ path: string;
6
+ /** base = merge-base side. */
7
+ base: ConflictSide;
8
+ /** track = the merging track branch (ours). */
9
+ track: ConflictSide;
10
+ /** counterpart = the current integration tip (theirs). */
11
+ counterpart: ConflictSide;
12
+ conflictKind: ConflictKind;
13
+ /** Deterministic 0-based index of the conflict region in the diff3 output. */
14
+ hunkOrdinal: number;
15
+ /** The pinned merge-implementation id (git version + strategy / vendored). */
16
+ mergeImplId: string;
17
+ }
18
+ /**
19
+ * Compute the deterministic `conflict_id` for a 3-way conflict region. Pure;
20
+ * identical inputs → identical id; any change in any of the three sides' blob/
21
+ * mode/type, the conflict kind, the hunk ordinal, or `merge_impl_id` → a
22
+ * different id (→ re-resolve, never a stale replay).
23
+ */
24
+ export declare function computeConflictId(input: ConflictIdInput): string;
25
+ /** SHA-256 hex of arbitrary resolved bytes (the audited `resolved_blob_hash`). */
26
+ export declare function hashResolvedBytes(bytes: Buffer): string;
27
+ /** The full agentic-resolution input identity (CP-14 WB2 / #C14-WB2-AGENTIC-IDENTITY). */
28
+ export interface AgenticInstanceKey {
29
+ /** The off-branch merge-result tree the agent resolved against (full context). */
30
+ conflictedTree: string;
31
+ /** The slot's class-2 `conflict_id`s (sorted into the key for order-stability). */
32
+ conflictIds: readonly string[];
33
+ /** The resolving agent kind (CLAUDE | CODEX | GEMINI). */
34
+ implementorAgent: string;
35
+ /** The resolving agent's per-spawn task identity. */
36
+ implementorTaskId: string;
37
+ /** The pinned merge-implementation id (git version + strategy / vendored). */
38
+ mergeImplId: string;
39
+ }
40
+ /**
41
+ * Compute the deterministic agentic-resolution `instance_id`. Pure; a change in
42
+ * the conflict-set, the `conflictedTree` (full context), the resolver agent/task,
43
+ * or `merge_impl_id` → a distinct instance (never a stale-context replay).
44
+ */
45
+ export declare function computeAgenticInstanceId(key: AgenticInstanceKey): string;
46
+ /** A snapshot of the three sides' identity (stored for audit + exact-input replay). */
47
+ export interface ConflictSidesSnapshot {
48
+ base: {
49
+ blobOid?: string;
50
+ mode?: string;
51
+ type: ConflictSide['type'];
52
+ };
53
+ track: {
54
+ blobOid?: string;
55
+ mode?: string;
56
+ type: ConflictSide['type'];
57
+ };
58
+ counterpart: {
59
+ blobOid?: string;
60
+ mode?: string;
61
+ type: ConflictSide['type'];
62
+ };
63
+ }
64
+ /** A first-class ConflictResolution audit record (§4.5). */
65
+ export interface ConflictResolutionRecord {
66
+ conflict_id: string;
67
+ repoId: string;
68
+ path: string;
69
+ conflict_kind: ConflictKind;
70
+ hunk_ordinal: number;
71
+ merge_impl_id: string;
72
+ sides: ConflictSidesSnapshot;
73
+ /** The durable per-hunk resolved lines (so multiple hunks COMPOSE). */
74
+ resolved_hunk_patch: string;
75
+ /** SHA-256 of the fully-resolved FILE bytes — the integrity check on replay. */
76
+ resolved_blob_hash: string;
77
+ /** Who resolved it: a deterministic reconciler (lockfile-only in W3-core), the
78
+ * bounded prompt→JSON LLM, an AGENTIC resolver (CP-14 WB2 — read+write in a
79
+ * disposable repo; recorded per-slot via {@link AgenticResolutionRecord}, not
80
+ * here), or a human. */
81
+ resolver: 'reconciler:lockfile' | 'llm' | 'agentic' | 'human';
82
+ /** Free-text rationale (byte-explanation for class-1; model/human reasoning). */
83
+ rationale: string;
84
+ /** Self-reported confidence (best-effort; class-2 is Tier-2'd regardless). */
85
+ confidence?: number;
86
+ /** The resolution class (§4.3). */
87
+ class: ConflictClass;
88
+ }
89
+ /**
90
+ * A per-SLOT agentic ConflictResolution audit record (CP-14 WB2). Unlike the
91
+ * per-hunk {@link ConflictResolutionRecord}, an agentic resolution covers the
92
+ * whole slot's class-2 conflict-set, is keyed by its full-context
93
+ * {@link AgenticInstanceKey} (`instance_id`), and binds the resolved TREE OID
94
+ * (the selective-imported result) + per-file resolved blob OIDs — the
95
+ * full-committed-tree-OID authentication (agy r2-HIGH) compares the committed
96
+ * commit tree against `resolved_tree_oid`. There is no `resolved_hunk_patch`:
97
+ * the agent wrote whole files, so the audit is tree/blob-level, not hunk-level.
98
+ */
99
+ export interface AgenticResolutionRecord {
100
+ /** {@link computeAgenticInstanceId} over the slot's {@link AgenticInstanceKey}. */
101
+ instance_id: string;
102
+ /** The off-branch merge-result tree the agent resolved against (full context). */
103
+ conflictedTree: string;
104
+ /** The slot's class-2 `conflict_id`s this resolution covers (sorted). */
105
+ conflictIds: string[];
106
+ implementorAgent: string;
107
+ implementorTaskId: string;
108
+ merge_impl_id: string;
109
+ /** The resolved tree OID (the selective-imported result overlaid on `conflictedTree`). */
110
+ resolved_tree_oid: string;
111
+ /**
112
+ * Per-conflicted-file resolved-content digests (the only paths the agent's edits import).
113
+ * `blobSha256` is the SHA-256 of the resolved file bytes ({@link hashResolvedBytes}), NOT a
114
+ * git blob OID (Stage-2 Codex LOW — the prior `blobOid` name was misleading). It is an audit
115
+ * field only; the full-tree-OID moat ({@link AgenticResolutionRecord.resolved_tree_oid}) is
116
+ * what `verifyAgenticSlot` checks — this per-file digest is NOT on any OID-auth path.
117
+ */
118
+ resolved_blobs: Array<{
119
+ path: string;
120
+ blobSha256: string;
121
+ }>;
122
+ resolver: 'agentic';
123
+ /** Agentic resolution is always class-2 (the LLM-resolvable tier). */
124
+ class: 2;
125
+ /** Free-text rationale (best-effort; the slot is final-tip Tier-2'd regardless). */
126
+ rationale?: string;
127
+ }
128
+ /** Strip a `ConflictSide` to its stored identity snapshot (no raw bytes). */
129
+ export declare function snapshotSides(input: ConflictIdInput): ConflictSidesSnapshot;
130
+ /**
131
+ * The durable ConflictResolution store (§4.5). Keyed by `conflict_id`. The
132
+ * merge-train looks up a conflict's id BEFORE invoking any model: on a hit the
133
+ * recorded resolution replays (no model call); on a miss it resolves and
134
+ * `put`s the record. Implementations persist to the audit corpus (the
135
+ * `MergeGateResult` chain) with the same EventDedupKey discipline; the
136
+ * in-memory impl below is for tests + a same-process replay cache.
137
+ */
138
+ export interface ConflictResolutionStore {
139
+ get(conflictId: string): Promise<ConflictResolutionRecord | null>;
140
+ /**
141
+ * Persist a resolution. Idempotent on `conflict_id`: a second put with the
142
+ * SAME conflict_id keeps the ORIGINAL record (the recorded resolution for a
143
+ * given exact 3-way input is immutable — never overwritten by a re-run).
144
+ * Returns the record now in the store (original on a dup).
145
+ *
146
+ * `attemptId` (CP-14 WB2) tags the record as PENDING for that resolve attempt
147
+ * until the `resolution_recorded` WAL marker is durable; a crashed attempt's
148
+ * pending records are dropped by {@link clearPending} on recovery (case 3),
149
+ * never colliding with a fresh non-deterministic re-attempt. Omit for a
150
+ * deterministic (class-1 / replay-stable) record that has no collision risk.
151
+ */
152
+ put(record: ConflictResolutionRecord, attemptId?: string): Promise<ConflictResolutionRecord>;
153
+ /** Look up an agentic per-slot resolution by its `instance_id`. */
154
+ getAgentic(instanceId: string): Promise<AgenticResolutionRecord | null>;
155
+ /**
156
+ * Persist an agentic per-slot resolution (keyed by `instance_id`). Idempotent
157
+ * on `instance_id` (same full-context instance → keep the original). `attemptId`
158
+ * tags it PENDING until the WAL marker (see {@link put}).
159
+ */
160
+ putAgentic(record: AgenticResolutionRecord, attemptId?: string): Promise<AgenticResolutionRecord>;
161
+ /**
162
+ * Recovery case 3 (Codex r5 / agy r5): drop every PENDING (pre-WAL) record
163
+ * written under `attemptId` — per-hunk AND agentic — so a fresh non-deterministic
164
+ * re-dispatch can write without a first-writer-wins collision. Pending records
165
+ * are non-authoritative by construction (only a durable WAL makes them load-
166
+ * bearing), so clearing them is safe. No-op for an unknown `attemptId`.
167
+ */
168
+ clearPending(attemptId: string): Promise<void>;
169
+ /** Explicitly delete a single record by `conflict_id` or agentic `instance_id`. */
170
+ delete(key: string): Promise<void>;
171
+ }
172
+ /** In-memory {@link ConflictResolutionStore} (tests + same-process replay cache). */
173
+ export declare class InMemoryConflictResolutionStore implements ConflictResolutionStore {
174
+ private readonly byId;
175
+ private readonly agenticById;
176
+ /** attemptId → the keys (conflict_id / instance_id) it wrote while PENDING. */
177
+ private readonly pendingByAttempt;
178
+ private trackPending;
179
+ get(conflictId: string): Promise<ConflictResolutionRecord | null>;
180
+ put(record: ConflictResolutionRecord, attemptId?: string): Promise<ConflictResolutionRecord>;
181
+ getAgentic(instanceId: string): Promise<AgenticResolutionRecord | null>;
182
+ putAgentic(record: AgenticResolutionRecord, attemptId?: string): Promise<AgenticResolutionRecord>;
183
+ clearPending(attemptId: string): Promise<void>;
184
+ delete(key: string): Promise<void>;
185
+ /** Test helper: number of distinct recorded per-hunk resolutions. */
186
+ get size(): number;
187
+ /** Test helper: number of distinct recorded agentic per-slot resolutions. */
188
+ get agenticSize(): number;
189
+ }
190
+ /**
191
+ * Verify that `bytes` match the record's audited `resolved_blob_hash`. The bytes
192
+ * MUST be at the SAME granularity the record hashed:
193
+ * - class-2 (per-hunk): the resolved HUNK bytes (`resolved_hunk_patch`);
194
+ * - class-1 (whole-file): the whole resolved FILE bytes.
195
+ * Used as a fail-closed integrity guard: on a fresh resolve it confirms the
196
+ * stored hash reproduces the bytes; on a durable-store REPLAY it catches a
197
+ * corrupted record — a mismatch → FAIL CLOSED (re-resolve / escalate), never
198
+ * adopt unverified bytes (§4.5).
199
+ */
200
+ export declare function verifyResolvedBytes(record: ConflictResolutionRecord, bytes: Buffer): boolean;
201
+ /**
202
+ * Recompute the `conflict_id` from a record's STORED identity fields (repoId /
203
+ * path / sides {blob,mode,type} / conflict_kind / hunk_ordinal / merge_impl_id).
204
+ * On a durable-store REPLAY the result MUST equal both the record's own
205
+ * `conflict_id` AND the lookup key — a mismatch means the record's identity
206
+ * metadata was tampered/corrupted (the hunk-hash alone wouldn't catch a flipped
207
+ * `class`/`sides`/`kind`), so the caller FAILS CLOSED instead of replaying it
208
+ * (Stage-2 r1 Codex HIGH — replay must not trust mutable record metadata).
209
+ */
210
+ export declare function recomputeConflictIdFromRecord(record: ConflictResolutionRecord): string;
@@ -0,0 +1,86 @@
1
+ /**
2
+ * The git conflict KIND for a path (§4.5). Only `content` (a regular-file text
3
+ * 3-way content conflict) is class-1/class-2 eligible; every other kind is a
4
+ * hard route-to-human (class-3) — a blob-only resolution would be unsound for a
5
+ * rename/mode/type/submodule/binary conflict.
6
+ */
7
+ export type ConflictKind = 'content' | 'add_add' | 'rename_rename' | 'rename_delete' | 'modify_delete' | 'mode_change' | 'type_change' | 'submodule' | 'binary';
8
+ /** A git tree-entry object type for one side of a conflict (§4.5 key input). */
9
+ export type GitObjectType = 'regular' | 'symlink' | 'gitlink';
10
+ /**
11
+ * One side (base / track / counterpart) of a 3-way conflict for a single path.
12
+ * `blobOid`/`mode`/`type` are part of the `conflict_id` key (§4.5) so a same-blob
13
+ * but different-mode/type pair can never stale-replay across each other.
14
+ * `content` is the raw bytes (present for regular text sides; absent for a
15
+ * deleted side or a non-blob).
16
+ */
17
+ export interface ConflictSide {
18
+ /** The git blob OID (40/64-hex), or undefined for a deleted/absent side. */
19
+ blobOid?: string;
20
+ /** The octal tree-entry mode (e.g. `100644`, `100755`, `120000`, `160000`). */
21
+ mode?: string;
22
+ /** The object type of this side. */
23
+ type: GitObjectType;
24
+ /** Raw bytes of this side's blob (regular text sides), or undefined. */
25
+ content?: Buffer;
26
+ }
27
+ /**
28
+ * The full per-path conflict descriptor the classifier + resolver consume.
29
+ * Assembled by the merge-train wiring (W3-6) from the 3-way blob extraction.
30
+ */
31
+ export interface ConflictFileMeta {
32
+ /** Repo-relative path (the integration-tip path). */
33
+ path: string;
34
+ /** The git conflict kind. */
35
+ conflictKind: ConflictKind;
36
+ /** True if any side is detected binary (NUL byte / git binary heuristic). */
37
+ isBinary: boolean;
38
+ /** True if any present REGULAR side is not valid UTF-8 (and not NUL-binary) —
39
+ * e.g. a Latin-1 / invalid-UTF-8 text file. The diff3 parse + compose path is
40
+ * UTF-8 string-based, so such a blob would round-trip through `U+FFFD`
41
+ * replacement bytes and silently corrupt unchanged context lines. It is routed
42
+ * to class-3 (`non_utf8`), FAILING CLOSED before class-2 (Stage-2 r6 Codex MED).
43
+ * A byte-oriented diff3 path could re-enable these as class-2; that is a follow-on. */
44
+ isNonUtf8: boolean;
45
+ /** True if any touched path carries a Git-LFS filter (→ class-3, §4.2). */
46
+ hasLfs: boolean;
47
+ /** True if `.gitattributes` declares a custom `merge=`/`filter=` driver for
48
+ * this path (→ class-3, §4.2) — never run a driver, never silently strip it. */
49
+ hasDangerousAttr: boolean;
50
+ /** The three sides (base = merge-base; track = the merging branch; counterpart
51
+ * = the current integration tip). */
52
+ base: ConflictSide;
53
+ track: ConflictSide;
54
+ counterpart: ConflictSide;
55
+ }
56
+ /** The resolution class for a conflict (§4.3). */
57
+ export type ConflictClass = 1 | 2 | 3;
58
+ /** Why a conflict was put in its class (audit + the human-gate surface). */
59
+ export interface ConflictClassification {
60
+ /** 1 = deterministic-mechanical, 2 = LLM-assisted (Tier-2'd), 3 = human gate. */
61
+ class: ConflictClass;
62
+ /** Human-readable rationale. */
63
+ reason: string;
64
+ /** For class-1: the deterministic reconciler family to apply. W3-core ships
65
+ * only the structurally-safe `lockfile` reconciler; whitespace/import-order
66
+ * are deferred to the language-aware follow-on (see class1-reconcilers.ts). */
67
+ reconciler?: 'lockfile';
68
+ /** For class-3: the structural trigger category that forced the human gate. */
69
+ humanGateTrigger?: 'shared_contract' | 'dangerous_attr' | 'submodule' | 'lfs' | 'binary' | 'non_utf8' | 'mode_change' | 'type_change' | 'rename' | 'add_add' | 'modify_delete' | 'lockfile_version_delta';
70
+ }
71
+ /**
72
+ * One conflict HUNK within a path — the unit a resolution is recorded against
73
+ * (§4.5 stores the per-hunk `resolved_hunk_patch` so multiple hunks on one file
74
+ * COMPOSE rather than overwrite). `hunkOrdinal` is the deterministic index of
75
+ * the conflict region in the pinned diff3 output.
76
+ */
77
+ export interface ConflictHunk {
78
+ /** Deterministic 0-based index of this conflict region in the diff3 output. */
79
+ hunkOrdinal: number;
80
+ /** The base (merge-base) lines of this region. */
81
+ baseLines: string[];
82
+ /** The track-branch (ours) lines of this region. */
83
+ trackLines: string[];
84
+ /** The integration-tip (theirs) lines of this region. */
85
+ counterpartLines: string[];
86
+ }
@@ -0,0 +1,152 @@
1
+ import type { AuditKindCp7, StrictAuditSink } from "../credential-broker/audit-sink";
2
+ /** One CP-7 audit-log entry, mirroring `codevibe-audit::AuditEntry` (no new fields). */
3
+ export interface Cp7AuditEntry {
4
+ /** Primary key — this entry's identity (a uuid). NOT the dedup key. */
5
+ entry_id: string;
6
+ /** Foreign key to the orchestration task this entry describes. */
7
+ task_id: string;
8
+ /** Which CP-7 audit kind (snake_case wire form). */
9
+ kind: AuditKindCp7;
10
+ /** Typed payload per `kind` (the broker/LE-supplied object). */
11
+ payload: Record<string, unknown>;
12
+ /** When the event occurred (a fixed ISO-8601 ms-precision UTC string). */
13
+ timestamp: string;
14
+ /**
15
+ * Hex SHA-256 of the canonical serialization of the PREVIOUS entry in this
16
+ * task's file. `null` ONLY for the genesis (first) entry — the documented
17
+ * zero/empty sentinel (§W3.2 step 3).
18
+ */
19
+ prev_hash: string | null;
20
+ /** Deterministic event-identity key (the framed W0 helper output, hex). */
21
+ event_dedup_key: string;
22
+ }
23
+ /** The pinned canonical-form version tag (bump = chain-breaking migration). */
24
+ export declare const CP7_CANONICAL_FORM_VERSION = "cp7-w3-canonical-v1";
25
+ /** The documented genesis `prev_hash` sentinel — `null` (first entry only). */
26
+ export declare const GENESIS_PREV_HASH: null;
27
+ /**
28
+ * Deterministic, stable-key-ordered JSON serialization of an arbitrary
29
+ * JSON-able value. Object keys are recursively sorted ascending (JS default
30
+ * `<` on the key strings — UTF-16 code-unit order); arrays keep element order;
31
+ * scalars use `JSON.stringify`. This is the `payload` serializer (and is reused
32
+ * for the whole canonical object so the ordering rule is single-sourced).
33
+ *
34
+ * Rejects values that JSON cannot round-trip deterministically: `undefined`,
35
+ * functions, and non-finite numbers throw (a payload carrying one is a bug —
36
+ * fail closed rather than silently drop a field and corrupt the chain).
37
+ */
38
+ export declare function canonicalJson(value: unknown): string;
39
+ /**
40
+ * Serialize a {@link Cp7AuditEntry} to its PINNED canonical bytes (a UTF-8
41
+ * string). The 7 fields are emitted in {@link CANONICAL_FIELD_ORDER}; `payload`
42
+ * (and every field, via the single-sourced {@link canonicalJson}) is
43
+ * stable-key-ordered. THIS string is what `computeEntryHash` hashes — the
44
+ * verifier contract (CP-8 must reproduce it).
45
+ */
46
+ export declare function canonicalEntryBytes(entry: Cp7AuditEntry): string;
47
+ /**
48
+ * The TS-NATIVE tamper-evident chain hash of a {@link Cp7AuditEntry}: lowercase
49
+ * hex SHA-256 over its {@link canonicalEntryBytes}. The NEXT entry's `prev_hash`
50
+ * is this value; flipping ANY field of THIS entry changes these bytes → changes
51
+ * this hash → breaks the next entry's `prev_hash` link → chain verify fails.
52
+ *
53
+ * NOT a byte-mirror of the Rust `sha256_hex(serde_json::to_string(&AuditEntry))`
54
+ * chain (§W3.2 step 3) — TS-native by design.
55
+ */
56
+ export declare function computeEntryHash(entry: Cp7AuditEntry): string;
57
+ /**
58
+ * Verify a hash chain over an ordered list of entries (the CP-8 reader logic,
59
+ * inlined here for the W3 self-consistency + mutation tests). Returns the index
60
+ * of the FIRST broken link, or `null` if the whole chain verifies.
61
+ *
62
+ * A chain is valid iff entry[0].prev_hash === GENESIS sentinel AND for every
63
+ * i>0, entry[i].prev_hash === computeEntryHash(entry[i-1]).
64
+ */
65
+ export declare function verifyChain(entries: ReadonlyArray<Cp7AuditEntry>): number | null;
66
+ /**
67
+ * The real {@link StrictAuditSink} for a live session (§W3.2). ONE instance per
68
+ * `task_id`, bound to that task's `audit.jsonl` path. Every `emit`:
69
+ * 1. allocates an `entry_id` (uuid),
70
+ * 2. computes the framed `event_dedup_key` from the payload,
71
+ * 3. chains `prev_hash` off the last entry written to THIS file,
72
+ * 4. builds the {@link Cp7AuditEntry} (no new fields),
73
+ * 5. durably appends (`O_CREAT|O_APPEND|O_WRONLY|`**`O_NOFOLLOW`** open +
74
+ * `fstat` regular-file assert + `writeSync` + **`fsyncSync`**) and returns
75
+ * `{ack}` ONLY after fsync; ANY throw → `{nack}` (NEVER swallowed). The
76
+ * O_NOFOLLOW open refuses to follow a planted leaf symlink (ELOOP) so the
77
+ * record can never be redirected into the agent-writable workdir; a
78
+ * post-write finalize failure POISONS the writer (fail closed),
79
+ * 6. with all appends serialized per-task (in-instance queue) so concurrent
80
+ * emits chain deterministically.
81
+ */
82
+ export declare class Cp7AuditWriter implements StrictAuditSink {
83
+ private readonly taskId;
84
+ private readonly auditPath;
85
+ /** The last entry's hash (the next entry's `prev_hash`). `null` = genesis. */
86
+ private lastHash;
87
+ /** True once we've established `lastHash` (in-memory OR from the file). */
88
+ private chainInitialized;
89
+ /** The in-instance serialization tail — appends chain onto this. */
90
+ private appendQueue;
91
+ /**
92
+ * Stage-2 r1 MEDIUM — the writer is POISONED once an append has WRITTEN bytes
93
+ * to disk but FAILED to complete cleanly (fsync/close threw AFTER the write
94
+ * syscall). The bytes are durable but `lastHash` did NOT advance, so the
95
+ * on-disk chain has an orphaned line a later emit would acknowledge against a
96
+ * stale `prev_hash` → a forever-broken chain. Once poisoned, EVERY subsequent
97
+ * `emit` fails closed with `{nack}` (NEVER acks onto a broken chain). This is
98
+ * set ONLY on a POST-write failure — a PRE-write failure (open/O_NOFOLLOW/
99
+ * fstat reject → the file is untouched) nacks WITHOUT poisoning, since the
100
+ * chain on disk is still intact and the next emit can proceed.
101
+ */
102
+ private poisoned;
103
+ /**
104
+ * @param taskId The orchestration task_id — the audit scope (§3.5). Bound
105
+ * at construction; every entry carries it + the dedup keys
106
+ * frame on it.
107
+ * @param auditPath The per-task `audit.jsonl` absolute path. The LE derives it
108
+ * as `<repoRootCanonical>/.codevibe/audit/<group>/<track>/`
109
+ * and asserts (containment guard) it is OUTSIDE the agent's
110
+ * workdir BEFORE constructing this (see engage-substrate.ts).
111
+ */
112
+ constructor(taskId: string, auditPath: string);
113
+ /** The per-task audit file path (for the E2E + teardown). */
114
+ get path(): string;
115
+ /**
116
+ * Emit one strict audit row. Resolves `{ack: entry_id}` ONLY after the row is
117
+ * durably fsync'd; resolves `{nack: reason}` on ANY failure (open/O_NOFOLLOW
118
+ * ELOOP/fstat/write/fsync/canonicalization). NEVER throws, NEVER swallows a
119
+ * failure into a false ack.
120
+ *
121
+ * Appends are serialized onto an in-instance queue so concurrent emits chain
122
+ * deterministically (no interleaved `prev_hash` race).
123
+ *
124
+ * Stage-2 r1 MEDIUM — POISON FAIL-CLOSED: if an append wrote bytes to disk but
125
+ * failed to finalize (fsync/close threw after the write), the writer becomes
126
+ * POISONED and EVERY subsequent emit nacks (`"writer poisoned after partial
127
+ * write"`) — never an ack onto the now-broken on-disk chain. A PRE-write
128
+ * failure (open/O_NOFOLLOW/fstat/dedup/canonicalize) nacks WITHOUT poisoning
129
+ * (the file is untouched; the next emit may proceed).
130
+ */
131
+ emit(kind: AuditKindCp7, payload: Record<string, unknown>): Promise<{
132
+ ack: string;
133
+ } | {
134
+ nack: string;
135
+ }>;
136
+ /**
137
+ * The serialized single-append body. Runs under the queue (never concurrently
138
+ * with another append on this instance). Returns `{ack}`/`{nack}` — NEVER
139
+ * rejects (a throw is caught + converted to a nack so the chain tail stays
140
+ * a resolved promise).
141
+ */
142
+ private appendOne;
143
+ /**
144
+ * Recover the chain tail from an existing file (resumed session). Reads the
145
+ * file's last non-empty line, parses it as a {@link Cp7AuditEntry}, and
146
+ * returns `computeEntryHash` of it. Returns `null` (genesis) if the file is
147
+ * absent or empty. A corrupt last line THROWS — better a hard fail than
148
+ * silently re-chaining off a forged/truncated tail (mirrors the Rust
149
+ * `FileAuditWriter::open` CorruptedTail contract).
150
+ */
151
+ private readLastHashFromFile;
152
+ }