@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
@@ -1,5 +1,160 @@
1
1
  import { CreateEventInput, CreateSessionInput, UpdateSessionInput, UpdateEventStatusInput, Event, Session, EventSource, DeviceKey, GrantSessionKeyInput, UpdateReviewerPolicyInput, UserReviewerPolicySnapshot } from '../types';
2
2
  import type { PostDecisionAction } from '../orchestration-shell/types';
3
+ import type { CreateTaskGroupInput, CreateTaskGroupResult, SubmitMergeGateVerdictInput, SubmitMergeGateVerdictResult, SubmitTrackVerificationOutcomeInput, SubmitTrackVerificationOutcomeResult, ClaimGroupDecisionInput, ClaimGroupDecisionResult } from '../local-executor/task-group-types';
4
+ import type { ReviewerVerdict, ReviewerRole, AgentKind as ReviewerAgentKind } from '../reviewer/types';
5
+ import type { PlannerDecision } from '../planner/types';
6
+ /**
7
+ * One assigned reviewer seat returned by `getInReviewAssignments`. Mirrors the
8
+ * engine `InReviewAssignment` serde (camelCase) in
9
+ * `codevibe-orchestration-lambda/src/types.rs::InReviewAssignment`.
10
+ */
11
+ export interface InReviewAssignment {
12
+ /** Gate this assignment belongs to (UUID string). */
13
+ gateId: string;
14
+ /** NUMERIC seat-id (0-indexed). */
15
+ seatId: number;
16
+ /** snake_case reviewer lens. */
17
+ role: ReviewerRole;
18
+ /** Lowercase agent kind chosen by the resolver. */
19
+ agentKind: ReviewerAgentKind;
20
+ /** Round number of the gate (0-indexed). */
21
+ round: number;
22
+ }
23
+ /**
24
+ * CP-12 W4 (#593) — one non-terminal team track returned by the team-dispatch
25
+ * recovery queries (`getTaskGroupTracks` / `getInFlightTeamTracks`). A DISTINCT
26
+ * recovery-row type — NOT an extension of the live `TrackAssignedPayload` (so the
27
+ * live Class B contract stays unpolluted). Mirrors the engine handler's camelCase
28
+ * `TeamTrackRecoveryRow` serde:
29
+ * - ALWAYS present: `taskGroupId`, `trackIndex`, `relaunch`, and `encryptedBrief?`
30
+ * (omitted when the track had no description → recovery treats it as an empty
31
+ * brief). `taskGroupId` is on EVERY row (seed-only too) so the desktop keys its
32
+ * recovered brief + corrupt-brief tombstone by `(taskGroupId, trackIndex)` —
33
+ * B.2 aggregates across groups, so a bare `trackIndex` key could cross-blend
34
+ * two groups (#593 Stage-2 r2 Codex MEDIUM).
35
+ * - ONLY when `relaunch === true` (flattened at top level): the full live
36
+ * `TrackAssigned` wire-field set (`taskId`, `implementorAgent`,
37
+ * `ownershipScope`, `isSharedTestOwner`, `stateDir`, `dispatchId`,
38
+ * `dispatchGeneration`, `conflictContext`) PLUS recovery metadata (`gateRunId`,
39
+ * `gateType`). These camelCase keys are byte-identical to the live
40
+ * `TrackAssigned` Class B packet, so `normalizeTrackAssignedWire(row)` accepts
41
+ * a relaunch row directly (it picks the expected keys and ignores the extras).
42
+ *
43
+ * Typed loosely (`unknown` payload past the always-present fields) because the
44
+ * relaunch keys are present-or-absent; the recovery loop runs the shared
45
+ * `normalizeTrackAssignedWire` + `isValidTrackAssignedPayload` validators on the
46
+ * raw row (never a divergent second validator), so the SDK does not re-type them.
47
+ */
48
+ export interface TeamTrackRecoveryRow {
49
+ /**
50
+ * The owning task group's id — present on EVERY row (seed-only + relaunch) so
51
+ * recovered briefs + tombstones key by `(taskGroupId, trackIndex)` and B.2's
52
+ * cross-group aggregation can't collide on a shared `trackIndex` (#593 r2).
53
+ */
54
+ taskGroupId: string;
55
+ trackIndex: number;
56
+ /** Bare base64 ciphertext; absent when the track had no description. */
57
+ encryptedBrief?: string;
58
+ relaunch: boolean;
59
+ /** The round-0 gate id (relaunch rows only) — read off the row by recovery. */
60
+ gateRunId?: string;
61
+ /** `"reviewer_quorum"` (relaunch rows only). */
62
+ gateType?: string;
63
+ /** The relaunch rows carry the full TrackAssigned wire field set (see above). */
64
+ [key: string]: unknown;
65
+ }
66
+ /**
67
+ * PHASE-589/469 W3.1 (RESIDUAL 2 / #589-I) — the `getTaskGroupStatus` result. The
68
+ * group's authoritative TERMINAL status (the engine's snake_case
69
+ * `TaskGroupStatus` label, OR `"unknown"` for a vanished / unowned group) + the
70
+ * persisted halt reason (only on a `halted` group). Mirrors the engine
71
+ * `GetTaskGroupStatusOutput { taskGroupId, status, haltReason? }`. Used by the
72
+ * startup reconcile to drive the offline-lease-timeout auto-revert.
73
+ */
74
+ export interface TaskGroupStatusResult {
75
+ taskGroupId: string;
76
+ status: string;
77
+ haltReason?: string;
78
+ }
79
+ /**
80
+ * PHASE-CP-1-F.1 Part A (LOCK L2) — tolerant `AWSJSON!` object read.
81
+ *
82
+ * AppSync delivers an `AWSJSON!` field to a consumer as EITHER an embedded
83
+ * object/array OR a (possibly double-encoded) JSON string — the producer
84
+ * stringifies the value into the field, and the delivery path may or may not
85
+ * re-wrap it. This mirrors the iOS normalization
86
+ * (`codevibe-ios/.../GraphQLClient.swift:1004-1009`).
87
+ *
88
+ * Coercion rules (the SINGLE AWSJSON object-read path for new nested-AWSJSON
89
+ * consumers):
90
+ * 1. `raw` is already a non-null, non-array object → use it directly.
91
+ * 2. `raw` is a string → `JSON.parse`. If the result is STILL a string
92
+ * (double-encoded) → `JSON.parse` ONCE more (bounded: at most one extra
93
+ * unwrap — a triple-encoded payload is treated as malformed).
94
+ * 3. The final value MUST be a non-null, non-array object → else throw
95
+ * (fail-closed; we never silently accept null/array/scalar).
96
+ *
97
+ * @param raw the AWSJSON field value off the GraphQL response
98
+ * @param op the operation name (for fail-closed error messages)
99
+ */
100
+ export declare function coerceAwsJsonObject(raw: unknown, op: string): Record<string, unknown>;
101
+ /** Result of `getReviewerPrompt` — the DECRYPTED rendered prompt + seat metadata. */
102
+ export interface ReviewerPromptResult {
103
+ gateId: string;
104
+ seatId: number;
105
+ role: ReviewerRole;
106
+ /** Decrypted plaintext rendered prompt (UTF-8) → ReviewerSpec.prompt_template. */
107
+ prompt: string;
108
+ }
109
+ /** One reviewer seat in a round's `reviewers[]` (decrypted). */
110
+ export interface TaskReviewSummaryReviewer {
111
+ /** ReviewerVerdict.seat_id (0-indexed). */
112
+ seatId: number;
113
+ /** ReviewerRole serde (snake_case): architecture | correctness | … */
114
+ role: string;
115
+ /** AgentKind serde (lowercase): claude | codex | gemini. */
116
+ agent: string;
117
+ /** VerdictKind serde (UPPERCASE): APPROVE | REJECT | REVISE | ESCALATE. */
118
+ decision: string;
119
+ /** ReviewerVerdict.reasoning verbatim. */
120
+ reasoning: string;
121
+ /** ReviewerVerdict.suggested_changes (may be empty). */
122
+ suggestedChanges: string[];
123
+ }
124
+ /** One round in the per-round summary (decrypted). */
125
+ export interface TaskReviewSummaryRound {
126
+ /** gate_row.round_number (0-indexed). */
127
+ round: number;
128
+ /** Human-readable concat of problem/proposal/plan/expected-outputs. */
129
+ proposal: string;
130
+ /** Per-seat verdicts for this round. */
131
+ reviewers: TaskReviewSummaryReviewer[];
132
+ /** GateDecision serde: proceed | auto_revise | escalate. */
133
+ outcome: string;
134
+ /** Aggregated REVISE seat findings; present only when outcome==auto_revise. */
135
+ reviseNotes?: string;
136
+ }
137
+ /**
138
+ * Result of `getTaskReviewSummary` — the DECRYPTED per-round review summary the
139
+ * desktop renders at the final-approval gate. Mirrors the engine's allowlist
140
+ * projection; `truncatedForSize`/`omittedRounds` flag the size-cap degrade.
141
+ */
142
+ export interface TaskReviewSummary {
143
+ rounds: TaskReviewSummaryRound[];
144
+ /** The resolution that produced the final-approval prompt (normally proceed). */
145
+ finalOutcome: string;
146
+ /** True when the size cap forced any truncation/omission. */
147
+ truncatedForSize: boolean;
148
+ /** Count of whole oldest rounds dropped under the size cap (0 when none). */
149
+ omittedRounds: number;
150
+ }
151
+ /** Result of `getClassBSigningPublicKey` — the engine's Ed25519 verifier key. */
152
+ export interface ClassBSigningPublicKey {
153
+ /** Base64-encoded raw 32-byte Ed25519 public (verifying) key. */
154
+ publicKeyB64: string;
155
+ /** Rotation-aware key id (matches `signedEnvelope.publicKeyId`). */
156
+ keyId: string;
157
+ }
3
158
  /**
4
159
  * Download URL response
5
160
  */
