@quantiya/codevibe-core 2.0.1 → 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 (282) hide show
  1. package/dist/__tests__/prompt-parser.test.d.ts +1 -0
  2. package/dist/adapter/registry.d.ts +69 -2
  3. package/dist/appsync/__tests__/appsync-client-event-source-filter.test.d.ts +1 -0
  4. package/dist/appsync/__tests__/appsync-client-task-group.test.d.ts +1 -0
  5. package/dist/appsync/__tests__/cleanup-subscription.test.d.ts +1 -0
  6. package/dist/appsync/__tests__/coerce-awsjson-and-review-summary.test.d.ts +1 -0
  7. package/dist/appsync/__tests__/cp1f-quorum-sdk.test.d.ts +1 -0
  8. package/dist/appsync/__tests__/event-throttle.test.d.ts +1 -0
  9. package/dist/appsync/appsync-client.d.ts +621 -10
  10. package/dist/appsync/event-throttle.d.ts +28 -0
  11. package/dist/appsync/index.d.ts +3 -0
  12. package/dist/appsync/queries.d.ts +19 -0
  13. package/dist/audit-keys/index.d.ts +32 -0
  14. package/dist/auth/auth-service.d.ts +32 -2
  15. package/dist/auth/auth-telemetry.d.ts +19 -1
  16. package/dist/auth/index.d.ts +1 -0
  17. package/dist/companion-mode/persist-preference.d.ts +1 -1
  18. package/dist/config/config.d.ts +8 -1
  19. package/dist/continuation/__tests__/dirty-state-collector.test.d.ts +1 -0
  20. package/dist/continuation/__tests__/integration.test.d.ts +1 -0
  21. package/dist/continuation/__tests__/packet-reader.test.d.ts +1 -0
  22. package/dist/continuation/__tests__/packet-writer.test.d.ts +1 -0
  23. package/dist/continuation/__tests__/parity.test.d.ts +1 -0
  24. package/dist/continuation/__tests__/status-cli.test.d.ts +1 -0
  25. package/dist/continuation/dirty-state-collector.d.ts +46 -0
  26. package/dist/continuation/index.d.ts +8 -0
  27. package/dist/continuation/packet-reader.d.ts +33 -0
  28. package/dist/continuation/packet-writer.d.ts +86 -0
  29. package/dist/continuation/types.d.ts +239 -0
  30. package/dist/credential-broker/__tests__/broker.test.d.ts +1 -0
  31. package/dist/credential-broker/__tests__/canonical.test.d.ts +1 -0
  32. package/dist/credential-broker/__tests__/scrubber.test.d.ts +1 -0
  33. package/dist/credential-broker/__tests__/upstream-client.test.d.ts +1 -0
  34. package/dist/credential-broker/__tests__/vendor-key-store.test.d.ts +1 -0
  35. package/dist/credential-broker/audit-sink.d.ts +69 -0
  36. package/dist/credential-broker/broker-config.d.ts +39 -0
  37. package/dist/credential-broker/broker-token.d.ts +123 -0
  38. package/dist/credential-broker/broker.d.ts +165 -0
  39. package/dist/credential-broker/canonical.d.ts +119 -0
  40. package/dist/credential-broker/index.d.ts +15 -0
  41. package/dist/credential-broker/scrubber.d.ts +45 -0
  42. package/dist/credential-broker/types.d.ts +141 -0
  43. package/dist/credential-broker/upstream-client.d.ts +20 -0
  44. package/dist/credential-broker/vendor-key-store.d.ts +54 -0
  45. package/dist/index.d.ts +6 -1
  46. package/dist/index.js +427 -124
  47. package/dist/keychain/__tests__/keychain-backend.test.d.ts +1 -0
  48. package/dist/keychain/keychain-backend.d.ts +82 -0
  49. package/dist/local-executor/__tests__/agentic-disposable-repo.test.d.ts +1 -0
  50. package/dist/local-executor/__tests__/agentic-resolve.test.d.ts +1 -0
  51. package/dist/local-executor/__tests__/agentic-resolver-flag.test.d.ts +1 -0
  52. package/dist/local-executor/__tests__/class-a-sign.test.d.ts +1 -0
  53. package/dist/local-executor/__tests__/class1-reconcilers.test.d.ts +1 -0
  54. package/dist/local-executor/__tests__/class2-resolver.test.d.ts +1 -0
  55. package/dist/local-executor/__tests__/confined-model-caller.test.d.ts +1 -0
  56. package/dist/local-executor/__tests__/conflict-classifier.test.d.ts +1 -0
  57. package/dist/local-executor/__tests__/conflict-resolution-durable-store.test.d.ts +1 -0
  58. package/dist/local-executor/__tests__/conflict-resolution-store.test.d.ts +1 -0
  59. package/dist/local-executor/__tests__/cp1f-quorum-consumer.test.d.ts +1 -0
  60. package/dist/local-executor/__tests__/cp7-audit-writer.test.d.ts +1 -0
  61. package/dist/local-executor/__tests__/durable-store.test.d.ts +1 -0
  62. package/dist/local-executor/__tests__/git-lock-retry.test.d.ts +1 -0
  63. package/dist/local-executor/__tests__/implementor-argv.test.d.ts +1 -0
  64. package/dist/local-executor/__tests__/local-executor-teams.test.d.ts +1 -0
  65. package/dist/local-executor/__tests__/merge-conflict-extract.test.d.ts +1 -0
  66. package/dist/local-executor/__tests__/merge-conflict-git.integration.test.d.ts +1 -0
  67. package/dist/local-executor/__tests__/merge-conflict-resolve-agentic.integration.test.d.ts +1 -0
  68. package/dist/local-executor/__tests__/merge-conflict-resolve.integration.test.d.ts +1 -0
  69. package/dist/local-executor/__tests__/merge-journal-store.test.d.ts +1 -0
  70. package/dist/local-executor/__tests__/merge-train-agentic-recovery.integration.test.d.ts +1 -0
  71. package/dist/local-executor/__tests__/merge-train-w3.integration.test.d.ts +1 -0
  72. package/dist/local-executor/__tests__/merge-train-waveb.integration.test.d.ts +1 -0
  73. package/dist/local-executor/__tests__/merge-train.test.d.ts +1 -0
  74. package/dist/local-executor/__tests__/promote-wal-store.test.d.ts +1 -0
  75. package/dist/local-executor/__tests__/revert-reconcile.test.d.ts +1 -0
  76. package/dist/local-executor/__tests__/revert-runner.test.d.ts +1 -0
  77. package/dist/local-executor/__tests__/shared-contract-detector.test.d.ts +1 -0
  78. package/dist/local-executor/__tests__/substrate-engage.test.d.ts +1 -0
  79. package/dist/local-executor/__tests__/team-execution-flag.test.d.ts +1 -0
  80. package/dist/local-executor/__tests__/track-registry.test.d.ts +1 -0
  81. package/dist/local-executor/__tests__/wb2-review-bundle.test.d.ts +1 -0
  82. package/dist/local-executor/__tests__/wb2-substrate-spawn.live.test.d.ts +1 -0
  83. package/dist/local-executor/__tests__/workspace-shadow.test.d.ts +1 -0
  84. package/dist/local-executor/__tests__/worktree-merge.test.d.ts +1 -0
  85. package/dist/local-executor/agentic-disposable-repo.d.ts +52 -0
  86. package/dist/local-executor/agentic-resolve.d.ts +54 -0
  87. package/dist/local-executor/agentic-resolver-flag.d.ts +9 -0
  88. package/dist/local-executor/authority.d.ts +33 -1
  89. package/dist/local-executor/class-a-emit.d.ts +3 -1
  90. package/dist/local-executor/class-a-sign.d.ts +57 -0
  91. package/dist/local-executor/class-b-consumer.d.ts +159 -4
  92. package/dist/local-executor/class-b-verify.d.ts +30 -0
  93. package/dist/local-executor/class1-reconcilers.d.ts +58 -0
  94. package/dist/local-executor/class2-resolver.d.ts +74 -0
  95. package/dist/local-executor/confined-model-caller.d.ts +39 -0
  96. package/dist/local-executor/conflict-classifier.d.ts +21 -0
  97. package/dist/local-executor/conflict-resolution-durable-store.d.ts +61 -0
  98. package/dist/local-executor/conflict-resolution-store.d.ts +210 -0
  99. package/dist/local-executor/conflict-types.d.ts +86 -0
  100. package/dist/local-executor/cp7-audit-writer.d.ts +152 -0
  101. package/dist/local-executor/durable-store.d.ts +334 -0
  102. package/dist/local-executor/git-lock-retry.d.ts +40 -0
  103. package/dist/local-executor/hook-bridge.d.ts +1 -1
  104. package/dist/local-executor/implementor-argv.d.ts +183 -0
  105. package/dist/local-executor/index.d.ts +44 -3
  106. package/dist/local-executor/local-executor-impl.d.ts +645 -4
  107. package/dist/local-executor/merge-conflict-extract.d.ts +34 -0
  108. package/dist/local-executor/merge-conflict-resolve.d.ts +101 -0
  109. package/dist/local-executor/merge-journal-store.d.ts +311 -0
  110. package/dist/local-executor/merge-train.d.ts +713 -0
  111. package/dist/local-executor/promote-wal-store.d.ts +301 -0
  112. package/dist/local-executor/resolution-set-index.d.ts +51 -0
  113. package/dist/local-executor/revert-reconcile.d.ts +89 -0
  114. package/dist/local-executor/revert-runner.d.ts +17 -0
  115. package/dist/local-executor/shared-contract-detector.d.ts +57 -0
  116. package/dist/local-executor/spawn.d.ts +29 -1
  117. package/dist/local-executor/task-group-types.d.ts +346 -0
  118. package/dist/local-executor/team-execution-flag.d.ts +21 -0
  119. package/dist/local-executor/track-registry.d.ts +50 -0
  120. package/dist/local-executor/types.d.ts +238 -4
  121. package/dist/local-executor/wb2-review-bundle.d.ts +59 -0
  122. package/dist/local-executor/workspace-shadow.d.ts +290 -0
  123. package/dist/local-executor/worktree-merge.d.ts +601 -0
  124. package/dist/local-model/__tests__/installer.test.d.ts +1 -0
  125. package/dist/local-model/__tests__/manager.test.d.ts +1 -0
  126. package/dist/local-model/__tests__/ollama.test.d.ts +1 -0
  127. package/dist/local-model/__tests__/runtime.test.d.ts +1 -0
  128. package/dist/local-model/__tests__/state.test.d.ts +1 -0
  129. package/dist/local-model/manager.d.ts +119 -0
  130. package/dist/local-model/ollama.d.ts +27 -0
  131. package/dist/local-model/runtime.d.ts +27 -0
  132. package/dist/local-model/state.d.ts +32 -0
  133. package/dist/orchestration/detect-agents.d.ts +15 -2
  134. package/dist/orchestration/setup-types.d.ts +2 -1
  135. package/dist/orchestration-shell/__tests__/attachments.test.d.ts +1 -0
  136. package/dist/orchestration-shell/__tests__/audit-browser.test.d.ts +1 -0
  137. package/dist/orchestration-shell/__tests__/audited-path-fixes.test.d.ts +1 -0
  138. package/dist/orchestration-shell/__tests__/bracketed-paste.test.d.ts +1 -0
  139. package/dist/orchestration-shell/__tests__/cli-group-halt-wiring.test.d.ts +1 -0
  140. package/dist/orchestration-shell/__tests__/cli-orchestration-session-bootstrap.test.d.ts +1 -0
  141. package/dist/orchestration-shell/__tests__/cli-probe-group-status.test.d.ts +1 -0
  142. package/dist/orchestration-shell/__tests__/cli-quorum-loop-tier.test.d.ts +1 -0
  143. package/dist/orchestration-shell/__tests__/cli-verdict-classifier-wiring.test.d.ts +1 -0
  144. package/dist/orchestration-shell/__tests__/context-store.test.d.ts +1 -0
  145. package/dist/orchestration-shell/__tests__/cp10-585-accept-echo-target.test.d.ts +1 -0
  146. package/dist/orchestration-shell/__tests__/cp10-585-loop.test.d.ts +1 -0
  147. package/dist/orchestration-shell/__tests__/cp10-585-prompts.test.d.ts +1 -0
  148. package/dist/orchestration-shell/__tests__/cp12-w2b-team-loop.test.d.ts +1 -0
  149. package/dist/orchestration-shell/__tests__/cp12-w4-team-recovery.test.d.ts +1 -0
  150. package/dist/orchestration-shell/__tests__/cp1f-quorum-loop.test.d.ts +1 -0
  151. package/dist/orchestration-shell/__tests__/cp606-team-track-user-resolved.test.d.ts +1 -0
  152. package/dist/orchestration-shell/__tests__/cp7-reviewer-substrate.test.d.ts +1 -0
  153. package/dist/orchestration-shell/__tests__/declared-test-runner.test.d.ts +1 -0
  154. package/dist/orchestration-shell/__tests__/familiarize-routing.test.d.ts +1 -0
  155. package/dist/orchestration-shell/__tests__/gate-decision-submit.test.d.ts +1 -0
  156. package/dist/orchestration-shell/__tests__/gate-details-panel.test.d.ts +1 -0
  157. package/dist/orchestration-shell/__tests__/gate-verdict-details-dispatch.test.d.ts +1 -0
  158. package/dist/orchestration-shell/__tests__/group-decision-submit.test.d.ts +1 -0
  159. package/dist/orchestration-shell/__tests__/image-attach-e2e.test.d.ts +1 -0
  160. package/dist/orchestration-shell/__tests__/input-bar-autocomplete.test.d.ts +1 -0
  161. package/dist/orchestration-shell/__tests__/live-region-cap.test.d.ts +1 -0
  162. package/dist/orchestration-shell/__tests__/live-static-order.test.d.ts +1 -0
  163. package/dist/orchestration-shell/__tests__/model-cli.test.d.ts +1 -0
  164. package/dist/orchestration-shell/__tests__/non-gate-prompt-routing.test.d.ts +1 -0
  165. package/dist/orchestration-shell/__tests__/orchestration-app-group-decision-transport.test.d.ts +1 -0
  166. package/dist/orchestration-shell/__tests__/orchestration-app-layout.test.d.ts +1 -0
  167. package/dist/orchestration-shell/__tests__/reissue-team-retained-spec.test.d.ts +1 -0
  168. package/dist/orchestration-shell/__tests__/review-summary-render.test.d.ts +1 -0
  169. package/dist/orchestration-shell/__tests__/reviewer-wizard.test.d.ts +1 -0
  170. package/dist/orchestration-shell/__tests__/reviewers-format.test.d.ts +1 -0
  171. package/dist/orchestration-shell/__tests__/root-discovery.test.d.ts +1 -0
  172. package/dist/orchestration-shell/__tests__/serialize-submissions.test.d.ts +1 -0
  173. package/dist/orchestration-shell/__tests__/slash-suggest.test.d.ts +1 -0
  174. package/dist/orchestration-shell/__tests__/status-format.test.d.ts +1 -0
  175. package/dist/orchestration-shell/__tests__/task-progress.test.d.ts +1 -0
  176. package/dist/orchestration-shell/__tests__/team-decompose-routing.test.d.ts +1 -0
  177. package/dist/orchestration-shell/__tests__/team-decompose-types.test.d.ts +1 -0
  178. package/dist/orchestration-shell/__tests__/team-decompose.test.d.ts +1 -0
  179. package/dist/orchestration-shell/__tests__/team-e2e-smoke.test.d.ts +1 -0
  180. package/dist/orchestration-shell/__tests__/tier2-reviewer-selection.test.d.ts +1 -0
  181. package/dist/orchestration-shell/__tests__/web-browsing.test.d.ts +1 -0
  182. package/dist/orchestration-shell/attachments.d.ts +152 -0
  183. package/dist/orchestration-shell/audit-browser.d.ts +115 -0
  184. package/dist/orchestration-shell/audit-runner.d.ts +59 -0
  185. package/dist/orchestration-shell/bracketed-paste.d.ts +26 -0
  186. package/dist/orchestration-shell/cli.d.ts +336 -1
  187. package/dist/orchestration-shell/cli.js +39318 -3436
  188. package/dist/orchestration-shell/components/AuditLogPanel.d.ts +11 -0
  189. package/dist/orchestration-shell/components/ConversationPane.d.ts +7 -1
  190. package/dist/orchestration-shell/components/GateDetailsPanel.d.ts +57 -0
  191. package/dist/orchestration-shell/components/GatePanelEntry.d.ts +9 -0
  192. package/dist/orchestration-shell/components/GatePromptEntry.d.ts +7 -0
  193. package/dist/orchestration-shell/components/InputBar.d.ts +17 -3
  194. package/dist/orchestration-shell/components/LiveProgressLine.d.ts +8 -0
  195. package/dist/orchestration-shell/components/MultiTrackStatusNode.d.ts +8 -0
  196. package/dist/orchestration-shell/components/OrchestrationApp.d.ts +81 -15
  197. package/dist/orchestration-shell/components/ReviewerSetupWizard.d.ts +24 -0
  198. package/dist/orchestration-shell/components/StatusBar.d.ts +15 -2
  199. package/dist/orchestration-shell/context-store.d.ts +389 -0
  200. package/dist/orchestration-shell/declared-test-runner.d.ts +84 -0
  201. package/dist/orchestration-shell/emit-shell-event.d.ts +1 -1
  202. package/dist/orchestration-shell/gate-decision-submit.d.ts +245 -0
  203. package/dist/orchestration-shell/gate-prompts.d.ts +361 -3
  204. package/dist/orchestration-shell/index.d.ts +613 -1
  205. package/dist/orchestration-shell/ink-runtime.d.ts +21 -1
  206. package/dist/orchestration-shell/live-region-cap.d.ts +70 -0
  207. package/dist/orchestration-shell/live-static-order.d.ts +22 -0
  208. package/dist/orchestration-shell/non-tty-fallback.d.ts +21 -0
  209. package/dist/orchestration-shell/quorum-loop.d.ts +1900 -0
  210. package/dist/orchestration-shell/root-discovery.d.ts +25 -0
  211. package/dist/orchestration-shell/route-browse.d.ts +20 -0
  212. package/dist/orchestration-shell/slash-router.d.ts +20 -1
  213. package/dist/orchestration-shell/slash-routes/continuation.d.ts +71 -0
  214. package/dist/orchestration-shell/slash-routes/reviewers.d.ts +41 -0
  215. package/dist/orchestration-shell/slash-suggest.d.ts +29 -0
  216. package/dist/orchestration-shell/status-format.d.ts +59 -0
  217. package/dist/orchestration-shell/task-progress.d.ts +122 -0
  218. package/dist/orchestration-shell/team-decompose.d.ts +196 -0
  219. package/dist/orchestration-shell/types.d.ts +363 -3
  220. package/dist/orchestration-shell/vendor/ink-parse-keypress.d.ts +42 -0
  221. package/dist/orchestration-shell/web/extract.d.ts +11 -0
  222. package/dist/orchestration-shell/web/fetch.d.ts +15 -0
  223. package/dist/orchestration-shell/web/ip.d.ts +26 -0
  224. package/dist/orchestration-shell/web/sanitize.d.ts +14 -0
  225. package/dist/orchestration-shell/web/search.d.ts +16 -0
  226. package/dist/planner/__tests__/local-gemma.test.d.ts +1 -0
  227. package/dist/planner/index.d.ts +2 -0
  228. package/dist/planner/local-advisory.d.ts +84 -0
  229. package/dist/planner/local-gemma.d.ts +23 -0
  230. package/dist/planner/types.d.ts +16 -6
  231. package/dist/reviewer/__tests__/antigravity-provider.test.d.ts +1 -0
  232. package/dist/reviewer/__tests__/claude-provider-json.test.d.ts +1 -0
  233. package/dist/reviewer/__tests__/cp7-reviewer-sandbox.test.d.ts +1 -0
  234. package/dist/reviewer/__tests__/output-parser-classifier-helpers.test.d.ts +1 -0
  235. package/dist/reviewer/__tests__/verdict-classifier.test.d.ts +1 -0
  236. package/dist/reviewer/index.d.ts +2 -0
  237. package/dist/reviewer/output-parser.d.ts +48 -12
  238. package/dist/reviewer/provider.d.ts +107 -3
  239. package/dist/reviewer/providers/__tests__/failure-classifier.test.d.ts +1 -0
  240. package/dist/reviewer/providers/antigravity.d.ts +49 -0
  241. package/dist/reviewer/providers/claude.d.ts +19 -4
  242. package/dist/reviewer/providers/codex.d.ts +47 -5
  243. package/dist/reviewer/providers/failure-classifier.d.ts +26 -0
  244. package/dist/reviewer/providers/gemini.d.ts +5 -4
  245. package/dist/reviewer/registry.d.ts +5 -5
  246. package/dist/reviewer/subprocess.d.ts +37 -0
  247. package/dist/reviewer/token-usage.d.ts +32 -0
  248. package/dist/reviewer/types.d.ts +5 -5
  249. package/dist/reviewer/verdict-classifier.d.ts +62 -0
  250. package/dist/session/__tests__/prepare-event-timestamp.test.d.ts +1 -0
  251. package/dist/session/index.d.ts +1 -0
  252. package/dist/session/prepare-event-timestamp.d.ts +30 -0
  253. package/dist/substrate/__tests__/docker.test.d.ts +1 -0
  254. package/dist/substrate/__tests__/forwarder.test.d.ts +1 -0
  255. package/dist/substrate/__tests__/git-proxy.test.d.ts +1 -0
  256. package/dist/substrate/__tests__/sandbox-exec.test.d.ts +1 -0
  257. package/dist/substrate/__tests__/substrate-e2e.integration.test.d.ts +1 -0
  258. package/dist/substrate/command-runner.d.ts +19 -0
  259. package/dist/substrate/docker.d.ts +134 -0
  260. package/dist/substrate/errors.d.ts +33 -0
  261. package/dist/substrate/forwarder.d.ts +67 -0
  262. package/dist/substrate/git-proxy.d.ts +35 -0
  263. package/dist/substrate/index.d.ts +12 -0
  264. package/dist/substrate/relay-script.d.ts +27 -0
  265. package/dist/substrate/sandbox-exec.d.ts +116 -0
  266. package/dist/substrate/types.d.ts +218 -0
  267. package/dist/substrate-launch/__tests__/apikey-bootstrap.test.d.ts +1 -0
  268. package/dist/substrate-launch/__tests__/creditless-loop.integration.test.d.ts +1 -0
  269. package/dist/substrate-launch/__tests__/engage-substrate.test.d.ts +1 -0
  270. package/dist/substrate-launch/__tests__/fallback-ladder.test.d.ts +1 -0
  271. package/dist/substrate-launch/__tests__/le-env-scrub.test.d.ts +1 -0
  272. package/dist/substrate-launch/__tests__/sanitized-env.test.d.ts +1 -0
  273. package/dist/substrate-launch/apikey-bootstrap.d.ts +84 -0
  274. package/dist/substrate-launch/engage-substrate.d.ts +102 -0
  275. package/dist/substrate-launch/fallback-ladder.d.ts +49 -0
  276. package/dist/substrate-launch/index.d.ts +12 -0
  277. package/dist/substrate-launch/le-env-scrub.d.ts +77 -0
  278. package/dist/substrate-launch/sanitized-env.d.ts +73 -0
  279. package/dist/types/auth.d.ts +6 -1
  280. package/dist/types/events.d.ts +3 -1
  281. package/dist/types/reviewer.d.ts +6 -6
  282. package/package.json +7 -3
@@ -0,0 +1,141 @@
1
+ /**
2
+ * The vendor providers Rung 1 brokers. Claude + Codex (Anthropic +
3
+ * OpenAI) only — Gemini stays out of the substrate (§6 Q4, agy is
4
+ * reduced-trust).
5
+ */
6
+ export type VendorProvider = "anthropic" | "openai";
7
+ /** A route the broker serves. */
8
+ export type BrokerRouteMethod = "POST" | "GET";
9
+ /**
10
+ * The locked broker route table (§3.2). Declared as data-shape types so
11
+ * the W1 gateway and any conformance test agree on the surface without
12
+ * a contract reopen.
13
+ */
14
+ export interface BrokerRoute {
15
+ method: BrokerRouteMethod;
16
+ path: "/v1/messages" | "/v1/responses" | "/healthz";
17
+ /** Whether the route requires a valid agent→broker token. */
18
+ auth: "broker_token" | "none";
19
+ }
20
+ /**
21
+ * The broker's locked route table — exactly three routes (§3.2). Any
22
+ * other method+path → 403.
23
+ */
24
+ export declare const BROKER_ROUTES: readonly BrokerRoute[];
25
+ /**
26
+ * The broker's HTTP status taxonomy (§3.2 + §3.2 upstream-auth note).
27
+ * Declared as a typed enum so the W1 gateway and reviewers share one
28
+ * source of truth for the fail-closed status mapping.
29
+ */
30
+ export type BrokerStatus = 200 | 400 | 401 | 403 | 502 | 503;
31
+ /**
32
+ * An inbound request to the broker. `method`/`path` are **raw HTTP
33
+ * strings**, deliberately NOT narrowed to `BROKER_ROUTES` (Codex W0 R1):
34
+ * the §3.2 contract is "everything else → 403", so the type MUST be able
35
+ * to represent a *disallowed* route for the W1 gateway's `handle()` to be
36
+ * conformance-testable (send `/v1/admin` / `DELETE` → assert 403). Only
37
+ * the three `(method, path)` pairs in `BROKER_ROUTES` are forwarded; every
38
+ * other request fails closed at 403.
39
+ */
40
+ export interface BrokerRequest {
41
+ method: string;
42
+ path: string;
43
+ /** Opaque short-lived agent→broker token (§3.3); absent for `/healthz`. */
44
+ brokerToken?: string;
45
+ /** Model-bound JSON body (the only carried-through surface, §3.4). */
46
+ body?: unknown;
47
+ /**
48
+ * Agent-supplied headers (lowercased keys), if the transport surfaced
49
+ * any. The §3.4 canonical constructor DROPS all of them except an
50
+ * exact-allowlist beta token; carried on the wire type so `handle()`'s
51
+ * canonicalization is conformance-testable (assert the agent's
52
+ * `authorization` / `x-api-key` / unknown headers do not reach upstream).
53
+ */
54
+ agentHeaders?: Readonly<Record<string, string>>;
55
+ /** Agent-supplied query params, if any. ALL are dropped (§3.4). */
56
+ agentQuery?: Readonly<Record<string, string>>;
57
+ /** Agent-declared content type, if surfaced. Non-JSON → 400 (§3.4). */
58
+ agentContentType?: string;
59
+ }
60
+ /** Response from a broker model-gateway route. */
61
+ export interface BrokerResponse {
62
+ status: BrokerStatus;
63
+ /** Upstream model-bound JSON body on 200; an error envelope otherwise. */
64
+ body?: unknown;
65
+ }
66
+ /**
67
+ * The lifecycle surface of the per-session local broker daemon (§3.2).
68
+ * The LE starts one broker per session on `127.0.0.1:<ephemeral>` and
69
+ * tears it down at session end. Signatures only in W0.
70
+ */
71
+ export interface ModelGatewayBroker {
72
+ /** Start listening on an ephemeral loopback port; resolve the bound addr. */
73
+ start(): Promise<{
74
+ hostBrokerAddr: string;
75
+ }>;
76
+ /** Liveness — the LE waits for this before launching the agent. */
77
+ healthz(): Promise<boolean>;
78
+ /** Handle one model-gateway request (the §3.2 route surface). */
79
+ handle(req: BrokerRequest): Promise<BrokerResponse>;
80
+ /** Tear down; zeroize the in-process upstream credential (§3.3). */
81
+ stop(): Promise<void>;
82
+ }
83
+ /**
84
+ * The provider-scoped vendor-key storage API (§3.3) — [NEW], owner W1.
85
+ * Reuses the existing keychain backend (OS keyring + file fallback).
86
+ * Signatures only in W0; the implementation (keychain accounts
87
+ * `vendor-key-<provider>`) lands in W1.
88
+ */
89
+ export interface VendorKeyStore {
90
+ /**
91
+ * Read the user's vendor key for `provider` from the keychain. Returns
92
+ * `null` when no key is present — the broker then fails closed (503),
93
+ * NEVER a silent fallback to an ambient `ANTHROPIC_API_KEY` /
94
+ * `OPENAI_API_KEY` (that would re-introduce the I1 ambient-cred path).
95
+ */
96
+ getVendorKey(provider: VendorProvider): Promise<string | null>;
97
+ /** Persist the user's vendor key for `provider` (one-time setup step). */
98
+ setVendorKey(provider: VendorProvider, key: string): Promise<void>;
99
+ }
100
+ /**
101
+ * The agent→broker token (§3.3): per-session, broker-minted, opaque,
102
+ * short-lived. Authenticates the agent to the LOCAL broker only — it is
103
+ * NOT a vendor credential.
104
+ */
105
+ export interface BrokerToken {
106
+ /** Opaque token value emitted to the agent's apiKeyHelper / `[auth]` hook. */
107
+ readonly value: string;
108
+ /** Epoch-ms expiry; the helper refreshes on expiry / on a broker 401. */
109
+ readonly expiresAtMs: number;
110
+ }
111
+ /**
112
+ * The result of a broker→vendor upstream call. The broker maps upstream
113
+ * status to the agent-facing `BrokerStatus` (§3.2): an upstream 401/403
114
+ * (bad/expired vendor key) → 502 (NOT a pass-through), every other status
115
+ * carries through.
116
+ */
117
+ export interface UpstreamResponse {
118
+ /** Raw upstream HTTP status. */
119
+ status: number;
120
+ /** Parsed JSON body (model-bound). */
121
+ body?: unknown;
122
+ }
123
+ /**
124
+ * The broker→vendor upstream HTTP client (§3.3/§3.4). INJECTED so W1 tests
125
+ * use a stub (no real network). The real fetch-backed client lands when
126
+ * the broker is wired into the LE; W1 only depends on this interface.
127
+ */
128
+ export interface UpstreamClient {
129
+ /**
130
+ * POST the canonical request upstream. `headers` already includes the
131
+ * synthesized vendor/version headers AND the injected upstream
132
+ * credential (the caller adds the credential header). Resolves with the
133
+ * upstream status + body; rejects only on a transport/network error
134
+ * (which the broker maps to its forward-error path).
135
+ */
136
+ post(args: {
137
+ url: string;
138
+ headers: Readonly<Record<string, string>>;
139
+ body: unknown;
140
+ }): Promise<UpstreamResponse>;
141
+ }
@@ -0,0 +1,20 @@
1
+ import type { UpstreamClient, UpstreamResponse } from "./types";
2
+ /**
3
+ * The production fetch-backed {@link UpstreamClient}. Constructed once per
4
+ * broker session by the LE and injected into `LocalModelGatewayBroker`
5
+ * (replacing the W1 stub).
6
+ */
7
+ export declare class FetchUpstreamClient implements UpstreamClient {
8
+ private readonly opts;
9
+ constructor(opts?: {
10
+ /** Injectable for tests (default: global `fetch`). */
11
+ fetchFn?: typeof fetch;
12
+ /** Per-request timeout (ms). */
13
+ timeoutMs?: number;
14
+ });
15
+ post(args: {
16
+ url: string;
17
+ headers: Readonly<Record<string, string>>;
18
+ body: unknown;
19
+ }): Promise<UpstreamResponse>;
20
+ }
@@ -0,0 +1,54 @@
1
+ import type { VendorKeyStore, VendorProvider } from "./types";
2
+ /**
3
+ * Keychain-backed implementation of {@link VendorKeyStore} (§3.3). Reads
4
+ * the same keychain service the rest of CodeVibe uses (`getConfig()
5
+ * .keychain.serviceName`) so vendor keys live alongside the existing
6
+ * device identity + OAuth tokens under one auditable backend.
7
+ *
8
+ * r5 HIGH-1 / r6 HIGH-2 (Codex): unlike the OAuth-token storage, the vendor
9
+ * key is KEYCHAIN-ONLY at rest for BOTH read and write — `setVendorKey`
10
+ * (write) and `getVendorKey` (read) BOTH require the real OS keychain and
11
+ * FAIL CLOSED rather than touch the plaintext file backend (see the two
12
+ * methods + file header). The agent can never REACH the key at runtime on any
13
+ * substrate (A1 never mounts `~/.codevibe`; A5 denies it in the Seatbelt
14
+ * profile).
15
+ */
16
+ export declare class KeychainVendorKeyStore implements VendorKeyStore {
17
+ private get serviceName();
18
+ /**
19
+ * Read the user's vendor key from the keychain. Returns `null` when no
20
+ * key is present (the broker fails closed — 503). Backend errors
21
+ * (keyring unavailable, corrupted store) propagate to the caller, same
22
+ * as `KeychainManager.getTokens` — a hard config failure the user must
23
+ * see, NOT a silent "no key" that would mask a broken keychain.
24
+ *
25
+ * NO ambient-env fallback (I1): a missing key is `null`, full stop.
26
+ *
27
+ * r6 HIGH-2 (Codex): KEYCHAIN-ONLY on the READ side too. We require the real
28
+ * OS keychain (`getActiveBackendKind() === 'keytar'`) BEFORE reading. On the
29
+ * FILE backend we FAIL CLOSED by returning `null` (the broker then fails
30
+ * closed — 503) and DO NOT read `~/.codevibe/<service>.json` — so a legacy /
31
+ * manually-placed PLAINTEXT vendor key is never sourced from the file store.
32
+ * On a file-backend (headless Linux) box the user supplies the vendor key
33
+ * per-session into broker memory (the documented open item — see file header).
34
+ * SCOPED to the vendor key — the shared backend's OAuth-token file fallback
35
+ * (#29) is untouched (we only call the read-only `getActiveBackendKind`).
36
+ */
37
+ getVendorKey(provider: VendorProvider): Promise<string | null>;
38
+ /**
39
+ * Persist the user's vendor key (one-time setup step). The plaintext
40
+ * value is never logged.
41
+ *
42
+ * r5 HIGH-1 (Codex): FAIL CLOSED if only the FILE backend is available —
43
+ * the broker refuses to write a PLAINTEXT vendor key to
44
+ * `~/.codevibe/<service>.json`. We prefer the REAL OS keychain; if it is
45
+ * unavailable (the file backend is active), we throw rather than silently
46
+ * persisting the key in plaintext (which would break the keychain-only
47
+ * at-rest invariant). This is SCOPED to the vendor key — the shared
48
+ * backend's OAuth-token file fallback (#29) is untouched. r6 HIGH-2: the READ
49
+ * side (`getVendorKey`) is now gated the SAME way (returns `null` on the file
50
+ * backend, no plaintext read); on a fail-closed box the user supplies the key
51
+ * per-session into broker memory.
52
+ */
53
+ setVendorKey(provider: VendorProvider, key: string): Promise<void>;
54
+ }
package/dist/index.d.ts CHANGED
@@ -3,6 +3,7 @@ export { CryptoService, cryptoService, CryptoError, ENCRYPTION_VERSION } from '.
3
3
  export { AppSyncClient, AppSyncGraphQLError, DownloadUrlResponse } from './appsync';