@@ -31,6 +186,41 @@ export declare class AppSyncGraphQLError extends Error {
31
186
  path?: unknown;
32
187
  });
33
188
  }
189
+ /**
190
+ * PHASE-CP-10-MIN (#585) §2.3 — the parsed cross-device applyUserDecision
191
+ * echo. Mirrors the quorum-core SDK's `UserDecisionAppliedEvent`
192
+ * (`quorum-core/src/types.ts:680`) + the backend `UserDecisionAppliedEvent`
193
+ * (`schema.graphql:1364-1371`): `decision` lowercase, `action` parsed to the
194
+ * typed `PostDecisionAction` via `coerceAwsJsonObject`.
195
+ */
196
+ export interface UserDecisionAppliedEvent {
197
+ sessionId: string;
198
+ taskId: string;
199
+ gateId: string;
200
+ /** Lowercase `UserDecisionKind` string (the wire enum is SCREAMING_SNAKE; coerced to lowercase). */
201
+ decision: string;
202
+ /** The parsed `PostDecisionAction` (from the AWSJSON `payload`). */
203
+ action: PostDecisionAction;
204
+ }
205
+ /**
206
+ * CP-1.f — decides whether a subscribed event should be delivered to the
207
+ * caller's `onEvent` callback.
208
+ *
209
+ * - Companion plugin path (`receiveDesktopEvents` falsy): deliver ONLY
210
+ * MOBILE-source events. The desktop plugin emits its own DESKTOP events and
211
+ * must NOT re-receive them (the 2026-04-14 duplicate-mobile-event fix).
212
+ * - Orchestration shell path (`receiveDesktopEvents` true): ALSO deliver
213
+ * DESKTOP-source events. Engine/backend emits gate prompts via the AppSync
214
+ * SigV4 branch, which stamps `source = DESKTOP` (`emittedBy = SYSTEM`); for
215
+ * an orchestration session those are the ONLY DESKTOP events (the shell
216
+ * originates none), so this is exactly the set of engine-emitted prompts the
217
+ * shell must render. MOBILE events (user messages from the phone) are still
218
+ * delivered in both modes.
219
+ *
220
+ * Pure function so the delivery rule is unit-testable independently of the
221
+ * WebSocket message plumbing.
222
+ */
223
+ export declare function shouldDeliverSubscribedEvent(event: Pick<Event, 'source'>, receiveDesktopEvents: boolean): boolean;
34
224
  /**
35
225
  * Discriminator for the most recent `authenticateWithStoredTokens()`
36
226
  * failure. Lets callers distinguish a genuine "no tokens / refresh
@@ -52,6 +242,7 @@ export type AuthFailureKind = 'no_tokens' | 'refresh_auth_rejected' | 'refresh_n
52
242
  * AppSync GraphQL client with WebSocket subscriptions
53
243
  */
54
244
  export declare class AppSyncClient {
245
+ #private;
55
246
  private authenticated;
56
247
  private currentUserId;
57
248
  private currentEmail;
@@ -80,6 +271,8 @@ export declare class AppSyncClient {
80
271
  private static readonly REFRESH_BACKOFF_MS;
81
272
  private deviceKeyWatcher;
82
273
  private sessionUpdateWatchers;
274
+ private applyUserDecisionWatchers;
275
+ private statusWriteChains;
83
276
  private environment;
84
277
  constructor();
85
278
  /**
@@ -183,6 +376,7 @@ export declare class AppSyncClient {
183
376
  * Update a session
184
377
  */
185
378
  updateSession(input: UpdateSessionInput): Promise<Session>;
379
+ private doUpdateSession;
186
380
  /**
187
381
  * Get a session
188
382
  */
@@ -287,8 +481,15 @@ export declare class AppSyncClient {
287
481
  * (`CLAUDE` / `GEMINI` / `CODEX`). Idempotent — safe to call every
288
482
  * launch. Backend stores in `User.availableAgents`; used later to
289
483
  * derive tier-default reviewer seat assignments.
484
+ *
485
+ * CP-1.f LOCK RP-3 — `replace` semantics. Default `false` keeps the 1.x
486
+ * companion-daemon UNION contract (the backend merges the input into the
487
+ * cross-device set). The orchestration shell passes `true` so the
488
+ * backend SETs `availableAgents` to exactly the input set (REPLACE),
489
+ * dropping any stale agent (e.g. a `GEMINI` from a prior host that would
490
+ * otherwise be composed into the reviewer panel → `spawn gemini ENOENT`).
290
491
  */
291
- updateAvailableAgents(agents: Array<'CLAUDE' | 'GEMINI' | 'CODEX'>): Promise<UserReviewerPolicySnapshot>;
492
+ updateAvailableAgents(agents: Array<'CLAUDE' | 'GEMINI' | 'CODEX' | 'ANTIGRAVITY'>, replace?: boolean): Promise<UserReviewerPolicySnapshot>;
292
493
  /**
293
494
  * CP-5.c — push the per-agent capability snapshot. Dual-write
294
495
  * alongside `updateAvailableAgents` per LOCK #C5-C-4 (the legacy
@@ -418,10 +619,310 @@ export declare class AppSyncClient {
418
619
  decision: string;
419
620
  postAction: PostDecisionAction;
420
621
  }>;
622
+ /**
623
+ * CP-12 §2.1 — create a task group. The server validates disjointness
624
+ * (#C12-2) BEFORE creating any track and returns the
625
+ * `CreateTaskGroupResult` discriminated union (accepted arm with
626
+ * `taskGroupId` + `dispatchedTracks`, or rejected arm with `rejection`).
627
+ *
628
+ * The mutation returns `AWSJSON!` (a stringified JSON value), so the
629
+ * response field is a JSON string parsed here — identical AWSJSON handling
630
+ * to `applyUserDecision` + `recordExecutionEvent`. Validates the input
631
+ * minimally (mirrors the `applyUserDecision` pattern) and surfaces backend
632
+ * rejections as `AppSyncGraphQLError` (thrown by `graphqlRequest`).
633
+ *
634
+ * W2.a ships the SDK surface; the N-track spawn / scheduler wiring that
635
+ * consumes the result is W2.b.
636
+ */
637
+ createTaskGroup(input: CreateTaskGroupInput): Promise<CreateTaskGroupResult>;
638
+ /**
639
+ * CP-12 §2.1 / #C12-8 — submit a MergeGate verdict. The `classification`
640
+ * carries the LE-signed, server-readable structural metadata (the server
641
+ * verifies `classification.signatureB64` against the LE's Class A key
642
+ * before routing); `detail` is the E2E-encrypted human-readable payload.
643
+ * Idempotent replay on `verdictIdempotencyKey`.
644
+ *
645
+ * The mutation returns `AWSJSON!` (the resolved-outcome union as a
646
+ * stringified JSON value); parsed here like `createTaskGroup`. The caller
647
+ * is responsible for building + signing the classification (W2.b builds the
648
+ * real classification; the signing helper is `signMergeClassification` in
649
+ * `local-executor/class-a-sign.ts`). W2.a ships the SDK surface only.
650
+ */
651
+ submitMergeGateVerdict(input: SubmitMergeGateVerdictInput): Promise<SubmitMergeGateVerdictResult>;
652
+ /**
653
+ * PHASE-589/469 W1 (LOCK #589-F) — report that ONE team track HARD-FAILED
654
+ * its own local gate (a declared-test failure or an out-of-scope write). The
655
+ * engine marks the track `Failed` NOW so its existing scheduler drain +
656
+ * group-escalation resolves the group promptly (instead of the slow lease
657
+ * sweeper, with the wrong "timeout" reason). The marker carries NO proposal
658
+ * and MUST NOT fan out to reviewers (#598's guarantee). `outcome` is the
659
+ * CONTENT-FREE closed reason label — NEVER raw test output.
660
+ *
661
+ * The mutation returns `AWSJSON!` (`{ trackState }` as a stringified JSON
662
+ * value); parsed here like `submitMergeGateVerdict`. The desktop caller
663
+ * treats this as BEST-EFFORT (W1): it does not depend on the return to
664
+ * render — it flips its own track + renders the group-terminal from local
665
+ * state; the engine lease sweeper is the backstop if the call fails.
666
+ */
667
+ submitTrackVerificationOutcome(input: SubmitTrackVerificationOutcomeInput): Promise<SubmitTrackVerificationOutcomeResult>;
668
+ /**
669
+ * PHASE-589/469 W3.2 — `claimGroupDecision` two-phase group-escalation resolve
670
+ * (LOCK #589-J). Mirror of `submitTrackVerificationOutcome`'s AWSJSON
671
+ * passthrough shape. CLAIM (`phase:"claim"`) atomically locks the group to the
672
+ * first acting surface; COMMIT (`phase:"commit"`, echoing the CLAIM's
673
+ * `claimToken`) drives the group terminal AFTER the desktop revert side-effect.
674
+ * The optional `*_WITH_NOTES` `notes` ride E2E-encrypted (the engine never
675
+ * decrypts them); they are encrypted by the caller before reaching here.
676
+ */
677
+ claimGroupDecision(input: ClaimGroupDecisionInput, sessionKeyBase64?: string): Promise<ClaimGroupDecisionResult>;
678
+ /**
679
+ * §3.A.1 / §3.C.20 — drive the engine Idle → GatePlanInFlight transition.
680
+ * The planner's `start_task` decision (action + optional gateRequest) is
681
+ * plaintext on the wire (no E2E-sensitive prose beyond the opaque
682
+ * gateRequest blob). Returns the resulting workflow-state label so the
683
+ * caller can confirm the engine spawned a gate plan.
684
+ *
685
+ * CP-1.f LOCK RP-6 — `availableAgents` carries THIS orchestration host's
686
+ * detected coding agents (UPPERCASE `CLAUDE` / `CODEX` / `GEMINI`) so the
687
+ * gate row's availability is stamped race-free from the request, instead
688
+ * of the engine reading the shared per-user `User.availableAgents` field
689
+ * (which a legacy 1.x companion daemon on another device can union a
690
+ * stale agent back into). The `Some([])` vs absent distinction is
691
+ * load-bearing engine-side: pass `[]` (a definitive "nothing detected" →
692
+ * Claude-only fail-safe) rather than omitting the field. The field rides
693
+ * inside `$input` (the `StartTaskInput!` GraphQL type gained
694
+ * `availableAgents: [String]`); the mutation document is unchanged. When
695
+ * `availableAgents` is `undefined` the field is omitted entirely (an
696
+ * older desktop's behavior → engine Users-table fallback).
697
+ */
698
+ startTask(input: {
699
+ taskId: string;
700
+ sessionId: string;
701
+ decision: PlannerDecision;
702
+ availableAgents?: string[];
703
+ }): Promise<{
704
+ workflowState: string;
705
+ }>;
706
+ /**
707
+ * §3.A.3 / §3.C.20 / §3.C.23 — submit the E2E-encrypted implementor proposal
708
+ * for the in-flight gate (round-0 startTask gate OR a round-N+1 revise gate).
709
+ * `rawOutput` is the primary-agent raw output the engine parses + renders.
710
+ * Returns `{ gateId, workflowState }`.
711
+ */
712
+ submitImplementorOutput(input: {
713
+ taskId: string;
714
+ gateId: string;
715
+ sessionId: string;
716
+ roundNumber: number;
717
+ rawOutput: string;
718
+ }, sessionKeyBase64: string): Promise<{
719
+ gateId: string;
720
+ workflowState: string;
721
+ }>;
722
+ /**
723
+ * §3.C.22 — submit one reviewer seat's verdict. The full `ReviewerVerdict`
724
+ * JSON is E2E-encrypted under the session key (#C1F-6). Returns the parsed
725
+ * `GateResolvedEvent.payload` (the discriminated `SubmitReviewerVerdictOutput`
726
+ * — `acknowledged` for seats 1..N-1, `reviewGateResolved` for the last seat).
727
+ */
728
+ submitReviewerVerdict(input: {
729
+ gateId: string;
730
+ sessionId: string;
731
+ seatId: number;
732
+ verdict: ReviewerVerdict;
733
+ }, sessionKeyBase64: string): Promise<unknown>;
734
+ /**
735
+ * §3.A.7 / §3.C.21 — fetch + DECRYPT the engine-rendered reviewer prompt for
736
+ * one seat. `seatId` is the NUMERIC seat (the caller extracts it from the
737
+ * dispatch packet's resolved seat-id string). The engine returns an
738
+ * `EncryptedPayload` (inline-nonce ciphertext of the raw prompt bytes); this
739
+ * decrypts it under the session key → plaintext prompt for the ReviewerSpec.
740
+ *
741
+ * Throws (NotFound surfaced as a GraphQL error) when the pending handle
742
+ * hasn't propagated yet — the caller retries-with-backoff then fail-closed
743
+ * synthesizes ESCALATE (#C1F-8).
744
+ */
745
+ getReviewerPrompt(gateId: string, seatId: number, sessionKeyBase64: string): Promise<ReviewerPromptResult>;
746
+ /**
747
+ * PHASE-CP-1-F.1 Part B (LOCK L3/L6) — fetch + DECRYPT the per-round review
748
+ * summary for a final-approval gate. `gateId` is the final-approval prompt's
749
+ * gateId (the HEAD of the proposal-gate `revision_of` lineage); `taskId` is
750
+ * the auth/scoping anchor. The engine walks the lineage backward, projects an
751
+ * exhaustive allowlist over each round, and returns the E2E-encrypted summary
752
+ * re-keyed for the session.
753
+ *
754
+ * Wire (bare `AWSJSON!`, read via the SAME tolerant `coerceAwsJsonObject` as
755
+ * Part A): `{ taskId, sessionId, summary: { ciphertextB64, sessionId,
756
+ * keyVersion } }`. `summary` is the DEDICATED `TaskReviewSummaryEnvelope`
757
+ * (inline-nonce AES-256-GCM; the 12-byte nonce is prepended INSIDE
758
+ * `ciphertextB64`, NO separate nonce field) — decrypt with
759
+ * `cryptoService.decryptContent` (NOT decryptMetadata), identical to
760
+ * `getReviewerPrompt`. The decrypted plaintext is the §2.3 `{rounds,
761
+ * finalOutcome, …}` object.
762
+ *
763
+ * Throws on a missing/malformed envelope or a decrypt/parse failure — the
764
+ * caller (the base-first dispatch in `orchestration-shell/index.ts`) catches
765
+ * every throw and fails OPEN (the prompt renders with no panel, never
766
+ * ciphertext).
767
+ */
768
+ getTaskReviewSummary(taskId: string, gateId: string, sessionKeyBase64: string): Promise<TaskReviewSummary>;
769
+ /**
770
+ * §3.B.15 / §3.C.18 — fetch the engine's Ed25519 Class-B signing PUBLIC key
771
+ * + rotation-aware keyId. The desktop caches this and verifies every Class B
772
+ * packet's signature against it (fail-closed). No E2E — a public verifier
773
+ * key.
774
+ */
775
+ getClassBSigningPublicKey(): Promise<ClassBSigningPublicKey>;
776
+ /**
777
+ * §3.B.15 / §3.C.21b — the dropped-packet recovery primitive. Returns every
778
+ * seat assigned to the caller across any `in_review` gate of the task; the
779
+ * desktop spawns any seat NOT already running-in-memory or verdict-submitted.
780
+ */
781
+ getInReviewAssignments(taskId: string): Promise<InReviewAssignment[]>;
782
+ /**
783
+ * CP-12 W4 (#593) B.1 — strong (`ConsistentRead`) read of the just-created
784
+ * team group's in-flight tracks. The desktop knows the `taskGroupId`
785
+ * `createTaskGroup` just returned, so this is the deterministic initial-connect
786
+ * recovery for the proven emit-before-subscribe race (no GSI, no eventual
787
+ * consistency). Returns every NON-terminal track as a `TeamTrackRecoveryRow`;
788
+ * the desktop seeds all briefs (PASS 1) and re-launches the relaunch subset
789
+ * (PASS 2). Mirrors `getInReviewAssignments` (`{ tracks: [...] }` wrapper).
790
+ */
791
+ getTaskGroupTracks(taskGroupId: string): Promise<TeamTrackRecoveryRow[]>;
792
+ /**
793
+ * CP-12 W4 (#593) B.2 — discover the caller's in-flight team tracks across
794
+ * UNKNOWN groups (restart / reconnect), via the `session_id-status-index` GSI.
795
+ * The desktop has no remembered `taskGroupId` after a restart, so B.1 cannot
796
+ * fire; this is the only path that recovers a team interrupted by a process
797
+ * restart. Eventual-consistency on the GSI is acceptable (a bounded retry
798
+ * covers propagation, §4.2); the handler always re-reads the authoritative
799
+ * `tg#{group}` row with a `ConsistentRead` before deciding `relaunch`. Returns
800
+ * every NON-terminal track as a `TeamTrackRecoveryRow` (same wrapper).
801
+ */
802
+ getInFlightTeamTracks(sessionId: string): Promise<TeamTrackRecoveryRow[]>;
803
+ /**
804
+ * PHASE-589/469 W3.1 (RESIDUAL 2 / #589-I) — read a team group's authoritative
805
+ * TERMINAL status + halt reason for the startup reconcile. The recovery queries
806
+ * above only surface IN-FLIGHT tracks, so they cannot distinguish a `complete`
807
+ * (kept) group from a `halted` (rejected — incl. a sweeper-driven lease-timeout
808
+ * the desktop MISSED while offline) from a TTL'd one. This reads the group row's
809
+ * status directly so the reconcile can auto-revert a terminal-rejected-but-
810
+ * locally-dirty tree before a backend expiry strands it. CONTENT-FREE (status +
811
+ * halt-reason label only; no decrypt). A vanished / unowned group fails closed
812
+ * server-side to `status: "unknown"`. Mirrors `getTaskGroupTracks` (a top-level
813
+ * `taskGroupId` arg; returns the bare AWSJSON object).
814
+ */
815
+ getTaskGroupStatus(taskGroupId: string): Promise<TaskGroupStatusResult>;
816
+ /**
817
+ * CP-6 LOCK #C6-A-10.4.10.2 — record an LE-written continuation
818
+ * packet's authoritative hash on the backend audit table. Called
819
+ * DIRECTLY by `createContinuationPacketWriter` after the atomic
820
+ * packet write completes; NOT routed through `emitShellEvent` (per
821
+ * §11 row 25).
822
+ *
823
+ * Wire-form per `RecordContinuationPacketWrittenInput`
824
+ * (`schema.graphql:1086-1093`):
825
+ * - `taskId`: ULID/UUID
826
+ * - `offerId`: nullable ULID (None for LE-initiated writes)
827
+ * - `packetHash`: 64-char lowercase hex SHA-256
828
+ * - `packetRelativePath`: relative to `~/.codevibe/tasks/`
829
+ * - `sourceAgent`: CLAUDE | CODEX | GEMINI | ANTIGRAVITY (all four
830
+ * accepted by the Rust handler as of AGY-2.0 Phase C)
831
+ * - `blockedReason`: §6:827 wire value
832
+ * (`quota_exhausted | auth_failed | timeout | user_requested`)
833
+ *
834
+ * Returns the design-locked discriminated union:
835
+ * - `{ kind: 'ok', auditEventId, alreadyExists }` on success
836
+ * - `{ kind: 'error', reason }` on any GraphQL error
837
+ *
838
+ * Does NOT throw — every failure surfaces as `{ kind: 'error' }`.
839
+ * The writer's F-GY-3 contract unlinks the local packet ONLY when
840
+ * this method returns `{ kind: 'error' }`.
841
+ */
842
+ recordContinuationPacketWritten(input: {
843
+ taskId: string;
844
+ offerId: string | null;
845
+ packetHash: string;
846
+ packetRelativePath: string;
847
+ sourceAgent: 'CLAUDE' | 'CODEX' | 'GEMINI' | 'ANTIGRAVITY';
848
+ blockedReason: 'quota_exhausted' | 'auth_failed' | 'timeout' | 'user_requested';
849
+ /**
850
+ * PHASE-CP-10-MIN (#585) M-B — the additive `gateId: ID` input. The
851
+ * handler `fetch_row`s it, cross-checks `gate_row.task_id == input.task_id`,
852
+ * stamps `handoff_pending` (#C10M-14), and emits the handoff prompt for it.
853
+ * Optional (the Rust DTO is `#[serde(default)] gate_id: Option<Uuid>`);
854
+ * required at the handler for #585's two triggers. The mutation passes
855
+ * `{ input }` directly, so the additive field rides without a query change.
856
+ */
857
+ gateId?: string;
858
+ }): Promise<{
859
+ kind: 'ok';
860
+ auditEventId: string;
861
+ alreadyExists: boolean;
862
+ } | {
863
+ kind: 'error';
864
+ reason: string;
865
+ }>;
866
+ /**
867
+ * CP-6 Stage 2 R1 H-1 fix — dedicated existence-check for the
868
+ * `continuation_packet_written` audit row. Replaces the legacy
869
+ * `queryAudit` usage in `packet-reader.ts` which was incompatible
870
+ * with the real backend audit shape (entries[].payload is encrypted,
871
+ * so the reader cannot extract `packet_hash` from the payload to
872
+ * verify F-GY-3).
873
+ *
874
+ * The backend handler computes the dedup_key from the public
875
+ * `(taskId, packetHash)` pair via the same
876
+ * `continuation_packet_written_key` formula used at write time,
877
+ * then does a single DDB point-read on the audit dedup table.
878
+ *
879
+ * Returns the design-locked discriminated union:
880
+ * - `{ kind: 'ok', exists: boolean }` on success
881
+ * - `{ kind: 'error', reason: string }` on any GraphQL/transport
882
+ * error (fail-CLOSED: caller treats this as "unverified" per
883
+ * F-GY-3 — better to refuse the read than silently accept).
884
+ *
885
+ * Does NOT throw — every failure surfaces as `{ kind: 'error' }`
886
+ * (mirrors `recordContinuationPacketWritten` discipline).
887
+ */
888
+ verifyContinuationPacketWritten(input: {
889
+ taskId: string;
890
+ offerId: string | null;
891
+ packetHash: string;
892
+ }): Promise<{
893
+ kind: 'ok';
894
+ exists: boolean;
895
+ } | {
896
+ kind: 'error';
897
+ reason: string;
898
+ }>;
899
+ /**
900
+ * Backend `queryAudit` query — generic audit-row retrieval keyed on
901
+ * `(taskId, sessionId)`. Backend resolver returns AWSJSON; this
902
+ * method parses the string envelope into a typed shape. The AWSJSON
903
+ * contract is best-effort normalized — callers should treat the
904
+ * `rows[]` as untyped and filter on the `kind` / `packet_hash`
905
+ * fields themselves.
906
+ *
907
+ * @deprecated for the CP-6 F-GY-3 verification path — use
908
+ * `verifyContinuationPacketWritten` instead. The legacy
909
+ * `queryAudit` returns encrypted `entries[].payload` shapes that
910
+ * the reader cannot inspect for `packet_hash`. Kept on the client
911
+ * because other CP-6-unrelated code may use it.
912
+ */
913
+ queryAudit(input: {
914
+ taskId: string;
915
+ sessionId: string;
916
+ kind?: string;
917
+ }): Promise<{
918
+ rows: Array<Record<string, unknown>>;
919
+ }>;
421
920
  /**
422
921
  * Subscribe to events for a session
423
922
  */
424
- subscribeToEvents(sessionId: string, onEvent: (event: Event) => void, onError?: (error: Error) => void): () => void;
923
+ subscribeToEvents(sessionId: string, onEvent: (event: Event) => void, onError?: (error: Error) => void, options?: {
924
+ receiveDesktopEvents?: boolean;
925
+ }): () => void;
425
926
  /**
426
927
  * Build WebSocket URL
427
928
  *
@@ -528,6 +1029,35 @@ export declare class AppSyncClient {
528
1029
  private resetSessionUpdateWatcherKeepAlive;
529
1030
  private handleSessionUpdateWatcherError;
530
1031
  private cleanupSessionUpdateWatcherState;
1032
+ /**
1033
+ * PHASE-CP-10-MIN (#585) §2.3 / Codex-H3 — subscribe to the cross-device
1034
+ * `onApplyUserDecision` echo for a session. The orchestration shell uses
1035
+ * this so a FOREIGN (mobile-originated) `continuation_switch_accepted`
1036
+ * decision resumes the desktop that owns the implementor (the shell did NOT
1037
+ * subscribe before; the V1-bridge plugins do via the quorum-core SDK —
1038
+ * `codevibe-claude-plugin/src/server.ts:4493`). Mirrors the
1039
+ * `watchForMobileEnd` per-session watcher (replace-on-duplicate, two-phase
1040
+ * reconnect, keep-alive). Delivers a parsed `UserDecisionAppliedEvent`
1041
+ * (`decision` lowercased; `action` coerced from the AWSJSON payload).
1042
+ * Returns a `stop()` handle (idempotent).
1043
+ */
1044
+ subscribeToApplyUserDecision(sessionId: string, onDecision: (event: UserDecisionAppliedEvent) => void, onError?: (error: Error) => void): {
1045
+ stop: () => void;
1046
+ };
1047
+ private createApplyUserDecisionWatcherConnection;
1048
+ /**
1049
+ * Parse one delivered `onApplyUserDecision` payload into a typed
1050
+ * `UserDecisionAppliedEvent` and fire the callback OFF the message-handler
1051
+ * stack (so a throwing consumer cannot tear down the socket). The `payload`
1052
+ * is the AWSJSON `PostDecisionAction` — coerced with the SAME tolerant
1053
+ * `coerceAwsJsonObject` the `applyUserDecision` mutation uses (no casing
1054
+ * transform, so the snake_case continuation action fields land verbatim).
1055
+ */
1056
+ private handleApplyUserDecisionPayload;
1057
+ private sendApplyUserDecisionWatcherStart;
1058
+ private resetApplyUserDecisionWatcherKeepAlive;
1059
+ private handleApplyUserDecisionWatcherError;
1060
+ private cleanupApplyUserDecisionWatcherState;
531
1061
  private heartbeatTimers;
532
1062
  /**
533
1063
  * Start periodic heartbeat for a session.
@@ -542,6 +1072,30 @@ export declare class AppSyncClient {
542
1072
  * Send a single heartbeat update.
543
1073
  */
544
1074
  private sendHeartbeat;
1075
+ /**
1076
+ * Tear down the mobile-event subscription for a SINGLE session.
1077
+ *
1078
+ * Use this when a session ends or is superseded by a /resume while the
1079
+ * daemon keeps running — cleanupSubscriptions() tears down ALL
1080
+ * subscriptions and is only appropriate on full daemon shutdown.
1081
+ *
1082
+ * Without per-session teardown, an ended session's WebSocket survives in
1083
+ * the still-running daemon. When AppSync idle-closes it (code 1000) the
1084
+ * reconnect path in the start_ack handler re-runs startHeartbeat() and
1085
+ * re-asserts status: ACTIVE — resurrecting the ended session as a
1086
+ * duplicate row that the mobile app shows as a second live session.
1087
+ * cleanupSubscriptionState() sets state.destroyed = true, which is exactly
1088
+ * the flag the start_ack and 'close' handlers check to bail out, so this
1089
+ * closes the resurrection path.
1090
+ *
1091
+ * (Confirmed in production logs 2026-06-04: a resumed-over Claude session
1092
+ * was marked INACTIVE at 00:23:34 and resurrected to ACTIVE at 03:02:05
1093
+ * when its leaked subscription reconnected after an AppSync code-1000
1094
+ * close.)
1095
+ *
1096
+ * Idempotent: a no-op if no subscription is tracked for sessionId.
1097
+ */
1098
+ cleanupSubscription(sessionId: string): void;
545
1099
  /**
546
1100
  * Cleanup all subscriptions and heartbeats
547
1101
  */
@@ -560,27 +1114,84 @@ export declare class AppSyncClient {
560
1114
  * to `onPacket`. Errors during parsing OR transport are forwarded to
561
1115
  * `onError`. Returns an unsubscribe handle.
562
1116
  *
563
- * CP-1.e ships the handler surface + parser; full WebSocket wiring on the
564
- * `subscribeToEvents`-style two-phase reconnect engine completes in CP-2
565
- * Stage A when the hosted producer side comes online. Until then the method
566
- * registers the handler and returns a working unsubscribe — callers (the
567
- * orchestration shell) can wire it during CP-1.e bootstrap with no
568
- * behavioral change once CP-2 lights up the wire.
1117
+ * The `onClassBPacket(userId)` stream delivers EVERY packet for the user —
1118
+ * across ALL of their active sessions. The second `onPacket` argument
1119
+ * surfaces the AppSync `ClassBPacket` ENVELOPE metadata (`sessionId`,
1120
+ * `taskId`, `packetId`, `issuedAt`) so a multi-session consumer (the
1121
+ * orchestration shell) can drop packets that belong to a different session
1122
+ * BEFORE acting on them (CP-12 W3 Stage-2 session-isolation fix). The inner
1123
+ * parsed `packetJson` (the typed `ClassBInbound`) is the FIRST argument and
1124
+ * is unchanged.
1125
+ *
1126
+ * CP-1.f §3.C.17 — the live WebSocket transport is now wired on the same
1127
+ * two-phase reconnect engine that powers `subscribeToEvents` /
1128
+ * `subscribeToDeviceKeyRegistered` (idToken auth via the realtime URL). The
1129
+ * `_deliverClassBPacketForTests` seam is preserved (it routes through the
1130
+ * SAME `classBPacketHandlers` registry the live socket dispatches into), so
1131
+ * unit tests inject packets without standing up a real socket. `onReconnect`
1132
+ * fires after a successful recovery so the shell can run the §3.C.21b
1133
+ * dropped-packet recovery poll.
569
1134
  */
570
1135
  subscribeToClassBPackets(userId: string, handlers: {
571
- onPacket: (packet: unknown) => void | Promise<void>;
1136
+ onPacket: (packet: unknown, envelope: ClassBPacketEnvelopeMeta) => void | Promise<void>;
572
1137
  onError?: (err: Error) => void;
1138
+ onReconnect?: () => void | Promise<void>;
1139
+ /**
1140
+ * CP-12 W4 (#593) — fired on EVERY subscription establishment (initial
1141
+ * connect + reconnect). `isReconnect=false` on the first connect (the
1142
+ * restart-discovery signal B.2 needs), `true` on a reconnect.
1143
+ */
1144
+ onSubscribed?: (isReconnect: boolean) => void | Promise<void>;
573
1145
  }): {
574
1146
  unsubscribe: () => Promise<void>;
575
1147
  };
1148
+ /**
1149
+ * Public stop for the Class B watcher. Used at shell teardown.
1150
+ */
1151
+ stopClassBWatcher(): void;
1152
+ private stopClassBWatcherInternal;
1153
+ private createClassBWatcherConnection;
1154
+ private sendClassBWatcherStart;
1155
+ private resetClassBWatcherKeepAlive;
1156
+ private handleClassBWatcherError;
1157
+ /**
1158
+ * Parse + route one live Class B packet through the registered handler.
1159
+ * Shared by the live WebSocket `data` path AND `_deliverClassBPacketForTests`
1160
+ * so both exercise the exact same parse → onPacket → onError flow.
1161
+ */
1162
+ private dispatchClassBPacket;
576
1163
  /**
577
1164
  * Test seam — deliver a raw envelope payload to the registered handler.
578
1165
  * Used by §7.4 unit tests to assert parse + forward semantics without
579
1166
  * standing up a real WebSocket. Production code path (CP-2) will call the
580
1167
  * same internal flow.
581
1168
  *
1169
+ * `envelope` mirrors the AppSync `ClassBPacket` envelope fields that the
1170
+ * real subscription surfaces (`{ packetId, userId, sessionId, taskId,
1171
+ * issuedAt }`); the wire envelope's `userId` always equals the subscription
1172
+ * `userId`, so it is filled in here. `sessionId` defaults to '' for the
1173
+ * legacy CP-1.e parse/error tests that do not exercise session isolation.
1174
+ *
582
1175
  * @internal
583
1176
  */
584
- _deliverClassBPacketForTests(userId: string, rawPacketJson: string): Promise<void>;
1177
+ _deliverClassBPacketForTests(userId: string, rawPacketJson: string, envelope?: Partial<ClassBPacketEnvelopeMeta>): Promise<void>;
1178
+ private classBWatcher;
585
1179
  private readonly classBPacketHandlers;
586
1180
  }
1181
+ /**
1182
+ * Envelope metadata surfaced alongside each Class B packet — the AppSync
1183
+ * `ClassBPacket` GraphQL type carries `{ packetId, userId, sessionId, taskId,
1184
+ * packetJson, issuedAt }`. `parseClassBPacketPayload` parses `packetJson`
1185
+ * (the inner typed packet); this type carries the OUTER envelope fields the
1186
+ * consumer needs for routing/isolation. `sessionId` is load-bearing for the
1187
+ * orchestration shell's per-session packet filter (CP-12 W3).
1188
+ */
1189
+ export interface ClassBPacketEnvelopeMeta {
1190
+ /** The session this packet was minted for. Used for shell session isolation. */
1191
+ sessionId: string;
1192
+ /** Always equals the subscription `userId`. */
1193
+ userId: string;
1194
+ taskId?: string;
1195
+ packetId?: string;
1196
+ issuedAt?: string;
1197
+ }