4
4
  export { queries, mutations, subscriptions } from './appsync';
5
5
  export { AuthService, authService } from './auth';
6
+ export { bindOAuthServer, PRIMARY_PORT, PORT_RANGE_SIZE } from './auth';
6
7
  export { runAuthCli } from './auth';
7
8
  export { fireAuthCompletedBeacon, fireAuthFailedBeacon, markErrorBeaconed, errorWasBeaconed, getErrorReason, } from './auth';
8
9
  export type { AuthFailureReason, AuthStage } from './auth';
@@ -11,14 +12,18 @@ export type { Config, Environment } from './config';
11
12
  export { Logger, logger, createLogger } from './logger';
12
13
  export { parseInteractivePrompt, normalizeSnapshot, } from './prompt-parser';
13
14
  export type { ParsedInteractivePrompt, PromptKind, InteractivePromptOption, } from './prompt-parser';
14
- export { resumeOrCreateSession, prepareSessionEncryption, rekeySessionForNewDevices, startDeviceKeyWatcher, registerDeviceEncryptionKey, } from './session';
15
+ export { resumeOrCreateSession, prepareSessionEncryption, rekeySessionForNewDevices, startDeviceKeyWatcher, registerDeviceEncryptionKey, prepareEventTimestamp, _resetPrepareEventTimestampForTesting, } from './session';
15
16
  export type { ResumeOrCreateSessionInput, ResumeOrCreateSessionResult } from './session';
16
17
  export { detectInstalledAgents, pushDetectedAgents, applyPerSessionOrchestrationOverride, runOrchestrationCli, V1_ORCHESTRATION_PROMPT_KIND, V1_ORCHESTRATION_OPTIONS, mapOptionNumberToUserDecisionKind, mapOptionToUserDecisionKind, } from './orchestration';
17
18
  export type { DetectableAgent, V1OrchestrationOption, V1UserDecisionKind, } from './orchestration';
18
19
  export * as Reviewer from './reviewer';
19
20
  export * as AuditKeys from './audit-keys';
21
+ export * as Substrate from './substrate';
22
+ export * as CredentialBroker from './credential-broker';
23
+ export * as SubstrateLaunch from './substrate-launch';
20
24
  export * from './types';
21
25
  export * as Planner from './planner';
26
+ export * as Continuation from './continuation';
22
27
  export * as StructuralSummary from './structural-summary';
23
28
  export { runOrchestrationShell } from './orchestration-shell';
24
29
  export { runCompanionMode } from './companion-mode';